OPTIND
optind is an external integer used by the getopt family of functions to track parsing progress of command-line arguments. It is typically declared in POSIX headers such as unistd.h or getopt.h in GNU environments. The variable is initialized to 1, which corresponds to the first argument after the program name. Each call to getopt advances optind to point to the next argv element to be scanned.
During option parsing, optind serves as the index into the argv array. After all options have been
optarg and optopt are related: optarg points to the argument associated with the current option, and optopt
Usage notes and portability: If a program needs to parse argv more than once, optind can be
In summary, optind provides the index of the next command-line argument to be processed by getopt, initializes