Print system login processes correctly when doing who -l

Fix style as well.
This commit is contained in:
sin 2014-03-25 12:38:47 +00:00
parent 9031fcfd29
commit 07592f31be
1 changed files with 2 additions and 3 deletions

5
who.c
View File

@ -49,9 +49,9 @@ main(int argc, char **argv)
if (!*usr.ut_name || !*usr.ut_line || if (!*usr.ut_name || !*usr.ut_line ||
usr.ut_line[0] == '~') usr.ut_line[0] == '~')
continue; continue;
if (mflag && strcmp(usr.ut_line, tty)) if (mflag != 0 && strcmp(usr.ut_line, tty) != 0)
continue; continue;
if (strcmp(usr.ut_name, "LOGIN") == lflag) if (!!strcmp(usr.ut_name, "LOGIN") == lflag)
continue; continue;
t = usr.ut_time; t = usr.ut_time;
strftime(timebuf, sizeof timebuf, "%Y-%m-%d %H:%M", localtime(&t)); strftime(timebuf, sizeof timebuf, "%Y-%m-%d %H:%M", localtime(&t));
@ -60,4 +60,3 @@ main(int argc, char **argv)
fclose(ufp); fclose(ufp);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }