From: Adam Dickmeiss Date: Thu, 14 Mar 1996 11:48:37 +0000 (+0000) Subject: New function egw_prog that returns name of shell. X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=eabbad76c996dd29295d07df3111f0797624b42e;p=egate.git New function egw_prog that returns name of shell. --- diff --git a/www/wcgi.c b/www/wcgi.c index 6242f90..6a43239 100644 --- a/www/wcgi.c +++ b/www/wcgi.c @@ -41,7 +41,10 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wcgi.c,v $ - * Revision 1.17 1996/02/26 10:36:15 adam + * Revision 1.18 1996/03/14 11:48:37 adam + * New function egw_prog that returns name of shell. + * + * Revision 1.17 1996/02/26 10:36:15 adam * Better error handling when (re)spawn of the shell fails. * * Revision 1.16 1996/02/12 10:10:29 adam @@ -118,9 +121,6 @@ #include #endif -#define DEADSTRING "Your database server has terminated. To reactivate \ -the server, please reload the server's 'front page'." - #include #include #include "wproto.h" diff --git a/www/wproto.c b/www/wproto.c index 0cbeeb1..f649de6 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.18 1996/02/12 10:09:23 adam + * 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 * New parameter to wproto_init: directory root for the FIFOs (instead * of using preprocessor defines FIFODIR/FIFOROOT). * @@ -418,7 +421,7 @@ int wproto_process(WCLIENT wc, int timeout) } } -WCLIENT wproto_init (const char *fifoDir) +WCLIENT wproto_init (const char *fifoDir, const char *prog) { char *val, path2[256]; wclient_data *new; @@ -435,6 +438,12 @@ WCLIENT wproto_init (const char *fifoDir) gw_log (GW_LOG_FATAL, mod, "GWID not set"); exit (1); } + if (!(new->prog = malloc (strlen(prog)+1))) + { + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, mod, "malloc"); + exit (1); + } + strcpy (new->prog, prog); new->fifoDir = fifoDir; new->id = atoi (val); sprintf(new->path, "%s/clt%d", new->fifoDir, new->id); @@ -482,6 +491,7 @@ static void wproto_uncache(WCLIENT wc, int level) void wproto_terminate(WCLIENT wc) { + free (wc->prog); close(wc->linein); unlink(wc->path); wproto_uncache(wc, 0); diff --git a/www/wproto.h b/www/wproto.h index abe0f05..3c2e46e 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.8 1996/02/12 10:09:25 adam + * 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 * New parameter to wproto_init: directory root for the FIFOs (instead * of using preprocessor defines FIFODIR/FIFOROOT). * @@ -108,6 +111,7 @@ struct w_select_handle { typedef struct wclient_data { int id; + char *prog; wform_data wf_data[100]; char wf_parms[512]; char wf_serverp[512]; @@ -131,7 +135,7 @@ typedef struct wclient_data char *wgetval (WCLIENT wc, char *name); int wproto_process (WCLIENT wc, int timeout); -WCLIENT wproto_init (const char *fifoDir); +WCLIENT wproto_init (const char *fifoDir, const char *prog); void wo_printf (WCLIENT wc, const char *fmt, ...); void wo_clear (WCLIENT wc, const char *type); int wo_finish (WCLIENT wc); diff --git a/www/wshmain.c b/www/wshmain.c index 9a34f7e..1b25d38 100644 --- a/www/wshmain.c +++ b/www/wshmain.c @@ -41,7 +41,10 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wshmain.c,v $ - * Revision 1.2 1996/03/08 16:47:06 adam + * 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 * Logs of changes. * * Revision 1.1 1996/02/29 15:36:34 adam @@ -95,7 +98,8 @@ void wshmain (int argc, char **argv, W_Interp_Type w_interp_type) gw_log_level (gw_log_mask_str ( gw_res_get (shRes, "log.level", "default"))); #endif - if (!(wcl = wproto_init (gw_res_get (shRes, "fifo.dir", "/tmp/egw")))) + if (!(wcl = wproto_init (gw_res_get (shRes, "fifo.dir", "/tmp/egw"), + *argv))) { gw_log (GW_LOG_FATAL, mod, "init"); exit(1); diff --git a/www/wtcl.c b/www/wtcl.c index 542c67d..c75f8a4 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.12 1996/03/07 12:45:34 adam + * 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 * New Tcl calls egw_enc/egw_dec to encode/decode binary URL info. * * Revision 1.11 1996/01/24 08:26:56 adam @@ -291,6 +294,14 @@ static int proc_dec (ClientData clientData, Tcl_Interp *interp, return TCL_OK; } +static int proc_prog (ClientData clientData, Tcl_Interp *interp, + int argc, char **argv) +{ + struct tcl_info *p = (struct tcl_info*) clientData; + + Tcl_AppendResult (p->interp, p->wcl->prog, NULL); + return TCL_OK; +} int Tcl_AppInit (Tcl_Interp *interp) { @@ -329,6 +340,7 @@ static void *do_create (WCLIENT wcl, void *args) Tcl_CreateCommand (p->interp, "egw_log", proc_wlog_invoke, p, NULL); Tcl_CreateCommand (p->interp, "egw_enc", proc_enc, p, NULL); Tcl_CreateCommand (p->interp, "egw_dec", proc_dec, p, NULL); + Tcl_CreateCommand (p->interp, "egw_prog", proc_prog, p, NULL); sprintf (tmp_str, "%d", wcl->id); Tcl_SetVar (p->interp, "sessionId", tmp_str, TCL_GLOBAL_ONLY); return p;