Message ID | 0ea78f2dddbb59ce2c984c83ab45cd811191b499.1675798292.git.nabijaczleweli@nabijaczleweli.xyz (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | [1/6] fc -s: refuse multiple events instead of ignoring | expand |
diff --git a/src/histedit.c b/src/histedit.c index f10e5ab..502ad40 100644 --- a/src/histedit.c +++ b/src/histedit.c @@ -217,7 +217,7 @@ histcmd(int argc, char **argv) #else optreset = 1; optind = 1; /* initialize getopt */ #endif - while (not_fcnumber(argv[optind]) && + while (not_fcnumber(argv[optind ?: 1]) && (ch = getopt(argc, argv, ":e:lnrs")) != -1) switch ((char)ch) { case 'e': @@ -243,6 +243,7 @@ histcmd(int argc, char **argv) sh_error("unknown option: -%c", optopt); /* NOTREACHED */ } + optind = optind ?: 1; argc -= optind, argv += optind; /*