/* REXX Routines to Manipulate CGI input cottrell@slac.stanford.edu http://www.slac.stanford.edu/~cottrell.html/cottrell.html These routines are modelled on a set of Perl routines from S.E.Brenner@bioc.cam.ac.uk, with some additions suggested by "Gateway Programming I: ..." in "HTML and CGI Unleashed" by John December and Mark Ginsberg, published by Sams/Macmillan. For more information on Steve's functions, see: http://www.bio.cam.ac.uk/web/form.html http://www.seas.upenn.edu/~mengwong/forms/ For more information on "HTML and CGI Unleashed" see http://www.rpi.edu/~decemj/works/wdg.html This document and/or portions of the material and data furnished herewith, was developed under sponsorship of the U.S. Government. Neither the U.S. nor the U.S.D.O.E., nor the Leland Stanford Junior University, nor their employees, nor their respective contractors, subcontractors, or their employees, makes any warranty, express or implied, or assumes any liability or responsibility for accuracy, completeness or usefulness of any information, apparatus, product or process disclosed, or represents that its use will not infringe privately-owned rights. Mention of any product, its manufacturer, or suppliers shall not, nor is it intended to, imply approval, disapproval, or fitness for any particular use. The U.S. and the University at all times retain the right to use and disseminate same for any purpose whatsoever. Copyright (c) Stanford University 1995, 1996. Permission granted to use and modify this library so long as the copyright above is maintained, modifications are documented, and credit is given for any use of the library. The main functional differences of the REXX version to the Perl version are: *ReadParse is replaced by ReadForm which returns the results in a different fashion. ReadForm returns the results as a string, whereas ReadParse uses an associative variable. This difference is necessitated since REXX does not support returning associative (stem) variables from external functions. *PrintVariables takes as input a string rather than an asociative variable. This difference is driven by the expectation that it will be used with a string returned from ReadForm. */ #!/usr/local/bin/rxx /* The above line indicates that the code is a REXX script and where the REXX interpreter is to be found. This may be different at your site. Sample CGI Script in Uni-REXX, invoke from: http://www.slac.stanford.edu/cgi-wrap/finger?cottrell*/ Fail=PUTENV('REXXPATH=/afs/slac/www/slac/www/tool/cgi-rexx') /* The above line tells the REXX interpreter where to find the external REXX library functions, such as PrintHeader, HTMLTop, DeWeb and HTMLBot. */ SAY PrintHeader() /*Put out Content-type stuff*/ SAY '
' In=DeWeb(TRANSLATE(GETENV('QUERY_STRING'),' ','+')) /*Decode + signs to spaces and hex %XX to chars*/ SAY HTMLTop('Finger' In)''
Valid=' abcdefghijklmnopqrstuvwxyz'
Valid=Valid||'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Valid=Valid||'0123456789-_/.@'
V=VERIFY(In,Valid) /*Check input is valid*/
IF V\=0 THEN
SAY 'Bad char('SUBSTR(In,V,1)')in:"'In'"'
ELSE ADDRESS COMMAND '/usr/ucb/finger' In
SAY HTMLBot() /*Put out trailer boilerplate*/
EXIT
#!/usr/local/bin/rxx
/* Minimalist http form and script */
F=PUTENV("REXXPATH=/afs/slac/www/slac/www/tool/cgi-rexx")
SAY PrintHeader(); SAY ''
Input=ReadForm()
IF Input='' THEN DO /*Part 1*/
SAY HTMLTop('Minimal Form')
SAY '