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