+ int option_index, c, yes = 0;
+
+ /* Parse the command line. */
+ for (;;) {
+ c = getopt_long (argc, argv, options, long_options, &option_index);
+ if (c == -1) break;
+
+ switch (c) {
+ case 0: /* options which are long only */
+ if (strcmp (long_options[option_index].name, "timeout") == 0) {
+ if (sscanf (optarg, "%d", &watchdog_timeout) != 1) {
+ fprintf (stderr, "%s: invalid --timeout option\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+ } else if (strcmp (long_options[option_index].name, "yes") == 0) {
+ yes = 1;
+ } else {
+ fprintf (stderr, "%s: unknown long option: %s (%d)\n",
+ argv[0], long_options[option_index].name, option_index);
+ exit (EXIT_FAILURE);
+ }
+ break;
+
+ case HELP_OPTION:
+ usage (EXIT_SUCCESS);
+
+ default:
+ usage (EXIT_FAILURE);
+ }
+ }