Record presentation.
[egate.git] / www / wirtcl.c
index fcb49ff..e0e48e8 100644 (file)
  * USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * $Log: wirtcl.c,v $
- * Revision 1.4  1995/10/31 10:03:53  adam
+ * Revision 1.5  1995/10/31 16:56:24  adam
+ * Record presentation.
+ *
+ * Revision 1.4  1995/10/31  10:03:53  adam
  * Work on queries.
  * New command implemented - aborts script.
  *
@@ -71,6 +74,7 @@
 #include <assert.h>
 #include <ctype.h>
 
+#include <log.h>
 #include "wtcl.h"
 #include "wirtcl.h"
 
@@ -144,6 +148,7 @@ static void *do_create (WCLIENT wcl, void *args)
         gw_log (GW_LOG_FATAL, mod, "Cannot make Irtcl_Interp");
         exit (1);
     }
+    log_init(LOG_ALL, "irtcl", "/usr/local/etc/httpd/logs/irtcl_log");
     /* initialize irtcl */
     Tcl_CreateCommand (p->interp, "zwait", proc_zwait_invoke, p, NULL);
     for (i=0; i<MAX_CALLBACK; i++)
@@ -193,13 +198,13 @@ static int events (struct tcl_info *p, char *waitVar)
         Tcl_AppendResult (p->interp, msg, NULL);
         return TCL_ERROR;
     }
-    gw_log (GW_LOG_DEBUG, mod, "Waiting for variable %s=%s",
-            waitVar, waitVarVal);
+    gw_log (GW_LOG_DEBUG, mod, "Waiting %s=%s", waitVar, waitVarVal);
     while (1)
     {
         if (!(cp = Tcl_GetVar (p->interp, waitVar, 0)) ||
             strcmp (cp, waitVarVal))
         {
+            gw_log (GW_LOG_DEBUG, mod, "Changed to %s", cp);
             Tcl_AppendResult (p->interp, cp, NULL);
             free (waitVarVal);
             return TCL_OK;
@@ -228,17 +233,24 @@ static int events (struct tcl_info *p, char *waitVar)
         }
         if (!r)
             break;
+        gw_log (GW_LOG_DEBUG, mod, "fifo select %d", fifo_in);
         FD_SET (fifo_in, &fdset_tcl_r);
         if ((r = select(max_fd+1, &fdset_tcl_r, &fdset_tcl_w, 
                           &fdset_tcl_x, 0)) < 0)
         {
-            perror("select");
+            gw_log (GW_LOG_ERRNO|GW_LOG_FATAL, mod, "select");
             exit(1);
         }
         if (!r)
+        {
+            gw_log (GW_LOG_DEBUG, mod, "timeout");
             break;
+        }
         if (FD_ISSET (fifo_in, &fdset_tcl_r))
+        {
+            gw_log (GW_LOG_DEBUG, mod, "FIFO closed");
             break;
+        }
         for (i=0; i<=max_fd; i++)
         {
             if (FD_ISSET (i, &fdset_tcl_r))