diff options
author | stefanf <stefanf@FreeBSD.org> | 2006-04-09 12:21:20 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2006-04-09 12:21:20 +0000 |
commit | 968438f2fcefda39356b35981197656400d90f0f (patch) | |
tree | b2e9e5bfdcae5d9e40672127fa23de6d02ac47ee /bin/sh/options.c | |
parent | 209025405d1718f956439567f56fb8504bbfc6cf (diff) | |
download | FreeBSD-src-968438f2fcefda39356b35981197656400d90f0f.zip FreeBSD-src-968438f2fcefda39356b35981197656400d90f0f.tar.gz |
Implement some of the differences between special built-ins and other builtins
demanded by POSIX.
- A redirection error is only fatal (meaning the execution of a shell script is
terminated) for special built-ins. Previously it was fatal for all shell
builtins, causing problems like the one reported in PR 88845.
- Variable assignments remain in effect for special built-ins.
- Option or operand errors are only fatal for special built-ins.
This change also makes errors from 'fc' non-fatal (I could not find any reasons
for this behaviour).
Somewhat independently from the above down-grade the error handling in the
shift built-in if the operand is bigger than $# from an error() call (which is
now fatal) to a return 1. I'm not sure if this should be considered a POSIX
"operand error", however this change is needed for now as we trigger that error
while building libncurses. Comparing with other shells, zsh does the same as
our sh before this change (write a diagnostic, return 1), bash behaves as our
sh after this commit (no diagnostic, return 1) and ksh93 and NetBSD's sh treat
it as a fatal error.
Diffstat (limited to 'bin/sh/options.c')
-rw-r--r-- | bin/sh/options.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c index 64e129e..58c5c7b 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -374,7 +374,7 @@ shiftcmd(int argc, char **argv) if (argc > 1) n = number(argv[1]); if (n > shellparam.nparam) - error("can't shift that many"); + return 1; INTOFF; shellparam.nparam -= n; for (ap1 = shellparam.p ; --n >= 0 ; ap1++) { |