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