/* Since this function gets called with the 'nextarg' pointer from within the getparameter a lot, we must check it for NULL before accessing the str data.  */
static ParameterError str2double(double *val, const char *str, long max)
/* Since this function gets called with the 'nextarg' pointer from within the getparameter a lot, we must check it for NULL before accessing the str data.  */
static ParameterError str2double(double *val, const char *str, long max)
{
  if(str) {
    char *endptr;
    double num;
    errno = 0;
    num = strtod(str, &endptr);
    if(errno == ERANGE)
      return PARAM_NUMBER_TOO_LARGE;
    if(num > max) {
      return PARAM_NUMBER_TOO_LARGE;
    }
    if((endptr != str) && (endptr == str + strlen(str))) {
      *val = num;
      return PARAM_OK;
    }
  }
  return PARAM_BAD_NUMERIC;
}