2004-04-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>

* libc/stdio/asprintf.c libc/stdio/clearerr.c,
        libc/stdio/fclose.c libc/stdio/fcloseall.c libc/stdio/fdopen.c,
        libc/stdio/feof.c libc/stdio/ferror.c libc/stdio/fflush.c,
        libc/stdio/fgetc.c libc/stdio/fgetpos.c libc/stdio/fgets.c,
        libc/stdio/fileno.c libc/stdio/findfp.c libc/stdio/fiprintf.c,
        libc/stdio/flags.c libc/stdio/fopen.c libc/stdio/fprintf.c,
        libc/stdio/fputc.c libc/stdio/fputs.c libc/stdio/fread.c,
        libc/stdio/freopen.c libc/stdio/fscanf.c libc/stdio/fseek.c,
        libc/stdio/fseeko.c libc/stdio/fsetpos.c libc/stdio/ftell.c,
        libc/stdio/ftello.c libc/stdio/fvwrite.c libc/stdio/fwalk.c,
        libc/stdio/fwrite.c libc/stdio/getc.c libc/stdio/getc_u.c,
        libc/stdio/getchar.c libc/stdio/getchar_u.c,
        libc/stdio/getdelim.c libc/stdio/getline.c libc/stdio/gets.c,
        libc/stdio/getw.c libc/stdio/iprintf.c libc/stdio/local.h,
        libc/stdio/makebuf.c libc/stdio/mktemp.c libc/stdio/perror.c,
        libc/stdio/printf.c libc/stdio/putc.c libc/stdio/putc_u.c,
        libc/stdio/putchar.c libc/stdio/putchar_u.c libc/stdio/puts.c,
        libc/stdio/putw.c libc/stdio/refill.c libc/stdio/remove.c,
        libc/stdio/rename.c libc/stdio/rewind.c libc/stdio/rget.c,
        libc/stdio/scanf.c libc/stdio/setbuf.c libc/stdio/setbuffer.c,
        libc/stdio/setlinebuf.c libc/stdio/setvbuf.c,
        libc/stdio/siprintf.c libc/stdio/snprintf.c,
        libc/stdio/sprintf.c libc/stdio/sscanf.c libc/stdio/stdio.c,
        libc/stdio/tmpfile.c libc/stdio/tmpnam.c libc/stdio/ungetc.c,
        libc/stdio/vasprintf.c libc/stdio/vfieeefp.h,
        libc/stdio/vfprintf.c libc/stdio/vfscanf.c,
        libc/stdio/vprintf.c libc/stdio/vscanf.c,
        libc/stdio/vsnprintf.c libc/stdio/vsprintf.c,
        libc/stdio/vsscanf.c libc/stdio/wbuf.c,
        libc/stdio/wsetup.c: Perform minor formatting changes.  Move
        copyright notices to top of file, ensure that <_ansi.h> is
        included, be consistent with open parentheses, use _DEFUN macro,
        include "local.h" where needed, and remove various compiler
        warnings.
This commit is contained in:
Jeff Johnston
2004-04-23 20:01:55 +00:00
parent 7ed02aabd1
commit 05b315770a
79 changed files with 1502 additions and 1157 deletions

View File

@ -1,3 +1,40 @@
2004-04-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/asprintf.c libc/stdio/clearerr.c,
libc/stdio/fclose.c libc/stdio/fcloseall.c libc/stdio/fdopen.c,
libc/stdio/feof.c libc/stdio/ferror.c libc/stdio/fflush.c,
libc/stdio/fgetc.c libc/stdio/fgetpos.c libc/stdio/fgets.c,
libc/stdio/fileno.c libc/stdio/findfp.c libc/stdio/fiprintf.c,
libc/stdio/flags.c libc/stdio/fopen.c libc/stdio/fprintf.c,
libc/stdio/fputc.c libc/stdio/fputs.c libc/stdio/fread.c,
libc/stdio/freopen.c libc/stdio/fscanf.c libc/stdio/fseek.c,
libc/stdio/fseeko.c libc/stdio/fsetpos.c libc/stdio/ftell.c,
libc/stdio/ftello.c libc/stdio/fvwrite.c libc/stdio/fwalk.c,
libc/stdio/fwrite.c libc/stdio/getc.c libc/stdio/getc_u.c,
libc/stdio/getchar.c libc/stdio/getchar_u.c,
libc/stdio/getdelim.c libc/stdio/getline.c libc/stdio/gets.c,
libc/stdio/getw.c libc/stdio/iprintf.c libc/stdio/local.h,
libc/stdio/makebuf.c libc/stdio/mktemp.c libc/stdio/perror.c,
libc/stdio/printf.c libc/stdio/putc.c libc/stdio/putc_u.c,
libc/stdio/putchar.c libc/stdio/putchar_u.c libc/stdio/puts.c,
libc/stdio/putw.c libc/stdio/refill.c libc/stdio/remove.c,
libc/stdio/rename.c libc/stdio/rewind.c libc/stdio/rget.c,
libc/stdio/scanf.c libc/stdio/setbuf.c libc/stdio/setbuffer.c,
libc/stdio/setlinebuf.c libc/stdio/setvbuf.c,
libc/stdio/siprintf.c libc/stdio/snprintf.c,
libc/stdio/sprintf.c libc/stdio/sscanf.c libc/stdio/stdio.c,
libc/stdio/tmpfile.c libc/stdio/tmpnam.c libc/stdio/ungetc.c,
libc/stdio/vasprintf.c libc/stdio/vfieeefp.h,
libc/stdio/vfprintf.c libc/stdio/vfscanf.c,
libc/stdio/vprintf.c libc/stdio/vscanf.c,
libc/stdio/vsnprintf.c libc/stdio/vsprintf.c,
libc/stdio/vsscanf.c libc/stdio/wbuf.c,
libc/stdio/wsetup.c: Perform minor formatting changes. Move
copyright notices to top of file, ensure that <_ansi.h> is
included, be consistent with open parentheses, use _DEFUN macro,
include "local.h" where needed, and remove various compiler
warnings.
2004-04-21 J"orn Rennecke <joern.rennecke@superh.com> 2004-04-21 J"orn Rennecke <joern.rennecke@superh.com>
* libc/stdio/vfscanf.c (NNZDIGITS): New define. * libc/stdio/vfscanf.c (NNZDIGITS): New define.

View File

@ -14,9 +14,10 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* This code was copied from sprintf.c */ /* This code was copied from sprintf.c */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
@ -24,14 +25,16 @@
#include <varargs.h> #include <varargs.h>
#endif #endif
#include <limits.h> #include <limits.h>
#include <_ansi.h>
#include "local.h" #include "local.h"
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_DEFUN (_asprintf_r, (ptr, strp, fmt), struct _reent *ptr _AND char **strp _AND _CONST char *fmt _DOTS) _DEFUN(_asprintf_r, (ptr, strp, fmt),
struct _reent *ptr _AND
char **strp _AND
_CONST char *fmt _DOTS)
#else #else
_asprintf_r (ptr, strp, fmt, va_alist) _asprintf_r(ptr, strp, fmt, va_alist)
struct _reent *ptr; struct _reent *ptr;
char **strp; char **strp;
_CONST char *fmt; _CONST char *fmt;
@ -63,9 +66,11 @@ _asprintf_r (ptr, strp, fmt, va_alist)
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_DEFUN (asprintf, (strp, fmt), char **strp _AND _CONST char *fmt _DOTS) _DEFUN(asprintf, (strp, fmt),
char **strp _AND
_CONST char *fmt _DOTS)
#else #else
asprintf (strp, fmt, va_alist) asprintf(strp, fmt, va_alist)
char **strp; char **strp;
_CONST char *fmt; _CONST char *fmt;
va_dcl va_dcl

View File

