Quoting <https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html>
"You don’t ordinarily need to copy the optarg string, since it is a pointer 
into the original argv array, not into a static area that might be 
overwritten." I think we should be safe here.

On April 7, 2025 3:12:50 PM GMT+02:00, "Csókás Bence" <[email protected]> 
wrote:
>Hi,
>
>On 2025. 04. 07. 12:08, Marc Kewitz wrote:
>> +    while ((optc = getopt_long(argc, argv, short_options, long_options, 
>> NULL)) != -1) {
>> +            switch (optc)
>> +            {
>> +            case 'i':
>> +                    ignore_environment = true;
>> +                    break;
>> +            case 'u':
>> +                    add_unset_var(optarg);
>
>Is it guaranteed that the memory pointed to by `optarg` will not change after 
>consecutive calls to `getopt*()`? I don't see it specified either way in the 
>man page.
>
>Bence
>
>_______________________________________________
>busybox mailing list
>[email protected]
>https://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to