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