84825bc76665ae0c9f09a5f00a6bb18af5f8c91e
[oweals/busybox.git] / libbb / vinfo_msg.c
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 (ENABLE_FEATURE_SYSLOG & (logmode & LOGMODE_SYSLOG))
28                 vsyslog(LOG_INFO, s, p2);
29         va_end(p2);
30 }