Michael Reed wrote: > Hi all, > > I test it out as both `arch' and `machine' and didn't observe > any differences. Also, I figured I might as well convert exit(3) > to return while touching this code, as was done in [1].
this is cleaner i think. Index: arch.c =================================================================== RCS file: /cvs/src/usr.bin/arch/arch.c,v retrieving revision 1.14 diff -u -p -r1.14 arch.c --- arch.c 8 Feb 2015 23:40:34 -0000 1.14 +++ arch.c 24 Sep 2015 15:00:43 -0000 @@ -32,7 +32,7 @@ #include <string.h> #include <unistd.h> -static void usage(void); +static void __dead usage(void); static int machine; @@ -54,7 +54,7 @@ main(int argc, char *argv[]) arch = MACHINE_ARCH; opts = "ks"; } - while ((c = getopt(argc, argv, opts)) != -1) + while ((c = getopt(argc, argv, opts)) != -1) { switch (c) { case 'a': arch = MACHINE_ARCH; @@ -67,22 +67,16 @@ main(int argc, char *argv[]) break; default: usage(); - /* NOTREACHED */ } - if (optind != argc) { - usage(); - /* NOTREACHED */ - } - if (!short_form) { - fputs("OpenBSD", stdout); - fputc('.', stdout); } - fputs(arch, stdout); - fputc('\n', stdout); - exit(0); + if (optind != argc) + usage(); + + printf("%s%s\n", short_form ? "" : "OpenBSD.", arch); + return (0); } -static void +static void __dead usage(void) { if (machine)