Skip to content
Snippets Groups Projects
Commit f97f93c4 authored by Nagy Tibor's avatar Nagy Tibor
Browse files

Handle getopt reinitialization

parent 740f5773
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,12 @@ pub unsafe extern "C" fn getopt_long( ...@@ -30,6 +30,12 @@ pub unsafe extern "C" fn getopt_long(
// if optarg is not set, we still don't want the previous value leaking // if optarg is not set, we still don't want the previous value leaking
optarg = ptr::null_mut(); optarg = ptr::null_mut();
// handle reinitialization request
if optind == 0 {
optind = 1;
CURRENT_OPT = ptr::null_mut();
}
if CURRENT_OPT.is_null() || *CURRENT_OPT == 0 { if CURRENT_OPT.is_null() || *CURRENT_OPT == 0 {
if optind >= argc { if optind >= argc {
-1 -1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment