xref: /titanic_50/usr/src/cmd/sendmail/libsm/rewind.c (revision 7c1d35456b77b833f089b886b99aa431a24e1377)
1 /*
2  * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3  *      All rights reserved.
4  * Copyright (c) 1990, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Chris Torek.
9  *
10  * By using this file, you agree to the terms and conditions set
11  * forth in the LICENSE file which can be found at the top level of
12  * the sendmail distribution.
13  */
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 #include <sm/gen.h>
18 SM_RCSID("@(#)$Id: rewind.c,v 1.16 2001/04/03 01:46:40 ca Exp $")
19 #include <errno.h>
20 #include <sm/io.h>
21 #include <sm/assert.h>
22 #include "local.h"
23 
24 /*
25 **  SM_IO_REWIND -- rewind the file
26 **
27 **	Seeks the file to the begining and clears any outstanding errors.
28 **
29 **	Parameters:
30 **		fp -- the flie pointer for rewind
31 **		timeout -- time to complete the rewind
32 **
33 **	Returns:
34 **		none.
35 */
36 
37 void
38 sm_io_rewind(fp, timeout)
39 	register SM_FILE_T *fp;
40 	int timeout;
41 {
42 	SM_REQUIRE_ISA(fp, SmFileMagic);
43 	(void) sm_io_seek(fp, timeout, 0L, SM_IO_SEEK_SET);
44 	(void) sm_io_clearerr(fp);
45 	errno = 0;      /* not required, but seems reasonable */
46 }
47