X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2Fstdlib%2Fgetenv.c;h=f07481d3b48ae24157f85f33b4840c28d3ea5c10;hp=2a8b63466d913cac629e4e36c30919d33ce827b9;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=b08f4b52b1cd1f7a9553c0f357a7c90859fa3e73 diff --git a/platform/example/functions/stdlib/getenv.c b/platform/example/functions/stdlib/getenv.c index 2a8b634..f07481d 100644 --- a/platform/example/functions/stdlib/getenv.c +++ b/platform/example/functions/stdlib/getenv.c @@ -1,12 +1,10 @@ -/* $Id$ */ - /* getenv( const char * ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. */ -/* This is an example implementation of getenv() fit for use with POSIX kernels. +/* This is a stub implementation of getenv */ #include @@ -14,31 +12,18 @@ #ifndef REGTEST -extern char * * environ; - char * getenv( const char * name ) { - size_t len = strlen( name ); - size_t index = 0; - while ( environ[ index ] != NULL ) - { - if ( strncmp( environ[ index ], name, len ) == 0 ) - { - return environ[ index ] + len + 1; - } - index++; - } return NULL; } #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" int main( void ) { - TESTCASE( strcmp( getenv( "SHELL" ), "/bin/sh" ) == 0 ); return TEST_RESULTS; }