Use 'getopt_long'

Clean up 'main' by using 'getopt_long' instead of writing the command
line argument parser from scratch.