diff options
author | Glenn L McGrath | 2002-12-23 10:16:12 +0000 |
---|---|---|
committer | Glenn L McGrath | 2002-12-23 10:16:12 +0000 |
commit | 0a65e190f4dafd5850fb3e86df30e88b198bab1e (patch) | |
tree | 98e58536f38459d9601f7c164ef1d11d487906fe /editors | |
parent | 4d7f965c8e1de8aa054ff6373727d1f46d3220de (diff) | |
download | busybox-0a65e190f4dafd5850fb3e86df30e88b198bab1e.zip busybox-0a65e190f4dafd5850fb3e86df30e88b198bab1e.tar.gz |
Support the '=' command
Diffstat (limited to 'editors')
-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 df62346..4ab7219 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 /* if it was a single-letter command that takes no arguments (such as 'p' * or 'd') all we need to do is increment the index past that command */ - if (strchr("pd", sed_cmd->cmd)) { + if (strchr("pd=", sed_cmd->cmd)) { idx++; } /* handle (s)ubstitution command */ @@ -451,7 +451,7 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd idx += parse_file_cmd(sed_cmd, &cmdstr[idx]); } else { - error_msg_and_die("invalid command"); + error_msg_and_die("Unsupported command %c", sed_cmd->cmd); } /* give back whatever's left over */ @@ -685,7 +685,9 @@ static void process_file(FILE *file) * actual sedding */ switch (sed_cmd->cmd) { - + case '=': + printf("%d\n", linenum); + break; case 'p': puts(line); break; |