]> pd.if.org Git - pdclib.old/blobdiff - functions/stdio/rename.c
[gandr] s/__lp64__/__LP64__/ to match GCC define
[pdclib.old] / functions / stdio / rename.c
index 6b1e1b592f23bff2f62f2a6150c7e5c211cae75f..0ae5c6a62cfe5ebff97d9e47555c037431438674 100644 (file)
 
 #include <string.h>
 
-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 +46,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,7 +71,7 @@ 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 */
     TESTCASE( remove( testfile1 ) == 0 );
     TESTCASE( remove( testfile2 ) == 0 );