X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2Frename.c;h=0c30b1e78cd9f8db37c1b2bc34e78e7c7175d872;hp=6b1e1b592f23bff2f62f2a6150c7e5c211cae75f;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=a7a8d2f1c85c2d7760d4d3479e90466cc3a81b04 diff --git a/functions/stdio/rename.c b/functions/stdio/rename.c index 6b1e1b5..0c30b1e 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). @@ -9,15 +7,15 @@ #include #ifndef REGTEST -#include <_PDCLIB_glue.h> +#include "_PDCLIB_glue.h" #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 ) ) @@ -33,7 +31,7 @@ int rename( const char * old, const char * new ) #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" #include @@ -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,7 +69,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 );