-static struct option const long_options[] = {
- {"help", no_argument, NULL, 1},
- {NULL, 0, NULL, 0}
-};
-
-int main(int argc, char *argv[]) {
- program_name = argv[0];
- int r;
- int option_index = 0;
-
- while((r = getopt_long(argc, argv, "", long_options, &option_index)) != EOF) {
- switch(r) {
- case 0: /* long option */
- break;
-
- case '?': /* wrong options */
- usage();
- return 1;
-
- case 1: /* help */
- usage();
- return 0;
-
- default:
- break;
- }
- }