commit 65615675973acbe985a46c37aa4828d04e2f5cf7
parent 8b87d0098a1c91c3e7b3ba6cc77a176d178a6812
Author: Tuukka Kataja <stuge@xor.fi>
Date: Mon, 9 Jun 2014 16:53:55 +0100
Fix expand when one of multiple files can't be opened
Currently when multiple files are specified and one of them can't be opened,
expand doesn't correctly skip over the missing file. This patch fixes that.
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/expand.c b/expand.c
@@ -39,7 +39,7 @@ main(int argc, char *argv[])
dsc.fp = stdin;
expand(&dsc, tabstop);
} else {
- for (; argc > 0; argc--) {
+ for (; argc > 0; argc--, argv++) {
if (!(fp = fopen(*argv, "r"))) {
weprintf("fopen %s:", *argv);
continue;
@@ -48,7 +48,6 @@ main(int argc, char *argv[])
dsc.fp = fp;
expand(&dsc, tabstop);
fclose(fp);
- argv++;
}
}
return EXIT_SUCCESS;