2 ** error.c -- main error handling routines
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
14 ** print out error message
17 advise(char *what, char *fmt, ...)
22 advertise(what, NULL, fmt, ap);
28 ** print out error message and exit
31 adios(char *what, char *fmt, ...)
36 advertise(what, NULL, fmt, ap);
46 admonish(char *what, char *fmt, ...)
51 advertise(what, "continuing...", fmt, ap);
57 ** main routine for printing error messages.
59 ** Until 2011-11-01, this routine used writev(). In order to remove
60 ** ``sexy'' syscalls, in favor for mainstream programming, I removed
61 ** it. But I want to preserve the following comment:
63 ** Use writev() if available, for slightly better performance.
64 ** Why? Well, there are a couple of reasons. Primarily, it
65 ** gives a smoother output... More importantly though, it's a
68 ** advertise() does *not* use writev() anymore, and that's good so.
69 ** -- meillo@marmaro.de
72 advertise(char *what, char *tail, char *fmt, va_list ap)
77 if (invo_name && *invo_name)
78 fprintf(stderr, "%s: ", invo_name);
79 vfprintf(stderr, fmt, ap);
85 fprintf(stderr, " %s: ", what);
86 if ((s = strerror(eindex)))
87 fprintf(stderr, "%s", s);
89 fprintf(stderr, "Error %d", eindex);
92 fprintf(stderr, ", %s", tail);