Skip to content

Commit

Permalink
getopt_long: neater errors
Browse files Browse the repository at this point in the history
  • Loading branch information
abrasive committed Jun 19, 2013
1 parent 3aa8bab commit d699d43
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions getopt_long.c
Expand Up @@ -148,8 +148,7 @@ getopt_long(int argc, char *const argv[],
}

if (opterr && optstring[0] != ':')
warn(
"%s: illegal option -- %s\n", argv[0], place);
warn("illegal option -- %s\n", place);
place = EMSG;
optind++;
return BADCH;
Expand All @@ -165,8 +164,7 @@ getopt_long(int argc, char *const argv[],
if (!*place)
++optind;
if (opterr && *optstring != ':')
warn(
"%s: illegal option -- %c\n", argv[0], optopt);
warn("illegal option -- %c\n", optopt);
return BADCH;
}

Expand All @@ -186,9 +184,7 @@ getopt_long(int argc, char *const argv[],
if (*optstring == ':')
return BADARG;
if (opterr)
warn(
"%s: option requires an argument -- %c\n",
argv[0], optopt);
warn("option requires an argument -- %c\n", optopt);
return BADCH;
}
else
Expand Down

0 comments on commit d699d43

Please sign in to comment.