summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/stdio.c
diff options
context:
space:
mode:
authorjraynard <jraynard@FreeBSD.org>1996-06-22 10:34:15 +0000
committerjraynard <jraynard@FreeBSD.org>1996-06-22 10:34:15 +0000
commitfac2ce3b1236438834d415410078fc73bacc4fcd (patch)
treedabe76e239303cbaa8026d6b9fa85fe1b5845601 /lib/libc/stdio/stdio.c
parent1649c2ccee0c009a07ac7e86ad4c7681345a7c24 (diff)
downloadFreeBSD-src-fac2ce3b1236438834d415410078fc73bacc4fcd.zip
FreeBSD-src-fac2ce3b1236438834d415410078fc73bacc4fcd.tar.gz
Suggested by: Bruce Evans, Jeffrey Hsu, Gary Palmer
Added $Id$'s to files that were lacking them (gpalmer), made some cosmetic changes to conform to style guidelines (bde) and checked against NetBSD and Lite2 to remove unnecessary divergences (hsu, bde) One last code cleanup:- Removed spurious casts in fseek.c and stdio.c. Added missing function argument in fwalk.c. Added missing header include in flags.c and rget.c. Put in casts where int's were being passed as size_t's. Put in missing prototypes for static functions. Changed second args of __sflags() inflags.c and writehook() in vasprintf.c from char * to const char * to conform to prototypes. This directory now compiles with no warnings with -Wall under gcc-2.6.3 and with considerably less warnings than before with the ultra-pedantic script I used for testing. (Most of the remaining ones are due to const poisoning).
Diffstat (limited to 'lib/libc/stdio/stdio.c')
-rw-r--r--lib/libc/stdio/stdio.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c
index c3b7e51..852e971 100644
--- a/lib/libc/stdio/stdio.c
+++ b/lib/libc/stdio/stdio.c
@@ -35,7 +35,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* LIBC_SCCS and not lint */
#include <fcntl.h>
@@ -47,7 +51,8 @@ static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
* Small standard I/O/seek/close functions.
* These maintain the `known seek offset' for seek optimisation.
*/
-int __sread(cookie, buf, n)
+int
+__sread(cookie, buf, n)
void *cookie;
char *buf;
int n;
@@ -55,7 +60,7 @@ int __sread(cookie, buf, n)
register FILE *fp = cookie;
register int ret;
- ret = read(fp->_file, buf, n);
+ ret = read(fp->_file, buf, (size_t)n);
/* if the read succeeded, update the current offset */
if (ret >= 0)
fp->_offset += ret;
@@ -64,7 +69,8 @@ int __sread(cookie, buf, n)
return (ret);
}
-int __swrite(cookie, buf, n)
+int
+__swrite(cookie, buf, n)
void *cookie;
char const *buf;
int n;
@@ -74,7 +80,7 @@ int __swrite(cookie, buf, n)
if (fp->_flags & __SAPP)
(void) lseek(fp->_file, (off_t)0, SEEK_END);
fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */
- return (write(fp->_file, buf, n));
+ return (write(fp->_file, buf, (size_t)n));
}
fpos_t
@@ -87,7 +93,7 @@ __sseek(cookie, offset, whence)
register off_t ret;
ret = lseek(fp->_file, (off_t)offset, whence);
- if (ret == -1L)
+ if (ret == -1)
fp->_flags &= ~__SOFF;
else {
fp->_flags |= __SOFF;
@@ -96,7 +102,8 @@ __sseek(cookie, offset, whence)
return (ret);
}
-int __sclose(cookie)
+int
+__sclose(cookie)
void *cookie;
{
OpenPOWER on IntegriCloud