How does get_range() handle errors, like input ofget_range will return a negative value which caused it to break out of
64-60
or 64-N
or 64-
?
the while loop on the next iteration. I've added a check of the
get_range return value to break immediately. See snippet. If get_options is called with a bad range, 64-N,65
returns and empty array.
63,64-N
returns an array with just 63.
if (res == 3) {
int range_nums;
range_nums = get_range((char **)&str, ints + i);
+ if ( range_nums < 0)
+ break;
/* Decrement the result by one to leave out the
last number in the range. The next iteration
will handle the upper number in the range */
i += (range_nums - 1);
}
Derek