Support -v --help the same way as gcc does
This commit is contained in:
parent
ae14ef5426
commit
47363cbb97
2 changed files with 17 additions and 4 deletions
3
libtcc.c
3
libtcc.c
|
@ -1773,6 +1773,9 @@ reparse:
|
|||
|
||||
switch(popt->index) {
|
||||
case TCC_OPTION_HELP:
|
||||
if (s->verbose > 0)
|
||||
return OPT_VERBOSE_HELP;
|
||||
else
|
||||
return OPT_HELP;
|
||||
case TCC_OPTION_HELP2:
|
||||
return OPT_HELP2;
|
||||
|
|
18
tcc.c
18
tcc.c
|
@ -268,10 +268,20 @@ redo:
|
|||
opt = tcc_parse_args(s, &argc, &argv, 1);
|
||||
|
||||
if (n == 0) {
|
||||
if (opt == OPT_HELP)
|
||||
return fputs(help, stdout), 0;
|
||||
if (opt == OPT_HELP2)
|
||||
return fputs(help2, stdout), 0;
|
||||
if (opt == OPT_HELP) {
|
||||
fputs(help, stdout);
|
||||
return 0;
|
||||
}
|
||||
if (opt == OPT_HELP2) {
|
||||
fputs(help, stdout);
|
||||
return 0;
|
||||
}
|
||||
if (opt == OPT_VERBOSE_HELP) {
|
||||
/* simulate gcc -v --help */
|
||||
fputs(help, stdout);
|
||||
fputs(help2, stdout);
|
||||
return 0;
|
||||
}
|
||||
if (opt == OPT_M32 || opt == OPT_M64)
|
||||
tcc_tool_cross(s, argv, opt); /* never returns */
|
||||
if (s->verbose)
|
||||
|
|
Loading…
Reference in a new issue