summaryrefslogtreecommitdiff
path: root/usr.bin/who
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-31 17:42:27 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-31 17:42:27 +0000
commitd613eeedff667aa4c64353fb667b5db1a31e5a25 (patch)
treea77a0e316c95f23c58a135ba498dec12c9a40ef4 /usr.bin/who
parent9337e383d2a63a9fe7f2562ce38cafac86e53c9e (diff)
move utmp to large format, usernames to 32 chars; downsj
Diffstat (limited to 'usr.bin/who')
-rw-r--r--usr.bin/who/who.c19
1 files changed, 11 insertions, 8 deletions
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');
}