getopt: update optarg and optind correctly on missing argument