diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-31 17:42:27 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-31 17:42:27 +0000 |
commit | d613eeedff667aa4c64353fb667b5db1a31e5a25 (patch) | |
tree | a77a0e316c95f23c58a135ba498dec12c9a40ef4 /usr.bin | |
parent | 9337e383d2a63a9fe7f2562ce38cafac86e53c9e (diff) |
move utmp to large format, usernames to 32 chars; downsj
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/last/last.c | 31 | ||||
-rw-r--r-- | usr.bin/w/w.c | 11 | ||||
-rw-r--r-- | usr.bin/who/who.c | 19 |
3 files changed, 35 insertions, 26 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) diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 67029faafa7..833f2008c90 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -1,4 +1,4 @@ -/* $OpenBSD: w.c,v 1.31 2000/12/23 02:07:49 deraadt Exp $ */ +/* $OpenBSD: w.c,v 1.32 2001/01/31 17:42:26 deraadt Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94"; #else -static char *rcsid = "$OpenBSD: w.c,v 1.31 2000/12/23 02:07:49 deraadt Exp $"; +static char *rcsid = "$OpenBSD: w.c,v 1.32 2001/01/31 17:42:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -100,6 +100,9 @@ int sortidle; /* sort bu idle time */ char *sel_user; /* login of particular user selected */ char domain[MAXHOSTNAMELEN]; +#define NAME_WIDTH 8 +#define HOST_WIDTH 16 + /* * One of these per active utmp entry. */ @@ -337,10 +340,10 @@ main(argc, argv) p = buf; } (void)printf("%-*.*s %-2.2s %-*.*s ", - UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name, + NAME_WIDTH, UT_NAMESIZE, ep->utmp.ut_name, strncmp(ep->utmp.ut_line, "tty", 3) ? ep->utmp.ut_line : ep->utmp.ut_line + 3, - UT_HOSTSIZE, UT_HOSTSIZE, *p ? p : "-"); + HOST_WIDTH, HOST_WIDTH, *p ? p : "-"); pr_attime(&ep->utmp.ut_time, &now); pr_idle(ep->idle); pr_args(ep->kp); diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c index f6f9d3e4873..2ca1508355b 100644 --- a/usr.bin/who/who.c +++ b/usr.bin/who/who.c @@ -1,4 +1,4 @@ -/* $OpenBSD: who.c,v 1.9 2000/03/22 17:07:37 millert Exp $ */ +/* $OpenBSD: who.c,v 1.10 2001/01/31 17:42:26 deraadt Exp $ */ /* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: who.c,v 1.9 2000/03/22 17:07:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: who.c,v 1.10 2001/01/31 17:42:26 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -75,6 +75,9 @@ int show_idle; /* show idle time */ int show_labels; /* show column labels */ int show_quick; /* quick, names only */ +#define NAME_WIDTH 8 +#define HOST_WIDTH 32 + int main(argc, argv) int argc; @@ -131,7 +134,7 @@ main(argc, argv) while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { if (*usr.ut_name && *usr.ut_line) { - (void)printf("%-*.*s ", UT_NAMESIZE, + (void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, usr.ut_name); if ((++count % 8) == 0) (void) printf("\n"); @@ -157,7 +160,7 @@ main(argc, argv) while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { if (*usr.ut_name && *usr.ut_line) { - (void)printf("%-*.*s ", UT_NAMESIZE, + (void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, usr.ut_name); if ((++count % 8) == 0) (void) printf("\n"); @@ -241,7 +244,7 @@ output(up) } - (void)printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, up->ut_name); + (void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, up->ut_name); if (show_term) { (void)printf("%c ", state); @@ -262,14 +265,14 @@ output(up) } if (*up->ut_host) - printf("\t(%.*s)", UT_HOSTSIZE, up->ut_host); + printf(" (%.*s)", HOST_WIDTH, up->ut_host); (void)putchar('\n'); } void output_labels() { - (void)printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, "USER"); + (void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, "USER"); if (show_term) (void)printf("S "); @@ -280,7 +283,7 @@ output_labels() if (show_idle) (void)printf("IDLE "); - (void)printf("\t%.*s", UT_HOSTSIZE, "FROM"); + (void)printf(" %.*s", HOST_WIDTH, "FROM"); (void)putchar('\n'); } |