summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/ftell.c
diff options
context:
space:
mode:
authorDmitrij Tejblum <dt@FreeBSD.org>1999-05-05 22:18:12 +0000
committerDmitrij Tejblum <dt@FreeBSD.org>1999-05-05 22:18:12 +0000
commitc0d0cd800b91e3c706c1218001a59dd187a41f4b (patch)
tree10ff5588eb741a24d89158610d7a39ddc89590cc /lib/libc/stdio/ftell.c
parentf9b77ed91ea12fbae83af78b6b5ceafe81e13857 (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..ca739c80285f 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.10 1999/02/08 21:32:38 dt 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) {