Fixed Svannah bug #17782 ('./' prefix added at start of arg while it should be added at the start of the expansion of {})

This commit is contained in:
James Youngman
2006-11-08 07:11:43 +00:00
parent af3c01528a
commit 7bdf3f39e5
2 changed files with 17 additions and 13 deletions
+11 -13
View File
@@ -134,14 +134,12 @@ bc_do_insert (const struct buildcmd_control *ctl,
insertbuf = (char *) xmalloc (ctl->arg_max + 1);
p = insertbuf;
need_prefix = 0;
do
{
size_t len; /* Length in ARG before `replace_pat'. */
char *s = mbstrstr (arg, ctl->replace_pat);
if (s)
{
need_prefix = 1;
len = s - arg;
}
else
@@ -161,31 +159,31 @@ bc_do_insert (const struct buildcmd_control *ctl,
if (s)
{
if (bytes_left <= lblen)
if (bytes_left <= (lblen + pfxlen))
break;
else
bytes_left -= lblen;
bytes_left -= (lblen + pfxlen);
if (prefix)
{
strcpy (p, prefix);
p += pfxlen;
}
strcpy (p, linebuf);
p += lblen;
arg += ctl->rplen;
arglen -= ctl->rplen;
p += lblen;
}
}
while (*arg);
if (*arg)
error (1, 0, _("command too long"));
*p++ = '\0';
if (!need_prefix)
{
prefix = NULL;
pfxlen = 0;
}
bc_push_arg (ctl, state,
insertbuf, p - insertbuf,
prefix, pfxlen,
NULL, 0,
initial_args);
}