summaryrefslogtreecommitdiffstats
path: root/avahi-compat-howl
diff options
context:
space:
mode:
Diffstat (limited to 'avahi-compat-howl')
-rw-r--r--avahi-compat-howl/Makefile.am4
-rw-r--r--avahi-compat-howl/samples/Makefile.am4
-rw-r--r--avahi-compat-howl/text.c18
3 files changed, 25 insertions, 1 deletions
diff --git a/avahi-compat-howl/Makefile.am b/avahi-compat-howl/Makefile.am
index 5c12782..e183b7e 100644
--- a/avahi-compat-howl/Makefile.am
+++ b/avahi-compat-howl/Makefile.am
@@ -25,6 +25,7 @@ AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
SUBDIRS = . samples
if HAVE_DBUS
+if ENABLE_COMPAT_HOWL
avahi_compat_howldir=$(includedir)/avahi-compat-howl
avahi_compat_howl_rendezvousdir=$(avahi_compat_howldir)/rendezvous
@@ -70,7 +71,9 @@ HOWLHEADERS = \
lib_LTLIBRARIES = libavahi-compat-howl.la
+if ENABLE_TESTS
noinst_PROGRAMS = address-test text-test browse-domain-test
+endif
libavahi_compat_howl_la_SOURCES = \
$(HOWLHEADERS) \
@@ -105,3 +108,4 @@ browse_domain_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
browse_domain_test_LDADD = $(AM_LDADD) libavahi-compat-howl.la
endif
+endif
diff --git a/avahi-compat-howl/samples/Makefile.am b/avahi-compat-howl/samples/Makefile.am
index 14bbfb7..21d15a8 100644
--- a/avahi-compat-howl/samples/Makefile.am
+++ b/avahi-compat-howl/samples/Makefile.am
@@ -23,8 +23,11 @@ AM_CFLAGS=-I$(top_srcdir) -I$(top_srcdir)/avahi-compat-howl/include
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
if HAVE_DBUS
+if ENABLE_COMPAT_HOWL
+if ENABLE_TESTS
noinst_PROGRAMS = browse resolve publish query
+endif
browse_SOURCES = \
browse.c
@@ -47,3 +50,4 @@ query_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
query_LDADD = $(AM_LDADD) ../libavahi-compat-howl.la
endif
+endif
diff --git a/avahi-compat-howl/text.c b/avahi-compat-howl/text.c
index 1cd34fe..fb05acf 100644
--- a/avahi-compat-howl/text.c
+++ b/avahi-compat-howl/text.c
@@ -39,6 +39,22 @@ struct _sw_text_record {
int buffer_valid;
};
+#ifndef HAVE_STRLCPY
+
+static size_t strlcpy(char *dest, const char *src, size_t n) {
+ assert(dest);
+ assert(src);
+
+ if (n > 0) {
+ strncpy(dest, src, n-1);
+ dest[n-1] = 0;
+ }
+
+ return strlen(src);
+}
+
+#endif
+
sw_result sw_text_record_init(sw_text_record *self) {
assert(self);
@@ -223,7 +239,7 @@ sw_result sw_text_record_iterator_next(
if (avahi_string_list_get_pair(self->index, &mkey, &mvalue, &msize) < 0)
return SW_E_UNKNOWN;
- avahi_strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN);
+ strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN);
memset(val, 0, SW_TEXT_RECORD_MAX_LEN);
memcpy(val, mvalue, msize);
*val_len = msize;