URL: <https://savannah.gnu.org/bugs/?68726>
Summary: [grohtml] migrate `pre-grohtml` from fprintf(3) to
`fatal()` where appropriate
Group: GNU roff
Submitter: gbranden
Submitted: Tue 29 Sep 2026 01:58:11 PM UTC
Category: Preprocessor html
Severity: 3 - Normal
Item Group: Refactoring
Status: Confirmed
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Unlocked
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Tue 29 Sep 2026 01:58:11 PM UTC By: G. Branden Robinson <gbranden>
I recently said to Ingo:
> ...I'm used to using groff's bespoke `fatal()`
> function, which itself exit(3)s. I don't know why pre-grohtml doesn't
> consistently use it. That program is a poor fit with many of James
> Clark's idioms.
$ git grep -n fprintf src/preproc/html/*.cpp
src/preproc/html/pre-html.cpp:29: // fprintf(), fputc(),
fread(), getc(), printf(),
src/preproc/html/pre-html.cpp:408: fprintf(stderr, "%s: debug: executing:
", program_name);
src/preproc/html/pre-html.cpp:424: fprintf(stderr, "%s: unable to execute
command '%s': %s\n",
src/preproc/html/pre-html.cpp:428: fprintf(stderr, "%s: command '%s'
returned status %d\n",
src/preproc/html/pre-html.cpp:431: fprintf(stderr, "%s: command '%s'
exited by signal: %s\n",
src/preproc/html/pre-html.cpp:434: fprintf(stderr, "%s: command '%s'
stopped: %s\n",
src/preproc/html/pre-html.cpp:437: fprintf(stderr, "%s: command '%s'
exited abnormally\n",
src/preproc/html/pre-html.cpp:957: fprintf(stderr, "[%d] ", pageno);
src/preproc/html/pre-html.cpp:962: fprintf(stderr, "%s: debug: creating
page %d\n", program_name,
src/preproc/html/pre-html.cpp:1040: fprintf(stderr, "%s: error: unable to
generate raster image",
src/preproc/html/pre-html.cpp:1060: fprintf(stderr, "%s: error: unable to
generate raster image"
src/preproc/html/pre-html.cpp:1079: fprintf(stderr, "%s: error: unable to
generate raster image"
src/preproc/html/pre-html.cpp:1087: fprintf(stderr, "%s: debug: ignoring
image as x1 coord is -1\n",
src/preproc/html/pre-html.cpp:1167: fprintf(stderr, "done\n");
src/preproc/html/pre-html.cpp:1185: fprintf(stderr, "%s: unable to
replace fd=%d with %d",
src/preproc/html/pre-html.cpp:1188: fprintf(stderr,
src/preproc/html/pre-html.cpp:1217: fprintf(stderr, "%s: unable to get
duplicate file descriptor for"
src/preproc/html/pre-html.cpp:1321: fprintf(stderr, " %d arguments:",
argc);
src/preproc/html/pre-html.cpp:1323: fprintf(stderr, " %s", argv[i]);
src/preproc/html/pre-html.cpp:1324: fprintf(stderr, "\n");
src/preproc/html/pre-html.cpp:1335: fprintf(stderr, "%s: debug: executing:
", program_name);
src/preproc/html/pre-html.cpp:1337: fprintf(stderr, "%s ", argv[i]);
src/preproc/html/pre-html.cpp:1585: fprintf(stream,
src/preproc/html/pre-html.cpp:1602: fprintf(stream,
src/preproc/html/pre-html.cpp:1831: fprintf(stderr, "%s: invoked with %d
arguments ...\n", program_name,
src/preproc/html/pre-html.cpp:1834: fprintf(stderr, "%2d: %s\n", i,
argv[i]);
src/preproc/html/pushback.cpp:23:#include <stdio.h> // fflush(), fprintf(),
printf(), putchar(), stderr
src/preproc/html/pushback.cpp:40:# define ERROR(X) (void)(fprintf(stderr,
"%s:%d error %s\n", __FILE__, __LINE__, X) && \
> Lines 1585 and 1602 are more likely okay than not, since I suspect
> they're not diagnostic, but generative of "real" output.
>
> The only other _good_ reason I know of for going straight to fprintf(3)
> is when you need to format a type that groff's error-printing functions
> don't support. Historically, this was true of `long` integers but I
> can't remember if I fixed that.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68726>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
