]> diplodocus.org Git - nmh/blobdiff - sbr/error.c
Fix up error reporting for the hook code.
[nmh] / sbr / error.c
index 299e3a6206a0b2a6fdecdaeba68f8a1ceb06a458..fd74d270a2e89200a8674d23cf603a380aa7dc75 100644 (file)
@@ -2,8 +2,6 @@
 /*
  * error.c -- main error handling routines
  *
- * $Id$
- *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  * complete copyright information.
@@ -11,12 +9,8 @@
 
 #include <h/mh.h>
 
-#ifdef HAVE_WRITEV
-# include <sys/types.h>
-# include <sys/uio.h>
-#endif
-
-#include <errno.h>
+#include <sys/types.h>
+#include <sys/uio.h>
 
 
 /*
@@ -64,25 +58,16 @@ admonish (char *what, char *fmt, ...)
 
 /*
  * main routine for printing error messages.
- *
- * Use writev() if available, for slightly better performance.
- * Why?  Well, there are a couple of reasons.  Primarily, it
- * gives a smoother output...  More importantly though, it's a
- * sexy syscall()...
  */
 void
 advertise (char *what, char *tail, char *fmt, va_list ap)
 {
     int        eindex = errno;
-
-#ifdef HAVE_WRITEV
     char buffer[BUFSIZ], err[BUFSIZ];
     struct iovec iob[20], *iov;
-#endif
 
     fflush (stdout);
 
-#ifdef HAVE_WRITEV
     fflush (stderr);
     iov = iob;
 
@@ -122,23 +107,4 @@ advertise (char *what, char *tail, char *fmt, va_list ap)
     iov->iov_len = strlen (iov->iov_base = "\n");
     iov++;
     writev (fileno (stderr), iob, iov - iob);
-#else
-    if (invo_name && *invo_name)
-       fprintf (stderr, "%s: ", invo_name);
-    vfprintf (stderr, fmt, ap);
-
-    if (what) {
-       char *s;
-
-       if (*what)
-           fprintf (stderr, " %s: ", what);
-       if ((s = strerror(eindex)))
-           fprintf (stderr, "%s", s);
-       else
-           fprintf (stderr, "Error %d", eindex);
-    }
-    if (tail)
-       fprintf (stderr, ", %s", tail);
-    fputc ('\n', stderr);
-#endif
 }