/* unpost.c by RJB CSUSB 1997 Program to rationalise content from CGI POST Purpose: This program reads in a number of characters fron stdin and outputs them with an EOF at the end. Usage... in a CGI script for a form with request method POST unpost $CONTENT_LENGTH | urlunencode | ... preprocesses the query handed to the CGI. Also see the urlunencode script in http://www.csci.csusb.edu/dick/tools/urlunencode */ /*#define DEBUG*/ #include #include #ifdef DEBUG #define db(f,x) fprintf(stderr," "#x" =<"#f">\n",x); #define dbs(x) fprintf(stderr,"%s\n",x); #else #define db(f,x) ; #define dbs(s) ; #endif void main(int argc, char * argv[]) { int ch,i,n; if(argc!=2){fprintf(stdout,"usage: unpost $CONTENT_LENGTH\n");exit(1);} /*else*/ n=abs(atoi(argv[1])); for(i=0; i