Theo de Raadt wrote: > I don't know if I am alone in this -- I am getting a bit tired of > changes which are can be summarized as: "fighting someone else's > style". > > I do not really see the value in changes of this sort.
Agreed. I ordered the includes, but the void casts should just stay. I'd argue that some style changes make static analysis a little easier or greatly improve readability. It's a fine line. > >frit...@alokat.org wrote: > >> Hi tech@, > >> > >> here are some basename(1) tweaks: > >> - remove (void) cast for puts(3) and fprintf(3) > > > >We typically leave these. I agree that they're usually pointless visual > >distractions in 2015 because there are a set of functions (mostly > >blocking IO functions to stdout and stderr) that are assumed not to fail > >unless misused, pretty much as as an API guarantee. > > > >Removing them might cause more churn than it's worth though. I'd > >probably save these for code that's being actively developed and needs > >the readability improvement. > > > >> - activate stack protector > > > >Hm? Changing the exit to a return does this? > > > >> - put includes in correct order > > > >ok mmcc@ > > > >> Index: basename.c > >> =================================================================== > >> RCS file: /cvs/src/usr.bin/basename/basename.c,v > >> retrieving revision 1.11 > >> diff -u -r1.11 basename.c > >> --- basename.c 9 Oct 2015 01:37:06 -0000 1.11 > >> +++ basename.c 24 Dec 2015 16:33:35 -0000 > >> @@ -32,10 +32,10 @@ > >> > >> #include <err.h> > >> #include <libgen.h> > >> +#include <locale.h> > >> #include <stdio.h> > >> #include <stdlib.h> > >> #include <string.h> > >> -#include <locale.h> > >> #include <unistd.h> > >> > >> void usage(void); > >> @@ -64,7 +64,7 @@ > >> usage(); > >> > >> if (**argv == '\0') { > >> - (void)puts(""); > >> + puts(""); > >> exit(0); > >> } > >> p = basename(*argv); > >> @@ -88,8 +88,8 @@ > >> p[off] = '\0'; > >> } > >> } > >> - (void)puts(p); > >> - exit(0); > >> + puts(p); > >> + return 0; > >> } > >> > >> extern char *__progname; > >> @@ -97,6 +97,6 @@ > >> usage(void) > >> { > >> > >> - (void)fprintf(stderr, "usage: %s string [suffix]\n", __progname); > >> + fprintf(stderr, "usage: %s string [suffix]\n", __progname); > >> exit(1); > >> } > >> > > > >