working around limitations in posix.getopt()