stagit-gopher

[fork] gopher git frontend
Log | Files | Refs | README | LICENSE

commit cba17854219972673d7079e9cb11185cc2565710
parent d0d070040d949d825c4464022d0d43cb1582db1f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun,  2 Sep 2018 15:50:33 +0200

fix writeheader not being called when flags are used before repos

Diffstat:
Mstagit-gopher-index.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/stagit-gopher-index.c b/stagit-gopher-index.c @@ -214,7 +214,7 @@ main(int argc, char *argv[]) FILE *fp; char path[PATH_MAX], repodirabs[PATH_MAX + 1]; const char *repodir = NULL; - int i, ret = 0; + int i, r, ret = 0; setlocale(LC_CTYPE, ""); @@ -225,7 +225,7 @@ main(int argc, char *argv[]) err(1, "pledge"); #endif - for (i = 1; i < argc; i++) { + for (i = 1, r = 0; i < argc; i++) { if (argv[i][0] == '-') { if (argv[i][1] != 'b' || i + 1 >= argc) usage(argv[0]); @@ -233,7 +233,7 @@ main(int argc, char *argv[]) continue; } - if (i == 1) + if (r++ == 0) writeheader(stdout); repodir = argv[i];