17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
37c478bdstevel@tonic-gate *      All rights reserved.
47c478bdstevel@tonic-gate * Copyright (c) 1990, 1993
57c478bdstevel@tonic-gate *	The Regents of the University of California.  All rights reserved.
67c478bdstevel@tonic-gate *
77c478bdstevel@tonic-gate * This code is derived from software contributed to Berkeley by
87c478bdstevel@tonic-gate * Chris Torek.
97c478bdstevel@tonic-gate *
107c478bdstevel@tonic-gate * By using this file, you agree to the terms and conditions set
117c478bdstevel@tonic-gate * forth in the LICENSE file which can be found at the top level of
127c478bdstevel@tonic-gate * the sendmail distribution.
137c478bdstevel@tonic-gate */
147c478bdstevel@tonic-gate
157c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
167c478bdstevel@tonic-gate
177c478bdstevel@tonic-gate#include <sm/gen.h>
187c478bdstevel@tonic-gateSM_RCSID("@(#)$Id: rewind.c,v 1.16 2001/04/03 01:46:40 ca Exp $")
197c478bdstevel@tonic-gate#include <errno.h>
207c478bdstevel@tonic-gate#include <sm/io.h>
217c478bdstevel@tonic-gate#include <sm/assert.h>
227c478bdstevel@tonic-gate#include "local.h"
237c478bdstevel@tonic-gate
247c478bdstevel@tonic-gate/*
257c478bdstevel@tonic-gate**  SM_IO_REWIND -- rewind the file
267c478bdstevel@tonic-gate**
277c478bdstevel@tonic-gate**	Seeks the file to the begining and clears any outstanding errors.
287c478bdstevel@tonic-gate**
297c478bdstevel@tonic-gate**	Parameters:
307c478bdstevel@tonic-gate**		fp -- the flie pointer for rewind
317c478bdstevel@tonic-gate**		timeout -- time to complete the rewind
327c478bdstevel@tonic-gate**
337c478bdstevel@tonic-gate**	Returns:
347c478bdstevel@tonic-gate**		none.
357c478bdstevel@tonic-gate*/
367c478bdstevel@tonic-gate
377c478bdstevel@tonic-gatevoid
387c478bdstevel@tonic-gatesm_io_rewind(fp, timeout)
397c478bdstevel@tonic-gate	register SM_FILE_T *fp;
407c478bdstevel@tonic-gate	int timeout;
417c478bdstevel@tonic-gate{
427c478bdstevel@tonic-gate	SM_REQUIRE_ISA(fp, SmFileMagic);
437c478bdstevel@tonic-gate	(void) sm_io_seek(fp, timeout, 0L, SM_IO_SEEK_SET);
447c478bdstevel@tonic-gate	(void) sm_io_clearerr(fp);
457c478bdstevel@tonic-gate	errno = 0;      /* not required, but seems reasonable */
467c478bdstevel@tonic-gate}
47