remove getopt call in configuration module, it changes the argv order. Fix configuration module bugs (command line arguments sometimes not properly processed

This commit is contained in:
frtabu
2017-10-01 19:19:36 +02:00
parent b5a36dd90c
commit d88b72498d
5 changed files with 26 additions and 17 deletions
+5 -5
View File
@@ -109,14 +109,14 @@ char *atoken;
uint32_t tmpflags=0;
int i;
/* first parse the command line to look for the -O option */
opterr=0;
while ((i = getopt(argc, argv, "O:h")) != -1) {
if ( i == 'O' ) {
cfgparam = optarg;
for (i = 0;i<argc;i++) {
if (strlen(argv[i]) < 2) continue;
if ( argv[i][1] == 'O' && i < (argc -1)) {
cfgparam = argv[i+1];
}
if ( i == 'h' ) {
if ( argv[i][1] == 'h' ) {
tmpflags = CONFIG_HELP;
}
}