From: Alan Cox Date: Sun, 12 Nov 2017 21:07:37 +0000 (+0000) Subject: who: fix use as users when a path is given X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=183d41e48b102f8bf16df7eb374ae07598d3595a;p=FUZIX.git who: fix use as users when a path is given --- diff --git a/Applications/util/who.c b/Applications/util/who.c index b50edc9a..3d872891 100644 --- a/Applications/util/who.c +++ b/Applications/util/who.c @@ -24,11 +24,17 @@ void main(int argc, char *argv[]) { - register struct utmp *entry; + struct utmp *entry; char *timestr; + char *p; uint8_t fmt = 0; - if (strcmp(argv[0], "users") == 0) + p = strchr(argv[0],'/'); + if (p) + p++; + else + p = argv[0]; + if (strcmp(p, "users") == 0) fmt = 1; setutent(); while ((entry = getutent()) != NULL) {