Revert r216423 per request from Jilles.
The new behavior prevents us from being able to bail out explicitly on unknown options that we have not implemented. BASH for instance have introduced a '-v' for printf(1) builtin and it seems to be bad to pretend that we supported it and have a script break silently.
This commit is contained in:
parent
879b3da6b5
commit
18ea61230f
@ -101,7 +101,7 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
int chopped, end, rval;
|
int ch, chopped, end, rval;
|
||||||
char *format, *fmt, *start;
|
char *format, *fmt, *start;
|
||||||
|
|
||||||
#ifndef SHELL
|
#ifndef SHELL
|
||||||
@ -110,15 +110,15 @@ main(int argc, char *argv[])
|
|||||||
#ifdef SHELL
|
#ifdef SHELL
|
||||||
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
|
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
|
||||||
#endif
|
#endif
|
||||||
/* Skip argv[0] which is the process name */
|
while ((ch = getopt(argc, argv, "")) != -1)
|
||||||
argv++;
|
switch (ch) {
|
||||||
argc--;
|
case '?':
|
||||||
|
default:
|
||||||
/* Need to accept/ignore "--" option. */
|
usage();
|
||||||
if (argc >= 1 && strcmp(*argv, "--") == 0) {
|
return (1);
|
||||||
argc--;
|
}
|
||||||
argv++;
|
argc -= optind;
|
||||||
}
|
argv += optind;
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
usage();
|
usage();
|
||||||
|
Loading…
Reference in New Issue
Block a user