diff options
Diffstat (limited to 'editors/sed.c')
-rw-r--r-- | editors/sed.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/editors/sed.c b/editors/sed.c index e2c6690bb..bb2809d3c 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | * Licensed under GPLv2, see file LICENSE in this source tree. | 13 | * Licensed under GPLv2, see file LICENSE in this source tree. |
14 | */ | 14 | */ |
15 | |||
16 | /* Code overview. | 15 | /* Code overview. |
17 | * | 16 | * |
18 | * Files are laid out to avoid unnecessary function declarations. So for | 17 | * Files are laid out to avoid unnecessary function declarations. So for |
@@ -29,7 +28,6 @@ | |||
29 | * | 28 | * |
30 | * sed_main() is where external code calls into this, with a command line. | 29 | * sed_main() is where external code calls into this, with a command line. |
31 | */ | 30 | */ |
32 | |||
33 | /* Supported features and commands in this version of sed: | 31 | /* Supported features and commands in this version of sed: |
34 | * | 32 | * |
35 | * - comments ('#') | 33 | * - comments ('#') |
@@ -55,7 +53,6 @@ | |||
55 | * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html | 53 | * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html |
56 | * http://sed.sourceforge.net/sedfaq3.html | 54 | * http://sed.sourceforge.net/sedfaq3.html |
57 | */ | 55 | */ |
58 | |||
59 | //config:config SED | 56 | //config:config SED |
60 | //config: bool "sed (12 kb)" | 57 | //config: bool "sed (12 kb)" |
61 | //config: default y | 58 | //config: default y |
@@ -63,10 +60,10 @@ | |||
63 | //config: sed is used to perform text transformations on a file | 60 | //config: sed is used to perform text transformations on a file |
64 | //config: or input from a pipeline. | 61 | //config: or input from a pipeline. |
65 | 62 | ||
66 | //kbuild:lib-$(CONFIG_SED) += sed.o | ||
67 | |||
68 | //applet:IF_SED(APPLET(sed, BB_DIR_BIN, BB_SUID_DROP)) | 63 | //applet:IF_SED(APPLET(sed, BB_DIR_BIN, BB_SUID_DROP)) |
69 | 64 | ||
65 | //kbuild:lib-$(CONFIG_SED) += sed.o | ||
66 | |||
70 | //usage:#define sed_trivial_usage | 67 | //usage:#define sed_trivial_usage |
71 | //usage: "[-i[SFX]] [-nrE] [-f FILE]... [-e CMD]... [FILE]...\n" | 68 | //usage: "[-i[SFX]] [-nrE] [-f FILE]... [-e CMD]... [FILE]...\n" |
72 | //usage: "or: sed [-i[SFX]] [-nrE] CMD [FILE]..." | 69 | //usage: "or: sed [-i[SFX]] [-nrE] CMD [FILE]..." |
@@ -356,10 +353,16 @@ static int get_address(const char *my_str, int *linenum, regex_t ** regex) | |||
356 | if (*my_str == '\\') | 353 | if (*my_str == '\\') |
357 | delimiter = *++pos; | 354 | delimiter = *++pos; |
358 | next = index_of_next_unescaped_regexp_delim(delimiter, ++pos); | 355 | next = index_of_next_unescaped_regexp_delim(delimiter, ++pos); |
359 | temp = copy_parsing_escapes(pos, next); | 356 | if (next != 0) { |
360 | *regex = xzalloc(sizeof(regex_t)); | 357 | temp = copy_parsing_escapes(pos, next); |
361 | xregcomp(*regex, temp, G.regex_type); | 358 | G.previous_regex_ptr = *regex = xzalloc(sizeof(regex_t)); |
362 | free(temp); | 359 | xregcomp(*regex, temp, G.regex_type); |
360 | free(temp); | ||
361 | } else { | ||
362 | *regex = G.previous_regex_ptr; | ||
363 | if (!G.previous_regex_ptr) | ||
364 | bb_error_msg_and_die("no previous regexp"); | ||
365 | } | ||
363 | /* Move position to next character after last delimiter */ | 366 | /* Move position to next character after last delimiter */ |
364 | pos += (next+1); | 367 | pos += (next+1); |
365 | } | 368 | } |