-const char *argp_program_version = "Variations on Rockdodger " VERSION;
-const char *argp_program_bug_address = "<josh@qualdan.com>";
-static char doc[] = "Dodge the rocks until you die.";
-static struct argp_option opts[] = {
- {0, 0, 0, 0, "Gameplay Variations:"},
- {"bounciness", 'b', "N%", 0, "keep N% of speed when hitting edges (default 50%)"},
- {"game-speed", 'g', "N%", 0, "50-100% (default 100%)"},
- {"bad-physics", 'p', 0, 0, "bad physics (i.e. friction)"},
- {0, 0, 0, 0, "Look and Feel:"},
- {"engine", 'e', 0, 0, "Display large tail plume"},
- {"full-screen", 'f', 0, 0, ""},
- {"music", 'm', 0, 0, "Enable music"},
- {"silent", 's', 0, 0, "Turn off explosion sounds"},
- {0, 0, 0, 0, "Informational:", -1},
- {0}
-};
+static void
+show_help(void)
+{
+ puts("Dodge the rocks until you die.");
+ putchar('\n');
+ puts(" -f, --full-screen");
+ puts(" -s, --silent No explosion sounds or music");
+ puts(" -V, --version Print program version");
+ puts(" -?, --help Give this help list");
+ putchar('\n');
+ puts("Report bugs at http://jasonwoof.com/contact.html");
+}
+
+int
+short_opt(char c, char *arg)
+{
+ switch(c) {
+ case 'f': opt_fullscreen = 1; break;
+ case 's': opt_sound = 0; break;
+ case 'V':
+ printf("Variations on Rockdodger %s\n", PACKAGE_VERSION);
+ exit(0);
+ case '?':
+ case 'h': return 0;
+ case 'a': opt_autopilot = 1; break;
+ default:
+ fprintf(stderr, "unknown option -%c\n\n", c);
+ return 0;
+ }
+ return 1;
+}
+
+int
+parse_short_opts(const char *s, char *arg)
+{
+ while(s[1]) if(!short_opt(*s++, NULL)) return 0;
+ return short_opt(*s, arg);
+}
+
+static char *long_opts[] = { "full-screen", "silent", "version", "help", "autopilot" };