utwatch.wbb - Interface With a Shared Directory CGI Request Process

Syntax

RUN "utwatch.wbb"

Description

This program continuously scans a directory for files that contain CGI requests. The request file, which must follow the name convention of "filename.in", will contain the name of a Business BASIC program to RUN, along with the environment and CGI data. The specified program is RUN and must use "utsend.wbb" for all its HTML output When it is finished, it must CALL "utexit.wbb" and RUN "utwatch.wbb".

Typically, this program runs from one or more background tasks. The more tasks, the more likely that CGI requests will be responded to quickly.

The global variable "$commdir" should be set to the name of the shared directory before utwatch.wbb is run. If it is not set, the current directory is used.

Normally, utwatch.wbb scans the shared directory completely and pauses for one second before scanning again. The number of seconds, from 0 to any value allowed by the WAIT directive, can be specified in the global variable "$waitsec".

The format of a request file is:

program-name

env-1=val-1

env-2=val-2

...

env-n=val-n

<blank line>

CGI standard input stream (with line-feed appended)

---EOF---

The first line is the Business BASIC program that utwatch.wbb should RUN. The next lines, up to a blank line, contain the environment variables and their values. Following the blank line is the CGI input stream that the CGI script received on its standard input handle, with a line feed appended to force an additional line. The last line is the text string "---EOF---".

The UNIX shell script bwu2.sh provides the interface mechanism for UNIX CGI requests.