X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Frename.c;h=ba4a75dfd20a3462d71a050e403a73d360e16c06;hb=e1c526e9bad3f6e69391e94059096145390508d3;hp=409005f933776055198186e34713cf6f1ab9bd3f;hpb=55cf35957bf8dec0a489ba758c02c83303a5eb50;p=pdclib diff --git a/functions/stdio/rename.c b/functions/stdio/rename.c index 409005f..ba4a75d 100644 --- a/functions/stdio/rename.c +++ b/functions/stdio/rename.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* rename( const char *, const char * ) This file is part of the Public Domain C Library (PDCLib). @@ -13,11 +11,11 @@ #include -extern struct _PDCLIB_file_t * _PDCLIB_filelist; +extern _PDCLIB_file_t * _PDCLIB_filelist; int rename( const char * old, const char * new ) { - struct _PDCLIB_file_t * current = _PDCLIB_filelist; + FILE * current = _PDCLIB_filelist; while ( current != NULL ) { if ( ( current->filename != NULL ) && ( strcmp( current->filename, old ) == 0 ) ) @@ -46,7 +44,7 @@ int main( void ) TESTCASE( fopen( testfile1, "r" ) == NULL ); TESTCASE( fopen( testfile2, "r" ) == NULL ); /* rename file 1 to file 2 - expected to fail */ - TESTCASE( rename( testfile1, testfile2 ) == -1 ); + TESTCASE( rename( testfile1, testfile2 ) != 0 ); /* create file 1 */ TESTCASE( ( file = fopen( testfile1, "w" ) ) != NULL ); TESTCASE( fputs( "x", file ) != EOF ); @@ -71,10 +69,10 @@ int main( void ) _PDCLIB_rename() itself. */ /* NOREG as glibc overwrites existing destination file. */ - TESTCASE_NOREG( rename( testfile1, testfile2 ) == -1 ); + TESTCASE_NOREG( rename( testfile1, testfile2 ) != 0 ); /* remove both files */ - remove( testfile1 ); - remove( testfile2 ); + TESTCASE( remove( testfile1 ) == 0 ); + TESTCASE( remove( testfile2 ) == 0 ); /* check that they're gone */ TESTCASE( fopen( testfile1, "r" ) == NULL ); TESTCASE( fopen( testfile2, "r" ) == NULL );