Figured out what the problem was and it was related both to an undocumented requirement of how optional arguments work with long options and how I was handling optarg.