1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38#if 0 39static char sccsid[] = "@(#)rewind.c 8.1 (Berkeley) 6/4/93"; 40#endif 41static const char rcsid[] = |
42 "$FreeBSD: head/lib/libc/stdio/rewind.c 82743 2001-09-01 15:28:24Z ache $"; |
43#endif /* LIBC_SCCS and not lint */ 44 45#include "namespace.h" 46#include <errno.h> 47#include <stdio.h> 48#include "un-namespace.h" 49#include "libc_private.h" 50#include "local.h" 51 52void 53rewind(FILE *fp) 54{ |
55 int serrno = errno; 56 |
57 /* make sure stdio is set up */ 58 if (!__sdidinit) 59 __sinit(); 60 61 FLOCKFILE(fp); |
62 if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) { |
63 clearerr_unlocked(fp); |
64 errno = serrno; 65 } |
66 FUNLOCKFILE(fp); |
67} |