Email gateway obeys 'Reply-To:' in header.
[egate.git] / www / whtml.c
index 3c1e080..b590af8 100644 (file)
  * 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.
  *
  */
 #include <assert.h>
 #include <ctype.h>
 
-#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;
 }