.TH ERROR 3 local .DA 8 May 1984 .SH NAME error, warning \- print error messages .SH SYNOPSIS .nf .B error(s1, s2) .B char *s1; .B char *s2; .B warning(s1, s2) .B char *s1; .B char *s2; .B extern char *progname; .B extern int errno; .B progname = argv[0]; .SH DESCRIPTION .I Warning prints an error message, with suitable embellishments, and clears .IR errno . .I Error does likewise and then exits. The .I s1 argument should be a .I printf format string (without a trailing newline), with .I s2 available as an argument. .PP If there is an environment variable .BR CMDNAME with non-null value, its contents are printed first, followed by a colon. Following this, any non-null value of .I progname is printed, followed by a colon and a space. Following this, .IR fprintf (3) is invoked with .I s1 as the format string and .I s2 as the argument. If the value of .I errno is within the normal range, a standard elaborating message is printed (see .IR intro (2)). .PP .B CMDNAME should be set by shellfiles that expect subordinate programs to issue error message in the shellfile's name. .I Progname should be set by all programs; .I argv[0] is usually a suitable thing to set it to. .I Errno is set by system calls and various other routines, although its use is not universal; note that it is not reset by successful system calls following an unsuccessful one. .SH SEE ALSO intro(2), intro(3), printf(3), exit(2), getopt(3) .SH DIAGNOSTICS .IR Error 's exit status is 1. .SH HISTORY Local products, modelled on the .I error in Kernighan&Pike. .SH BUGS Be nice if they could take a full .IR printf -style argument list.