diff options
-rw-r--r-- | editors/sed.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c index 45574e81d..3d6871621 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -112,7 +112,7 @@ typedef struct sed_cmd_s { | |||
112 | 112 | ||
113 | /* globals */ | 113 | /* globals */ |
114 | /* options */ | 114 | /* options */ |
115 | static int be_quiet = 0, in_place=0; | 115 | static int be_quiet = 0, in_place=0, regex_type=0; |
116 | FILE *nonstdout; | 116 | FILE *nonstdout; |
117 | char *outname; | 117 | char *outname; |
118 | 118 | ||
@@ -298,7 +298,7 @@ static int get_address(char *my_str, int *linenum, regex_t ** regex) | |||
298 | 298 | ||
299 | temp=copy_parsing_slashn(pos,next); | 299 | temp=copy_parsing_slashn(pos,next); |
300 | *regex = (regex_t *) xmalloc(sizeof(regex_t)); | 300 | *regex = (regex_t *) xmalloc(sizeof(regex_t)); |
301 | xregcomp(*regex, temp, REG_NEWLINE); | 301 | xregcomp(*regex, temp, regex_type|REG_NEWLINE); |
302 | free(temp); | 302 | free(temp); |
303 | /* Move position to next character after last delimiter */ | 303 | /* Move position to next character after last delimiter */ |
304 | pos+=(next+1); | 304 | pos+=(next+1); |
@@ -326,7 +326,7 @@ static int parse_file_cmd(sed_cmd_t * sed_cmd, const char *filecmdstr, char **re | |||
326 | 326 | ||
327 | static int parse_subst_cmd(sed_cmd_t * const sed_cmd, char *substr) | 327 | static int parse_subst_cmd(sed_cmd_t * const sed_cmd, char *substr) |
328 | { | 328 | { |
329 | int cflags = 0; | 329 | int cflags = regex_type; |
330 | char *match; | 330 | char *match; |
331 | int idx = 0; | 331 | int idx = 0; |
332 | 332 | ||
@@ -1115,12 +1115,15 @@ extern int sed_main(int argc, char **argv) | |||
1115 | #endif | 1115 | #endif |
1116 | 1116 | ||
1117 | /* do normal option parsing */ | 1117 | /* do normal option parsing */ |
1118 | while ((opt = getopt(argc, argv, "ine:f:")) > 0) { | 1118 | while ((opt = getopt(argc, argv, "irne:f:")) > 0) { |
1119 | switch (opt) { | 1119 | switch (opt) { |
1120 | case 'i': | 1120 | case 'i': |
1121 | in_place++; | 1121 | in_place++; |
1122 | atexit(cleanup_outname); | 1122 | atexit(cleanup_outname); |
1123 | break; | 1123 | break; |
1124 | case 'r': | ||
1125 | regex_type|=REG_EXTENDED; | ||
1126 | break; | ||
1124 | case 'n': | 1127 | case 'n': |
1125 | be_quiet++; | 1128 | be_quiet++; |
1126 | break; | 1129 | break; |