X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=www%2Fwtcl.c;h=8772adcc89f87134cb408bb2eb8069e15ea478cc;hb=a99bbcafcacb3b34d19e2ccef4ee636dfbe883e1;hp=8053f24b92cde92b6519dc262dc9052a2408941e;hpb=1140389ab96fc8ca7bc9c8dc642adbcec625f4a6;p=egate.git diff --git a/www/wtcl.c b/www/wtcl.c index 8053f24..8772adc 100644 --- a/www/wtcl.c +++ b/www/wtcl.c @@ -41,6 +41,10 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wtcl.c,v $ + * Revision 1.20 1997/01/31 11:16:01 adam + * Enhanced the egw_source command. An optional parameter specifies the + * name of a variable in which the HTML output is stored. + * * Revision 1.19 1997/01/27 11:27:17 adam * Implemented a new command, egw_clear, to clear http output cache. * Changed prototype for function wo_clear. @@ -384,22 +388,32 @@ static int proc_source (ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { struct tcl_info *p = (struct tcl_info*) clientData; - int r; + int r, offset = 0; - if (argc != 2) + if (argc < 2 || argc > 3) { Tcl_AppendResult (p->interp, - "wrong # args: should be egw_source file", NULL); + "wrong # args: should be egw_source file ?var?", + NULL); return TCL_ERROR; } + if (argc == 3) + offset = wproto_save_push (p->wcl); r = exec_file (argv[1], p); - if (r == -2) + Tcl_ResetResult (p->interp); + if (argc == 3) + { + char *res = wproto_save_pop (p->wcl, offset); + if (res) + Tcl_SetVar (p->interp, argv[2], res, 0); + } + if (r == -1) { - Tcl_AppendResult (p->interp, "egw_source: couldn't source ", + Tcl_AppendResult (p->interp, "egw_source: couldn't open ", argv[1], NULL); return TCL_ERROR; } - else if (r == -1) + else if (r == -2) { Tcl_AppendResult (p->interp, "egw_source: Tcl error in script ", argv[1], NULL);