Add sanity checks for command line argument handling

Coverity 1075221.

Normally getopt_long should cover this case, but can't hurt to
add in some extra checks.