From 183d41e48b102f8bf16df7eb374ae07598d3595a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 12 Nov 2017 21:07:37 +0000 Subject: [PATCH] who: fix use as users when a path is given --- Applications/util/who.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) { -- 2.34.1