diff options
author | jraynard <jraynard@FreeBSD.org> | 1996-06-22 10:34:15 +0000 |
---|---|---|
committer | jraynard <jraynard@FreeBSD.org> | 1996-06-22 10:34:15 +0000 |
commit | fac2ce3b1236438834d415410078fc73bacc4fcd (patch) | |
tree | dabe76e239303cbaa8026d6b9fa85fe1b5845601 /lib | |
parent | 1649c2ccee0c009a07ac7e86ad4c7681345a7c24 (diff) | |
download | FreeBSD-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')
57 files changed, 317 insertions, 50 deletions
diff --git a/lib/libc/stdio/clrerr.c b/lib/libc/stdio/clrerr.c index a597b7b..a230119 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 <stdio.h> diff --git a/lib/libc/stdio/fclose.c b/lib/libc/stdio/fclose.c index be92108..1104bd0 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 <errno.h> diff --git a/lib/libc/stdio/feof.c b/lib/libc/stdio/feof.c index efcdc40..e42df61 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 <stdio.h> @@ -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 a245128..8a68500 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 <stdio.h> @@ -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 fce8932..aed57ec 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 <errno.h> diff --git a/lib/libc/stdio/fgetc.c b/lib/libc/stdio/fgetc.c index 7e2738f..f93a004 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 <stdio.h> diff --git a/lib/libc/stdio/fgetln.c b/lib/libc/stdio/fgetln.c index ea99f4d..7c5742b 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 <stdio.h> @@ -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 4ac0be4..ab8a9e5 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 <stdio.h> diff --git a/lib/libc/stdio/fgets.c b/lib/libc/stdio/fgets.c index 186a1a1..434fc07 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 <stdio.h> @@ -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 327bedd..6ceac0c 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 <stdio.h> @@ -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 2986a2c..8a6cddd 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 <sys/param.h> @@ -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 6ec19e4..4ef0db1 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 <sys/types.h> #include <sys/file.h> #include <stdio.h> #include <errno.h> +#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 c6ece45..383f1e1 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 <stdio.h> @@ -45,8 +49,9 @@ static char sccsid[] = "@(#)fprintf.c 8.1 (Berkeley) 6/4/93"; #include <varargs.h> #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 7cf54ff..d1d9e87 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 <errno.h> diff --git a/lib/libc/stdio/fputc.c b/lib/libc/stdio/fputc.c index 09b55d5..89b138d 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 <stdio.h> diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c index 92fcc30..537c348 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 <stdio.h> diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index 7132e85..4f67fbf 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 <stdio.h> diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c index bbb3155..8513f80 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 <stdio.h> diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c index 1e99de9..c6707df 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 <sys/types.h> @@ -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 23faf26..d521a20 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 <stdio.h> @@ -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 abffc3e..855b6e1 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 <stdio.h> diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c index 38ddc9e..28db2ba 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 <stdio.h> @@ -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 2e19d3e..8f91b46 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 <errno.h> @@ -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 7efb0ac..ba8540d 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 <stdio.h> diff --git a/lib/libc/stdio/getc.c b/lib/libc/stdio/getc.c index c0726ee..ced796b 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 <stdio.h> diff --git a/lib/libc/stdio/getchar.c b/lib/libc/stdio/getchar.c index 7aeef8a..0bcbd3a 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 d31aeee..0c821ea 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 <unistd.h> diff --git a/lib/libc/stdio/getw.c b/lib/libc/stdio/getw.c index 0053391..c72756d 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 <stdio.h> -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 afe3f2d..bc4c928 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 <sys/types.h> @@ -40,12 +44,13 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; #include <fcntl.h> #include <errno.h> #include <stdio.h> -#include <unistd.h> #include <ctype.h> +#include <unistd.h> 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 64ea6b0..9711549 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 <stdio.h> @@ -45,8 +49,9 @@ static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93"; #include <varargs.h> #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 f1d42b1..a1b0814 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 <stdio.h> diff --git a/lib/libc/stdio/putchar.c b/lib/libc/stdio/putchar.c index 5e04a6c..99439ac 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 <stdio.h> diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c index e8a35c5..91a20de 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 <stdio.h> diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c index 604bed0..946a311 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 <stdio.h> diff --git a/lib/libc/stdio/refill.c b/lib/libc/stdio/refill.c index 8b118d6..d30194f 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 <errno.h> @@ -43,8 +47,10 @@ static char sccsid[] = "@(#)refill.c 8.1 (Berkeley) 6/4/93"; #include <stdlib.h> #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 85eaeb9..6a25563 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 <unistd.h> #include <stdio.h> -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 f20f619..f6609d6 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 <errno.h> diff --git a/lib/libc/stdio/rget.c b/lib/libc/stdio/rget.c index 3299fb5..45d817d 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 <stdio.h> +#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 5faf018..7a8bd65 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 <stdio.h> diff --git a/lib/libc/stdio/setbuffer.c b/lib/libc/stdio/setbuffer.c index a6d06dd..d272177 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 <stdio.h> @@ -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 c6c037d..9cc6bb6 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 <stdio.h> diff --git a/lib/libc/stdio/snprintf.c b/lib/libc/stdio/snprintf.c index 82fad1a..0e3c456 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 <stdio.h> diff --git a/lib/libc/stdio/sprintf.c b/lib/libc/stdio/sprintf.c index e71f7d0..fb0514d 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 <stdio.h> @@ -47,11 +51,10 @@ static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93"; #include <limits.h> #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 dc96312..d114ae3 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 <stdio.h> @@ -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 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; { diff --git a/lib/libc/stdio/tempnam.c b/lib/libc/stdio/tempnam.c index 0407e8bb1..243fa39 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 <sys/param.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <paths.h> diff --git a/lib/libc/stdio/ungetc.c b/lib/libc/stdio/ungetc.c index 25f59d7..c0355b7 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 <stdio.h> @@ -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 bec579a..09c89c2 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 <stdio.h> @@ -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 0f241de..5c3b986 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 f975341..35e7fbe 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 <stdio.h> @@ -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 069411e..8d449d6 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 <stdio.h> -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 677039e..9381710 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 <stdio.h> diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c index 1bff18b..8837c2e 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 <stdio.h> diff --git a/lib/libc/stdio/vsprintf.c b/lib/libc/stdio/vsprintf.c index cdfb9eb..911d97f 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 <stdio.h> diff --git a/lib/libc/stdio/vsscanf.c b/lib/libc/stdio/vsscanf.c index 0d4d05a..4cfa662 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 <stdio.h> #include <string.h> +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 010539f..b85ac51 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 <stdio.h> @@ -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 c494f69..74f0f77 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 <stdio.h> @@ -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 */ |