X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2F_PDCLIB_fileops.c;fp=platform%2Fexample%2Ffunctions%2F_PDCLIB%2F_PDCLIB_fileops.c;h=59ff45d522eb7a2e5c81d72fca149789f2105119;hb=af55dc64b9118345203e7ba7bd262e6444573795;hp=0000000000000000000000000000000000000000;hpb=77e0f19332a2b4e64d48ecb48557ea7aefa2cc61;p=pdclib.old diff --git a/platform/example/functions/_PDCLIB/_PDCLIB_fileops.c b/platform/example/functions/_PDCLIB/_PDCLIB_fileops.c new file mode 100644 index 0000000..59ff45d --- /dev/null +++ b/platform/example/functions/_PDCLIB/_PDCLIB_fileops.c @@ -0,0 +1,56 @@ +/* _PDCLIB_fileops + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#ifndef REGTEST +#include +#include +#include <_PDCLIB_glue.h> +#include + +static bool readf( _PDCLIB_fd_t self, void * buf, size_t length, + size_t * numBytesRead ) +{ + errno = ENOTSUP; + return false; +} + +static bool writef( _PDCLIB_fd_t self, const void * buf, size_t length, + size_t * numBytesWritten ) +{ + errno = ENOTSUP; + return false; +} +static bool seekf( _PDCLIB_fd_t self, int_fast64_t offset, int whence, + int_fast64_t* newPos ) +{ + errno = ENOTSUP; + return false; +} + +static void closef( _PDCLIB_fd_t self ) +{ + errno = ENOTSUP; +} + +const _PDCLIB_fileops_t _PDCLIB_fileops = { + .read = readf, + .write = writef, + .seek = seekf, + .close = closef, +}; + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + // Tested by stdio test cases + return TEST_RESULTS; +} + +#endif