CMSC 740 - Computer Graphics
File: sample.c
/*-----------------------------------------------------------------------
This is the main file that defines all the globals and starts everything.
-------------------------------------------------------------------------*/
#include "sample.h"
void
main(int ac, char** av)
{
char filename[128];
init_display(ac, av);
#if 0
deal_with_options(ac,av, filename); /* set the filename */
input_dataset(filename); /* read in the dataset */
#endif
loop_display();
}
/*--------------------------------------------------------------------------
prints out the usage
----------------------------------------------------------------------------*/
void usage(char *prog_name)
{
fprintf(stderr,"usage: %s \n", prog_name);
exit(1);
}
/*----------------------------------------------------------------------------
deal_with_options intializes the various command line parameters mentioned above
-----------------------------------------------------------------------------*/
void deal_with_options(int ac, char **av, char* filename)
{
char *s;
int argumentOk=0;
char *prog_name;
prog_name = av[0];
while (--ac > 0 )
{
if ((*++av)[0]=='-'){
for (s = av[0]+1; *s; s++) switch (*s) {
case '?':
usage(prog_name);
break;
default:
break;
}; /*of switch */
} /* of if */
else {
sprintf((char *) filename, "%s", *av);
argumentOk+=1;
}
}
if (argumentOk!=1) usage(prog_name);
}
Web Accessibility