Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/miscutils/last.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/miscutils/last.c
r2725 r3232 8 8 */ 9 9 10 //usage:#define last_trivial_usage 11 //usage: ""IF_FEATURE_LAST_FANCY("[-HW] [-f FILE]") 12 //usage:#define last_full_usage "\n\n" 13 //usage: "Show listing of the last users that logged into the system" 14 //usage: IF_FEATURE_LAST_FANCY( "\n" 15 /* //usage: "\n -H Show header line" */ 16 //usage: "\n -W Display with no host column truncation" 17 //usage: "\n -f FILE Read from FILE instead of /var/log/wtmp" 18 //usage: ) 19 10 20 #include "libbb.h" 11 #include <utmp.h>12 21 13 22 /* NB: ut_name and ut_user are the same field, use only one name (ut_user) … … 63 72 64 73 printf("%-10s %-14s %-18s %-12.12s %s\n", 65 74 "USER", "TTY", "HOST", "LOGIN", "TIME"); 66 75 /* yikes. We reverse over the file and that is a not too elegant way */ 67 76 pos = xlseek(file, 0, SEEK_END); … … 123 132 t_tmp = (time_t)ut.ut_tv.tv_sec; 124 133 printf("%-10s %-14s %-18s %-12.12s\n", 125 134 ut.ut_user, ut.ut_line, ut.ut_host, ctime(&t_tmp) + 4); 126 135 next: 127 136 pos -= sizeof(ut);
Note:
See TracChangeset
for help on using the changeset viewer.