X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffopen.c;h=4cce8fa891f51aa9254522b9addcefdbd87ddda5;hb=e1c526e9bad3f6e69391e94059096145390508d3;hp=ff8e8e8a08862ea7679d54d3457d41531c3a7599;hpb=04ff9a4a124eaa87d5d26d90077fb4ed15f3277f;p=pdclib diff --git a/functions/stdio/fopen.c b/functions/stdio/fopen.c index ff8e8e8..4cce8fa 100644 --- a/functions/stdio/fopen.c +++ b/functions/stdio/fopen.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* fopen( const char *, const char * ) This file is part of the Public Domain C Library (PDCLib). @@ -10,11 +8,12 @@ #include #ifndef REGTEST +#include <_PDCLIB_io.h> #include <_PDCLIB_glue.h> #include #include -extern struct _PDCLIB_file_t * _PDCLIB_filelist; +extern FILE * _PDCLIB_filelist; FILE * fopen( const char * _PDCLIB_restrict filename, const char * _PDCLIB_restrict mode ) @@ -24,15 +23,16 @@ FILE * fopen( const char * _PDCLIB_restrict filename, if( imode == 0 || filename == NULL ) return NULL; - _PDCLIB_fd_t fd = _PDCLIB_open( filename, imode ); - if(fd == _PDCLIB_NOHANDLE) { + _PDCLIB_fd_t fd; + const _PDCLIB_fileops_t * ops; + if(!_PDCLIB_open( &fd, &ops, filename, imode )) { return NULL; } - FILE * f = _PDCLIB_fdopen( fd, imode, filename ); + FILE * f = _PDCLIB_fvopen( fd, ops, imode, filename ); if(!f) { int saveErrno = errno; - _PDCLIB_close( fd ); + ops->close(fd); errno = saveErrno; } return f;