aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/rwho
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2013-07-03 20:44:47 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2013-07-03 20:44:47 +0000
commitd7499324a813f5a64d5b926c142a028db091afc7 (patch)
treeed747e9b8b2822a45721d3ad94f39be1589a00c8 /usr.bin/rwho
parent7c33a30a7a7f8f6588f739dd372c48c44d84a639 (diff)
downloadsrc-d7499324a813f5a64d5b926c142a028db091afc7.tar.gz
src-d7499324a813f5a64d5b926c142a028db091afc7.zip
Notes
Diffstat (limited to 'usr.bin/rwho')
-rw-r--r--usr.bin/rwho/rwho.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c
index 0d4dde92ef2f..bcb5adb8e919 100644
--- a/usr.bin/rwho/rwho.c
+++ b/usr.bin/rwho/rwho.c
@@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#define NUSERS 1000
-#define WHDRSIZE (ssize_t)(sizeof (wd) - sizeof (wd.wd_we))
+#define WHDRSIZE (ssize_t)(sizeof(wd) - sizeof(wd.wd_we))
/*
* this macro should be shared with ruptime.
*/
@@ -143,18 +143,18 @@ main(int argc, char *argv[])
continue;
if (cap_rights_limit(f, CAP_READ) < 0 && errno != ENOSYS)
err(1, "cap_rights_limit failed: %s", dp->d_name);
- cc = read(f, (char *)&wd, sizeof (struct whod));
+ cc = read(f, (char *)&wd, sizeof(struct whod));
if (cc < WHDRSIZE) {
(void) close(f);
continue;
}
- if (down(w,now) != 0) {
+ if (down(w, now) != 0) {
(void) close(f);
continue;
}
cc -= WHDRSIZE;
we = w->wd_we;
- for (n = cc / sizeof (struct whoent); n > 0; n--) {
+ for (n = cc / sizeof(struct whoent); n > 0; n--) {
if (aflg == 0 && we->we_idle >= 60 * 60) {
we++;
continue;
@@ -170,7 +170,7 @@ main(int argc, char *argv[])
}
(void) close(f);
}
- qsort((char *)myutmp, nusers, sizeof (struct myutmp), utmpcmp);
+ qsort((char *)myutmp, nusers, sizeof(struct myutmp), utmpcmp);
mp = myutmp;
width = 0;
for (i = 0; i < nusers; i++) {
@@ -188,18 +188,14 @@ main(int argc, char *argv[])
time_t t;
t = _int_to_time(mp->myutmp.out_time);
- strftime(cbuf, sizeof(cbuf),
- d_first ? "%e %b %R" : "%b %e %R",
+ strftime(cbuf, sizeof(cbuf), d_first ? "%e %b %R" : "%b %e %R",
localtime(&t));
(void) sprintf(buf, "%s:%-.*s", mp->myhost,
(int)sizeof(mp->myutmp.out_line), mp->myutmp.out_line);
printf("%-*.*s %-*s %s",
(int)sizeof(mp->myutmp.out_name),
(int)sizeof(mp->myutmp.out_name),
- mp->myutmp.out_name,
- width,
- buf,
- cbuf);
+ mp->myutmp.out_name, width, buf, cbuf);
mp->myidle /= 60;
if (mp->myidle != 0) {
if (aflg != 0) {
@@ -224,6 +220,7 @@ main(int argc, char *argv[])
static void
usage(void)
{
+
fprintf(stderr, "usage: rwho [-a]\n");
exit(1);
}
@@ -242,6 +239,6 @@ utmpcmp(const void *u1, const void *u2)
rc = strcmp(MYUTMP(u1)->myhost, MYUTMP(u2)->myhost);
if (rc != 0)
return (rc);
- return (strncmp(MYUTMP(u1)->myutmp.out_line, MYUTMP(u2)->myutmp.out_line,
- sizeof(MYUTMP(u2)->myutmp.out_line)));
+ return (strncmp(MYUTMP(u1)->myutmp.out_line,
+ MYUTMP(u2)->myutmp.out_line, sizeof(MYUTMP(u2)->myutmp.out_line)));
}