modify argc and argv
This commit is contained in:
parent
8701a5d7ca
commit
07fa58d397
@ -154,7 +154,7 @@ Options::parse(int& argc, char**& argv)
|
|||||||
{
|
{
|
||||||
int current = 1;
|
int current = 1;
|
||||||
|
|
||||||
std::set<int> consumed;
|
int nextKeep = 1;
|
||||||
|
|
||||||
while (current != argc)
|
while (current != argc)
|
||||||
{
|
{
|
||||||
@ -172,6 +172,8 @@ Options::parse(int& argc, char**& argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
argv[nextKeep] = argv[current];
|
||||||
|
++nextKeep;
|
||||||
}
|
}
|
||||||
//if we return from here then it was parsed successfully, so continue
|
//if we return from here then it was parsed successfully, so continue
|
||||||
}
|
}
|
||||||
@ -262,6 +264,8 @@ Options::parse(int& argc, char**& argv)
|
|||||||
|
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argc = nextKeep;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,6 +71,8 @@ int main(int argc, char* argv[])
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << argc << std::endl;
|
||||||
|
|
||||||
} catch (const cxxopts::OptionException& e)
|
} catch (const cxxopts::OptionException& e)
|
||||||
{
|
{
|
||||||
std::cout << "error parsing options: " << e.what() << std::endl;
|
std::cout << "error parsing options: " << e.what() << std::endl;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user