X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2Fstdlib%2Fsystem.c;h=2cf7534b2faf99671408ab044ac56dcb399fe630;hb=a38d56a6a13dbb89022b5448d2d5247f3f99ea41;hp=fb3c40685da55e10c0d832efe6d1228f3f6c99ad;hpb=e814d98512182702c60ba26236b14774e8ee88cc;p=pdclib.old diff --git a/platform/example/functions/stdlib/system.c b/platform/example/functions/stdlib/system.c index fb3c406..2cf7534 100644 --- a/platform/example/functions/stdlib/system.c +++ b/platform/example/functions/stdlib/system.c @@ -8,40 +8,19 @@ #include -/* This is an example implementation of system() fit for use with POSIX kernels. +/* This is a stub implementation of getenv */ -#include -#include - int system( const char * string ) { - char const * const argv[] = { "sh", "-c", (char const * const)string, NULL }; - if ( string != NULL ) - { - int pid = fork(); - if ( pid == 0 ) - { - execve( "/bin/sh", (char * * const)argv, NULL ); - } - else if ( pid > 0 ) - { - while( wait( NULL ) != pid ); - } - } return -1; } #ifdef TEST -/* TODO: Work around the following undef */ -#undef SEEK_SET #include <_PDCLIB_test.h> -#define SHELLCOMMAND "echo 'SUCCESS testing system()'" - int main( void ) { - TESTCASE( system( SHELLCOMMAND ) ); return TEST_RESULTS; }