aboutsummaryrefslogtreecommitdiff
path: root/bpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'bpeg.c')
-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:;