Index: bin/sh/histedit.c =================================================================== --- bin/sh/histedit.c +++ bin/sh/histedit.c @@ -77,7 +77,7 @@ static bool in_command_completion; static char *fc_replace(const char *, char *, char *); -static int not_fcnumber(const char *); +static int fcnumber(const char *); static int str_to_event(const char *, int); static int comparator(const void *, const void *, void *); static char **sh_matches(const char *, int, int); @@ -278,7 +278,7 @@ if (argc == 1) error("missing history argument"); - while (not_fcnumber(*argptr) && (ch = nextopt("e:lnrs")) != '\0') + while ((ch = nextopt("e:lnrs")) != '\0') { switch ((char)ch) { case 'e': editor = shoptarg; @@ -296,6 +296,9 @@ sflg = 1; break; } + if (fcnumber(*nextopt_optptr != 0 ? nextopt_optptr : *argptr)) + break; + } savehandler = handler; /* @@ -485,13 +488,13 @@ } static int -not_fcnumber(const char *s) +fcnumber(const char *s) { if (s == NULL) - return (0); + return (1); if (*s == '-') s++; - return (!is_number(s)); + return (is_number(s)); } static int