xref: /titanic_44/usr/src/cmd/sendmail/libsmutil/err.c (revision 55553f719b521a0bb4deab6efc944cd30c1a56aa)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
12 
13 #include <sendmail.h>
14 
15 SM_RCSID("@(#)$Id: err.c,v 8.3 2001/01/24 01:27:30 gshapiro Exp $")
16 
17 #include <ctype.h>
18 
19 /*VARARGS1*/
20 void
21 #ifdef __STDC__
22 message(const char *msg, ...)
23 #else /* __STDC__ */
24 message(msg, va_alist)
25 	const char *msg;
26 	va_dcl
27 #endif /* __STDC__ */
28 {
29 	const char *m;
30 	SM_VA_LOCAL_DECL
31 
32 	m = msg;
33 	if (isascii(m[0]) && isdigit(m[0]) &&
34 	    isascii(m[1]) && isdigit(m[1]) &&
35 	    isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
36 		m += 4;
37 	SM_VA_START(ap, msg);
38 	(void) vfprintf(stderr, m, ap);
39 	SM_VA_END(ap);
40 	(void) fprintf(stderr, "\n");
41 }
42 
43 /*VARARGS1*/
44 void
45 #ifdef __STDC__
46 syserr(const char *msg, ...)
47 #else /* __STDC__ */
48 syserr(msg, va_alist)
49 	const char *msg;
50 	va_dcl
51 #endif /* __STDC__ */
52 {
53 	const char *m;
54 	SM_VA_LOCAL_DECL
55 
56 	m = msg;
57 	if (isascii(m[0]) && isdigit(m[0]) &&
58 	    isascii(m[1]) && isdigit(m[1]) &&
59 	    isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
60 		m += 4;
61 	SM_VA_START(ap, msg);
62 	(void) vfprintf(stderr, m, ap);
63 	SM_VA_END(ap);
64 	(void) fprintf(stderr, "\n");
65 }
66