getopt, with LOTS of bugs