#include <stdio.h>
#ifndef REGTEST
-#include <_PDCLIB_glue.h>
+#include <_PDCLIB_io.h>
-int fsetpos( struct _PDCLIB_file_t * stream, const struct _PDCLIB_fpos_t * pos )
+int _PDCLIB_fsetpos_unlocked( FILE * stream,
+ const _PDCLIB_fpos_t * pos )
{
if ( stream->status & _PDCLIB_FWRITE )
{
{
return EOF;
}
- stream->pos.status = pos->status;
- /* TODO: Add mbstate. */
+ stream->pos.mbs = pos->mbs;
+
return 0;
}
+int fsetpos( FILE * stream,
+ const _PDCLIB_fpos_t * pos )
+{
+ _PDCLIB_flockfile( stream );
+ int res = _PDCLIB_fsetpos_unlocked( stream, pos );
+ _PDCLIB_funlockfile( stream );
+ return res;
+}
+
#endif
#ifdef TEST
int main( void )
{
- TESTCASE( NO_TESTDRIVER );
+ /* fsetpos() tested together with fsetpos(). */
return TEST_RESULTS;
}