diff --git a/usr.bin/users/users.c b/usr.bin/users/users.c index 6be7e03c3d9a..e0d04e7256b7 100644 --- a/usr.bin/users/users.c +++ b/usr.bin/users/users.c @@ -50,9 +50,9 @@ static const char rcsid[] = #include #include -typedef char namebuf[sizeof(((struct utmpx *)0)->ut_user) + 1]; +typedef char namebuf[sizeof(((struct utmpx *)0)->ut_user) + 1]; +typedef int (*scmp)(const void *, const void *); -int scmp(const void *, const void *); static void usage(void); int @@ -91,7 +91,7 @@ main(int argc, char **argv) } endutxent(); if (ncnt > 0) { - qsort(names, ncnt, sizeof(namebuf), scmp); + qsort(names, ncnt, sizeof(*names), (scmp)strcmp); printf("%s", names[0]); for (cnt = 1; cnt < ncnt; ++cnt) if (strcmp(names[cnt], names[cnt - 1]) != 0) @@ -107,10 +107,3 @@ usage(void) fprintf(stderr, "usage: users\n"); exit(1); } - -int -scmp(const void *p, const void *q) -{ - - return (strcmp(p, q)); -}