Hi Ted, please just commit this patch you sent out back in July. The old, verbose style keeps confusing people, see for example Jan Stary's recent messages to tech@. I guess you just overlooked my OK. There was no opposition when you put this on tech@.
Yours, Ingo Ingo Schwarze wrote on Fri, Jul 01, 2016 at 11:40:01PM +0200: > Ted Unangst wrote on Thu, Jun 23, 2016 at 09:06:10PM -0400: >> just because. > OK schwarze@ > Ingo Index: logname.c =================================================================== RCS file: /cvs/src/usr.bin/logname/logname.c,v retrieving revision 1.9 diff -u -p -r1.9 logname.c --- logname.c 9 Oct 2015 01:37:08 -0000 1.9 +++ logname.c 24 Jun 2016 01:02:58 -0000 @@ -32,45 +32,30 @@ #include <stdio.h> #include <stdlib.h> -#include <locale.h> +#include <string.h> #include <unistd.h> #include <err.h> -void usage(void); +static void __dead +usage(void) +{ + (void)fprintf(stderr, "usage: logname\n"); + exit(1); +} int main(int argc, char *argv[]) { - int ch; - char *p; - - setlocale(LC_ALL, ""); + const char *p; if (pledge("stdio", NULL) == -1) err(1, "pledge"); - while ((ch = getopt(argc, argv, "")) != -1) - switch (ch) { - case '?': - default: - usage(); - /* NOTREACHED */ - } - - if (argc != optind) { + if (!(argc == 1 || (argc == 2 && strcmp(argv[1], "--") == 0))) usage(); - /* NOTREACHED */ - } if ((p = getlogin()) == NULL) err(1, NULL); (void)printf("%s\n", p); - exit(0); -} - -void -usage(void) -{ - (void)fprintf(stderr, "usage: logname\n"); - exit(1); + return 0; }