summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorMark Whitley2000-11-03 20:02:35 +0000
committerMark Whitley2000-11-03 20:02:35 +0000
commite7ff2842dd180f1d9b35ae6d6d7bca5ee8af77d9 (patch)
tree62df2eeee033b14ef52f67cb5a2bde21b647829d /editors
parent2dc192fd991ff24a2e1e469b988391d7830ad4b6 (diff)
downloadbusybox-e7ff2842dd180f1d9b35ae6d6d7bca5ee8af77d9.zip
busybox-e7ff2842dd180f1d9b35ae6d6d7bca5ee8af77d9.tar.gz
Now, what was that logic block doing up there?
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/editors/sed.c b/editors/sed.c
index eaca9ad..bc0e961 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -537,12 +537,6 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, const char *line)
int altered = 0;
regmatch_t *regmatch = NULL;
- /* if the user specified that they didn't want anything printed (i.e. a -n
- * flag and no 'p' flag after the s///), then there's really no point doing
- * anything here. */
- if (be_quiet && !sed_cmd->sub_p)
- return 0;
-
/* we only proceed if the substitution 'search' expression matches */
if (regexec(sed_cmd->sub_match, line, 0, NULL, 0) == REG_NOMATCH)
return 0;
@@ -615,6 +609,12 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line)
* flag exists in the first place.
*/
+ /* if the user specified that they didn't want anything printed (i.e. a -n
+ * flag and no 'p' flag after the s///), then there's really no point doing
+ * anything here. */
+ if (be_quiet && !sed_cmd->sub_p)
+ break;
+
/* we print the line once, unless we were told to be quiet */
if (!be_quiet)
altered = do_subst_command(sed_cmd, line);