From 719cf31c6ab1710c21ecdf30527307ecff789c06 Mon Sep 17 00:00:00 2001 From: Tadashi Saito Date: Tue, 16 Jul 2024 04:52:32 +0900 Subject: [PATCH] Refactoring. --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 63e94d1..e54f8ce 100644 --- a/main.c +++ b/main.c @@ -19,13 +19,13 @@ static FILE *parse_opt(int argc, char *const *argv) exit(2); } } - if (argv[optind]) { - const char *f = argv[optind]; + const char *f = argv[optind]; + if (f) { if (in != NULL) error("filename %s given while option '-e' passed", f); in = fopen(f, "r"); if (in == NULL) - error("file %s not found", f); + error("can't read file %s", f); } return in ? in : stdin; }