diff options
author | dt <dt@FreeBSD.org> | 1999-02-08 21:32:38 +0000 |
---|---|---|
committer | dt <dt@FreeBSD.org> | 1999-02-08 21:32:38 +0000 |
commit | dd5f24e20cdd683adbb5885bb01814ac81fbc90b (patch) | |
tree | 2f7f0b89a7c12e8dce152773c267d5fe10f78eb6 /lib/libc/stdio/ftell.c | |
parent | af242fbed135e989cc0ff0985a4ebdad783ef2eb (diff) | |
download | FreeBSD-src-dd5f24e20cdd683adbb5885bb01814ac81fbc90b.zip FreeBSD-src-dd5f24e20cdd683adbb5885bb01814ac81fbc90b.tar.gz |
Added functions fseeko() and ftello() (from susv2).
Fixed fgetpos() and fsetpos() for offsets > 2GB.
PR: 8637
Submitted by: Dan Nelson <dnelson@emsphone.com> (adjusted by me a little)
Diffstat (limited to 'lib/libc/stdio/ftell.c')
-rw-r--r-- | lib/libc/stdio/ftell.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index 34da271..552ed21 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -39,21 +39,38 @@ static char sccsid[] = "@(#)ftell.c 8.2 (Berkeley) 5/4/95"; #endif static const char rcsid[] = - "$Id: ftell.c,v 1.8 1997/03/11 11:40:40 peter Exp $"; + "$Id: ftell.c,v 1.9 1998/04/11 07:40:44 jb Exp $"; #endif /* LIBC_SCCS and not lint */ +#include <sys/types.h> #include <stdio.h> #include <errno.h> #include "local.h" #include "libc_private.h" /* - * ftell: return current offset. + * standard ftell function. */ long ftell(fp) register FILE *fp; { + register off_t rv; + rv = ftello(fp); + if ((long)rv != rv) { + errno = EOVERFLOW; + return (-1); + } + return (rv); +} + +/* + * ftello: return current offset. + */ +off_t +ftello(fp) + register FILE *fp; +{ register fpos_t pos; if (fp->_seek == NULL) { |