Tcl command wform extented; options -raw and -exists added.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 21 May 1996 14:53:03 +0000 (14:53 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 21 May 1996 14:53:03 +0000 (14:53 +0000)
www/egwindex.html
www/wproto.c
www/wproto.h
www/wtcl.c

index 5ec6763..519dadd 100644 (file)
@@ -3,7 +3,7 @@
 <title>Europagate WWW index</title>
 </head>
 <body>
-<h2>Europagate WWW index, $Id: egwindex.html,v 1.12 1996/03/13 14:07:28 adam Exp $</h2>
+<h2>Europagate WWW index, $Id: egwindex.html,v 1.13 1996/05/21 14:53:03 adam Exp $</h2>
 <p>
 <ul>
 <li>
@@ -40,6 +40,9 @@
 <li>
     <a href="http:/cgi-bin/egwcgi/egwwais/nwi.egw/1+1">
       NWI/test with debug</a>
+<li>
+    <a href="http:/cgi-bin/egwcgi/egwirtcl/nwiquery.tcl">
+      New NWI/test with debug</a>
 </ul>
 </body>
 </html>
index f649de6..668a5a7 100644 (file)
  * USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * $Log: wproto.c,v $
- * Revision 1.19  1996/03/14 11:48:39  adam
+ * Revision 1.20  1996/05/21 14:53:04  adam
+ * Tcl command wform extented; options -raw and -exists added.
+ *
+ * Revision 1.19  1996/03/14  11:48:39  adam
  * New function egw_prog that returns name of shell.
  *
  * Revision 1.18  1996/02/12  10:09:23  adam
@@ -394,6 +397,7 @@ int wproto_process(WCLIENT wc, int timeout)
        for (t = wc->wf_parms; (*t = *p); t++, p++);
        p++;
        p++;         /* we don't deal with envvars yet */
+        wc->raw_data = p;
        decode_form(wc->wf_data, p);
        if (wc->lineout < 0)
         {
index 3c2e46e..9ccd6e8 100644 (file)
  * USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * $Log: wproto.h,v $
- * Revision 1.9  1996/03/14 11:48:39  adam
+ * Revision 1.10  1996/05/21 14:53:04  adam
+ * Tcl command wform extented; options -raw and -exists added.
+ *
+ * Revision 1.9  1996/03/14  11:48:39  adam
  * New function egw_prog that returns name of shell.
  *
  * Revision 1.8  1996/02/12  10:09:25  adam
@@ -112,6 +115,7 @@ typedef struct wclient_data
 {
     int id;
     char *prog;
+    char *raw_data;
     wform_data wf_data[100];
     char wf_parms[512];
     char wf_serverp[512];
index c75f8a4..7ee01dd 100644 (file)
  * USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * $Log: wtcl.c,v $
- * Revision 1.13  1996/03/14 11:48:40  adam
+ * Revision 1.14  1996/05/21 14:53:04  adam
+ * Tcl command wform extented; options -raw and -exists added.
+ *
+ * Revision 1.13  1996/03/14  11:48:40  adam
  * New function egw_prog that returns name of shell.
  *
  * Revision 1.12  1996/03/07  12:45:34  adam
@@ -173,17 +176,46 @@ static int proc_wform_invoke (ClientData clientData, Tcl_Interp *interp,
                               int argc, char **argv)
 {
     struct tcl_info *p = (struct tcl_info*) clientData;
+    const char *arg = NULL;
+    int failFlag = 0;
     int i;
-    if (argc == 2)
+
+    if (argc == 3)
+    {
+        if (!strcmp (argv[1], "-raw"))
+        {
+            interp->result = p->wcl->raw_data;
+            return TCL_OK;
+        }
+        else if (!strcmp (argv[1], "-exists"))
+        {
+            failFlag = 1;
+            arg = argv[2];
+        }
+        else
+        {
+            Tcl_AppendResult (p->interp, "bad option to ", argv[0],
+                              " \"", argv[1], "\"", NULL);
+            return TCL_ERROR;
+        }
+    }
+    else if (argc == 2)
+        arg = argv[1];
+    if (arg)
     {
         for (i = 0; *p->wcl->wf_data[i].name; i++)
-            if (!strcmp (argv[1], p->wcl->wf_data[i].name) && 
+            if (!strcmp (arg, p->wcl->wf_data[i].name) && 
                 *p->wcl->wf_data[i].value)
                 Tcl_AppendElement (p->interp, p->wcl->wf_data[i].value);
+        if (failFlag)
+        {
+            Tcl_AppendResult (p->interp, arg, " doesn't exist", NULL);
+            return TCL_ERROR;
+        }
         return TCL_OK;
     }    
     for (i = 0; *p->wcl->wf_data[i].name; i++)
-    { 
+    {
         Tcl_AppendResult (p->interp, "{ ", NULL);
         Tcl_AppendElement (p->interp, p->wcl->wf_data[i].name);
         Tcl_AppendElement (p->interp, p->wcl->wf_data[i].value);