opt: wean off getopt_long, beef up tests.