diff options
author | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-07-14 00:49:59 +0000 |
---|---|---|
committer | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-07-14 00:49:59 +0000 |
commit | 1f2788afe9f02d6d511259d1b416b54b56461dd7 (patch) | |
tree | 577d93df5005b4187cd30aa025bb258bee40b850 /sed.c | |
parent | d3c224e1a92df0923d257541c7caaa2ead3e42d7 (diff) | |
download | busybox-w32-1f2788afe9f02d6d511259d1b416b54b56461dd7.tar.gz busybox-w32-1f2788afe9f02d6d511259d1b416b54b56461dd7.tar.bz2 busybox-w32-1f2788afe9f02d6d511259d1b416b54b56461dd7.zip |
It dawned on me that I would need to grow a char buffer one extra char bigger
to accomodate a trailing '\n'ewline that I append to it later one. This is
only necessary for the case of one inserted, appended, or changed line, but
it's still necessary.
git-svn-id: svn://busybox.net/trunk/busybox@845 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'sed.c')
-rw-r--r-- | sed.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -309,7 +309,10 @@ static void parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr) | |||
309 | fatalError("bad format in edit expression\n"); | 309 | fatalError("bad format in edit expression\n"); |
310 | 310 | ||
311 | /* store the edit line text */ | 311 | /* store the edit line text */ |
312 | sed_cmd->editline = strdup(&editstr[3]); | 312 | /* make editline big enough to accomodate the extra '\n' we will tack on |
313 | * to the end */ | ||
314 | sed_cmd->editline = xmalloc(strlen(&editstr[3]) + 2); | ||
315 | strcpy(sed_cmd->editline, &editstr[3]); | ||
313 | ptr = sed_cmd->editline; | 316 | ptr = sed_cmd->editline; |
314 | 317 | ||
315 | /* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */ | 318 | /* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */ |