summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-06 03:41:08 +0000
committerDenis Vlasenko2007-08-06 03:41:08 +0000
commit8274e06677ba55532a4e1488b659f0b1e743130e (patch)
treeaf0a5bec322c6f2dc3214ea6a57997455cc35876 /editors
parente013475830b2399e31f5e17758dd6674b6b60058 (diff)
downloadbusybox-8274e06677ba55532a4e1488b659f0b1e743130e.zip
busybox-8274e06677ba55532a4e1488b659f0b1e743130e.tar.gz
sed: fix 'q' command handling ("Nguyen Thai Ngoc Duy" <pclouds@gmail.com>)
add testsuite entry for it. Fix applet order checker. Fix cmp yelling. trylink: fix error file and map file generation applets: fix applet order
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c
index d0c2ca7..4647079 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -836,6 +836,14 @@ static void puts_maybe_newline(char *s, FILE *file, char *last_puts_char, char l
#define sed_puts(s, n) (puts_maybe_newline(s, G.nonstdout, &last_puts_char, n))
+static int beg_match(sed_cmd_t *sed_cmd, const char *pattern_space)
+{
+ int retval = sed_cmd->beg_match && !regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0);
+ if (retval)
+ G.previous_regex_ptr = sed_cmd->beg_match;
+ return retval;
+}
+
/* Process all the lines in all the files */
static void process_files(void)
@@ -880,8 +888,7 @@ restart:
/* Or did we match the start of a numerical range? */
|| (sed_cmd->beg_line > 0 && (sed_cmd->beg_line == linenum))
/* Or does this line match our begin address regex? */
- || (sed_cmd->beg_match &&
- !regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0))
+ || (beg_match(sed_cmd, pattern_space))
/* Or did we match last line of input? */
|| (sed_cmd->beg_line == -1 && next_line == NULL);