diff options
author | Rob Landley <rob@landley.net> | 2012-11-13 17:14:08 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-11-13 17:14:08 -0600 |
commit | 7aa651a6a4496d848f86de9b1e6b3a003256a01f (patch) | |
tree | 6995fb4b7cc2e90a6706b0239ebaf95d9dbab530 /toys/other/w.c | |
parent | 571b0706cce45716126776d0ad0f6ac65f4586e3 (diff) | |
download | toybox-7aa651a6a4496d848f86de9b1e6b3a003256a01f.tar.gz |
Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
Diffstat (limited to 'toys/other/w.c')
-rw-r--r-- | toys/other/w.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/toys/other/w.c b/toys/other/w.c index 097a4386..c271e8bd 100644 --- a/toys/other/w.c +++ b/toys/other/w.c @@ -1,34 +1,33 @@ -/* vi: set sw=4 ts=4: - * - * w.c - shows logged in users +/* w.c - shows logged in users * * Copyright 2012 Gaurang Shastri <gmshastri@gmail.com> USE_W(NEWTOY(w, NULL, TOYFLAG_USR|TOYFLAG_BIN)) config W - bool "w" - default y - help - usage: w + bool "w" + default y + help + usage: w - Show who is logged on and since how long they logged in. + Show who is logged on and since how long they logged in. */ #include "toys.h" void w_main(void) { - struct utmpx *x; + struct utmpx *x; - xprintf("USER TTY LOGIN@ FROM"); - setutxent(); - while ((x=getutxent()) != NULL) - if (x->ut_type==7) { - time_t tt = x->ut_tv.tv_sec; + xprintf("USER TTY LOGIN@ FROM"); + setutxent(); + while ((x=getutxent()) != NULL) { + if (x->ut_type==7) { + time_t tt = x->ut_tv.tv_sec; - xprintf("\n%-9.8s%-9.8s %-4.24s (%-1.12s)", x->ut_user, x->ut_line, - ctime(&tt), x->ut_host); - } - xputc('\n'); + xprintf("\n%-9.8s%-9.8s %-4.24s (%-1.12s)", x->ut_user, x->ut_line, + ctime(&tt), x->ut_host); + } + } + xputc('\n'); } |