Finally, help output for qfprogs.

Nothing great, but better than nothing.
This commit is contained in:
Bill Currie 2010-12-24 17:33:57 +09:00
parent ce64227a71
commit d6b3d4891a

View file

@ -96,6 +96,7 @@ static const struct option long_options[] = {
{"fields", no_argument, 0, 'f'}, {"fields", no_argument, 0, 'f'},
{"functions", no_argument, 0, 'F'}, {"functions", no_argument, 0, 'F'},
{"globals", no_argument, 0, 'g'}, {"globals", no_argument, 0, 'g'},
{"help", no_argument, 0, 'h'},
{"lines", no_argument, 0, 'l'}, {"lines", no_argument, 0, 'l'},
{"modules", no_argument, 0, 'M'}, {"modules", no_argument, 0, 'M'},
{"numeric", no_argument, 0, 'n'}, {"numeric", no_argument, 0, 'n'},
@ -107,17 +108,18 @@ static const struct option long_options[] = {
}; };
static const char *short_options = static const char *short_options =
"d" "d" // disassemble
"F" "F" // functions
"f" "f" // fields
"g" "g" // globals
"l" "h" // help
"M" "l" // lines
"n" "M" // modules
"P:" "n" // numeric
"r" "P:" // path
"s" "r" // relocs
"v" "s" // strings
"v" // verbose
; ;
static edict_t *edicts; static edict_t *edicts;
@ -133,6 +135,28 @@ static const char *source_path = "";
static hashtab_t *func_tab; static hashtab_t *func_tab;
static void __attribute__((noreturn))
usage (int status)
{
printf ("%s - QuakeForge progs utility\n", "qfprogs");
printf ("Usage: %s [options] [files]\n", "qfprogs");
printf (
" -d, --disassemble Dump code disassembly.\n"
" -F, --fields Dump entity fields.\n"
" -f, --functions Dump functions.\n"
" -g, --globals Dump global variables.\n"
" -h, --help Display this help and exit\n"
" -l, --lines Dump line number information.\n"
" -M, --modules Dump Objective-QuakeC data.\n"
" -n, --numeric Sort globals by address.\n"
" -P, --path DIR Source path.\n"
" -r, --relocs Dump reloc information.\n"
" -s, --strings Dump static strings.\n"
" -v, --verbose Display more output than usual.\n"
);
exit (status);
}
static QFile * static QFile *
open_file (const char *path, int *len) open_file (const char *path, int *len)
{ {
@ -516,6 +540,8 @@ main (int argc, char **argv)
case 'g': case 'g':
func = &operations[1]; func = &operations[1];
break; break;
case 'h':
usage (0);
case 's': case 's':
func = &operations[2]; func = &operations[2];
break; break;
@ -544,7 +570,7 @@ main (int argc, char **argv)
sorted = 1; sorted = 1;
break; break;
default: default:
return 1; usage (1);
} }
} }
init_qf (); init_qf ();