aboutsummaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-06 03:41:08 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-06 03:41:08 +0000
commit8274e06677ba55532a4e1488b659f0b1e743130e (patch)
treeaf0a5bec322c6f2dc3214ea6a57997455cc35876 /editors/sed.c
parente013475830b2399e31f5e17758dd6674b6b60058 (diff)
downloadbusybox-w32-8274e06677ba55532a4e1488b659f0b1e743130e.tar.gz
busybox-w32-8274e06677ba55532a4e1488b659f0b1e743130e.tar.bz2
busybox-w32-8274e06677ba55532a4e1488b659f0b1e743130e.zip
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/sed.c')
-rw-r--r--editors/sed.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c
index d0c2ca742..4647079aa 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
836 836
837#define sed_puts(s, n) (puts_maybe_newline(s, G.nonstdout, &last_puts_char, n)) 837#define sed_puts(s, n) (puts_maybe_newline(s, G.nonstdout, &last_puts_char, n))
838 838
839static int beg_match(sed_cmd_t *sed_cmd, const char *pattern_space)
840{
841 int retval = sed_cmd->beg_match && !regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0);
842 if (retval)
843 G.previous_regex_ptr = sed_cmd->beg_match;
844 return retval;
845}
846
839/* Process all the lines in all the files */ 847/* Process all the lines in all the files */
840 848
841static void process_files(void) 849static void process_files(void)
@@ -880,8 +888,7 @@ restart:
880 /* Or did we match the start of a numerical range? */ 888 /* Or did we match the start of a numerical range? */
881 || (sed_cmd->beg_line > 0 && (sed_cmd->beg_line == linenum)) 889 || (sed_cmd->beg_line > 0 && (sed_cmd->beg_line == linenum))
882 /* Or does this line match our begin address regex? */ 890 /* Or does this line match our begin address regex? */
883 || (sed_cmd->beg_match && 891 || (beg_match(sed_cmd, pattern_space))
884 !regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0))
885 /* Or did we match last line of input? */ 892 /* Or did we match last line of input? */
886 || (sed_cmd->beg_line == -1 && next_line == NULL); 893 || (sed_cmd->beg_line == -1 && next_line == NULL);
887 894