Handle both GNU/WIN32 and BSD getopt reinit

This allows all the tests to pass on systems that use the BSD version of getopt which uses optind = 1 and optreset to reinitialize getopt.