From 5c047efcb7f92de36df102dd164345d988f64567 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 11 Sep 2020 03:00:30 -0700 Subject: Tidying up --- bpeg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bpeg.c') diff --git a/bpeg.c b/bpeg.c index 89f262a..421b238 100644 --- a/bpeg.c +++ b/bpeg.c @@ -138,13 +138,15 @@ int main(int argc, char *argv[]) input = readfile(STDIN_FILENO); goto run_match; } - for ( ; i < argc; i++) { + for (int nfiles = 0; i < argc; nfiles++, i++) { if (argv[i] == NULL || streq(argv[i], "-")) { input = readfile(STDIN_FILENO); } else { int fd = open(argv[i], O_RDONLY); - check(fd >= 0, "Couldn't open file: %s", argv[2]); + check(fd >= 0, "Couldn't open file: %s", argv[i]); input = readfile(fd); + if (nfiles > 0) printf("\n"); + printf("\033[1;4;33m%s\033[0m\n", argv[i]); } run_match:; -- cgit v1.2.3