summaryrefslogtreecommitdiff
path: root/coreutils/who.c
diff options
context:
space:
mode:
authorTim Riker2006-01-25 00:08:53 +0000
committerTim Riker2006-01-25 00:08:53 +0000
commitc1ef7bdd8d002ae0889efcf883d0e1b7faa938d4 (patch)
tree5f329b7d0c7f20ecced0dc7581a9ba6dc720d965 /coreutils/who.c
parentf64ff682a3d58dbb627e760e6fe1ec21d9ccdf61 (diff)
downloadbusybox-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.zip
busybox-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.gz
just whitespace
Diffstat (limited to 'coreutils/who.c')
-rw-r--r--coreutils/who.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/coreutils/who.c b/coreutils/who.c
index 0531326..e2ea227 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
@@ -33,49 +33,49 @@ extern int who_main(int argc, char **argv)
time_t now, idle;
if (argc > 1)
- bb_show_usage();
+ bb_show_usage();
setutent();
devlen = sizeof("/dev/") - 1;
printf("USER TTY IDLE FROM HOST\n");
while ((ut = getutent()) != NULL) {
- char name[40];
+ char name[40];
- if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
- len = strlen(ut->ut_line);
- if (ut->ut_line[0] == '/') {
- strncpy(name, ut->ut_line, len);
- name[len] = '\0';
- strcpy(ut->ut_line, ut->ut_line + devlen);
- } else {
- strcpy(name, "/dev/");
- strncpy(name+devlen, ut->ut_line, len);
- name[devlen+len] = '\0';
- }
+ if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
+ len = strlen(ut->ut_line);
+ if (ut->ut_line[0] == '/') {
+ strncpy(name, ut->ut_line, len);
+ name[len] = '\0';
+ strcpy(ut->ut_line, ut->ut_line + devlen);
+ } else {
+ strcpy(name, "/dev/");
+ strncpy(name+devlen, ut->ut_line, len);
+ name[devlen+len] = '\0';
+ }
- printf("%-10s %-8s ", ut->ut_user, ut->ut_line);
+ printf("%-10s %-8s ", ut->ut_user, ut->ut_line);
- if (stat(name, &st) == 0) {
- now = time(NULL);
- idle = now - st.st_atime;
+ if (stat(name, &st) == 0) {
+ now = time(NULL);
+ idle = now - st.st_atime;
- if (idle < 60)
- printf("00:00m ");
- else if (idle < (60 * 60))
- printf("00:%02dm ", (int)(idle / 60));
- else if (idle < (24 * 60 * 60))
- printf("%02d:%02dm ", (int)(idle / (60 * 60)),
- (int)(idle % (60 * 60)) / 60);
- else if (idle < (24 * 60 * 60 * 365))
- printf("%03ddays ", (int)(idle / (24 * 60 * 60)));
- else
- printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365)));
- } else
- printf("%-8s ", "?");
+ if (idle < 60)
+ printf("00:00m ");
+ else if (idle < (60 * 60))
+ printf("00:%02dm ", (int)(idle / 60));
+ else if (idle < (24 * 60 * 60))
+ printf("%02d:%02dm ", (int)(idle / (60 * 60)),
+ (int)(idle % (60 * 60)) / 60);
+ else if (idle < (24 * 60 * 60 * 365))
+ printf("%03ddays ", (int)(idle / (24 * 60 * 60)));
+ else
+ printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365)));
+ } else
+ printf("%-8s ", "?");
- printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
- }
+ printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
+ }
}
endutent();