I'm an idiot and this looks better and is more KISS (I suppose)

too bad I don't just wrap it in braces
This commit is contained in:
tg 2007-07-06 02:39:37 +00:00
parent fca52a0f6a
commit a29f4f60f8
2 changed files with 9 additions and 6 deletions

4
eval.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.32 2007/07/06 02:22:56 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.33 2007/07/06 02:39:36 tg Exp $");
#ifdef MKSH_SMALL
#define MKSH_NOPWNAM
@ -798,7 +798,7 @@ varsub(Expand *xp, const char *sp, const char *word,
stype = 0x80;
c = word[slen + 0] == CHAR ? word[slen + 1] : 0;
}
if (stype == 0x80 && !c && word[slen] && word[slen] != CHAR) {
if (stype == 0x80 && (c == ' ' || c == '0')) {
stype |= '0';
} else if (ctype(c, C_SUBOP1)) {
slen += 2;

11
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.41 2007/07/06 02:24:18 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.42 2007/07/06 02:39:37 tg Exp $");
/* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state. */
@ -291,7 +291,7 @@ yylex(int cf)
*wp++ = CHAR, *wp++ = c;
c = getsc();
if (c == ':') {
*wp++ = QCHAR;
*wp++ = CHAR;
*wp++ = '0';
*wp++ = ADELIM;
*wp++ = ':';
@ -303,8 +303,11 @@ yylex(int cf)
c == '('/*)*/ || c == ' ' ||
c == '$' /* XXX what else? */) {
/* substring subst. */
*wp++ = QCHAR;
*wp++ = c;
if (c != ' ') {
*wp++ = CHAR;
*wp++ = ' ';
}
ungetsc(c);
PUSH_STATE(SADELIM);
statep->ls_sadelim.delimiter = ':';
statep->ls_sadelim.num = 2;