From e4d925b8899e38437311d2c63d0d0d200e04b5a1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 8 Apr 2016 00:20:36 +0200 Subject: sed: support "-f -" idiom Signed-off-by: Denys Vlasenko --- editors/sed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editors/sed.c') diff --git a/editors/sed.c b/editors/sed.c index 4c7f75521..9c4c8e148 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -1507,12 +1507,12 @@ int sed_main(int argc UNUSED_PARAM, char **argv) while (opt_f) { // -f char *line; FILE *cmdfile; - cmdfile = xfopen_for_read(llist_pop(&opt_f)); + cmdfile = xfopen_stdin(llist_pop(&opt_f)); while ((line = xmalloc_fgetline(cmdfile)) != NULL) { add_cmd(line); free(line); } - fclose(cmdfile); + fclose_if_not_stdin(cmdfile); } /* if we didn't get a pattern from -e or -f, use argv[0] */ if (!(opt & 0x30)) { -- cgit v1.2.3