/*++ Copyright (c) 1994 Microsoft Corporation Module Name: cgimin.c Abstract: This module demonstrates a minimal CGI executable for HTTP server It mimics the action of BGI program w3min.dll Author: Murali R. Krishnan (MuraliK) 19-June-1995 Revision History: --*/ #include #include # include # define DEFAULT_LEN ( 256) int __cdecl main( int argc, char * argv[]) { char rgchMethod[DEFAULT_LEN]; char rgchQuery[DEFAULT_LEN]; char rgchPathInfo[DEFAULT_LEN]; char rgchXlatedPathInfo[DEFAULT_LEN]; DWORD dwLen; rgchMethod[0] = rgchQuery[0] = rgchPathInfo[0] = rgchXlatedPathInfo[0] = '\0'; dwLen = DEFAULT_LEN; dwLen = GetEnvironmentVariableA( PSZ_REQUEST_METHOD_A, rgchMethod, dwLen); if ( dwLen > DEFAULT_LEN) { fprintf( stderr, " Environment variable %s has value of length %d\n", PSZ_REQUEST_METHOD_A, dwLen); } dwLen = DEFAULT_LEN; dwLen = GetEnvironmentVariableA( PSZ_PATH_INFO_A, rgchPathInfo, dwLen); if ( dwLen > DEFAULT_LEN) { fprintf( stderr, " Environment variable %s has value of length %d\n", PSZ_PATH_INFO_A, dwLen); } dwLen = DEFAULT_LEN; dwLen = GetEnvironmentVariableA( PSZ_QUERY_STRING_A, rgchQuery, dwLen); if ( dwLen > DEFAULT_LEN) { fprintf( stderr, " Environment variable %s has value of length %d\n", PSZ_QUERY_STRING_A, dwLen); } dwLen = DEFAULT_LEN; dwLen = GetEnvironmentVariableA( PSZ_PATH_TRANSLATED_A, rgchXlatedPathInfo, dwLen); if ( dwLen > DEFAULT_LEN) { fprintf( stderr, " Environment variable %s has value of length %d\n", PSZ_PATH_TRANSLATED_A, dwLen); } printf( "Content-Type: text/html\r\n" "\r\n" "Minimal Server Extension Example\n" "

Minimal Server Extension Example (CGI)

\n" "

Method = %s\n" "

Query String = %s\n" "

Path Info = %s\n" "

Translated Path Info = %s\n" "

" "

" "

" "Enter your name:
" "" "", rgchMethod, rgchQuery, rgchPathInfo, rgchXlatedPathInfo); return (1); } // main() /************************* End Of File ************************/