Set opterr to zero to avoid duplicate warnings from getopt(3) for unknown
options.
This commit is contained in:
parent
3be089e932
commit
ca8e9f2edf
@ -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) {
|
||||
|
@ -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':
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user