+ p = adu_malloc(size);
+ while (1) {
+ va_list ap;
+ /* Try to print in the allocated space. */
+ va_start(ap, fmt);
+ n = vsnprintf(p, size, fmt, ap);
+ va_end(ap);
+ /* If that worked, return the string. */
+ if (n > -1 && n < size)
+ break;
+ /* Else try again with more space. */
+ if (n > -1) /* glibc 2.1 */
+ size = n + 1; /* precisely what is needed */
+ else /* glibc 2.0 */
+ size *= 2; /* twice the old size */
+ p = adu_realloc(p, size);
+ }
+ return p;
+}
+
+/**
+ * adu's version of strcat().
+ *
+ * \param a String to be appended to.
+ * \param b String to append.
+ *
+ * Append \p b to \p a.
+ *
+ * \return If \a a is \p NULL, return a pointer to a copy of \a b, i.e.
+ * adu_strcat(NULL, b) is equivalent to adu_strdup(b). If \a b is \p NULL,
+ * return \a a without making a copy of \a a. Otherwise, construct the
+ * concatenation \a c, free \a a (but not \a b) and return \a c.
+ *
+ * \sa strcat(3).
+ */
+__must_check __malloc char *adu_strcat(char *a, const char *b)
+{
+ char *tmp;
+
+ if (!a)
+ return adu_strdup(b);
+ if (!b)
+ return a;
+ tmp = make_message("%s%s", a, b);
+ free(a);
+ return tmp;