1*32735Sbostic /* 2*32735Sbostic * Copyright (c) 1987 Regents of the University of California. 3*32735Sbostic * All rights reserved. 4*32735Sbostic * 5*32735Sbostic * Redistribution and use in source and binary forms are permitted 6*32735Sbostic * provided that this notice is preserved and that due credit is given 7*32735Sbostic * to the University of California at Berkeley. The name of the University 8*32735Sbostic * may not be used to endorse or promote products derived from this 9*32735Sbostic * software without specific written prior permission. This software 10*32735Sbostic * is provided ``as is'' without express or implied warranty. 11*32735Sbostic */ 12*32735Sbostic 1326659Sdonn #if defined(LIBC_SCCS) && !defined(lint) 14*32735Sbostic static char sccsid[] = "@(#)rewind.c 5.3 (Berkeley) 12/02/87"; 15*32735Sbostic #endif /* LIBC_SCCS and not lint */ 1622144Smckusick 17*32735Sbostic #include <sys/types.h> 18*32735Sbostic #include <sys/file.h> 19*32735Sbostic #include <stdio.h> 202030Swnj 212030Swnj rewind(iop) 22*32735Sbostic register FILE *iop; 232030Swnj { 24*32735Sbostic off_t lseek(); 25*32735Sbostic 26*32735Sbostic (void)fflush(iop); 27*32735Sbostic (void)lseek(fileno(iop), 0L, L_SET); 282030Swnj iop->_cnt = 0; 292030Swnj iop->_ptr = iop->_base; 302030Swnj iop->_flag &= ~(_IOERR|_IOEOF); 313163Stoy if (iop->_flag & _IORW) 323163Stoy iop->_flag &= ~(_IOREAD|_IOWRT); 332030Swnj } 34