@ -52,14 +52,15 @@ ANSI C requires <<clearerr>>.
No supporting OS subroutines are required. No supporting OS subroutines are required.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#undef clearerr #undef clearerr
_VOID _VOID
_DEFUN (clearerr, (fp), _DEFUN(clearerr, (fp),
FILE * fp) FILE * fp)
{ {
_flockfile(fp); _flockfile (fp);
__sclearerr (fp); __sclearerr (fp);
_funlockfile(fp); _funlockfile (fp);
} }

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fclose>>---close a file <<fclose>>---close a file
@ -10,7 +27,7 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int fclose(FILE *<[fp]>); int fclose(FILE *<[fp]>);
int _fclose_r(void *<[reent]>, FILE *<[fp]>); int _fclose_r(struct _reent *<[reent]>, FILE *<[fp]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -18,7 +35,7 @@ TRAD_SYNOPSIS
FILE *<[fp]>; FILE *<[fp]>;
int fclose(<[fp]>) int fclose(<[fp]>)
void *<[reent]> struct _reent *<[reent]>
FILE *<[fp]>; FILE *<[fp]>;
DESCRIPTION DESCRIPTION
@ -40,35 +57,15 @@ Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
<<read>>, <<sbrk>>, <<write>>. <<read>>, <<sbrk>>, <<write>>.
*/ */
/* #include <_ansi.h>
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <reent.h> #include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "local.h"
#include <sys/lock.h> #include <sys/lock.h>
#include "local.h"
/*
* Close a file.
*/
int int
_DEFUN (_fclose_r, (rptr, fp), _DEFUN(_fclose_r, (rptr, fp),
struct _reent *rptr _AND struct _reent *rptr _AND
register FILE * fp) register FILE * fp)
{ {
@ -79,13 +76,13 @@ _DEFUN (_fclose_r, (rptr, fp),
__sfp_lock_acquire (); __sfp_lock_acquire ();
_flockfile(fp); _flockfile (fp);
CHECK_INIT (fp); CHECK_INIT (fp);
if (fp->_flags == 0) /* not open! */ if (fp->_flags == 0) /* not open! */
{ {
_funlockfile(fp); _funlockfile (fp);
__sfp_lock_release (); __sfp_lock_release ();
return (0); return (0);
} }
@ -99,7 +96,7 @@ _DEFUN (_fclose_r, (rptr, fp),
if (HASLB (fp)) if (HASLB (fp))
FREELB (fp); FREELB (fp);
fp->_flags = 0; /* release this FILE for reuse */ fp->_flags = 0; /* release this FILE for reuse */
_funlockfile(fp); _funlockfile (fp);
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock); __lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock);
#endif #endif
@ -112,7 +109,7 @@ _DEFUN (_fclose_r, (rptr, fp),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (fclose, (fp), _DEFUN(fclose, (fp),
register FILE * fp) register FILE * fp)
{ {
return _fclose_r(_REENT, fp); return _fclose_r(_REENT, fp);

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fcloseall>>---close all files <<fcloseall>>---close all files
@ -37,34 +54,18 @@ PORTABILITY
Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>, Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
<<read>>, <<sbrk>>, <<write>>. <<read>>, <<sbrk>>, <<write>>.
*/ */
/* This file based upon fwalk.c. */ /* This file based upon fwalk.c. */
/* #include <_ansi.h>
* Copyright (c) 1990 The Regents of the University of California. #include <reent.h>
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include "local.h" #include "local.h"
int int
_fcloseall_r (ptr) _DEFUN(_fcloseall_r, (ptr),
struct _reent *ptr; struct _reent *ptr)
{ {
return _fwalk_reent (ptr, _fclose_r); return _fwalk_reent (ptr, _fclose_r);
} }
@ -72,7 +73,7 @@ _fcloseall_r (ptr)
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
fcloseall (void) _DEFUN_VOID(fcloseall)
{ {
return _fcloseall_r (_GLOBAL_REENT); return _fcloseall_r (_GLOBAL_REENT);
} }

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fdopen>>---turn open file into a stream <<fdopen>>---turn open file into a stream
@ -10,7 +27,7 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
FILE *fdopen(int <[fd]>, const char *<[mode]>); FILE *fdopen(int <[fd]>, const char *<[mode]>);
FILE *_fdopen_r(void *<[reent]>, FILE *_fdopen_r(struct _reent *<[reent]>,
int <[fd]>, const char *<[mode]>); int <[fd]>, const char *<[mode]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -20,7 +37,7 @@ TRAD_SYNOPSIS
char *<[mode]>; char *<[mode]>;
FILE *_fdopen_r(<[reent]>, <[fd]>, <[mode]>) FILE *_fdopen_r(<[reent]>, <[fd]>, <[mode]>)
char *<[reent]>; struct _reent *<[reent]>;
int <[fd]>; int <[fd]>;
char *<[mode]>); char *<[mode]>);
@ -37,18 +54,17 @@ PORTABILITY
<<fdopen>> is ANSI. <<fdopen>> is ANSI.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "local.h" #include "local.h"
#include <_syslist.h> #include <_syslist.h>
extern int __sflags ();
FILE * FILE *
_DEFUN (_fdopen_r, (ptr, fd, mode), _DEFUN(_fdopen_r, (ptr, fd, mode),
struct _reent *ptr _AND struct _reent *ptr _AND
int fd _AND int fd _AND
_CONST char *mode) _CONST char *mode)
@ -77,7 +93,7 @@ _DEFUN (_fdopen_r, (ptr, fd, mode),
if ((fp = __sfp (ptr)) == 0) if ((fp = __sfp (ptr)) == 0)
return 0; return 0;
_flockfile(fp); _flockfile (fp);
fp->_flags = flags; fp->_flags = flags;
/* /*
@ -107,21 +123,21 @@ _DEFUN (_fdopen_r, (ptr, fd, mode),
#ifdef __SCLE #ifdef __SCLE
/* Explicit given mode results in explicit setting mode on fd */ /* Explicit given mode results in explicit setting mode on fd */
if (oflags & O_BINARY) if (oflags & O_BINARY)
setmode(fp->_file, O_BINARY); setmode (fp->_file, O_BINARY);
else if (oflags & O_TEXT) else if (oflags & O_TEXT)
setmode(fp->_file, O_TEXT); setmode (fp->_file, O_TEXT);
if (__stextmode(fp->_file)) if (__stextmode (fp->_file))
fp->_flags |= __SCLE; fp->_flags |= __SCLE;
#endif #endif
_funlockfile(fp); _funlockfile (fp);
return fp; return fp;
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
FILE * FILE *
_DEFUN (fdopen, (fd, mode), _DEFUN(fdopen, (fd, mode),
int fd _AND int fd _AND
_CONST char *mode) _CONST char *mode)
{ {

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<feof>>---test for end of file <<feof>>---test for end of file
@ -33,12 +50,12 @@ No supporting OS subroutines are required.
#undef feof #undef feof
int int
_DEFUN (feof, (fp), _DEFUN(feof, (fp),
FILE * fp) FILE * fp)
{ {
int result; int result;
_flockfile(fp); _flockfile (fp);
result = __sfeof (fp); result = __sfeof (fp);
_funlockfile(fp); _funlockfile (fp);
return result; return result;
} }

View File

@ -53,6 +53,7 @@ No supporting OS subroutines are required.
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
/* A subroutine version of the macro ferror. */ /* A subroutine version of the macro ferror. */
@ -60,12 +61,12 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef ferror #undef ferror
int int
_DEFUN (ferror, (fp), _DEFUN(ferror, (fp),
FILE * fp) FILE * fp)
{ {
int result; int result;
_flockfile(fp); _flockfile (fp);
result = __sferror (fp); result = __sferror (fp);
_funlockfile(fp); _funlockfile (fp);
return result; return result;
} }

View File

@ -51,13 +51,14 @@ ANSI C requires <<fflush>>.
No supporting OS subroutines are required. No supporting OS subroutines are required.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"
/* Flush a single file, or (if fp is NULL) all files. */ /* Flush a single file, or (if fp is NULL) all files. */
int int
_DEFUN (fflush, (fp), _DEFUN(fflush, (fp),
register FILE * fp) register FILE * fp)
{ {
register unsigned char *p; register unsigned char *p;
@ -66,14 +67,14 @@ _DEFUN (fflush, (fp),
if (fp == NULL) if (fp == NULL)
return _fwalk (_GLOBAL_REENT, fflush); return _fwalk (_GLOBAL_REENT, fflush);
_flockfile(fp); _flockfile (fp);
CHECK_INIT (fp); CHECK_INIT (fp);
t = fp->_flags; t = fp->_flags;
if ((t & __SWR) == 0 || (p = fp->_bf._base) == NULL) if ((t & __SWR) == 0 || (p = fp->_bf._base) == NULL)
{ {
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
} }
n = fp->_p - p; /* write this much */ n = fp->_p - p; /* write this much */
@ -92,12 +93,12 @@ _DEFUN (fflush, (fp),
if (t <= 0) if (t <= 0)
{ {
fp->_flags |= __SERR; fp->_flags |= __SERR;
_funlockfile(fp); _funlockfile (fp);
return EOF; return EOF;
} }
p += t; p += t;
n -= t; n -= t;
} }
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
} }

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fgetc>>---get a character from a file or stream <<fgetc>>---get a character from a file or stream
@ -36,15 +53,16 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
int int
_DEFUN (fgetc, (fp), _DEFUN(fgetc, (fp),
FILE * fp) FILE * fp)
{ {
int result; int result;
_flockfile(fp); _flockfile (fp);
result = __sgetc (fp); result = __sgetc (fp);
_funlockfile(fp); _funlockfile (fp);
return result; return result;
} }

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fgetpos>>---record position in a stream or file <<fgetpos>>---record position in a stream or file
@ -54,30 +71,32 @@ conforming C implementations may return a different result from
No supporting OS subroutines are required. No supporting OS subroutines are required.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
int int
_DEFUN (_fgetpos_r, (ptr, fp, pos), _DEFUN(_fgetpos_r, (ptr, fp, pos),
struct _reent * ptr _AND struct _reent * ptr _AND
FILE * fp _AND FILE * fp _AND
_fpos_t * pos) _fpos_t * pos)
{ {
_flockfile(fp); _flockfile (fp);
*pos = _ftell_r (ptr, fp); *pos = _ftell_r (ptr, fp);
if (*pos != -1) if (*pos != -1)
{ {
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
} }
_funlockfile(fp); _funlockfile (fp);
return 1; return 1;
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (fgetpos, (fp, pos), _DEFUN(fgetpos, (fp, pos),
FILE * fp _AND FILE * fp _AND
_fpos_t * pos) _fpos_t * pos)
{ {

View File

@ -16,9 +16,9 @@
*/ */
/* /*
FUNCTION FUNCTION
<<fgets>>---get character string from a file or stream <<fgets>>---get character string from a file or stream
INDEX INDEX
fgets fgets
@ -54,10 +54,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "local.h"
extern int __srefill ();
/* /*
* Read at most n-1 characters from the given file. * Read at most n-1 characters from the given file.
@ -66,7 +66,7 @@ extern int __srefill ();
*/ */
char * char *
_DEFUN (fgets, (buf, n, fp), _DEFUN(fgets, (buf, n, fp),
char *buf _AND char *buf _AND
int n _AND int n _AND
FILE * fp) FILE * fp)
@ -80,13 +80,13 @@ _DEFUN (fgets, (buf, n, fp),
s = buf; s = buf;
_flockfile(fp); _flockfile (fp);
#ifdef __SCLE #ifdef __SCLE
if (fp->_flags & __SCLE) if (fp->_flags & __SCLE)
{ {
int c; int c;
/* Sorry, have to do it the slow way */ /* Sorry, have to do it the slow way */
while (--n > 0 && (c = __sgetc(fp)) != EOF) while (--n > 0 && (c = __sgetc (fp)) != EOF)
{ {
*s++ = c; *s++ = c;
if (c == '\n') if (c == '\n')
@ -94,11 +94,11 @@ _DEFUN (fgets, (buf, n, fp),
} }
if (c == EOF && s == buf) if (c == EOF && s == buf)
{ {
_funlockfile(fp); _funlockfile (fp);
return NULL; return NULL;
} }
*s = 0; *s = 0;
_funlockfile(fp); _funlockfile (fp);
return buf; return buf;
} }
#endif #endif
@ -116,7 +116,7 @@ _DEFUN (fgets, (buf, n, fp),
/* EOF: stop with partial or no line */ /* EOF: stop with partial or no line */
if (s == buf) if (s == buf)
{ {
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
} }
break; break;
@ -139,18 +139,18 @@ _DEFUN (fgets, (buf, n, fp),
len = ++t - p; len = ++t - p;
fp->_r -= len; fp->_r -= len;
fp->_p = t; fp->_p = t;
(void) memcpy ((_PTR) s, (_PTR) p, len); _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
s[len] = 0; s[len] = 0;
_funlockfile(fp); _funlockfile (fp);
return (buf); return (buf);
} }
fp->_r -= len; fp->_r -= len;
fp->_p += len; fp->_p += len;
(void) memcpy ((_PTR) s, (_PTR) p, len); _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
s += len; s += len;
} }
while ((n -= len) != 0); while ((n -= len) != 0);
*s = 0; *s = 0;
_funlockfile(fp); _funlockfile (fp);
return buf; return buf;
} }

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fileno>>---return file descriptor associated with stream <<fileno>>---return file descriptor associated with stream
@ -28,17 +45,18 @@ POSIX requires <<fileno>>.
Supporting OS subroutines required: none. Supporting OS subroutines required: none.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"
int int
_DEFUN (fileno, (f), _DEFUN(fileno, (f),
FILE * f) FILE * f)
{ {
int result; int result;
_flockfile(f); _flockfile (f);
CHECK_INIT (f); CHECK_INIT (f);
result = __sfileno (f); result = __sfileno (f);
_funlockfile(f); _funlockfile (f);
return result; return result;
} }

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,7 +14,10 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92. */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
@ -25,12 +26,12 @@
#include <sys/lock.h> #include <sys/lock.h>
#include "local.h" #include "local.h"
static void static _VOID
std (ptr, flags, file, data) _DEFUN(std, (ptr, flags, file, data),
FILE *ptr; FILE *ptr _AND
int flags; int flags _AND
int file; int file _AND
struct _reent *data; struct _reent *data)
{ {
ptr->_p = 0; ptr->_p = 0;
ptr->_r = 0; ptr->_r = 0;
@ -54,15 +55,15 @@ std (ptr, flags, file, data)
#endif #endif
#ifdef __SCLE #ifdef __SCLE
if (__stextmode(ptr->_file)) if (__stextmode (ptr->_file))
ptr->_flags |= __SCLE; ptr->_flags |= __SCLE;
#endif #endif
} }
struct _glue * struct _glue *
__sfmoreglue (d, n) _DEFUN(__sfmoreglue, (d, n),
struct _reent *d; struct _reent *d _AND
register int n; register int n)
{ {
struct _glue *g; struct _glue *g;
FILE *p; FILE *p;
@ -83,8 +84,8 @@ __sfmoreglue (d, n)
*/ */
FILE * FILE *
__sfp (d) _DEFUN(__sfp, (d),
struct _reent *d; struct _reent *d)
{ {
FILE *fp; FILE *fp;
int n; int n;
@ -138,17 +139,17 @@ found:
* The name `_cleanup' is, alas, fairly well known outside stdio. * The name `_cleanup' is, alas, fairly well known outside stdio.
*/ */
void _VOID
_cleanup_r (ptr) _DEFUN(_cleanup_r, (ptr),
struct _reent *ptr; struct _reent *ptr)
{ {
/* (void) _fwalk(fclose); */ /* _CAST_VOID _fwalk(fclose); */
(void) _fwalk (ptr, fflush); /* `cheating' */ _CAST_VOID _fwalk (ptr, fflush); /* `cheating' */
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
void _VOID
_cleanup () _DEFUN_VOID(_cleanup)
{ {
_cleanup_r (_GLOBAL_REENT); _cleanup_r (_GLOBAL_REENT);
} }
@ -158,9 +159,9 @@ _cleanup ()
* __sinit() is called whenever stdio's internal variables must be set up. * __sinit() is called whenever stdio's internal variables must be set up.
*/ */
void _VOID
__sinit (s) _DEFUN(__sinit, (s),
struct _reent *s; struct _reent *s)
{ {
/* make sure we clean up on exit */ /* make sure we clean up on exit */
s->__cleanup = _cleanup_r; /* conservative */ s->__cleanup = _cleanup_r; /* conservative */
@ -197,50 +198,50 @@ __sinit (s)
__LOCK_INIT_RECURSIVE(static, __sfp_lock); __LOCK_INIT_RECURSIVE(static, __sfp_lock);
void _VOID
__sfp_lock_acquire () _DEFUN_VOID(__sfp_lock_acquire)
{ {
__lock_acquire(__sfp_lock); __lock_acquire_recursive (__sfp_lock);
} }
void _VOID
__sfp_lock_release () _DEFUN_VOID(__sfp_lock_release)
{ {
__lock_release(__sfp_lock); __lock_release_recursive (__sfp_lock);
} }
/* Walkable file locking routine. */ /* Walkable file locking routine. */
static int static int
__fp_lock (ptr) _DEFUN(__fp_lock, (ptr),
FILE * ptr; FILE * ptr)
{ {
_flockfile(ptr); _flockfile (ptr);
return 0; return 0;
} }
/* Walkable file unlocking routine. */ /* Walkable file unlocking routine. */
static int static int
__fp_unlock (ptr) _DEFUN(__fp_unlock, (ptr),
FILE * ptr; FILE * ptr)
{ {
_funlockfile(ptr); _funlockfile (ptr);
return 0; return 0;
} }
void _VOID
__fp_lock_all () _DEFUN_VOID(__fp_lock_all)
{ {
__sfp_lock_acquire (); __sfp_lock_acquire ();
(void) _fwalk (_REENT, __fp_lock); _CAST_VOID _fwalk (_REENT, __fp_lock);
} }
void _VOID
__fp_unlock_all () _DEFUN_VOID(__fp_unlock_all)
{ {
(void) _fwalk (_REENT, __fp_unlock); _CAST_VOID _fwalk (_REENT, __fp_unlock);
__sfp_lock_release (); __sfp_lock_release ();
} }

View File

@ -1,6 +1,24 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fiprintf>>---format output to file (integer only) <<fiprintf>>---format output to file (integer only)
INDEX INDEX
fiprintf fiprintf
@ -38,7 +56,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <_ansi.h> #include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
@ -47,10 +64,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
fiprintf (FILE * fp, const char *fmt,...) fiprintf(FILE * fp, _CONST char *fmt,...)
#else #else
int int
fiprintf (fp, fmt, va_alist) fiprintf(fp, fmt, va_alist)
FILE *fp; FILE *fp;
char *fmt; char *fmt;
va_dcl va_dcl

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92 */
/* /*
* Copyright (c) 1990 Regents of the University of California. * Copyright (c) 1990 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,11 +14,12 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92 */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
@ -31,10 +30,10 @@
*/ */
int int
__sflags (ptr, mode, optr) _DEFUN(__sflags, (ptr, mode, optr),
struct _reent *ptr; struct _reent *ptr _AND
register char *mode; register char *mode _AND
int *optr; int *optr)
{ {
register int ret, m, o; register int ret, m, o;

View File

@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
FILE *fopen(const char *<[file]>, const char *<[mode]>); FILE *fopen(const char *<[file]>, const char *<[mode]>);
FILE *_fopen_r(void *<[reent]>, FILE *_fopen_r(struct _reent *<[reent]>,
const char *<[file]>, const char *<[mode]>); const char *<[file]>, const char *<[mode]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -38,7 +38,7 @@ TRAD_SYNOPSIS
char *<[mode]>; char *<[mode]>;
FILE *_fopen_r(<[reent]>, <[file]>, <[mode]>) FILE *_fopen_r(<[reent]>, <[file]>, <[mode]>)
void *<[reent]>; struct _reent *<[reent]>;
char *<[file]>; char *<[file]>;
char *<[mode]>; char *<[mode]>;
@ -113,16 +113,18 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "local.h" #include <sys/lock.h>
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#include <sys/lock.h> #include "local.h"
FILE * FILE *
_DEFUN (_fopen_r, (ptr, file, mode), _DEFUN(_fopen_r, (ptr, file, mode),
struct _reent *ptr _AND struct _reent *ptr _AND
_CONST char *file _AND _CONST char *file _AND
_CONST char *mode) _CONST char *mode)
@ -147,7 +149,7 @@ _DEFUN (_fopen_r, (ptr, file, mode),
return NULL; return NULL;
} }
_flockfile(fp); _flockfile (fp);
fp->_file = f; fp->_file = f;
fp->_flags = flags; fp->_flags = flags;
@ -165,14 +167,14 @@ _DEFUN (_fopen_r, (ptr, file, mode),
fp->_flags |= __SCLE; fp->_flags |= __SCLE;
#endif #endif
_funlockfile(fp); _funlockfile (fp);
return fp; return fp;
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
FILE * FILE *
_DEFUN (fopen, (file, mode), _DEFUN(fopen, (file, mode),
_CONST char *file _AND _CONST char *file _AND
_CONST char *mode) _CONST char *mode)
{ {

View File

@ -17,7 +17,6 @@
#include <_ansi.h> #include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
@ -26,10 +25,10 @@
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
fprintf (FILE * fp, const char *fmt,...) fprintf(FILE * fp, _CONST char *fmt,...)
#else #else
int int
fprintf (fp, fmt, va_alist) fprintf(fp, fmt, va_alist)
FILE *fp; FILE *fp;
char *fmt; char *fmt;
va_dcl va_dcl

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fputc>>---write a character on a stream or file <<fputc>>---write a character on a stream or file
@ -40,16 +57,17 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
int int
_DEFUN (fputc, (ch, file), _DEFUN(fputc, (ch, file),
int ch _AND int ch _AND
FILE * file) FILE * file)
{ {
int result; int result;
_flockfile(file); _flockfile (file);
result = putc (ch, file); result = putc (ch, file);
_funlockfile(file); _funlockfile (file);
return result; return result;
} }

View File

@ -47,6 +47,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "fvwrite.h" #include "fvwrite.h"
@ -56,7 +57,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
*/ */
int int
_DEFUN (fputs, (s, fp), _DEFUN(fputs, (s, fp),
char _CONST * s _AND char _CONST * s _AND
FILE * fp) FILE * fp)
{ {
@ -68,8 +69,8 @@ _DEFUN (fputs, (s, fp),
iov.iov_len = uio.uio_resid = strlen (s); iov.iov_len = uio.uio_resid = strlen (s);
uio.uio_iov = &iov; uio.uio_iov = &iov;
uio.uio_iovcnt = 1; uio.uio_iovcnt = 1;
_flockfile(fp); _flockfile (fp);
result = __sfvwrite (fp, &uio); result = __sfvwrite (fp, &uio);
_funlockfile(fp); _funlockfile (fp);
return result; return result;
} }

View File

@ -55,13 +55,14 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "local.h" #include "local.h"
#ifdef __SCLE #ifdef __SCLE
static size_t static size_t
_DEFUN (crlf, (fp, buf, count, eof), _DEFUN(crlf, (fp, buf, count, eof),
FILE * fp _AND FILE * fp _AND
char * buf _AND char * buf _AND
size_t count _AND size_t count _AND
@ -84,11 +85,11 @@ _DEFUN (crlf, (fp, buf, count, eof),
{ {
if (*s == '\r') if (*s == '\r')
{ {
int c = __sgetc_raw(fp); int c = __sgetc_raw (fp);
if (c == '\n') if (c == '\n')
*s = '\n'; *s = '\n';
else else
ungetc(c, fp); ungetc (c, fp);
} }
*d++ = *s++; *d++ = *s++;
} }
@ -96,7 +97,7 @@ _DEFUN (crlf, (fp, buf, count, eof),
while (d < e) while (d < e)
{ {
r = getc(fp); r = getc (fp);
if (r == EOF) if (r == EOF)
return count - (e-d); return count - (e-d);
*d++ = r; *d++ = r;
@ -109,7 +110,7 @@ _DEFUN (crlf, (fp, buf, count, eof),
#endif #endif
size_t size_t
_DEFUN (fread, (buf, size, count, fp), _DEFUN(fread, (buf, size, count, fp),
_PTR buf _AND _PTR buf _AND
size_t size _AND size_t size _AND
size_t count _AND size_t count _AND
@ -123,7 +124,7 @@ _DEFUN (fread, (buf, size, count, fp),
if ((resid = count * size) == 0) if ((resid = count * size) == 0)
return 0; return 0;
_flockfile(fp); _flockfile (fp);
if (fp->_r < 0) if (fp->_r < 0)
fp->_r = 0; fp->_r = 0;
total = resid; total = resid;
@ -131,7 +132,7 @@ _DEFUN (fread, (buf, size, count, fp),
while (resid > (r = fp->_r)) while (resid > (r = fp->_r))
{ {
(void) memcpy ((void *) p, (void *) fp->_p, (size_t) r); _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) r);
fp->_p += r; fp->_p += r;
/* fp->_r = 0 ... done in __srefill */ /* fp->_r = 0 ... done in __srefill */
p += r; p += r;
@ -142,24 +143,24 @@ _DEFUN (fread, (buf, size, count, fp),
#ifdef __SCLE #ifdef __SCLE
if (fp->_flags & __SCLE) if (fp->_flags & __SCLE)
{ {
_funlockfile(fp); _funlockfile (fp);
return crlf(fp, buf, total-resid, 1) / size; return crlf (fp, buf, total-resid, 1) / size;
} }
#endif #endif
_funlockfile(fp); _funlockfile (fp);
return (total - resid) / size; return (total - resid) / size;
} }
} }
(void) memcpy ((void *) p, (void *) fp->_p, resid); _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, resid);
fp->_r -= resid; fp->_r -= resid;
fp->_p += resid; fp->_p += resid;
#ifdef __SCLE #ifdef __SCLE
if (fp->_flags & __SCLE) if (fp->_flags & __SCLE)
{ {
_funlockfile(fp); _funlockfile (fp);
return crlf(fp, buf, total, 0) / size; return crlf(fp, buf, total, 0) / size;
} }
#endif #endif
_funlockfile(fp); _funlockfile (fp);
return count; return count;
} }

View File

@ -66,19 +66,21 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<open>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<open>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include "local.h"
#include <sys/lock.h> #include <sys/lock.h>
#include "local.h"
/* /*
* Re-direct an existing, open (probably) file to some other file. * Re-direct an existing, open (probably) file to some other file.
*/ */
FILE * FILE *
_DEFUN (_freopen_r, (ptr, file, mode, fp), _DEFUN(_freopen_r, (ptr, file, mode, fp),
struct _reent *ptr _AND struct _reent *ptr _AND
_CONST char *file _AND _CONST char *file _AND
_CONST char *mode _AND _CONST char *mode _AND
@ -89,14 +91,14 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
__sfp_lock_acquire (); __sfp_lock_acquire ();
_flockfile(fp); _flockfile (fp);
CHECK_INIT (fp); CHECK_INIT (fp);
if ((flags = __sflags (ptr, mode, &oflags)) == 0) if ((flags = __sflags (ptr, mode, &oflags)) == 0)
{ {
_funlockfile(fp); _funlockfile (fp);
(void) _fclose_r (ptr, fp); _CAST_VOID _fclose_r (ptr, fp);
__sfp_lock_release (); __sfp_lock_release ();
return NULL; return NULL;
} }
@ -114,10 +116,10 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
else else
{ {
if (fp->_flags & __SWR) if (fp->_flags & __SWR)
(void) fflush (fp); _CAST_VOID fflush (fp);
/* if close is NULL, closing is a no-op, hence pointless */ /* if close is NULL, closing is a no-op, hence pointless */
if (fp->_close != NULL) if (fp->_close != NULL)
(void) (*fp->_close) (fp->_cookie); _CAST_VOID (*fp->_close) (fp->_cookie);
} }
/* /*
@ -153,7 +155,7 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
{ /* did not get it after all */ { /* did not get it after all */
fp->_flags = 0; /* set it free */ fp->_flags = 0; /* set it free */
ptr->_errno = e; /* restore in case _close clobbered */ ptr->_errno = e; /* restore in case _close clobbered */
_funlockfile(fp); _funlockfile (fp);
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock); __lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock);
#endif #endif
@ -170,11 +172,11 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
fp->_close = __sclose; fp->_close = __sclose;
#ifdef __SCLE #ifdef __SCLE
if (__stextmode(fp->_file)) if (__stextmode (fp->_file))
fp->_flags |= __SCLE; fp->_flags |= __SCLE;
#endif #endif
_funlockfile(fp); _funlockfile (fp);
__sfp_lock_release (); __sfp_lock_release ();
return fp; return fp;
} }
@ -182,7 +184,7 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
FILE * FILE *
_DEFUN (freopen, (file, mode, fp), _DEFUN(freopen, (file, mode, fp),
_CONST char *file _AND _CONST char *file _AND
_CONST char *mode _AND _CONST char *mode _AND
register FILE *fp) register FILE *fp)

View File

@ -16,23 +16,22 @@
*/ */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
#include <varargs.h> #include <varargs.h>
#endif #endif
#include "local.h" #include "local.h"
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
fscanf (FILE *fp, const char *fmt, ...) fscanf(FILE *fp, _CONST char *fmt, ...)
#else #else
fscanf (FILE *fp, fmt, va_alist) fscanf(FILE *fp, fmt, va_alist)
FILE *fp; FILE *fp;
char *fmt; char *fmt;
va_dcl va_dcl
@ -55,9 +54,9 @@ fscanf (FILE *fp, fmt, va_alist)
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_fscanf_r (struct _reent *ptr, FILE *fp, const char *fmt, ...) _fscanf_r(struct _reent *ptr, FILE *fp, _CONST char *fmt, ...)
#else #else
_fscanf_r (ptr, FILE *fp, fmt, va_alist) _fscanf_r(ptr, FILE *fp, fmt, va_alist)
struct _reent *ptr; struct _reent *ptr;
FILE *fp; FILE *fp;
char *fmt; char *fmt;

View File

@ -98,6 +98,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <fcntl.h> #include <fcntl.h>
@ -114,19 +116,20 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
*/ */
int int
_DEFUN (_fseek_r, (ptr, fp, offset, whence), _DEFUN(_fseek_r, (ptr, fp, offset, whence),
struct _reent *ptr _AND struct _reent *ptr _AND
register FILE *fp _AND register FILE *fp _AND
long offset _AND long offset _AND
int whence) int whence)
{ {
_fpos_t _EXFUN ((*seekfn), (void *, _fpos_t, int)); _fpos_t _EXFUN((*seekfn), (_PTR, _fpos_t, int));
_fpos_t target, curoff; _fpos_t target;
_fpos_t curoff = 0;
size_t n; size_t n;
struct stat st; struct stat st;
int havepos; int havepos;
_flockfile(fp); _flockfile (fp);
/* Make sure stdio is set up. */ /* Make sure stdio is set up. */
@ -146,7 +149,7 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
if ((seekfn = fp->_seek) == NULL) if ((seekfn = fp->_seek) == NULL)
{ {
ptr->_errno = ESPIPE; /* ??? */ ptr->_errno = ESPIPE; /* ??? */
_funlockfile(fp); _funlockfile (fp);
return EOF; return EOF;
} }
@ -163,7 +166,7 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
* we have to first find the current stream offset a la * we have to first find the current stream offset a la
* ftell (see ftell for details). * ftell (see ftell for details).
*/ */
fflush(fp); /* may adjust seek offset on append stream */ fflush (fp); /* may adjust seek offset on append stream */
if (fp->_flags & __SOFF) if (fp->_flags & __SOFF)
curoff = fp->_offset; curoff = fp->_offset;
else else
@ -171,7 +174,7 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
curoff = (*seekfn) (fp->_cookie, (_fpos_t) 0, SEEK_CUR); curoff = (*seekfn) (fp->_cookie, (_fpos_t) 0, SEEK_CUR);
if (curoff == -1L) if (curoff == -1L)
{ {
_funlockfile(fp); _funlockfile (fp);
return EOF; return EOF;
} }
} }
@ -196,7 +199,7 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
default: default:
ptr->_errno = EINVAL; ptr->_errno = EINVAL;
_funlockfile(fp); _funlockfile (fp);
return (EOF); return (EOF);
} }
@ -306,7 +309,7 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
if (HASUB (fp)) if (HASUB (fp))
FREEUB (fp); FREEUB (fp);
fp->_flags &= ~__SEOF; fp->_flags &= ~__SEOF;
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
} }
@ -335,7 +338,7 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
fp->_p += n; fp->_p += n;
fp->_r -= n; fp->_r -= n;
} }
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
/* /*
@ -346,7 +349,7 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
dumb: dumb:
if (fflush (fp) || (*seekfn) (fp->_cookie, offset, whence) == POS_ERR) if (fflush (fp) || (*seekfn) (fp->_cookie, offset, whence) == POS_ERR)
{ {
_funlockfile(fp); _funlockfile (fp);
return EOF; return EOF;
} }
/* success: clear EOF indicator and discard ungetc() data */ /* success: clear EOF indicator and discard ungetc() data */
@ -356,14 +359,14 @@ dumb:
fp->_r = 0; fp->_r = 0;
/* fp->_w = 0; *//* unnecessary (I think...) */ /* fp->_w = 0; *//* unnecessary (I think...) */
fp->_flags &= ~__SEOF; fp->_flags &= ~__SEOF;
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (fseek, (fp, offset, whence), _DEFUN(fseek, (fp, offset, whence),
register FILE *fp _AND register FILE *fp _AND
long offset _AND long offset _AND
int whence) int whence)

View File

@ -15,10 +15,12 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
int int
_DEFUN (_fseeko_r, (ptr, fp, offset, whence), _DEFUN(_fseeko_r, (ptr, fp, offset, whence),
struct _reent *ptr _AND struct _reent *ptr _AND
register FILE *fp _AND register FILE *fp _AND
_off_t offset _AND _off_t offset _AND
@ -30,10 +32,10 @@ _DEFUN (_fseeko_r, (ptr, fp, offset, whence),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
fseeko (fp, offset, whence) _DEFUN(fseeko, (fp, offset, whence),
register FILE *fp; register FILE *fp _AND
_off_t offset; _off_t offset _AND
int whence; int whence)
{ {
/* for now we simply cast since off_t should be long */ /* for now we simply cast since off_t should be long */
return _fseek_r (_REENT, fp, (long)offset, whence); return _fseek_r (_REENT, fp, (long)offset, whence);

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<fsetpos>>---restore position of a stream or file <<fsetpos>>---restore position of a stream or file
@ -48,10 +65,12 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
int int
_DEFUN (_fsetpos_r, (ptr, iop, pos), _DEFUN(_fsetpos_r, (ptr, iop, pos),
struct _reent * ptr _AND struct _reent * ptr _AND
FILE * iop _AND FILE * iop _AND
_CONST _fpos_t * pos) _CONST _fpos_t * pos)
@ -66,7 +85,7 @@ _DEFUN (_fsetpos_r, (ptr, iop, pos),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (fsetpos, (iop, pos), _DEFUN(fsetpos, (iop, pos),
FILE * iop _AND FILE * iop _AND
_CONST _fpos_t * pos) _CONST _fpos_t * pos)
{ {

View File

@ -92,19 +92,20 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* ftell: return current offset. * ftell: return current offset.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "local.h" #include "local.h"
long long
_DEFUN (_ftell_r, (ptr, fp), _DEFUN(_ftell_r, (ptr, fp),
struct _reent *ptr _AND struct _reent *ptr _AND
register FILE * fp) register FILE * fp)
{ {
_fpos_t pos; _fpos_t pos;
_flockfile(fp); _flockfile (fp);
/* Ensure stdio is set up. */ /* Ensure stdio is set up. */
@ -113,7 +114,7 @@ _DEFUN (_ftell_r, (ptr, fp),
if (fp->_seek == NULL) if (fp->_seek == NULL)
{ {
ptr->_errno = ESPIPE; ptr->_errno = ESPIPE;
_funlockfile(fp); _funlockfile (fp);
return -1L; return -1L;
} }
@ -127,7 +128,7 @@ _DEFUN (_ftell_r, (ptr, fp),
pos = (*fp->_seek) (fp->_cookie, (_fpos_t) 0, SEEK_CUR); pos = (*fp->_seek) (fp->_cookie, (_fpos_t) 0, SEEK_CUR);
if (pos == -1L) if (pos == -1L)
{ {
_funlockfile(fp); _funlockfile (fp);
return pos; return pos;
} }
} }
@ -152,14 +153,14 @@ _DEFUN (_ftell_r, (ptr, fp),
pos += fp->_p - fp->_bf._base; pos += fp->_p - fp->_bf._base;
} }
_funlockfile(fp); _funlockfile (fp);
return pos; return pos;
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
long long
_DEFUN (ftell, (fp), _DEFUN(ftell, (fp),
register FILE * fp) register FILE * fp)
{ {
return _ftell_r (_REENT, fp); return _ftell_r (_REENT, fp);

View File

@ -15,10 +15,12 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
_off_t _off_t
_DEFUN (_ftello_r, (ptr, fp), _DEFUN(_ftello_r, (ptr, fp),
struct _reent * ptr _AND struct _reent * ptr _AND
register FILE * fp) register FILE * fp)
{ {
@ -29,7 +31,7 @@ _DEFUN (_ftello_r, (ptr, fp),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
_off_t _off_t
_DEFUN (ftello, (fp), _DEFUN(ftello, (fp),
register FILE * fp) register FILE * fp)
{ {
return (_off_t)_ftell_r (_REENT, fp); return (_off_t)_ftell_r (_REENT, fp);

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,7 +14,9 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92. */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -24,7 +24,7 @@
#include "fvwrite.h" #include "fvwrite.h"
#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b))
#define COPY(n) (void) memmove((void *) fp->_p, (void *) p, (size_t) (n)) #define COPY(n) _CAST_VOID memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (n))
#define GETIOV(extra_work) \ #define GETIOV(extra_work) \
while (len == 0) \ while (len == 0) \
@ -43,12 +43,12 @@
*/ */
int int
__sfvwrite (fp, uio) _DEFUN(__sfvwrite, (fp, uio),
register FILE *fp; register FILE *fp _AND
register struct __suio *uio; register struct __suio *uio)
{ {
register size_t len; register size_t len;
register _CONST char *p; register _CONST char *p = NULL;
register struct __siov *iov; register struct __siov *iov;
register int w, s; register int w, s;
char *nl; char *nl;
@ -72,7 +72,7 @@ __sfvwrite (fp, uio)
GETIOV (;); GETIOV (;);
while (len > 0) while (len > 0)
{ {
if (putc(*p, fp) == EOF) if (putc (*p, fp) == EOF)
return EOF; return EOF;
p++; p++;
len--; len--;
@ -181,12 +181,13 @@ __sfvwrite (fp, uio)
* that the amount to write is MIN(len,nldist). * that the amount to write is MIN(len,nldist).
*/ */
nlknown = 0; nlknown = 0;
nldist = 0;
do do
{ {
GETIOV (nlknown = 0); GETIOV (nlknown = 0);
if (!nlknown) if (!nlknown)
{ {
nl = memchr ((void *) p, '\n', len); nl = memchr ((_PTR) p, '\n', len);
nldist = nl ? nl + 1 - p : len + 1; nldist = nl ? nl + 1 - p : len + 1;
nlknown = 1; nlknown = 1;
} }

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,20 +14,23 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92. */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include "local.h" #include "local.h"
static int static int
__fwalk (ptr, function) _DEFUN(__fwalk, (ptr, function),
struct _reent *ptr; struct _reent *ptr _AND
register int (*function) (); register int (*function) ())
{ {
register FILE *fp; register FILE *fp;
register int n, ret = 0; register int n, ret = 0;
@ -51,9 +52,9 @@ __fwalk (ptr, function)
/* Special version of __fwalk where the function pointer is a reentrant /* Special version of __fwalk where the function pointer is a reentrant
I/O function (e.g. _fclose_r). */ I/O function (e.g. _fclose_r). */
static int static int
__fwalk_reent (ptr, reent_function) _DEFUN(__fwalk_reent, (ptr, reent_function),
struct _reent *ptr; struct _reent *ptr _AND
register int (*reent_function) (); register int (*reent_function) ())
{ {
register FILE *fp; register FILE *fp;
register int n, ret = 0; register int n, ret = 0;
@ -73,9 +74,9 @@ __fwalk_reent (ptr, reent_function)
} }
int int
_fwalk (ptr, function) _DEFUN(_fwalk, (ptr, function),
struct _reent *ptr; struct _reent *ptr _AND
register int (*function) (); register int (*function)())
{ {
register int ret = 0; register int ret = 0;
@ -96,9 +97,9 @@ _fwalk (ptr, function)
/* Special version of _fwalk which handles a function pointer to a /* Special version of _fwalk which handles a function pointer to a
reentrant I/O function (e.g. _fclose_r). */ reentrant I/O function (e.g. _fclose_r). */
int int
_fwalk_reent (ptr, reent_function) _DEFUN(_fwalk_reent, (ptr, reent_function),
struct _reent *ptr; struct _reent *ptr _AND
register int (*reent_function) (); register int (*reent_function) ())
{ {
register int ret = 0; register int ret = 0;

View File

@ -61,6 +61,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#if 0 #if 0
@ -77,7 +78,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/ */
size_t size_t
_DEFUN (fwrite, (buf, size, count, fp), _DEFUN(fwrite, (buf, size, count, fp),
_CONST _PTR buf _AND _CONST _PTR buf _AND
size_t size _AND size_t size _AND
size_t count _AND size_t count _AND
@ -98,12 +99,12 @@ _DEFUN (fwrite, (buf, size, count, fp),
* generally slow and since this occurs whenever size==0. * generally slow and since this occurs whenever size==0.
*/ */
_flockfile(fp); _flockfile (fp);
if (__sfvwrite (fp, &uio) == 0) if (__sfvwrite (fp, &uio) == 0)
{ {
_funlockfile(fp); _funlockfile (fp);
return count; return count;
} }
_funlockfile(fp); _funlockfile (fp);
return (n - uio.uio_resid) / size; return (n - uio.uio_resid) / size;
} }

View File

@ -62,6 +62,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
/* /*
@ -71,13 +72,13 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef getc #undef getc
int int
getc (fp) _DEFUN(getc, (fp),
register FILE *fp; register FILE *fp)
{ {
int result; int result;
_flockfile(fp); _flockfile (fp);
/* CHECK_INIT is called (eventually) by __srefill. */ /* CHECK_INIT is called (eventually) by __srefill. */
result = __sgetc (fp); result = __sgetc (fp);
_funlockfile(fp); _funlockfile (fp);
return result; return result;
} }

View File

@ -50,6 +50,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
/* /*
@ -59,8 +60,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef getc_unlocked #undef getc_unlocked
int int
getc_unlocked (fp) _DEFUN(getc_unlocked, (fp),
register FILE *fp; register FILE *fp)
{ {
/* CHECK_INIT is called (eventually) by __srefill. */ /* CHECK_INIT is called (eventually) by __srefill. */

View File

@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int getchar(void); int getchar(void);
int _getchar_r(void *<[reent]>); int _getchar_r(struct _reent *<[reent]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -71,25 +71,25 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro getchar. * A subroutine version of the macro getchar.
*/ */
#include <stdio.h> #include <_ansi.h>
#include <reent.h> #include <reent.h>
#include <stdio.h>
#include "local.h" #include "local.h"
#undef getchar #undef getchar
int int
_getchar_r (f) _DEFUN(_getchar_r, (f),
struct _reent *f; struct _reent *f)
{ {
_REENT_SMALL_CHECK_INIT(_stdin_r (f)); _REENT_SMALL_CHECK_INIT (_stdin_r (f));
return getc (_stdin_r (f)); return getc (_stdin_r (f));
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
getchar () _DEFUN_VOID(getchar)
{ {
/* CHECK_INIT is called (eventually) by __srefill. */ /* CHECK_INIT is called (eventually) by __srefill. */

View File

@ -54,14 +54,15 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro getchar_unlocked. * A subroutine version of the macro getchar_unlocked.
*/ */
#include <stdio.h> #include <_ansi.h>
#include <reent.h> #include <reent.h>
#include <stdio.h>
#undef getchar_unlocked #undef getchar_unlocked
int int
_getchar_unlocked_r (f) _DEFUN(_getchar_unlocked_r, (f),
struct _reent *f; struct _reent *f)
{ {
return getc_unlocked (_stdin_r (f)); return getc_unlocked (_stdin_r (f));
} }
@ -69,7 +70,7 @@ _getchar_unlocked_r (f)
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
getchar_unlocked () _DEFUN_VOID(getchar_unlocked)
{ {
/* CHECK_INIT is called (eventually) by __srefill. */ /* CHECK_INIT is called (eventually) by __srefill. */

View File

@ -1,3 +1,4 @@
/* Copyright 2002, Red Hat Inc. - all rights reserved */
/* /*
FUNCTION FUNCTION
<<getdelim>>---read a line up to a specified line delimeter <<getdelim>>---read a line up to a specified line delimeter
@ -37,8 +38,7 @@ PORTABILITY
No supporting OS subroutines are directly required. No supporting OS subroutines are directly required.
*/ */
/* Copyright 2002, Red Hat Inc. - all rights reserved */ #include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
@ -48,11 +48,11 @@ No supporting OS subroutines are directly required.
#define DEFAULT_LINE_SIZE 128 #define DEFAULT_LINE_SIZE 128
ssize_t ssize_t
__getdelim (bufptr, n, delim, fp) _DEFUN(__getdelim, (bufptr, n, delim, fp),
char **bufptr; char **bufptr _AND
size_t *n; size_t *n _AND
int delim; int delim _AND
FILE *fp; FILE *fp)
{ {
char *buf; char *buf;
char *ptr; char *ptr;
@ -79,9 +79,9 @@ __getdelim (bufptr, n, delim, fp)
*n = DEFAULT_LINE_SIZE; *n = DEFAULT_LINE_SIZE;
} }
_flockfile(fp); _flockfile (fp);
CHECK_INIT(fp); CHECK_INIT (fp);
numbytes = *n; numbytes = *n;
ptr = buf; ptr = buf;

View File

@ -1,3 +1,4 @@
/* Copyright 2002, Red Hat Inc. - all rights reserved */
/* /*
FUNCTION FUNCTION
<<getline>>---read a line from a file <<getline>>---read a line from a file
@ -37,17 +38,16 @@ PORTABILITY
No supporting OS subroutines are directly required. No supporting OS subroutines are directly required.
*/ */
/* Copyright 2002, Red Hat Inc. - all rights reserved */ #include <_ansi.h>
#include <stdio.h> #include <stdio.h>
extern ssize_t __getdelim (char **, size_t *, int, FILE *); extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
ssize_t ssize_t
__getline (lptr, n, fp) _DEFUN(__getline, (lptr, n, fp),
char **lptr; char **lptr _AND
size_t *n; size_t *n _AND
FILE *fp; FILE *fp)
{ {
return __getdelim (lptr, n, '\n', fp); return __getdelim (lptr, n, '\n', fp);
} }

View File

@ -15,11 +15,10 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* /*
FUNCTION FUNCTION
<<gets>>---get character string (obsolete, use <<fgets>> instead) <<gets>>---get character string (obsolete, use <<fgets>> instead)
INDEX INDEX
gets gets
INDEX INDEX
@ -30,7 +29,7 @@ ANSI_SYNOPSIS
char *gets(char *<[buf]>); char *gets(char *<[buf]>);
char *_gets_r(void *<[reent]>, char *<[buf]>); char *_gets_r(struct _reent *<[reent]>, char *<[buf]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -39,7 +38,7 @@ TRAD_SYNOPSIS
char *<[buf]>; char *<[buf]>;
char *_gets_r(<[reent]>, <[buf]>) char *_gets_r(<[reent]>, <[buf]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[buf]>; char *<[buf]>;
DESCRIPTION DESCRIPTION
@ -68,12 +67,14 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
char * char *
_gets_r (ptr, buf) _DEFUN(_gets_r, (ptr, buf),
struct _reent *ptr; struct _reent *ptr _AND
char *buf; char *buf)
{ {
register int c; register int c;
register char *s = buf; register char *s = buf;
@ -93,8 +94,8 @@ _gets_r (ptr, buf)
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
char * char *
gets (buf) _DEFUN(gets, (buf),
char *buf; char *buf)
{ {
return _gets_r (_REENT, buf); return _gets_r (_REENT, buf);
} }

View File

@ -54,14 +54,15 @@ Supporting OS subroutines required: <<fread>>. */
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
int int
getw (fp) _DEFUN(getw, (fp),
register FILE *fp; register FILE *fp)
{ {
int result; int result;
if (fread((char*)&result, sizeof(result), 1, fp) != 1) if (fread ((char*)&result, sizeof (result), 1, fp) != 1)
return EOF; return EOF;
return result; return result;
} }

View File

@ -1,6 +1,24 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<iprintf>>---write formatted output (integer only) <<iprintf>>---write formatted output (integer only)
INDEX INDEX
iprintf iprintf
@ -36,24 +54,23 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
*/ */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include "local.h"
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
#include <varargs.h> #include <varargs.h>
#endif #endif
#include "local.h"
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
iprintf (const char *fmt,...) iprintf(_CONST char *fmt,...)
#else #else
int int
iprintf (fmt, va_alist) iprintf(fmt, va_alist)
char *fmt; char *fmt;
va_dcl va_dcl
#endif #endif
@ -61,7 +78,7 @@ iprintf (fmt, va_alist)
int ret; int ret;
va_list ap; va_list ap;
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT)); _REENT_SMALL_CHECK_INIT (_stdout_r (_REENT));
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
va_start (ap, fmt); va_start (ap, fmt);
#else #else
@ -76,10 +93,10 @@ iprintf (fmt, va_alist)
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
_iprintf_r (struct _reent *ptr, const char *fmt, ...) _iprintf_r(struct _reent *ptr, _CONST char *fmt, ...)
#else #else
int int
_iprintf_r (data, fmt, va_alist) _iprintf_r(data, fmt, va_alist)
char *data; char *data;
char *fmt; char *fmt;
va_dcl va_dcl
@ -88,7 +105,7 @@ _iprintf_r (data, fmt, va_alist)
int ret; int ret;
va_list ap; va_list ap;
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr)); _REENT_SMALL_CHECK_INIT (_stdout_r (ptr));
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
va_start (ap, fmt); va_start (ap, fmt);
#else #else

View File

@ -23,6 +23,7 @@
*/ */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdarg.h> #include <stdarg.h>
#include <reent.h> #include <reent.h>
#include <unistd.h> #include <unistd.h>
@ -31,15 +32,16 @@ extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list
extern FILE *_EXFUN(__sfp,(struct _reent *)); extern FILE *_EXFUN(__sfp,(struct _reent *));
extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*));
extern int _EXFUN(__srefill,(FILE *)); extern int _EXFUN(__srefill,(FILE *));
extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(void *, char *, int)); extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(_PTR, char *, int));
extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(void *, char const *, int)); extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(_PTR, char _CONST *, int));
extern _fpos_t _EXFUN(__sseek,(void *, _fpos_t, int)); extern _fpos_t _EXFUN(__sseek,(_PTR, _fpos_t, int));
extern int _EXFUN(__sclose,(void *)); extern int _EXFUN(__sclose,(_PTR));
extern int _EXFUN(__stextmode,(int)); extern int _EXFUN(__stextmode,(int));
extern void _EXFUN(__sinit,(struct _reent *)); extern _VOID _EXFUN(__sinit,(struct _reent *));
extern void _EXFUN(_cleanup_r,(struct _reent *)); extern _VOID _EXFUN(_cleanup_r,(struct _reent *));
extern void _EXFUN(__smakebuf,(FILE *)); extern _VOID _EXFUN(__smakebuf,(FILE *));
extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *))); extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *)));
extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(FILE *)));
struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n)); struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n));
extern int _EXFUN(__srefill,(FILE *fp)); extern int _EXFUN(__srefill,(FILE *fp));
@ -92,6 +94,6 @@ char *_EXFUN(_llicvt,(char *, long long, char));
#define __sfp_lock_acquire() #define __sfp_lock_acquire()
#define __sfp_lock_release() #define __sfp_lock_release()
#else #else
void _EXFUN(__sfp_lock_acquire,(void)); _VOID _EXFUN(__sfp_lock_acquire,(_VOID));
void _EXFUN(__sfp_lock_release,(void)); _VOID _EXFUN(__sfp_lock_release,(_VOID));
#endif #endif

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,13 +14,14 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92. */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/unistd.h> #include <sys/unistd.h>
#include "local.h" #include "local.h"
/* /*
@ -33,9 +32,9 @@
* optimization) right after the _fstat() that finds the buffer size. * optimization) right after the _fstat() that finds the buffer size.
*/ */
void _VOID
__smakebuf (fp) _DEFUN(__smakebuf, (fp),
register FILE *fp; register FILE *fp)
{ {
register size_t size, couldbetty; register size_t size, couldbetty;
register _PTR p; register _PTR p;

View File

@ -1,8 +1,3 @@
/* This is file MKTEMP.C */
/* This file may have been modified by DJ Delorie (Jan 1991). If so,
** these modifications are Copyright (C) 1991 DJ Delorie.
*/
/* /*
* Copyright (c) 1987 Regents of the University of California. * Copyright (c) 1987 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -21,6 +16,10 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* This is file MKTEMP.C */
/* This file may have been modified by DJ Delorie (Jan 1991). If so,
** these modifications are Copyright (C) 1991 DJ Delorie.
*/
/* /*
FUNCTION FUNCTION
@ -40,8 +39,8 @@ ANSI_SYNOPSIS
char *mktemp(char *<[path]>); char *mktemp(char *<[path]>);
int mkstemp(char *<[path]>); int mkstemp(char *<[path]>);
char *_mktemp_r(void *<[reent]>, char *<[path]>); char *_mktemp_r(struct _reent *<[reent]>, char *<[path]>);
int *_mkstemp_r(void *<[reent]>, char *<[path]>); int *_mkstemp_r(struct _reent *<[reent]>, char *<[path]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -52,11 +51,11 @@ TRAD_SYNOPSIS
char *<[path]>; char *<[path]>;
char *_mktemp_r(<[reent]>, <[path]>) char *_mktemp_r(<[reent]>, <[path]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[path]>; char *<[path]>;
int _mkstemp_r(<[reent]>, <[path]>) int _mkstemp_r(<[reent]>, <[path]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[path]>; char *<[path]>;
DESCRIPTION DESCRIPTION
@ -93,16 +92,17 @@ V Interface Definition requires <<mktemp>> as of Issue 2.
Supporting OS subroutines required: <<getpid>>, <<open>>, <<stat>>. Supporting OS subroutines required: <<getpid>>, <<open>>, <<stat>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <reent.h>
static int static int
_DEFUN (_gettemp, (ptr, path, doopen), _DEFUN(_gettemp, (ptr, path, doopen),
struct _reent *ptr _AND struct _reent *ptr _AND
char *path _AND char *path _AND
register int *doopen) register int *doopen)
@ -190,7 +190,7 @@ _DEFUN (_gettemp, (ptr, path, doopen),
} }
int int
_DEFUN (_mkstemp_r, (ptr, path), _DEFUN(_mkstemp_r, (ptr, path),
struct _reent *ptr _AND struct _reent *ptr _AND
char *path) char *path)
{ {
@ -200,7 +200,7 @@ _DEFUN (_mkstemp_r, (ptr, path),
} }
char * char *
_DEFUN (_mktemp_r, (ptr, path), _DEFUN(_mktemp_r, (ptr, path),
struct _reent *ptr _AND struct _reent *ptr _AND
char *path) char *path)
{ {
@ -210,7 +210,7 @@ _DEFUN (_mktemp_r, (ptr, path),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (mkstemp, (path), _DEFUN(mkstemp, (path),
char *path) char *path)
{ {
int fd; int fd;
@ -219,7 +219,7 @@ _DEFUN (mkstemp, (path),
} }
char * char *
_DEFUN (mktemp, (path), _DEFUN(mktemp, (path),
char *path) char *path)
{ {
return (_gettemp (_REENT, path, (int *) NULL) ? path : (char *) NULL); return (_gettemp (_REENT, path, (int *) NULL) ? path : (char *) NULL);

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<perror>>---print an error message on standard error <<perror>>---print an error message on standard error
@ -11,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
void perror(char *<[prefix]>); void perror(char *<[prefix]>);
void _perror_r(void *<[reent]>, char *<[prefix]>); void _perror_r(struct _reent *<[reent]>, char *<[prefix]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -19,7 +36,7 @@ TRAD_SYNOPSIS
char *<[prefix]>; char *<[prefix]>;
void _perror_r(<[reent]>, <[prefix]>) void _perror_r(<[reent]>, <[prefix]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[prefix]>; char *<[prefix]>;
DESCRIPTION DESCRIPTION
@ -33,7 +50,6 @@ of the strings described for <<strerror>>.
The alternate function <<_perror_r>> is a reentrant version. The The alternate function <<_perror_r>> is a reentrant version. The
extra argument <[reent]> is a pointer to a reentrancy structure. extra argument <[reent]> is a pointer to a reentrancy structure.
RETURNS RETURNS
<<perror>> returns no result. <<perror>> returns no result.
@ -45,20 +61,20 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <stddef.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "local.h" #include "local.h"
void _VOID
_DEFUN (_perror_r, (ptr, s), _DEFUN(_perror_r, (ptr, s),
struct _reent *ptr _AND struct _reent *ptr _AND
_CONST char *s) _CONST char *s)
{ {
char *error; char *error;
_REENT_SMALL_CHECK_INIT(_stderr_r (ptr)); _REENT_SMALL_CHECK_INIT (_stderr_r (ptr));
if (s != NULL && *s != '\0') if (s != NULL && *s != '\0')
{ {
fputs (s, _stderr_r (ptr)); fputs (s, _stderr_r (ptr));
@ -73,8 +89,8 @@ _DEFUN (_perror_r, (ptr, s),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
void _VOID
_DEFUN (perror, (s), _DEFUN(perror, (s),
_CONST char *s) _CONST char *s)
{ {
_perror_r (_REENT, s); _perror_r (_REENT, s);

View File

@ -1,21 +1,36 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include "local.h"
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
#include <varargs.h> #include <varargs.h>
#endif #endif
#include "local.h"
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
_printf_r (struct _reent *ptr, const char *fmt, ...) _printf_r(struct _reent *ptr, _CONST char *fmt, ...)
#else #else
int int
_printf_r (ptr, fmt, va_alist) _printf_r(ptr, fmt, va_alist)
struct _reent *ptr; struct _reent *ptr;
char *fmt; char *fmt;
va_dcl va_dcl
@ -24,7 +39,7 @@ _printf_r (ptr, fmt, va_alist)
int ret; int ret;
va_list ap; va_list ap;
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr)); _REENT_SMALL_CHECK_INIT (_stdout_r (ptr));
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
va_start (ap, fmt); va_start (ap, fmt);
#else #else
@ -39,10 +54,10 @@ _printf_r (ptr, fmt, va_alist)
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
printf (const char *fmt, ...) printf(_CONST char *fmt, ...)
#else #else
int int
printf (fmt, va_alist) printf(fmt, va_alist)
char *fmt; char *fmt;
va_dcl va_dcl
#endif #endif
@ -50,7 +65,7 @@ printf (fmt, va_alist)
int ret; int ret;
va_list ap; va_list ap;
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT)); _REENT_SMALL_CHECK_INIT (_stdout_r (_REENT));
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
va_start (ap, fmt); va_start (ap, fmt);
#else #else

View File

@ -65,6 +65,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
/* /*
@ -74,14 +75,14 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef putc #undef putc
int int
putc (c, fp) _DEFUN(putc, (c, fp),
int c; int c _AND
register FILE *fp; register FILE *fp)
{ {
int result; int result;
_flockfile(fp); _flockfile (fp);
/* CHECK_INIT is (eventually) called by __swbuf. */ /* CHECK_INIT is (eventually) called by __swbuf. */
result = __sputc (c, fp); result = __sputc (c, fp);
_funlockfile(fp); _funlockfile (fp);
return result; return result;
} }

View File

@ -44,12 +44,14 @@ POSIX 1003.1 requires <<putc_unlocked>>. <<putc_unlocked>> may be
implemented as a macro, so arguments should not have side-effects. implemented as a macro, so arguments should not have side-effects.
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. */ <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
/* /*
@ -59,9 +61,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef putc_unlocked #undef putc_unlocked
int int
putc_unlocked (c, fp) _DEFUN(putc_unlocked, (c, fp),
int c; int c _AND
register FILE *fp; register FILE *fp)
{ {
/* CHECK_INIT is (eventually) called by __swbuf. */ /* CHECK_INIT is (eventually) called by __swbuf. */

View File

@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int putchar(int <[ch]>); int putchar(int <[ch]>);
int _putchar_r(void *<[reent]>, int <[ch]>); int _putchar_r(struct _reent *<[reent]>, int <[ch]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -36,7 +36,7 @@ TRAD_SYNOPSIS
int <[ch]>; int <[ch]>;
int _putchar_r(<[reent]>, <[ch]>) int _putchar_r(<[reent]>, <[ch]>)
char *<[reent]>; struct _reent *<[reent]>;
int <[ch]>; int <[ch]>;
DESCRIPTION DESCRIPTION
@ -68,26 +68,27 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro putchar. * A subroutine version of the macro putchar.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"
#undef putchar #undef putchar
int int
_putchar_r (ptr, c) _DEFUN(_putchar_r, (ptr, c),
struct _reent *ptr; struct _reent *ptr _AND
int c; int c)
{ {
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr)); _REENT_SMALL_CHECK_INIT (_stdout_r (ptr));
return putc (c, _stdout_r (ptr)); return putc (c, _stdout_r (ptr));
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
putchar (c) _DEFUN(putchar, (c),
int c; int c)
{ {
/* CHECK_INIT is (eventually) called by __swbuf. */ /* CHECK_INIT is (eventually) called by __swbuf. */

View File

@ -54,14 +54,16 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro putchar_unlocked. * A subroutine version of the macro putchar_unlocked.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#undef putchar_unlocked #undef putchar_unlocked
int int
_putchar_unlocked_r (ptr, c) _DEFUN(_putchar_unlocked_r, (ptr, c),
struct _reent *ptr; struct _reent *ptr _AND
int c; int c)
{ {
return putc_unlocked (c, _stdout_r (ptr)); return putc_unlocked (c, _stdout_r (ptr));
} }
@ -69,12 +71,12 @@ _putchar_unlocked_r (ptr, c)
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
putchar_unlocked (c) _DEFUN(putchar_unlocked, (c),
int c; int c)
{ {
/* CHECK_INIT is (eventually) called by __swbuf. */ /* CHECK_INIT is (eventually) called by __swbuf. */
_putchar_unlocked_r (_REENT, c); return _putchar_unlocked_r (_REENT, c);
} }
#endif #endif

View File

@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int puts(const char *<[s]>); int puts(const char *<[s]>);
int _puts_r(void *<[reent]>, const char *<[s]>); int _puts_r(struct _reent *<[reent]>, const char *<[s]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -36,7 +36,7 @@ TRAD_SYNOPSIS
char *<[s]>; char *<[s]>;
int _puts_r(<[reent]>, <[s]>) int _puts_r(<[reent]>, <[s]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[s]>; char *<[s]>;
DESCRIPTION DESCRIPTION
@ -55,15 +55,17 @@ ANSI C requires <<puts>>, but does not specify that the result on
success must be <<0>>; any non-negative value is permitted. success must be <<0>>; any non-negative value is permitted.
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. */ <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "fvwrite.h" #include "fvwrite.h"
#include "local.h" #include "local.h"
@ -72,7 +74,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/ */
int int
_DEFUN (_puts_r, (ptr, s), _DEFUN(_puts_r, (ptr, s),
struct _reent *ptr _AND struct _reent *ptr _AND
_CONST char * s) _CONST char * s)
{ {
@ -88,14 +90,14 @@ _DEFUN (_puts_r, (ptr, s),
uio.uio_iov = &iov[0]; uio.uio_iov = &iov[0];
uio.uio_iovcnt = 2; uio.uio_iovcnt = 2;
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr)); _REENT_SMALL_CHECK_INIT (_stdout_r (ptr));
return (__sfvwrite (_stdout_r (ptr), &uio) ? EOF : '\n'); return (__sfvwrite (_stdout_r (ptr), &uio) ? EOF : '\n');
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (puts, (s), _DEFUN(puts, (s),
char _CONST * s) char _CONST * s)
{ {
return _puts_r (_REENT, s); return _puts_r (_REENT, s);

View File

@ -44,7 +44,8 @@ PORTABILITY
<<fwrite>> should be used instead. In fact, this implementation of <<fwrite>> should be used instead. In fact, this implementation of
<<putw>> is based upon <<fwrite>>. <<putw>> is based upon <<fwrite>>.
Supporting OS subroutines required: <<fwrite>>. */ Supporting OS subroutines required: <<fwrite>>.
*/
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
@ -53,11 +54,11 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#include <stdio.h> #include <stdio.h>
int int
putw (w, fp) _DEFUN(putw, (w, fp),
int w; int w _AND
register FILE *fp; register FILE *fp)
{ {
if (fwrite((const char*)&w, sizeof(w), 1, fp) != 1) if (fwrite ((_CONST char*)&w, sizeof (w), 1, fp) != 1)
return EOF; return EOF;
return 0; return 0;
} }

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,14 +14,16 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92. */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include "local.h"
#include <stdlib.h> #include <stdlib.h>
#include "local.h"
static int static int
lflush (fp) _DEFUN(lflush, (fp),
FILE *fp; FILE *fp)
{ {
if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR)) if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR))
return fflush (fp); return fflush (fp);
@ -36,7 +36,7 @@ lflush (fp)
*/ */
int int
_DEFUN (__srefill, (fp), _DEFUN(__srefill, (fp),
register FILE * fp) register FILE * fp)
{ {
/* make sure stdio is set up */ /* make sure stdio is set up */
@ -94,7 +94,7 @@ _DEFUN (__srefill, (fp),
*/ */
if (fp->_flags & (__SLBF | __SNBF)) if (fp->_flags & (__SLBF | __SNBF))
(void) _fwalk (_GLOBAL_REENT, lflush); _CAST_VOID _fwalk (_GLOBAL_REENT, lflush);
fp->_p = fp->_bf._base; fp->_p = fp->_bf._base;
fp->_r = (*fp->_read) (fp->_cookie, (char *) fp->_p, fp->_bf._size); fp->_r = (*fp->_read) (fp->_cookie, (char *) fp->_p, fp->_bf._size);
fp->_flags &= ~__SMOD; /* buffer contents are again pristine */ fp->_flags &= ~__SMOD; /* buffer contents are again pristine */

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<remove>>---delete a file's name <<remove>>---delete a file's name
@ -9,7 +26,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int remove(char *<[filename]>); int remove(char *<[filename]>);
int _remove_r(void *<[reent]>, char *<[filename]>); int _remove_r(struct _reent *<[reent]>, char *<[filename]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -17,7 +34,7 @@ TRAD_SYNOPSIS
char *<[filename]>; char *<[filename]>;
int _remove_r(<[reent]>, <[filename]>) int _remove_r(<[reent]>, <[filename]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[filename]>; char *<[filename]>;
DESCRIPTION DESCRIPTION
@ -44,13 +61,14 @@ open file may vary among implementations.
Supporting OS subroutine required: <<unlink>>. Supporting OS subroutine required: <<unlink>>.
*/ */
#include <stdio.h> #include <_ansi.h>
#include <reent.h> #include <reent.h>
#include <stdio.h>
int int
_remove_r (ptr, filename) _DEFUN(_remove_r, (ptr, filename),
struct _reent *ptr; struct _reent *ptr _AND
_CONST char *filename; _CONST char *filename)
{ {
if (_unlink_r (ptr, filename) == -1) if (_unlink_r (ptr, filename) == -1)
return -1; return -1;
@ -61,8 +79,8 @@ _remove_r (ptr, filename)
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
remove (filename) _DEFUN(remove, (filename),
_CONST char *filename; _CONST char *filename)
{ {
return _remove_r (_REENT, filename); return _remove_r (_REENT, filename);
} }

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<rename>>---rename a file <<rename>>---rename a file
@ -11,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int rename(const char *<[old]>, const char *<[new]>); int rename(const char *<[old]>, const char *<[new]>);
int _rename_r(void *<[reent]>, int _rename_r(struct _reent *<[reent]>,
const char *<[old]>, const char *<[new]>); const char *<[old]>, const char *<[new]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -21,7 +38,7 @@ TRAD_SYNOPSIS
char *<[new]>; char *<[new]>;
int _rename_r(<[reent]>, <[old]>, <[new]>) int _rename_r(<[reent]>, <[old]>, <[new]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[old]>; char *<[old]>;
char *<[new]>; char *<[new]>;
@ -48,15 +65,16 @@ as <<*<[new]>>> may vary from one implementation to another.
Supporting OS subroutines required: <<link>>, <<unlink>>, or <<rename>>. Supporting OS subroutines required: <<link>>, <<unlink>>, or <<rename>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <sys/unistd.h> #include <sys/unistd.h>
#include <reent.h>
int int
_rename_r (ptr, old, new) _DEFUN(_rename_r, (ptr, old, new),
struct _reent *ptr; struct _reent *ptr _AND
_CONST char *old; _CONST char *old _AND
_CONST char *new; _CONST char *new)
{ {
#ifdef HAVE_RENAME #ifdef HAVE_RENAME
return _rename (old,new); return _rename (old,new);
@ -76,9 +94,9 @@ _rename_r (ptr, old, new)
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
rename (old, new) _DEFUN(rename, (old, new),
_CONST char *old; _CONST char *old _AND
_CONST char *new; _CONST char *new)
{ {
return _rename_r (_REENT, old, new); return _rename_r (_REENT, old, new);
} }

View File

@ -56,24 +56,26 @@ No supporting OS subroutines are required.
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
void _VOID
_DEFUN (_rewind_r, (ptr, fp), _DEFUN(_rewind_r, (ptr, fp),
struct _reent * ptr _AND struct _reent * ptr _AND
register FILE * fp) register FILE * fp)
{ {
(void) _fseek_r (ptr, fp, 0L, SEEK_SET); _CAST_VOID _fseek_r (ptr, fp, 0L, SEEK_SET);
clearerr(fp); clearerr (fp);
} }
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
void _VOID
_DEFUN (rewind, (fp), _DEFUN(rewind, (fp),
register FILE * fp) register FILE * fp)
{ {
(void) _fseek_r (_REENT, fp, 0L, SEEK_SET); _CAST_VOID _fseek_r (_REENT, fp, 0L, SEEK_SET);
} }
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,11 +14,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92. */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"
@ -31,8 +31,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/ */
int int
__srget (fp) _DEFUN(__srget, (fp),
register FILE *fp; register FILE *fp)
{ {
if (__srefill (fp) == 0) if (__srefill (fp) == 0)
{ {

View File

@ -16,22 +16,22 @@
*/ */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include "local.h"
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
#include <varargs.h> #include <varargs.h>
#endif #endif
#include "local.h"
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
scanf (const char *fmt, ...) scanf(_CONST char *fmt, ...)
#else #else
scanf (fmt, va_alist) scanf(fmt, va_alist)
char *fmt; char *fmt;
va_dcl va_dcl
#endif #endif
@ -39,7 +39,7 @@ scanf (fmt, va_alist)
int ret; int ret;
va_list ap; va_list ap;
_REENT_SMALL_CHECK_INIT(_stdin_r (_REENT)); _REENT_SMALL_CHECK_INIT (_stdin_r (_REENT));
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
va_start (ap, fmt); va_start (ap, fmt);
#else #else
@ -54,9 +54,9 @@ scanf (fmt, va_alist)
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_scanf_r (struct _reent *ptr, const char *fmt, ...) _scanf_r(struct _reent *ptr, _CONST char *fmt, ...)
#else #else
_scanf_r (ptr, fmt, va_alist) _scanf_r(ptr, fmt, va_alist)
struct _reent *ptr; struct _reent *ptr;
char *fmt; char *fmt;
va_dcl va_dcl
@ -65,7 +65,7 @@ _scanf_r (ptr, fmt, va_alist)
int ret; int ret;
va_list ap; va_list ap;
_REENT_SMALL_CHECK_INIT(_stdin_r (ptr)); _REENT_SMALL_CHECK_INIT (_stdin_r (ptr));
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
va_start (ap, fmt); va_start (ap, fmt);
#else #else
@ -76,4 +76,3 @@ _scanf_r (ptr, fmt, va_alist)
return (ret); return (ret);
} }

View File

@ -70,10 +70,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"
void _VOID
_DEFUN (setbuf, (fp, buf), _DEFUN(setbuf, (fp, buf),
FILE * fp _AND FILE * fp _AND
char *buf) char *buf)
{ {
(void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ); _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
} }

View File

@ -14,7 +14,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* /*
Modified copy of setbuf.c to support the setbuffer function Modified copy of setbuf.c to support the setbuffer function
defined as part of BSD. defined as part of BSD.
@ -69,7 +68,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
FUNCTION FUNCTION
<<setlinebuf>>---specify line buffering for a file or stream <<setlinebuf>>---specify line buffering for a file or stream
INDEX INDEX
@ -108,11 +106,11 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"
void _VOID
_DEFUN (setbuffer, (fp, buf, size), _DEFUN(setbuffer, (fp, buf, size),
FILE * fp _AND FILE * fp _AND
char *buf _AND char *buf _AND
int size) int size)
{ {
(void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size); _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
} }

View File

@ -14,7 +14,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* /*
Modified copy of setbuf.c to support setlinebuf function Modified copy of setbuf.c to support setlinebuf function
defined as part of BSD. defined as part of BSD.
@ -23,7 +22,6 @@ Modifications by Gareth Pearce, 2001.
/* /*
FUNCTION FUNCTION
<<setlinebuf>>---specify line buffering for a file or stream <<setlinebuf>>---specify line buffering for a file or stream
INDEX INDEX
@ -63,7 +61,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include "local.h" #include "local.h"
int int
_DEFUN (setlinebuf, (fp), _DEFUN(setlinebuf, (fp),
FILE * fp) FILE * fp)
{ {
return (setvbuf (fp, (char *) NULL, _IOLBF, (size_t) 0)); return (setvbuf (fp, (char *) NULL, _IOLBF, (size_t) 0));

View File

@ -96,7 +96,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
*/ */
int int
_DEFUN (setvbuf, (fp, buf, mode, size), _DEFUN(setvbuf, (fp, buf, mode, size),
register FILE * fp _AND register FILE * fp _AND
char *buf _AND char *buf _AND
register int mode _AND register int mode _AND
@ -104,7 +104,7 @@ _DEFUN (setvbuf, (fp, buf, mode, size),
{ {
int ret = 0; int ret = 0;
_flockfile(fp); _flockfile (fp);
CHECK_INIT (fp); CHECK_INIT (fp);
@ -115,7 +115,7 @@ _DEFUN (setvbuf, (fp, buf, mode, size),
if ((mode != _IOFBF && mode != _IOLBF && mode != _IONBF) || (int)(_POINTER_INT) size < 0) if ((mode != _IOFBF && mode != _IOLBF && mode != _IONBF) || (int)(_POINTER_INT) size < 0)
{ {
_funlockfile(fp); _funlockfile (fp);
return (EOF); return (EOF);
} }
@ -126,11 +126,11 @@ _DEFUN (setvbuf, (fp, buf, mode, size),
* non buffer flags, and clear malloc flag. * non buffer flags, and clear malloc flag.
*/ */
(void) fflush (fp); _CAST_VOID fflush (fp);
fp->_r = 0; fp->_r = 0;
fp->_lbfsize = 0; fp->_lbfsize = 0;
if (fp->_flags & __SMBF) if (fp->_flags & __SMBF)
_free_r (_REENT, (void *) fp->_bf._base); _free_r (_REENT, (_PTR) fp->_bf._base);
fp->_flags &= ~(__SLBF | __SNBF | __SMBF); fp->_flags &= ~(__SLBF | __SNBF | __SMBF);
if (mode == _IONBF) if (mode == _IONBF)
@ -158,7 +158,7 @@ nbf:
fp->_w = 0; fp->_w = 0;
fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._base = fp->_p = fp->_nbuf;
fp->_bf._size = 1; fp->_bf._size = 1;
_funlockfile(fp); _funlockfile (fp);
return (ret); return (ret);
} }
fp->_flags |= __SMBF; fp->_flags |= __SMBF;
@ -193,6 +193,6 @@ nbf:
if (fp->_flags & __SWR) if (fp->_flags & __SWR)
fp->_w = fp->_flags & (__SLBF | __SNBF) ? 0 : size; fp->_w = fp->_flags & (__SLBF | __SNBF) ? 0 : size;
_funlockfile(fp); _funlockfile (fp);
return 0; return 0;
} }

View File

@ -1,6 +1,24 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<siprintf>>---write formatted output (integer only) <<siprintf>>---write formatted output (integer only)
INDEX INDEX
siprintf siprintf
@ -29,6 +47,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
@ -36,15 +56,15 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <varargs.h> #include <varargs.h>
#endif #endif
#include <limits.h> #include <limits.h>
#include <_ansi.h>
#include <reent.h>
#include "local.h" #include "local.h"
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_DEFUN (siprintf, (str, fmt), char *str _AND _CONST char *fmt _DOTS) _DEFUN(siprintf, (str, fmt),
char *str _AND
_CONST char *fmt _DOTS)
#else #else
siprintf (str, fmt, va_alist) siprintf(str, fmt, va_alist)
char *str; char *str;
_CONST char *fmt; _CONST char *fmt;
va_dcl va_dcl

View File

@ -1,7 +1,3 @@
/* doc in sprintf.c */
/* This code created by modifying sprintf.c so copyright inherited. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -18,7 +14,11 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* doc in sprintf.c */
/* This code created by modifying sprintf.c so copyright inherited. */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
@ -26,14 +26,17 @@
#include <varargs.h> #include <varargs.h>
#endif #endif
#include <limits.h> #include <limits.h>
#include <_ansi.h>
#include "local.h" #include "local.h"
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_DEFUN (_snprintf_r, (ptr, str, size, fmt), struct _reent *ptr _AND char *str _AND size_t size _AND _CONST char *fmt _DOTS) _DEFUN(_snprintf_r, (ptr, str, size, fmt),
struct _reent *ptr _AND
char *str _AND
size_t size _AND
_CONST char *fmt _DOTS)
#else #else
_snprintf_r (ptr, str, size, fmt, va_alist) _snprintf_r(ptr, str, size, fmt, va_alist)
struct _reent *ptr; struct _reent *ptr;
char *str; char *str;
size_t size; size_t size;
@ -64,9 +67,12 @@ _snprintf_r (ptr, str, size, fmt, va_alist)
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_DEFUN (snprintf, (str, size, fmt), char *str _AND size_t size _AND _CONST char *fmt _DOTS) _DEFUN(snprintf, (str, size, fmt),
char *str _AND
size_t size _AND
_CONST char *fmt _DOTS)
#else #else
snprintf (str, size, fmt, va_alist) snprintf(str, size, fmt, va_alist)
char *str; char *str;
size_t size; size_t size;
_CONST char *fmt; _CONST char *fmt;

View File

@ -16,9 +16,9 @@
*/ */
/* /*
FUNCTION FUNCTION
<<printf>>, <<fprintf>>, <<asprintf>>, <<sprintf>>, <<snprintf>>---format output <<printf>>, <<fprintf>>, <<asprintf>>, <<sprintf>>, <<snprintf>>---format output
INDEX INDEX
fprintf fprintf
INDEX INDEX
@ -305,6 +305,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
@ -312,14 +314,16 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <varargs.h> #include <varargs.h>
#endif #endif
#include <limits.h> #include <limits.h>
#include <_ansi.h>
#include "local.h" #include "local.h"
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_DEFUN (_sprintf_r, (ptr, str, fmt), struct _reent *ptr _AND char *str _AND _CONST char *fmt _DOTS) _DEFUN(_sprintf_r, (ptr, str, fmt),
struct _reent *ptr _AND
char *str _AND
_CONST char *fmt _DOTS)
#else #else
_sprintf_r (ptr, str, fmt, va_alist) _sprintf_r(ptr, str, fmt, va_alist)
struct _reent *ptr; struct _reent *ptr;
char *str; char *str;
_CONST char *fmt; _CONST char *fmt;
@ -349,9 +353,11 @@ _sprintf_r (ptr, str, fmt, va_alist)
int int
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
_DEFUN (sprintf, (str, fmt), char *str _AND _CONST char *fmt _DOTS) _DEFUN(sprintf, (str, fmt),
char *str _AND
_CONST char *fmt _DOTS)
#else #else
sprintf (str, fmt, va_alist) sprintf(str, fmt, va_alist)
char *str; char *str;
_CONST char *fmt; _CONST char *fmt;
va_dcl va_dcl

View File

@ -16,9 +16,8 @@
*/ */
/* /*
FUNCTION FUNCTION
<<scanf>>, <<fscanf>>, <<sscanf>>---scan and format input <<scanf>>, <<fscanf>>, <<sscanf>>---scan and format input
INDEX INDEX
scanf scanf
@ -375,12 +374,11 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
/* | ARGSUSED */ /* | ARGSUSED */
/*SUPPRESS 590*/ /*SUPPRESS 590*/
static static _READ_WRITE_RETURN_TYPE
_READ_WRITE_RETURN_TYPE _DEFUN(eofread, (cookie, buf, len),
eofread (cookie, buf, len) _PTR cookie _AND
_PTR cookie; char *buf _AND
char *buf; int len)
int len;
{ {
return 0; return 0;
} }
@ -389,10 +387,12 @@ eofread (cookie, buf, len)
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
_DEFUN (sscanf, (str, fmt), _CONST char *str _AND _CONST char *fmt _DOTS) _DEFUN(sscanf, (str, fmt),
_CONST char *str _AND
_CONST char *fmt _DOTS)
#else #else
int int
sscanf (str, fmt, va_alist) sscanf(str, fmt, va_alist)
_CONST char *str; _CONST char *str;
_CONST char *fmt; _CONST char *fmt;
va_dcl va_dcl
@ -422,10 +422,13 @@ sscanf (str, fmt, va_alist)
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
int int
_DEFUN (_sscanf_r, (ptr, str, fmt), struct _reent *ptr _AND _CONST char *str _AND _CONST char *fmt _DOTS) _DEFUN(_sscanf_r, (ptr, str, fmt),
struct _reent *ptr _AND
_CONST char *str _AND
_CONST char *fmt _DOTS)
#else #else
int int
_sscanf_r (ptr, str, fmt, va_alist) _sscanf_r(ptr, str, fmt, va_alist)
struct _reent *ptr; struct _reent *ptr;
_CONST char *str; _CONST char *str;
_CONST char *fmt; _CONST char *fmt;

View File

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

View File

@ -11,14 +11,14 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
FILE *tmpfile(void); FILE *tmpfile(void);
FILE *_tmpfile_r(void *<[reent]>); FILE *_tmpfile_r(struct _reent *<[reent]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
FILE *tmpfile(); FILE *tmpfile();
FILE *_tmpfile_r(<[reent]>) FILE *_tmpfile_r(<[reent]>)
char *<[reent]>; struct _reent *<[reent]>;
DESCRIPTION DESCRIPTION
Create a temporary file (a file which will be deleted automatically), Create a temporary file (a file which will be deleted automatically),
@ -45,11 +45,13 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<getpid>>,
<<tmpfile>> also requires the global pointer <<environ>>. <<tmpfile>> also requires the global pointer <<environ>>.
*/ */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
FILE * FILE *
_DEFUN (_tmpfile_r, (ptr), _DEFUN(_tmpfile_r, (ptr),
struct _reent *ptr) struct _reent *ptr)
{ {
FILE *fp; FILE *fp;
@ -69,7 +71,7 @@ _DEFUN (_tmpfile_r, (ptr),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
FILE * FILE *
_DEFUN_VOID (tmpfile) _DEFUN_VOID(tmpfile)
{ {
return _tmpfile_r (_REENT); return _tmpfile_r (_REENT);
} }

View File

@ -2,7 +2,6 @@
* tmpname.c * tmpname.c
* Original Author: G. Haley * Original Author: G. Haley
*/ */
/* /*
FUNCTION FUNCTION
<<tmpnam>>, <<tempnam>>---name for a temporary file <<tmpnam>>, <<tempnam>>---name for a temporary file
@ -20,8 +19,8 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
char *tmpnam(char *<[s]>); char *tmpnam(char *<[s]>);
char *tempnam(char *<[dir]>, char *<[pfx]>); char *tempnam(char *<[dir]>, char *<[pfx]>);
char *_tmpnam_r(void *<[reent]>, char *<[s]>); char *_tmpnam_r(struct _reent *<[reent]>, char *<[s]>);
char *_tempnam_r(void *<[reent]>, char *<[dir]>, char *<[pfx]>); char *_tempnam_r(struct _reent *<[reent]>, char *<[dir]>, char *<[pfx]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -33,11 +32,11 @@ TRAD_SYNOPSIS
char *<[pfx]>; char *<[pfx]>;
char *_tmpnam_r(<[reent]>, <[s]>) char *_tmpnam_r(<[reent]>, <[s]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[s]>; char *<[s]>;
char *_tempnam_r(<[reent]>, <[dir]>, <[pfx]>) char *_tempnam_r(<[reent]>, <[dir]>, <[pfx]>)
char *<[reent]>; struct *<[reent]>;
char *<[dir]>; char *<[dir]>;
char *<[pfx]>; char *<[pfx]>;
@ -93,6 +92,7 @@ The global pointer <<environ>> is also required.
*/ */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -104,13 +104,13 @@ The global pointer <<environ>> is also required.
another one. Return nonzero if successful, otherwise zero. */ another one. Return nonzero if successful, otherwise zero. */
static int static int
worker (ptr, result, part1, part2, part3, part4) _DEFUN(worker, (ptr, result, part1, part2, part3, part4),
struct _reent *ptr; struct _reent *ptr _AND
char *result; char *result _AND
_CONST char *part1; _CONST char *part1 _AND
_CONST char *part2; _CONST char *part2 _AND
int part3; int part3 _AND
int *part4; int *part4)
{ {
/* Generate the filename and make sure that there isn't one called /* Generate the filename and make sure that there isn't one called
it already. */ it already. */
@ -136,7 +136,7 @@ worker (ptr, result, part1, part2, part3, part4)
} }
char * char *
_DEFUN (_tmpnam_r, (p, s), _DEFUN(_tmpnam_r, (p, s),
struct _reent *p _AND struct _reent *p _AND
char *s) char *s)
{ {
@ -165,7 +165,7 @@ _DEFUN (_tmpnam_r, (p, s),
} }
char * char *
_DEFUN (_tempnam_r, (p, dir, pfx), _DEFUN(_tempnam_r, (p, dir, pfx),
struct _reent *p _AND struct _reent *p _AND
_CONST char *dir _AND _CONST char *dir _AND
_CONST char *pfx) _CONST char *pfx)
@ -192,7 +192,7 @@ _DEFUN (_tempnam_r, (p, dir, pfx),
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
char * char *
_DEFUN (tempnam, (dir, pfx), _DEFUN(tempnam, (dir, pfx),
_CONST char *dir _AND _CONST char *dir _AND
_CONST char *pfx) _CONST char *pfx)
{ {
@ -200,7 +200,7 @@ _DEFUN (tempnam, (dir, pfx),
} }
char * char *
_DEFUN (tmpnam, (s), _DEFUN(tmpnam, (s),
char *s) char *s)
{ {
return _tmpnam_r (_REENT, s); return _tmpnam_r (_REENT, s);

View File

@ -19,6 +19,7 @@
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -33,8 +34,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
/*static*/ /*static*/
int int
__submore (fp) _DEFUN(__submore, (fp),
register FILE *fp; register FILE *fp)
{ {
register int i; register int i;
register unsigned char *p; register unsigned char *p;
@ -58,7 +59,7 @@ __submore (fp)
p = (unsigned char *) _realloc_r (_REENT, (_PTR) (fp->_ub._base), i << 1); p = (unsigned char *) _realloc_r (_REENT, (_PTR) (fp->_ub._base), i << 1);
if (p == NULL) if (p == NULL)
return EOF; return EOF;
(void) memcpy ((void *) (p + i), (void *) p, (size_t) i); _CAST_VOID memcpy ((_PTR) (p + i), (_PTR) p, (size_t) i);
fp->_p = p + i; fp->_p = p + i;
fp->_ub._base = p; fp->_ub._base = p;
fp->_ub._size = i << 1; fp->_ub._size = i << 1;
@ -66,14 +67,14 @@ __submore (fp)
} }
int int
ungetc (c, fp) _DEFUN(ungetc, (c, fp),
int c; int c _AND
register FILE *fp; register FILE *fp)
{ {
if (c == EOF) if (c == EOF)
return (EOF); return (EOF);
_flockfile(fp); _flockfile (fp);
/* Ensure stdio has been initialized. /* Ensure stdio has been initialized.
??? Might be able to remove this as some other stdio routine should ??? Might be able to remove this as some other stdio routine should
@ -92,14 +93,14 @@ ungetc (c, fp)
*/ */
if ((fp->_flags & __SRW) == 0) if ((fp->_flags & __SRW) == 0)
{ {
_funlockfile(fp); _funlockfile (fp);
return EOF; return EOF;
} }
if (fp->_flags & __SWR) if (fp->_flags & __SWR)
{ {
if (fflush (fp)) if (fflush (fp))
{ {
_funlockfile(fp); _funlockfile (fp);
return EOF; return EOF;
} }
fp->_flags &= ~__SWR; fp->_flags &= ~__SWR;
@ -119,12 +120,12 @@ ungetc (c, fp)
{ {
if (fp->_r >= fp->_ub._size && __submore (fp)) if (fp->_r >= fp->_ub._size && __submore (fp))
{ {
_funlockfile(fp); _funlockfile (fp);
return EOF; return EOF;
} }
*--fp->_p = c; *--fp->_p = c;
fp->_r++; fp->_r++;
_funlockfile(fp); _funlockfile (fp);
return c; return c;
} }
@ -138,7 +139,7 @@ ungetc (c, fp)
{ {
fp->_p--; fp->_p--;
fp->_r++; fp->_r++;
_funlockfile(fp); _funlockfile (fp);
return c; return c;
} }
@ -154,6 +155,6 @@ ungetc (c, fp)
fp->_ubuf[sizeof (fp->_ubuf) - 1] = c; fp->_ubuf[sizeof (fp->_ubuf) - 1] = c;
fp->_p = &fp->_ubuf[sizeof (fp->_ubuf) - 1]; fp->_p = &fp->_ubuf[sizeof (fp->_ubuf) - 1];
fp->_r = 1; fp->_r = 1;
_funlockfile(fp); _funlockfile (fp);
return c; return c;
} }

View File

@ -1,5 +1,3 @@
/* doc in vfprintf.c */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,15 +14,14 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* This code was based on vsprintf.c */ /* This code was based on vsprintf.c */
/* doc in vfprintf.c */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
@ -36,7 +33,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (vasprintf, (strp, fmt, ap), _DEFUN(vasprintf, (strp, fmt, ap),
char **strp _AND char **strp _AND
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
@ -57,7 +54,7 @@ _DEFUN (vasprintf, (strp, fmt, ap),
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */
int int
_DEFUN (_vasprintf_r, (ptr, strp, fmt, ap), _DEFUN(_vasprintf_r, (ptr, strp, fmt, ap),
struct _reent *ptr _AND struct _reent *ptr _AND
char **strp _AND char **strp _AND
_CONST char *fmt _AND _CONST char *fmt _AND

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,20 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* /*
FUNCTION FUNCTION
<<vscanf>>, <<vfscanf>>, <<vsscanf>>---format argument list <<vscanf>>, <<vfscanf>>, <<vsscanf>>---format argument list
@ -16,11 +33,11 @@ ANSI_SYNOPSIS
int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>); int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>); int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
int _vscanf_r(void *<[reent]>, const char *<[fmt]>, int _vscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
va_list <[list]>); va_list <[list]>);
int _vfscanf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>, int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
va_list <[list]>); va_list <[list]>);
int _vsscanf_r(void *<[reent]>, const char *<[str]>, const char *<[fmt]>, int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>, const char *<[fmt]>,
va_list <[list]>); va_list <[list]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -41,18 +58,18 @@ TRAD_SYNOPSIS
va_list <[list]>; va_list <[list]>;
int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>) int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[fmt]>; char *<[fmt]>;
va_list <[list]>; va_list <[list]>;
int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>) int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>)
char *<[reent]>; struct _reent *<[reent]>;
FILE *<[fp]>; FILE *<[fp]>;
char *<[fmt]>; char *<[fmt]>;
va_list <[list]>; va_list <[list]>;
int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>) int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
char *<[reent]>; struct _reent *<[reent]>;
char *<[str]>; char *<[str]>;
char *<[fmt]>; char *<[fmt]>;
va_list <[list]>; va_list <[list]>;
@ -85,24 +102,8 @@ These are GNU extensions.
Supporting OS subroutines required: Supporting OS subroutines required:
*/ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <ctype.h> #include <ctype.h>
#include <wctype.h> #include <wctype.h>
#include <stdio.h> #include <stdio.h>
@ -212,7 +213,7 @@ typedef unsigned long long u_long_long;
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (vfscanf, (fp, fmt, ap), _DEFUN(vfscanf, (fp, fmt, ap),
register FILE *fp _AND register FILE *fp _AND
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
@ -222,10 +223,10 @@ _DEFUN (vfscanf, (fp, fmt, ap),
} }
int int
__svfscanf (fp, fmt0, ap) _DEFUN(__svfscanf, (fp, fmt0, ap),
register FILE *fp; register FILE *fp _AND
char _CONST *fmt0; char _CONST *fmt0 _AND
va_list ap; va_list ap)
{ {
return __svfscanf_r (_REENT, fp, fmt0, ap); return __svfscanf_r (_REENT, fp, fmt0, ap);
} }
@ -233,7 +234,7 @@ __svfscanf (fp, fmt0, ap)
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */
int int
_DEFUN (_vfscanf_r, (data, fp, fmt, ap), _DEFUN(_vfscanf_r, (data, fp, fmt, ap),
struct _reent *data _AND struct _reent *data _AND
register FILE *fp _AND register FILE *fp _AND
_CONST char *fmt _AND _CONST char *fmt _AND
@ -244,11 +245,11 @@ _DEFUN (_vfscanf_r, (data, fp, fmt, ap),
int int
__svfscanf_r (rptr, fp, fmt0, ap) _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
struct _reent *rptr; struct _reent *rptr _AND
register FILE *fp; register FILE *fp _AND
char _CONST *fmt0; char _CONST *fmt0 _AND
va_list ap; va_list ap)
{ {
register u_char *fmt = (u_char *) fmt0; register u_char *fmt = (u_char *) fmt0;
register int c; /* character from format, or conversion */ register int c; /* character from format, or conversion */
@ -555,7 +556,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
if (flags & LONG) if (flags & LONG)
{ {
if ((flags & SUPPRESS) == 0) if ((flags & SUPPRESS) == 0)
wcp = va_arg(ap, wchar_t *); wcp = va_arg (ap, wchar_t *);
else else
wcp = NULL; wcp = NULL;
n = 0; n = 0;
@ -566,8 +567,8 @@ __svfscanf_r (rptr, fp, fmt0, ap)
buf[n++] = *fp->_p; buf[n++] = *fp->_p;
fp->_r -= 1; fp->_r -= 1;
fp->_p += 1; fp->_p += 1;
memset((void *)&state, '\0', sizeof(mbstate_t)); memset ((_PTR)&state, '\0', sizeof (mbstate_t));
if ((mbslen = _mbrtowc_r(rptr, wcp, buf, n, &state)) if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
== (size_t)-1) == (size_t)-1)
goto input_failure; /* Invalid sequence */ goto input_failure; /* Invalid sequence */
if (mbslen == 0 && !(flags & SUPPRESS)) if (mbslen == 0 && !(flags & SUPPRESS))
@ -684,19 +685,19 @@ __svfscanf_r (rptr, fp, fmt0, ap)
{ {
/* Process %S and %ls placeholders */ /* Process %S and %ls placeholders */
if ((flags & SUPPRESS) == 0) if ((flags & SUPPRESS) == 0)
wcp = va_arg(ap, wchar_t *); wcp = va_arg (ap, wchar_t *);
else else
wcp = &wc; wcp = &wc;
n = 0; n = 0;
while (!isspace(*fp->_p) && width != 0) while (!isspace (*fp->_p) && width != 0)
{ {
if (n == MB_CUR_MAX) if (n == MB_CUR_MAX)
goto input_failure; goto input_failure;
buf[n++] = *fp->_p; buf[n++] = *fp->_p;
fp->_r -= 1; fp->_r -= 1;
fp->_p += 1; fp->_p += 1;
memset((void *)&state, '\0', sizeof(mbstate_t)); memset ((_PTR)&state, '\0', sizeof (mbstate_t));
if ((mbslen = _mbrtowc_r(rptr, wcp, buf, n, &state)) if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
== (size_t)-1) == (size_t)-1)
goto input_failure; goto input_failure;
if (mbslen == 0) if (mbslen == 0)
@ -706,7 +707,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
if (iswspace(*wcp)) if (iswspace(*wcp))
{ {
while (n != 0) while (n != 0)
ungetc(buf[--n], fp); ungetc (buf[--n], fp);
break; break;
} }
nread += n; nread += n;
@ -1171,9 +1172,9 @@ all_done:
/*static*/ /*static*/
u_char * u_char *
__sccl (tab, fmt) _DEFUN(__sccl, (tab, fmt),
register char *tab; register char *tab _AND
register u_char *fmt; register u_char *fmt)
{ {
register int c, n, v; register int c, n, v;

View File

@ -1,5 +1,3 @@
/* doc in vfprintf.c */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,37 +14,37 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* doc in vfprintf.c */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
#include <varargs.h> #include <varargs.h>
#endif #endif
#include "local.h" #include "local.h"
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (vprintf, (fmt, ap), _DEFUN(vprintf, (fmt, ap),
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
{ {
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT)); _REENT_SMALL_CHECK_INIT (_stdout_r (_REENT));
return _vfprintf_r (_REENT, _stdout_r (_REENT), fmt, ap); return _vfprintf_r (_REENT, _stdout_r (_REENT), fmt, ap);
} }
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */
int int
_DEFUN (_vprintf_r, (ptr, fmt, ap), _DEFUN(_vprintf_r, (ptr, fmt, ap),
struct _reent *ptr _AND struct _reent *ptr _AND
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
{ {
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr)); _REENT_SMALL_CHECK_INIT (_stdout_r (ptr));
return _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap); return _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
} }

View File

@ -18,39 +18,35 @@
*/ */
#include <_ansi.h> #include <_ansi.h>
#include <reent.h>
#include <stdio.h> #include <stdio.h>
#include "local.h"
#ifdef _HAVE_STDC #ifdef _HAVE_STDC
#include <stdarg.h> #include <stdarg.h>
#else #else
#include <varargs.h> #include <varargs.h>
#endif #endif
#include "local.h"
/*
* vscanf
*/
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (vscanf, (fmt, ap), _DEFUN(vscanf, (fmt, ap),
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
{ {
_REENT_SMALL_CHECK_INIT(_stdin_r (_REENT)); _REENT_SMALL_CHECK_INIT (_stdin_r (_REENT));
return __svfscanf_r (_REENT, _stdin_r (_REENT), fmt, ap); return __svfscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
} }
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */
int int
_DEFUN (_vscanf_r, (ptr, fmt, ap), _DEFUN(_vscanf_r, (ptr, fmt, ap),
struct _reent *ptr _AND struct _reent *ptr _AND
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
{ {
_REENT_SMALL_CHECK_INIT(_stdin_r (ptr)); _REENT_SMALL_CHECK_INIT (_stdin_r (ptr));
return __svfscanf_r (ptr, _stdin_r (ptr), fmt, ap); return __svfscanf_r (ptr, _stdin_r (ptr), fmt, ap);
} }

View File

@ -1,7 +1,3 @@
/* doc in vfprintf.c */
/* This code created by modifying vsprintf.c so copyright inherited. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -18,6 +14,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* doc in vfprintf.c */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
@ -36,7 +33,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (vsnprintf, (str, size, fmt, ap), _DEFUN(vsnprintf, (str, size, fmt, ap),
char *str _AND char *str _AND
size_t size _AND size_t size _AND
_CONST char *fmt _AND _CONST char *fmt _AND
@ -57,7 +54,7 @@ _DEFUN (vsnprintf, (str, size, fmt, ap),
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */
int int
_DEFUN (_vsnprintf_r, (ptr, str, size, fmt, ap), _DEFUN(_vsnprintf_r, (ptr, str, size, fmt, ap),
struct _reent *ptr _AND struct _reent *ptr _AND
char *str _AND char *str _AND
size_t size _AND size_t size _AND

View File

@ -1,5 +1,3 @@
/* doc in vfprintf.c */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,6 +14,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* doc in vfprintf.c */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
@ -34,7 +33,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (vsprintf, (str, fmt, ap), _DEFUN(vsprintf, (str, fmt, ap),
char *str _AND char *str _AND
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
@ -54,7 +53,7 @@ _DEFUN (vsprintf, (str, fmt, ap),
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */
int int
_DEFUN (_vsprintf_r, (ptr, str, fmt, ap), _DEFUN(_vsprintf_r, (ptr, str, fmt, ap),
struct _reent *ptr _AND struct _reent *ptr _AND
char *str _AND char *str _AND
_CONST char *fmt _AND _CONST char *fmt _AND

View File

@ -28,12 +28,11 @@
#endif #endif
#include "local.h" #include "local.h"
static static _READ_WRITE_RETURN_TYPE
_READ_WRITE_RETURN_TYPE _DEFUN(eofread1, (cookie, buf, len),
eofread1 (cookie, buf, len) _PTR cookie _AND
_PTR cookie; char *buf _AND
char *buf; int len)
int len;
{ {
return 0; return 0;
} }
@ -45,7 +44,7 @@ eofread1 (cookie, buf, len)
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
int int
_DEFUN (vsscanf, (str, fmt, ap), _DEFUN(vsscanf, (str, fmt, ap),
_CONST char *str _AND _CONST char *str _AND
_CONST char *fmt _AND _CONST char *fmt _AND
va_list ap) va_list ap)
@ -56,7 +55,7 @@ _DEFUN (vsscanf, (str, fmt, ap),
#endif /* !_REENT_ONLY */ #endif /* !_REENT_ONLY */
int int
_DEFUN (_vsscanf_r, (ptr, str, fmt, ap), _DEFUN(_vsscanf_r, (ptr, str, fmt, ap),
struct _reent *ptr _AND struct _reent *ptr _AND
_CONST char *str _AND _CONST char *str _AND
_CONST char *fmt _AND _CONST char *fmt _AND

View File

@ -1,5 +1,3 @@
/* No user fns here. Pesch 15apr92. */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -16,11 +14,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* No user fns here. Pesch 15apr92. */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%"; static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include "local.h" #include "local.h"
#include "fvwrite.h" #include "fvwrite.h"
@ -32,9 +32,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/ */
int int
__swbuf (c, fp) _DEFUN(__swbuf, (c, fp),
register int c; register int c _AND
register FILE *fp; register FILE *fp)
{ {
register int n; register int n;

View File

@ -17,6 +17,7 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
#include <_ansi.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "local.h" #include "local.h"
@ -28,7 +29,7 @@
*/ */
int int
_DEFUN (__swsetup, (fp), _DEFUN(__swsetup, (fp),
register FILE * fp) register FILE * fp)
{ {
/* Make sure stdio is set up. */ /* Make sure stdio is set up. */