Don't include stdio.h.
[gnulib.git] / lib / readutmp.h
1 /* Declarations for GNU's read utmp module.
2    Copyright (C) 1992-1999 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
17
18 /* Written by jla; revised by djm */
19
20 #ifndef __READUTMP_H__
21 # define __READUTMP_H__
22
23 # ifndef PARAMS
24 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
25 #   define PARAMS(Args) Args
26 #  else
27 #   define PARAMS(Args) ()
28 #  endif
29 # endif
30
31 # include <sys/types.h>
32
33 # ifdef HAVE_UTMPX_H
34 #  include <utmpx.h>
35 #  define UTMP_STRUCT_NAME utmpx
36 #  define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_tv.tv_sec)
37 # else
38 #  include <utmp.h>
39 #  define UTMP_STRUCT_NAME utmp
40 #  define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_time)
41 # endif
42
43 typedef struct UTMP_STRUCT_NAME STRUCT_UTMP;
44
45 # include <time.h>
46 # ifdef HAVE_SYS_PARAM_H
47 #  include <sys/param.h>
48 # endif
49
50 # include <errno.h>
51 # ifndef errno
52 extern int errno;
53 # endif
54
55 # if !defined (UTMP_FILE) && defined (_PATH_UTMP)
56 #  define UTMP_FILE _PATH_UTMP
57 # endif
58
59 # if !defined (WTMP_FILE) && defined (_PATH_WTMP)
60 #  define WTMP_FILE _PATH_WTMP
61 # endif
62
63 # ifdef UTMPX_FILE /* Solaris, SysVr4 */
64 #  undef UTMP_FILE
65 #  define UTMP_FILE UTMPX_FILE
66 # endif
67
68 # ifdef WTMPX_FILE /* Solaris, SysVr4 */
69 #  undef WTMP_FILE
70 #  define WTMP_FILE WTMPX_FILE
71 # endif
72
73 # ifndef UTMP_FILE
74 #  define UTMP_FILE "/etc/utmp"
75 # endif
76
77 # ifndef WTMP_FILE
78 #  define WTMP_FILE "/etc/wtmp"
79 # endif
80
81 # undef PARAMS
82 # if defined (__STDC__) && __STDC__
83 #  define PARAMS(Args) Args
84 # else
85 #  define PARAMS(Args) ()
86 # endif
87
88 extern char *extract_trimmed_name PARAMS ((const STRUCT_UTMP *ut));
89 extern int read_utmp PARAMS ((const char *filename,
90                               int *n_entries, STRUCT_UTMP **utmp_buf));
91
92 #endif /* __READUTMP_H__ */