Added more error checking to getopt_long()