home *** CD-ROM | disk | FTP | other *** search
- /* brady.c
- this produces a 3X3 matrix of images much like the opening
- if the brady bunch. All the names/urls/images match objects
- on a local machine at NYU and will have to be changed to customize.
-
- It is included not to be used as a stand=alone, but rather as
- some sample code to base other cgi apps on. To take a look at
- what this produces on my server, try this URL:
-
- http://found.cs.nyu.edu/cgi-bin/downing/brady
- */
-
- #include <stdio.h>
-
- #define LF 10
- #define TRUE 1
- #define FALSE 0
- #define PATH "http://found.cs.nyu.edu/MRL/faces/"
- #define RPATH "http://found.cs.nyu.edu"
-
-
- int main(void)
- {
-
- unsigned char rn;
- int people[]= {0,0,0,0,0,0,0,0,0};
- int index, list[8],assigned;
- char *names[]= {
- "allison",
- "ken",
- "richard",
- "robo",
- "dancer",
- "troy",
- "raj",
- "athomas",
- "fred"
- };
-
- char *reference[]= {
- "/nobody.html",
- "/play.a/perlin/public-html/index.html",
- "/robust.b/robots/rsw/public-html/index.html",
- "/robust.b/robots/rsw/public-html/robotics.html",
- "/MRL/proc_anim/animation.html",
- "/shaggy.a/downing/public-html/index.html",
- "/large.a/rajesh/public-html/index.html",
- "/large.a/athomas/public-html/index.html",
- "/cadman.a/robots/hansen/public-html/index.html"
- };
-
- char *position[]= {
- "TL",
- "TC",
- "TR",
- "CL",
- "CC",
- "CR",
- "BL",
- "BC",
- "BR"
- };
-
-
- printf("Content-type: text/html%c%c",LF,LF);
- srand(getpid());
-
- for(index=0;index <= 8;index++){
- assigned=FALSE;
- while(!assigned){
- rn = rand()%9;
- if(people[rn]==FALSE){
- list[index]=rn;
- people[rn]=TRUE;
- assigned=TRUE;
- }
- }
- }
- printf("<HTML><HEAD><META http-equiv=\"Refresh\" content=25>");
- printf("<title>MRL Faces</title>");
- printf("</HEAD>");
- printf("<h1>Faces at the MRL</h1><p><hr>%c",LF);
- printf("<PRE>");
- for(index=0;index <= 8; index++){
- printf("<a href=\"%s%s\"><img src=\"%s%s%s.gif\"></a> ",
- RPATH,reference[list[index]],PATH,names[list[index]],
- position[index]);
- if(((index-2)%3)==0)
- printf("<p>%c",LF);
- }
- printf("</PRE>");
- return(0);
- }
-