/* * Automatic /. Flame-Generator 11.7 * troll.cc -- Definitions to perform command-line option processing. * * GENERATED BY GENOPT -- CHANGES WILL BE LOST */ #include // eventually #include "troll.h" #include #include #include // or whatever contains basename(3) using std::string; namespace { // name of program; this is guessed and may need to be changed by you string argvzero; void print_usage(); void print_help(); void print_version(); } // end unnamed namespace bool whacko_microsquish_option = false; int whacko_portman_option = 85; bool whacko_unbalanced_view_of_technology_option = true; bool whacko_remindpreview_option = false; int whacko_process_options (int argc, char** argv) { argvzero = basename(argv[0]); // possibly a Bad Thing to do opterr = 0; int c; while ((c = getopt(argc, argv, "hvSp:ud")) != EOF) { switch (c) { case 'S': whacko_microsquish_option = !whacko_microsquish_option; break; case 'p': whacko_portman_option = atoi(optarg); break; case 'u': whacko_unbalanced_view_of_technology_option = !whacko_unbalanced_view_of_technology_option; whacko_remindpreview_option = !whacko_remindpreview_option; break; case 'd': whacko_remindpreview_option = !whacko_remindpreview_option; break; case '?': std::cerr << argvzero << ": Unrecognized or missing option \'" << static_cast(optopt) << "\'\n"; print_usage(); ::exit(1); break; /* NOTREACHED */ case 'h': print_help(); ::exit(0); break; /* NOTREACHED */ case 'v': print_version(); ::exit(0); break; /* NOTREACHED */ } } return optind; } namespace { // Indentation violated inside this namespace block void print_usage() { using std::cerr; cerr << "Usage: " << argvzero << " [-hv] " // assuming you want help/version, else delete/comment "[-S] [-p count] [-u] [-d] " << std::endl; } void print_help() { using std::cout; print_version(); print_usage(); // Lines with [default] can be removed entirely if you like cout << "Options:\n" << " -S Disables the automatic appending of Microsoft\n" " flames (duh, screw that).\n" " [default false]\n" " -p count Number of repetitions of sexist immature\n" " prepubescent remarks about popular actresses.\n" " [default 85]\n" " -u Blindly roast anybody who critiques Linux or\n" " praises parts of other OSes.\n" " [default true]\n" " -d Debug reminder to preview comments.\n" " [default false]\n" << std::endl; } void print_version() { std::cout << "Automatic /. Flame-Generator version 11.7" << std::endl; //std::cout << "v11.7" << std::endl; } } // end unnamed namespace