Files
plan9port/man/man3/sysfatal.3
Dmitri Vereshchagin 10564b1175 tmac/tmac.an: define .MR in a groff compatible way
groff 1.23.0 added .MR to its -man macro package.  The NEWS file states
that the inclusion of the macro "was prompted by its introduction to
Plan 9 from User Space's troff in August 2020."  From d32deab it seems
that the name for Plan 9 from User Space's implementation was suggested
by groff maintainer G. Brandon Robinson.

Not sure if the intention was to make these definitions compatible, but
it would be nice if they were.

Currently, Plan 9 from User Space's .MR expects its second argument to
be parenthesized.  groff's .MR does not.  This results in extra
parentheses appearing in manual references when viewing Plan 9 from User
Space's manual pages on a system using groff.
2025-07-27 09:58:50 -04:00

69 lines
1.4 KiB
Groff

.TH SYSFATAL 3
.SH NAME
syslog, sysfatal \- system error messages
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.B
void syslog(int cons, char *logname, char *fmt, ...)
.PP
.B
void sysfatal(char *fmt, ...)
.SH DESCRIPTION
.I Sysfatal
prints to standard error the name of the running program,
a colon and a space,
the message described by the
.MR print 3
format string
.I fmt
and subsequent arguments, and a newline.
It then calls
.MR exits 3
with the formatted message as argument.
The program's name is the value of
.BR argv0 ,
which will be set if the program uses the
.MR arg 3
interface to process its arguments.
If
.B argv0
is null, it is ignored and the following colon and space are suppressed.
.PP
.I Syslog
logs messages in the file named by
.I logname
in the directory
.B \*9/log ;
the file must already exist and is opened append-only.
.I Logname
must contain no slashes.
The message is a line with several fields:
the name of the machine writing the message;
the date and time;
the message specified by the
.MR print 3
format
.I fmt
and any following arguments;
and a final newline.
If
.I cons
is set or the log file cannot be opened, the message is also printed
on the system console.
.I Syslog
can be used safely in multi-threaded programs.
.SH SOURCE
.B \*9/src/lib9/sysfatal.c
.br
.B \*9/src/lib9/syslog.c
.SH "SEE ALSO"
.MR intro 3 ,
.MR errstr 3 ,
the
.B %r
format in
.MR print 3