summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio/stdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/stdio.c')
-rw-r--r--newlib/libc/stdio/stdio.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c
index bf304bc18..8bc736088 100644
--- a/newlib/libc/stdio/stdio.c
+++ b/newlib/libc/stdio/stdio.c
@@ -1,5 +1,3 @@
-/* No user fns here. Pesch 15apr92. */
-
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -16,7 +14,10 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+/* No user fns here. Pesch 15apr92. */
+#include <_ansi.h>
+#include <reent.h>
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
@@ -29,10 +30,10 @@
*/
_READ_WRITE_RETURN_TYPE
-__sread (cookie, buf, n)
- _PTR cookie;
- char *buf;
- int n;
+_DEFUN(__sread, (cookie, buf, n),
+ _PTR cookie _AND
+ char *buf _AND
+ int n)
{
register FILE *fp = (FILE *) cookie;
register int ret;
@@ -40,14 +41,14 @@ __sread (cookie, buf, n)
#ifdef __SCLE
int oldmode = 0;
if (fp->_flags & __SCLE)
- oldmode = setmode(fp->_file, O_BINARY);
+ oldmode = setmode (fp->_file, O_BINARY);
#endif
ret = _read_r (_REENT, fp->_file, buf, n);
#ifdef __SCLE
if (oldmode)
- setmode(fp->_file, oldmode);
+ setmode (fp->_file, oldmode);
#endif
/* If the read succeeded, update the current offset. */
@@ -60,10 +61,10 @@ __sread (cookie, buf, n)
}
_READ_WRITE_RETURN_TYPE
-__swrite (cookie, buf, n)
- _PTR cookie;
- char _CONST *buf;
- int n;
+_DEFUN(__swrite, (cookie, buf, n),
+ _PTR cookie _AND
+ char _CONST *buf _AND
+ int n)
{
register FILE *fp = (FILE *) cookie;
int w;
@@ -72,29 +73,29 @@ __swrite (cookie, buf, n)
#endif
if (fp->_flags & __SAPP)
- (void) _lseek_r (_REENT, fp->_file, (_off_t) 0, SEEK_END);
+ _CAST_VOID _lseek_r (_REENT, fp->_file, (_off_t) 0, SEEK_END);
fp->_flags &= ~__SOFF; /* in case O_APPEND mode is set */
#ifdef __SCLE
if (fp->_flags & __SCLE)
- oldmode = setmode(fp->_file, O_BINARY);
+ oldmode = setmode (fp->_file, O_BINARY);
#endif
w = _write_r (_REENT, fp->_file, buf, n);
#ifdef __SCLE
if (oldmode)
- setmode(fp->_file, oldmode);
+ setmode (fp->_file, oldmode);
#endif
return w;
}
_fpos_t
-__sseek (cookie, offset, whence)
- _PTR cookie;
- _fpos_t offset;
- int whence;
+_DEFUN(__sseek, (cookie, offset, whence),
+ _PTR cookie _AND
+ _fpos_t offset _AND
+ int whence)
{
register FILE *fp = (FILE *) cookie;
register _off_t ret;
@@ -111,8 +112,8 @@ __sseek (cookie, offset, whence)
}
int
-__sclose (cookie)
- _PTR cookie;
+_DEFUN(__sclose, (cookie),
+ _PTR cookie)
{
FILE *fp = (FILE *) cookie;
@@ -121,7 +122,8 @@ __sclose (cookie)
#ifdef __SCLE
int
-__stextmode (int fd)
+_DEFUN(__stextmode, (fd),
+ int fd)
{
#ifdef __CYGWIN__
return _cygwin_istext_for_stdio (fd);