X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=www%2Fwhtml.c;h=b590af83c43cc43da015b2bce270f342e423f93a;hb=25db261b6bbbfcc7bc26f679f195b51d31b9d7d7;hp=3c1e0809d4b362709deac3fc7770fca1781c41c3;hpb=f37ddd57014f51c88ef36050ed08b4c6e226e094;p=egate.git diff --git a/www/whtml.c b/www/whtml.c index 3c1e080..b590af8 100644 --- a/www/whtml.c +++ b/www/whtml.c @@ -41,7 +41,18 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: whtml.c,v $ - * Revision 1.1 1995/10/20 14:02:41 adam + * Revision 1.4 1996/02/29 15:35:20 adam + * Missing 'extern' in declaration of Winterp types. + * + * Revision 1.3 1995/10/27 15:12:06 adam + * IrTcl incorporated in the gateway. + * Better separation of script types. + * Z39.50 gateway scripts entered. + * + * Revision 1.2 1995/10/23 16:55:37 adam + * A lot of changes - really. + * + * Revision 1.1 1995/10/20 14:02:41 adam * First version of WWW gateway with embedded Tcl. * */ @@ -52,30 +63,45 @@ #include #include -#include "wproto.h" -#include "winterp.h" +#include "whtml.h" -static void *do_create (void *args); -static int do_exec (WCLIENT wcl, const char *fname, char *parms, void *mydata); +static void *do_create (WCLIENT wcl, void *args); +static int do_exec (const char *fname, char *parms, void *mydata); static struct w_interp_type w_interp_t = { "html", do_create, - do_exec + do_exec, + NULL, + NULL }; W_Interp_Type w_interp_html = &w_interp_t; static char *mod = "whtml"; -static void *do_create (void *args) +struct html_info { + WCLIENT wcl; +}; + +static void *do_create (WCLIENT wcl, void *args) { - return NULL; + struct html_info *p; + + p = malloc (sizeof(*p)); + if (!p) + { + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, mod, "malloc: html_info"); + exit (1); + } + p->wcl = wcl; + return p; } -static int do_exec (WCLIENT wcl, const char *fname, char *parms, void *mydata) +static int do_exec (const char *fname, char *parms, void *mydata) { int c; + struct html_info *p = mydata; FILE *inf = fopen (fname, "r"); gw_log (GW_LOG_DEBUG, mod, "executing %s", fname); @@ -85,7 +111,7 @@ static int do_exec (WCLIENT wcl, const char *fname, char *parms, void *mydata) return -1; } while ((c = getc (inf)) != EOF) - wo_putc (wcl, c); + wo_putc (p->wcl, c); fclose (inf); return 0; }