From ce51cf0392a0b2cc80e5ddcdb01394a303093443 Mon Sep 17 00:00:00 2001 From: James Raynard Date: Sat, 22 Jun 1996 10:34:15 +0000 Subject: [PATCH] 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). --- lib/libc/stdio/clrerr.c | 4 ++++ lib/libc/stdio/fclose.c | 4 ++++ lib/libc/stdio/feof.c | 8 ++++++-- lib/libc/stdio/ferror.c | 7 ++++++- lib/libc/stdio/fflush.c | 4 ++++ lib/libc/stdio/fgetc.c | 4 ++++ lib/libc/stdio/fgetln.c | 11 ++++++++--- lib/libc/stdio/fgetpos.c | 4 ++++ lib/libc/stdio/fgets.c | 6 +++++- lib/libc/stdio/fileno.c | 7 ++++++- lib/libc/stdio/findfp.c | 6 ++++++ lib/libc/stdio/flags.c | 10 ++++++++-- lib/libc/stdio/fprintf.c | 7 ++++++- lib/libc/stdio/fpurge.c | 4 ++++ lib/libc/stdio/fputc.c | 4 ++++ lib/libc/stdio/fputs.c | 4 ++++ lib/libc/stdio/fread.c | 4 ++++ lib/libc/stdio/fscanf.c | 4 ++++ lib/libc/stdio/fseek.c | 6 +++++- lib/libc/stdio/fsetpos.c | 7 ++++++- lib/libc/stdio/ftell.c | 4 ++++ lib/libc/stdio/fvwrite.c | 7 ++++++- lib/libc/stdio/fwalk.c | 9 +++++++-- lib/libc/stdio/fwrite.c | 4 ++++ lib/libc/stdio/getc.c | 4 ++++ lib/libc/stdio/getchar.c | 4 ++++ lib/libc/stdio/gets.c | 4 ++++ lib/libc/stdio/getw.c | 7 ++++++- lib/libc/stdio/mktemp.c | 13 +++++++++---- lib/libc/stdio/printf.c | 7 ++++++- lib/libc/stdio/putc.c | 4 ++++ lib/libc/stdio/putchar.c | 4 ++++ lib/libc/stdio/puts.c | 4 ++++ lib/libc/stdio/putw.c | 4 ++++ lib/libc/stdio/refill.c | 13 ++++++++++--- lib/libc/stdio/remove.c | 7 ++++++- lib/libc/stdio/rewind.c | 4 ++++ lib/libc/stdio/rget.c | 10 +++++++++- lib/libc/stdio/scanf.c | 4 ++++ lib/libc/stdio/setbuffer.c | 6 +++++- lib/libc/stdio/setvbuf.c | 4 ++++ lib/libc/stdio/snprintf.c | 4 ++++ lib/libc/stdio/sprintf.c | 7 +++++-- lib/libc/stdio/sscanf.c | 6 ++++++ lib/libc/stdio/stdio.c | 19 +++++++++++++------ lib/libc/stdio/tempnam.c | 5 +++++ lib/libc/stdio/ungetc.c | 8 +++++++- lib/libc/stdio/vasprintf.c | 12 +++++++----- lib/libc/stdio/vfprintf.c | 11 ++++++++++- lib/libc/stdio/vfscanf.c | 13 +++++++++---- lib/libc/stdio/vprintf.c | 7 ++++++- lib/libc/stdio/vscanf.c | 4 ++++ lib/libc/stdio/vsnprintf.c | 4 ++++ lib/libc/stdio/vsprintf.c | 4 ++++ lib/libc/stdio/vsscanf.c | 7 +++++++ lib/libc/stdio/wbuf.c | 7 ++++++- lib/libc/stdio/wsetup.c | 7 ++++++- 57 files changed, 317 insertions(+), 50 deletions(-) diff --git a/lib/libc/stdio/clrerr.c b/lib/libc/stdio/clrerr.c index a597b7b0baf..a230119a6e8 100644 --- a/lib/libc/stdio/clrerr.c +++ b/lib/libc/stdio/clrerr.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)clrerr.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fclose.c b/lib/libc/stdio/fclose.c index be9210801b5..1104bd08a78 100644 --- a/lib/libc/stdio/fclose.c +++ b/lib/libc/stdio/fclose.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fclose.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/feof.c b/lib/libc/stdio/feof.c index efcdc407660..e42df61ea66 100644 --- a/lib/libc/stdio/feof.c +++ b/lib/libc/stdio/feof.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)feof.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,8 +49,8 @@ static char sccsid[] = "@(#)feof.c 8.1 (Berkeley) 6/4/93"; */ #undef feof - -int feof(fp) +int +feof(fp) FILE *fp; { return (__sfeof(fp)); diff --git a/lib/libc/stdio/ferror.c b/lib/libc/stdio/ferror.c index a245128ef0b..8a6850095bf 100644 --- a/lib/libc/stdio/ferror.c +++ b/lib/libc/stdio/ferror.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)ferror.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,7 +49,8 @@ static char sccsid[] = "@(#)ferror.c 8.1 (Berkeley) 6/4/93"; */ #undef ferror -int ferror(fp) +int +ferror(fp) FILE *fp; { return (__sferror(fp)); diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index fce893292e6..aed57ec852c 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fflush.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fgetc.c b/lib/libc/stdio/fgetc.c index 7e2738f6c48..f93a0046209 100644 --- a/lib/libc/stdio/fgetc.c +++ b/lib/libc/stdio/fgetc.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fgetc.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fgetln.c b/lib/libc/stdio/fgetln.c index ea99f4d8b65..7c5742b908e 100644 --- a/lib/libc/stdio/fgetln.c +++ b/lib/libc/stdio/fgetln.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fgetln.c 8.2 (Berkeley) 1/2/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -50,7 +54,8 @@ static char sccsid[] = "@(#)fgetln.c 8.2 (Berkeley) 1/2/94"; * so we add 1 here. #endif */ -int __slbexpand(fp, newsize) +int +__slbexpand(fp, newsize) FILE *fp; size_t newsize; { @@ -91,7 +96,7 @@ fgetln(fp, lenp) } /* look for a newline in the input */ - if ((p = memchr((void *)fp->_p, '\n', fp->_r)) != NULL) { + if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) != NULL) { register char *ret; /* @@ -133,7 +138,7 @@ fgetln(fp, lenp) off = len; if (__srefill(fp)) break; /* EOF or error: return partial line */ - if ((p = memchr((void *)fp->_p, '\n', fp->_r)) == NULL) + if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL) continue; /* got it: finish up the line (like code above) */ diff --git a/lib/libc/stdio/fgetpos.c b/lib/libc/stdio/fgetpos.c index 4ac0be4ed3e..ab8a9e50cea 100644 --- a/lib/libc/stdio/fgetpos.c +++ b/lib/libc/stdio/fgetpos.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fgetpos.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fgets.c b/lib/libc/stdio/fgets.c index 186a1a1136a..434fc07cdec 100644 --- a/lib/libc/stdio/fgets.c +++ b/lib/libc/stdio/fgets.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fgets.c 8.2 (Berkeley) 12/22/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -61,7 +65,7 @@ fgets(buf, n, fp) register char *s; register unsigned char *p, *t; - if (n <= 0) /* sanity check */ + if (n <= 0) /* sanity check */ return (NULL); #ifdef _THREAD_SAFE diff --git a/lib/libc/stdio/fileno.c b/lib/libc/stdio/fileno.c index 327beddb8d4..6ceac0c1d8e 100644 --- a/lib/libc/stdio/fileno.c +++ b/lib/libc/stdio/fileno.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fileno.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,7 +49,8 @@ static char sccsid[] = "@(#)fileno.c 8.1 (Berkeley) 6/4/93"; */ #undef fileno -int fileno(fp) +int +fileno(fp) FILE *fp; { return (__sfileno(fp)); diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c index 2986a2ccbbd..8a6cddd71a9 100644 --- a/lib/libc/stdio/findfp.c +++ b/lib/libc/stdio/findfp.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)findfp.c 8.2 (Berkeley) 1/4/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -66,6 +70,8 @@ FILE __sF[3] = { }; struct glue __sglue = { &uglue, 3, __sF }; +static struct glue * moreglue __P((int)); + static struct glue * moreglue(n) register int n; diff --git a/lib/libc/stdio/flags.c b/lib/libc/stdio/flags.c index 6ec19e45ac6..4ef0db11a40 100644 --- a/lib/libc/stdio/flags.c +++ b/lib/libc/stdio/flags.c @@ -35,21 +35,27 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)flags.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include #include #include #include +#include "local.h" /* * Return the (stdio) flags for a given mode. Store the flags * to be passed to an open() syscall through *optr. * Return 0 on error. */ -int __sflags(mode, optr) - register char *mode; +int +__sflags(mode, optr) + register const char *mode; int *optr; { register int ret, m, o; diff --git a/lib/libc/stdio/fprintf.c b/lib/libc/stdio/fprintf.c index c6ece4532de..383f1e17908 100644 --- a/lib/libc/stdio/fprintf.c +++ b/lib/libc/stdio/fprintf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fprintf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,8 +49,9 @@ static char sccsid[] = "@(#)fprintf.c 8.1 (Berkeley) 6/4/93"; #include #endif +int #if __STDC__ -int fprintf(FILE *fp, const char *fmt, ...) +fprintf(FILE *fp, const char *fmt, ...) #else fprintf(fp, fmt, va_alist) FILE *fp; diff --git a/lib/libc/stdio/fpurge.c b/lib/libc/stdio/fpurge.c index 7cf54ffb2e3..d1d9e876258 100644 --- a/lib/libc/stdio/fpurge.c +++ b/lib/libc/stdio/fpurge.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fpurge.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fputc.c b/lib/libc/stdio/fputc.c index 09b55d59a58..89b138d15a0 100644 --- a/lib/libc/stdio/fputc.c +++ b/lib/libc/stdio/fputc.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fputc.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c index 92fcc303a69..537c34895de 100644 --- a/lib/libc/stdio/fputs.c +++ b/lib/libc/stdio/fputs.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fputs.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index 7132e8544c0..4f67fbf4134 100644 --- a/lib/libc/stdio/fread.c +++ b/lib/libc/stdio/fread.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fread.c 8.2 (Berkeley) 12/11/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c index bbb3155f94a..8513f801cea 100644 --- a/lib/libc/stdio/fscanf.c +++ b/lib/libc/stdio/fscanf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fscanf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c index 1e99de9db2c..c6707dfb34f 100644 --- a/lib/libc/stdio/fseek.c +++ b/lib/libc/stdio/fseek.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fseek.c 8.3 (Berkeley) 1/2/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -99,7 +103,7 @@ fseek(fp, offset, whence) curoff = fp->_offset; else { curoff = (*seekfn)(fp->_cookie, (fpos_t)0, SEEK_CUR); - if (curoff == -1L) { + if (curoff == -1) { #ifdef _THREAD_SAFE _thread_funlockfile(fp); #endif diff --git a/lib/libc/stdio/fsetpos.c b/lib/libc/stdio/fsetpos.c index 23faf26d119..d521a205487 100644 --- a/lib/libc/stdio/fsetpos.c +++ b/lib/libc/stdio/fsetpos.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fsetpos.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -43,7 +47,8 @@ static char sccsid[] = "@(#)fsetpos.c 8.1 (Berkeley) 6/4/93"; /* * fsetpos: like fseek. */ -int fsetpos(iop, pos) +int +fsetpos(iop, pos) FILE *iop; const fpos_t *pos; { diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index abffc3e8daa..855b6e1f8b3 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)ftell.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c index 38ddc9e0a79..28db2bafc4f 100644 --- a/lib/libc/stdio/fvwrite.c +++ b/lib/libc/stdio/fvwrite.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -49,7 +53,8 @@ static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93"; * This routine is large and unsightly, but most of the ugliness due * to the three different kinds of output buffering is handled here. */ -int __sfvwrite(fp, uio) +int +__sfvwrite(fp, uio) register FILE *fp; register struct __suio *uio; { diff --git a/lib/libc/stdio/fwalk.c b/lib/libc/stdio/fwalk.c index 2e19d3efb8c..8f91b46d904 100644 --- a/lib/libc/stdio/fwalk.c +++ b/lib/libc/stdio/fwalk.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fwalk.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -43,8 +47,9 @@ static char sccsid[] = "@(#)fwalk.c 8.1 (Berkeley) 6/4/93"; #include "local.h" #include "glue.h" -int _fwalk(function) - register int (*function)(); +int +_fwalk(function) + register int (*function)(FILE *); { register FILE *fp; register int n, ret; diff --git a/lib/libc/stdio/fwrite.c b/lib/libc/stdio/fwrite.c index 7efb0ac4e27..ba8540d4af9 100644 --- a/lib/libc/stdio/fwrite.c +++ b/lib/libc/stdio/fwrite.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)fwrite.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/getc.c b/lib/libc/stdio/getc.c index c0726ee2db6..ced796b8919 100644 --- a/lib/libc/stdio/getc.c +++ b/lib/libc/stdio/getc.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)getc.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/getchar.c b/lib/libc/stdio/getchar.c index 7aeef8af645..0bcbd3a6949 100644 --- a/lib/libc/stdio/getchar.c +++ b/lib/libc/stdio/getchar.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)getchar.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ /* diff --git a/lib/libc/stdio/gets.c b/lib/libc/stdio/gets.c index d31aeeef914..0c821ea76bd 100644 --- a/lib/libc/stdio/gets.c +++ b/lib/libc/stdio/gets.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)gets.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/getw.c b/lib/libc/stdio/getw.c index 0053391b5cb..c72756d4db8 100644 --- a/lib/libc/stdio/getw.c +++ b/lib/libc/stdio/getw.c @@ -35,12 +35,17 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)getw.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include -int getw(fp) +int +getw(fp) FILE *fp; { int x; diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index afe3f2da8d9..bc4c928e2de 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -32,7 +32,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -40,12 +44,13 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; #include #include #include -#include #include +#include static int _gettemp(char *, int *); -int mkstemp(path) +int +mkstemp(path) char *path; { int fd; @@ -60,8 +65,8 @@ mktemp(path) return(_gettemp(path, (int *)NULL) ? path : (char *)NULL); } -static -int _gettemp(path, doopen) +static int +_gettemp(path, doopen) char *path; register int *doopen; { diff --git a/lib/libc/stdio/printf.c b/lib/libc/stdio/printf.c index 64ea6b0c06c..97115494c42 100644 --- a/lib/libc/stdio/printf.c +++ b/lib/libc/stdio/printf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,8 +49,9 @@ static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93"; #include #endif +int #if __STDC__ -int printf(char const *fmt, ...) +printf(char const *fmt, ...) #else printf(fmt, va_alist) char *fmt; diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c index f1d42b11454..a1b08146424 100644 --- a/lib/libc/stdio/putc.c +++ b/lib/libc/stdio/putc.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)putc.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/putchar.c b/lib/libc/stdio/putchar.c index 5e04a6c72f2..99439aca10e 100644 --- a/lib/libc/stdio/putchar.c +++ b/lib/libc/stdio/putchar.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)putchar.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c index e8a35c533a5..91a20de975a 100644 --- a/lib/libc/stdio/puts.c +++ b/lib/libc/stdio/puts.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)puts.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c index 604bed0b792..946a311ac33 100644 --- a/lib/libc/stdio/putw.c +++ b/lib/libc/stdio/putw.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)putw.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/refill.c b/lib/libc/stdio/refill.c index 8b118d66f8e..d30194f8682 100644 --- a/lib/libc/stdio/refill.c +++ b/lib/libc/stdio/refill.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)refill.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -43,8 +47,10 @@ static char sccsid[] = "@(#)refill.c 8.1 (Berkeley) 6/4/93"; #include #include "local.h" -static -int lflush(fp) +static int lflush __P((FILE *)); + +static int +lflush(fp) FILE *fp; { @@ -57,7 +63,8 @@ int lflush(fp) * Refill a stdio buffer. * Return EOF on eof or error, 0 otherwise. */ -int __srefill(fp) +int +__srefill(fp) register FILE *fp; { diff --git a/lib/libc/stdio/remove.c b/lib/libc/stdio/remove.c index 85eaeb933ff..6a255639c96 100644 --- a/lib/libc/stdio/remove.c +++ b/lib/libc/stdio/remove.c @@ -35,13 +35,18 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)remove.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include #include -int remove(file) +int +remove(file) const char *file; { return (unlink(file)); diff --git a/lib/libc/stdio/rewind.c b/lib/libc/stdio/rewind.c index f20f6197f97..f6609d69f57 100644 --- a/lib/libc/stdio/rewind.c +++ b/lib/libc/stdio/rewind.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)rewind.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/rget.c b/lib/libc/stdio/rget.c index 3299fb568f5..45d817d78f9 100644 --- a/lib/libc/stdio/rget.c +++ b/lib/libc/stdio/rget.c @@ -35,17 +35,25 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)rget.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id"; #endif /* LIBC_SCCS and not lint */ #include +#include "local.h" + +int +__srefill(FILE *); /* * Handle getc() when the buffer ran out: * Refill, then return the first character * in the newly-filled buffer. */ -__srget(fp) +int __srget(fp) register FILE *fp; { if (__srefill(fp) == 0) { diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c index 5faf018711d..7a8bd65990f 100644 --- a/lib/libc/stdio/scanf.c +++ b/lib/libc/stdio/scanf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)scanf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/setbuffer.c b/lib/libc/stdio/setbuffer.c index a6d06ddda22..d27217751e1 100644 --- a/lib/libc/stdio/setbuffer.c +++ b/lib/libc/stdio/setbuffer.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)setbuffer.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -47,7 +51,7 @@ setbuffer(fp, buf, size) int size; { - (void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, size); + (void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, (size_t)size); } /* diff --git a/lib/libc/stdio/setvbuf.c b/lib/libc/stdio/setvbuf.c index c6c037d7e29..9cc6bb6ee65 100644 --- a/lib/libc/stdio/setvbuf.c +++ b/lib/libc/stdio/setvbuf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)setvbuf.c 8.2 (Berkeley) 11/16/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/snprintf.c b/lib/libc/stdio/snprintf.c index 82fad1a7590..0e3c4566f55 100644 --- a/lib/libc/stdio/snprintf.c +++ b/lib/libc/stdio/snprintf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/sprintf.c b/lib/libc/stdio/sprintf.c index e71f7d091bc..fb0514d5ff2 100644 --- a/lib/libc/stdio/sprintf.c +++ b/lib/libc/stdio/sprintf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -47,11 +51,10 @@ static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93"; #include #include "local.h" -#if __STDC__ int +#if __STDC__ sprintf(char *str, char const *fmt, ...) #else -int sprintf(str, fmt, va_alist) char *str; char *fmt; diff --git a/lib/libc/stdio/sscanf.c b/lib/libc/stdio/sscanf.c index dc96312a563..d114ae3b9a0 100644 --- a/lib/libc/stdio/sscanf.c +++ b/lib/libc/stdio/sscanf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)sscanf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -47,6 +51,8 @@ static char sccsid[] = "@(#)sscanf.c 8.1 (Berkeley) 6/4/93"; #endif #include "local.h" +static int eofread __P((void *, char *, int)); + /* ARGSUSED */ static int eofread(cookie, buf, len) diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c index c3b7e518304..852e971336f 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 @@ -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; { diff --git a/lib/libc/stdio/tempnam.c b/lib/libc/stdio/tempnam.c index 0407e8bb166..243fa397ca5 100644 --- a/lib/libc/stdio/tempnam.c +++ b/lib/libc/stdio/tempnam.c @@ -32,13 +32,18 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)tempnam.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include #include #include #include +#include #include #include diff --git a/lib/libc/stdio/ungetc.c b/lib/libc/stdio/ungetc.c index 25f59d7420f..c0355b7f641 100644 --- a/lib/libc/stdio/ungetc.c +++ b/lib/libc/stdio/ungetc.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)ungetc.c 8.2 (Berkeley) 11/3/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -47,6 +51,8 @@ static char sccsid[] = "@(#)ungetc.c 8.2 (Berkeley) 11/3/93"; #include "pthread_private.h" #endif +static int __submore __P((FILE *)); + /* * Expand the ungetc buffer `in place'. That is, adjust fp->_p when * the buffer moves, so that it points the same distance from the end, @@ -75,7 +81,7 @@ __submore(fp) return (0); } i = fp->_ub._size; - p = realloc(fp->_ub._base, i << 1); + p = realloc(fp->_ub._base, (size_t)(i << 1)); if (p == NULL) return (EOF); /* no overlap (hence can use memcpy) because we doubled the size */ diff --git a/lib/libc/stdio/vasprintf.c b/lib/libc/stdio/vasprintf.c index bec579a7a9d..09c89c29514 100644 --- a/lib/libc/stdio/vasprintf.c +++ b/lib/libc/stdio/vasprintf.c @@ -24,7 +24,7 @@ */ #if defined(LIBC_RCS) && !defined(lint) -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: vasprintf.c,v 1.1 1996/05/27 10:49:43 peter Exp $"; #endif /* LIBC_RCS and not lint */ #include @@ -44,10 +44,12 @@ struct bufcookie { int left; }; +static int writehook __P((void *cookie, const char *, int)); + static int writehook(cookie, buf, len) void *cookie; - char *buf; + const char *buf; int len; { struct bufcookie *h = (struct bufcookie *)cookie; @@ -59,12 +61,12 @@ writehook(cookie, buf, len) /* grow malloc region */ h->left = h->left + len + CHUNK_SPARE; h->size = h->size + len + CHUNK_SPARE; - h->base = realloc(h->base, h->size); + h->base = realloc(h->base, (size_t)h->size); if (h->base == NULL) return (-1); } /* "write" it */ - (void)memcpy(h->base + h->size - h->left, buf, len); + (void)memcpy(h->base + h->size - h->left, buf, (size_t)len); h->left -= len; return (0); } @@ -101,7 +103,7 @@ vasprintf(str, fmt, ap) return (-1); h.base[h.size - h.left] = '\0'; - *str = realloc(h.base, h.size - h.left + 1); + *str = realloc(h.base, (size_t)(h.size - h.left + 1)); if (*str == NULL) /* failed to realloc it to actual size */ return -1; return (ret); diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 0f241deebe1..5c3b9861e0c 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ /* @@ -67,6 +71,11 @@ static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; /* Define FLOATING_POINT to get floating point. */ #define FLOATING_POINT +static int __sprint __P((FILE *, struct __suio *)); +static int __sbprintf __P((FILE *, const char *, va_list)); +static char * __ultoa __P((u_long, char *, int, int, char *)); +static char * __uqtoa __P((u_quad_t, char *, int, int, char *)); + /* * Flush out all the vectors defined by the given uio, * then reset it so that it can be reused. @@ -620,7 +629,7 @@ fp_begin: if (prec == -1) * NUL in the first `prec' characters, and * strlen() will go further. */ - char *p = memchr(cp, 0, prec); + char *p = memchr(cp, 0, (size_t)prec); if (p != NULL) { size = p - cp; diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index f975341a020..35e7fbed7db 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -89,12 +93,13 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; #define u_char unsigned char #define u_long unsigned long -static u_char *__sccl(); +static u_char *__sccl(char *, u_char *); /* * vfscanf */ -int __svfscanf(fp, fmt0, ap) +int +__svfscanf(fp, fmt0, ap) register FILE *fp; char const *fmt0; va_list ap; @@ -346,7 +351,7 @@ literal: case CT_CCL: /* scan a (nonempty) character class (sets NOSKIP) */ if (width == 0) - width = ~0; /* `infinity' */ + width = (size_t)~0; /* `infinity' */ /* take only those things in the class */ if (flags & SUPPRESS) { n = 0; @@ -387,7 +392,7 @@ literal: case CT_STRING: /* like CCL, but zero-length string OK, & no NOSKIP */ if (width == 0) - width = ~0; + width = (size_t)~0; if (flags & SUPPRESS) { n = 0; while (!isspace(*fp->_p)) { diff --git a/lib/libc/stdio/vprintf.c b/lib/libc/stdio/vprintf.c index 069411e3bb4..8d449d620e6 100644 --- a/lib/libc/stdio/vprintf.c +++ b/lib/libc/stdio/vprintf.c @@ -35,12 +35,17 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)vprintf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include -int vprintf(fmt, ap) +int +vprintf(fmt, ap) char const *fmt; _BSD_VA_LIST_ ap; { diff --git a/lib/libc/stdio/vscanf.c b/lib/libc/stdio/vscanf.c index 677039ecc8e..9381710f301 100644 --- a/lib/libc/stdio/vscanf.c +++ b/lib/libc/stdio/vscanf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)vscanf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c index 1bff18bb8d3..8837c2e0514 100644 --- a/lib/libc/stdio/vsnprintf.c +++ b/lib/libc/stdio/vsnprintf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)vsnprintf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/vsprintf.c b/lib/libc/stdio/vsprintf.c index cdfb9ebb91f..911d97fa36f 100644 --- a/lib/libc/stdio/vsprintf.c +++ b/lib/libc/stdio/vsprintf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/lib/libc/stdio/vsscanf.c b/lib/libc/stdio/vsscanf.c index 0d4d05a10a4..4cfa6627079 100644 --- a/lib/libc/stdio/vsscanf.c +++ b/lib/libc/stdio/vsscanf.c @@ -35,12 +35,19 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include #include +static int +eofread __P((void *, char *, int)); + /* ARGSUSED */ static int eofread(cookie, buf, len) diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c index 010539f24e2..b85ac51fa8e 100644 --- a/lib/libc/stdio/wbuf.c +++ b/lib/libc/stdio/wbuf.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)wbuf.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -46,7 +50,8 @@ static char sccsid[] = "@(#)wbuf.c 8.1 (Berkeley) 6/4/93"; * the given file. Flush the buffer out if it is or becomes full, * or if c=='\n' and the file is line buffered. */ -int __swbuf(c, fp) +int +__swbuf(c, fp) register int c; register FILE *fp; { diff --git a/lib/libc/stdio/wsetup.c b/lib/libc/stdio/wsetup.c index c494f69a5dd..74f0f7755d1 100644 --- a/lib/libc/stdio/wsetup.c +++ b/lib/libc/stdio/wsetup.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)wsetup.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* LIBC_SCCS and not lint */ #include @@ -47,7 +51,8 @@ static char sccsid[] = "@(#)wsetup.c 8.1 (Berkeley) 6/4/93"; * because either _flags does not include __SWR, or _buf is NULL. * _wsetup returns 0 if OK to write, nonzero otherwise. */ -int __swsetup(fp) +int +__swsetup(fp) register FILE *fp; { /* make sure stdio is set up */