1 /* advertise.c - the heart of adios */
3 static char ident[] = "@(#)$Id: advertise.c,v 1.4 1993/08/25 17:18:31 jromine Exp shettich $";
13 /* For 4.2BSD systems, use writev() for slightly better performance. Why?
14 Well, there are a couple of reasons. Primarily, it gives a smoother
15 output... More importantly though, it's a sexy syscall()...
19 #ifndef BSD44 /* in <stdio.h> */
21 extern const char *sys_errlist[];
28 void advertise (what, tail, fmt, a, b, c, d, e, f)
44 register struct iovec *iov = iob;
47 (void) fflush (stdout);
50 if (invo_name && *invo_name)
51 fprintf (stderr, "%s: ", invo_name);
52 fprintf (stderr, fmt, a, b, c, d, e, f);
55 fprintf (stderr, " %s: ", what);
56 if (eindex > 0 && eindex < sys_nerr)
57 fprintf (stderr, "%s", sys_errlist[eindex]);
59 fprintf (stderr, "Error %d", eindex);
62 fprintf (stderr, ", %s", tail);
63 (void) fputc ('\n', stderr);
65 (void) fflush (stderr);
67 if (invo_name && *invo_name) {
68 iov -> iov_len = strlen (iov -> iov_base = invo_name);
70 iov -> iov_len = strlen (iov -> iov_base = ": ");
74 (void) sprintf (buffer, fmt, a, b, c, d, e, f);
75 iov -> iov_len = strlen (iov -> iov_base = buffer);
79 iov -> iov_len = strlen (iov -> iov_base = " ");
81 iov -> iov_len = strlen (iov -> iov_base = what);
83 iov -> iov_len = strlen (iov -> iov_base = ": ");
86 if (eindex > 0 && eindex < sys_nerr)
87 iov -> iov_len = strlen (iov -> iov_base = sys_errlist[eindex]);
89 (void) sprintf (err, "Error %d", eindex);
90 iov -> iov_len = strlen (iov -> iov_base = err);
95 iov -> iov_len = strlen (iov -> iov_base = ", ");
97 iov -> iov_len = strlen (iov -> iov_base = tail);
100 iov -> iov_len = strlen (iov -> iov_base = "\n");
102 (void) writev (fileno (stderr), iob, iov - iob);