g/c magic definitions for simple chars (as opposed to e.g. tokens/lexems)
some (such as NOT) were already gone; this should unconfuse; most were unused anyway…
This commit is contained in:
parent
2a47cab08f
commit
16ac73b074
18
eval.c
18
eval.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.113 2012/03/23 23:25:27 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.114 2012/03/27 22:58:38 tg Exp $");
|
||||
|
||||
/*
|
||||
* string expansion
|
||||
@ -936,10 +936,10 @@ expand(const char *cp, /* input word */
|
||||
*dp++ = MAGIC;
|
||||
}
|
||||
break;
|
||||
case OBRACE:
|
||||
case '{':
|
||||
case '}':
|
||||
case ',':
|
||||
case CBRACE:
|
||||
if ((f & DOBRACE) && (c == OBRACE ||
|
||||
if ((f & DOBRACE) && (c == '{' /*}*/ ||
|
||||
(fdo & DOBRACE))) {
|
||||
fdo |= DOBRACE|DOMAGIC;
|
||||
*dp++ = MAGIC;
|
||||
@ -1664,7 +1664,7 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
||||
char *p;
|
||||
|
||||
/* search for open brace */
|
||||
for (p = exp_start; (p = strchr(p, MAGIC)) && p[1] != OBRACE; p += 2)
|
||||
for (p = exp_start; (p = strchr(p, MAGIC)) && p[1] != '{' /*}*/; p += 2)
|
||||
;
|
||||
brace_start = p;
|
||||
|
||||
@ -1674,9 +1674,9 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
||||
count = 1;
|
||||
for (p += 2; *p && count; p++) {
|
||||
if (ISMAGIC(*p)) {
|
||||
if (*++p == OBRACE)
|
||||
if (*++p == '{' /*}*/)
|
||||
count++;
|
||||
else if (*p == CBRACE)
|
||||
else if (*p == /*{*/ '}')
|
||||
--count;
|
||||
else if (*p == ',' && count == 1)
|
||||
comma = p;
|
||||
@ -1707,9 +1707,9 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
||||
count = 1;
|
||||
for (p = brace_start + 2; p != brace_end; p++) {
|
||||
if (ISMAGIC(*p)) {
|
||||
if (*++p == OBRACE)
|
||||
if (*++p == '{' /*}*/)
|
||||
count++;
|
||||
else if ((*p == CBRACE && --count == 0) ||
|
||||
else if ((*p == /*{*/ '}' && --count == 0) ||
|
||||
(*p == ',' && count == 1)) {
|
||||
char *news;
|
||||
int l1, l2, l3;
|
||||
|
12
sh.h
12
sh.h
@ -152,7 +152,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.533 2012/03/27 22:49:47 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.534 2012/03/27 22:58:39 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R40 2012/03/27"
|
||||
|
||||
@ -383,7 +383,7 @@ extern int wcwidth(__WCHAR_TYPE__);
|
||||
/*
|
||||
* Make MAGIC a char that might be printed to make bugs more obvious, but
|
||||
* not a char that is used often. Also, can't use the high bit as it causes
|
||||
* portability problems (calling strchr(x, 0x80|'x') is error prone).
|
||||
* portability problems (calling strchr(x, 0x80 | 'x') is error prone).
|
||||
*/
|
||||
#define MAGIC (7) /* prefix for *?[!{,} during expand */
|
||||
#define ISMAGIC(c) ((unsigned char)(c) == MAGIC)
|
||||
@ -878,14 +878,6 @@ EXTERN char *current_wd;
|
||||
EXTERN mksh_ari_t x_cols E_INIT(80); /* tty columns */
|
||||
EXTERN mksh_ari_t x_lins E_INIT(24); /* tty lines */
|
||||
|
||||
/* These to avoid bracket matching problems */
|
||||
#define OPAREN '('
|
||||
#define CPAREN ')'
|
||||
#define OBRACK '['
|
||||
#define CBRACK ']'
|
||||
#define OBRACE '{'
|
||||
#define CBRACE '}'
|
||||
|
||||
|
||||
/* Determine the location of the system (common) profile */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user