1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2009 */
6 /* See the file NOTICE for conditions of use and distribution. */
8 /* This file is not part of the main Exim code. There are little bits of test
9 code for some of Exim's modules, and when they are used, the module they are
10 testing may call other main Exim functions that are not available and/or
11 should not be used in a test. The classic case is log_write(). This module
12 contains dummy versions of such functions - well not really dummies, more like
20 /* We don't have the full Exim headers dragged in, but this function
21 is used for debugging output. */
23 extern int string_vformat(char *, int, char *, va_list);
26 /*************************************************
27 * Handle calls to write the log *
28 *************************************************/
30 /* The message gets written to stderr when log_write() is called from a
31 utility. The message always gets '\n' added on the end of it.
34 selector not relevant when running a utility
35 flags not relevant when running a utility
36 format a printf() format
37 ... arguments for format
43 log_write(unsigned int selector
, int flags
, char *format
, ...)
47 vfprintf(stderr
, format
, ap
);
48 fprintf(stderr
, "\n");
50 selector
= selector
; /* Keep picky compilers happy */
55 /*************************************************
56 * Handle calls to print debug output *
57 *************************************************/
59 /* The message just gets written to stderr
62 format a printf() format
63 ... arguments for format
69 debug_printf(char *format
, ...)
76 if (!string_vformat(buffer
, sizeof(buffer
), format
, ap
))
78 char *s
= "**** debug string overflowed buffer ****\n";
79 char *p
= buffer
+ (int)strlen(buffer
);
80 int maxlen
= sizeof(buffer
) - (int)strlen(s
) - 3;
81 if (p
> buffer
+ maxlen
) p
= buffer
+ maxlen
;
82 if (p
> buffer
&& p
[-1] != '\n') *p
++ = '\n';
86 fprintf(stderr
, "%s", buffer
);
93 /*************************************************
95 *************************************************/
97 extern int sigalrm_seen
;
100 sigalrm_handler(int sig
)
102 sig
= sig
; /* Keep picky compilers happy */
108 /*************************************************
110 *************************************************/
113 header_checkname(void *h
, char *name
, int len
)
115 h
= h
; /* Keep picky compilers happy */
122 directory_make(char *parent
, char *name
, int mode
, int panic
)
124 parent
= parent
; /* Keep picky compilers happy */
131 host_build_sender_fullhost(void) { }
133 /* This one isn't needed for test_host */
137 host_ntoa(int type
, const void *arg
, char *buffer
, int *portptr
)
139 type
= type
; /* Keep picky compilers happy */
148 /* End of dummies.c */