optind should be 0 when reiterating the argument list.

Well, this is embarrassing.