iTP Secure WebServer System Administrator's Guide (Version 7.0)
Using Common Gateway Interface (CGI) Programs
iTP Secure WebServer System Administrator’s Guide—523346-012
8-31
CGI Library
CGI_printf() This procedure is analogous to the printf() procedure in the C
library, with one exception: output is passed back to the CGI client
program through the Pathway CGI interface rather than to the
stdout file descriptor.
The maximum size of the write buffer (including expansion of
elements such as integers) is 32000 bytes. If the printf string
exceeds this size, the application terminates with an error
message.
CGI_fread() This procedure is analogous to the fread() procedure in the C
library with the following exceptions:
Data is read from the Pathway CGI interface rather than from
stdin, and stdin is the only file descriptor that this procedure might
be called with.
CGI_fwrite() This procedure is analogous to the write() procedure with the
following exceptions: stdout is the only file descriptor that works
with this procedure, and data is written to the Pathway CGI
interface rather than to stdout.
CGI_fflush() This procedure immediately writes buffered data from a CGI
program to a specified stream. If the stream specified is stdout or
stderr, this procedure immediately writes any buffered data to the
httpd process and restarts the fflush timer.
CGI_set_fflush_timer() This procedure specifies the interval at which stdout (really
$RECEIVE simulating stdout) is flushed. To change a flush interval
set by a call to CGI_set_fflush_timer(), the program must call
CGI_set_fflush_timer() with seconds set to 0 (zero), and then call
CGI_set_fflush_timer() with a nonzero value to set the new flush
interval.
A call to this procedure supersedes the value of the
TANDEM_CGI_SET_FFLUSH_TIMER in the server configuration.
The flush timer uses an signal handling routine that catches a
SIGALARM signal. When the alarm signal is delivered to a
process, it can interrupt long I/O operations, and cause an error. In
this case, the errno variable is set to 4004 (interrupted system
call). If you want your server to perform its own SIGALARM
processing, set this value to 0.
Only a single alarm signal can be in effect for a process. If you
need to implement a customized alarm function and still use the
fflush timer, write an alarm signal handler that calls CGI_fflush()
when appropriate.
CGI_getc() This procedure gets a character from the CGI input stream. It is
the same as the Posix function getc(), but returns the next byte
from the CGI input stream specified and moves the file pointer, if
defined, ahead 1 byte in the stream.
Table 8-6. CGI Procedures (page 2 of 3)
Procedure Description