]> pd.if.org Git - pdclib/blob - functions/stdio/_PDCLIB_seek.c
Cosmetic comment fixes.
[pdclib] / functions / stdio / _PDCLIB_seek.c
1 /* int64_t _PDCLIB_seek( FILE *, int64_t, int )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <stdio.h>
8 #include <stdint.h>
9 #include <errno.h>
10 #ifndef REGTEST
11 #include "_PDCLIB_io.h"
12
13 int_fast64_t _PDCLIB_seek( FILE * stream, 
14                            int_fast64_t offset, 
15                            int whence )
16 {
17     int_fast64_t newPos;
18     if(!stream->ops->seek(stream->handle, offset, whence, &newPos)) {
19         return EOF;
20     }
21
22     stream->ungetidx = 0;
23     stream->bufidx = 0;
24     stream->bufend = 0;
25     stream->pos.offset = newPos;
26     return newPos;
27 }
28
29 #endif
30
31 #ifdef TEST
32 #include "_PDCLIB_test.h"
33
34 int main( void )
35 {
36     /* Testing covered by ftell.c */
37     return TEST_RESULTS;
38 }
39
40 #endif
41