1 /* getenv( const char * )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
7 /* This is an example implementation of getenv() fit for use with POSIX kernels.
15 extern char * * environ;
17 char * getenv( const char * name )
19 size_t len = strlen( name );
21 while ( environ[ index ] != NULL )
23 if ( strncmp( environ[ index ], name, len ) == 0 )
25 return environ[ index ] + len + 1;
35 #include <_PDCLIB_test.h>
39 TESTCASE( strcmp( getenv( "SHELL" ), "/bin/bash" ) == 0 );
40 /* TESTCASE( strcmp( getenv( "SHELL" ), "/bin/sh" ) == 0 ); */