summaryrefslogtreecommitdiffabout
path: root/src/cmdline.opt
Side-by-side diff
Diffstat (limited to 'src/cmdline.opt') (more/less context) (ignore whitespace changes)
-rw-r--r--src/cmdline.opt14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cmdline.opt b/src/cmdline.opt
index afa1949..f92f48f 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -211,11 +211,15 @@ parse_options(int argc, char *argv[])
GETOPT(argc, argv)
if (pp_cmd_acc && grecs_preprocessor)
{
- char *defs = txtacc_finish (pp_cmd_acc);
- char *cmd = xmalloc (strlen (grecs_preprocessor) + strlen (defs) + 1);
- strcpy (cmd, grecs_preprocessor);
- strcat (cmd, defs);
- grecs_preprocessor = cmd;
+ char *cmd;
+ size_t len = strlen (grecs_preprocessor);
+ txtacc_1grow (pp_cmd_acc, 0);
+ txtacc_grow (pp_cmd_acc, grecs_preprocessor, len + 1);
+ cmd = txtacc_finish (pp_cmd_acc, 1);
txtacc_free (pp_cmd_acc);
+ memmove (cmd + len + 1, cmd, strlen (cmd) + 1);
+ memcpy (cmd, grecs_preprocessor, len);
+ cmd[len] = ' ';
+ grecs_preprocessor = cmd;
}
}

Return to:

Send suggestions and report system problems to the System administrator.