err.c revision 266692
1188943Sthompsa/*
2188943Sthompsa * Copyright (c) 2001 Proofpoint, Inc. and its suppliers.
3188943Sthompsa *	All rights reserved.
4188943Sthompsa *
5188943Sthompsa * By using this file, you agree to the terms and conditions set
6188943Sthompsa * forth in the LICENSE file which can be found at the top level of
7188943Sthompsa * the sendmail distribution.
8188943Sthompsa *
9188943Sthompsa */
10188943Sthompsa
11188943Sthompsa#include <sendmail.h>
12188943Sthompsa
13188943SthompsaSM_RCSID("@(#)$Id: err.c,v 8.6 2013-11-22 20:51:50 ca Exp $")
14188943Sthompsa
15188943Sthompsa#include <ctype.h>
16188943Sthompsa
17188943Sthompsa/*VARARGS1*/
18188943Sthompsavoid
19188943Sthompsa#ifdef __STDC__
20188943Sthompsamessage(const char *msg, ...)
21188943Sthompsa#else /* __STDC__ */
22188943Sthompsamessage(msg, va_alist)
23188943Sthompsa	const char *msg;
24188943Sthompsa	va_dcl
25188943Sthompsa#endif /* __STDC__ */
26188943Sthompsa{
27188943Sthompsa	const char *m;
28188943Sthompsa	SM_VA_LOCAL_DECL
29188943Sthompsa
30188943Sthompsa	m = msg;
31188943Sthompsa	if (isascii(m[0]) && isdigit(m[0]) &&
32188943Sthompsa	    isascii(m[1]) && isdigit(m[1]) &&
33188943Sthompsa	    isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
34188943Sthompsa		m += 4;
35188943Sthompsa	SM_VA_START(ap, msg);
36188943Sthompsa	(void) vfprintf(stderr, m, ap);
37188943Sthompsa	SM_VA_END(ap);
38	(void) fprintf(stderr, "\n");
39}
40
41/*VARARGS1*/
42void
43#ifdef __STDC__
44syserr(const char *msg, ...)
45#else /* __STDC__ */
46syserr(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