summaryrefslogtreecommitdiff
path: root/usr.bin/last/last.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/last/last.c')
-rw-r--r--usr.bin/last/last.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index 664525f7cb8..b187bf86a86 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: last.c,v 1.12 2000/12/12 09:16:03 deraadt Exp $ */
+/* $OpenBSD: last.c,v 1.13 2001/01/31 17:42:26 deraadt Exp $ */
/* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
#endif
-static char rcsid[] = "$OpenBSD: last.c,v 1.12 2000/12/12 09:16:03 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: last.c,v 1.13 2001/01/31 17:42:26 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -106,6 +106,9 @@ int want __P((struct utmp *, int));
void wtmp __P((void));
void checkargs __P((void));
+#define NAME_WIDTH 8
+#define HOST_WIDTH 32
+
int
main(argc, argv)
int argc;
@@ -286,18 +289,18 @@ wtmp()
if (want(bp, NO)) {
if (seconds) {
printf("%-*.*s %-*.*s %-*.*s %ld \n",
- UT_NAMESIZE, UT_NAMESIZE,
+ NAME_WIDTH, UT_NAMESIZE,
bp->ut_name, UT_LINESIZE,
UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE,
+ HOST_WIDTH, UT_HOSTSIZE,
bp->ut_host, bp->ut_time);
} else {
ct = ctime(&bp->ut_time);
printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s \n",
- UT_NAMESIZE, UT_NAMESIZE,
+ NAME_WIDTH, UT_NAMESIZE,
bp->ut_name, UT_LINESIZE,
UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE,
+ HOST_WIDTH, UT_HOSTSIZE,
bp->ut_host, ct, timesize,
timesize, ct + 11);
}
@@ -315,16 +318,16 @@ wtmp()
if (want(bp, NO)) {
if (seconds) {
printf("%-*.*s %-*.*s %-*.*s %ld \n",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
bp->ut_time);
} else {
ct = ctime(&bp->ut_time);
printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s \n",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
ct, timesize, timesize, ct + 11);
}
if (maxrec && !--maxrec)
@@ -354,16 +357,16 @@ wtmp()
snapfound = 1;
if (seconds) {
printf("%-*.*s %-*.*s %-*.*s %ld ",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
bp->ut_time);
} else {
ct = ctime(&bp->ut_time);
printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s ",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
ct, timesize, timesize, ct + 11);
}
if (!T->logout)