diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-31 20:12:50 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-31 20:12:50 +0000 |
commit | f1da71e6e5d4a285ef07cad59d822a5cd0ee6689 (patch) | |
tree | a173e0234b18ed7c5499d3ab5a977670bd6ecbf3 | |
parent | a32e9365ff905d17a5df19c2b7c7c881be469767 (diff) |
make aware of UT_NAMESIZE
-rw-r--r-- | usr.bin/rwho/rwho.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c index 9e9356fa273..cc711efb510 100644 --- a/usr.bin/rwho/rwho.c +++ b/usr.bin/rwho/rwho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rwho.c,v 1.10 1998/04/26 17:01:02 deraadt Exp $ */ +/* $OpenBSD: rwho.c,v 1.11 2001/01/31 20:12:49 deraadt Exp $ */ /* * Copyright (c) 1983 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rwho.c 5.5 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$OpenBSD: rwho.c,v 1.10 1998/04/26 17:01:02 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rwho.c,v 1.11 2001/01/31 20:12:49 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -52,6 +52,7 @@ static char rcsid[] = "$OpenBSD: rwho.c,v 1.10 1998/04/26 17:01:02 deraadt Exp $ #include <string.h> #include <unistd.h> #include <stdlib.h> +#include <utmp.h> #include <vis.h> #include <err.h> @@ -171,12 +172,12 @@ main(argc, argv) } mp = myutmp; for (i = 0; i < nusers; i++) { - char buf[BUFSIZ], vis_user[4*8]; + char buf[BUFSIZ], vis_user[4*UT_NAMESIZE]; (void)snprintf(buf, sizeof buf, "%s:%s", mp->myhost, mp->myutmp.out_line); strvis(vis_user, mp->myutmp.out_name, VIS_CSTYLE); - printf("%-8.8s %-*s %.12s", - vis_user, + printf("%-*.*s %-*s %.12s", + UT_NAMESIZE, UT_NAMESIZE, vis_user, width, buf, ctime((time_t *)&mp->myutmp.out_time)+4); |