I _think_ this implements ${foo/bar/baz} logic (bar is a glob pattern)

todo tomorrow:
• test case (compare with e.g. GNU bash)
• manpage
• version bump

sqchar is a bit ugly, but \/ must be preserved, as we don’t get wdencoded
strings later on in the process (eval.c CSUBST) and I didn’t want to have
an implementation like ${foo: 2: 3} this time
This commit is contained in:
tg
2008-02-27 01:00:10 +00:00
parent 0f1501326b
commit 01b54f1fd5
4 changed files with 97 additions and 14 deletions

4
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.52 2008/02/26 21:08:33 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.53 2008/02/27 01:00:09 tg Exp $");
/*
* states while lexing word
@ -395,7 +395,7 @@ yylex(int cf)
/* If this is a trim operation,
* treat (,|,) specially in STBRACE.
*/
if (c == '#' || c == '%') {
if (ctype(c, C_SUBOP2)) {
ungetsc(c);
PUSH_STATE(STBRACE);
} else {