version 1.40, 2000/07/17 22:57:37 |
version 1.41, 2000/07/17 23:01:20 |
|
|
case 'N': |
case 'N': |
case 'M': |
case 'M': |
{ |
{ |
char *pattern; |
|
char *cp2; |
|
Boolean copy; |
|
|
|
copy = FALSE; |
|
for (cp = tstr + 1; |
for (cp = tstr + 1; |
*cp != '\0' && *cp != ':' && *cp != endc; |
*cp != '\0' && *cp != ':' && *cp != endc; |
cp++) |
cp++) { |
{ |
|
if (*cp == '\\' && (cp[1] == ':' || cp[1] == endc)){ |
if (*cp == '\\' && (cp[1] == ':' || cp[1] == endc)){ |
copy = TRUE; |
|
cp++; |
cp++; |
} |
} |
} |
} |
termc = *cp; |
termc = *cp; |
*cp = '\0'; |
*cp = '\0'; |
if (copy) { |
if (*tstr == 'M') |
/* |
newStr = VarModify(str, VarMatch, tstr+1); |
* Need to compress the \:'s out of the pattern, so |
else |
* allocate enough room to hold the uncompressed |
newStr = VarModify(str, VarNoMatch, tstr+1); |
* pattern (note that cp started at tstr+1, so |
|
* cp - tstr takes the null byte into account) and |
|
* compress the pattern into the space. |
|
*/ |
|
pattern = emalloc(cp - tstr); |
|
for (cp2 = pattern, cp = tstr + 1; |
|
*cp != '\0'; |
|
cp++, cp2++) |
|
{ |
|
if ((*cp == '\\') && |
|
(cp[1] == ':' || cp[1] == endc)) { |
|
cp++; |
|
} |
|
*cp2 = *cp; |
|
} |
|
*cp2 = '\0'; |
|
} else { |
|
pattern = &tstr[1]; |
|
} |
|
if (*tstr == 'M' || *tstr == 'm') { |
|
newStr = VarModify(str, VarMatch, pattern); |
|
} else { |
|
newStr = VarModify(str, VarNoMatch, pattern); |
|
} |
|
if (copy) { |
|
free(pattern); |
|
} |
|
break; |
break; |
} |
} |
case 'S': |
case 'S': |