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:
tg
2011-05-29 02:18:57 +00:00
parent 9fe3ba48d2
commit 2cfc3e5c3d
13 changed files with 971 additions and 319 deletions

20
syn.c
View File

@@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.64 2011/05/07 00:51:12 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.65 2011/05/29 02:18:57 tg Exp $");
extern short subshell_nesting_level;
@@ -619,7 +619,17 @@ casepart(int endtok)
t->left = c_list(true);
/* Note: POSIX requires the ;; */
if ((tpeek(CONTIN|KEYWORD|ALIAS)) != endtok)
musthave(BREAK, CONTIN|KEYWORD|ALIAS);
switch (symbol) {
default:
syntaxerr(NULL);
case BREAK:
case BRKEV:
case BRKFT:
t->u.charflag =
(symbol == BRKEV) ? '|' :
(symbol == BRKFT) ? '&' : ';';
ACCEPT;
}
return (t);
}
@@ -768,6 +778,8 @@ const struct tokeninfo {
{ "&&", LOGAND, false },
{ "||", LOGOR, false },
{ ";;", BREAK, false },
{ ";|", BRKEV, false },
{ ";&", BRKFT, false },
{ "((", MDPAREN, false },
{ "|&", COPROC, false },
/* and some special cases... */
@@ -782,8 +794,8 @@ initkeywords(void)
struct tbl *p;
ktinit(&keywords, APERM,
/* must be 80% of 2^n (currently 20 keywords) */
32);
/* must be 80% of 2^n (currently 28 keywords) */
64);
for (tt = tokentab; tt->name; tt++) {
if (tt->reserved) {
p = ktenter(&keywords, tt->name, hash(tt->name));