Cygwin/MinGW getopt no longer seems to have optreset, so now would be the time to start using that implementation we stole from BSD.