]> pd.if.org Git - pdclib/blob - functions/stdio/rewind.c
rewind: Add _unlocked variation. Make rewind() actually take lock before touching...
[pdclib] / functions / stdio / rewind.c
1 /* $Id$ */
2
3 /* rewind( FILE * )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdio.h>
10
11 #ifndef REGTEST
12
13 void rewind_unlocked( struct _PDCLIB_file_t * stream )
14 {
15     stream->status &= ~ _PDCLIB_ERRORFLAG;
16     fseek_unlocked( stream, 0L, SEEK_SET );
17 }
18
19 void rewind( struct _PDCLIB_file_t * stream )
20 {
21     flockfile(stream);
22     rewind_unlocked(stream);
23     funlockfile(stream);
24 }
25
26 #endif
27
28 #ifdef TEST
29 #include <_PDCLIB_test.h>
30
31 int main( void )
32 {
33     /* Testing covered by ftell.c */
34     return TEST_RESULTS;
35 }
36
37 #endif