who: fix use as users when a path is given
authorAlan Cox <alan@linux.intel.com>
Sun, 12 Nov 2017 21:07:37 +0000 (21:07 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 12 Nov 2017 21:07:37 +0000 (21:07 +0000)
Applications/util/who.c

index b50edc9..3d87289 100644 (file)
 
 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) {