windres: Accept the abbreviated form --include in addition to --include-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
This commit is contained in:
Martin Storsjö committed 2020-01-05 22:09:31 +02:00
1 parent 6513708aff
commit ee894b6f63
1 file changed
+5 -2
+5 -2
View File
@@ -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)); \
@@ -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;