summaryrefslogtreecommitdiffstats
path: root/usr.bin/last
diff options
context:
space:
mode:
authordd <dd@FreeBSD.org>2001-06-14 04:55:26 +0000
committerdd <dd@FreeBSD.org>2001-06-14 04:55:26 +0000
commiteaa2b71bee1a50aeae3ca6a136f5b4f0231947fc (patch)
tree7707c4ee62b4f30a71e6fef6a19594ec4b0e8779 /usr.bin/last
parente98800da9c155b7ea446acfdd6b6b3126a00984e (diff)
downloadFreeBSD-src-eaa2b71bee1a50aeae3ca6a136f5b4f0231947fc.zip
FreeBSD-src-eaa2b71bee1a50aeae3ca6a136f5b4f0231947fc.tar.gz
Silence warnings and minor style fixes. Mostly constify and don't
assume that time_t is a long. Clamp down with WARNS=2. Not objected to by: -audit
Diffstat (limited to 'usr.bin/last')
-rw-r--r--usr.bin/last/Makefile4
-rw-r--r--usr.bin/last/last.c20
2 files changed, 14 insertions, 10 deletions
diff --git a/usr.bin/last/Makefile b/usr.bin/last/Makefile
index edbb66b..0238cdd 100644
--- a/usr.bin/last/Makefile
+++ b/usr.bin/last/Makefile
@@ -1,5 +1,7 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
PROG= last
+WARNS?= 2
.include <bsd.prog.mk>
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index d449679..cb44e9832a 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -34,13 +34,13 @@
*/
#ifndef lint
-static char copyright[] =
+static const char copyright[] =
"@(#) Copyright (c) 1987, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
+static const char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
#endif /* not lint */
#include <sys/param.h>
@@ -86,7 +86,7 @@ struct ttytab {
static long currentout, /* current logout value */
maxrec; /* records to display */
-static char *file = _PATH_WTMP; /* wtmp file */
+static const char *file = _PATH_WTMP; /* wtmp file */
static int sflag = 0; /* show delta in seconds */
static int width = 5; /* show seconds in delta */
static int d_first;
@@ -96,11 +96,12 @@ static time_t snaptime; /* if != 0, we will only
*/
void addarg __P((int, char *));
+time_t dateconv __P((char *));
void hostconv __P((char *));
void onintr __P((int));
char *ttyconv __P((char *));
-time_t dateconv __P((char *));
int want __P((struct utmp *));
+void usage __P((void));
void wtmp __P((void));
void
@@ -196,7 +197,7 @@ wtmp()
long bl;
time_t delta; /* time difference */
int bytes, wfd;
- char *crmsg;
+ const char *crmsg;
char ct[80];
struct tm *tm;
int snapfound = 0; /* found snapshot entry? */
@@ -338,8 +339,8 @@ wtmp()
}
delta = tt->logout - bp->ut_time;
if ( sflag ) {
- printf(" (%8lu)\n",
- delta);
+ printf(" (%8ld)\n",
+ (long)delta);
} else {
tm = gmtime(&delta);
(void) strftime(ct, sizeof(ct),
@@ -349,7 +350,8 @@ wtmp()
printf(" (%s)\n", ct);
else
printf(" (%ld+%s)\n",
- delta / 86400, ct);
+ (long)delta /
+ 86400, ct);
}
}
if (maxrec != -1 && !--maxrec)
@@ -359,7 +361,7 @@ wtmp()
}
}
tm = localtime(&buf[0].ut_time);
- (void) strftime(ct, sizeof(ct), "\nwtmp begins %c\n", tm);
+ (void) strftime(ct, sizeof(ct), "\nwtmp begins %+\n", tm);
printf("%s", ct);
}
OpenPOWER on IntegriCloud