FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
January 01, 2002

Writing CGI Scripts in REXX (Web Techniques, May 1996)

(Page 14 of 23)

Writing CGI Scripts in REXX, Listing 2 (Web Techniques, May 1996)

Web Techniques Magazine

May 1996

Volume 1, Issue 2





Writing CGI Scripts in REXX



Listing Two

ReadPost: PROCEDURE; PARSE ARG StdinFile

/******************************************** */

/*Read HTML FORM POST input (if any) from */

/*standard input. Note that if the caller */

/*provides a filename then we save the input */

/*in case we need to send it to another */

/*script. If so we can restore the stdin for */

/*the called command by using the command: */

/*ADDRESS UNIX script '<' StdinF. */

/*A good way to get a unique filename to save */

/*the standard input in, is to use the process*/

/*id. For example: */

/* StdinFile='/tmp/stdin'_GETPID() */

/* Post=ReadPost(StdinFile) */

/*_GETPID() provides the process ID in UniREXX*/

/*ReadPost returns the POST input if the */

/*REQUEST_METHOD="POST" else it returns null. */

/*N.b. the returned Post input does NOT have */

/*plus signs (+) converted to spaces or hex */

/* ASCII %XX encodings converted to characters*/

/******************************************** */

In=''

IF GETENV('REQUEST_METHOD')="POST" THEN DO

In=CHARIN(,1,GETENV('CONTENT_LENGTH'))

IF In='' THEN DO

SAY '400: Null input from POST!'; EXIT

END

IF StdinFile/='' THEN DO

IF CHAROUT(StdinFile,In,1) /=0 THEN DO

SAY '500: Unable to write out all POST chars!'

EXIT

END

Fail=CHAROUT(StdinFile) /*Close the file*/

END

END

RETURN In



( back )


Copyright Web Techniques. All rights reserved.

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK