At 2026-10-15T21:40:33-0700, Mike wrote: > mmroff.pl is reporting the sixteen bit value set by wait(2). > > The high order eight bits are the exit status for a process > terminating normally. If the process is terminated by a fatal signal, > the low order seven bits indicated that signal. The eighth bit > indicates whether a core file was generated. This is probably the > source of confusion about bit 0x80, above. > > In the case in question, mmroff.pl should report $? >> 8. It should > also detect signal termination and report accordingly.
We already have code to do this in pdfmom.pl (that I put in myself). I
simply had an attack of laziness and didn't copy it over to mmroff.pl.
sub abort
{
my $message=shift(@_);
print STDERR "$prog: fatal error: $message";
exit 1;
}
sub autopsy
{
my $waitstatus=shift(@_);
my $finding;
if ($waitstatus == -1) {
$finding = "unable to run groff: $!\n";
}
elsif ($? & 127) {
$finding = sprintf("$groff died with signal %d, %s core dump\n",
($? & 127), ($? & 128) ? 'with' : 'without');
}
else {
$finding = sprintf("$groff exited with status %d\n", $? >> 8);
}
return $finding;
}
...
elsif ($c eq '-v' or $c eq '--version')
{
print "GNU pdfmom (groff) version @VERSION@\n";
my $waitstatus = system("$groff -T$dev --version");
abort(autopsy($?)) unless $waitstatus == 0;
exit;
}
...and so forth.
Regards,
Branden
signature.asc
Description: PGP signature
