** Start of listing of h1.c ** #include #include #include int main(void) { time_t t; struct tm* ptm; char* sTime; int slen; char* ip; char* path; printf("Content-type: text/plain\n\n"); t = time(NULL); ptm = localtime(&t); sTime = asctime(ptm); slen = strlen(sTime); sTime[slen-1] = sTime[slen]; /* Copy null byte to clobber newline. */ slen = strlen(sTime); printf("The time is %s in California.\n\n", sTime); ip = getenv("REMOTE_ADDR"); /* Compiler warning: assignment makes pointer from integer without a cast. Never warned stdlib missing */ printf("The IP number %s is where your client/browser is located.\n\n", ip); path = getenv("PATH"); /* Compiler warning as above. */ printf("The PATH is %s currently\n", path); printf("(the only environment variable common to both CGI and login)\n"); return 0; } ** End of listing of h1.c ** Here is the directory entry for that source file: -rw------- 1 rem user 862 Feb 14 2007 h1.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 5257 Feb 14 2007 h1-c.cgi ^ Note user execute permission needed for all CGI programs. (because compiled-C is native machine code run directly on machine)