diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1997-10-13 15:17:03 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1997-10-13 15:17:03 +0000 |
commit | 9d8c91b749e7a6474aa2a4c54ea85316de126a6a (patch) | |
tree | 4938aca3c51f22c1ecdc4db4c5c8b210e2889585 /usr.bin/w/w.c | |
parent | 570f313ee4da5ca6ec2c986804ecb7b3a3a2dd85 (diff) | |
download | src-test2-9d8c91b749e7a6474aa2a4c54ea85316de126a6a.tar.gz src-test2-9d8c91b749e7a6474aa2a4c54ea85316de126a6a.zip |
Notes
Diffstat (limited to 'usr.bin/w/w.c')
-rw-r--r-- | usr.bin/w/w.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 631378675bc4..1401ef12ea48 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94"; #endif static const char rcsid[] = - "$Id: w.c,v 1.22 1997/09/12 02:22:21 ache Exp $"; + "$Id: w.c,v 1.23 1997/09/12 02:26:12 ache Exp $"; #endif /* not lint */ /* @@ -399,7 +399,7 @@ pr_header(nowp, nusers) { double avenrun[3]; time_t uptime; - int days, hrs, i, mins; + int days, hrs, i, mins, secs; int mib[2]; size_t size; char buf[256]; @@ -431,19 +431,21 @@ pr_header(nowp, nusers) hrs = uptime / 3600; uptime %= 3600; mins = uptime / 60; + secs = uptime % 60; (void)printf(" up"); if (days > 0) (void)printf(" %d day%s,", days, days > 1 ? "s" : ""); if (hrs > 0 && mins > 0) (void)printf(" %2d:%02d,", hrs, mins); - else { - if (hrs > 0) - (void)printf(" %d hr%s,", - hrs, hrs > 1 ? "s" : ""); - if (mins > 0) - (void)printf(" %d min%s,", - mins, mins > 1 ? "s" : ""); - } + else if (hrs > 0) + (void)printf(" %d hr%s,", + hrs, hrs > 1 ? "s" : ""); + else if (mins > 0) + (void)printf(" %d min%s,", + mins, mins > 1 ? "s" : ""); + else + (void)printf(" %d sec%s,", + secs, secs > 1 ? "s" : ""); } /* Print number of users logged in to system */ |