diff options
author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-10-01 06:45:11 +0000 |
---|---|---|
committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-10-01 06:45:11 +0000 |
commit | 31a410d2d5713faf538018f8f5fd1fd8d883e50c (patch) | |
tree | 5dbb7fe21f0461f268ed1742ed53712759beca19 | |
parent | 98450521145e963ff3036feb954aadef1d3d3813 (diff) | |
download | busybox-w32-31a410d2d5713faf538018f8f5fd1fd8d883e50c.tar.gz busybox-w32-31a410d2d5713faf538018f8f5fd1fd8d883e50c.tar.bz2 busybox-w32-31a410d2d5713faf538018f8f5fd1fd8d883e50c.zip |
Patch by Rob Landley, fix "newline after edit command"
git-svn-id: svn://busybox.net/trunk/busybox@7584 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | editors/sed.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c index 6452a321c..3d6d72c68 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -176,8 +176,8 @@ static void parse_escapes(char *dest, const char *string, int len, char from, ch | |||
176 | 176 | ||
177 | while(i<len) { | 177 | while(i<len) { |
178 | if(string[i] == '\\') { | 178 | if(string[i] == '\\') { |
179 | if(string[i+1] == from) { | 179 | if(!to || string[i+1] == from) { |
180 | *(dest++) = to; | 180 | *(dest++) = to ? to : string[i+1]; |
181 | i+=2; | 181 | i+=2; |
182 | continue; | 182 | continue; |
183 | } else *(dest++)=string[i++]; | 183 | } else *(dest++)=string[i++]; |
@@ -403,6 +403,7 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr) | |||
403 | ("only a beginning address can be specified for edit commands"); | 403 | ("only a beginning address can be specified for edit commands"); |
404 | while(isspace(*cmdstr)) cmdstr++; | 404 | while(isspace(*cmdstr)) cmdstr++; |
405 | sed_cmd->string = bb_xstrdup(cmdstr); | 405 | sed_cmd->string = bb_xstrdup(cmdstr); |
406 | parse_escapes(sed_cmd->string,sed_cmd->string,strlen(cmdstr),0,0); | ||
406 | cmdstr += strlen(cmdstr); | 407 | cmdstr += strlen(cmdstr); |
407 | /* handle file cmds: (r)ead */ | 408 | /* handle file cmds: (r)ead */ |
408 | } else if(strchr("rw", sed_cmd->cmd)) { | 409 | } else if(strchr("rw", sed_cmd->cmd)) { |