ack! back these out so I can see what I did wrong. It looks like a
patch-by-hand botch, but it sig-11's during make world.
This commit is contained in:
parent
2a6480c367
commit
3d58e0bf86
@ -97,8 +97,8 @@ STATIC char *exptilde __P((char *, int));
|
||||
STATIC void expbackq __P((union node *, int, int));
|
||||
STATIC int subevalvar __P((char *, char *, int, int, int));
|
||||
STATIC char *evalvar __P((char *, int));
|
||||
STATIC int varisset __P((char *));
|
||||
STATIC void varvalue __P((char *, int, int));
|
||||
STATIC int varisset __P((int));
|
||||
STATIC void varvalue __P((int, int, int));
|
||||
STATIC void recordregion __P((int, int, int));
|
||||
STATIC void ifsbreakup __P((char *, struct arglist *));
|
||||
STATIC void expandmeta __P((struct strlist *, int));
|
||||
@ -547,7 +547,7 @@ evalvar(p, flag)
|
||||
p = strchr(p, '=') + 1;
|
||||
again: /* jump here after setting a variable with ${var=text} */
|
||||
if (special) {
|
||||
set = varisset(var);
|
||||
set = varisset(*var);
|
||||
val = NULL;
|
||||
} else {
|
||||
val = lookupvar(var);
|
||||
@ -563,7 +563,7 @@ evalvar(p, flag)
|
||||
/* insert the value of the variable */
|
||||
if (special) {
|
||||
char *exp, *oexpdest = expdest;
|
||||
varvalue(var, varflags & VSQUOTE, flag & EXP_FULL);
|
||||
varvalue(*var, varflags & VSQUOTE, flag & EXP_FULL);
|
||||
if (subtype == VSLENGTH) {
|
||||
for (exp = oexpdest;exp != expdest; exp++)
|
||||
varlen++;
|
||||
@ -677,23 +677,22 @@ evalvar(p, flag)
|
||||
|
||||
STATIC int
|
||||
varisset(name)
|
||||
char *name;
|
||||
char name;
|
||||
{
|
||||
char **ap;
|
||||
int num;
|
||||
|
||||
if (*name == '!') {
|
||||
if (name == '!') {
|
||||
if (backgndpid == -1)
|
||||
return 0;
|
||||
} else if (*name == '@' || *name == '*') {
|
||||
} else if (name == '@' || name == '*') {
|
||||
if (*shellparam.p == NULL)
|
||||
return 0;
|
||||
} else if (is_digit(*name)) {
|
||||
num = atoi(name);
|
||||
} else if ((unsigned)(name -= '1') <= '9' - '1') {
|
||||
ap = shellparam.p;
|
||||
while (num-- > 0)
|
||||
do {
|
||||
if (*ap++ == NULL)
|
||||
return 0;
|
||||
} while (--name >= 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -706,7 +705,7 @@ varisset(name)
|
||||
|
||||
STATIC void
|
||||
varvalue(name, quoted, allow_split)
|
||||
char *name;
|
||||
char name;
|
||||
int quoted;
|
||||
int allow_split;
|
||||
{
|
||||
@ -733,7 +732,7 @@ varvalue(name, quoted, allow_split)
|
||||
} while (0)
|
||||
|
||||
|
||||
switch (*name) {
|
||||
switch (name) {
|
||||
case '$':
|
||||
num = rootpid;
|
||||
goto numvar;
|
||||
@ -774,12 +773,9 @@ varvalue(name, quoted, allow_split)
|
||||
STRTODEST(p);
|
||||
break;
|
||||
default:
|
||||
if (is_digit(*name)) {
|
||||
num = atoi(name);
|
||||
if (num > 0 && num <= shellparam.nparam) {
|
||||
p = shellparam.p[*name];
|
||||
STRTODEST(p);
|
||||
}
|
||||
if ((unsigned)(name -= '1') <= '9' - '1') {
|
||||
p = shellparam.p[name];
|
||||
STRTODEST(p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1141,7 +1141,6 @@ parsesub: {
|
||||
#ifndef GDB_HACK
|
||||
static const char types[] = "}-+?=";
|
||||
#endif
|
||||
int bracketed_name = 0; /* used to handle ${[0-9]*} variables */
|
||||
|
||||
c = pgetc();
|
||||
if (c != '(' && c != '{' && !is_name(c) && !is_special(c)) {
|
||||
@ -1160,7 +1159,6 @@ parsesub: {
|
||||
USTPUTC(VSNORMAL, out);
|
||||
subtype = VSNORMAL;
|
||||
if (c == '{') {
|
||||
bracketed_name = 1;
|
||||
c = pgetc();
|
||||
if (c == '#') {
|
||||
if ((c = pgetc()) == '}')
|
||||
@ -1176,16 +1174,6 @@ parsesub: {
|
||||
STPUTC(c, out);
|
||||
c = pgetc();
|
||||
} while (is_in_name(c));
|
||||
} else if (is_digit(c)) {
|
||||
if (bracketed_name) {
|
||||
do {
|
||||
STPUTC(c, out);
|
||||
c = pgetc();
|
||||
} while (is_digit(c));
|
||||
} else {
|
||||
STPUTC(c, out);
|
||||
c = pgetc();
|
||||
}
|
||||
} else {
|
||||
if (! is_special(c))
|
||||
badsub: synerror("Bad substitution");
|
||||
|
Loading…
Reference in New Issue
Block a user