Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0'...