iTP Secure WebServer System Administrator's Guide (iTPWebSvr 5.1+)

Using Common Gateway Interface (CGI) Programs
iTP Secure WebServer System Administrators Guide522659-001
8-30
CGI Library
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 may
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 may 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.
CGI_puts() This procedure writes a string to the CGI output stream. It operates
in the same way as its Posix equivalent.
Table 8-6. CGI Procedures (page 2 of 3)
Procedure Description