/***************************************************** * * main.c * * Test program for the argument processing package. * *****************************************************/ #include #include "args.h" /* * The following three variables are the locations * where the argument values will be stored. */ int n = 0; float f = 0.0; char* s = ""; /* * The array args is the argument table for the test * program. It contains one argument of each type, * and the two flag prefixes */ Arg args[] = { "-n", ARG_INT, &n, "+f", ARG_FLOAT, &f, "-s", ARG_STRING, &s, 0, 0, 0 }; /* * The main program calls process_arguments and displays * the values of the arguments on the command line */ int main(int argc, char* argv[]) { char** files; int i; files = process_arguments(args, argc, argv); printf("n: %d\n", n); printf("f: %f\n", f); printf("s: %s\n", s); printf("files:\n"); i = 0; while(files[i] != 0) { printf(" %s\n", files[i++]); } return 0; }