xref: /titanic_51/usr/src/cmd/sendmail/libsmutil/err.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
3*7c478bd9Sstevel@tonic-gate  *	All rights reserved.
4*7c478bd9Sstevel@tonic-gate  *
5*7c478bd9Sstevel@tonic-gate  * By using this file, you agree to the terms and conditions set
6*7c478bd9Sstevel@tonic-gate  * forth in the LICENSE file which can be found at the top level of
7*7c478bd9Sstevel@tonic-gate  * the sendmail distribution.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  */
10*7c478bd9Sstevel@tonic-gate 
11*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
12*7c478bd9Sstevel@tonic-gate 
13*7c478bd9Sstevel@tonic-gate #include <sendmail.h>
14*7c478bd9Sstevel@tonic-gate 
15*7c478bd9Sstevel@tonic-gate SM_RCSID("@(#)$Id: err.c,v 8.3 2001/01/24 01:27:30 gshapiro Exp $")
16*7c478bd9Sstevel@tonic-gate 
17*7c478bd9Sstevel@tonic-gate #include <ctype.h>
18*7c478bd9Sstevel@tonic-gate 
19*7c478bd9Sstevel@tonic-gate /*VARARGS1*/
20*7c478bd9Sstevel@tonic-gate void
21*7c478bd9Sstevel@tonic-gate #ifdef __STDC__
22*7c478bd9Sstevel@tonic-gate message(const char *msg, ...)
23*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */
24*7c478bd9Sstevel@tonic-gate message(msg, va_alist)
25*7c478bd9Sstevel@tonic-gate 	const char *msg;
26*7c478bd9Sstevel@tonic-gate 	va_dcl
27*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
28*7c478bd9Sstevel@tonic-gate {
29*7c478bd9Sstevel@tonic-gate 	const char *m;
30*7c478bd9Sstevel@tonic-gate 	SM_VA_LOCAL_DECL
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate 	m = msg;
33*7c478bd9Sstevel@tonic-gate 	if (isascii(m[0]) && isdigit(m[0]) &&
34*7c478bd9Sstevel@tonic-gate 	    isascii(m[1]) && isdigit(m[1]) &&
35*7c478bd9Sstevel@tonic-gate 	    isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
36*7c478bd9Sstevel@tonic-gate 		m += 4;
37*7c478bd9Sstevel@tonic-gate 	SM_VA_START(ap, msg);
38*7c478bd9Sstevel@tonic-gate 	(void) vfprintf(stderr, m, ap);
39*7c478bd9Sstevel@tonic-gate 	SM_VA_END(ap);
40*7c478bd9Sstevel@tonic-gate 	(void) fprintf(stderr, "\n");
41*7c478bd9Sstevel@tonic-gate }
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /*VARARGS1*/
44*7c478bd9Sstevel@tonic-gate void
45*7c478bd9Sstevel@tonic-gate #ifdef __STDC__
46*7c478bd9Sstevel@tonic-gate syserr(const char *msg, ...)
47*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */
48*7c478bd9Sstevel@tonic-gate syserr(msg, va_alist)
49*7c478bd9Sstevel@tonic-gate 	const char *msg;
50*7c478bd9Sstevel@tonic-gate 	va_dcl
51*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
52*7c478bd9Sstevel@tonic-gate {
53*7c478bd9Sstevel@tonic-gate 	const char *m;
54*7c478bd9Sstevel@tonic-gate 	SM_VA_LOCAL_DECL
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate 	m = msg;
57*7c478bd9Sstevel@tonic-gate 	if (isascii(m[0]) && isdigit(m[0]) &&
58*7c478bd9Sstevel@tonic-gate 	    isascii(m[1]) && isdigit(m[1]) &&
59*7c478bd9Sstevel@tonic-gate 	    isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
60*7c478bd9Sstevel@tonic-gate 		m += 4;
61*7c478bd9Sstevel@tonic-gate 	SM_VA_START(ap, msg);
62*7c478bd9Sstevel@tonic-gate 	(void) vfprintf(stderr, m, ap);
63*7c478bd9Sstevel@tonic-gate 	SM_VA_END(ap);
64*7c478bd9Sstevel@tonic-gate 	(void) fprintf(stderr, "\n");
65*7c478bd9Sstevel@tonic-gate }
66