diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2018-04-07 15:12:57 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2018-04-07 15:12:57 +0200 |
commit | 6e1ab9aa550695ee7e3d467b4173c0b83ba7f759 (patch) | |
tree | 8fb7faa4364a7cbf1cba48296a5f537e13f2a8d9 /Src/cond.c | |
parent | 5ad56a41f1ee2e61abca079f5ea8909f895ac2dd (diff) | |
parent | f027f1d6e876708bc75d4217e1ca26898658d8d3 (diff) | |
download | zsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.tar.gz zsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.zip |
Merge tag 'zsh-5.4.2-test-2' / 'upstream' branch into 'debian' branch
Test version 2 prior to zsh 5.5.
Diffstat (limited to 'Src/cond.c')
-rw-r--r-- | Src/cond.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Src/cond.c b/Src/cond.c index b9a47cea5..9f13e07d7 100644 --- a/Src/cond.c +++ b/Src/cond.c @@ -61,7 +61,8 @@ static void cond_subst(char **strp, int glob_ok) * of functionality. * * Return status is the final shell status, i.e. 0 for true, - * 1 for false and 2 for error. + * 1 for false, 2 for syntax error, 3 for "option in tested in + * -o does not exist". */ /**/ @@ -86,10 +87,10 @@ evalcond(Estate state, char *fromtest) if (tracingcond) fprintf(xtrerr, " %s", condstr[ctype]); ret = evalcond(state, fromtest); - if (ret == 2) - return ret; - else + if (ret == 0 || ret == 1) return !ret; + else + return ret; case COND_AND: if (!(ret = evalcond(state, fromtest))) { if (tracingcond) @@ -100,7 +101,8 @@ evalcond(Estate state, char *fromtest) return ret; } case COND_OR: - if ((ret = evalcond(state, fromtest)) == 1) { + ret = evalcond(state, fromtest); + if (ret == 1 || ret == 3) { if (tracingcond) fprintf(xtrerr, " %s", condstr[ctype]); goto rec; @@ -506,8 +508,12 @@ optison(char *name, char *s) else i = optlookup(s); if (!i) { - zwarnnam(name, "no such option: %s", s); - return 2; + if (isset(POSIXBUILTINS)) + return 1; + else { + zwarnnam(name, "no such option: %s", s); + return 3; + } } else if(i < 0) return !unset(-i); else |