X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=blobdiff_plain;f=platform%2Fposix%2Ffunctions%2Fstdlib%2Fsystem.c;fp=platform%2Fexample_cygwin%2Ffunctions%2Fstdlib%2Fsystem.c;h=eb8db3dbd9022f6b80f39881289ed95e3c820d1f;hp=2e0079a449d942178badaedf8d98a285e842d95d;hb=a38d56a6a13dbb89022b5448d2d5247f3f99ea41;hpb=81f4c957d2f820d9340d90d5b650cbbed054caa0 diff --git a/platform/example_cygwin/functions/stdlib/system.c b/platform/posix/functions/stdlib/system.c similarity index 72% rename from platform/example_cygwin/functions/stdlib/system.c rename to platform/posix/functions/stdlib/system.c index 2e0079a..eb8db3d 100644 --- a/platform/example_cygwin/functions/stdlib/system.c +++ b/platform/posix/functions/stdlib/system.c @@ -40,7 +40,17 @@ int system( const char * string ) int main( void ) { + FILE * fh; + char buffer[25]; + buffer[24] = 'x'; + TESTCASE( ( fh = freopen( testfile, "wb+", stdout ) ) != NULL ); TESTCASE( system( SHELLCOMMAND ) ); + rewind( fh ); + TESTCASE( fread( buffer, 1, 24, fh ) == 24 ); + TESTCASE( memcmp( buffer, "SUCCESS testing system()", 24 ) == 0 ); + TESTCASE( buffer[24] == 'x' ); + TESTCASE( fclose( fh ) == 0 ); + TESTCASE( remove( testfile ) == 0 ); return TEST_RESULTS; }