USA.
***/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <ctype.h>
#include <avahi-common/malloc.h>
#include <avahi-core/log.h>
i = r = avahi_new(char*, n_comma+2);
for (;;) {
- size_t l = strcspn(t, ",");
+ size_t n, l = strcspn(t, ",");
+ const char *c;
+
+ /* Ignore leading blanks */
+ for (c = t, n = l; isblank(*c); c++, n--);
+
+ /* Ignore trailing blanks */
+ for (; n > 0 && isblank(c[n-1]); n--);
- *(i++) = avahi_strndup(t, l);
+ *(i++) = avahi_strndup(c, n);
t += l;