From 9c146238bf44e9bea12e458b7db1fc61dad87860 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Mon, 10 Aug 1998 07:53:11 +0000 Subject: [PATCH] ad some documentation git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@977 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/table-html.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/register/table-html.c b/src/register/table-html.c index 8a029bdea8..69067d4c81 100644 --- a/src/register/table-html.c +++ b/src/register/table-html.c @@ -4,8 +4,9 @@ * * FUNCTION: * Implements the infrastructure for the displayed table. - * This is just a sample hack for printing html. Its cheesey, - * for several reasons: + * This is just a sample hack for printing html to a file, + * or by acting as a web server. Its cheesey, for several + * reasons: * * (1) HTML should never be put in the same file as C code. * Some sort of template file should be used. @@ -17,6 +18,9 @@ * get the financial data straight from the engine, * not from the register. * + * (3) The so-called "webserver" has less intelligence + * than a mosquito. + * * But this code is fun, so what the hey. * * @@ -181,10 +185,12 @@ xaccTableWebServeHTML (Table * table, unsigned short port) char buff[255]; int cnt; + /* don't slow down the parent, fork into background */ pid = fork(); if (0 < pid) return; /* parent */ CHKERR (pid, "cant fork"); + /* create a socket */ listen_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); CHKERR (listen_fd, "cant listen"); @@ -210,7 +216,7 @@ xaccTableWebServeHTML (Table * table, unsigned short port) accept_fd = accept (listen_fd, &clientsock, &clientaddrsize); CHKERR (rc, "cant accept"); - /* count, for content-length */ + /* count the number of chars, for content-length */ cnt = xaccTablePrintHTML (table, "/dev/null"); sprintf (buff, "HTTP/1.0 200 OK\n"