home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / infosyst / gopher / 2058 < prev    next >
Encoding:
Text File  |  1993-01-25  |  2.2 KB  |  76 lines

  1. Path: sparky!uunet!mcsun!uknet!yorkohm!nigelm
  2. From: nigelm@ohm.york.ac.uk (Nigel Metheringham)
  3. Newsgroups: comp.infosystems.gopher
  4. Subject: Re: Anyway to pass args from user to shell script being exec'ed?
  5. Message-ID: <1993Jan25.131234.11876@ohm.york.ac.uk>
  6. Date: 25 Jan 93 13:12:34 GMT
  7. References: <ellis.727665624@nova> <1jp7feINNhj6@zippy.telcom.arizona.edu>
  8. Organization: Electronics Department, University of York, UK
  9. Lines: 65
  10.  
  11. In <1jp7feINNhj6@zippy.telcom.arizona.edu> (Tim Conery) writes:
  12. >Gopher can pass arguments into shell scripts one of two ways that I know
  13. >about.
  14.  
  15. >One way is by providing the arguments in the cap file.
  16.  
  17. >Host=+
  18. >Port=+
  19. >Type=0
  20. >Path=exec:arguments to pass:script_name
  21. >Name=Whatever
  22.  
  23. >The second way is to use type 7 to query the user for the arguments.  This
  24. >works
  25. >fine, BUT The shell script should write out standard gopher directory
  26. >protocol.
  27.  
  28. You also need to modify your gopherd to accept more arguments in the
  29. search string field (by default 1.1/1.11 doesn't).  However this fix
  30. is trivial to put in - here's one I did, but it may need work when
  31. gopher+ turns up (no checking for additional fields after the
  32. arguments).
  33.  
  34.     Nigel.
  35.  
  36. Index: gopherd/gopherd.c
  37. --- gopher1.11b/gopherd/gopherd.c    Mon Jan 11 19:07:42 1993
  38. +++ gopher1.11b_x/gopherd/gopherd.c    Tue Jan 19 17:37:47 1993
  39. @@ -659,6 +659,10 @@
  40.       int length;        /* Length of the command line */
  41.       char logline[MAXLINE];
  42.       char *selstr;
  43. +#ifdef VARIABLE_EXEC
  44. +     char * more_args;
  45. +     char arg_list[MAXLINE];
  46. +#endif
  47.  
  48.       /*** Reopen the log file ***/
  49.  
  50. @@ -950,8 +954,20 @@
  51.             *command = '\0';
  52.             command++;
  53.             
  54. +#ifdef VARIABLE_EXEC
  55. +           more_args = strchr(command, '\t');
  56. +           if (more_args == NULL)
  57. +           EXECargs = args;
  58. +           else {
  59. +           *more_args++ = '\0';
  60. +           strcpy(arg_list, args);
  61. +           strcat(arg_list, " ");
  62. +           strcat(arg_list, more_args);
  63. +           EXECargs = arg_list;
  64. +           }
  65. +#else
  66.             EXECargs = args;
  67. -
  68. +#endif
  69.             printfile(sockfd, command, 0, -1);
  70.        }
  71.        break;
  72. -- 
  73. #   Nigel Metheringham  -- (NeXT) EMail: nigelm@ohm.york.ac.uk    #
  74. #   System Administrator, Electronics Dept, University of York    #
  75. #   York YO1 5DD. Phone: +44 904 432374, Fax: +44 904 432335      #
  76.