mirror of
https://github.com/sheumann/hush.git
synced 2024-11-05 06:07:00 +00:00
Patch by Rob Landley, fix "newline after edit command"
This commit is contained in:
parent
aa5a602689
commit
738fb33994
@ -176,8 +176,8 @@ static void parse_escapes(char *dest, const char *string, int len, char from, ch
|
|||||||
|
|
||||||
while(i<len) {
|
while(i<len) {
|
||||||
if(string[i] == '\\') {
|
if(string[i] == '\\') {
|
||||||
if(string[i+1] == from) {
|
if(!to || string[i+1] == from) {
|
||||||
*(dest++) = to;
|
*(dest++) = to ? to : string[i+1];
|
||||||
i+=2;
|
i+=2;
|
||||||
continue;
|
continue;
|
||||||
} else *(dest++)=string[i++];
|
} else *(dest++)=string[i++];
|
||||||
@ -403,6 +403,7 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr)
|
|||||||
("only a beginning address can be specified for edit commands");
|
("only a beginning address can be specified for edit commands");
|
||||||
while(isspace(*cmdstr)) cmdstr++;
|
while(isspace(*cmdstr)) cmdstr++;
|
||||||
sed_cmd->string = bb_xstrdup(cmdstr);
|
sed_cmd->string = bb_xstrdup(cmdstr);
|
||||||
|
parse_escapes(sed_cmd->string,sed_cmd->string,strlen(cmdstr),0,0);
|
||||||
cmdstr += strlen(cmdstr);
|
cmdstr += strlen(cmdstr);
|
||||||
/* handle file cmds: (r)ead */
|
/* handle file cmds: (r)ead */
|
||||||
} else if(strchr("rw", sed_cmd->cmd)) {
|
} else if(strchr("rw", sed_cmd->cmd)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user