#define _POSIX_C_SOURCE 200809L #include "form.h" #include "defs.h" #include #include #if 0 "" " \n" \ " " \ "" PROJECT_TITLE "" #endif int form_head(struct html_node *const n) { struct html_node *head, *link, *charset, *name, *title; if (!(head = html_node_add_child(n, "head")) || !(link = html_node_add_child(head, "link")) || !(charset = html_node_add_child(head, "meta")) || !(name = html_node_add_child(head, "meta")) || !(title = html_node_add_child(head, "title"))) { fprintf(stderr, "%s: html_node_add_child failed\n", __func__); return -1; } else if (html_node_add_attr(link, "href", "/" STYLE_PATH) || html_node_add_attr(link, "rel", "stylesheet") || html_node_add_attr(charset, "charset", "UTF-8") || html_node_add_attr(name, "name", "viewport") || html_node_add_attr(name, "content", "width=device-width, initial-scale=1, maximum-scale=1")) { fprintf(stderr, "%s: html_node_add_attr failed\n", __func__); return -1; } else if (html_node_set_value(title, PROJECT_TITLE)) { fprintf(stderr, "%s: html_node_set_value failed\n", __func__); return -1; } return 0; }