quisp: i/o

quick server pages
| Manual page for i/o(TDH)

## Input / output

With QUISP, any line that is not a directive or a comment is output directly.`` Hence, most template output is done without any kind of "print" statement.`` There are, however, several output-related directives for handling special situations:

## #+

As mentioned above, any line that is not a directive or a comment is output directly by QUISP.`` However, it is often desirable to indent code to express nest levels.`` Leading space is normally skipped over in HTML, so the indent is not really a concern there.`` But for other situations where the leading space will present a problem, the `#+` output directive is provided.`` All content following the `#+` (less one space) is written to standard output.``

Example: `#+ hello world`

## #write - #endwrite

Write text to file, such as to add an entry to a log.`` pathname should be a full pathname.`` filemode is either `w` to create, or `a` to append.`` text may be any number of lines, and other directives, such as #if , #for , #include and so on may be embedded to help generate the text.`` When the `#endwrite` is encountered, the file is closed.``

Usage: `#write` pathname`[`filemode]
..text..``
`#endwrite`

Hint: use `@PROJDIR` to represent the pathname of the project directory.``

Security concern: user-supplied values (such as CGI user variables) should not be used to build the pathname, unless proper measures are taken to detect and remove the `../` construct (used as a hack to see higher levels of the file system).``

Example: the following code will log page hits with date, time, name of page, and the HTTP info.``

     #set RH = $getenv(REMOTE_HOST)
     #set RF = $getenv(HTTP_REFERER)
     #call $setdatefmt(yyyy/mmm/dd)
     #set DATE = $todaysdate()
     #set TIME = $time()
     #write @PROJDIR/logs/usage_log a
     @DATE @TIME @rtn @RH @RF
     #endwrite

## #cat

Copy the contents of files to the standard output.`` No processing or interpretation is done to the contents.`` Suitable for text files or binary files.``

Security concern: user-supplied values (such as CGI user variables) should not be used to build filenames, unless proper measures are taken to detect and remove the `../` construct (used as a hack to see higher levels of the file system).``

Usage: `#cat` file1 [..fileN]

Example: `#cat /home/scg/img/banner.gif`
quick server pages
Copyright Steve Grubb

Markup created by unroff 1.0, `` `` June 01, 2005.