mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
who: code shrink by Tito <farmatito@tiscali.it>
function old new delta who_main 271 259 -12
This commit is contained in:
parent
72cc9641f8
commit
05c8c4f745
@ -55,8 +55,6 @@ int who_main(int argc, char **argv)
|
|||||||
printf("USER TTY IDLE TIME HOST\n");
|
printf("USER TTY IDLE TIME HOST\n");
|
||||||
while ((ut = getutent()) != NULL) {
|
while ((ut = getutent()) != NULL) {
|
||||||
if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
|
if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
|
||||||
time_t thyme = ut->ut_tv.tv_sec;
|
|
||||||
|
|
||||||
/* ut->ut_line is device name of tty - "/dev/" */
|
/* ut->ut_line is device name of tty - "/dev/" */
|
||||||
name = concat_path_file("/dev", ut->ut_line);
|
name = concat_path_file("/dev", ut->ut_line);
|
||||||
str6[0] = '?';
|
str6[0] = '?';
|
||||||
@ -66,7 +64,7 @@ int who_main(int argc, char **argv)
|
|||||||
/* 15 chars for time: Nov 10 19:33:20 */
|
/* 15 chars for time: Nov 10 19:33:20 */
|
||||||
printf("%-10s %-8s %-9s %-15.15s %s\n",
|
printf("%-10s %-8s %-9s %-15.15s %s\n",
|
||||||
ut->ut_user, ut->ut_line, str6,
|
ut->ut_user, ut->ut_line, str6,
|
||||||
ctime(&thyme) + 4, ut->ut_host);
|
ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user