diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/efgcvt_r.c | 1 | ||||
-rw-r--r-- | misc/login.c | 2 | ||||
-rw-r--r-- | misc/logout.c | 2 | ||||
-rw-r--r-- | misc/logwtmp.c | 7 | ||||
-rw-r--r-- | misc/utmp.h | 17 |
5 files changed, 23 insertions, 6 deletions
diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c index 2da5e55b0b..6bead573a7 100644 --- a/misc/efgcvt_r.c +++ b/misc/efgcvt_r.c @@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ #include <string.h> #include <ctype.h> #include <math.h> +#include <stdlib.h> int fcvt_r (value, ndigit, decpt, sign, buf, len) diff --git a/misc/login.c b/misc/login.c index 911c2892d2..5b71082c52 100644 --- a/misc/login.c +++ b/misc/login.c @@ -45,7 +45,7 @@ static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; void login(ut) - struct utmp *ut; + const struct utmp *ut; { register int fd; int tty; diff --git a/misc/logout.c b/misc/logout.c index 11da24f1c8..40ae25456f 100644 --- a/misc/logout.c +++ b/misc/logout.c @@ -48,7 +48,7 @@ typedef struct utmp UTMP; int logout(line) - register char *line; + register const char *line; { register int fd; UTMP ut; diff --git a/misc/logwtmp.c b/misc/logwtmp.c index 5b3c8ded11..7734ca9624 100644 --- a/misc/logwtmp.c +++ b/misc/logwtmp.c @@ -37,21 +37,20 @@ static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93"; #include <sys/types.h> #include <sys/file.h> -#include <sys/time.h> #include <sys/stat.h> +#include <time.h> +#include <string.h> #include <unistd.h> #include <utmp.h> void logwtmp(line, name, host) - char *line, *name, *host; + const char *line, *name, *host; { struct utmp ut; struct stat buf; int fd; - time_t time(); - char *strncpy(); if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0) return; diff --git a/misc/utmp.h b/misc/utmp.h index 15c4e4fd3d..cfd9438f5f 100644 --- a/misc/utmp.h +++ b/misc/utmp.h @@ -41,6 +41,8 @@ #ifndef _UTMP_H_ #define _UTMP_H_ +#include <sys/cdefs.h> + #define _PATH_UTMP "/var/run/utmp" #define _PATH_WTMP "/var/log/wtmp" #define _PATH_LASTLOG "/var/log/lastlog" @@ -49,6 +51,8 @@ #define UT_LINESIZE 8 #define UT_HOSTSIZE 16 +__BEGIN_DECLS + struct lastlog { time_t ll_time; char ll_line[UT_LINESIZE]; @@ -62,4 +66,17 @@ struct utmp { long ut_time; }; + +/* Write the given entry into utmp and wtmp. */ +extern void login __P ((const struct utmp *)); + +/* Write the utmp entry to say the user on UT_LINE has logged out. */ +extern int logout __P ((const char *ut_line)); + +/* Append to wtmp an entry for the current time and the given info. */ +extern void logwtmp __P ((const char *ut_line, const char *ut_name, + const char *ut_host)); + +__END_DECLS + #endif /* !_UTMP_H_ */ |