Set opterr to zero to avoid duplicate warnings from getopt(3) for unknown

options.
This commit is contained in:
Tim J. Robbins 2002-07-25 10:47:38 +00:00
parent 52384d0388
commit 050f7913c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100663
5 changed files with 6 additions and 2 deletions

View File

@ -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) {

View File

@ -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':

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {