From: Nick Bowler Date: Thu, 7 Dec 2023 02:35:26 +0000 (-0500) Subject: cdecl99: Better "help" output on some old systems. X-Git-Tag: v1.3~61 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/a4355b10f7738d5b8438f03fa193a710b765d8e0 cdecl99: Better "help" output on some old systems. Some very old printf implementations return 0 on success instead of the number of bytes written. We should never see a return of 0 normally, so we can improve the output to be less of a garbled mess by printing a newline if that happens (same as the error case). This is a simple tweak that should have virtually no impact on modern systems. --- diff --git a/src/execute.gperf b/src/execute.gperf index bf9a080..a45413d 100644 --- a/src/execute.gperf +++ b/src/execute.gperf @@ -1,6 +1,6 @@ %{ /* - * Copyright © 2021 Nick Bowler + * Copyright © 2021, 2023 Nick Bowler * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +72,7 @@ static int run_cmd_help(void) int w; w = printf(" %s", stringpool+c->name); - if (w < 0 || w > 13) { + if (w <= 0 || w > 13) { putchar('\n'); w = 0; }