home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- *
- * This module presents example PowerWeb Server++ API Hook Functions.
- *
- * Implements the same functionality as the C-language TourPresentCSV API hook.
- *
- * The two implementations are plug-in replaceable, showing how a
- * customised extension can be rapidly prototyped in Rexx and then either
- * used as-is, or ported across to C for final production release.
- *
- * COPYRIGHT:
- * CompuSource (Pty) Ltd
- * Licensed Materials - Property of CompuSource (Pty) Ltd
- * (C) Copyright CompuSource (Pty) Ltd 1994, 1995.
- * All Rights Reserved
- * Use, duplication, or disclosure restricted by international
- * copyright law.
- *
- *******************************************************************************/
-
- Parse Arg parcel
-
- filename = ServerReadText(parcel, "Request:/Resource")
-
- html = ServerFind(parcel, "Request:/Result")
-
- call ServerAppendText html,, "<html><body><h2>Tabular View of " filename "</h2><table border=1>"
-
- /* open the file */
- call stream filename, 'C', 'open read'
-
- /* read the file line by line */
-
- do while lines(filename)
-
- record = linein(filename)
-
- call ServerAppendText html,, "<tr>"
-
- /* process each field, separated by commas */
-
- do while length(record) > 0
-
- parse var record field ',' record
-
- /* if field is enclosed in quotes, remove them */
-
- if substr(field,1,1) = '"' then do
- if substr(field, length(field), 1) = '"' then
- field = substr(field, 2, length(field)-2)
- end
-
- /* add the field to the table */
-
- call ServerAppendText html,, "<td>"field
- end
- end
-
- /* close the file */
- call stream filename, 'C', 'close'
-
- call ServerAppendText html,, "</table></body></html>"
-
- return "0"
-
-