gnu-getopt: modernize and add test