diff options
author | Tim Riker <tim@rikers.org> | 2006-01-25 00:08:53 +0000 |
---|---|---|
committer | Tim Riker <tim@rikers.org> | 2006-01-25 00:08:53 +0000 |
commit | c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4 (patch) | |
tree | 5f329b7d0c7f20ecced0dc7581a9ba6dc720d965 /coreutils/who.c | |
parent | f64ff682a3d58dbb627e760e6fe1ec21d9ccdf61 (diff) | |
download | busybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.gz busybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.bz2 busybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.zip |
just whitespace
Diffstat (limited to 'coreutils/who.c')
-rw-r--r-- | coreutils/who.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/coreutils/who.c b/coreutils/who.c index 0531326bd..e2ea227eb 100644 --- a/coreutils/who.c +++ b/coreutils/who.c | |||
@@ -33,49 +33,49 @@ extern int who_main(int argc, char **argv) | |||
33 | time_t now, idle; | 33 | time_t now, idle; |
34 | 34 | ||
35 | if (argc > 1) | 35 | if (argc > 1) |
36 | bb_show_usage(); | 36 | bb_show_usage(); |
37 | 37 | ||
38 | setutent(); | 38 | setutent(); |
39 | devlen = sizeof("/dev/") - 1; | 39 | devlen = sizeof("/dev/") - 1; |
40 | printf("USER TTY IDLE FROM HOST\n"); | 40 | printf("USER TTY IDLE FROM HOST\n"); |
41 | 41 | ||
42 | while ((ut = getutent()) != NULL) { | 42 | while ((ut = getutent()) != NULL) { |
43 | char name[40]; | 43 | char name[40]; |
44 | 44 | ||
45 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { | 45 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { |
46 | len = strlen(ut->ut_line); | 46 | len = strlen(ut->ut_line); |
47 | if (ut->ut_line[0] == '/') { | 47 | if (ut->ut_line[0] == '/') { |
48 | strncpy(name, ut->ut_line, len); | 48 | strncpy(name, ut->ut_line, len); |
49 | name[len] = '\0'; | 49 | name[len] = '\0'; |
50 | strcpy(ut->ut_line, ut->ut_line + devlen); | 50 | strcpy(ut->ut_line, ut->ut_line + devlen); |
51 | } else { | 51 | } else { |
52 | strcpy(name, "/dev/"); | 52 | strcpy(name, "/dev/"); |
53 | strncpy(name+devlen, ut->ut_line, len); | 53 | strncpy(name+devlen, ut->ut_line, len); |
54 | name[devlen+len] = '\0'; | 54 | name[devlen+len] = '\0'; |
55 | } | 55 | } |
56 | 56 | ||
57 | printf("%-10s %-8s ", ut->ut_user, ut->ut_line); | 57 | printf("%-10s %-8s ", ut->ut_user, ut->ut_line); |
58 | 58 | ||
59 | if (stat(name, &st) == 0) { | 59 | if (stat(name, &st) == 0) { |
60 | now = time(NULL); | 60 | now = time(NULL); |
61 | idle = now - st.st_atime; | 61 | idle = now - st.st_atime; |
62 | 62 | ||
63 | if (idle < 60) | 63 | if (idle < 60) |
64 | printf("00:00m "); | 64 | printf("00:00m "); |
65 | else if (idle < (60 * 60)) | 65 | else if (idle < (60 * 60)) |
66 | printf("00:%02dm ", (int)(idle / 60)); | 66 | printf("00:%02dm ", (int)(idle / 60)); |
67 | else if (idle < (24 * 60 * 60)) | 67 | else if (idle < (24 * 60 * 60)) |
68 | printf("%02d:%02dm ", (int)(idle / (60 * 60)), | 68 | printf("%02d:%02dm ", (int)(idle / (60 * 60)), |
69 | (int)(idle % (60 * 60)) / 60); | 69 | (int)(idle % (60 * 60)) / 60); |
70 | else if (idle < (24 * 60 * 60 * 365)) | 70 | else if (idle < (24 * 60 * 60 * 365)) |
71 | printf("%03ddays ", (int)(idle / (24 * 60 * 60))); | 71 | printf("%03ddays ", (int)(idle / (24 * 60 * 60))); |
72 | else | 72 | else |
73 | printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); | 73 | printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); |
74 | } else | 74 | } else |
75 | printf("%-8s ", "?"); | 75 | printf("%-8s ", "?"); |
76 | 76 | ||
77 | printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); | 77 | printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | endutent(); | 80 | endutent(); |
81 | 81 | ||