From: Shlomi Fish Date: Thu, 16 Dec 2021 17:26:49 +0000 (+0200) Subject: Wrap C/etc. oneline blocks in {...} X-Git-Tag: fortune-mod-3.12.0~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89f84547aa59ca66dab876c92253ebbea75c1550;p=fortune-mod Wrap C/etc. oneline blocks in {...} See: https://fc-solve.shlomifish.org/docs/distro/HACKING.html#one-line-clauses . --- diff --git a/fortune-mod/util/strfile.c b/fortune-mod/util/strfile.c index ba30f97..be65608 100644 --- a/fortune-mod/util/strfile.c +++ b/fortune-mod/util/strfile.c @@ -141,6 +141,7 @@ static void getargs(int argc, char **argv) int ch; while ((ch = getopt(argc, argv, "c:iorsx")) != EOF) + { switch (ch) { case 'c': /* new delimiting char */ @@ -170,6 +171,7 @@ static void getargs(int argc, char **argv) default: usage(); } + } argv += optind; if (*argv) @@ -256,18 +258,26 @@ static int cmp_str(const void *v1, const void *v2) bool n1 = false; bool n2 = false; while (!isalnum(c1 = getc(Sort_1)) && c1 != '\0') + { SET_N(n1, c1); + } while (!isalnum(c2 = getc(Sort_2)) && c2 != '\0') + { SET_N(n2, c2); + } while (!IS_END(c1, n1) && !IS_END(c2, n2)) { if (Iflag) { if (isupper(c1)) + { c1 = tolower(c1); + } if (isupper(c2)) + { c2 = tolower(c2); + } } if (c1 != c2) {