diff --git a/usr.bin/getopt/getopt.c b/usr.bin/getopt/getopt.c index 060e2c9ce17f..fbadc928ab7e 100644 --- a/usr.bin/getopt/getopt.c +++ b/usr.bin/getopt/getopt.c @@ -1,11 +1,12 @@ +/* $FreeBSD$ */ + #include +#include main(argc, argv) int argc; char *argv[]; { - extern int optind; - extern char *optarg; int c; int status = 0; diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c index 48d4871a210b..e8353dfb1717 100644 --- a/usr.bin/ktrace/ktrace.c +++ b/usr.bin/ktrace/ktrace.c @@ -66,8 +66,6 @@ main(argc, argv) int argc; char **argv; { - extern int optind; - extern char *optarg; enum { NOTSET, CLEAR, CLEARALL } clear; int append, ch, fd, inherit, ops, pid, pidset, trpoints; char *tracefile; diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c index 5efd9e829ca5..a0c6f398b7a9 100644 --- a/usr.bin/last/last.c +++ b/usr.bin/last/last.c @@ -108,8 +108,6 @@ main(argc, argv) int argc; char *argv[]; { - extern int optind; - extern char *optarg; int ch; char *p; diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index d565d607102f..5c25d05753d8 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -65,7 +65,7 @@ char *argv[]; int c; int vflag = 0; - while ((c = getopt(argc, argv, "vf:")) != EOF) { + while ((c = getopt(argc, argv, "vf:")) != -1) { switch (c) { case 'v': vflag++; diff --git a/usr.bin/locate/code/locate.code.c b/usr.bin/locate/code/locate.code.c index c7cb09715fb4..e44c51663e64 100644 --- a/usr.bin/locate/code/locate.code.c +++ b/usr.bin/locate/code/locate.code.c @@ -97,6 +97,7 @@ static char sccsid[] = "@(#)locate.code.c 8.1 (Berkeley) 6/6/93"; #include #include #include +#include #include "locate.h" #define BGBUFSIZE (NBG * 2) /* size of bigram buffer */ @@ -119,8 +120,6 @@ int bgindex __P((char *)); void usage __P((void)); -extern int optind; -extern int optopt; int main(argc, argv) diff --git a/usr.bin/locate/locate/locate.c b/usr.bin/locate/locate/locate.c index a0ffe0dbdcc0..0ee14f3050ab 100644 --- a/usr.bin/locate/locate/locate.c +++ b/usr.bin/locate/locate/locate.c @@ -140,10 +140,6 @@ extern u_char *tolower_word __P((u_char *)); extern int check_bigram_char __P((int)); extern char *patprep __P((char *)); -extern char *optarg; -extern int optind; - - int main(argc, argv) int argc; diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c index 41b7b1385fe9..93fd81f18dff 100644 --- a/usr.bin/m4/main.c +++ b/usr.bin/m4/main.c @@ -139,12 +139,8 @@ struct keyblk keywrds[] = { /* m4 keywords to be installed */ #define MAXKEYS (sizeof(keywrds)/sizeof(struct keyblk)) -extern int optind; -extern char *optarg; - void macro(); void initkwds(); -extern int getopt(); int main(argc,argv) diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c index 25ef8e547e2c..dc4a625f2235 100644 --- a/usr.bin/nfsstat/nfsstat.c +++ b/usr.bin/nfsstat/nfsstat.c @@ -91,8 +91,6 @@ main(argc, argv) int argc; char **argv; { - extern int optind; - extern char *optarg; u_int interval; int clientOnly = -1; int serverOnly = -1; diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c index 91665b229a51..59442c0d9f6f 100644 --- a/usr.bin/nm/nm.c +++ b/usr.bin/nm/nm.c @@ -97,7 +97,6 @@ main(argc, argv) int argc; char **argv; { - extern int optind; int ch, errors; while ((ch = getopt(argc, argv, "agnoprtuwW")) != -1) { diff --git a/usr.bin/ranlib/ranlib.c b/usr.bin/ranlib/ranlib.c index 40263318e6a6..6177984705f7 100644 --- a/usr.bin/ranlib/ranlib.c +++ b/usr.bin/ranlib/ranlib.c @@ -68,7 +68,6 @@ main(argc, argv) int argc; char **argv; { - extern int optind; int ch, eval, tflag; tflag = 0; diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c index 51ef079260ff..15fbe93652ca 100644 --- a/usr.bin/rlogin/rlogin.c +++ b/usr.bin/rlogin/rlogin.c @@ -144,8 +144,6 @@ main(argc, argv) int argc; char *argv[]; { - extern char *optarg; - extern int optind; struct passwd *pw; struct servent *sp; struct sgttyb ttyb; diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c index 99089bb2f305..622ea819a0c2 100644 --- a/usr.bin/rpcinfo/rpcinfo.c +++ b/usr.bin/rpcinfo/rpcinfo.c @@ -53,6 +53,7 @@ static char rcsid[] = #include #include #include +#include #include #include @@ -89,8 +90,6 @@ main(argc, argv) char **argv; { register int c; - extern char *optarg; - extern int optind; int errflg; int function; u_short portnum; diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c index b916e9d23440..aeadfc56ef17 100644 --- a/usr.bin/rup/rup.c +++ b/usr.bin/rup/rup.c @@ -208,7 +208,6 @@ int main(int argc, char *argv[]) { int ch; - extern int optind; while ((ch = getopt(argc, argv, "?")) != -1) switch (ch) { diff --git a/usr.bin/strings/strings.c b/usr.bin/strings/strings.c index 6a49d632035e..128292f22b4d 100644 --- a/usr.bin/strings/strings.c +++ b/usr.bin/strings/strings.c @@ -78,8 +78,6 @@ main(argc, argv) int argc; char **argv; { - extern char *optarg; - extern int optind; register int ch, cnt; register u_char *C; EXEC *head; diff --git a/usr.bin/tconv/tconv.c b/usr.bin/tconv/tconv.c index a9d035d028d6..f61f8d24f022 100644 --- a/usr.bin/tconv/tconv.c +++ b/usr.bin/tconv/tconv.c @@ -1202,9 +1202,6 @@ int main(argc, argv) int argc; char **argv; { - extern char *optarg; - extern int optind; - extern int opterr; char *term = NULL; char *file = NULL; int r; diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c index 9126738c848b..657f560e64a4 100644 --- a/usr.bin/telnet/main.c +++ b/usr.bin/telnet/main.c @@ -43,6 +43,8 @@ static char copyright[] = static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 12/15/93"; #endif /* not lint */ +#include +#include #include #include @@ -125,10 +127,8 @@ main(argc, argv) int argc; char *argv[]; { - extern char *optarg; - extern int optind; int ch; - char *user, *strrchr(); + char *user; char *src_addr = NULL; #ifdef FORWARD extern int forward_flags; diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c index 960d00e27aac..e802e4dbb9c0 100644 --- a/usr.bin/time/time.c +++ b/usr.bin/time/time.c @@ -68,9 +68,6 @@ main(argc, argv) int argc; char **argv; { - extern char *optarg; - extern int optind; - register int pid; int aflag, ch, lflag, status, pflag; struct timeval before, after; diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c index 2eb3e466a009..67a6b531dd63 100644 --- a/usr.bin/tput/tput.c +++ b/usr.bin/tput/tput.c @@ -38,7 +38,11 @@ static char copyright[] = #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)tput.c 8.2 (Berkeley) 3/19/94"; +#endif +static char rcsid[] = +"$FreeBSD$"; #endif /* not lint */ #include @@ -61,8 +65,6 @@ main(argc, argv) int argc; char **argv; { - extern char *optarg; - extern int optind; int ch, exitval, n; char *cptr, *p, *term, buf[1024], tbuf[1024]; diff --git a/usr.bin/vacation/vacation.c b/usr.bin/vacation/vacation.c index 98a2987abd3c..9a5790ea7ad0 100644 --- a/usr.bin/vacation/vacation.c +++ b/usr.bin/vacation/vacation.c @@ -109,8 +109,6 @@ main(argc, argv) int argc; char **argv; { - extern int optind, opterr; - extern char *optarg; struct passwd *pw; ALIAS *cur; time_t interval;