aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-11 03:00:30 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-11 03:00:30 -0700
commit5c047efcb7f92de36df102dd164345d988f64567 (patch)
tree7ca48edbb6125421e6d37c0d5c7f204feec259a2
parentd0538fa25ffa60fc3ef17048aa2c46423a1bf036 (diff)
Tidying up
-rw-r--r--bpeg.c6
1 files changed, 4 insertions, 2 deletions
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:;