From ca8e9f2edf22b507593fe9c0b5a2b8f9fad7d37e Mon Sep 17 00:00:00 2001 From: tjr Date: Thu, 25 Jul 2002 10:47:38 +0000 Subject: Set opterr to zero to avoid duplicate warnings from getopt(3) for unknown options. --- bin/sh/cd.c | 4 ++-- bin/sh/eval.c | 1 + bin/sh/histedit.c | 1 + bin/sh/jobs.c | 1 + bin/sh/var.c | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) (limited to 'bin') 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) { -- cgit v1.1