diff options
Diffstat (limited to 'newlib/libc/stdio/ftell.c')
-rw-r--r-- | newlib/libc/stdio/ftell.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/newlib/libc/stdio/ftell.c b/newlib/libc/stdio/ftell.c index 74d6d906c..1df856366 100644 --- a/newlib/libc/stdio/ftell.c +++ b/newlib/libc/stdio/ftell.c @@ -92,29 +92,28 @@ static char sccsid[] = "%W% (Berkeley) %G%"; * ftell: return current offset. */ -#include <_ansi.h> -#include <reent.h> #include <stdio.h> #include <errno.h> + #include "local.h" long -_DEFUN(_ftell_r, (ptr, fp), - struct _reent *ptr _AND - register FILE * fp) +_DEFUN (_ftell_r, (ptr, fp), + struct _reent *ptr _AND + register FILE * fp) { _fpos_t pos; - /* Ensure stdio is set up. */ + _flockfile(fp); - CHECK_INIT (ptr); + /* Ensure stdio is set up. */ - _flockfile (fp); + CHECK_INIT (fp); if (fp->_seek == NULL) { ptr->_errno = ESPIPE; - _funlockfile (fp); + _funlockfile(fp); return -1L; } @@ -128,7 +127,7 @@ _DEFUN(_ftell_r, (ptr, fp), pos = (*fp->_seek) (fp->_cookie, (_fpos_t) 0, SEEK_CUR); if (pos == -1L) { - _funlockfile (fp); + _funlockfile(fp); return pos; } } @@ -143,7 +142,7 @@ _DEFUN(_ftell_r, (ptr, fp), if (HASUB (fp)) pos -= fp->_ur; } - else if ((fp->_flags & __SWR) && fp->_p != NULL) + else if (fp->_flags & __SWR && fp->_p != NULL) { /* * Writing. Any buffered characters cause the @@ -153,15 +152,15 @@ _DEFUN(_ftell_r, (ptr, fp), pos += fp->_p - fp->_bf._base; } - _funlockfile (fp); + _funlockfile(fp); return pos; } #ifndef _REENT_ONLY long -_DEFUN(ftell, (fp), - register FILE * fp) +_DEFUN (ftell, (fp), + register FILE * fp) { return _ftell_r (_REENT, fp); } |