|
|
@ -136,6 +136,16 @@ static int write_html(int fd, const char *buf, size_t len) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int write_zet_link(int fd, const char *id, const char *title) {
|
|
|
|
|
|
|
|
if (title == NULL) {
|
|
|
|
|
|
|
|
return dprintf(fd, " <a href=\"%s\"><strong><code>§%s</code></strong></a>", id, id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int rc = dprintf(fd, " <a href=\"%s\"><strong>[", id);
|
|
|
|
|
|
|
|
rc |= write_html(fd, title, strlen(title));
|
|
|
|
|
|
|
|
rc |= dprintf(fd, "](<code>§%s</code>)</strong></a>", id);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int write_topbar(int fd, enum page page, const char *id, const char *title) {
|
|
|
|
static int write_topbar(int fd, enum page page, const char *id, const char *title) {
|
|
|
|
int rc = write_buf(fd, "<form action=\"search\">");
|
|
|
|
int rc = write_buf(fd, "<form action=\"search\">");
|
|
|
|
|
|
|
|
|
|
|
@ -163,13 +173,7 @@ static int write_topbar(int fd, enum page page, const char *id, const char *titl
|
|
|
|
rc |= write_buf(fd, ">");
|
|
|
|
rc |= write_buf(fd, ">");
|
|
|
|
|
|
|
|
|
|
|
|
if (page == PAGE_ZET) {
|
|
|
|
if (page == PAGE_ZET) {
|
|
|
|
if (title == NULL) {
|
|
|
|
rc |= write_zet_link(fd, id, title);
|
|
|
|
rc |= dprintf(fd, " <a href=\"%s\"><strong><code>§%s</code></strong></a>", id, id);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
rc |= dprintf(fd, " <a href=\"%s\"><strong>[", id);
|
|
|
|
|
|
|
|
rc |= write_html(fd, title, strlen(title));
|
|
|
|
|
|
|
|
rc |= dprintf(fd, "](<code>§%s</code>)</strong></a>", id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rc |= write_buf(fd, "</form>");
|
|
|
|
rc |= write_buf(fd, "</form>");
|
|
|
@ -548,9 +552,9 @@ static int dpi_serve_zet_search(int fd, char *qs) {
|
|
|
|
title[sizeof(title)-1] = '\0';
|
|
|
|
title[sizeof(title)-1] = '\0';
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rc = dprintf(fd, "<li><a href=\"%s\">", id);
|
|
|
|
rc = write_buf(fd, "<li>");
|
|
|
|
rc |= write_html(fd, title, strlen(title));
|
|
|
|
rc |= write_zet_link(fd, id, title);
|
|
|
|
rc |= write_buf(fd, "</a></li>");
|
|
|
|
rc |= write_buf(fd, "</li>");
|
|
|
|
if (rc < 0) { warnx("dprintf/write_html/write_buf"); close(fd); return 0; }
|
|
|
|
if (rc < 0) { warnx("dprintf/write_html/write_buf"); close(fd); return 0; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rc = dprintf(fd, "</ul></body></html>");
|
|
|
|
rc = dprintf(fd, "</ul></body></html>");
|
|
|
|