summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/ftell.c
diff options
context:
space:
mode:
authorDmitrij Tejblum <dt@FreeBSD.org>1999-02-08 21:32:38 +0000
committerDmitrij Tejblum <dt@FreeBSD.org>1999-02-08 21:32:38 +0000
commit7307d07db6d636b8690c330a65b857dbe1738364 (patch)
treeff7ef06c4da289753c0ab5f95214f648a3626b95 /lib/libc/stdio/ftell.c
parent0d35e40d61a162640b2963d3647050e33c66fab8 (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/ftell.c')
-rw-r--r--lib/libc/stdio/ftell.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c
index 34da2713321b..552ed2124ce7 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) {