cp_variablesubst() and cp_bquote(), rewrite

This commit is contained in:
rlar 2013-07-30 21:36:02 +02:00
parent 9eab66131d
commit 909f087237
2 changed files with 8 additions and 11 deletions

View File

@ -37,12 +37,11 @@ cp_bquote(wordlist *wlist)
while (t < s)
wbuf[i++] = *t++;
wbuf[i] = '\0';
(void) strcpy(buf, ++t);
t++;
s = buf;
while (*s && (*s != cp_back)) {
t++; /* Get s and t past the next backquote. */
s++;
}
/* Get s and t past the next backquote. */
while (*t && (*t != cp_back))
*s++ = *t++;
/* What the heck, let "echo `foo" work... */
*s = '\0';
t++; /* Get past the second ` */

View File

@ -691,13 +691,11 @@ cp_variablesubst(wordlist *wlist)
while (t < s)
wbuf[i++] = *t++;
wbuf[i] = '\0';
(void) strcpy(buf, ++t);
t++;
s = buf;
while (*s && (isalphanum(*s) || strchr(VALIDCHARS, *s))) {
/* Get s and t past the end of the var name. */
t++;
s++;
}
/* Get s and t past the end of the var name. */
while (*t && (isalphanum(*t) || strchr(VALIDCHARS, *t)))
*s++ = *t++;
*s = '\0';
nwl = vareval(buf);
if (i) {