Make getopt() use portable to Linux.

llvm-svn: 105922
This commit is contained in:
Eli Friedman 2010-06-13 19:18:49 +00:00
parent 932197d89c
commit adb3502477
2 changed files with 16 additions and 1 deletions

View File

@ -477,8 +477,12 @@ Args::ParseOptions (Options &options)
}
}
}
#ifdef __GLIBC__
optind = 0;
#else
optreset = 1;
optind = 1;
#endif
int val;
while (1)
{
@ -837,8 +841,12 @@ Args::ParseAliasOptions
}
}
#ifdef __GLIBC__
optind = 0;
#else
optreset = 1;
optind = 1;
#endif
int val;
while (1)
{
@ -974,8 +982,12 @@ Args::ParseArgsForCompletion
}
}
#ifdef __GLIBC__
optind = 0;
#else
optreset = 1;
optind = 1;
#endif
opterr = 0;
int val;

View File

@ -349,9 +349,12 @@ ParseOptions (Driver::OptionData &data, int argc, const char **argv)
}
// Prepare for & make calls to getopt_long.
#if __GLIBC__
optind = 0;
#else
optreset = 1;
optind = 1;
#endif
int val;
while (1)
{