History

Support -v --help the same way as gcc does

Christian Jullien committed 6 years ago

Commit 47363cb1 parent ae14ef52 files · +17 −4Browse files

Unified · Split

2 files
  1. libtcc.c +3 −0
  2. tcc.c +14 −4
libtcc.c+3−0
@@ -1773,6 +1773,9 @@ reparse: · 1772 unmodified lines
17731773
17741774 switch(popt->index) {
17751775 case TCC_OPTION_HELP:
1776+ if (s->verbose > 0)
1777+ return OPT_VERBOSE_HELP;
1778+ else
17761779 return OPT_HELP;
17771780 case TCC_OPTION_HELP2:
17781781 return OPT_HELP2;
tcc.c+14−4
@@ -268,10 +268,20 @@ redo: · 267 unmodified lines
268268 opt = tcc_parse_args(s, &argc, &argv, 1);
269269
270270 if (n == 0) {
271− if (opt == OPT_HELP)
272− return fputs(help, stdout), 0;
273− if (opt == OPT_HELP2)
274− return fputs(help2, stdout), 0;
271+ if (opt == OPT_HELP) {
272+ fputs(help, stdout);
273+ return 0;
274+ }
275+ if (opt == OPT_HELP2) {
276+ fputs(help, stdout);
277+ return 0;
278+ }
279+ if (opt == OPT_VERBOSE_HELP) {
280+ /* simulate gcc -v --help */
281+ fputs(help, stdout);
282+ fputs(help2, stdout);
283+ return 0;
284+ }
275285 if (opt == OPT_M32 || opt == OPT_M64)
276286 tcc_tool_cross(s, argv, opt); /* never returns */
277287 if (s->verbose)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t