diff options
-rw-r--r-- | editors/sed.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/editors/sed.c b/editors/sed.c index a0d0cf74b..5832e99a9 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -618,6 +618,15 @@ static int do_subst_command(sed_cmd_t * sed_cmd, char **line) | |||
618 | do { | 618 | do { |
619 | int i; | 619 | int i; |
620 | 620 | ||
621 | /* Work around bug in glibc regexec, demonstrated by: | ||
622 | echo " a.b" | busybox sed 's [^ .]* x g' | ||
623 | The match_count check is so not to break | ||
624 | echo "hi" | busybox sed 's/^/!/g' */ | ||
625 | if(!regmatch[0].rm_so && !regmatch[0].rm_eo && match_count) { | ||
626 | pipe_putc(*(oldline++)); | ||
627 | continue; | ||
628 | } | ||
629 | |||
621 | match_count++; | 630 | match_count++; |
622 | 631 | ||
623 | /* If we aren't interested in this match, output old line to | 632 | /* If we aren't interested in this match, output old line to |
@@ -1073,6 +1082,14 @@ extern int sed_main(int argc, char **argv) | |||
1073 | bb_perror_msg_and_die("atexit"); | 1082 | bb_perror_msg_and_die("atexit"); |
1074 | #endif | 1083 | #endif |
1075 | 1084 | ||
1085 | #define LIE_TO_AUTOCONF | ||
1086 | #ifdef LIE_TO_AUTOCONF | ||
1087 | if(argc==2 && !strcmp(argv[1],"--version")) { | ||
1088 | printf("This is not GNU sed version 4.0\n"); | ||
1089 | exit(0); | ||
1090 | } | ||
1091 | #endif | ||
1092 | |||
1076 | /* do normal option parsing */ | 1093 | /* do normal option parsing */ |
1077 | while ((opt = getopt(argc, argv, "ne:f:")) > 0) { | 1094 | while ((opt = getopt(argc, argv, "ne:f:")) > 0) { |
1078 | switch (opt) { | 1095 | switch (opt) { |