
How to get search.html Working
==============================

search.html is a forms interface to sk, a CGI script written in C,
which carries out the actual search over the document.

sk.c can be found in the 'src' directory in the curl release, and
should be compiled like so:

  $ gcc -o sk sk.c

It can also be compiled with cc.

sk should be placed in the CGI scripts directory on the local machine.
Although there needs to be a separate copy of search.html in each WWW
document processed by curl, only a single copy of sk is required in the
CGI scripts directory.

The copy of search.html needs to be customised in three places:

  <FORM method="POST" action="URL-of-sk">

  <INPUT type="hidden" name="path" value="UNIX-path-to-directory">

  <INPUT type="hidden" name="upath" value="URL-of-directory">

sk's URL must be placed in the action field of the
form, while the two value fields must be adjusted to
refer to the directory holding this copy of search.html.


For instance, the URL of sk on my machine is:

  http://www.cs.mu.oz.au/cgi-bin/sk

The UNIX path to the directory holding the newsletter example of
section 4 of the user manual is:

  /home/staff/ad/www_public/curl/example

The URL of that directory is:

  http://www.cs.mu.oz.au/~ad/curl/example

Thus, the relevant fields of search.html for the newsletter example
are:

  <FORM method="POST"
             action="http://www.cs.mu.oz.au/cgi-bin/sk">

  <INPUT type="hidden" name="path"
             value="/home/staff/ad/www_public/curl/example">

  <INPUT type="hidden" name="upath"
             value="http://www.cs.mu.oz.au/~ad/curl/example">


sk uses the UNIX utility fgrep with two options: -i to ignore
case, and -c to return matching line counts only. In
addition, it utilises some slightly unusual C headers, namely
fcntl.h, sys/types.h, sys/stat.h and dirent.h.

