diff options
author | ats <ats@FreeBSD.org> | 1994-12-27 00:53:14 +0000 |
---|---|---|
committer | ats <ats@FreeBSD.org> | 1994-12-27 00:53:14 +0000 |
commit | 32fbcd2a755951192cebd40e20e57606fd7b3bf2 (patch) | |
tree | 83fbbc5998b5e43b2873d41902a2b7cc34a4d8c1 /usr.bin/rwho | |
parent | bc52f83749b31166c2b334be6ad76935f5d261db (diff) | |
download | FreeBSD-src-32fbcd2a755951192cebd40e20e57606fd7b3bf2.zip FreeBSD-src-32fbcd2a755951192cebd40e20e57606fd7b3bf2.tar.gz |
My prevoius commit missed some things. The out_line didn't need
to be padded to 8 chars. Simply make sure that never more than 8 chars
are printed ( %-.8s ). The former commit otherwise hosed the width
calculation and landed on different positions for the time output.
Also the strlen(xx_out_line) hoses the wide
calculation, so that it sometimes make it much larger than necessary.
Simply use always 8 chars for the out_line calculation now. Looks good
this way.
Diffstat (limited to 'usr.bin/rwho')
-rw-r--r-- | usr.bin/rwho/rwho.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c index 6191803..24545cf 100644 --- a/usr.bin/rwho/rwho.c +++ b/usr.bin/rwho/rwho.c @@ -136,7 +136,8 @@ main(argc, argv) mp = myutmp; width = 0; for (i = 0; i < nusers; i++) { - int j = strlen(mp->myhost) + 1 + strlen(mp->myutmp.out_line); + /* append one for the blank and use 8 for the out_line */ + int j = strlen(mp->myhost) + 1 + 8; if (j > width) width = j; mp++; @@ -144,7 +145,7 @@ main(argc, argv) mp = myutmp; for (i = 0; i < nusers; i++) { char buf[BUFSIZ]; - (void)sprintf(buf, "%s:%-8.8s", mp->myhost, mp->myutmp.out_line); + (void)sprintf(buf, "%s:%-.8s", mp->myhost, mp->myutmp.out_line); printf("%-8.8s %-*s %.12s", mp->myutmp.out_name, width, |