With <unistd.h> included, there is no need 
to declare extern int optind and friends again.

        Jan

Index: usr.sbin/amd/amd/get_args.c
===================================================================
RCS file: /cvs/src/usr.sbin/amd/amd/get_args.c,v
retrieving revision 1.15
diff -u -p -r1.15 get_args.c
--- usr.sbin/amd/amd/get_args.c 21 Oct 2021 10:55:56 -0000      1.15
+++ usr.sbin/amd/amd/get_args.c 10 Nov 2021 16:27:26 -0000
@@ -44,9 +44,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-extern int optind;
-extern char *optarg;
-
 #if defined(DEBUG) && defined(PARANOID)
 char **gargv;
 #endif /* defined(DEBUG) && defined(PARANOID) */
Index: usr.sbin/amd/amq/amq.c
===================================================================
RCS file: /cvs/src/usr.sbin/amd/amq/amq.c,v
retrieving revision 1.21
diff -u -p -r1.21 amq.c
--- usr.sbin/amd/amq/amq.c      21 Jan 2017 08:33:51 -0000      1.21
+++ usr.sbin/amd/amq/amq.c      10 Nov 2021 16:27:26 -0000
@@ -59,9 +59,6 @@ static char *xlog_optstr;
 static char localhost[] = "localhost";
 static char *def_server = localhost;
 
-extern int optind;
-extern char *optarg;
-
 static struct timeval tmo = { 10, 0 };
 #define        TIMEOUT tmo
 
