Mercurial > hg > octave-shane > gnulib-hg
annotate lib/readutmp.h @ 2226:1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Sun, 30 Jan 2000 16:39:08 +0000 |
parents | ae596af5aea1 |
children | b3a94d16a532 |
rev | line source |
---|---|
981 | 1 /* Declarations for GNU's read utmp module. |
2226
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
2 Copyright (C) 1992-2000 Free Software Foundation, Inc. |
981 | 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 | |
1299 | 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 | |
981 | 31 # include <sys/types.h> |
32 | |
2226
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
33 /* Accessor macro for the member named ut_user or ut_name. */ |
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
34 # if HAVE_STRUCT_UTMPX_UT_USER || HAVE_STRUCT_UTMP_UT_USER |
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
35 # define UT_USER(Utmp) Utmp->ut_user |
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
36 # endif |
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
37 # if HAVE_STRUCT_UTMPX_UT_NAME || HAVE_STRUCT_UTMP_UT_NAME |
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
38 # define UT_USER(Utmp) Utmp->ut_name |
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
39 # endif |
1b6275c2d099
(UT_USER): Define. Accessor macro for the member named ut_user or ut_name.
Jim Meyering <jim@meyering.net>
parents:
1829
diff
changeset
|
40 |
981 | 41 # ifdef HAVE_UTMPX_H |
42 # include <utmpx.h> | |
983
4ef0d1a19429
(PARAMS): Update prototype.
Jim Meyering <jim@meyering.net>
parents:
981
diff
changeset
|
43 # define UTMP_STRUCT_NAME utmpx |
981 | 44 # define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_tv.tv_sec) |
1829
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
45 # define SET_UTMP_ENT setutxent |
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
46 # define GET_UTMP_ENT getutxent |
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
47 # define END_UTMP_ENT endutxent |
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
48 # define UTMP_NAME_FUNCTION utmpxname |
981 | 49 # else |
50 # include <utmp.h> | |
983
4ef0d1a19429
(PARAMS): Update prototype.
Jim Meyering <jim@meyering.net>
parents:
981
diff
changeset
|
51 # define UTMP_STRUCT_NAME utmp |
981 | 52 # define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_time) |
1829
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
53 # define SET_UTMP_ENT setutent |
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
54 # define GET_UTMP_ENT getutent |
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
55 # define END_UTMP_ENT endutent |
ae596af5aea1
Add definitions to help read utmpx on systems with utmpname.
Jim Meyering <jim@meyering.net>
parents:
1711
diff
changeset
|
56 # define UTMP_NAME_FUNCTION utmpname |
981 | 57 # endif |
58 | |
983
4ef0d1a19429
(PARAMS): Update prototype.
Jim Meyering <jim@meyering.net>
parents:
981
diff
changeset
|
59 typedef struct UTMP_STRUCT_NAME STRUCT_UTMP; |
4ef0d1a19429
(PARAMS): Update prototype.
Jim Meyering <jim@meyering.net>
parents:
981
diff
changeset
|
60 |
981 | 61 # include <time.h> |
62 # ifdef HAVE_SYS_PARAM_H | |
63 # include <sys/param.h> | |
64 # endif | |
65 | |
66 # include <errno.h> | |
67 # ifndef errno | |
68 extern int errno; | |
69 # endif | |
70 | |
71 # if !defined (UTMP_FILE) && defined (_PATH_UTMP) | |
72 # define UTMP_FILE _PATH_UTMP | |
73 # endif | |
74 | |
75 # if !defined (WTMP_FILE) && defined (_PATH_WTMP) | |
76 # define WTMP_FILE _PATH_WTMP | |
77 # endif | |
78 | |
79 # ifdef UTMPX_FILE /* Solaris, SysVr4 */ | |
80 # undef UTMP_FILE | |
81 # define UTMP_FILE UTMPX_FILE | |
82 # endif | |
83 | |
84 # ifdef WTMPX_FILE /* Solaris, SysVr4 */ | |
85 # undef WTMP_FILE | |
86 # define WTMP_FILE WTMPX_FILE | |
87 # endif | |
88 | |
89 # ifndef UTMP_FILE | |
90 # define UTMP_FILE "/etc/utmp" | |
91 # endif | |
92 | |
93 # ifndef WTMP_FILE | |
94 # define WTMP_FILE "/etc/wtmp" | |
95 # endif | |
96 | |
97 # undef PARAMS | |
98 # if defined (__STDC__) && __STDC__ | |
99 # define PARAMS(Args) Args | |
100 # else | |
101 # define PARAMS(Args) () | |
102 # endif | |
103 | |
983
4ef0d1a19429
(PARAMS): Update prototype.
Jim Meyering <jim@meyering.net>
parents:
981
diff
changeset
|
104 extern char *extract_trimmed_name PARAMS ((const STRUCT_UTMP *ut)); |
4ef0d1a19429
(PARAMS): Update prototype.
Jim Meyering <jim@meyering.net>
parents:
981
diff
changeset
|
105 extern int read_utmp PARAMS ((const char *filename, |
4ef0d1a19429
(PARAMS): Update prototype.
Jim Meyering <jim@meyering.net>
parents:
981
diff
changeset
|
106 int *n_entries, STRUCT_UTMP **utmp_buf)); |
981 | 107 |
108 #endif /* __READUTMP_H__ */ |