OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [stdlib/] [getenv.c] - Diff between revs 39 and 56

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 39 Rev 56
Line 76... Line 76...
char *
char *
_DEFUN (_findenv, (name, offset),
_DEFUN (_findenv, (name, offset),
        register _CONST char *name _AND
        register _CONST char *name _AND
        int *offset)
        int *offset)
{
{
  register int len;
  return _findenv_r (_REENT, name, offset);
  register char **p;
 
  _CONST char *c;
 
 
 
  /* In some embedded systems, this does not get set.  This protects
 
     newlib from dereferencing a bad pointer.  */
 
  if (!environ)
 
    return NULL;
 
 
 
  c = name;
 
  len = 0;
 
  while (*c && *c != '=')
 
    {
 
      c++;
 
      len++;
 
    }
 
 
 
  for (p = environ; *p; ++p)
 
    if (!strncmp (*p, name, len))
 
      if (*(c = *p + len) == '=')
 
        {
 
          *offset = p - environ;
 
          return (char *) (++c);
 
        }
 
  return NULL;
 
}
}
 
 
/*
/*
 * getenv --
 * getenv --
 *      Returns ptr to value associated with name, if any, else NULL.
 *      Returns ptr to value associated with name, if any, else NULL.
Line 113... Line 89...
char *
char *
_DEFUN (getenv, (name),
_DEFUN (getenv, (name),
        _CONST char *name)
        _CONST char *name)
{
{
  int offset;
  int offset;
  char *_findenv ();
  char *_findenv_r ();
 
 
  return _findenv (name, &offset);
  return _findenv_r (_REENT, name, &offset);
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.