Index: usr.sbin/crunchgen/crunchgen.c
===================================================================
RCS file: /cvs/src/usr.sbin/crunchgen/crunchgen.c,v
retrieving revision 1.24
diff -u -p -r1.24 crunchgen.c
--- usr.sbin/crunchgen/crunchgen.c      24 Oct 2021 21:24:18 -0000      1.24
+++ usr.sbin/crunchgen/crunchgen.c      10 Nov 2021 16:27:26 -0000
@@ -117,8 +117,6 @@ main(int argc, char *argv[])
 {
        char           *p;
        int             optc;
-       extern int      optind;
-       extern char    *optarg;
 
        if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {
                perror("pledge");
Index: usr.sbin/mtree/mtree.c
===================================================================
RCS file: /cvs/src/usr.sbin/mtree/mtree.c,v
retrieving revision 1.26
diff -u -p -r1.26 mtree.c
--- usr.sbin/mtree/mtree.c      16 Sep 2018 12:43:40 -0000      1.26
+++ usr.sbin/mtree/mtree.c      10 Nov 2021 16:27:26 -0000
@@ -55,8 +55,6 @@ static void usage(void);
 int
 main(int argc, char *argv[])
 {
-       extern int optind;
-       extern char *optarg;
        int ch;
        char *dir, *p;
        int status;
Index: usr.sbin/npppctl/npppctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/npppctl/npppctl.c,v
retrieving revision 1.9
diff -u -p -r1.9 npppctl.c
--- usr.sbin/npppctl/npppctl.c  28 Jun 2019 13:32:49 -0000      1.9
+++ usr.sbin/npppctl/npppctl.c  10 Nov 2021 16:27:26 -0000
@@ -80,8 +80,6 @@ main(int argc, char *argv[])
        struct parse_result     *result;
        struct sockaddr_un       sun;
        const char              *npppd_ctlpath = NPPPD_SOCKET;
-       extern int               optind;
-       extern char             *optarg;
 
        while ((ch = getopt(argc, argv, "ns:")) != -1)
                switch (ch) {
Index: usr.sbin/npppd/npppd/npppd.c
===================================================================
RCS file: /cvs/src/usr.sbin/npppd/npppd/npppd.c,v
retrieving revision 1.51
diff -u -p -r1.51 npppd.c
--- usr.sbin/npppd/npppd/npppd.c        29 Mar 2021 03:54:39 -0000      1.51
+++ usr.sbin/npppd/npppd/npppd.c        10 Nov 2021 16:27:26 -0000
@@ -136,7 +136,6 @@ int
 main(int argc, char *argv[])
 {
        int            ch, stop_by_error, runasdaemon = 1, nflag = 0;
-       extern char   *optarg;
        const char    *npppd_conf0 = DEFAULT_NPPPD_CONF;
        struct passwd *pw;
 
Index: usr.sbin/pstat/pstat.c
===================================================================
RCS file: /cvs/src/usr.sbin/pstat/pstat.c,v
retrieving revision 1.126
diff -u -p -r1.126 pstat.c
--- usr.sbin/pstat/pstat.c      20 Oct 2021 06:35:40 -0000      1.126
+++ usr.sbin/pstat/pstat.c      10 Nov 2021 16:27:26 -0000
@@ -150,8 +150,6 @@ main(int argc, char *argv[])
        int fileflag = 0, swapflag = 0, ttyflag = 0, vnodeflag = 0, ch;
        char buf[_POSIX2_LINE_MAX];
        const char *dformat = NULL;
-       extern char *optarg;
-       extern int optind;
        int i;
 
        hideroot = getuid();
Index: usr.sbin/quotaon/quotaon.c
===================================================================
RCS file: /cvs/src/usr.sbin/quotaon/quotaon.c,v
retrieving revision 1.27
diff -u -p -r1.27 quotaon.c
--- usr.sbin/quotaon/quotaon.c  26 Apr 2018 12:42:51 -0000      1.27
+++ usr.sbin/quotaon/quotaon.c  10 Nov 2021 16:27:26 -0000
@@ -66,7 +66,6 @@ main(int argc, char *argv[])
        char *qfnp, *whoami;
        long argnum, done = 0;
        int i, offmode = 0, errs = 0;
-       extern int optind;
        int ch;
 
        whoami = strrchr(*argv, '/') + 1;
Index: usr.sbin/rarpd/rarpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/rarpd/rarpd.c,v
retrieving revision 1.78
diff -u -p -r1.78 rarpd.c
--- usr.sbin/rarpd/rarpd.c      6 Sep 2021 13:32:18 -0000       1.78
+++ usr.sbin/rarpd/rarpd.c      10 Nov 2021 16:27:26 -0000
@@ -103,7 +103,6 @@ int
 main(int argc, char *argv[])
 {
        extern char *__progname;
-       extern int optind, opterr;
        int op;
 
        /* All error reporting is done through syslogs. */
Index: usr.sbin/rdate/rdate.c
===================================================================
RCS file: /cvs/src/usr.sbin/rdate/rdate.c,v
retrieving revision 1.35
diff -u -p -r1.35 rdate.c
--- usr.sbin/rdate/rdate.c      23 Dec 2015 19:13:52 -0000      1.35
+++ usr.sbin/rdate/rdate.c      10 Nov 2021 16:27:26 -0000
@@ -82,7 +82,6 @@ main(int argc, char **argv)
        int             pr = 0, silent = 0, ntp = 1, verbose = 0;
        int             slidetime = 0, corrleaps = 0;
        char           *hname;
-       extern int      optind;
        int             c, p[2], pid;
        int             family = PF_UNSPEC;
 
Index: usr.sbin/repquota/repquota.c
===================================================================
RCS file: /cvs/src/usr.sbin/repquota/repquota.c,v
retrieving revision 1.35
diff -u -p -r1.35 repquota.c
--- usr.sbin/repquota/repquota.c        16 Mar 2016 15:41:11 -0000      1.35
+++ usr.sbin/repquota/repquota.c        10 Nov 2021 16:27:26 -0000
@@ -77,8 +77,6 @@ main(int argc, char *argv[])
        struct group *gr;
        int gflag = 0, uflag = 0, errs = 0;
        long i, argnum, done = 0;
-       extern char *optarg;
-       extern int optind;
        char *qfnp;
        int ch;
 
Index: usr.sbin/rpc.bootparamd/bootparamd.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpc.bootparamd/bootparamd.c,v
retrieving revision 1.21
diff -u -p -r1.21 bootparamd.c
--- usr.sbin/rpc.bootparamd/bootparamd.c        16 Oct 2016 10:40:58 -0000      
1.21
+++ usr.sbin/rpc.bootparamd/bootparamd.c        10 Nov 2021 16:27:26 -0000
@@ -50,8 +50,6 @@ struct sockaddr_in my_addr;
 extern char *__progname;
 char   *bootpfile = _PATH_BOOTPARAMS;
 
-extern char *optarg;
-extern int optind;
 
 static void
 usage(void)
Index: usr.sbin/syslogc/syslogc.c
===================================================================
RCS file: /cvs/src/usr.sbin/syslogc/syslogc.c,v
retrieving revision 1.18
diff -u -p -r1.18 syslogc.c
--- usr.sbin/syslogc/syslogc.c  13 Oct 2015 16:30:55 -0000      1.18
+++ usr.sbin/syslogc/syslogc.c  10 Nov 2021 16:27:26 -0000
@@ -77,8 +77,6 @@ main(int argc, char **argv)
        struct sockaddr_un ctl;
        int ctlsock, ch, oflag, rval;
        FILE *ctlf;
-       extern char *optarg;
-       extern int optind;
        struct ctl_cmd cc;
        struct ctl_reply_hdr rr;
        const char *errstr;

Reply via email to