Oh No, Not This Again!
#include <stdio.h> int main( void ) { printf( "Content-type: text/html\n\n" ); printf( "<HTML><HEAD><TITLE>Hello World</TITLE></HEAD>\n" ); printf( "<BODY><H1>Hello World</H1></BODY></HTML>\n" ); return 0; }
#!/usr/local/bin/perl print "Content-type: text/html\n\n"; print "<HTML><HEAD><TITLE>Hello World</TITLE></HEAD>\n"; print "<BODY><H1>Hello World</H1></BODY></HTML>\n"; exit 0;
Example Output
What Is There To Work With?
#include <stdio.h> #include <string.h> int main( argc, argv, envp ) int argc; char *argv[]; char *envp[]; { char *var; printf( "Content-type: text/html\n\n" ); printf( "<HTML><HEAD><TITLE>CGI Environmental Variables</TITLE></HEAD>\n" ); printf( "<BODY><H1>CGI Environmental Variables</H1>\n<P>\n" ); while( *envp != NULL ) { var = strchr( *envp, '=' ); *var++ = '\0'; printf( "%s=<B>%s</B><BR>\n", *envp++, var ); } printf( "</P>\n</BODY></HTML>" ); return 0; }
#!/usr/local/bin/perl sub PrintEnv { foreach $key ( sort keys %ENV ) { print "$key = <B>$ENV{$key}</B><BR>\n"; } } print "Content-type: text/html\n\n"; print "<HTML><HEAD><TITLE>CGI Environmental Variables</TITLE></HEAD>\n"; print "<BODY><H1>CGI Environmental Variables</H1>\n<P>\n"; &PrintEnv; print "</P>\n</BODY></HTML>"; exit( 0 );
Example Output
Last Modified: 17 February 1997
St. Louis Unix Users Group - Linux SIG