diff options
author | Bryan Drewery <bryan@shatow.net> | 2022-11-05 22:53:45 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2022-11-05 22:53:45 +0300 |
commit | 3a903aa725fd285a375045b766e0b8c5849bb519 (patch) | |
tree | e4ba68f6dd43635b8ce47b19c8331e679a62d1a6 | |
parent | 93fc1245586c2b7aa9e6c1f26fef725f1f64c17e (diff) |
Update sh from FreeBSD 8d7221ca2dd5e0b6c633761b314cffed82ddca72
-rw-r--r-- | external/sh/histedit.c | 43 | ||||
-rw-r--r-- | external/sh/jobs.h | 2 | ||||
-rw-r--r-- | external/sh/options.c | 5 |
3 files changed, 28 insertions, 22 deletions
diff --git a/external/sh/histedit.c b/external/sh/histedit.c index 453260a2..88122002 100644 --- a/external/sh/histedit.c +++ b/external/sh/histedit.c @@ -255,7 +255,6 @@ setterm(const char *term) int histcmd(int argc, char **argv __unused) { - int ch; const char *editor = NULL; HistEvent he; int lflg = 0, nflg = 0, rflg = 0, sflg = 0; @@ -277,25 +276,29 @@ histcmd(int argc, char **argv __unused) if (argc == 1) error("missing history argument"); - while (not_fcnumber(*argptr) && (ch = nextopt("e:lnrs")) != '\0') - switch ((char)ch) { - case 'e': - editor = shoptarg; - break; - case 'l': - lflg = 1; - break; - case 'n': - nflg = 1; - break; - case 'r': - rflg = 1; - break; - case 's': - sflg = 1; - break; - } - + while (not_fcnumber(*argptr)) + do { + switch (nextopt("e:lnrs")) { + case 'e': + editor = shoptarg; + break; + case 'l': + lflg = 1; + break; + case 'n': + nflg = 1; + break; + case 'r': + rflg = 1; + break; + case 's': + sflg = 1; + break; + case '\0': + goto operands; + } + } while (nextopt_optptr != NULL); +operands: savehandler = handler; /* * If executing... diff --git a/external/sh/jobs.h b/external/sh/jobs.h index d0caf063..411d08f2 100644 --- a/external/sh/jobs.h +++ b/external/sh/jobs.h @@ -55,7 +55,7 @@ void setjobctl(int); void showjobs(int, int); struct job *makejob(union node *, int); pid_t forkshell(struct job *, union node *, int); -pid_t vforkexecshell(struct job *, char **, char **, const char *, int, int []); +pid_t vforkexecshell(struct job *, char **, char **, const char *, int, int [2]); int waitforjob(struct job *, int *); int stoppedjobs(void); int backgndpidset(void); diff --git a/external/sh/options.c b/external/sh/options.c index 97171d32..55bfd9d4 100644 --- a/external/sh/options.c +++ b/external/sh/options.c @@ -589,6 +589,9 @@ nextopt(const char *optstring) shoptarg = p; p = NULL; } - nextopt_optptr = p; + if (p != NULL && *p != '\0') + nextopt_optptr = p; + else + nextopt_optptr = NULL; return c; } |