forked from miekg/rdup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsg.c
43 lines (38 loc) · 946 Bytes
/
msg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "rdup.h"
extern char *PROGNAME;
void
msg_va_list(const char *fmt, va_list args)
{
fprintf(stderr, "** %s: ", PROGNAME);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
/* only with debugging enabled will this call be different */
void
msgd_va_list(__attribute__((unused)) const char *func,
__attribute__((unused)) int line, const char *fmt, va_list args)
{
#ifdef DEBUG
fprintf(stderr, "** %s: %s():%d ", PROGNAME, func, line);
#else
fprintf(stderr, "** %s: ", PROGNAME);
#endif /* DEBUG */
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
void
msg(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
msg_va_list(fmt, args);
va_end(args);
}
void
msgd(const char *func, int line, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
msgd_va_list(func, line, fmt, args);
va_end(args);
}