-->
Previous Table of Contents Next


Setting Up Your Gopher Directories

Gopher directories and files are quite simple to set up and follow standard naming conventions for the most part. Before you begin, though, you should know which documents and files are to be provided through Gopher to other users, and you should be able to write a short description of each. (If you don’t know the contents of a file, either read it or get the author to summarize the file for you.) For simplicity, let’s assume you will use only a single directory for all your Gopher documents.

Begin by changing to the top directory you use for your Gopher directories (which you may have to create if you haven’t already done so). This directory should not be where the Gopher source and configuration files are located, for convenience. Simply choose a useful name and create the directory. For example, to create the Gopher home directory /usr/gopher/data, issue a standard mkdir command:


mkdir /usr/gopher/data

Change into your Gopher directory and copy the files you want to make available into it. When you have done that, you can create a descriptive filename for each file (instead of the more obtuse filenames usually used) up to 80 characters long. For example, if you have a filename called q1.sales, you may want to rename it to Company_Sales_1887_Q1 to help users identify the contents a little more easily.

The process for providing better filenames is to first create a .cap directory under your Gopher main directory (such as /usr/gopher/data/.cap). For each file in the main directory, you want to create a file in the .cap directory with the same name, but with a name and number. For example, suppose you have a file called q1.sales in /usr/gopher/data. In /usr/gopher/data/.cap you would create a file with the same name, q1.sales, which has the following contents:


Name=Company Sales for the First Quarter, 1887

Numb=1

The Name entry can have spaces or other special symbols in it because it is echoed as a complete string. The Numb entry is for the location of the entry on your Gopher menu. For example, suppose you had the preceding entry and two other files, shown by using cat to display their contents:


$ cat q1.sales

Name=Company Sales for the First Quarter, 1887

Numb=1



$ cat q2.sales

Name=Company Sales for the Second Quarter, 1887

Numb=2



$cat q3.sales

Name=Company Sales for the Third Quarter, 1887

Numb=3

When these entries are displayed in a Gopher menu they look like this:


1. Company Sales for the First Quarter, 1887

2. Company Sales for the Second Quarter, 1887

3. Company Sales for the Third Quarter, 1887

The order of filenames in the .cap directory doesn’t matter, but you shouldn’t have the same Numb entry more than once.

An alternative to using the .cap directory approach (which allows for easy addition of new files) is to use a single master file for each document you are making available. This file goes in your Gopher top directory and is called .names. Here’s the .names file for the same three files just mentioned:


$ cd /usr/gopher/data

$ cat .names

# My Gopher main .names file



Path=./q1.sales

Name=Company Sales for the First Quarter, 1887

Numb=1



Path=./q2.sales

Name=Company Sales for the Second Quarter, 1887

Numb=2



Path=./q3.sales

Name=Company Sales for the Third Quarter, 1887

Numb=3

As you can see, this format contains the same information but adds the filename (which was not needed in .cap since the filenames were the same). One advantage to using a .names file is that you can reorder your menu entries much more easily because you only have one file to work with instead of several. Also, the .names file enables you to add an abstract describing the file. For example, you could have the following entry in a .names file:


Path=./gopher

Name=How to Set up A Gopher Service

Numb=16

Abstract=This document shows the steps you need to take to

set up a Gopher service.

You can get a little fancier with Gopher and have a menu item lead to another menu or to another machine entirely. This is done with links, controlled by a link file, which ends with .link. A .link file has five pieces of information in it, in the same format as this example:


Name=More Sales Info

Type=1

Port=70

Path=/usr/gopher/data/more_sales

Host=wizard.tpci.com

The Name entry is what a user sees on the Gopher menu and can be any type of description you want, regardless of what else is in the link file. The Type field has a number showing the type of document the file links to. The following are all valid numbers:

0 Text
1 Directory
2 CSO name server
7 Full text index
8 Telnet session
9 Binary
h HTML file
I Image file
M MIME file
s Sound file

These types are the same as the list shown earlier in this chapter for the types of files Gopher supports, although it’s a little shorter here.

The Port field is the port for a connection to a remote system (if that’s where the link leads), and the Path field is where the file is on the local or remote server. The Host field, not surprisingly, is the name of the host the file resides on. If you are setting up a link to another machine via FTP or WAIS, you need to specify the path to include the service name and any arguments. For example, if your Gopher menu leads users to a file on another machine through FTP, your link file may look like this:


Name=More Sales Info

Type=1

Port=+

Path=ftp:chatton.bigcat.com@/usr/gopher/cats

Host=+


Previous Table of Contents Next