From 46e482552c35456ddc836720df0a44ba25f60544 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 28 Jul 2026 23:33:23 +0200 Subject: feat: config.h GOSPEL_ONLY -- print all readings (default) or just the Gospel Add a compile-time toggle in config.h: GOSPEL_ONLY=0 (default) prints every reading; GOSPEL_ONLY=1 prints only the Gospel. The Gospel is matched by its part label, so it works for both forms. Help and the compiled-settings line report the mode. Also tidy print_day's header underline to match the width of the "
for " line instead of the reading count. No data change; strict -Wsign-conversion clean in both modes. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a --- clectio.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'clectio.c') diff --git a/clectio.c b/clectio.c index 6461e51..24cb4b6 100644 --- a/clectio.c +++ b/clectio.c @@ -67,18 +67,23 @@ static const char *citation(int r) { static void print_day(long off, const char *datestr) { const Day *d = &days[cal[off]]; - unsigned k, ri; + unsigned ri; + int n; if (usecolor) - printf("%s%s\033[0m", colansi[d->colour], names[d->name]); + printf("%s%s\033[0m\n", colansi[d->colour], names[d->name]); else - printf("%s \xc2\xb7 %s", names[d->name], colname[d->colour]); - printf("\n%s for %s\n", FORMNAME, datestr); - for (k = 0; k < d->rlen; k++) + printf("%s \xc2\xb7 %s\n", names[d->name], colname[d->colour]); + n = printf("%s for %s\n", FORMNAME, datestr) - 1; /* underline that line */ + while (n-- > 0) putchar('='); putchar('\n'); for (ri = 0; ri < d->rlen; ri++) { const Reading *r = &readings[rpool[d->roff + ri]]; unsigned v; +#if GOSPEL_ONLY + if (strcmp(parts[r->part], "Gospel") != 0) + continue; +#endif printf("\n%s (%s)\n\n", parts[r->part], citation(rpool[d->roff + ri])); for (v = 0; v < r->vlen; v++) printf("%s\n", verse[vpool[r->voff + v]]); @@ -95,7 +100,7 @@ int main(int argc, char **argv) { if (argc > 1 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) { fprintf(stderr, "usage: clectio [YYYY-MM-DD] (default: today)\n" - " compiled: %s, %s, %d-%d\n", FORMNAME, SIGLANAME, EPOCH_Y, EPOCH_Y + (NDAYS / 366)); + " compiled: %s, %s, %s, %d-%d\n", FORMNAME, SIGLANAME, READMODE, EPOCH_Y, EPOCH_Y + (NDAYS / 366)); return 0; } if (argc > 1) { -- cgit v1.3