mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibCore: Reset getopt's state when starting parse()
This way, a program can use ArgsParser multiple times, potentially with multiple different options.
This commit is contained in:
parent
ab2bb583a4
commit
16ba0b39f3
Notes:
sideshowbarker
2024-07-19 06:35:01 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/16ba0b39f3b Pull-request: https://github.com/SerenityOS/serenity/pull/2241 Reviewed-by: https://github.com/Dexesttp Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/bugaevc
1 changed files with 2 additions and 0 deletions
|
@ -49,6 +49,8 @@ void ArgsParser::parse(int argc, char** argv)
|
|||
|
||||
int index_of_found_long_option = -1;
|
||||
|
||||
optind = 0;
|
||||
|
||||
for (size_t i = 0; i < m_options.size(); i++) {
|
||||
auto& opt = m_options[i];
|
||||
if (opt.long_name) {
|
||||
|
|
Loading…
Reference in a new issue