#include <stdio.h>
#include <nnlib.h>
  
static int d = 12, y = 1992;
static char *m = "August";
static char *names[6] = {"2", "Stephanie", "Kukolich"};
static char initial = 'W';
static int phone[128] = {3, 617, 648, 8225};
static float weight = 8.1;
static float  lengths[3] =  {2.0, 20.125, 8.2};
static double pi = 3.14159265358;
static double constants[6] =  {5,  0,  1,  2,  0.414728, 6.022e23};
static int male = 0;
static ARG argtab[] =
{{"year", INT, &y, "birth year"},
   {"day", INT, &d, "day of month of birth", 1, 31},
   {"month", STRING, (int *)&m, "name of birth month"},
   {"name", STRING_LIST, (int *)names, "full name", 5},
   {"initial", CHAR, (int *)&initial,
      "initial of mother's maiden name"},
   {"phone", INT_LIST, phone, "phone number", 127},
   {"weight", FLOAT, (int *)&weight, "birth weight"},
   {"lengths", FLOAT_LIST, (int *)lengths,
      "length, head circumference, in inches", 2},
   {"male", BOOLEAN, &male, "default: female"},
   {"pi", DOUBLE, (int *)&pi,
      "favorite estimate of pi", 3, 4},
   {"constants", DOUBLE_LIST, (int *)constants,
      "up to 4 of your favorite constants", 4},
 };
#define TABSIZE (sizeof(argtab)/sizeof(ARG))
main(argc, argv)
     int argc;
     char **argv;
{
    int i,j;
    argc = nnargs(argc, argv, argtab, TABSIZE);
    /* the arguments in argtab have now been set to
       the values specified on the command line */
    if(male) printf("He is");
    else printf("She is");
    i = atoi(names[0]);
    j = 1;
    while(j <= i) printf(" %s",names[j++]);
    printf(", born on %s %d, %d.", m, d, y);
}
