From 5ad610a31c3c57ce53d04a1002b7cef1876f30db Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 21 May 1996 14:53:03 +0000 Subject: [PATCH] Tcl command wform extented; options -raw and -exists added. --- www/egwindex.html | 5 ++++- www/wproto.c | 6 +++++- www/wproto.h | 6 +++++- www/wtcl.c | 40 ++++++++++++++++++++++++++++++++++++---- 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/www/egwindex.html b/www/egwindex.html index 5ec6763..519dadd 100644 --- a/www/egwindex.html +++ b/www/egwindex.html @@ -3,7 +3,7 @@ Europagate WWW index -

Europagate WWW index, $Id: egwindex.html,v 1.12 1996/03/13 14:07:28 adam Exp $

+

Europagate WWW index, $Id: egwindex.html,v 1.13 1996/05/21 14:53:03 adam Exp $

diff --git a/www/wproto.c b/www/wproto.c index f649de6..668a5a7 100644 --- a/www/wproto.c +++ b/www/wproto.c @@ -41,7 +41,10 @@ * 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) { diff --git a/www/wproto.h b/www/wproto.h index 3c2e46e..9ccd6e8 100644 --- a/www/wproto.h +++ b/www/wproto.h @@ -41,7 +41,10 @@ * 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]; diff --git a/www/wtcl.c b/www/wtcl.c index c75f8a4..7ee01dd 100644 --- a/www/wtcl.c +++ b/www/wtcl.c @@ -41,7 +41,10 @@ * 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); -- 1.7.10.4