summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-07-25 10:47:38 +0000
committertjr <tjr@FreeBSD.org>2002-07-25 10:47:38 +0000
commitca8e9f2edf22b507593fe9c0b5a2b8f9fad7d37e (patch)
tree5018303a2ea7f396a38480e2e723c454ffc130c1 /bin
parent3be089e932919830a7affb5dff5e8751a597e10b (diff)
downloadFreeBSD-src-ca8e9f2edf22b507593fe9c0b5a2b8f9fad7d37e.zip
FreeBSD-src-ca8e9f2edf22b507593fe9c0b5a2b8f9fad7d37e.tar.gz
Set opterr to zero to avoid duplicate warnings from getopt(3) for unknown
options.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/cd.c4
-rw-r--r--bin/sh/eval.c1
-rw-r--r--bin/sh/histedit.c1
-rw-r--r--bin/sh/jobs.c1
-rw-r--r--bin/sh/var.c1
5 files changed, 6 insertions, 2 deletions
diff --git a/bin/sh/cd.c b/bin/sh/cd.c
index 39b466f..cf46a02 100644
--- a/bin/sh/cd.c
+++ b/bin/sh/cd.c
@@ -87,7 +87,7 @@ cdcmd(int argc, char **argv)
struct stat statb;
int ch, phys, print = 0;
- optreset = 1; optind = 1; /* initialize getopt */
+ optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
phys = 0;
while ((ch = getopt(argc, argv, "LP")) != -1) {
switch (ch) {
@@ -323,7 +323,7 @@ pwdcmd(int argc, char **argv)
char buf[PATH_MAX];
int ch, phys;
- optreset = 1; optind = 1; /* initialize getopt */
+ optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
phys = 0;
while ((ch = getopt(argc, argv, "LP")) != -1) {
switch (ch) {
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index 4e1079b..e147e43 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -1007,6 +1007,7 @@ commandcmd(int argc, char **argv)
path = pathval();
optind = optreset = 1;
+ opterr = 0;
while ((ch = getopt(argc, argv, "p")) != -1) {
switch (ch) {
case 'p':
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 6cd9fe4..d081d05 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -208,6 +208,7 @@ histcmd(int argc, char **argv)
error("missing history argument");
optreset = 1; optind = 1; /* initialize getopt */
+ opterr = 0;
while (not_fcnumber(argv[optind]) &&
(ch = getopt(argc, argv, ":e:lnrs")) != -1)
switch ((char)ch) {
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 1cab468..db13855 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -259,6 +259,7 @@ jobscmd(int argc, char *argv[])
int ch, sformat, lformat;
optind = optreset = 1;
+ opterr = 0;
sformat = lformat = 0;
while ((ch = getopt(argc, argv, "ls")) != -1) {
switch (ch) {
diff --git a/bin/sh/var.c b/bin/sh/var.c
index a4241af..b3be70a 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -543,6 +543,7 @@ exportcmd(int argc, char **argv)
cmdname = argv[0];
optreset = optind = 1;
+ opterr = 0;
values = 0;
while ((ch = getopt(argc, argv, "p")) != -1) {
switch (ch) {
OpenPOWER on IntegriCloud