summaryrefslogtreecommitdiff
path: root/libc/misc/getenv.c
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1996-03-24 21:25:23 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:29:54 +0200
commitdcc973ea3e31710429858c99d4f040334ac67c06 (patch)
tree8883b902eb18eba489957b7f03caa491fd7992a7 /libc/misc/getenv.c
parentfe22c37817ce338fbbc90b239320248c270957fa (diff)
downloaddev86-dcc973ea3e31710429858c99d4f040334ac67c06.tar.gz
Import Dev86-0.0.5.tar.gzv0.0.5
Diffstat (limited to 'libc/misc/getenv.c')
-rw-r--r--libc/misc/getenv.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libc/misc/getenv.c b/libc/misc/getenv.c
new file mode 100644
index 0000000..45d072e
--- /dev/null
+++ b/libc/misc/getenv.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+ * This file is part of the Linux-8086 C library and is distributed
+ * under the GNU Library General Public License.
+ */
+
+extern char ** environ;
+
+char *
+getenv(name)
+char * name;
+{
+ register int l;
+ register char ** ep = environ;
+ l = strlen(name);
+
+ if( ep == 0 || l == 0 ) return 0;
+
+ while(*ep)
+ {
+ if( **ep == *name && memcmp(name, *ep, l) == 0 && (*ep)[l] == '=' )
+ return *ep+l+1;
+ ep++;
+ }
+ return 0;
+}
+