** Start of listing of h3.c ** /* I haven't verified this, but I think I built h3-c.cgi like this: gcc h3.c cgis.o mv h3-c.cgi ~/Trash/ mv a.out h3-c.cgi */ #include #include #include /* Function prototype, see cgis.c: */ unsigned char *getval(unsigned char *); int main(void) { unsigned char *rmstr; unsigned char *qus; unsigned char *stmp; printf("Content-type: text/plain;charset=us-ascii\n\n"); printf("Working on new stuff...\n"); rmstr = getenv("REQUEST_METHOD"); if (rmstr == NULL) { printf("Request method returned NULL, why??\n"); return -1; } else { printf("The request method is: [%s]\n", rmstr); } if (strcmp(rmstr,"POST") == 0) { printf("*** POST method not yet implemented\n"); return -1; } else if (strcmp(rmstr,"GET") == 0) { qus = getenv("QUERY_STRING"); printf("The query string is: [%s]\n", qus); } else { printf("*** Unknown request method, neither GET nor POST\n"); return -1; } printf("* End of debug output.\n\n"); printf("Starting to use Peter Burden's form-contents decoder:\n"); stmp = getval((unsigned char *)("firstname")); printf("For key [firstname] the value is [%s].\n", stmp); stmp = getval((unsigned char *)("lastname")); printf("For key [lastname] the value is [%s].\n", stmp); stmp = getval((unsigned char *)("square root of 2")); printf("For key [square root of 2] the value is [%s].\n", stmp); return 0; } ** End of listing of h3.c ** Here is the directory entry for that source file: -rw------- 1 rem user 1430 Feb 28 2007 h3.c ^ Note user execute permission *not* needed for source files. That gets compiled to a.out, but then renamed to something.cgi so that it will be usable by remote users via CGI: -rwx------ 1 rem user 8402 Feb 28 2007 h3-c.cgi ^ Note user execute permission needed for all CGI programs. (because compiled-C is native machine code running directly on machine)