summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/ftell.c
diff options
context:
space:
mode:
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 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) {
OpenPOWER on IntegriCloud