FreeBSD/contrib/gcclibs/libgomp/env.c
/* Parse an unsigned long environment varible.  Return true if one was
   present and it was successfully parsed.  */
Parse an unsigned long environment varible.  Return true if one was
present and it was successfully parsed.
Parse an unsigned long environment varible . Return true if one was present and it was successfully parsed .
static bool
parse_unsigned_long (const char *name, unsigned long *pvalue)
{
  char *env, *end;
  unsigned long value;
  env = getenv (name);
  if (env == NULL)
    return false;
  while (isspace ((unsigned char) *env))
    ++env;
  if (*env == '\0')
    goto invalid;
  errno = 0;
  value = strtoul (env, &end, 10);
  if (errno || (long) value <= 0)
    goto invalid;
  while (isspace ((unsigned char) *end))
    ++end;
  if (*end != '\0')
    goto invalid;
  *pvalue = value;
  return true;
 invalid:
  gomp_error ("Invalid value for environment variable %s", name);
  return false;
}
static bool parse_unsigned_long ( const char * name , unsigned long * pvalue ) { char * env , * end ; unsigned long value ; env = getenv ( name ) ; if ( env == NULL ) return false ; while ( isspace ( ( unsigned char ) * env ) ) ++ env ; if ( * env == ' \0 ' ) goto invalid ; errno = 0 ; value = strtoul ( env , & end , 10 ) ; if ( errno || ( long ) value <= 0 ) goto invalid ; while ( isspace ( ( unsigned char ) * end ) ) ++ end ; if ( * end != ' \0 ' ) goto invalid ; * pvalue = value ; return true ; invalid : gomp_error ( " " , name ) ; return false ; }
Parse an unsigned long environment varible.
Parse an unsigned long environment varible .