Annotation of capa/capa51/GUITools/webpage.c, revision 1.1.1.1

1.1       albertel    1: /*
                      2:  * quizzer.c
                      3:  * Copyright Guy Albertelli II 1996
                      4:  */
                      5: #include <stdio.h>
                      6: #include <tcl.h>
                      7: #include <stdlib.h>
                      8: #include <Capa/capaCommon.h>
                      9: #include <unistd.h>
                     10: #include <webpage.h>
                     11: #include "common.h"
                     12: 
                     13: extern Tcl_Interp *gInterp;
                     14: 
                     15: int Webpage_Init(Tcl_Interp *interp);
                     16: int main(int argc, char**argv)
                     17: {
                     18:   char * rDisplay,*q,filename[BUFFER_SIZE],buffer[BUFFER_SIZE];
                     19:   int  found=1;
                     20: 
                     21:   if (argc >1) {
                     22:     if (!strcmp(argv[1],"-emailcapaid")) { emailcapaid(argc,argv);return 0;}
                     23:     if (!strcmp(argv[1],"-getid")) { getid(argc,argv);return 0;}
                     24:   }
                     25: 
                     26:   gInterp=Tcl_CreateInterp();
                     27:   if (gInterp ==NULL)
                     28:   {
                     29:     fprintf(stderr,"Couldn't get a new Tcl Interp\n");
                     30:     return -1;
                     31:   }
                     32: 
                     33:   q = Tcl_Merge(argc-1, argv+1);
                     34:   Tcl_SetVar(gInterp, "argv", q, TCL_GLOBAL_ONLY);
                     35:   ckfree(q);
                     36:   sprintf(buffer, "%d", argc-1);
                     37:   Tcl_SetVar(gInterp, "argc", buffer, TCL_GLOBAL_ONLY);
                     38:   Tcl_SetVar(gInterp, "argv0", argv[0],TCL_GLOBAL_ONLY);
                     39:   Tcl_SetVar(gInterp, "tcl_interactive","0", TCL_GLOBAL_ONLY);
                     40: 
                     41:   if (Tcl_Init(gInterp) == TCL_ERROR) 
                     42:   {
                     43:     fprintf(stderr,"Tcl_Init error\n");
                     44:     fprintf(stderr,"%d\n",TCL_ERROR);
                     45:     fprintf(stderr,"%s\n",gInterp->result);
                     46:     return -4;
                     47:   }
                     48:   
                     49:   Webpage_Init(gInterp);
                     50: 
                     51:   sprintf(filename,"./webpage.tcl");
                     52:   if( capa_access(filename, F_OK) == -1 ) {
                     53:     found=0;
                     54:   }
                     55:   
                     56:   if( found ) {
                     57:     if (Tcl_EvalFile(gInterp, filename) != TCL_OK) 
                     58:     {
                     59:       fprintf(stderr,"%s\n",gInterp->result);
                     60:       return -6;
                     61:     }
                     62:     while(Tcl_DoOneEvent(TCL_ALL_EVENTS));
                     63:   } else {
                     64:     fprintf(stderr,"Unable to find webpage.tcl\n");
                     65:     exit(-7);
                     66:   }
                     67:   return 0;
                     68: }
                     69: 
                     70: 
                     71: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>