From: Adam Dickmeiss Date: Thu, 23 May 1996 15:53:11 +0000 (+0000) Subject: Bug fix: egw_enc failed on 8-bit chars. X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=cfd53e6da1790969cb800d187f81cc63c18859ce;p=egate.git Bug fix: egw_enc failed on 8-bit chars. New command: egw_parms. --- diff --git a/www/wproto.c b/www/wproto.c index 668a5a7..5d3fc37 100644 --- a/www/wproto.c +++ b/www/wproto.c @@ -41,7 +41,11 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wproto.c,v $ - * Revision 1.20 1996/05/21 14:53:04 adam + * Revision 1.21 1996/05/23 15:53:11 adam + * Bug fix: egw_enc failed on 8-bit chars. + * New command: egw_parms. + * + * 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 @@ -394,6 +398,12 @@ int wproto_process(WCLIENT wc, int timeout) p++; for (t = wc->wf_serverf; (*t = *p); t++, p++); p++; + for (t = wc->wf_script; *p && *p != '/'; t++, p++) + *t = *p; + *t = '\0'; + if (*p) + p++; + decode_form (wc->wf_parms_var, p); for (t = wc->wf_parms; (*t = *p); t++, p++); p++; p++; /* we don't deal with envvars yet */ diff --git a/www/wproto.h b/www/wproto.h index 9ccd6e8..c483671 100644 --- a/www/wproto.h +++ b/www/wproto.h @@ -41,7 +41,11 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wproto.h,v $ - * Revision 1.10 1996/05/21 14:53:04 adam + * Revision 1.11 1996/05/23 15:53:11 adam + * Bug fix: egw_enc failed on 8-bit chars. + * New command: egw_parms. + * + * 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 @@ -92,7 +96,7 @@ typedef struct wform_data { - char name[20]; + char name[64]; char value[512]; } wform_data; @@ -116,10 +120,12 @@ typedef struct wclient_data int id; char *prog; char *raw_data; - wform_data wf_data[100]; - char wf_parms[512]; - char wf_serverp[512]; - char wf_serverf[512]; + wform_data wf_data[50]; + wform_data wf_parms_var[50]; + char wf_parms[1024]; + char wf_serverp[1024]; + char wf_serverf[1024]; + char wf_script[1024]; char path[512]; int linein; int lineout; diff --git a/www/wshmain.c b/www/wshmain.c index 1b25d38..74d96ee 100644 --- a/www/wshmain.c +++ b/www/wshmain.c @@ -41,7 +41,11 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wshmain.c,v $ - * Revision 1.3 1996/03/14 11:48:39 adam + * Revision 1.4 1996/05/23 15:53:12 adam + * Bug fix: egw_enc failed on 8-bit chars. + * New command: egw_parms. + * + * Revision 1.3 1996/03/14 11:48:39 adam * New function egw_prog that returns name of shell. * * Revision 1.2 1996/03/08 16:47:06 adam @@ -132,11 +136,10 @@ void wshmain (int argc, char **argv, W_Interp_Type w_interp_type) timeout = 1; wo_clear (wcl, NULL); strcpy (parms_buf, wcl->wf_parms); - script = parms = parms_buf; - while (*parms && *parms != '/') - parms++; - if (*parms) - *parms++ = '\0'; + parms = parms_buf; + + script = wcl->wf_script; + if (*script) { p = script + strlen(script); diff --git a/www/wtcl.c b/www/wtcl.c index a5c0e71..5728d56 100644 --- a/www/wtcl.c +++ b/www/wtcl.c @@ -41,7 +41,11 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wtcl.c,v $ - * Revision 1.15 1996/05/22 16:50:27 adam + * Revision 1.16 1996/05/23 15:53:12 adam + * Bug fix: egw_enc failed on 8-bit chars. + * New command: egw_parms. + * + * Revision 1.15 1996/05/22 16:50:27 adam * Bug fix. * * Revision 1.14 1996/05/21 14:53:04 adam @@ -175,10 +179,10 @@ static int proc_html_invoke (ClientData clientData, Tcl_Interp *interp, return TCL_OK; } -static int proc_wform_invoke (ClientData clientData, Tcl_Interp *interp, - int argc, char **argv) +static int proc_form_invoke (struct tcl_info *p, wform_data *wfdata, + Tcl_Interp *interp, + int argc, char **argv) { - struct tcl_info *p = (struct tcl_info*) clientData; const char *arg = NULL; int failFlag = 0; int i; @@ -206,12 +210,12 @@ static int proc_wform_invoke (ClientData clientData, Tcl_Interp *interp, arg = argv[1]; if (arg) { - for (i = 0; *p->wcl->wf_data[i].name; i++) - if (!strcmp (arg, p->wcl->wf_data[i].name)) + for (i = 0; *wfdata[i].name; i++) + if (!strcmp (arg, wfdata[i].name)) { failFlag = 0; - if (*p->wcl->wf_data[i].value) - Tcl_AppendElement (p->interp, p->wcl->wf_data[i].value); + if (*wfdata[i].value) + Tcl_AppendElement (p->interp, wfdata[i].value); } if (failFlag) { @@ -220,16 +224,33 @@ static int proc_wform_invoke (ClientData clientData, Tcl_Interp *interp, } return TCL_OK; } - for (i = 0; *p->wcl->wf_data[i].name; i++) + for (i = 0; *wfdata[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); + Tcl_AppendElement (p->interp, wfdata[i].name); + Tcl_AppendElement (p->interp, wfdata[i].value); Tcl_AppendResult (p->interp, " }\n", NULL); } return TCL_OK; } +static int proc_wform_invoke (ClientData clientData, Tcl_Interp *interp, + int argc, char **argv) +{ + struct tcl_info *p = (struct tcl_info*) clientData; + wform_data *wfdata = p->wcl->wf_data; + return proc_form_invoke (p, wfdata, interp, argc, argv); +} + +static int proc_parms_invoke (ClientData clientData, Tcl_Interp *interp, + int argc, char **argv) +{ + struct tcl_info *p = (struct tcl_info*) clientData; + wform_data *wfdata = p->wcl->wf_parms_var; + return proc_form_invoke (p, wfdata, interp, argc, argv); +} + + static int proc_wlog_invoke (ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { @@ -269,7 +290,7 @@ static int proc_enc (ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { int i; - char buf1[4]; + char buf1[6]; char buf2[2]; buf1[0] = '%'; @@ -282,7 +303,7 @@ static int proc_enc (ClientData clientData, Tcl_Interp *interp, if (*cp <= ' ' || *cp >= 127 || *cp == '/' || *cp == ' ' || *cp == '&' || *cp == ':' || *cp == '%') { - sprintf (buf1+1, "%02X", *cp); + sprintf (buf1+1, "%02X", *cp & 0xff); Tcl_AppendResult (interp, buf1, NULL); } else @@ -373,6 +394,7 @@ static void *do_create (WCLIENT wcl, void *args) Tcl_AppInit (p->interp); Tcl_CreateCommand (p->interp, "html", proc_html_invoke, p, NULL); Tcl_CreateCommand (p->interp, "egw_form", proc_wform_invoke, p, NULL); + Tcl_CreateCommand (p->interp, "egw_parms", proc_parms_invoke, p, NULL); Tcl_CreateCommand (p->interp, "egw_abort", proc_wabort_invoke, p, NULL); Tcl_CreateCommand (p->interp, "egw_flush", proc_wflush_invoke, p, NULL); Tcl_CreateCommand (p->interp, "egw_log", proc_wlog_invoke, p, NULL);