1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-12 14:29:28 +00:00

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).
This commit is contained in:
James Raynard 1996-06-22 10:34:15 +00:00
parent 55c148f316
commit ce51cf0392
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16586
57 changed files with 317 additions and 50 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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));

View File

@ -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));

View File

@ -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>

View File

@ -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>

View File

@ -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) */

View File

@ -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>

View File

@ -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

View File

@ -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));

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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;
{

View File

@ -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>

View File

@ -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;
{

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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 */
/*

View File

@ -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>

View File

@ -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;

View File

@ -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;
{

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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;
{

View File

@ -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));

View File

@ -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>

View File

@ -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) {

View File

@ -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>

View File

@ -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);
}
/*

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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)

View File

@ -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;
{

View File

@ -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>

View File

@ -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 */

View File

@ -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);

View File

@ -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;

View File

@ -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 @@ again: c = *fmt++;
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 @@ again: c = *fmt++;
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)) {

View File

@ -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;
{

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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)

View File

@ -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;
{

View File

@ -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 */