From 72606bd24b5a939819d9dadc84fc7ec891cff643 Mon Sep 17 00:00:00 2001
From: cracauer <cracauer@FreeBSD.org>
Date: Thu, 20 Apr 2000 09:49:16 +0000
Subject: Fix warnings, some of them serious because sh violated name spaces
 reserved by the header files it includes.

mkinit.c still produces C code with redundant declarations, although
they are more harmless since they automatically derived from the right
places.
---
 bin/sh/arith_lex.l | 1 -
 bin/sh/error.h     | 1 -
 bin/sh/histedit.c  | 4 +---
 bin/sh/jobs.c      | 1 -
 bin/sh/miscbltin.c | 9 +++------
 bin/sh/options.c   | 4 ++--
 bin/sh/options.h   | 2 +-
 bin/sh/parser.c    | 3 +--
 8 files changed, 8 insertions(+), 17 deletions(-)

(limited to 'bin/sh')

diff --git a/bin/sh/arith_lex.l b/bin/sh/arith_lex.l
index 8b855bd..82086bf 100644
--- a/bin/sh/arith_lex.l
+++ b/bin/sh/arith_lex.l
@@ -45,7 +45,6 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
-#include <unistd.h>
 #include "y.tab.h"
 #include "error.h"
 
diff --git a/bin/sh/error.h b/bin/sh/error.h
index 6c58c12..b86e177 100644
--- a/bin/sh/error.h
+++ b/bin/sh/error.h
@@ -82,7 +82,6 @@ extern volatile sig_atomic_t exception;
 
 extern volatile sig_atomic_t suppressint;
 extern volatile sig_atomic_t intpending;
-extern char *commandname;	/* name of command--printed on error */
 
 #define INTOFF suppressint++
 #define INTON { if (--suppressint == 0 && intpending) onint(); }
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 798118b..6ff6070 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -168,8 +168,6 @@ histcmd(argc, argv)
 	int argc;
 	char **argv;
 {
-	extern char *optarg;
-	extern int optind, optopt, optreset;
 	int ch;
 	char *editor = NULL;
 	const HistEvent *he;
@@ -210,7 +208,7 @@ histcmd(argc, argv)
 	      (ch = getopt(argc, argv, ":e:lnrs")) != -1)
 		switch ((char)ch) {
 		case 'e':
-			editor = optarg;
+			editor = shoptarg;
 			break;
 		case 'l':
 			lflg = 1;
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 72a7bd2..5e6b3e7 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -971,7 +971,6 @@ stoppedjobs()
 
 STATIC char *cmdnextc;
 STATIC int cmdnleft;
-STATIC void cmdtxt(), cmdputs();
 #define MAXCMDTEXT	200
 
 char *
diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
index bb602f6..46d3950 100644
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -67,9 +67,6 @@ static const char rcsid[] =
 
 #undef eflag
 
-extern char **argptr;		/* argument list for builtin command */
-
-
 /*
  * The read builtin.  The -r option causes backslashes to be treated like
  * ordinary characters.
@@ -105,7 +102,7 @@ readcmd(argc, argv)
 	while ((i = nextopt("erp:t:")) != '\0') {
 		switch(i) {
 		case 'p':
-			prompt = optarg;
+			prompt = shoptarg;
 			break;
 		case 'e':
 			break;
@@ -113,8 +110,8 @@ readcmd(argc, argv)
 			rflag = 1;
 			break;
 		case 't':
-			tv.tv_sec = strtol(optarg, &tvptr, 0);
-			if (tvptr == optarg)
+			tv.tv_sec = strtol(shoptarg, &tvptr, 0);
+			if (tvptr == shoptarg)
 				error("timeout value");
 			switch(*tvptr) {
 			case 0:
diff --git a/bin/sh/options.c b/bin/sh/options.c
index 2bd55f5..36f9c5c 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -67,7 +67,7 @@ static const char rcsid[] =
 char *arg0;			/* value of $0 */
 struct shparam shellparam;	/* current positional parameters */
 char **argptr;			/* argument list for builtin commands */
-char *optarg;			/* set by nextopt (like getopt) */
+char *shoptarg;			/* set by nextopt (like getopt) */
 char *optptr;			/* used by nextopt */
 
 char *minusc;			/* argument to -c option */
@@ -539,7 +539,7 @@ nextopt(optstring)
 	if (*++q == ':') {
 		if (*p == '\0' && (p = *argptr++) == NULL)
 			error("No arg for -%c option", c);
-		optarg = p;
+		shoptarg = p;
 		p = NULL;
 	}
 	optptr = p;
diff --git a/bin/sh/options.h b/bin/sh/options.h
index e283703..023027b 100644
--- a/bin/sh/options.h
+++ b/bin/sh/options.h
@@ -103,7 +103,7 @@ extern char *minusc;		/* argument to -c option */
 extern char *arg0;		/* $0 */
 extern struct shparam shellparam;  /* $@ */
 extern char **argptr;		/* argument list for builtin commands */
-extern char *optarg;		/* set by nextopt */
+extern char *shoptarg;		/* set by nextopt */
 extern char *optptr;		/* used by nextopt */
 
 void procargs __P((int, char **));
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 2aa2665..9b141cc 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -59,6 +59,7 @@ static const char rcsid[] =
 #include "mystring.h"
 #include "alias.h"
 #include "show.h"
+#include "eval.h"
 #ifndef NO_HISTORY
 #include "myhistedit.h"
 #endif
@@ -678,8 +679,6 @@ peektoken() {
 	return (t);
 }
 
-STATIC int xxreadtoken();
-
 STATIC int
 readtoken() {
 	int t;
-- 
cgit v1.1