home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!yorkohm!nigelm
- From: nigelm@ohm.york.ac.uk (Nigel Metheringham)
- Newsgroups: comp.infosystems.gopher
- Subject: Re: Anyway to pass args from user to shell script being exec'ed?
- Message-ID: <1993Jan25.131234.11876@ohm.york.ac.uk>
- Date: 25 Jan 93 13:12:34 GMT
- References: <ellis.727665624@nova> <1jp7feINNhj6@zippy.telcom.arizona.edu>
- Organization: Electronics Department, University of York, UK
- Lines: 65
-
- In <1jp7feINNhj6@zippy.telcom.arizona.edu> (Tim Conery) writes:
- >Gopher can pass arguments into shell scripts one of two ways that I know
- >about.
-
- >One way is by providing the arguments in the cap file.
-
- >Host=+
- >Port=+
- >Type=0
- >Path=exec:arguments to pass:script_name
- >Name=Whatever
-
- >The second way is to use type 7 to query the user for the arguments. This
- >works
- >fine, BUT The shell script should write out standard gopher directory
- >protocol.
-
- You also need to modify your gopherd to accept more arguments in the
- search string field (by default 1.1/1.11 doesn't). However this fix
- is trivial to put in - here's one I did, but it may need work when
- gopher+ turns up (no checking for additional fields after the
- arguments).
-
- Nigel.
-
- Index: gopherd/gopherd.c
- --- gopher1.11b/gopherd/gopherd.c Mon Jan 11 19:07:42 1993
- +++ gopher1.11b_x/gopherd/gopherd.c Tue Jan 19 17:37:47 1993
- @@ -659,6 +659,10 @@
- int length; /* Length of the command line */
- char logline[MAXLINE];
- char *selstr;
- +#ifdef VARIABLE_EXEC
- + char * more_args;
- + char arg_list[MAXLINE];
- +#endif
-
- /*** Reopen the log file ***/
-
- @@ -950,8 +954,20 @@
- *command = '\0';
- command++;
-
- +#ifdef VARIABLE_EXEC
- + more_args = strchr(command, '\t');
- + if (more_args == NULL)
- + EXECargs = args;
- + else {
- + *more_args++ = '\0';
- + strcpy(arg_list, args);
- + strcat(arg_list, " ");
- + strcat(arg_list, more_args);
- + EXECargs = arg_list;
- + }
- +#else
- EXECargs = args;
- -
- +#endif
- printfile(sockfd, command, 0, -1);
- }
- break;
- --
- # Nigel Metheringham -- (NeXT) EMail: nigelm@ohm.york.ac.uk #
- # System Administrator, Electronics Dept, University of York #
- # York YO1 5DD. Phone: +44 904 432374, Fax: +44 904 432335 #
-