X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=getcgi.c;h=26c3c50f5f52cf2b6bce08a0b962458640aa2f81;hb=200b89a2c66c58c41a27883f021850445698b337;hp=47a94b294090c9a21da443247168aa706a72030a;hpb=e02c731dfbb288c736f2cd09a9b6df0507c59ddd;p=onak.git diff --git a/getcgi.c b/getcgi.c index 47a94b2..26c3c50 100644 --- a/getcgi.c +++ b/getcgi.c @@ -25,7 +25,7 @@ char *txt2html(const char *string) char *ptr = NULL; char *nextptr = NULL; - buf[0] = 0; + memset(buf, 0, 1024); ptr = strchr(string, '<'); if (ptr != NULL) { @@ -57,8 +57,42 @@ char *txt2html(const char *string) return buf; } +/* + * start_html - Start HTML output. + * @title: The title for the HTML. + * + * Takes a title string and starts HTML output, including the + * Content-Type header all the way up to . + */ +void start_html(const char *title) +{ + puts("Content-Type: text/html; charset=utf8\n"); + puts(""); + puts(""); + puts(""); + printf("%s\n", title); + puts(""); + puts(""); + + return; +} + +/* + * end_html - End HTML output. + * + * Ends HTML output - closes the BODY and HTML tags. + */ +void end_html(void) +{ + puts(""); + puts(""); + + return; +} + + /* Convert a two-char hex string into the char it represents */ -char x2c(char *what) +char x2c(const char *what) { register char digit;