This gives imcc a better help message, without being patronizing about the meanings of the options (because they're clear from the long option names). It also cleans up the option data structure in imcc and test_main by removing the unsightly NULLs that needn't be there.
Luke Index: test_main.c =================================================================== RCS file: /cvs/public/parrot/test_main.c,v retrieving revision 1.64 diff -u -r1.64 test_main.c --- test_main.c 18 May 2003 19:27:09 -0000 1.64 +++ test_main.c 31 May 2003 19:23:08 -0000 @@ -21,19 +21,19 @@ char *parseflags(Parrot_Interp interpreter, int *argc, char **argv[]); static struct longopt_opt_decl options[] = { - { 'b', 'b', 0, { "--bounds-checks", NULL } }, - { 'd', 'd', 0, { "--debugging", NULL } }, - { 'h', 'h', 0, { "--help", NULL } }, - { 'j', 'j', 0, { "--jit", NULL } }, - { 'p', 'p', 0, { "--profiling", NULL } }, - { 'P', 'P', 0, { "--predereferencing", NULL } }, - { 'S', 'S', 0, { "--switched_core", NULL } }, - { 'g', 'g', 0, { "--no-computed-goto", NULL } }, - { 't', 't', 0, { "--tracing", NULL } }, - { 'v', 'v', 0, { "--version", NULL } }, - { '.', '.', 0, { "--wait", NULL } }, - {'\0', 128, 0, { "--gc-debug", NULL } }, - {'\0', 0, 0, { NULL } } + { 'b', 'b', 0, { "--bounds-checks" } }, + { 'd', 'd', 0, { "--debugging" } }, + { 'h', 'h', 0, { "--help" } }, + { 'j', 'j', 0, { "--jit" } }, + { 'p', 'p', 0, { "--profiling" } }, + { 'P', 'P', 0, { "--predereferencing" } }, + { 'S', 'S', 0, { "--switched-core" } }, + { 'g', 'g', 0, { "--no-computed-goto" } }, + { 't', 't', 0, { "--tracing" } }, + { 'v', 'v', 0, { "--version" } }, + { '.', '.', 0, { "--wait" } }, + {'\0', 128, 0, { "--gc-debug" } }, + {'\0', 0, 0, { } } }; static void usage(void); Index: languages/imcc/main.c =================================================================== RCS file: /cvs/public/parrot/languages/imcc/main.c,v retrieving revision 1.24 diff -u -r1.24 main.c --- languages/imcc/main.c 28 May 2003 01:41:48 -0000 1.24 +++ languages/imcc/main.c 31 May 2003 19:23:09 -0000 @@ -26,24 +26,44 @@ static char optimizer_opt[20]; extern FILE *yyin; -static void usage(FILE *fp) +static void usage(FILE* fp) { - fprintf(fp, "imcc\t[-h|--help] [-V|--version] [-v|--verbose] " - "[-<parrot-switch>] \n" - "\t[-d|--debug [hexlevel]] [-y|--yydebug] [-a|--pasm]\n" - "\t[-c|--pbc] [-r|--run-pbc] [-O[012]]\n" - "\t[-o outfile] infile [arguments ...]\n"); - fprintf(fp, "\n\tlong options N/Y\n"); - fprintf(fp, "\n\ts. docs/running.pod for more.\n"); + fprintf(fp, + "imcc -[abcgGhjpPrStvVwy.] [-d FLAGS] [-o FILE] [-O level] <file>\n"); } - static void help(void) { - usage(stdout); - exit(0); + printf( + "imcc [Options] <file>\n" + " Options:\n" + " -h --help\n" + " -V --version\n" + " <VM options>\n" + " -b --bounds\n" + " -j --jit\n" + " -p --profile\n" + " -P --prederefrenced-core\n" + " -S --switched-core\n" + " -g --no-computed-goto\n" + " -t --tracing\n" + " -d --debug=HEXFLAGS\n" + " -w --warnings\n" + " -G --no-gc\n" + " --gc-debug\n" + " -. Read a keystroke before starting\n" + " <Compiler options>\n" + " -v --verbose\n" + " -o --output=FILE\n" + " -O --optimize=LEVEL\n" + " -a --pasm\n" + " -c --pbc\n" + " -r --run-pbc\n" + " -y --yydebug\n" + "see docs/running.pod for more\n"); } + static void imcc_version(void) { printf("imcc version " IMCC_VERSION "\n"); @@ -55,28 +75,28 @@ #define OPT_GC_DEBUG 128 static struct longopt_opt_decl options[] = { - { 'b', 'b', 0, { "--bounds", NULL } }, - { 'j', 'j', 0, { "--jit", NULL } }, - { 'p', 'p', 0, { "--profile", NULL } }, - { 'P', 'P', 0, { NULL } }, - { 'S', 'S', 0, { NULL } }, - { 'g', 'g', 0, { NULL } }, - { 't', 't', 0, { NULL } }, - { 'd', 'd', OPTION_required_FLAG, { "--debug", NULL } }, - { 'w', 'w', 0, { NULL } }, - { 'G', 'G', 0, { NULL } }, - { '.', '.', 0, { NULL } }, - { 'a', 'a', 0, { "--pasm", NULL } }, - { 'h', 'h', 0, { "--help", NULL } }, - { 'V', 'V', 0, { "--version", NULL } }, - { 'r', 'r', 0, { "--run-pbc", NULL } }, - { 'c', 'c', 0, { "--pbc", NULL } }, - { 'v', 'v', 0, { "--verbose", NULL } }, - { 'y', 'y', 0, { "--yydebug", NULL } }, - { 'o', 'o', OPTION_required_FLAG, { NULL } }, - { 'O', 'O', OPTION_required_FLAG, { NULL } }, - { OPT_GC_DEBUG, OPT_GC_DEBUG, 0, { "--gc-debug", NULL } }, - { 0, 0, 0, { NULL } } + { 'b', 'b', 0, { "--bounds" } }, + { 'j', 'j', 0, { "--jit" } }, + { 'p', 'p', 0, { "--profile" } }, + { 'P', 'P', 0, { "--prederefrenced-core" } }, + { 'S', 'S', 0, { "--switched-core" } }, + { 'g', 'g', 0, { "--no-computed-goto" } }, + { 't', 't', 0, { "--tracing" } }, + { 'd', 'd', OPTION_required_FLAG, { "--debug" } }, + { 'w', 'w', 0, { "--warnings" } }, + { 'G', 'G', 0, { "--no-gc" } }, + { '.', '.', 0, { } }, + { 'a', 'a', 0, { "--pasm" } }, + { 'h', 'h', 0, { "--help" } }, + { 'V', 'V', 0, { "--version" } }, + { 'r', 'r', 0, { "--run-pbc" } }, + { 'c', 'c', 0, { "--pbc" } }, + { 'v', 'v', 0, { "--verbose" } }, + { 'y', 'y', 0, { "--yydebug" } }, + { 'o', 'o', OPTION_required_FLAG, { "--output" } }, + { 'O', 'O', OPTION_required_FLAG, { "--optimize" } }, + { OPT_GC_DEBUG, '\0', 0, { "--gc-debug" } }, + { 0, 0, 0, { } } }; /* most stolen from test_main.c */