xref: /csrg-svn/lib/libc/stdio/rewind.c (revision 3163)
1*3163Stoy /* @(#)rewind.c	4.2 (Berkeley) 03/09/81 */
22030Swnj #include	<stdio.h>
32030Swnj 
42030Swnj rewind(iop)
52030Swnj register struct _iobuf *iop;
62030Swnj {
72030Swnj 	fflush(iop);
82030Swnj 	lseek(fileno(iop), 0L, 0);
92030Swnj 	iop->_cnt = 0;
102030Swnj 	iop->_ptr = iop->_base;
112030Swnj 	iop->_flag &= ~(_IOERR|_IOEOF);
12*3163Stoy 	if (iop->_flag & _IORW)
13*3163Stoy 		iop->_flag &= ~(_IOREAD|_IOWRT);
142030Swnj }
15