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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [misc/] [getenv.c] - Blame information for rev 1775

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

Line No. Rev Author Line
1 199 simons
/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
2
 * This file is part of the Linux-8086 C library and is distributed
3
 * under the GNU Library General Public License.
4
 */
5
#include <string.h>
6
#include <stdlib.h>
7
#include <malloc.h>
8
 
9
extern char ** environ;
10
 
11
char *
12
getenv(var)
13
const char * var;
14
{
15
   char **p;
16
   int len;
17
 
18
   len = strlen(var);
19
 
20
   if (!environ)
21
      return 0;
22
 
23
   for(p=environ; *p; p++)
24
   {
25
      if( memcmp(var, *p, len) == 0 && (*p)[len] == '=' )
26
         return *p + len + 1;
27
   }
28
   return 0;
29
}
30
 
31
 

powered by: WebSVN 2.1.0

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