diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2010-11-15 10:57:50 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2010-11-15 10:57:50 +0000 |
commit | 2922b556b0734015db426bbb45aa58ba4048f4e0 (patch) | |
tree | 2ce00d70f762fad07c5ccff4c1532f93a86ebea7 /usr.bin/who | |
parent | bc2f1146b41905d7646e2ad84a9d5162ff8ce2e8 (diff) |
show more of the host, but be careful not to go over 80 cols; ok krw@
Diffstat (limited to 'usr.bin/who')
-rw-r--r-- | usr.bin/who/who.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c index cfdb7dd69f7..88f70943a24 100644 --- a/usr.bin/who/who.c +++ b/usr.bin/who/who.c @@ -1,4 +1,4 @@ -/* $OpenBSD: who.c,v 1.18 2009/10/27 23:59:50 deraadt Exp $ */ +/* $OpenBSD: who.c,v 1.19 2010/11/15 10:57:49 otto Exp $ */ /* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */ /* @@ -59,7 +59,9 @@ int show_labels; /* show column labels */ int show_quick; /* quick, names only */ #define NAME_WIDTH 8 -#define HOST_WIDTH 32 +#define HOST_WIDTH 45 + +int hostwidth = HOST_WIDTH; int main(int argc, char *argv[]) @@ -100,6 +102,11 @@ main(int argc, char *argv[]) if (show_quick) { only_current_term = show_term = show_idle = show_labels = 0; } + + if (show_term) + hostwidth -= 2; + if (show_idle) + hostwidth -= 6; if (show_labels) output_labels(); @@ -245,7 +252,7 @@ output(struct utmp *up) } if (*up->ut_host) - printf(" (%.*s)", HOST_WIDTH, up->ut_host); + printf(" (%.*s)", hostwidth, up->ut_host); (void)putchar('\n'); } @@ -263,7 +270,7 @@ output_labels(void) if (show_idle) (void)printf("IDLE "); - (void)printf(" %.*s", HOST_WIDTH, "FROM"); + (void)printf(" %.*s", hostwidth, "FROM"); (void)putchar('\n'); } |