> 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.
optreset too. Strangely, ftpd/popen.c redeclares optreset but none of the others. Jan Index: popen.c =================================================================== RCS file: /cvs/src/libexec/ftpd/popen.c,v retrieving revision 1.26 diff -u -p -r1.26 popen.c --- popen.c 29 Feb 2016 17:50:34 -0000 1.26 +++ popen.c 3 Nov 2017 17:44:07 -0000 @@ -132,7 +132,6 @@ ftpd_popen(char *program, char *type, pi closelog(); if (strcmp(gargv[0], "/bin/ls") == 0) { - extern int optreset; extern int ls_main(int, char **); /* reset getopt for ls_main */