diff options
-rw-r--r-- | editors/sed.c | 12 | ||||
-rw-r--r-- | sed.c | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/editors/sed.c b/editors/sed.c index eaca9ada5..bc0e96187 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) | |||
537 | int altered = 0; | 537 | int altered = 0; |
538 | regmatch_t *regmatch = NULL; | 538 | regmatch_t *regmatch = NULL; |
539 | 539 | ||
540 | /* if the user specified that they didn't want anything printed (i.e. a -n | ||
541 | * flag and no 'p' flag after the s///), then there's really no point doing | ||
542 | * anything here. */ | ||
543 | if (be_quiet && !sed_cmd->sub_p) | ||
544 | return 0; | ||
545 | |||
546 | /* we only proceed if the substitution 'search' expression matches */ | 540 | /* we only proceed if the substitution 'search' expression matches */ |
547 | if (regexec(sed_cmd->sub_match, line, 0, NULL, 0) == REG_NOMATCH) | 541 | if (regexec(sed_cmd->sub_match, line, 0, NULL, 0) == REG_NOMATCH) |
548 | return 0; | 542 | return 0; |
@@ -615,6 +609,12 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line) | |||
615 | * flag exists in the first place. | 609 | * flag exists in the first place. |
616 | */ | 610 | */ |
617 | 611 | ||
612 | /* if the user specified that they didn't want anything printed (i.e. a -n | ||
613 | * flag and no 'p' flag after the s///), then there's really no point doing | ||
614 | * anything here. */ | ||
615 | if (be_quiet && !sed_cmd->sub_p) | ||
616 | break; | ||
617 | |||
618 | /* we print the line once, unless we were told to be quiet */ | 618 | /* we print the line once, unless we were told to be quiet */ |
619 | if (!be_quiet) | 619 | if (!be_quiet) |
620 | altered = do_subst_command(sed_cmd, line); | 620 | altered = do_subst_command(sed_cmd, line); |
@@ -537,12 +537,6 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, const char *line) | |||
537 | int altered = 0; | 537 | int altered = 0; |
538 | regmatch_t *regmatch = NULL; | 538 | regmatch_t *regmatch = NULL; |
539 | 539 | ||
540 | /* if the user specified that they didn't want anything printed (i.e. a -n | ||
541 | * flag and no 'p' flag after the s///), then there's really no point doing | ||
542 | * anything here. */ | ||
543 | if (be_quiet && !sed_cmd->sub_p) | ||
544 | return 0; | ||
545 | |||
546 | /* we only proceed if the substitution 'search' expression matches */ | 540 | /* we only proceed if the substitution 'search' expression matches */ |
547 | if (regexec(sed_cmd->sub_match, line, 0, NULL, 0) == REG_NOMATCH) | 541 | if (regexec(sed_cmd->sub_match, line, 0, NULL, 0) == REG_NOMATCH) |
548 | return 0; | 542 | return 0; |
@@ -615,6 +609,12 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line) | |||
615 | * flag exists in the first place. | 609 | * flag exists in the first place. |
616 | */ | 610 | */ |
617 | 611 | ||
612 | /* if the user specified that they didn't want anything printed (i.e. a -n | ||
613 | * flag and no 'p' flag after the s///), then there's really no point doing | ||
614 | * anything here. */ | ||
615 | if (be_quiet && !sed_cmd->sub_p) | ||
616 | break; | ||
617 | |||
618 | /* we print the line once, unless we were told to be quiet */ | 618 | /* we print the line once, unless we were told to be quiet */ |
619 | if (!be_quiet) | 619 | if (!be_quiet) |
620 | altered = do_subst_command(sed_cmd, line); | 620 | altered = do_subst_command(sed_cmd, line); |