140266059SGregory Neil Shapiro /* 25dd76dd0SGregory Neil Shapiro * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers. 340266059SGregory Neil Shapiro * All rights reserved. 440266059SGregory Neil Shapiro * Copyright (c) 1990, 1993 540266059SGregory Neil Shapiro * The Regents of the University of California. All rights reserved. 640266059SGregory Neil Shapiro * 740266059SGregory Neil Shapiro * This code is derived from software contributed to Berkeley by 840266059SGregory Neil Shapiro * Chris Torek. 940266059SGregory Neil Shapiro * 1040266059SGregory Neil Shapiro * By using this file, you agree to the terms and conditions set 1140266059SGregory Neil Shapiro * forth in the LICENSE file which can be found at the top level of 1240266059SGregory Neil Shapiro * the sendmail distribution. 1340266059SGregory Neil Shapiro */ 1440266059SGregory Neil Shapiro 1540266059SGregory Neil Shapiro #include <sm/gen.h> 164313cc83SGregory Neil Shapiro SM_RCSID("@(#)$Id: rewind.c,v 1.19 2013-11-22 20:51:43 ca Exp $") 1740266059SGregory Neil Shapiro #include <errno.h> 1840266059SGregory Neil Shapiro #include <sm/io.h> 1940266059SGregory Neil Shapiro #include <sm/assert.h> 2040266059SGregory Neil Shapiro #include "local.h" 2140266059SGregory Neil Shapiro 2240266059SGregory Neil Shapiro /* 2340266059SGregory Neil Shapiro ** SM_IO_REWIND -- rewind the file 2440266059SGregory Neil Shapiro ** 255b0945b5SGregory Neil Shapiro ** Seeks the file to the beginning and clears any outstanding errors. 2640266059SGregory Neil Shapiro ** 2740266059SGregory Neil Shapiro ** Parameters: 28*d39bd2c1SGregory Neil Shapiro ** fp -- the file pointer for rewind 2940266059SGregory Neil Shapiro ** timeout -- time to complete the rewind 3040266059SGregory Neil Shapiro ** 3140266059SGregory Neil Shapiro ** Returns: 3240266059SGregory Neil Shapiro ** none. 3340266059SGregory Neil Shapiro */ 3440266059SGregory Neil Shapiro 3540266059SGregory Neil Shapiro void 3640266059SGregory Neil Shapiro sm_io_rewind(fp, timeout) 3740266059SGregory Neil Shapiro register SM_FILE_T *fp; 3840266059SGregory Neil Shapiro int timeout; 3940266059SGregory Neil Shapiro { 4040266059SGregory Neil Shapiro SM_REQUIRE_ISA(fp, SmFileMagic); 4140266059SGregory Neil Shapiro (void) sm_io_seek(fp, timeout, 0L, SM_IO_SEEK_SET); 4240266059SGregory Neil Shapiro (void) sm_io_clearerr(fp); 4340266059SGregory Neil Shapiro errno = 0; /* not required, but seems reasonable */ 4440266059SGregory Neil Shapiro } 45