mksh R40 Release Candidate 1
Testsuite: • add new need-pass: {yes|no} attribute, default yes • exit with 1 if a need-pass test failed unexpectedly idea by Kacper Kornet <draenog@pld-linux.org> • mark utf8bom-2 as need-pass: no Infrstructure: • add housekeeping function for making a tty raw • switch functions with unused results to void • struct op: u.charflag contains last char of ;; in TPAT • var.c:arraysearch is now a global function Language: • add ;& (fall through) and ;| (examine next) delimiters in addition to ;; (end case) as zsh extensions, because POSIX standardised on ;& already • add -A (read into array), -N (read exactly n bytes), -n (read up to n bytes), -t (timeout) flags for read from ksh93 • allow read -N -1 or -n -1 to slurp the entire input • add -a (read into array the input characters) extension specific to mksh to read, idea by David Korn • add -e (exit with error if PWD was not set correctly after a physical cd) to cd builtin, mandated by next POSIX, and change error codes accordingly Rewrites: • full rewrite of read builtin and its manpage section • add regression tetss for most of the new functionality • duplicate hexdump demo tests for use of read -a • use read -raN-1 in dot.mkshrc to get NUL safe base64, DJB cdb hash and Jenkins one-at-a-time hash functions
This commit is contained in:
33
exec.c
33
exec.c
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.91 2011/05/07 00:51:11 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.92 2011/05/29 02:18:51 tg Exp $");
|
||||
|
||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
||||
@@ -405,15 +405,30 @@ execute(struct op * volatile t,
|
||||
break;
|
||||
|
||||
case TCASE:
|
||||
i = 0;
|
||||
ccp = evalstr(t->str, DOTILDE);
|
||||
for (t = t->left; t != NULL && t->type == TPAT; t = t->right)
|
||||
for (ap = (const char **)t->vars; *ap; ap++)
|
||||
if ((s = evalstr(*ap, DOTILDE|DOPAT)) &&
|
||||
gmatchx(ccp, s, false))
|
||||
goto Found;
|
||||
break;
|
||||
Found:
|
||||
rv = execute(t->left, flags & XERROK, xerrok);
|
||||
for (t = t->left; t != NULL && t->type == TPAT; t = t->right) {
|
||||
for (ap = (const char **)t->vars; *ap; ap++) {
|
||||
if (i || ((s = evalstr(*ap, DOTILDE|DOPAT)) &&
|
||||
gmatchx(ccp, s, false))) {
|
||||
rv = execute(t->left, flags & XERROK,
|
||||
xerrok);
|
||||
i = 0;
|
||||
switch (t->u.charflag) {
|
||||
case '&':
|
||||
i = 1;
|
||||
/* FALLTHROUGH */
|
||||
case '|':
|
||||
goto TCASE_next;
|
||||
}
|
||||
goto TCASE_out;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
TCASE_next:
|
||||
/* empty */;
|
||||
}
|
||||
TCASE_out:
|
||||
break;
|
||||
|
||||
case TBRACE:
|
||||
|
Reference in New Issue
Block a user