
Listing 2:  New getopt() Command Line Processing
================================================

while ((option = getopt (argc, argv, optstring)) != NONOPT) ||
       (optarg != NULL)) {
    switch (option) {
    case 'a': ...
    case 'b': ...
    ...
    case '?': ... error ...
    case NONOPT: ... process optarg ...
    default:  break ;
    }
}

