[previous] [next] [top] [search] [index]

Appendix B: Index File directives


This is a list of the items which may be placed in an index file to be processed by wndex. This file consists of a collection of records each of which consists of a group of lines pertaining to single file. Each line of a record begins with a directive like "Title=" which indicates that the remainder of that line is to be take as the title of the document whose record contains this line. There are three special directives that indicate the beginning of a new record. The most common of these is "File=" which is followed by the name of the file whose record will follow. The others, "Indexfile=", "Link=", and "Text=", are explained below.

The first record in an index file is special and is intended to describe attributes of the entire directory rather than individual files. It contains lines with directives specifying attributes of the directory as a whole or all the files in it. Here is a complete list of these directory directives:

Directory directives

Owner -- Specify owner of directory items
This should be a line like
     Owner=mailto:maintainer@host
     
The mailto:e-mail_address may be replaced with a URL referring to the indvidual who is responsible for the documents in this directory. This information is used in an HTTP header. It is not possible to designate the owner of a single file in an index directive. However, if the file is an HTML file this can be done with a "link" tag in the header of that document.

Accessfile -- Specify directory access control file
The line
     Accessfile=/dir/accessfile
     
specifies that the file /dir/accessfile is to be used to determine access priviliges (by hostname or IP address) for this directory. If this line is omitted access is allowed for everyone. The path /dir/accessfile is relative to the server root directory. If this path does not begin with a '/' then the path is relative to the directory containing the index file. (See the user's manual section: Limiting Access to Your Server.
Searchwrapper -- Set wrapper file for searches on this directory.
The line
     Searchwrapper=wrap.html
     
specifies that the HTML file wrap.html in the current directory should be used as a wrapper for the output of all searches on this directory.

Cache-Module -- Specify program to be used as interface to database for index.cache entries.
If this line specifies a program then instead of looking for file entries in the index.cache file this program is executed after putting the basename of the URL in the environment variable WN_KEY. This provides a mechanism to use a real database rather than the file index.cache. Note that the directory directives are still obtained from index.cache. The output of this module must be in the format of an index.cache line. Title, cache and grep searches are not not supported since that would require reading the entire database.

File-Module -- Specify program to be used as interface to database for obtaining files.
If this line specifies a program then instead of looking for a file in the current directory this program is executed after putting the basename of the URL in the environment variable WN_KEY. The output of this is served as if it were a file. This provides a mechanism to use a real database rather than the file index.cache.

Authorization-Module, Authorization-Realm, Authorization-Type -- Specify program to be used as for authorization module.
A future release will include a BASIC authorization module. In the meantime you can make your own. Data is placed in environment variables as with CGI. WN expects the first character of the return to be 't' if authorization is granted and something else if it is denied. This has only been lightly tested.

File directives

A collection of lines in the index file containing information about a single file in the directory of the index file is called a file record. A new file record begins with a line starting with File= or Indexfile= and ends with the start of a new file record or a line beginning with Text= to start an included text segment. Each line in a record begins with a file directive. Here is the complete list:
File -- File name
The line
     File=foo
     
begins a new file record for the file foo. It indicates that permission is granted for this file to be served. Other file directive lines will apply to this file until a new file record or text segment is started or the end of the index file is reached. The presence of this line causes an entry for this file to be written in the index.cache file created by wndex.

Indexfile -- Create an index.html file
This directive must (if it is used) be the start of the first file record in the index file. The line
     Indexfile=index.html
     
has the much the same effects as the entry "File=index.html" would, but additionally causes the wndex utility to create the file index.html containing (at least) a unordered list of anchors with links to all the files listed in the index file with a File= directive, a URL= directive, or a Link= directive. There should always be a Title= line associated with this item since wndex cannot both create index.html and read the title from it. The presence of the Indexfile=index.html line causes an entry for this file to be written in the index.cache file created by wndex. When the file index.html is created any previous file by that name is overwritten. It is not necessary to name the file "index.html."

Title -- Specify the title of a document or file
The line
     Title=This the the title
     
specifies the text "This is the title" as the title of the file. If the file is an HTML document this is not necessary as wndex will attempt to read the title from the document itself. If this line is supplied anyway it will override the title in the document. If this line is not supplied and the file is not an HTML document the default title "File " is used.

Link -- Enter an anchor in the index.html file
The line
     Link=/dir/foo
     

has no effect unless there is a previous Indexfile= line causing the creation of an index.html file. In this case this line causes the creation of a link to /dir/foo in the list of links in index.html. This directive has no effect on the index.cache file.

URL -- reference a remote URL
This directive is intended for links to items on other servers, even other types of servers. The lines
     URL=http://host/dir/foo.html
     Title=The file foo on server host
     

has the effect of putting an anchor to this item in index.html if the Indexfile= directive has been used and also putting the line

     url=http://host/dir/foo.html&title=The file foo on server host
     

in the current index.cache file. This is then used for title searches, so any query with a match will result in an anchor to the remote item in the list