dmesg(8) doesn't use any positional arguments. It's a usage error if any are present.
ok? Index: dmesg.c =================================================================== RCS file: /cvs/src/sbin/dmesg/dmesg.c,v retrieving revision 1.31 diff -u -p -r1.31 dmesg.c --- dmesg.c 24 Dec 2019 13:20:44 -0000 1.31 +++ dmesg.c 2 Aug 2022 16:48:13 -0000 @@ -89,6 +89,9 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (argc != 0) + usage(); + if (memf == NULL && nlistf == NULL) { int mib[2], msgbufsize; size_t len;