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

  1. Newsgroups: comp.infosystems.gopher
  2. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!math.nwu.edu!john
  3. From: john@math.nwu.edu (John Franks)
  4. Subject: Re: Anyway to pass args from user to shell script being exec'ed?
  5. Message-ID: <1993Jan22.140226.10778@news.acns.nwu.edu>
  6. Keywords: exec scripts args
  7. Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
  8. Nntp-Posting-Host: hopf.math.nwu.edu
  9. Reply-To: john@math.nwu.edu
  10. Organization: Dept of Math, Northwestern Univ
  11. References:  <ellis.727665624@nova>
  12. Date: Fri, 22 Jan 1993 14:02:26 GMT
  13. Lines: 43
  14.  
  15. In article <ellis.727665624@nova>, ellis@nova.gmi.edu (Stew Ellis) writes:
  16. > What I am trying to figure out now is whether I can run my own phone
  17. > directory program that was originally designed for shell command-line usage.
  18. > If called with only one non-switch arg, this C program looks only at the
  19. > lastname field, starting with the first position.
  20. > Something I read somewhere led me to believe that I could simply declare the
  21. > link to be type 7 and that the search arg would be passed to the script as
  22. > arg1.  This is not working for me.  Is there some way of accomplishing this?
  23. > Short of rewriting the C code for search and exec?
  24.  
  25. You can do what you want (sort of).  It must be done in two steps.  A type
  26. 7 item can only return a gopher menu item.  But the key idea is that that
  27. menu item can contain the search string.  Here's what you might do
  28.  
  29. Your phone book search script might look like
  30.  
  31. #!/bin/sh
  32. echo "0Matches for $1 <tab> exec:$1:/path/cprog <tab> gopherhost <tab> 70\r"
  33. echo ".\r"
  34.  
  35.  
  36. It's .cap file would be 
  37.  
  38.     Name=Phone Book
  39.     Type=7
  40.  
  41. When I did a search for Jones I would get back a menu with one item:
  42.  
  43. "Matches for Jones"
  44.  
  45. If I select that item then "cprog" is run with the argument "Jones" and 
  46. the results are returned as a text file.
  47.  
  48. This is about the only way to pass an argument to a program being execed.
  49.  
  50. -- 
  51.  
  52. John Franks     Dept of Math. Northwestern University
  53.         john@math.nwu.edu
  54.  
  55.