diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-23 10:16:12 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-23 10:16:12 +0000 |
commit | 0a65e190f4dafd5850fb3e86df30e88b198bab1e (patch) | |
tree | 98e58536f38459d9601f7c164ef1d11d487906fe | |
parent | 4d7f965c8e1de8aa054ff6373727d1f46d3220de (diff) | |
download | busybox-w32-0a65e190f4dafd5850fb3e86df30e88b198bab1e.tar.gz busybox-w32-0a65e190f4dafd5850fb3e86df30e88b198bab1e.tar.bz2 busybox-w32-0a65e190f4dafd5850fb3e86df30e88b198bab1e.zip |
Support the '=' command
-rw-r--r-- | editors/sed.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/editors/sed.c b/editors/sed.c index df623465f..4ab721982 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -431,7 +431,7 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd | |||
431 | 431 | ||
432 | /* if it was a single-letter command that takes no arguments (such as 'p' | 432 | /* if it was a single-letter command that takes no arguments (such as 'p' |
433 | * or 'd') all we need to do is increment the index past that command */ | 433 | * or 'd') all we need to do is increment the index past that command */ |
434 | if (strchr("pd", sed_cmd->cmd)) { | 434 | if (strchr("pd=", sed_cmd->cmd)) { |
435 | idx++; | 435 | idx++; |
436 | } | 436 | } |
437 | /* handle (s)ubstitution command */ | 437 | /* handle (s)ubstitution command */ |
@@ -451,7 +451,7 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd | |||
451 | idx += parse_file_cmd(sed_cmd, &cmdstr[idx]); | 451 | idx += parse_file_cmd(sed_cmd, &cmdstr[idx]); |
452 | } | 452 | } |
453 | else { | 453 | else { |
454 | error_msg_and_die("invalid command"); | 454 | error_msg_and_die("Unsupported command %c", sed_cmd->cmd); |
455 | } | 455 | } |
456 | 456 | ||
457 | /* give back whatever's left over */ | 457 | /* give back whatever's left over */ |
@@ -685,7 +685,9 @@ static void process_file(FILE *file) | |||
685 | * actual sedding | 685 | * actual sedding |
686 | */ | 686 | */ |
687 | switch (sed_cmd->cmd) { | 687 | switch (sed_cmd->cmd) { |
688 | 688 | case '=': | |
689 | printf("%d\n", linenum); | ||
690 | break; | ||
689 | case 'p': | 691 | case 'p': |
690 | puts(line); | 692 | puts(line); |
691 | break; | 693 | break; |