Skip to content

Commit

Permalink
windres: Accept the abbreviated form --include in addition to --inclu…
Browse files Browse the repository at this point in the history
…de-dir

As GNU binutils windres uses getopt for option parsing, it accepts
any unique abbreviation of the long options. For now just look
for this particular abbreviation instead of any potential one,
as there's at least one existing use in the wild of --include:

https://github.com/tcltk/tcl/blob/fe69f643609d633facf249c9c963ce121153a8ff/win/tcl.m4#L640
  • Loading branch information
mstorsjo committed Jan 5, 2020
1 parent 6513708 commit ee894b6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions wrappers/windres-wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ int _tmain(int argc, TCHAR* argv[]) {

#define IF_MATCH_EITHER(short, long) \
if (!_tcscmp(argv[i], _T(short)) || !_tcscmp(argv[i], _T(long)))
#define IF_MATCH_THREE(first, second, third) \
if (!_tcscmp(argv[i], _T(first)) || !_tcscmp(argv[i], _T(second)) || !_tcscmp(argv[i], _T(third)))
#define OPTION(short, long, var) \
if (_tcsstart(argv[i], _T(short)) && argv[i][_tcslen_const(_T(short))]) { \
var = argv[i] + _tcslen_const(_T(short)); \
Expand Down Expand Up @@ -203,9 +205,10 @@ int _tmain(int argc, TCHAR* argv[]) {
else OPTION("-J", "--input-format", input_format)
else OPTION("-O", "--output-format", output_format)
else OPTION("-F", "--target", bfd_target)
else IF_MATCH_EITHER("-I", "--include-dir") {
else IF_MATCH_THREE("-I", "--include-dir", "--include") {
SEPARATE_ARG(includes[nb_includes++]);
} else if (_tcsstart(argv[i], _T("--include-dir="))) {
} else if (_tcsstart(argv[i], _T("--include-dir=")) ||
_tcsstart(argv[i], _T("--include="))) {
includes[nb_includes++] = _tcschr(argv[i], '=') + 1;
} else if (_tcsstart(argv[i], _T("-I"))) {
includes[nb_includes++] = argv[i] + 2;
Expand Down

0 comments on commit ee894b6

Please sign in to comment.