main.cpp: straighten the getopt/optind adjustment before openfiles