mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
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.
This commit is contained in:
parent
02008346c0
commit
34623db618
@ -309,7 +309,10 @@ static void parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
|
|||||||
fatalError("bad format in edit expression\n");
|
fatalError("bad format in edit expression\n");
|
||||||
|
|
||||||
/* store the edit line text */
|
/* store the edit line text */
|
||||||
sed_cmd->editline = strdup(&editstr[3]);
|
/* make editline big enough to accomodate the extra '\n' we will tack on
|
||||||
|
* to the end */
|
||||||
|
sed_cmd->editline = xmalloc(strlen(&editstr[3]) + 2);
|
||||||
|
strcpy(sed_cmd->editline, &editstr[3]);
|
||||||
ptr = sed_cmd->editline;
|
ptr = sed_cmd->editline;
|
||||||
|
|
||||||
/* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */
|
/* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */
|
||||||
|
5
sed.c
5
sed.c
@ -309,7 +309,10 @@ static void parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
|
|||||||
fatalError("bad format in edit expression\n");
|
fatalError("bad format in edit expression\n");
|
||||||
|
|
||||||
/* store the edit line text */
|
/* store the edit line text */
|
||||||
sed_cmd->editline = strdup(&editstr[3]);
|
/* make editline big enough to accomodate the extra '\n' we will tack on
|
||||||
|
* to the end */
|
||||||
|
sed_cmd->editline = xmalloc(strlen(&editstr[3]) + 2);
|
||||||
|
strcpy(sed_cmd->editline, &editstr[3]);
|
||||||
ptr = sed_cmd->editline;
|
ptr = sed_cmd->editline;
|
||||||
|
|
||||||
/* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */
|
/* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */
|
||||||
|
Loading…
Reference in New Issue
Block a user