Make all bucket and overflow addresses unsigned
[unix-history] / usr / src / lib / libc / stdio / rewind.c
index bb66005..bb42ee5 100644 (file)
@@ -1,14 +1,25 @@
-/* @(#)rewind.c        4.2 (Berkeley) %G% */
-#include       <stdio.h>
+/*-
+ * 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%
+ */
 
 
-rewind(iop)
-register struct _iobuf *iop;
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)rewind.c   5.6 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
+
+#include <errno.h>
+#include <stdio.h>
+
+void
+rewind(fp)
+       register FILE *fp;
 {
 {
-       fflush(iop);
-       lseek(fileno(iop), 0L, 0);
-       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 */
 }
 }