Allow NULL as longindex parameter on getopt_long

This commit is contained in:
Bendeguz Pisch
2025-12-16 18:15:56 +01:00
parent 563be395f9
commit 89d7ed0120
+3 -1
View File
@@ -86,7 +86,9 @@ pub unsafe extern "C" fn getopt_long(
if unsafe { string::strncmp(current_arg, opt.name, end as size_t) == 0 } {
unsafe {
optind += 1;
*longindex = i as c_int;
if !longindex.is_null() {
*longindex = i as c_int;
}
}
if opt.has_arg == optional_argument {