]>
Commit | Line | Data |
---|---|---|
082e680b MNI |
1 | /* Copyright (C) 2004 Manuel Novoa III <[email protected]> |
2 | * | |
3 | * GNU Library General Public License (LGPL) version 2 or later. | |
4 | * | |
5 | * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. | |
6 | */ | |
7 | ||
8 | #include "_stdio.h" | |
9 | ||
10 | #ifdef __DO_LARGEFILE | |
11 | # ifndef __UCLIBC_HAS_LFS__ | |
12 | # error large file support is not enabled! | |
13 | # endif | |
14 | ||
15 | # define fsetpos fsetpos64 | |
16 | # define fpos_t fpos64_t | |
17 | # define fseek fseeko64 | |
18 | #endif | |
19 | ||
20 | int fsetpos(FILE *stream, register const fpos_t *pos) | |
21 | { | |
22 | #ifdef __STDIO_MBSTATE | |
23 | ||
24 | int retval = -1; | |
25 | __STDIO_AUTO_THREADLOCK_VAR; | |
26 | ||
27 | __STDIO_AUTO_THREADLOCK(stream); | |
28 | ||
29 | if ((retval = fseek(stream, pos->__pos, SEEK_SET)) == 0) { | |
30 | __COPY_MBSTATE(&(stream->__state), &(pos->__mbstate)); | |
31 | stream->__ungot_width[0]= pos->__mblen_pending; | |
32 | } | |
33 | ||
34 | __STDIO_AUTO_THREADUNLOCK(stream); | |
35 | ||
36 | return retval; | |
37 | ||
38 | #else | |
39 | ||
40 | return fseek(stream, pos->__pos, SEEK_SET); | |
41 | ||
42 | #endif | |
43 | } | |
44 |