Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gophfilt(1) [debian man page]

GOPHFILT(1)						      General Commands Manual						       GOPHFILT(1)

NAME
gophfilt - oneshot connection to gopher document server SYNOPSIS
gophfilt [-t type] [-p path] [-h host] [-s port] [-i item] DESCRIPTION
The gophfilt program is a oneshot command line driven version of a gopher client, suitable for use in shell- or awk-scripts. The Internet Gopher is a distributed document delivery service. It allows a neophyte user to access various types of data residing on mul- tiple hosts in a seamless fashion. This is accomplished by presenting the user a hierarchical arrangement of documents and by using a client-server communications model. The Internet Gopher Server accepts simple queries, and responds by sending the client a document. Gophfilt can operate in either of two modes. The first one is in the spirit of unix filters, in that it accepts requests on stdin and writes results to stdout. The request is in the form of a tab-delimited .cache item. For example: 1Master Gopher at UMN 1/ gopher.tc.umn.edu 70 (Or in string notation) "1Master Gopher at UMN 1/ gopher.tc.umn.edu 70 " This example would result in the retrieval of the root directory from the Master Gopher. Gophfilt's other mode permits the construction of a gopher request from arguments provided on the command line. In this "manual" mode, at least the path and type items must be provided. The default host and port are taken from the file conf.h at module build time. -p specifies the path to the requested data. From our "filter" example above, the field "1/" is the path. -t specifies the type of the requested data. From our example above, the leading "1" character is the type (directory, in this case). -h specifies the name of the host where the server is to be found. The default host (CLIENT1_HOST from file conf.h) is used if not pro- vided. -s specifies the service (port) that the server is monitoring. The default port (CLIENT1_PORT from file conf.h) is used if not provided. -i specifies a search item. This field immediately follows the path field in the transmitted request. -T specifies a receiver timeout in seconds. This is the maximum time that gophfilt will wait for more data. If the "timeout" return value is noticed by the calling program, any data received to that point should be considered suspect. To recreate using manual operation the request from our example, one would execute the following command. gophfilt -t 1 -p 1/ -h gopher.tc.umn.edu -s 70 MORE EXAMPLES
Here is an example that demonstrates the usefulness of the gophfilt. This specific example only works on the Rutgers campus, but illus- trates the point gophfilt -t 0 -p "webster default SPELL" -i flatulence -h hangout.rutgers.edu -s 770 | gophfilt This example requests a selector item from the Webster's Dictionary, and then pipes that item to gophfilt for subsequent retrieval of the actual definition. The result is available on stdout for use. RETURNS
Gophfilt returns the following completion codes on exit: 0 Successful completion. -1 Error in parsing command line arguments. -2 Manual operation and insufficient parameters were provided. -3 Piped operation and unable to read selector from stdin. -4 Unsupported item type requested. -5 Unable to connect to specified host and port combination. -6 Error encountered writing to stdout. -7 Timeout occurred while waiting for more data. GOPHFILT(1)

Check Out this Related Man Page

GOPHER_PARSEDIR(3)							 1							GOPHER_PARSEDIR(3)

gopher_parsedir - Translate a gopher formatted directory entry into an associative array.

SYNOPSIS
array gopher_parsedir (string $dirent) DESCRIPTION
gopher_parsedir(3) parses a gopher formatted directory entry into an associative array. While gopher returns text/plain documents for actual document requests. A request to a directory (such as /) will return specially encoded series of lines with each line being one directory entry or information line. PARAMETERS
o $dirent - The directory entry. RETURN VALUES
Returns an associative array whose components are: o type - One of the GOPHER_XXX constants. o title - The name of the resource. o path - The path of the resource. o host - The domain name of the host that has this document (or directory). o port - The port at which to connect on host. Upon failure, the additional data entry of the returned array will hold the parsed line. EXAMPLES
Example #1 Hypothetical output from gopher://gopher.example.com/ 0All about my gopher site. /allabout.txt gopher.example.com 70 9A picture of my cat. /pics/cat.png gopher.example.com 70 1A collection of my writings. /stories gopher.example.com 70 hThe HTTP version of this site. URL:http://www.example.com gopher.example.com 70 1Mirror of this site in Spain. / gopher.ejemplo.co.es 70 iWelcome to my gopher site. error.host 1 iPlease select one of the options above error.host 1 iSend complaints to /dev/null error.host 1 iLong live gopher! error.host 1 In the example above, the root directory at gopher.example.com knows about one DOCUMENT identified by 0 located at gopher://gopher.exam- ple.com:70/allabout.txt. It also knows about two other directory (which have their own listing files) at gopher://gopher.exmaple.com:70/stories and at gopher://gopher.ejemplo.co.es:70/. In addition there is a binary file, a link to an HTTP url, and several informative lines. By passing each line of the directory listing into gopher_parsedir(3), an associative array is formed containing a parsed out version of the data. Example #2 Using gopher_parsedir(3) <?php $directory = file("gopher://gopher.example.com"); foreach($directory as $dirent) { print_r(gopher_parsedir($dirent)); } ?> The above example will output: Array ( [type] => 0 [title] => All about my gopher site. [path] => /allabout.txt [host] => gopher.example.com [port] => 70 ) Array ( [type] => 9 [title] => A picture of my cat. [path] => /pics/cat.png [host] => gopher.example.com [port] => 70 ) Array ( [type] => 1 [title] => A collection of my writings. [path] => /stories [host] => gopher.example.com [port] => 70 ) Array ( [type] => 254 [title] => The HTTP version of this site. [path] => URL:http://www.example.com [host] => gopher.example.com [port] => 70 ) Array ( [type] => 1 [title] => Mirror of this site in Spain. [path] => / [host] => gopher.ejemplo.co.es [port] => 70 ) Array ( [type] => 255 [title] => Welcome to my gopher site. [path] => [host] => error.host [port] => 1 ) Array ( [type] => 255 [title] => Please select one of the options above. [path] => [host] => error.host [port] => 1 ) Array ( [type] => 255 [title] => Send complaints to /dev/null [path] => [host] => error.host [port] => 1 ) Array ( [type] => 255 [title] => Long live gopher! [path] => [host] => error.host [port] => 1 ) PHP Documentation Group GOPHER_PARSEDIR(3)
Man Page