If there is any interest in this at all,
there's a similar diff for usr.bin/ and usr.sbin/

        Jan


> On Nov 03 18:34:11, h...@stare.cz wrote:
> > Including <unistd.h> when using getopt(3) also makes
> > extern int opterr, optind, optopt, optreset;
> > and friends declared, but many utils redeclare them again.
> > 
> > Is there a reason for that, or can those be removed?
> > As a harmless example, here's a diff to games.
> > 
> >     Jan
> > 
> > 
> > Index: fortune/strfile/strfile.c
> > ===================================================================
> > RCS file: /cvs/src/games/fortune/strfile/strfile.c,v
> > retrieving revision 1.29
> > diff -u -p -r1.29 strfile.c
> > --- fortune/strfile/strfile.c       4 Jun 2017 13:39:25 -0000       1.29
> > +++ fortune/strfile/strfile.c       3 Nov 2017 17:32:52 -0000
> > @@ -252,8 +252,6 @@ main(int ac, char *av[])
> >  void
> >  getargs(int argc, char *argv[])
> >  {
> > -   extern char     *optarg;
> > -   extern int      optind;
> >     int     ch;
> >  
> >     while ((ch = getopt(argc, argv, "c:hiorsx")) != -1) {
> > Index: hunt/hunt/hunt.c
> > ===================================================================
> > RCS file: /cvs/src/games/hunt/hunt/hunt.c,v
> > retrieving revision 1.22
> > diff -u -p -r1.22 hunt.c
> > --- hunt/hunt/hunt.c        8 Apr 2017 22:50:41 -0000       1.22
> > +++ hunt/hunt/hunt.c        3 Nov 2017 17:32:52 -0000
> > @@ -85,8 +85,6 @@ int
> >  main(int ac, char **av)
> >  {
> >     int             c;
> > -   extern int      optind;
> > -   extern char     *optarg;
> >     long            enter_status;
> >     int             option;
> >     struct servent  *se;
> > Index: hunt/huntd/driver.c
> > ===================================================================
> > RCS file: /cvs/src/games/hunt/huntd/driver.c,v
> > retrieving revision 1.29
> > diff -u -p -r1.29 driver.c
> > --- hunt/huntd/driver.c     21 Jan 2017 08:22:57 -0000      1.29
> > +++ hunt/huntd/driver.c     3 Nov 2017 17:32:52 -0000
> > @@ -80,8 +80,6 @@ main(int ac, char **av)
> >     static fd_set   read_fds;
> >     static FLAG     first = TRUE;
> >     static FLAG     server = FALSE;
> > -   extern int      optind;
> > -   extern char     *optarg;
> >     extern char     *__progname;
> >     int             c;
> >     static struct timeval   linger = { 0, 0 };
> > Index: robots/main.c
> > ===================================================================
> > RCS file: /cvs/src/games/robots/main.c,v
> > retrieving revision 1.26
> > diff -u -p -r1.26 main.c
> > --- robots/main.c   28 May 2017 21:01:13 -0000      1.26
> > +++ robots/main.c   3 Nov 2017 17:32:52 -0000
> > @@ -56,7 +56,6 @@ main(int ac, char *av[])
> >     int             score_err = 0; /* hold errno from score file open */
> >     int             ch;
> >     int             ret;
> > -   extern int      optind;
> >     char            *home;
> >  #ifdef FANCY
> >     char            *sp;
> > 
> 

Reply via email to