diff options
author | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-07-13 22:52:02 +0000 |
---|---|---|
committer | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-07-13 22:52:02 +0000 |
commit | 192ba83efd514adcdad401f503a3fbe4115a01fe (patch) | |
tree | b1647a50d97a31c8e68cfc6e92d68ca236805db9 /sed.c | |
parent | 86930bad086955965134b54a61528040ad863d0e (diff) | |
download | busybox-w32-192ba83efd514adcdad401f503a3fbe4115a01fe.tar.gz busybox-w32-192ba83efd514adcdad401f503a3fbe4115a01fe.tar.bz2 busybox-w32-192ba83efd514adcdad401f503a3fbe4115a01fe.zip |
Fixed bug where sed '/foo/p' was printing "invalid command".
git-svn-id: svn://busybox.net/trunk/busybox@842 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'sed.c')
-rw-r--r-- | sed.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -188,11 +188,9 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
188 | } while (isdigit(my_str[idx])); | 188 | } while (isdigit(my_str[idx])); |
189 | my_str[idx] = 0; | 189 | my_str[idx] = 0; |
190 | *line = atoi(my_str); | 190 | *line = atoi(my_str); |
191 | *regex = NULL; | ||
192 | } | 191 | } |
193 | else if (my_str[idx] == '$') { | 192 | else if (my_str[idx] == '$') { |
194 | *line = -1; | 193 | *line = -1; |
195 | *regex = NULL; | ||
196 | idx++; | 194 | idx++; |
197 | } | 195 | } |
198 | else if (my_str[idx] == '/') { | 196 | else if (my_str[idx] == '/') { |
@@ -202,6 +200,7 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
202 | my_str[idx] = '\0'; | 200 | my_str[idx] = '\0'; |
203 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); | 201 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); |
204 | xregcomp(*regex, my_str+1, REG_NEWLINE); | 202 | xregcomp(*regex, my_str+1, REG_NEWLINE); |
203 | idx++; /* so it points to the next character after the last '/' */ | ||
205 | } | 204 | } |
206 | else { | 205 | else { |
207 | fprintf(stderr, "sed.c:get_address: no address found in string\n"); | 206 | fprintf(stderr, "sed.c:get_address: no address found in string\n"); |