Make sure the getopt variables are correctly initialized for any option parsing.

Added a new "--port-offset PORT" option to lldb-platform so it can be used with USB mux type scenarios.

llvm-svn: 195486
This commit is contained in:
Greg Clayton
2013-11-22 18:55:04 +00:00
parent 2b98c56996
commit d4724cfdb1
4 changed files with 64 additions and 5 deletions

View File

@@ -878,6 +878,14 @@ main (int argc, char *argv[])
}
// NULL terminate the short option string.
short_options[short_options_idx++] = '\0';
#if __GLIBC__
optind = 0;
#else
optreset = 1;
optind = 1;
#endif
while ((ch = getopt_long_only(argc, argv, short_options, g_long_options, &long_option_index)) != -1)
{
DNBLogDebug("option: ch == %c (0x%2.2x) --%s%c%s\n",