Denis Vlasenko | 3da6aa8 | 2006-09-07 05:09:22 +0000 | [diff] [blame^] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * Utility routines. |
| 4 | * |
| 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
| 6 | * |
| 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
| 8 | */ |
| 9 | |
| 10 | #include <stdio.h> |
| 11 | #include <errno.h> |
| 12 | #include <string.h> |
| 13 | #include <stdlib.h> |
| 14 | #include <syslog.h> |
| 15 | #include "libbb.h" |
| 16 | |
| 17 | void bb_vinfo_msg(const char *s, va_list p) |
| 18 | { |
| 19 | /* va_copy is used because it is not portable |
| 20 | * to use va_list p twice */ |
| 21 | va_list p2; |
| 22 | va_copy(p2, p); |
| 23 | if (logmode & LOGMODE_STDIO) { |
| 24 | vprintf(s, p); |
| 25 | putchar('\n'); |
| 26 | } |
| 27 | if (logmode & LOGMODE_SYSLOG) |
| 28 | vsyslog(LOG_INFO, s, p2); |
| 29 | va_end(p2); |
| 30 | } |