1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> 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 #ifndef __DO_LARGEFILE 11 #define FSEEK fseek 12 #endif 13 libc_hidden_proto(FSEEK)14libc_hidden_proto(FSEEK) 15 16 int fsetpos(FILE *stream, register const fpos_t *pos) 17 { 18 #ifdef __STDIO_MBSTATE 19 20 int retval = -1; 21 __STDIO_AUTO_THREADLOCK_VAR; 22 23 __STDIO_AUTO_THREADLOCK(stream); 24 25 if ((retval = FSEEK(stream, pos->__pos, SEEK_SET)) == 0) { 26 __COPY_MBSTATE(&(stream->__state), &(pos->__mbstate)); 27 stream->__ungot_width[0]= pos->__mblen_pending; 28 } 29 30 __STDIO_AUTO_THREADUNLOCK(stream); 31 32 return retval; 33 34 #else 35 36 return FSEEK(stream, pos->__pos, SEEK_SET); 37 38 #endif 39 } 40