frit...@alokat.org(frit...@alokat.org) on 2015.12.24 14:45:51 +0100: > On Thu, Dec 24, 2015 at 02:19:36PM +0100, Theo Buehler wrote: > > On Thu, Dec 24, 2015 at 01:52:56PM +0100, frit...@alokat.org wrote: > > > Hi tech@, > > > > > > here are some tweaks about uname(1): > > > > > > - change the parameter order to the same order as in the manpage > > > - change err(1, NULL) to errx(1, "uname") > > > > Why? This doesn't make sense to me. Like this you'll suppress the > > error string generated from errno. > > > > Thanks for the hint. > > > apart from this, this would be ok tb@
ok benno@ with whitespace on empty lines fixed (see below). tb? you do it? > > New version attached below. > > > > - change statements like: if (condition) statement > > > if (condition) > > > statement > > > > > > - activate the stack protector > > > > > > --F. > > > Index: uname.c > =================================================================== > RCS file: /cvs/src/usr.bin/uname/uname.c,v > retrieving revision 1.16 > diff -u -r1.16 uname.c > --- uname.c 9 Oct 2015 01:37:09 -0000 1.16 > +++ uname.c 24 Dec 2015 13:41:16 -0000 > @@ -73,6 +73,9 @@ > case 'n': > print_mask |= PRINT_NODENAME; > break; > + case 'p': > + print_mask |= PRINT_MACHINE_ARCH; > + break; > case 'r': > print_mask |= PRINT_RELEASE; > break; > @@ -82,9 +85,6 @@ > case 'v': > print_mask |= PRINT_VERSION; > break; > - case 'p': > - print_mask |= PRINT_MACHINE_ARCH; > - break; > default: > usage(); > /* NOTREACHED */ > @@ -100,39 +100,46 @@ > print_mask = PRINT_SYSNAME; > } > > - if (uname(&u)) { > - err(1, NULL); > - /* NOTREACHED */ > - } > + if (uname(&u)) > + err(1, "uname"); > > if (print_mask & PRINT_SYSNAME) { > space++; > fputs(u.sysname, stdout); > } > if (print_mask & PRINT_NODENAME) { > - if (space++) putchar(' '); > + if (space++) > + putchar(' '); > + whitespace > fputs(u.nodename, stdout); > } > if (print_mask & PRINT_RELEASE) { > - if (space++) putchar(' '); > + if (space++) > + putchar(' '); > + > fputs(u.release, stdout); > } > if (print_mask & PRINT_VERSION) { > - if (space++) putchar(' '); > + if (space++) > + putchar(' '); > + > fputs(u.version, stdout); > } > if (print_mask & PRINT_MACHINE) { > - if (space++) putchar(' '); > + if (space++) > + putchar(' '); > + whitespace > fputs(u.machine, stdout); > } > if (print_mask & PRINT_MACHINE_ARCH) { > - if (space++) putchar(' '); > + if (space++) > + putchar(' '); > + whitespace > fputs(MACHINE_ARCH, stdout); > } > putchar('\n'); > > - exit(0); > - /* NOTREACHED */ > + return 0; > } > > static void > --