]>
Commit | Line | Data |
---|---|---|
e9ce8d39 A |
1 | /* |
2 | * @OSF_FREE_COPYRIGHT@ | |
3 | * | |
4 | */ | |
5 | ||
6 | #include <mach/mach.h> | |
7 | #include <mach/mach_init.h> | |
8 | #include <stdio.h> | |
9 | #include <stdarg.h> | |
10 | ||
11 | int (*vprintf_stderr_func)(const char *format, va_list ap); | |
12 | ||
13 | ||
14 | /* This function allows the writing of a mach error message to an | |
15 | * application-controllable output method, the default being to | |
16 | * use printf if no other method is specified by the application. | |
17 | * | |
18 | * To override, set the global (static) function pointer vprintf_stderr to | |
19 | * a function which takes the same parameters as vprintf. | |
20 | */ | |
21 | ||
22 | int fprintf_stderr(const char *format, ...) | |
23 | { | |
24 | va_list args; | |
25 | int retval; | |
26 | ||
27 | va_start(args, format); | |
28 | if (vprintf_stderr_func == NULL) | |
29 | retval = vprintf(format, args); | |
30 | else | |
31 | retval = (*vprintf_stderr_func)(format, args); | |
32 | va_end(args); | |
33 | ||
34 | return retval; | |
35 | } |