|
10 | 10 | #include "log.h" |
11 | 11 |
|
12 | 12 | void |
13 | | -sshfatal(const char *file, const char *func, int line, int showfunc, |
14 | | - LogLevel level, const char *suffix, const char *fmt, ...) |
| 13 | +sshlogv(const char *file, const char *func, int line, int showfunc, |
| 14 | + LogLevel level, const char *suffix, const char *fmt, va_list args) |
15 | 15 | { |
16 | | - va_list ap; |
17 | | - |
18 | 16 | if (showfunc) |
19 | 17 | fprintf(stderr, "%s: ", func); |
20 | | - va_start(ap, fmt); |
21 | | - vfprintf(stderr, fmt, ap); |
22 | | - va_end(ap); |
| 18 | + vfprintf(stderr, fmt, args); |
23 | 19 | if (suffix != NULL) |
24 | 20 | fprintf(stderr, ": %s", suffix); |
25 | 21 | fputc('\n', stderr); |
| 22 | +} |
| 23 | + |
| 24 | +void |
| 25 | +sshlog(const char *file, const char *func, int line, int showfunc, |
| 26 | + LogLevel level, const char *suffix, const char *fmt, ...) |
| 27 | +{ |
| 28 | + va_list args; |
| 29 | + |
| 30 | + va_start(args, fmt); |
| 31 | + sshlogv(file, func, line, showfunc, level, suffix, fmt, args); |
| 32 | + va_end(args); |
| 33 | +} |
| 34 | + |
| 35 | +void |
| 36 | +sshfatal(const char *file, const char *func, int line, int showfunc, |
| 37 | + LogLevel level, const char *suffix, const char *fmt, ...) |
| 38 | +{ |
| 39 | + va_list args; |
| 40 | + |
| 41 | + va_start(args, fmt); |
| 42 | + sshlogv(file, func, line, showfunc, level, suffix, fmt, args); |
| 43 | + va_end(args); |
26 | 44 | _exit(1); |
27 | 45 | } |
0 commit comments