From: millert Date: Mon, 15 Nov 2021 15:14:24 +0000 (+0000) Subject: No need to declare optind, optarg or opterr; unistd.h does this for us. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=10a7b75896683c64bfb039e81ab2b44ce1670578;p=openbsd No need to declare optind, optarg or opterr; unistd.h does this for us. From Jan Stary. OK deraadt@ --- diff --git a/usr.sbin/amd/amd/get_args.c b/usr.sbin/amd/amd/get_args.c index 3a7bb68fb47..178ea0e2ac8 100644 --- a/usr.sbin/amd/amd/get_args.c +++ b/usr.sbin/amd/amd/get_args.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)get_args.c 8.1 (Berkeley) 6/6/93 - * $Id: get_args.c,v 1.15 2021/10/21 10:55:56 deraadt Exp $ + * $Id: get_args.c,v 1.16 2021/11/15 15:14:24 millert Exp $ */ /* @@ -44,9 +44,6 @@ #include #include -extern int optind; -extern char *optarg; - #if defined(DEBUG) && defined(PARANOID) char **gargv; #endif /* defined(DEBUG) && defined(PARANOID) */ diff --git a/usr.sbin/amd/amq/amq.c b/usr.sbin/amd/amq/amq.c index 972d4ef2c0b..57e2c4a5d6a 100644 --- a/usr.sbin/amd/amq/amq.c +++ b/usr.sbin/amd/amq/amq.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)amq.c 8.1 (Berkeley) 6/7/93 - * $Id: amq.c,v 1.21 2017/01/21 08:33:51 krw Exp $ + * $Id: amq.c,v 1.22 2021/11/15 15:14:24 millert Exp $ */ /* @@ -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 diff --git a/usr.sbin/crunchgen/crunchgen.c b/usr.sbin/crunchgen/crunchgen.c index e99ad2f177f..4526290197e 100644 --- a/usr.sbin/crunchgen/crunchgen.c +++ b/usr.sbin/crunchgen/crunchgen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crunchgen.c,v 1.24 2021/10/24 21:24:18 deraadt Exp $ */ +/* $OpenBSD: crunchgen.c,v 1.25 2021/11/15 15:14:24 millert Exp $ */ /* * Copyright (c) 1994 University of Maryland @@ -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"); diff --git a/usr.sbin/mtree/mtree.c b/usr.sbin/mtree/mtree.c index 3b7e1c0713d..fbfa797750a 100644 --- a/usr.sbin/mtree/mtree.c +++ b/usr.sbin/mtree/mtree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtree.c,v 1.26 2018/09/16 12:43:40 millert Exp $ */ +/* $OpenBSD: mtree.c,v 1.27 2021/11/15 15:14:24 millert Exp $ */ /* $NetBSD: mtree.c,v 1.7 1996/09/05 23:29:22 thorpej Exp $ */ /*- @@ -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; diff --git a/usr.sbin/npppctl/npppctl.c b/usr.sbin/npppctl/npppctl.c index 82706168073..398304e9080 100644 --- a/usr.sbin/npppctl/npppctl.c +++ b/usr.sbin/npppctl/npppctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppctl.c,v 1.9 2019/06/28 13:32:49 deraadt Exp $ */ +/* $OpenBSD: npppctl.c,v 1.10 2021/11/15 15:14:24 millert Exp $ */ /* * Copyright (c) 2012 Internet Initiative Japan Inc. @@ -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) { diff --git a/usr.sbin/npppd/npppd/npppd.c b/usr.sbin/npppd/npppd/npppd.c index b9b5831cfcc..b525d55ca98 100644 --- a/usr.sbin/npppd/npppd/npppd.c +++ b/usr.sbin/npppd/npppd/npppd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppd.c,v 1.51 2021/03/29 03:54:39 yasuoka Exp $ */ +/* $OpenBSD: npppd.c,v 1.52 2021/11/15 15:14:24 millert Exp $ */ /*- * Copyright (c) 2005-2008,2009 Internet Initiative Japan Inc. @@ -29,7 +29,7 @@ * Next pppd(nppd). This file provides a npppd daemon process and operations * for npppd instance. * @author Yasuoka Masahiko - * $Id: npppd.c,v 1.51 2021/03/29 03:54:39 yasuoka Exp $ + * $Id: npppd.c,v 1.52 2021/11/15 15:14:24 millert Exp $ */ #include "version.h" #include /* ALIGNED_POINTER */ @@ -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; diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index 14a779eb2ae..f618409f2a4 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pstat.c,v 1.126 2021/10/20 06:35:40 semarie Exp $ */ +/* $OpenBSD: pstat.c,v 1.127 2021/11/15 15:14:24 millert Exp $ */ /* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */ /*- @@ -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(); diff --git a/usr.sbin/quotaon/quotaon.c b/usr.sbin/quotaon/quotaon.c index f70f6f99c53..4d904d2b4d4 100644 --- a/usr.sbin/quotaon/quotaon.c +++ b/usr.sbin/quotaon/quotaon.c @@ -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; diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c index 7eff3d39239..fbb0b953eb9 100644 --- a/usr.sbin/rarpd/rarpd.c +++ b/usr.sbin/rarpd/rarpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rarpd.c,v 1.78 2021/09/06 13:32:18 deraadt Exp $ */ +/* $OpenBSD: rarpd.c,v 1.79 2021/11/15 15:14:24 millert Exp $ */ /* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */ /* @@ -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. */ diff --git a/usr.sbin/rdate/rdate.c b/usr.sbin/rdate/rdate.c index 5bf7fdd80c9..cff4692d035 100644 --- a/usr.sbin/rdate/rdate.c +++ b/usr.sbin/rdate/rdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rdate.c,v 1.35 2015/12/23 19:13:52 deraadt Exp $ */ +/* $OpenBSD: rdate.c,v 1.36 2021/11/15 15:14:24 millert Exp $ */ /* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */ /* @@ -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; diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c index f4144821013..9a4cafcfe0e 100644 --- a/usr.sbin/repquota/repquota.c +++ b/usr.sbin/repquota/repquota.c @@ -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; diff --git a/usr.sbin/rpc.bootparamd/bootparamd.c b/usr.sbin/rpc.bootparamd/bootparamd.c index f1c46a9dcbe..c58c4e9b897 100644 --- a/usr.sbin/rpc.bootparamd/bootparamd.c +++ b/usr.sbin/rpc.bootparamd/bootparamd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bootparamd.c,v 1.21 2016/10/16 10:40:58 jca Exp $ */ +/* $OpenBSD: bootparamd.c,v 1.22 2021/11/15 15:14:24 millert Exp $ */ /* * This code is not copyright, and is placed in the public domain. @@ -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) diff --git a/usr.sbin/syslogc/syslogc.c b/usr.sbin/syslogc/syslogc.c index eaf4d62d860..b9048bad9a0 100644 --- a/usr.sbin/syslogc/syslogc.c +++ b/usr.sbin/syslogc/syslogc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogc.c,v 1.18 2015/10/13 16:30:55 deraadt Exp $ */ +/* $OpenBSD: syslogc.c,v 1.19 2021/11/15 15:14:24 millert Exp $ */ /* * Copyright (c) 2004 Damien Miller @@ -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;