\n");
va_start(ap, current_page);
i = 0;
while ((child = va_arg(ap, gchar *)) &&
(tab_label = va_arg(ap, gchar *))) {
i_str = g_strdup_printf("%zu", i);
len += strlen("
\n");
len += strlen("
\n");
++i;
}
va_end(ap);
va_start(ap, current_page);
while ((child = va_arg(ap, gchar *)) &&
(tab_label = va_arg(ap, gchar *))) {
i_str = g_strdup_printf("%zu", i);
len += strlen("
\n");
len += strlen(child);
len += strlen("
\n\n");
}
va_end(ap);
len += strlen("
\n");
++len; /* NUL byte */
/* Build string. */
notebook = g_new(gchar, len);
ptr = g_stpcpy(notebook, "\n");
va_start(ap, current_page);
i = 0;
while ((child = va_arg(ap, gchar *)) &&
(tab_label = va_arg(ap, gchar *))) {
i_str = g_strdup_printf("%zu", i);
ptr = g_stpcpy(ptr, "
\n");
ptr = g_stpcpy(ptr, "
\n");
g_free(i_str);
++i;
}
va_end(ap);
va_start(ap, current_page);
i = 0;
while ((child = va_arg(ap, gchar *)) &&
(tab_label = va_arg(ap, gchar *))) {
i_str = g_strdup_printf("%zu", i);
ptr = g_stpcpy(ptr, "
\n");
ptr = g_stpcpy(ptr, child);
g_free(child);
ptr = g_stpcpy(ptr, "
\n\n");
++i;
}
va_end(ap);
ptr = g_stpcpy(ptr, "
\n"); /* g_stpcpy() adds the NUL. */
return notebook;
}
gchar *
mq_html_form(const gchar *submit_name, const gchar *submit_label,
const gchar *reset_name, const gchar *reset_label, ...)
{
gsize len;
va_list ap;
gchar *child;
gchar *form;
gchar *ptr;
/* Calculate length. */
len = strlen("