ok deraadt
> Several utilities have command line parsing that predates getopt. Several of
> these are the old kmem grovellers, which allowed specifying the custom nlist,
> etc.
>
> I think this is kind of unusual and think that generally, the fewer
> undocumented features the better. This is as likely to trap people who make
> typos as anything.
>
> Here's a sample diff for netstat. I kept the interval parsing, because I
> suspect people use that. unifdef the compat code, since it's realistically not
> going anywhere. But delete the old memf handling. Finally, check argc is sane,
> so that "netstat 1 apple banana cat dog elephant" doesn't just run without
> error.
>
> More to come for assorted other programs with similar blocks if we like this.
>
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/netstat/main.c,v
> retrieving revision 1.106
> diff -u -p -r1.106 main.c
> --- main.c 12 Feb 2015 01:49:02 -0000 1.106
> +++ main.c 1 Oct 2015 20:23:40 -0000
> @@ -263,23 +263,18 @@ main(int argc, char *argv[])
> argv += optind;
> argc -= optind;
>
> -#define BACKWARD_COMPATIBILITY
> -#ifdef BACKWARD_COMPATIBILITY
> if (*argv) {
> if (isdigit((unsigned char)**argv)) {
> interval = strtonum(*argv, 1, INT_MAX, &errstr);
> if (errstr)
> errx(1, "interval is %s", errstr);
> ++argv;
> + --argc;
> iflag = 1;
> }
> - if (*argv) {
> - nlistf = *argv;
> - if (*++argv)
> - memf = *argv;
> - }
> }
> -#endif
> + if (argc)
> + usage();
>
> /*
> * Show per-interface statistics which don't need access to
>