diff options
author | Rob Landley <rob@landley.net> | 2006-06-19 03:20:03 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-06-19 03:20:03 +0000 |
commit | 7a260f01ce6841658810dc9f0ff0706558a10d7f (patch) | |
tree | f98b6d5bf4c3d48dd54db386c29d39ab26e1463e /coreutils/who.c | |
parent | 290fcb4213ae5ab9ec6cb228dd64ef2c9f02d26d (diff) | |
download | busybox-w32-7a260f01ce6841658810dc9f0ff0706558a10d7f.tar.gz busybox-w32-7a260f01ce6841658810dc9f0ff0706558a10d7f.tar.bz2 busybox-w32-7a260f01ce6841658810dc9f0ff0706558a10d7f.zip |
Make some 64 bit warnings go away on x86-64.
Diffstat (limited to 'coreutils/who.c')
-rw-r--r-- | coreutils/who.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/coreutils/who.c b/coreutils/who.c index 0cb74313e..5cff65157 100644 --- a/coreutils/who.c +++ b/coreutils/who.c | |||
@@ -14,12 +14,9 @@ | |||
14 | *---------------------------------------------------------------------- | 14 | *---------------------------------------------------------------------- |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <stdio.h> | 17 | #include "busybox.h" |
18 | #include <stdlib.h> | ||
19 | #include <utmp.h> | 18 | #include <utmp.h> |
20 | #include <sys/stat.h> | ||
21 | #include <time.h> | 19 | #include <time.h> |
22 | #include "busybox.h" | ||
23 | 20 | ||
24 | static const char * idle_string (time_t t) | 21 | static const char * idle_string (time_t t) |
25 | { | 22 | { |
@@ -33,7 +30,7 @@ static const char * idle_string (time_t t) | |||
33 | sprintf (str, "%02d:%02d", | 30 | sprintf (str, "%02d:%02d", |
34 | (int) (s / (60 * 60)), | 31 | (int) (s / (60 * 60)), |
35 | (int) ((s % (60 * 60)) / 60)); | 32 | (int) ((s % (60 * 60)) / 60)); |
36 | return (const char *) str; | 33 | return str; |
37 | } | 34 | } |
38 | return "old"; | 35 | return "old"; |
39 | } | 36 | } |
@@ -52,14 +49,16 @@ int who_main(int argc, char **argv) | |||
52 | printf("USER TTY IDLE TIME HOST\n"); | 49 | printf("USER TTY IDLE TIME HOST\n"); |
53 | while ((ut = getutent()) != NULL) { | 50 | while ((ut = getutent()) != NULL) { |
54 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { | 51 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { |
52 | time_t thyme = ut->ut_tv.tv_sec; | ||
53 | |||
55 | /* ut->ut_line is device name of tty - "/dev/" */ | 54 | /* ut->ut_line is device name of tty - "/dev/" */ |
56 | name = concat_path_file("/dev", ut->ut_line); | 55 | name = concat_path_file("/dev", ut->ut_line); |
57 | printf("%-10s %-8s %-8s %-12.12s %s\n", ut->ut_user, ut->ut_line, | 56 | printf("%-10s %-8s %-8s %-12.12s %s\n", ut->ut_user, ut->ut_line, |
58 | (stat(name, &st)) ? "?" : idle_string(st.st_atime), | 57 | (stat(name, &st)) ? "?" : idle_string(st.st_atime), |
59 | ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); | 58 | ctime(&thyme) + 4, ut->ut_host); |
60 | free(name); | 59 | if (ENABLE_FEATURE_CLEAN_UP) free(name); |
61 | } | 60 | } |
62 | } | 61 | } |
63 | endutent(); | 62 | if (ENABLE_FEATURE_CLEAN_UP) endutent(); |
64 | return 0; | 63 | return 0; |
65 | } | 64 | } |