(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream) );
_PROTOTYPE( int fgetpos, (FILE *_stream, fpos_t *_pos) );
_PROTOTYPE( int fseek, (FILE *_stream, long _offset, int _whence) );
+_PROTOTYPE( int fseeko, (FILE *_stream, off_t _offset, int _whence) );
_PROTOTYPE( int fsetpos, (FILE *_stream, fpos_t *_pos) );
_PROTOTYPE( long ftell, (FILE *_stream) );
_PROTOTYPE( void rewind, (FILE *_stream) );
*/
/* $Header$ */
+#include <assert.h>
#include <stdio.h>
#if (SEEK_CUR != 1) || (SEEK_END != 2) || (SEEK_SET != 0)
int
fseek(FILE *stream, long int offset, int whence)
+{
+ assert(sizeof(offset) == sizeof(off_t));
+ return fseeko(stream, (off_t) offset, whence);
+}
+
+int
+fseeko(FILE *stream, off_t offset, int whence)
{
int adjust = 0;
long pos;
.TH FSEEK 3 "February 24, 1986"
.AT 3
.SH NAME
-fseek, ftell, rewind \- reposition a stream
+fseek, fseeko, ftell, rewind \- reposition a stream
.SH SYNOPSIS
.nf
.ft B
#include <stdio.h>
int fseek(FILE *\fIstream\fP, long \fIoffset\fP, int \fIptrname\fP)
+int fseeko(FILE *\fIstream\fP, off_t \fIoffset\fP, int \fIptrname\fP)
long ftell(FILE *\fIstream\fP)
void rewind(FILE *\fIstream\fP)
.ft R
.fi
.SH DESCRIPTION
.B Fseek
-sets the position of the next input or output
+and
+.B fseeko
+set the position of the next input or output
operation on the
.IR stream .
The new position is at the signed distance
has the value 0, 1, or 2.
.PP
.B Fseek
-undoes any effects of
+and
+.B fseeko
+undo any effects of
.BR ungetc (3).
.PP
.B Ftell
and the only foolproof way to obtain an
.I offset
for
-.BR fseek .
+.BR fseek
+and
+.BR fseeko .
.PP
.BR Rewind "(\fIstream\fR)"
is equivalent to
.BR fopen (3).
.SH DIAGNOSTICS
.B Fseek
-returns \-1 for improper seeks, otherwise zero.
+and
+.B fseeko
+return \-1 for improper seeks, otherwise zero.