/* CGI_TOOLS version 0.5, october 20, 2002. Copyright (c) 2002 Pieter Suurmond. Demonstrates the use of CGI_receive(), nothing else! (The UPLOAD project demonstates most other files in this directory, espacially all these _auth_ files. */ #include #include #include "CGI_receive.h" #include "CGI_receivePrint.h" /*-------------*/ void uploadForm() { printf("\n\
\n", getenv("SCRIPT_NAME")); printf("\n\ \ \ \ \ \ \ \
variable:
file to upload:
\
\
\n"); } /*--------------------------------------------------------------------------------------*/ main () { int e; CGI_INPUT* in; printf("%s 200 OK\n\ Server: %s\n\ Pragma: no-cache\n\ Content-type: text/html\n", getenv("SERVER_PROTOCOL"), /* Output begin of complete header. */ getenv("SERVER_SOFTWARE")); /* You may append more headerlines. */ /* Following \n terminates header. */ printf("\n\ \n\ \n\ nph-CGI_receiveExample.cgi\n\ \n\ \n\
");
    
    e = CGI_receive(&in, 65536, 8);                 /* Object, max_bytes, max_pairs. */
    if (e < 0)
        printf("ERROR: receive_CGI_INPUT() = %d!\n", e);
    else
        {
        printf("OK: receive_CGI_INPUT() = %d\n", e);
        CGI_receivePrint(in);                       /* Also safe when argument is NULL. */
        CGI_release(&in);                           /* DON'T FORGET THIS! (Also safe.)  */
        }

    printf("\
\n"); uploadForm(); printf("\ \n"); exit(0); /* UNIX likes this! */ } /* Due to a problem with the webserver, which refuses to serve a file that's called "nph-CGI_receiveExample.cgi.c", this file was renamed to "nph-CGI_receiveExample_cgi.c". This renaming is however not done in the .tar.gz distribution of the UPLOAD project. */