Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2. FUNCTION
  3. <<_getenv_r>>---look up environment variable
  4.  
  5. INDEX
  6.         _getenv_r
  7. INDEX
  8.         environ
  9.  
  10. ANSI_SYNOPSIS
  11.         #include <stdlib.h>
  12.         char *_getenv_r(struct _reent *<[reent_ptr]>, const char *<[name]>);
  13.  
  14. TRAD_SYNOPSIS
  15.         #include <stdlib.h>
  16.         char *_getenv_r(<[reent_ptr]>, <[name]>)
  17.         struct _reent *<[reent_ptr]>;
  18.         char *<[name]>;
  19.  
  20. DESCRIPTION
  21. <<_getenv_r>> searches the list of environment variable names and values
  22. (using the global pointer ``<<char **environ>>'') for a variable whose
  23. name matches the string at <[name]>.  If a variable name matches,
  24. <<_getenv_r>> returns a pointer to the associated value.
  25.  
  26. RETURNS
  27. A pointer to the (string) value of the environment variable, or
  28. <<NULL>> if there is no such environment variable.
  29.  
  30. PORTABILITY
  31. <<_getenv_r>> is not ANSI; the rules for properly forming names of environment
  32. variables vary from one system to another.  This implementation does not
  33. permit '=' to be in identifiers.
  34.  
  35. <<_getenv_r>> requires a global pointer <<environ>>.
  36. */
  37.  
  38. /* This file may have been modified by DJ Delorie (Jan 1991).  If so,
  39. ** these modifications are Copyright (C) 1991 DJ Delorie.
  40. */
  41.  
  42. /*
  43.  * Copyright (c) 1987 Regents of the University of California.
  44.  * All rights reserved.
  45.  *
  46.  * Redistribution and use in source and binary forms are permitted
  47.  * provided that: (1) source distributions retain this entire copyright
  48.  * notice and comment, and (2) distributions including binaries display
  49.  * the following acknowledgement:  ``This product includes software
  50.  * developed by the University of California, Berkeley and its contributors''
  51.  * in the documentation or other materials provided with the distribution
  52.  * and in all advertising materials mentioning features or use of this
  53.  * software. Neither the name of the University nor the names of its
  54.  * contributors may be used to endorse or promote products derived
  55.  * from this software without specific prior written permission.
  56.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  57.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  58.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  59.  */
  60.  
  61. #include <stdlib.h>
  62. #include <stddef.h>
  63. #include <string.h>
  64. #include "envlock.h"
  65.  
  66. extern char **environ;
  67.  
  68. /* Only deal with a pointer to environ, to work around subtle bugs with shared
  69.    libraries and/or small data systems where the user declares his own
  70.    'environ'.  */
  71. static char ***p_environ = &environ;
  72.  
  73. /*
  74.  * _findenv --
  75.  *      Returns pointer to value associated with name, if any, else NULL.
  76.  *      Sets offset to be the offset of the name/value combination in the
  77.  *      environmental array, for use by setenv(3) and unsetenv(3).
  78.  *
  79.  *      This routine *should* be a static; don't use it.
  80.  */
  81.  
  82. char *
  83. _DEFUN (_findenv_r, (reent_ptr, name, offset),
  84.         struct _reent *reent_ptr   _AND
  85.         register _CONST char *name _AND
  86.         int *offset)
  87. {
  88.   return NULL;
  89. }
  90.  
  91. /*
  92.  * _getenv_r --
  93.  *      Returns ptr to value associated with name, if any, else NULL.
  94.  */
  95.  
  96. char *
  97. _DEFUN (_getenv_r, (reent_ptr, name),
  98.         struct _reent *reent_ptr _AND
  99.         _CONST char *name)
  100. {
  101.   int offset;
  102.  
  103.   return NULL;
  104. //  return _findenv_r (reent_ptr, name, &offset);
  105. }
  106.