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"
|
#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
|
* string expansion
|
||||||
@ -936,10 +936,10 @@ expand(const char *cp, /* input word */
|
|||||||
*dp++ = MAGIC;
|
*dp++ = MAGIC;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OBRACE:
|
case '{':
|
||||||
|
case '}':
|
||||||
case ',':
|
case ',':
|
||||||
case CBRACE:
|
if ((f & DOBRACE) && (c == '{' /*}*/ ||
|
||||||
if ((f & DOBRACE) && (c == OBRACE ||
|
|
||||||
(fdo & DOBRACE))) {
|
(fdo & DOBRACE))) {
|
||||||
fdo |= DOBRACE|DOMAGIC;
|
fdo |= DOBRACE|DOMAGIC;
|
||||||
*dp++ = MAGIC;
|
*dp++ = MAGIC;
|
||||||
@ -1664,7 +1664,7 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
|||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
/* search for open brace */
|
/* 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;
|
brace_start = p;
|
||||||
|
|
||||||
@ -1674,9 +1674,9 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
|||||||
count = 1;
|
count = 1;
|
||||||
for (p += 2; *p && count; p++) {
|
for (p += 2; *p && count; p++) {
|
||||||
if (ISMAGIC(*p)) {
|
if (ISMAGIC(*p)) {
|
||||||
if (*++p == OBRACE)
|
if (*++p == '{' /*}*/)
|
||||||
count++;
|
count++;
|
||||||
else if (*p == CBRACE)
|
else if (*p == /*{*/ '}')
|
||||||
--count;
|
--count;
|
||||||
else if (*p == ',' && count == 1)
|
else if (*p == ',' && count == 1)
|
||||||
comma = p;
|
comma = p;
|
||||||
@ -1707,9 +1707,9 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
|
|||||||
count = 1;
|
count = 1;
|
||||||
for (p = brace_start + 2; p != brace_end; p++) {
|
for (p = brace_start + 2; p != brace_end; p++) {
|
||||||
if (ISMAGIC(*p)) {
|
if (ISMAGIC(*p)) {
|
||||||
if (*++p == OBRACE)
|
if (*++p == '{' /*}*/)
|
||||||
count++;
|
count++;
|
||||||
else if ((*p == CBRACE && --count == 0) ||
|
else if ((*p == /*{*/ '}' && --count == 0) ||
|
||||||
(*p == ',' && count == 1)) {
|
(*p == ',' && count == 1)) {
|
||||||
char *news;
|
char *news;
|
||||||
int l1, l2, l3;
|
int l1, l2, l3;
|
||||||
|
10
sh.h
10
sh.h
@ -152,7 +152,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#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
|
#endif
|
||||||
#define MKSH_VERSION "R40 2012/03/27"
|
#define MKSH_VERSION "R40 2012/03/27"
|
||||||
|
|
||||||
@ -878,14 +878,6 @@ EXTERN char *current_wd;
|
|||||||
EXTERN mksh_ari_t x_cols E_INIT(80); /* tty columns */
|
EXTERN mksh_ari_t x_cols E_INIT(80); /* tty columns */
|
||||||
EXTERN mksh_ari_t x_lins E_INIT(24); /* tty lines */
|
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 */
|
/* Determine the location of the system (common) profile */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user