diff options
author | Mark Whitley | 2000-07-13 22:52:02 +0000 |
---|---|---|
committer | Mark Whitley | 2000-07-13 22:52:02 +0000 |
commit | 496e33feeb2d0eb4aa2bf3cc2f34f6e29987c1bd (patch) | |
tree | b1647a50d97a31c8e68cfc6e92d68ca236805db9 /editors/sed.c | |
parent | 4f7fe77d07294586687382597d04fb46a24092e5 (diff) | |
download | busybox-496e33feeb2d0eb4aa2bf3cc2f34f6e29987c1bd.zip busybox-496e33feeb2d0eb4aa2bf3cc2f34f6e29987c1bd.tar.gz |
Fixed bug where sed '/foo/p' was printing "invalid command".
Diffstat (limited to 'editors/sed.c')
-rw-r--r-- | editors/sed.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c index 22d642e..bf8ca1b 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -188,11 +188,9 @@ static int get_address(const char *str, int *line, regex_t **regex) } while (isdigit(my_str[idx])); my_str[idx] = 0; *line = atoi(my_str); - *regex = NULL; } else if (my_str[idx] == '$') { *line = -1; - *regex = NULL; idx++; } else if (my_str[idx] == '/') { @@ -202,6 +200,7 @@ static int get_address(const char *str, int *line, regex_t **regex) my_str[idx] = '\0'; *regex = (regex_t *)xmalloc(sizeof(regex_t)); xregcomp(*regex, my_str+1, REG_NEWLINE); + idx++; /* so it points to the next character after the last '/' */ } else { fprintf(stderr, "sed.c:get_address: no address found in string\n"); |