From 14c61dfea87e664c3c50f401961426bbec616944 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Mon, 21 Jan 1991 05:27:42 -0800 Subject: [PATCH] new stdio; renamed from rew.c SCCS-vsn: lib/libc/stdio/rewind.c 5.6 --- usr/src/lib/libc/stdio/rewind.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/usr/src/lib/libc/stdio/rewind.c b/usr/src/lib/libc/stdio/rewind.c index f98fd651ff..bb42ee5e40 100644 --- a/usr/src/lib/libc/stdio/rewind.c +++ b/usr/src/lib/libc/stdio/rewind.c @@ -1,28 +1,25 @@ -/* - * Copyright (c) 1987 Regents of the University of California. +/*- + * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * * %sccs.include.redist.c% */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rewind.c 5.5 (Berkeley) %G%"; +static char sccsid[] = "@(#)rewind.c 5.6 (Berkeley) %G%"; #endif /* LIBC_SCCS and not lint */ -#include -#include +#include #include -rewind(iop) - register FILE *iop; +void +rewind(fp) + register FILE *fp; { - off_t lseek(); - - (void)fflush(iop); - (void)lseek(fileno(iop), 0L, L_SET); - iop->_cnt = 0; - iop->_ptr = iop->_base; - iop->_flag &= ~(_IOERR|_IOEOF); - if (iop->_flag & _IORW) - iop->_flag &= ~(_IOREAD|_IOWRT); + (void) fseek(fp, 0L, SEEK_SET); + clearerr(fp); + errno = 0; /* not required, but seems reasonable */ } -- 2.20.1