Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / sbr / RCS / advertise.c,v
1 head    1.4;
2 access;
3 symbols;
4 locks
5         shettich:1.4; strict;
6 comment @ * @;
7
8
9 1.4
10 date    93.08.25.17.18.31;      author jromine; state Exp;
11 branches;
12 next    1.3;
13
14 1.3
15 date    92.12.15.00.20.22;      author jromine; state Exp;
16 branches;
17 next    1.2;
18
19 1.2
20 date    92.12.14.17.47.34;      author jromine; state Exp;
21 branches;
22 next    1.1;
23
24 1.1
25 date    92.12.14.17.44.38;      author jromine; state Exp;
26 branches;
27 next    ;
28
29
30 desc
31 @@
32
33
34 1.4
35 log
36 @off_t fixes for BSD44
37 @
38 text
39 @/* advertise.c - the heart of adios */
40 #ifndef lint
41 static char ident[] = "@@(#)$Id: advertise.c,v 1.3 1992/12/15 00:20:22 jromine Exp jromine $";
42 #endif  /* lint */
43
44 #include "../h/mh.h"
45 #include <stdio.h>
46 #ifdef  BSD42
47 #include <sys/types.h>
48 #include <sys/uio.h>
49 #endif  /* BSD42 */
50
51 /* For 4.2BSD systems, use writev() for slightly better performance.  Why?
52    Well, there are a couple of reasons.  Primarily, it gives a smoother
53    output...  More importantly though, it's a sexy syscall()...
54  */
55
56 extern int  errno;
57 #ifndef BSD44   /* in <stdio.h> */
58 extern int  sys_nerr;
59 extern char *sys_errlist[];
60 #endif
61
62 /* \f */
63
64 /* VARARGS3 */
65
66 void advertise (what, tail, fmt, a, b, c, d, e, f)
67 char   *what,
68        *tail,
69        *fmt,
70        *a,
71        *b,
72        *c,
73        *d,
74        *e,
75        *f;
76 {
77     int     eindex = errno;
78 #ifdef  BSD42
79     char    buffer[BUFSIZ],
80             err[BUFSIZ];
81     struct iovec    iob[20];
82     register struct iovec  *iov = iob;
83 #endif  /* BSD42 */
84
85     (void) fflush (stdout);
86
87 #ifndef BSD42
88     if (invo_name && *invo_name)
89         fprintf (stderr, "%s: ", invo_name);
90     fprintf (stderr, fmt, a, b, c, d, e, f);
91     if (what) {
92         if (*what)
93             fprintf (stderr, " %s: ", what);
94         if (eindex > 0 && eindex < sys_nerr)
95             fprintf (stderr, "%s", sys_errlist[eindex]);
96         else
97             fprintf (stderr, "Error %d", eindex);
98     }
99     if (tail)
100         fprintf (stderr, ", %s", tail);
101     (void) fputc ('\n', stderr);
102 #else   /* BSD42 */
103     (void) fflush (stderr);
104
105     if (invo_name && *invo_name) {
106         iov -> iov_len = strlen (iov -> iov_base = invo_name);
107         iov++;
108         iov -> iov_len = strlen (iov -> iov_base = ": ");
109         iov++;
110     }
111     
112     (void) sprintf (buffer, fmt, a, b, c, d, e, f);
113     iov -> iov_len = strlen (iov -> iov_base = buffer);
114     iov++;
115     if (what) {
116         if (*what) {
117             iov -> iov_len = strlen (iov -> iov_base = " ");
118             iov++;
119             iov -> iov_len = strlen (iov -> iov_base = what);
120             iov++;
121             iov -> iov_len = strlen (iov -> iov_base = ": ");
122             iov++;
123         }
124         if (eindex > 0 && eindex < sys_nerr)
125             iov -> iov_len = strlen (iov -> iov_base = sys_errlist[eindex]);
126         else {
127             (void) sprintf (err, "Error %d", eindex);
128             iov -> iov_len = strlen (iov -> iov_base = err);
129         }
130         iov++;
131     }
132     if (tail && *tail) {
133         iov -> iov_len = strlen (iov -> iov_base = ", ");
134         iov++;
135         iov -> iov_len = strlen (iov -> iov_base = tail);
136         iov++;
137     }
138     iov -> iov_len = strlen (iov -> iov_base = "\n");
139     iov++;
140     (void) writev (fileno (stderr), iob, iov - iob);
141 #endif  /* BSD42 */
142 }
143 @
144
145
146 1.3
147 log
148 @endif sugar
149 @
150 text
151 @d3 1
152 a3 1
153 static char ident[] = "@@(#)$Id: advertise.c,v 1.2 1992/12/14 17:47:34 jromine Exp jromine $";
154 d19 1
155 d22 1
156 @
157
158
159 1.2
160 log
161 @add id
162 @
163 text
164 @d3 1
165 a3 1
166 static char ident[] = "@@(#)$Id: pidwait.c,v 1.9 1992/12/14 17:10:58 jromine Exp $";
167 d11 1
168 a11 1
169 #endif  BSD42
170 d43 1
171 a43 1
172 #endif  BSD42
173 d62 1
174 a62 1
175 #else   BSD42
176 d101 1
177 a101 1
178 #endif  BSD42
179 @
180
181
182 1.1
183 log
184 @Initial revision
185 @
186 text
187 @d2 3
188 @