Go to the previous, next section.

Database Builder

@everyfooting Author: rootd // Editor: ensley // Texinfo: rootd @| @| 3 December 1994

The database builder checks the INSTALLDIR/lslr directory for files, builds the database with those files, and then deletes the files in the lslr directory.

Invocation

Using the cshell, you can manually run the database builder with the following command:

makedb INSTALLDIR/lslr/*

This will automatically expand to be every file in the directory.

What it does

The database builder looks through the ls -lR file and puts the information in the appropriate database files. For each ls -lR file four new files will be created (or written over) in the four database directories: index, nocaseindex, data, and direc.

There are two types of lines in ls -lR files for which we have to produce output: lines indicating directories, and lines indicating files.

We maintain a directory counter, which starts at zero and counts the directory we are on.

We maintain a directory name string, which starts as "/" and always contains the current directory. We initialize the direc file by printing "/\n"

We can identify a line in an ls -lR as a directory if it has one field and ends with a ":" In this case we do the following things:

  1. Increment the directory counter.
  2. Set the directory name string to be the new name.
  3. Add the directory name to the direc file

We can identify a file line because it has nine fields. In this case we do the following:

  1. Add the filename to the index file
  2. Convert the filename to lowercase and add it to the nocaseindex file
  3. Add the data to the data file (see database format chapter).

Note that every time you print a line of data to one of these files, you must terminate the line with a newline.

Prototype example

Here is some sample perl code from our prototype which shows what is happeing. Note that the prototype calls the data file the info file, and that the prototype does not have a nocaseindex file.

Whenever you see and X, replace it with an underscore (the underscore is causing problems with our texinfo output--we haven't successfully fixed it yet).

Go to the previous, next section.