rewind.c revision 266692
1230557Sjimharris/*
2230557Sjimharris * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
3230557Sjimharris *      All rights reserved.
4230557Sjimharris * Copyright (c) 1990, 1993
5230557Sjimharris *	The Regents of the University of California.  All rights reserved.
6230557Sjimharris *
7230557Sjimharris * This code is derived from software contributed to Berkeley by
8230557Sjimharris * Chris Torek.
9230557Sjimharris *
10230557Sjimharris * By using this file, you agree to the terms and conditions set
11230557Sjimharris * forth in the LICENSE file which can be found at the top level of
12230557Sjimharris * the sendmail distribution.
13230557Sjimharris */
14230557Sjimharris
15230557Sjimharris#include <sm/gen.h>
16230557SjimharrisSM_RCSID("@(#)$Id: rewind.c,v 1.19 2013-11-22 20:51:43 ca Exp $")
17230557Sjimharris#include <errno.h>
18230557Sjimharris#include <sm/io.h>
19230557Sjimharris#include <sm/assert.h>
20230557Sjimharris#include "local.h"
21230557Sjimharris
22230557Sjimharris/*
23230557Sjimharris**  SM_IO_REWIND -- rewind the file
24230557Sjimharris**
25230557Sjimharris**	Seeks the file to the begining and clears any outstanding errors.
26230557Sjimharris**
27230557Sjimharris**	Parameters:
28230557Sjimharris**		fp -- the flie pointer for rewind
29230557Sjimharris**		timeout -- time to complete the rewind
30230557Sjimharris**
31230557Sjimharris**	Returns:
32230557Sjimharris**		none.
33230557Sjimharris*/
34230557Sjimharris
35230557Sjimharrisvoid
36230557Sjimharrissm_io_rewind(fp, timeout)
37230557Sjimharris	register SM_FILE_T *fp;
38230557Sjimharris	int timeout;
39230557Sjimharris{
40230557Sjimharris	SM_REQUIRE_ISA(fp, SmFileMagic);
41230557Sjimharris	(void) sm_io_seek(fp, timeout, 0L, SM_IO_SEEK_SET);
42230557Sjimharris	(void) sm_io_clearerr(fp);
43230557Sjimharris	errno = 0;      /* not required, but seems reasonable */
44230557Sjimharris}
45230557Sjimharris