[hackers] [sbase] Fix expand when one of multiple files can't be opened || Tuukka Kataja

From: <git_AT_suckless.org>
Date: Mon, 09 Jun 2014 18:00:27 +0200

commit 65615675973acbe985a46c37aa4828d04e2f5cf7
Author: Tuukka Kataja <stuge_AT_xor.fi>
Date: Mon Jun 9 16:53:55 2014 +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.

diff --git a/expand.c b/expand.c
index f859452..2bcc668 100644
--- a/expand.c
+++ b/expand.c
_AT_@ -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;
_AT_@ -48,7 +48,6 @@ main(int argc, char *argv[])
                         dsc.fp = fp;
                         expand(&dsc, tabstop);
                         fclose(fp);
- argv++;
                 }
         }
         return EXIT_SUCCESS;
Received on Mon Jun 09 2014 - 18:00:27 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 09 2014 - 18:12:13 CEST