summaryrefslogtreecommitdiffstats
path: root/avahi-compat-libdns_sd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-10-12 23:05:50 +0000
committerLennart Poettering <lennart@poettering.net>2005-10-12 23:05:50 +0000
commit7badca4113bc8289755cd536593d8f3287aae9d5 (patch)
tree2a676e2218712ff59e69027cc8490abc14815532 /avahi-compat-libdns_sd
parent4309f0c390af2dd6013c853f128295205faca4c3 (diff)
* integrate avahi-compat-howl into build system
* compat-libdns_sd: warn to syslog in addition to STDERR * compat-howl: make use of compat-libdns_sd warning functions git-svn-id: file:///home/lennart/svn/public/avahi/trunk@750 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-compat-libdns_sd')
-rw-r--r--avahi-compat-libdns_sd/warn.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/avahi-compat-libdns_sd/warn.c b/avahi-compat-libdns_sd/warn.c
index 7ebc7b1..4cd20e6 100644
--- a/avahi-compat-libdns_sd/warn.c
+++ b/avahi-compat-libdns_sd/warn.c
@@ -30,9 +30,15 @@
#include <string.h>
#include <stdlib.h>
#include <assert.h>
+#include <stdarg.h>
+#include <syslog.h>
#include "warn.h"
+#ifndef COMPAT_LAYER
+#define COMPAT_LAYER "Apple Bonjour"
+#endif
+
static pthread_mutex_t linkage_mutex = PTHREAD_MUTEX_INITIALIZER;
static int linkage_warning = 0;
@@ -58,6 +64,24 @@ static void get_exe_name(char *t, size_t l) {
}
}
+static void warning(const char *ident, const char *fmt, ...) {
+ va_list ap, ap2;
+
+ assert(ident);
+ assert(fmt);
+
+ va_start(ap, fmt);
+ va_copy(ap2, ap);
+
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ openlog(ident, LOG_PID, LOG_USER);
+ vsyslog(LOG_WARNING, fmt, ap2);
+ closelog();
+ va_end(ap2);
+}
+
void avahi_warn_linkage(void) {
int w;
@@ -66,11 +90,12 @@ void avahi_warn_linkage(void) {
linkage_warning = 1;
pthread_mutex_unlock(&linkage_mutex);
- if (!w && !getenv("AVAHI_BONJOUR_NOWARN")) {
+ if (!w && !getenv("AVAHI_COMPAT_NOWARN")) {
char exename[256];
+
get_exe_name(exename, sizeof(exename));
-
- fprintf(stderr, "*** WARNING: The application '%s' uses the Bonjour compatiblity layer of Avahi. Please fix it to use the native API! ***\n", exename);
+
+ warning(exename, "*** WARNING: The application '%s' uses the "COMPAT_LAYER" compatiblity layer of Avahi. Please fix it to use the native API! ***\n", exename);
}
}
@@ -78,7 +103,7 @@ void avahi_warn_unsupported(const char *function) {
char exename[256];
get_exe_name(exename, sizeof(exename));
- fprintf(stderr, "*** WARNING: The application '%s' called '%s()' which is not supported (or only supported partially) in the Bonjour compatiblity layer of Avahi. Please fix it to use the native API! ***\n", exename, function);
+ warning(exename, "*** WARNING: The application '%s' called '%s()' which is not supported (or only supported partially) in the "COMPAT_LAYER" compatiblity layer of Avahi. Please fix it to use the native API! ***\n", exename, function);
}