HTML & CGI Unleashed



C-Based Scripting
By Michael D. Perry ( wisdom@wisdom.com)

Additional information, resources & examples from the book


Stay tuned as I add more links to relevant resources!

browser.c
Source Code Listing, Run Script.
    This is an example of a very simple c-based script which displays the name of the Browser being used. This program simply displays the contents of the environment variable http_user_agent.

guestbook.c
Source Code Listing, Run Script.
    This is an example of a very simple C-based Guest Book script

    Correction:
    There's a typo on line 172 of the guestbook.c program. The line in the book reads:

    printf("<P>Unable to read data from %s!<P>",outfile);
    It should read:
    printf("<P>Unable to read data from %s!<P>",infile);
    How'd that get in there?? In any case, this is a minor typo - not affecting the operation of the script, but will give you the wrong reference in the error message if you do not have the proper access to the necessary file.

    Remember, in order for this script to work, you'll need make sure the web server has appropriate access to modify the guests.html file. Here's an example of the Unix command to grant such priviledges:

    CHMOD o+r+w guests.html

Other routines used:
util.h
Source Code Listing.
html.h
Source Code Listing.
    These are some basic cgi routines used by the Guest Book script.


BACK || HOME || NEW || Louisiana || INDEX || SEARCH || FEEDBACK
Copyright © 1995, PCS /Mike Perry - All rights reserved worldwide
wisdom@wisdom.com

Visitors since 10-30-95: