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") - 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 12:38:36 -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)) + errx(1, "uname"); if (print_mask & PRINT_SYSNAME) { space++; fputs(u.sysname, stdout); } if (print_mask & PRINT_NODENAME) { - if (space++) putchar(' '); + if (space++) + putchar(' '); + 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(' '); + fputs(u.machine, stdout); } if (print_mask & PRINT_MACHINE_ARCH) { - if (space++) putchar(' '); + if (space++) + putchar(' '); + fputs(MACHINE_ARCH, stdout); } putchar('\n'); - exit(0); - /* NOTREACHED */ + return 0; } static void