X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=www%2Fwsh.c;h=9ee4a1424c785bdb979ef7d0bb6e0bf3018ea020;hb=0869c05bd5a456f027823ca0783216acf4424b65;hp=f36d42e7d2eb4ccabcf4ef52c40114ea16606dda;hpb=1938b1fd36e774fa9b6d11a4eb5edfcdaee0267b;p=egate.git diff --git a/www/wsh.c b/www/wsh.c index f36d42e..9ee4a14 100644 --- a/www/wsh.c +++ b/www/wsh.c @@ -41,57 +41,78 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wsh.c,v $ - * Revision 1.1 1995/10/20 11:49:28 adam + * Revision 1.13 1996/02/29 15:36:34 adam + * Main shell loop implemented as a separate function called wshmain. + * + * Revision 1.12 1996/02/19 15:45:00 adam + * Sort of targets in multiple-targets selection. + * + * Revision 1.11 1996/02/12 10:10:32 adam + * Resource/config system used by the gateway. + * + * Revision 1.10 1996/01/12 10:05:22 adam + * If script name ends with ';' HTTP/GET/Expires will be defined. + * The cgi interface only reads final handshake if response from + * server (shell) was zero-terminated [If it isn't it probably died]. + * + * Revision 1.9 1996/01/09 10:46:51 adam + * New defines: LOGDIR/EGWDIR/CGIDIR set in Makefile. + * + * Revision 1.8 1995/12/20 16:31:33 adam + * Bug fix: shell might terminate even though new request was initiated + * by the cgi interface program. + * Work on more simple user interface and Europagate buttons. + * + * Revision 1.7 1995/11/06 17:44:23 adam + * State reestablised when shell restarts. History of previous + * result sets. + * + * Revision 1.6 1995/11/06 10:51:19 adam + * End of response marker in response from wsh/wproto to wcgi. + * Shells are respawned when necessary. + * + * Revision 1.5 1995/11/01 16:15:48 adam + * Better presentation of records. Query/set number persistent. + * + * Revision 1.4 1995/10/27 15:12:12 adam + * IrTcl incorporated in the gateway. + * Better separation of script types. + * Z39.50 gateway scripts entered. + * + * Revision 1.3 1995/10/23 16:55:41 adam + * A lot of changes - really. + * + * Revision 1.2 1995/10/20 14:02:42 adam + * First version of WWW gateway with embedded Tcl. + * + * Revision 1.1 1995/10/20 11:49:28 adam * First version of www gateway. * */ #include -#include -#include -#include -#include -#include - -#include "wproto.h" - -#define TIMEOUT_SHORT 300 -#define TIMEOUT_MEDIUM 1800 -#define TIMEOUT_LONG 7200 - -static WCLIENT wcl; -static char *mod = "wsh"; +#include "whtml.h" +#include "wtcl.h" +#include "wirtcl.h" int main (int argc, char **argv) { - char *argument, *p, parms[512]; - int timeout = TIMEOUT_SHORT; + W_Interp_Type w_interp_type; - chdir("/usr/local/etc/httpd/cgi-bin"); - gw_log_init ("egw"); - gw_log_file (GW_LOG_ALL, "/usr/local/etc/httpd/logs/egwsh_log"); - gw_log_level (GW_LOG_ALL); - gw_log (GW_LOG_STAT, mod, "Europagate www shell"); - - if (!(wcl = wproto_init())) - { - gw_log (GW_LOG_FATAL, mod, "init"); - exit(1); - } - while (wproto_process(wcl, timeout) > 0) + if (!strcmp (*argv, "egwtcl")) + w_interp_type = w_interp_tcl; + else if (!strcmp (*argv, "egwirtcl")) + w_interp_type = w_interp_irtcl; + else if (!strcmp (*argv, "egwhtml")) + w_interp_type = w_interp_html; + else { - wo_clear(wcl, "text/html"); - wo_printf(wcl, "INDEX\n"); - strcpy(parms, wcl->wf_parms); - argument = p = parms; - while (*p && *p != '/') - p++; - if (*p == '/') - *(p++) = '\0'; - gw_log (GW_LOG_DEBUG, mod, "command: %s", argument); - wo_printf (wcl, "hej - %s\n", argument); - wo_finish(wcl); + gw_log (GW_LOG_FATAL, "wsh", "Cannot determine shell type. prog=%s", + *argv); + exit (1); } - wproto_terminate(wcl); - return 0; + wshmain (argc, argv, w_interp_type); + exit (0); } + +