#include <signal.h>
#include "webcit.h"
#include "vcard.h"
+#include "webserver.h"
/*
- * Here we go. Please note that the buffer may be changed by this function!
*/
-void output_text_html(char *partbuf, int total_length) {
-
+void output_html(void) {
+ char buf[SIZ];
+ char *msg;
char *ptr;
char *msgstart;
char *msgend;
+ int total_length = 1;
+ int line_length = 0;
+
+ msg = strdup("");
+ msgstart = msg;
+ msgend = msg;
+
+ while (serv_gets(buf), strcmp(buf, "000")) {
+ line_length = strlen(buf);
+ total_length = total_length + line_length + 1;
+ msg = realloc(msg, total_length);
+ strcpy(msgend, buf);
+ strcat(msgend, "\n");
+ msgend = &msgend[line_length + 1];
+ }
+
+ ptr = msg;
+ msgstart = msg;
+ msgend = &msg[total_length];
- ptr = partbuf;
- msgstart = partbuf;
- msgend = &partbuf[total_length];
+ fprintf(stderr, "msg looks like this:\n%s\n", ptr);
while (ptr < msgend) {
write(WC->http_sock, msgstart, strlen(msgstart));
- /* Close a bunch of tags that might have been opened */
+ /* Close a bunch of tags that might have been opened
wprintf("</I></B></FONT></TD></TR></TABLE></TT></PRE></A><BR>\n");
+ */
+
+ /* Now give back the memory */
+ free(msg);
}