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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [newlib/] [libc/] [stdlib/] [getenv.c] - Blame information for rev 862

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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