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:
parent
7ed02aabd1
commit
05b315770a
|
@ -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>
|
||||
|
||||
* libc/stdio/vfscanf.c (NNZDIGITS): New define.
|
||||
|
|
|
@ -14,9 +14,10 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* This code was copied from sprintf.c */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
|
@ -24,12 +25,14 @@
|
|||
#include <varargs.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <_ansi.h>
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
#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
|
||||
_asprintf_r(ptr, strp, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
|
@ -63,7 +66,9 @@ _asprintf_r (ptr, strp, fmt, va_alist)
|
|||
|
||||
int
|
||||
#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
|
||||
asprintf(strp, fmt, va_alist)
|
||||
char **strp;
|
||||
|
|
|
@ -52,6 +52,7 @@ ANSI C requires <<clearerr>>.
|
|||
No supporting OS subroutines are required.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#undef clearerr
|
||||
|
||||
|
|
|
@ -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
|
||||
<<fclose>>---close a file
|
||||
|
@ -10,7 +27,7 @@ INDEX
|
|||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
int fclose(FILE *<[fp]>);
|
||||
int _fclose_r(void *<[reent]>, FILE *<[fp]>);
|
||||
int _fclose_r(struct _reent *<[reent]>, FILE *<[fp]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -18,7 +35,7 @@ TRAD_SYNOPSIS
|
|||
FILE *<[fp]>;
|
||||
|
||||
int fclose(<[fp]>)
|
||||
void *<[reent]>
|
||||
struct _reent *<[reent]>
|
||||
FILE *<[fp]>;
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -40,32 +57,12 @@ Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
|
|||
<<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "local.h"
|
||||
#include <sys/lock.h>
|
||||
|
||||
/*
|
||||
* Close a file.
|
||||
*/
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
_DEFUN(_fclose_r, (rptr, fp),
|
||||
|
|
|
@ -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
|
||||
<<fcloseall>>---close all files
|
||||
|
@ -37,34 +54,18 @@ PORTABILITY
|
|||
Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
|
||||
<<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
/* This file based upon fwalk.c. */
|
||||
|
||||
/*
|
||||
* 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 <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
_fcloseall_r (ptr)
|
||||
struct _reent *ptr;
|
||||
_DEFUN(_fcloseall_r, (ptr),
|
||||
struct _reent *ptr)
|
||||
{
|
||||
return _fwalk_reent (ptr, _fclose_r);
|
||||
}
|
||||
|
@ -72,7 +73,7 @@ _fcloseall_r (ptr)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
fcloseall (void)
|
||||
_DEFUN_VOID(fcloseall)
|
||||
{
|
||||
return _fcloseall_r (_GLOBAL_REENT);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
<<fdopen>>---turn open file into a stream
|
||||
|
@ -10,7 +27,7 @@ INDEX
|
|||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
FILE *fdopen(int <[fd]>, const char *<[mode]>);
|
||||
FILE *_fdopen_r(void *<[reent]>,
|
||||
FILE *_fdopen_r(struct _reent *<[reent]>,
|
||||
int <[fd]>, const char *<[mode]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
|
@ -20,7 +37,7 @@ TRAD_SYNOPSIS
|
|||
char *<[mode]>;
|
||||
|
||||
FILE *_fdopen_r(<[reent]>, <[fd]>, <[mode]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
int <[fd]>;
|
||||
char *<[mode]>);
|
||||
|
||||
|
@ -37,16 +54,15 @@ PORTABILITY
|
|||
<<fdopen>> is ANSI.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "local.h"
|
||||
#include <_syslist.h>
|
||||
|
||||
extern int __sflags ();
|
||||
|
||||
FILE *
|
||||
_DEFUN(_fdopen_r, (ptr, fd, mode),
|
||||
struct _reent *ptr _AND
|
||||
|
|
|
@ -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
|
||||
<<feof>>---test for end of file
|
||||
|
|
|
@ -53,6 +53,7 @@ No supporting OS subroutines are required.
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* A subroutine version of the macro ferror. */
|
||||
|
|
|
@ -51,6 +51,7 @@ ANSI C requires <<fflush>>.
|
|||
No supporting OS subroutines are required.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
|
|
|
@ -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
|
||||
<<fgetc>>---get a character from a file or stream
|
||||
|
@ -36,6 +53,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
|
|
|
@ -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
|
||||
<<fgetpos>>---record position in a stream or file
|
||||
|
@ -54,6 +71,8 @@ conforming C implementations may return a different result from
|
|||
No supporting OS subroutines are required.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
|
||||
FUNCTION
|
||||
<<fgets>>---get character string from a file or stream
|
||||
|
||||
INDEX
|
||||
fgets
|
||||
|
||||
|
@ -54,10 +54,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int __srefill ();
|
||||
#include "local.h"
|
||||
|
||||
/*
|
||||
* Read at most n-1 characters from the given file.
|
||||
|
@ -139,14 +139,14 @@ _DEFUN (fgets, (buf, n, fp),
|
|||
len = ++t - p;
|
||||
fp->_r -= len;
|
||||
fp->_p = t;
|
||||
(void) memcpy ((_PTR) s, (_PTR) p, len);
|
||||
_CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
|
||||
s[len] = 0;
|
||||
_funlockfile (fp);
|
||||
return (buf);
|
||||
}
|
||||
fp->_r -= len;
|
||||
fp->_p += len;
|
||||
(void) memcpy ((_PTR) s, (_PTR) p, len);
|
||||
_CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
|
||||
s += len;
|
||||
}
|
||||
while ((n -= len) != 0);
|
||||
|
|
|
@ -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
|
||||
<<fileno>>---return file descriptor associated with stream
|
||||
|
@ -28,6 +45,7 @@ POSIX requires <<fileno>>.
|
|||
Supporting OS subroutines required: none.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,7 +14,10 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* 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 <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
@ -25,12 +26,12 @@
|
|||
#include <sys/lock.h>
|
||||
#include "local.h"
|
||||
|
||||
static void
|
||||
std (ptr, flags, file, data)
|
||||
FILE *ptr;
|
||||
int flags;
|
||||
int file;
|
||||
struct _reent *data;
|
||||
static _VOID
|
||||
_DEFUN(std, (ptr, flags, file, data),
|
||||
FILE *ptr _AND
|
||||
int flags _AND
|
||||
int file _AND
|
||||
struct _reent *data)
|
||||
{
|
||||
ptr->_p = 0;
|
||||
ptr->_r = 0;
|
||||
|
@ -60,9 +61,9 @@ std (ptr, flags, file, data)
|
|||
}
|
||||
|
||||
struct _glue *
|
||||
__sfmoreglue (d, n)
|
||||
struct _reent *d;
|
||||
register int n;
|
||||
_DEFUN(__sfmoreglue, (d, n),
|
||||
struct _reent *d _AND
|
||||
register int n)
|
||||
{
|
||||
struct _glue *g;
|
||||
FILE *p;
|
||||
|
@ -83,8 +84,8 @@ __sfmoreglue (d, n)
|
|||
*/
|
||||
|
||||
FILE *
|
||||
__sfp (d)
|
||||
struct _reent *d;
|
||||
_DEFUN(__sfp, (d),
|
||||
struct _reent *d)
|
||||
{
|
||||
FILE *fp;
|
||||
int n;
|
||||
|
@ -138,17 +139,17 @@ found:
|
|||
* The name `_cleanup' is, alas, fairly well known outside stdio.
|
||||
*/
|
||||
|
||||
void
|
||||
_cleanup_r (ptr)
|
||||
struct _reent *ptr;
|
||||
_VOID
|
||||
_DEFUN(_cleanup_r, (ptr),
|
||||
struct _reent *ptr)
|
||||
{
|
||||
/* (void) _fwalk(fclose); */
|
||||
(void) _fwalk (ptr, fflush); /* `cheating' */
|
||||
/* _CAST_VOID _fwalk(fclose); */
|
||||
_CAST_VOID _fwalk (ptr, fflush); /* `cheating' */
|
||||
}
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
void
|
||||
_cleanup ()
|
||||
_VOID
|
||||
_DEFUN_VOID(_cleanup)
|
||||
{
|
||||
_cleanup_r (_GLOBAL_REENT);
|
||||
}
|
||||
|
@ -158,9 +159,9 @@ _cleanup ()
|
|||
* __sinit() is called whenever stdio's internal variables must be set up.
|
||||
*/
|
||||
|
||||
void
|
||||
__sinit (s)
|
||||
struct _reent *s;
|
||||
_VOID
|
||||
_DEFUN(__sinit, (s),
|
||||
struct _reent *s)
|
||||
{
|
||||
/* make sure we clean up on exit */
|
||||
s->__cleanup = _cleanup_r; /* conservative */
|
||||
|
@ -197,22 +198,22 @@ __sinit (s)
|
|||
|
||||
__LOCK_INIT_RECURSIVE(static, __sfp_lock);
|
||||
|
||||
void
|
||||
__sfp_lock_acquire ()
|
||||
_VOID
|
||||
_DEFUN_VOID(__sfp_lock_acquire)
|
||||
{
|
||||
__lock_acquire(__sfp_lock);
|
||||
__lock_acquire_recursive (__sfp_lock);
|
||||
}
|
||||
|
||||
void
|
||||
__sfp_lock_release ()
|
||||
_VOID
|
||||
_DEFUN_VOID(__sfp_lock_release)
|
||||
{
|
||||
__lock_release(__sfp_lock);
|
||||
__lock_release_recursive (__sfp_lock);
|
||||
}
|
||||
|
||||
/* Walkable file locking routine. */
|
||||
static int
|
||||
__fp_lock (ptr)
|
||||
FILE * ptr;
|
||||
_DEFUN(__fp_lock, (ptr),
|
||||
FILE * ptr)
|
||||
{
|
||||
_flockfile (ptr);
|
||||
|
||||
|
@ -221,26 +222,26 @@ __fp_lock (ptr)
|
|||
|
||||
/* Walkable file unlocking routine. */
|
||||
static int
|
||||
__fp_unlock (ptr)
|
||||
FILE * ptr;
|
||||
_DEFUN(__fp_unlock, (ptr),
|
||||
FILE * ptr)
|
||||
{
|
||||
_funlockfile (ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
__fp_lock_all ()
|
||||
_VOID
|
||||
_DEFUN_VOID(__fp_lock_all)
|
||||
{
|
||||
__sfp_lock_acquire ();
|
||||
|
||||
(void) _fwalk (_REENT, __fp_lock);
|
||||
_CAST_VOID _fwalk (_REENT, __fp_lock);
|
||||
}
|
||||
|
||||
void
|
||||
__fp_unlock_all ()
|
||||
_VOID
|
||||
_DEFUN_VOID(__fp_unlock_all)
|
||||
{
|
||||
(void) _fwalk (_REENT, __fp_unlock);
|
||||
_CAST_VOID _fwalk (_REENT, __fp_unlock);
|
||||
|
||||
__sfp_lock_release ();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
<<fiprintf>>---format output to file (integer only)
|
||||
|
||||
INDEX
|
||||
fiprintf
|
||||
|
||||
|
@ -38,7 +56,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
|
@ -47,7 +64,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
fiprintf (FILE * fp, const char *fmt,...)
|
||||
fiprintf(FILE * fp, _CONST char *fmt,...)
|
||||
#else
|
||||
int
|
||||
fiprintf(fp, fmt, va_alist)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,11 +14,12 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* No user fns here. Pesch 15apr92 */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -31,10 +30,10 @@
|
|||
*/
|
||||
|
||||
int
|
||||
__sflags (ptr, mode, optr)
|
||||
struct _reent *ptr;
|
||||
register char *mode;
|
||||
int *optr;
|
||||
_DEFUN(__sflags, (ptr, mode, optr),
|
||||
struct _reent *ptr _AND
|
||||
register char *mode _AND
|
||||
int *optr)
|
||||
{
|
||||
register int ret, m, o;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
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]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
|
@ -38,7 +38,7 @@ TRAD_SYNOPSIS
|
|||
char *<[mode]>;
|
||||
|
||||
FILE *_fopen_r(<[reent]>, <[file]>, <[mode]>)
|
||||
void *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[file]>;
|
||||
char *<[mode]>;
|
||||
|
||||
|
@ -113,13 +113,15 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "local.h"
|
||||
#include <sys/lock.h>
|
||||
#ifdef __CYGWIN__
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <sys/lock.h>
|
||||
#include "local.h"
|
||||
|
||||
FILE *
|
||||
_DEFUN(_fopen_r, (ptr, file, mode),
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
|
@ -26,7 +25,7 @@
|
|||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
fprintf (FILE * fp, const char *fmt,...)
|
||||
fprintf(FILE * fp, _CONST char *fmt,...)
|
||||
#else
|
||||
int
|
||||
fprintf(fp, fmt, va_alist)
|
||||
|
|
|
@ -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
|
||||
<<fputc>>---write a character on a stream or file
|
||||
|
@ -40,6 +57,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
|
|
|
@ -47,6 +47,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "fvwrite.h"
|
||||
|
|
|
@ -55,6 +55,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "local.h"
|
||||
|
@ -131,7 +132,7 @@ _DEFUN (fread, (buf, size, count, fp),
|
|||
|
||||
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->_r = 0 ... done in __srefill */
|
||||
p += r;
|
||||
|
@ -150,7 +151,7 @@ _DEFUN (fread, (buf, size, count, fp),
|
|||
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->_p += resid;
|
||||
#ifdef __SCLE
|
||||
|
|
|
@ -66,12 +66,14 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<open>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include "local.h"
|
||||
#include <sys/lock.h>
|
||||
#include "local.h"
|
||||
|
||||
/*
|
||||
* Re-direct an existing, open (probably) file to some other file.
|
||||
|
@ -96,7 +98,7 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
|
|||
if ((flags = __sflags (ptr, mode, &oflags)) == 0)
|
||||
{
|
||||
_funlockfile (fp);
|
||||
(void) _fclose_r (ptr, fp);
|
||||
_CAST_VOID _fclose_r (ptr, fp);
|
||||
__sfp_lock_release ();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -114,10 +116,10 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
|
|||
else
|
||||
{
|
||||
if (fp->_flags & __SWR)
|
||||
(void) fflush (fp);
|
||||
_CAST_VOID fflush (fp);
|
||||
/* if close is NULL, closing is a no-op, hence pointless */
|
||||
if (fp->_close != NULL)
|
||||
(void) (*fp->_close) (fp->_cookie);
|
||||
_CAST_VOID (*fp->_close) (fp->_cookie);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,21 +16,20 @@
|
|||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
fscanf (FILE *fp, const char *fmt, ...)
|
||||
fscanf(FILE *fp, _CONST char *fmt, ...)
|
||||
#else
|
||||
fscanf(FILE *fp, fmt, va_alist)
|
||||
FILE *fp;
|
||||
|
@ -55,7 +54,7 @@ fscanf (FILE *fp, fmt, va_alist)
|
|||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_fscanf_r (struct _reent *ptr, FILE *fp, const char *fmt, ...)
|
||||
_fscanf_r(struct _reent *ptr, FILE *fp, _CONST char *fmt, ...)
|
||||
#else
|
||||
_fscanf_r(ptr, FILE *fp, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
|
|
|
@ -98,6 +98,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -120,8 +122,9 @@ _DEFUN (_fseek_r, (ptr, fp, offset, whence),
|
|||
long offset _AND
|
||||
int whence)
|
||||
{
|
||||
_fpos_t _EXFUN ((*seekfn), (void *, _fpos_t, int));
|
||||
_fpos_t target, curoff;
|
||||
_fpos_t _EXFUN((*seekfn), (_PTR, _fpos_t, int));
|
||||
_fpos_t target;
|
||||
_fpos_t curoff = 0;
|
||||
size_t n;
|
||||
struct stat st;
|
||||
int havepos;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
|
@ -30,10 +32,10 @@ _DEFUN (_fseeko_r, (ptr, fp, offset, whence),
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
fseeko (fp, offset, whence)
|
||||
register FILE *fp;
|
||||
_off_t offset;
|
||||
int whence;
|
||||
_DEFUN(fseeko, (fp, offset, whence),
|
||||
register FILE *fp _AND
|
||||
_off_t offset _AND
|
||||
int whence)
|
||||
{
|
||||
/* for now we simply cast since off_t should be long */
|
||||
return _fseek_r (_REENT, fp, (long)offset, whence);
|
||||
|
|
|
@ -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
|
||||
<<fsetpos>>---restore position of a stream or file
|
||||
|
@ -48,6 +65,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
|
|
|
@ -92,9 +92,10 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
* ftell: return current offset.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "local.h"
|
||||
|
||||
long
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
_off_t
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,7 +14,9 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -24,7 +24,7 @@
|
|||
#include "fvwrite.h"
|
||||
|
||||
#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) \
|
||||
while (len == 0) \
|
||||
|
@ -43,12 +43,12 @@
|
|||
*/
|
||||
|
||||
int
|
||||
__sfvwrite (fp, uio)
|
||||
register FILE *fp;
|
||||
register struct __suio *uio;
|
||||
_DEFUN(__sfvwrite, (fp, uio),
|
||||
register FILE *fp _AND
|
||||
register struct __suio *uio)
|
||||
{
|
||||
register size_t len;
|
||||
register _CONST char *p;
|
||||
register _CONST char *p = NULL;
|
||||
register struct __siov *iov;
|
||||
register int w, s;
|
||||
char *nl;
|
||||
|
@ -181,12 +181,13 @@ __sfvwrite (fp, uio)
|
|||
* that the amount to write is MIN(len,nldist).
|
||||
*/
|
||||
nlknown = 0;
|
||||
nldist = 0;
|
||||
do
|
||||
{
|
||||
GETIOV (nlknown = 0);
|
||||
if (!nlknown)
|
||||
{
|
||||
nl = memchr ((void *) p, '\n', len);
|
||||
nl = memchr ((_PTR) p, '\n', len);
|
||||
nldist = nl ? nl + 1 - p : len + 1;
|
||||
nlknown = 1;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,20 +14,23 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "local.h"
|
||||
|
||||
static int
|
||||
__fwalk (ptr, function)
|
||||
struct _reent *ptr;
|
||||
register int (*function) ();
|
||||
_DEFUN(__fwalk, (ptr, function),
|
||||
struct _reent *ptr _AND
|
||||
register int (*function) ())
|
||||
{
|
||||
register FILE *fp;
|
||||
register int n, ret = 0;
|
||||
|
@ -51,9 +52,9 @@ __fwalk (ptr, function)
|
|||
/* Special version of __fwalk where the function pointer is a reentrant
|
||||
I/O function (e.g. _fclose_r). */
|
||||
static int
|
||||
__fwalk_reent (ptr, reent_function)
|
||||
struct _reent *ptr;
|
||||
register int (*reent_function) ();
|
||||
_DEFUN(__fwalk_reent, (ptr, reent_function),
|
||||
struct _reent *ptr _AND
|
||||
register int (*reent_function) ())
|
||||
{
|
||||
register FILE *fp;
|
||||
register int n, ret = 0;
|
||||
|
@ -73,9 +74,9 @@ __fwalk_reent (ptr, reent_function)
|
|||
}
|
||||
|
||||
int
|
||||
_fwalk (ptr, function)
|
||||
struct _reent *ptr;
|
||||
register int (*function) ();
|
||||
_DEFUN(_fwalk, (ptr, function),
|
||||
struct _reent *ptr _AND
|
||||
register int (*function)())
|
||||
{
|
||||
register int ret = 0;
|
||||
|
||||
|
@ -96,9 +97,9 @@ _fwalk (ptr, function)
|
|||
/* Special version of _fwalk which handles a function pointer to a
|
||||
reentrant I/O function (e.g. _fclose_r). */
|
||||
int
|
||||
_fwalk_reent (ptr, reent_function)
|
||||
struct _reent *ptr;
|
||||
register int (*reent_function) ();
|
||||
_DEFUN(_fwalk_reent, (ptr, reent_function),
|
||||
struct _reent *ptr _AND
|
||||
register int (*reent_function) ())
|
||||
{
|
||||
register int ret = 0;
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#if 0
|
||||
|
|
|
@ -62,6 +62,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
@ -71,8 +72,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
#undef getc
|
||||
|
||||
int
|
||||
getc (fp)
|
||||
register FILE *fp;
|
||||
_DEFUN(getc, (fp),
|
||||
register FILE *fp)
|
||||
{
|
||||
int result;
|
||||
_flockfile (fp);
|
||||
|
|
|
@ -50,6 +50,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
@ -59,8 +60,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
#undef getc_unlocked
|
||||
|
||||
int
|
||||
getc_unlocked (fp)
|
||||
register FILE *fp;
|
||||
_DEFUN(getc_unlocked, (fp),
|
||||
register FILE *fp)
|
||||
{
|
||||
/* CHECK_INIT is called (eventually) by __srefill. */
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
int getchar(void);
|
||||
|
||||
int _getchar_r(void *<[reent]>);
|
||||
int _getchar_r(struct _reent *<[reent]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -71,16 +71,16 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
* A subroutine version of the macro getchar.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
#undef getchar
|
||||
|
||||
int
|
||||
_getchar_r (f)
|
||||
struct _reent *f;
|
||||
_DEFUN(_getchar_r, (f),
|
||||
struct _reent *f)
|
||||
{
|
||||
_REENT_SMALL_CHECK_INIT (_stdin_r (f));
|
||||
return getc (_stdin_r (f));
|
||||
|
@ -89,7 +89,7 @@ _getchar_r (f)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
getchar ()
|
||||
_DEFUN_VOID(getchar)
|
||||
{
|
||||
/* CHECK_INIT is called (eventually) by __srefill. */
|
||||
|
||||
|
|
|
@ -54,14 +54,15 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
* A subroutine version of the macro getchar_unlocked.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef getchar_unlocked
|
||||
|
||||
int
|
||||
_getchar_unlocked_r (f)
|
||||
struct _reent *f;
|
||||
_DEFUN(_getchar_unlocked_r, (f),
|
||||
struct _reent *f)
|
||||
{
|
||||
return getc_unlocked (_stdin_r (f));
|
||||
}
|
||||
|
@ -69,7 +70,7 @@ _getchar_unlocked_r (f)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
getchar_unlocked ()
|
||||
_DEFUN_VOID(getchar_unlocked)
|
||||
{
|
||||
/* CHECK_INIT is called (eventually) by __srefill. */
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* Copyright 2002, Red Hat Inc. - all rights reserved */
|
||||
/*
|
||||
FUNCTION
|
||||
<<getdelim>>---read a line up to a specified line delimeter
|
||||
|
@ -37,8 +38,7 @@ PORTABILITY
|
|||
No supporting OS subroutines are directly required.
|
||||
*/
|
||||
|
||||
/* Copyright 2002, Red Hat Inc. - all rights reserved */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
@ -48,11 +48,11 @@ No supporting OS subroutines are directly required.
|
|||
#define DEFAULT_LINE_SIZE 128
|
||||
|
||||
ssize_t
|
||||
__getdelim (bufptr, n, delim, fp)
|
||||
char **bufptr;
|
||||
size_t *n;
|
||||
int delim;
|
||||
FILE *fp;
|
||||
_DEFUN(__getdelim, (bufptr, n, delim, fp),
|
||||
char **bufptr _AND
|
||||
size_t *n _AND
|
||||
int delim _AND
|
||||
FILE *fp)
|
||||
{
|
||||
char *buf;
|
||||
char *ptr;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* Copyright 2002, Red Hat Inc. - all rights reserved */
|
||||
/*
|
||||
FUNCTION
|
||||
<<getline>>---read a line from a file
|
||||
|
@ -37,17 +38,16 @@ PORTABILITY
|
|||
No supporting OS subroutines are directly required.
|
||||
*/
|
||||
|
||||
/* Copyright 2002, Red Hat Inc. - all rights reserved */
|
||||
|
||||
#include <_ansi.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
|
||||
__getline (lptr, n, fp)
|
||||
char **lptr;
|
||||
size_t *n;
|
||||
FILE *fp;
|
||||
_DEFUN(__getline, (lptr, n, fp),
|
||||
char **lptr _AND
|
||||
size_t *n _AND
|
||||
FILE *fp)
|
||||
{
|
||||
return __getdelim (lptr, n, '\n', fp);
|
||||
}
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
FUNCTION
|
||||
<<gets>>---get character string (obsolete, use <<fgets>> instead)
|
||||
|
||||
INDEX
|
||||
gets
|
||||
INDEX
|
||||
|
@ -30,7 +29,7 @@ ANSI_SYNOPSIS
|
|||
|
||||
char *gets(char *<[buf]>);
|
||||
|
||||
char *_gets_r(void *<[reent]>, char *<[buf]>);
|
||||
char *_gets_r(struct _reent *<[reent]>, char *<[buf]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -39,7 +38,7 @@ TRAD_SYNOPSIS
|
|||
char *<[buf]>;
|
||||
|
||||
char *_gets_r(<[reent]>, <[buf]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[buf]>;
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -68,12 +67,14 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char *
|
||||
_gets_r (ptr, buf)
|
||||
struct _reent *ptr;
|
||||
char *buf;
|
||||
_DEFUN(_gets_r, (ptr, buf),
|
||||
struct _reent *ptr _AND
|
||||
char *buf)
|
||||
{
|
||||
register int c;
|
||||
register char *s = buf;
|
||||
|
@ -93,8 +94,8 @@ _gets_r (ptr, buf)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
char *
|
||||
gets (buf)
|
||||
char *buf;
|
||||
_DEFUN(gets, (buf),
|
||||
char *buf)
|
||||
{
|
||||
return _gets_r (_REENT, buf);
|
||||
}
|
||||
|
|
|
@ -54,11 +54,12 @@ Supporting OS subroutines required: <<fread>>. */
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
getw (fp)
|
||||
register FILE *fp;
|
||||
_DEFUN(getw, (fp),
|
||||
register FILE *fp)
|
||||
{
|
||||
int result;
|
||||
if (fread ((char*)&result, sizeof (result), 1, fp) != 1)
|
||||
|
|
|
@ -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
|
||||
<<iprintf>>---write formatted output (integer only)
|
||||
|
||||
INDEX
|
||||
iprintf
|
||||
|
||||
|
@ -36,21 +54,20 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "local.h"
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
iprintf (const char *fmt,...)
|
||||
iprintf(_CONST char *fmt,...)
|
||||
#else
|
||||
int
|
||||
iprintf(fmt, va_alist)
|
||||
|
@ -76,7 +93,7 @@ iprintf (fmt, va_alist)
|
|||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
_iprintf_r (struct _reent *ptr, const char *fmt, ...)
|
||||
_iprintf_r(struct _reent *ptr, _CONST char *fmt, ...)
|
||||
#else
|
||||
int
|
||||
_iprintf_r(data, fmt, va_alist)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdarg.h>
|
||||
#include <reent.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 int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*));
|
||||
extern int _EXFUN(__srefill,(FILE *));
|
||||
extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(void *, char *, int));
|
||||
extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(void *, char const *, int));
|
||||
extern _fpos_t _EXFUN(__sseek,(void *, _fpos_t, int));
|
||||
extern int _EXFUN(__sclose,(void *));
|
||||
extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(_PTR, char *, int));
|
||||
extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(_PTR, char _CONST *, int));
|
||||
extern _fpos_t _EXFUN(__sseek,(_PTR, _fpos_t, int));
|
||||
extern int _EXFUN(__sclose,(_PTR));
|
||||
extern int _EXFUN(__stextmode,(int));
|
||||
extern void _EXFUN(__sinit,(struct _reent *));
|
||||
extern void _EXFUN(_cleanup_r,(struct _reent *));
|
||||
extern void _EXFUN(__smakebuf,(FILE *));
|
||||
extern _VOID _EXFUN(__sinit,(struct _reent *));
|
||||
extern _VOID _EXFUN(_cleanup_r,(struct _reent *));
|
||||
extern _VOID _EXFUN(__smakebuf,(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));
|
||||
extern int _EXFUN(__srefill,(FILE *fp));
|
||||
|
||||
|
@ -92,6 +94,6 @@ char *_EXFUN(_llicvt,(char *, long long, char));
|
|||
#define __sfp_lock_acquire()
|
||||
#define __sfp_lock_release()
|
||||
#else
|
||||
void _EXFUN(__sfp_lock_acquire,(void));
|
||||
void _EXFUN(__sfp_lock_release,(void));
|
||||
_VOID _EXFUN(__sfp_lock_acquire,(_VOID));
|
||||
_VOID _EXFUN(__sfp_lock_release,(_VOID));
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,13 +14,14 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/unistd.h>
|
||||
|
||||
#include "local.h"
|
||||
|
||||
/*
|
||||
|
@ -33,9 +32,9 @@
|
|||
* optimization) right after the _fstat() that finds the buffer size.
|
||||
*/
|
||||
|
||||
void
|
||||
__smakebuf (fp)
|
||||
register FILE *fp;
|
||||
_VOID
|
||||
_DEFUN(__smakebuf, (fp),
|
||||
register FILE *fp)
|
||||
{
|
||||
register size_t size, couldbetty;
|
||||
register _PTR p;
|
||||
|
|
|
@ -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.
|
||||
* All rights reserved.
|
||||
|
@ -21,6 +16,10 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* 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
|
||||
|
@ -40,8 +39,8 @@ ANSI_SYNOPSIS
|
|||
char *mktemp(char *<[path]>);
|
||||
int mkstemp(char *<[path]>);
|
||||
|
||||
char *_mktemp_r(void *<[reent]>, char *<[path]>);
|
||||
int *_mkstemp_r(void *<[reent]>, char *<[path]>);
|
||||
char *_mktemp_r(struct _reent *<[reent]>, char *<[path]>);
|
||||
int *_mkstemp_r(struct _reent *<[reent]>, char *<[path]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -52,11 +51,11 @@ TRAD_SYNOPSIS
|
|||
char *<[path]>;
|
||||
|
||||
char *_mktemp_r(<[reent]>, <[path]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[path]>;
|
||||
|
||||
int _mkstemp_r(<[reent]>, <[path]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[path]>;
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -93,13 +92,14 @@ V Interface Definition requires <<mktemp>> as of Issue 2.
|
|||
Supporting OS subroutines required: <<getpid>>, <<open>>, <<stat>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <reent.h>
|
||||
|
||||
static int
|
||||
_DEFUN(_gettemp, (ptr, path, doopen),
|
||||
|
|
|
@ -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
|
||||
<<perror>>---print an error message on standard error
|
||||
|
@ -11,7 +28,7 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
void perror(char *<[prefix]>);
|
||||
|
||||
void _perror_r(void *<[reent]>, char *<[prefix]>);
|
||||
void _perror_r(struct _reent *<[reent]>, char *<[prefix]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -19,7 +36,7 @@ TRAD_SYNOPSIS
|
|||
char *<[prefix]>;
|
||||
|
||||
void _perror_r(<[reent]>, <[prefix]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[prefix]>;
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -33,7 +50,6 @@ of the strings described for <<strerror>>.
|
|||
The alternate function <<_perror_r>> is a reentrant version. The
|
||||
extra argument <[reent]> is a pointer to a reentrancy structure.
|
||||
|
||||
|
||||
RETURNS
|
||||
<<perror>> returns no result.
|
||||
|
||||
|
@ -45,13 +61,13 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "local.h"
|
||||
|
||||
void
|
||||
_VOID
|
||||
_DEFUN(_perror_r, (ptr, s),
|
||||
struct _reent *ptr _AND
|
||||
_CONST char *s)
|
||||
|
@ -73,7 +89,7 @@ _DEFUN (_perror_r, (ptr, s),
|
|||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
void
|
||||
_VOID
|
||||
_DEFUN(perror, (s),
|
||||
_CONST char *s)
|
||||
{
|
||||
|
|
|
@ -1,18 +1,33 @@
|
|||
/*
|
||||
* 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 <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "local.h"
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
_printf_r (struct _reent *ptr, const char *fmt, ...)
|
||||
_printf_r(struct _reent *ptr, _CONST char *fmt, ...)
|
||||
#else
|
||||
int
|
||||
_printf_r(ptr, fmt, va_alist)
|
||||
|
@ -39,7 +54,7 @@ _printf_r (ptr, fmt, va_alist)
|
|||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
printf (const char *fmt, ...)
|
||||
printf(_CONST char *fmt, ...)
|
||||
#else
|
||||
int
|
||||
printf(fmt, va_alist)
|
||||
|
|
|
@ -65,6 +65,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
@ -74,9 +75,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
#undef putc
|
||||
|
||||
int
|
||||
putc (c, fp)
|
||||
int c;
|
||||
register FILE *fp;
|
||||
_DEFUN(putc, (c, fp),
|
||||
int c _AND
|
||||
register FILE *fp)
|
||||
{
|
||||
int result;
|
||||
_flockfile (fp);
|
||||
|
|
|
@ -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.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. */
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
@ -59,9 +61,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
#undef putc_unlocked
|
||||
|
||||
int
|
||||
putc_unlocked (c, fp)
|
||||
int c;
|
||||
register FILE *fp;
|
||||
_DEFUN(putc_unlocked, (c, fp),
|
||||
int c _AND
|
||||
register FILE *fp)
|
||||
{
|
||||
/* CHECK_INIT is (eventually) called by __swbuf. */
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
int putchar(int <[ch]>);
|
||||
|
||||
int _putchar_r(void *<[reent]>, int <[ch]>);
|
||||
int _putchar_r(struct _reent *<[reent]>, int <[ch]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -36,7 +36,7 @@ TRAD_SYNOPSIS
|
|||
int <[ch]>;
|
||||
|
||||
int _putchar_r(<[reent]>, <[ch]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
int <[ch]>;
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -68,16 +68,17 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
* A subroutine version of the macro putchar.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "local.h"
|
||||
|
||||
#undef putchar
|
||||
|
||||
int
|
||||
_putchar_r (ptr, c)
|
||||
struct _reent *ptr;
|
||||
int c;
|
||||
_DEFUN(_putchar_r, (ptr, c),
|
||||
struct _reent *ptr _AND
|
||||
int c)
|
||||
{
|
||||
_REENT_SMALL_CHECK_INIT (_stdout_r (ptr));
|
||||
return putc (c, _stdout_r (ptr));
|
||||
|
@ -86,8 +87,8 @@ _putchar_r (ptr, c)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
putchar (c)
|
||||
int c;
|
||||
_DEFUN(putchar, (c),
|
||||
int c)
|
||||
{
|
||||
/* CHECK_INIT is (eventually) called by __swbuf. */
|
||||
|
||||
|
|
|
@ -54,14 +54,16 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
* A subroutine version of the macro putchar_unlocked.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef putchar_unlocked
|
||||
|
||||
int
|
||||
_putchar_unlocked_r (ptr, c)
|
||||
struct _reent *ptr;
|
||||
int c;
|
||||
_DEFUN(_putchar_unlocked_r, (ptr, c),
|
||||
struct _reent *ptr _AND
|
||||
int c)
|
||||
{
|
||||
return putc_unlocked (c, _stdout_r (ptr));
|
||||
}
|
||||
|
@ -69,12 +71,12 @@ _putchar_unlocked_r (ptr, c)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
putchar_unlocked (c)
|
||||
int c;
|
||||
_DEFUN(putchar_unlocked, (c),
|
||||
int c)
|
||||
{
|
||||
/* CHECK_INIT is (eventually) called by __swbuf. */
|
||||
|
||||
_putchar_unlocked_r (_REENT, c);
|
||||
return _putchar_unlocked_r (_REENT, c);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
int puts(const char *<[s]>);
|
||||
|
||||
int _puts_r(void *<[reent]>, const char *<[s]>);
|
||||
int _puts_r(struct _reent *<[reent]>, const char *<[s]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -36,7 +36,7 @@ TRAD_SYNOPSIS
|
|||
char *<[s]>;
|
||||
|
||||
int _puts_r(<[reent]>, <[s]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[s]>;
|
||||
|
||||
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.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>. */
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fvwrite.h"
|
||||
#include "local.h"
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ PORTABILITY
|
|||
<<fwrite>> should be used instead. In fact, this implementation of
|
||||
<<putw>> is based upon <<fwrite>>.
|
||||
|
||||
Supporting OS subroutines required: <<fwrite>>. */
|
||||
Supporting OS subroutines required: <<fwrite>>.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
|
@ -53,11 +54,11 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
#include <stdio.h>
|
||||
|
||||
int
|
||||
putw (w, fp)
|
||||
int w;
|
||||
register FILE *fp;
|
||||
_DEFUN(putw, (w, fp),
|
||||
int w _AND
|
||||
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 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,14 +14,16 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
#include <stdlib.h>
|
||||
#include "local.h"
|
||||
|
||||
static int
|
||||
lflush (fp)
|
||||
FILE *fp;
|
||||
_DEFUN(lflush, (fp),
|
||||
FILE *fp)
|
||||
{
|
||||
if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR))
|
||||
return fflush (fp);
|
||||
|
@ -94,7 +94,7 @@ _DEFUN (__srefill, (fp),
|
|||
*/
|
||||
|
||||
if (fp->_flags & (__SLBF | __SNBF))
|
||||
(void) _fwalk (_GLOBAL_REENT, lflush);
|
||||
_CAST_VOID _fwalk (_GLOBAL_REENT, lflush);
|
||||
fp->_p = fp->_bf._base;
|
||||
fp->_r = (*fp->_read) (fp->_cookie, (char *) fp->_p, fp->_bf._size);
|
||||
fp->_flags &= ~__SMOD; /* buffer contents are again pristine */
|
||||
|
|
|
@ -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
|
||||
<<remove>>---delete a file's name
|
||||
|
@ -9,7 +26,7 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
int remove(char *<[filename]>);
|
||||
|
||||
int _remove_r(void *<[reent]>, char *<[filename]>);
|
||||
int _remove_r(struct _reent *<[reent]>, char *<[filename]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -17,7 +34,7 @@ TRAD_SYNOPSIS
|
|||
char *<[filename]>;
|
||||
|
||||
int _remove_r(<[reent]>, <[filename]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[filename]>;
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -44,13 +61,14 @@ open file may vary among implementations.
|
|||
Supporting OS subroutine required: <<unlink>>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
_remove_r (ptr, filename)
|
||||
struct _reent *ptr;
|
||||
_CONST char *filename;
|
||||
_DEFUN(_remove_r, (ptr, filename),
|
||||
struct _reent *ptr _AND
|
||||
_CONST char *filename)
|
||||
{
|
||||
if (_unlink_r (ptr, filename) == -1)
|
||||
return -1;
|
||||
|
@ -61,8 +79,8 @@ _remove_r (ptr, filename)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
remove (filename)
|
||||
_CONST char *filename;
|
||||
_DEFUN(remove, (filename),
|
||||
_CONST char *filename)
|
||||
{
|
||||
return _remove_r (_REENT, filename);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
<<rename>>---rename a file
|
||||
|
@ -11,7 +28,7 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
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]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
|
@ -21,7 +38,7 @@ TRAD_SYNOPSIS
|
|||
char *<[new]>;
|
||||
|
||||
int _rename_r(<[reent]>, <[old]>, <[new]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[old]>;
|
||||
char *<[new]>;
|
||||
|
||||
|
@ -48,15 +65,16 @@ as <<*<[new]>>> may vary from one implementation to another.
|
|||
Supporting OS subroutines required: <<link>>, <<unlink>>, or <<rename>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <reent.h>
|
||||
|
||||
int
|
||||
_rename_r (ptr, old, new)
|
||||
struct _reent *ptr;
|
||||
_CONST char *old;
|
||||
_CONST char *new;
|
||||
_DEFUN(_rename_r, (ptr, old, new),
|
||||
struct _reent *ptr _AND
|
||||
_CONST char *old _AND
|
||||
_CONST char *new)
|
||||
{
|
||||
#ifdef HAVE_RENAME
|
||||
return _rename (old,new);
|
||||
|
@ -76,9 +94,9 @@ _rename_r (ptr, old, new)
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
rename (old, new)
|
||||
_CONST char *old;
|
||||
_CONST char *new;
|
||||
_DEFUN(rename, (old, new),
|
||||
_CONST char *old _AND
|
||||
_CONST char *new)
|
||||
{
|
||||
return _rename_r (_REENT, old, new);
|
||||
}
|
||||
|
|
|
@ -56,24 +56,26 @@ No supporting OS subroutines are required.
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void
|
||||
_VOID
|
||||
_DEFUN(_rewind_r, (ptr, fp),
|
||||
struct _reent * ptr _AND
|
||||
register FILE * fp)
|
||||
{
|
||||
(void) _fseek_r (ptr, fp, 0L, SEEK_SET);
|
||||
_CAST_VOID _fseek_r (ptr, fp, 0L, SEEK_SET);
|
||||
clearerr (fp);
|
||||
}
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
void
|
||||
_VOID
|
||||
_DEFUN(rewind, (fp),
|
||||
register FILE * fp)
|
||||
{
|
||||
(void) _fseek_r (_REENT, fp, 0L, SEEK_SET);
|
||||
_CAST_VOID _fseek_r (_REENT, fp, 0L, SEEK_SET);
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,11 +14,13 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
|
@ -31,8 +31,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
*/
|
||||
|
||||
int
|
||||
__srget (fp)
|
||||
register FILE *fp;
|
||||
_DEFUN(__srget, (fp),
|
||||
register FILE *fp)
|
||||
{
|
||||
if (__srefill (fp) == 0)
|
||||
{
|
||||
|
|
|
@ -16,20 +16,20 @@
|
|||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
scanf (const char *fmt, ...)
|
||||
scanf(_CONST char *fmt, ...)
|
||||
#else
|
||||
scanf(fmt, va_alist)
|
||||
char *fmt;
|
||||
|
@ -54,7 +54,7 @@ scanf (fmt, va_alist)
|
|||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_scanf_r (struct _reent *ptr, const char *fmt, ...)
|
||||
_scanf_r(struct _reent *ptr, _CONST char *fmt, ...)
|
||||
#else
|
||||
_scanf_r(ptr, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
|
@ -76,4 +76,3 @@ _scanf_r (ptr, fmt, va_alist)
|
|||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -70,10 +70,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
void
|
||||
_VOID
|
||||
_DEFUN(setbuf, (fp, buf),
|
||||
FILE * fp _AND
|
||||
char *buf)
|
||||
{
|
||||
(void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
|
||||
_CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modified copy of setbuf.c to support the setbuffer function
|
||||
defined as part of BSD.
|
||||
|
@ -69,7 +68,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
|
||||
|
||||
FUNCTION
|
||||
|
||||
<<setlinebuf>>---specify line buffering for a file or stream
|
||||
|
||||
INDEX
|
||||
|
@ -108,11 +106,11 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
void
|
||||
_VOID
|
||||
_DEFUN(setbuffer, (fp, buf, size),
|
||||
FILE * fp _AND
|
||||
char *buf _AND
|
||||
int size)
|
||||
{
|
||||
(void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
|
||||
_CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modified copy of setbuf.c to support setlinebuf function
|
||||
defined as part of BSD.
|
||||
|
@ -23,7 +22,6 @@ Modifications by Gareth Pearce, 2001.
|
|||
|
||||
/*
|
||||
FUNCTION
|
||||
|
||||
<<setlinebuf>>---specify line buffering for a file or stream
|
||||
|
||||
INDEX
|
||||
|
|
|
@ -126,11 +126,11 @@ _DEFUN (setvbuf, (fp, buf, mode, size),
|
|||
* non buffer flags, and clear malloc flag.
|
||||
*/
|
||||
|
||||
(void) fflush (fp);
|
||||
_CAST_VOID fflush (fp);
|
||||
fp->_r = 0;
|
||||
fp->_lbfsize = 0;
|
||||
if (fp->_flags & __SMBF)
|
||||
_free_r (_REENT, (void *) fp->_bf._base);
|
||||
_free_r (_REENT, (_PTR) fp->_bf._base);
|
||||
fp->_flags &= ~(__SLBF | __SNBF | __SMBF);
|
||||
|
||||
if (mode == _IONBF)
|
||||
|
|
|
@ -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
|
||||
<<siprintf>>---write formatted output (integer only)
|
||||
|
||||
INDEX
|
||||
siprintf
|
||||
|
||||
|
@ -29,6 +47,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
|
@ -36,13 +56,13 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
#include <varargs.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
#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
|
||||
siprintf(str, fmt, va_alist)
|
||||
char *str;
|
||||
|
|
|
@ -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.
|
||||
* All rights reserved.
|
||||
|
@ -18,7 +14,11 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* 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>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
|
@ -26,12 +26,15 @@
|
|||
#include <varargs.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <_ansi.h>
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
#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
|
||||
_snprintf_r(ptr, str, size, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
|
@ -64,7 +67,10 @@ _snprintf_r (ptr, str, size, fmt, va_alist)
|
|||
|
||||
int
|
||||
#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
|
||||
snprintf(str, size, fmt, va_alist)
|
||||
char *str;
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
|
||||
FUNCTION
|
||||
<<printf>>, <<fprintf>>, <<asprintf>>, <<sprintf>>, <<snprintf>>---format output
|
||||
|
||||
INDEX
|
||||
fprintf
|
||||
INDEX
|
||||
|
@ -305,6 +305,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
|
@ -312,12 +314,14 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
#include <varargs.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <_ansi.h>
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
#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
|
||||
_sprintf_r(ptr, str, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
|
@ -349,7 +353,9 @@ _sprintf_r (ptr, str, fmt, va_alist)
|
|||
|
||||
int
|
||||
#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
|
||||
sprintf(str, fmt, va_alist)
|
||||
char *str;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
|
||||
FUNCTION
|
||||
<<scanf>>, <<fscanf>>, <<sscanf>>---scan and format input
|
||||
|
||||
|
@ -375,12 +374,11 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
|
||||
/* | ARGSUSED */
|
||||
/*SUPPRESS 590*/
|
||||
static
|
||||
_READ_WRITE_RETURN_TYPE
|
||||
eofread (cookie, buf, len)
|
||||
_PTR cookie;
|
||||
char *buf;
|
||||
int len;
|
||||
static _READ_WRITE_RETURN_TYPE
|
||||
_DEFUN(eofread, (cookie, buf, len),
|
||||
_PTR cookie _AND
|
||||
char *buf _AND
|
||||
int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -389,7 +387,9 @@ eofread (cookie, buf, len)
|
|||
|
||||
#ifdef _HAVE_STDC
|
||||
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
|
||||
int
|
||||
sscanf(str, fmt, va_alist)
|
||||
|
@ -422,7 +422,10 @@ sscanf (str, fmt, va_alist)
|
|||
|
||||
#ifdef _HAVE_STDC
|
||||
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
|
||||
int
|
||||
_sscanf_r(ptr, str, fmt, va_alist)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,7 +14,10 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* 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 <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -29,10 +30,10 @@
|
|||
*/
|
||||
|
||||
_READ_WRITE_RETURN_TYPE
|
||||
__sread (cookie, buf, n)
|
||||
_PTR cookie;
|
||||
char *buf;
|
||||
int n;
|
||||
_DEFUN(__sread, (cookie, buf, n),
|
||||
_PTR cookie _AND
|
||||
char *buf _AND
|
||||
int n)
|
||||
{
|
||||
register FILE *fp = (FILE *) cookie;
|
||||
register int ret;
|
||||
|
@ -60,10 +61,10 @@ __sread (cookie, buf, n)
|
|||
}
|
||||
|
||||
_READ_WRITE_RETURN_TYPE
|
||||
__swrite (cookie, buf, n)
|
||||
_PTR cookie;
|
||||
char _CONST *buf;
|
||||
int n;
|
||||
_DEFUN(__swrite, (cookie, buf, n),
|
||||
_PTR cookie _AND
|
||||
char _CONST *buf _AND
|
||||
int n)
|
||||
{
|
||||
register FILE *fp = (FILE *) cookie;
|
||||
int w;
|
||||
|
@ -72,7 +73,7 @@ __swrite (cookie, buf, n)
|
|||
#endif
|
||||
|
||||
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 */
|
||||
|
||||
#ifdef __SCLE
|
||||
|
@ -91,10 +92,10 @@ __swrite (cookie, buf, n)
|
|||
}
|
||||
|
||||
_fpos_t
|
||||
__sseek (cookie, offset, whence)
|
||||
_PTR cookie;
|
||||
_fpos_t offset;
|
||||
int whence;
|
||||
_DEFUN(__sseek, (cookie, offset, whence),
|
||||
_PTR cookie _AND
|
||||
_fpos_t offset _AND
|
||||
int whence)
|
||||
{
|
||||
register FILE *fp = (FILE *) cookie;
|
||||
register _off_t ret;
|
||||
|
@ -111,8 +112,8 @@ __sseek (cookie, offset, whence)
|
|||
}
|
||||
|
||||
int
|
||||
__sclose (cookie)
|
||||
_PTR cookie;
|
||||
_DEFUN(__sclose, (cookie),
|
||||
_PTR cookie)
|
||||
{
|
||||
FILE *fp = (FILE *) cookie;
|
||||
|
||||
|
@ -121,7 +122,8 @@ __sclose (cookie)
|
|||
|
||||
#ifdef __SCLE
|
||||
int
|
||||
__stextmode (int fd)
|
||||
_DEFUN(__stextmode, (fd),
|
||||
int fd)
|
||||
{
|
||||
#ifdef __CYGWIN__
|
||||
return _cygwin_istext_for_stdio (fd);
|
||||
|
|
|
@ -11,14 +11,14 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
FILE *tmpfile(void);
|
||||
|
||||
FILE *_tmpfile_r(void *<[reent]>);
|
||||
FILE *_tmpfile_r(struct _reent *<[reent]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
FILE *tmpfile();
|
||||
|
||||
FILE *_tmpfile_r(<[reent]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
|
||||
DESCRIPTION
|
||||
Create a temporary file (a file which will be deleted automatically),
|
||||
|
@ -45,6 +45,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<getpid>>,
|
|||
<<tmpfile>> also requires the global pointer <<environ>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* tmpname.c
|
||||
* Original Author: G. Haley
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<tmpnam>>, <<tempnam>>---name for a temporary file
|
||||
|
@ -20,8 +19,8 @@ ANSI_SYNOPSIS
|
|||
#include <stdio.h>
|
||||
char *tmpnam(char *<[s]>);
|
||||
char *tempnam(char *<[dir]>, char *<[pfx]>);
|
||||
char *_tmpnam_r(void *<[reent]>, char *<[s]>);
|
||||
char *_tempnam_r(void *<[reent]>, char *<[dir]>, char *<[pfx]>);
|
||||
char *_tmpnam_r(struct _reent *<[reent]>, char *<[s]>);
|
||||
char *_tempnam_r(struct _reent *<[reent]>, char *<[dir]>, char *<[pfx]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
@ -33,11 +32,11 @@ TRAD_SYNOPSIS
|
|||
char *<[pfx]>;
|
||||
|
||||
char *_tmpnam_r(<[reent]>, <[s]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[s]>;
|
||||
|
||||
char *_tempnam_r(<[reent]>, <[dir]>, <[pfx]>)
|
||||
char *<[reent]>;
|
||||
struct *<[reent]>;
|
||||
char *<[dir]>;
|
||||
char *<[pfx]>;
|
||||
|
||||
|
@ -93,6 +92,7 @@ The global pointer <<environ>> is also required.
|
|||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -104,13 +104,13 @@ The global pointer <<environ>> is also required.
|
|||
another one. Return nonzero if successful, otherwise zero. */
|
||||
|
||||
static int
|
||||
worker (ptr, result, part1, part2, part3, part4)
|
||||
struct _reent *ptr;
|
||||
char *result;
|
||||
_CONST char *part1;
|
||||
_CONST char *part2;
|
||||
int part3;
|
||||
int *part4;
|
||||
_DEFUN(worker, (ptr, result, part1, part2, part3, part4),
|
||||
struct _reent *ptr _AND
|
||||
char *result _AND
|
||||
_CONST char *part1 _AND
|
||||
_CONST char *part2 _AND
|
||||
int part3 _AND
|
||||
int *part4)
|
||||
{
|
||||
/* Generate the filename and make sure that there isn't one called
|
||||
it already. */
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -33,8 +34,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
|
||||
/*static*/
|
||||
int
|
||||
__submore (fp)
|
||||
register FILE *fp;
|
||||
_DEFUN(__submore, (fp),
|
||||
register FILE *fp)
|
||||
{
|
||||
register int i;
|
||||
register unsigned char *p;
|
||||
|
@ -58,7 +59,7 @@ __submore (fp)
|
|||
p = (unsigned char *) _realloc_r (_REENT, (_PTR) (fp->_ub._base), i << 1);
|
||||
if (p == NULL)
|
||||
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->_ub._base = p;
|
||||
fp->_ub._size = i << 1;
|
||||
|
@ -66,9 +67,9 @@ __submore (fp)
|
|||
}
|
||||
|
||||
int
|
||||
ungetc (c, fp)
|
||||
int c;
|
||||
register FILE *fp;
|
||||
_DEFUN(ungetc, (c, fp),
|
||||
int c _AND
|
||||
register FILE *fp)
|
||||
{
|
||||
if (c == EOF)
|
||||
return (EOF);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* doc in vfprintf.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,15 +14,14 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* This code was based on vsprintf.c */
|
||||
/* doc in vfprintf.c */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#ifdef _HAVE_STDC
|
||||
|
|
|
@ -1,116 +1,3 @@
|
|||
/*
|
||||
FUNCTION
|
||||
<<vprintf>>, <<vfprintf>>, <<vsprintf>>---format argument list
|
||||
|
||||
INDEX
|
||||
vprintf
|
||||
INDEX
|
||||
vfprintf
|
||||
INDEX
|
||||
vsprintf
|
||||
INDEX
|
||||
vsnprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int vprintf(const char *<[fmt]>, va_list <[list]>);
|
||||
int vfprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vsprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vasprintf(char **<[strp]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vsnprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
|
||||
|
||||
int _vprintf_r(void *<[reent]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vfprintf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vasprintf_r(void *<[reent]>, char **<[str]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vsprintf_r(void *<[reent]>, char *<[str]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vsnprintf_r(void *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <varargs.h>
|
||||
int vprintf( <[fmt]>, <[list]>)
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vfprintf(<[fp]>, <[fmt]>, <[list]>)
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vasprintf(<[strp]>, <[fmt]>, <[list]>)
|
||||
char **<[strp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vsprintf(<[str]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vsnprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vprintf_r(<[reent]>, <[fmt]>, <[list]>)
|
||||
char *<[reent]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vfprintf_r(<[reent]>, <[fp]>, <[fmt]>, <[list]>)
|
||||
char *<[reent]>;
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vasprintf_r(<[reent]>, <[strp]>, <[fmt]>, <[list]>)
|
||||
char *<[reent]>;
|
||||
char **<[strp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>)
|
||||
char *<[reent]>;
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsnprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>)
|
||||
char *<[reent]>;
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<vprintf>>, <<vfprintf>>, <<vasprintf>>, <<vsprintf>> and <<vsnprintf>> are
|
||||
(respectively) variants of <<printf>>, <<fprintf>>, <<asprintf>>, <<sprintf>>,
|
||||
and <<snprintf>>. They differ only in allowing their caller to pass the
|
||||
variable argument list as a <<va_list>> object (initialized by <<va_start>>)
|
||||
rather than directly accepting a variable number of arguments.
|
||||
|
||||
RETURNS
|
||||
The return values are consistent with the corresponding functions:
|
||||
<<vasprintf>>/<<vsprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<vprintf>> and <<vfprintf>> return the number of characters transmitted.
|
||||
If an error occurs, <<vprintf>> and <<vfprintf>> return <<EOF>> and
|
||||
<<vasprintf>> returns -1. No error returns occur for <<vsprintf>>.
|
||||
|
||||
PORTABILITY
|
||||
ANSI C requires all three functions.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -147,6 +34,119 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<vprintf>>, <<vfprintf>>, <<vsprintf>>---format argument list
|
||||
|
||||
INDEX
|
||||
vprintf
|
||||
INDEX
|
||||
vfprintf
|
||||
INDEX
|
||||
vsprintf
|
||||
INDEX
|
||||
vsnprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int vprintf(const char *<[fmt]>, va_list <[list]>);
|
||||
int vfprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vsprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vasprintf(char **<[strp]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vsnprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
|
||||
|
||||
int _vprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vfprintf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vasprintf_r(struct _reent *<[reent]>, char **<[str]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vsprintf_r(struct _reent *<[reent]>, char *<[str]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vsnprintf_r(struct _reent *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <varargs.h>
|
||||
int vprintf( <[fmt]>, <[list]>)
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vfprintf(<[fp]>, <[fmt]>, <[list]>)
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vasprintf(<[strp]>, <[fmt]>, <[list]>)
|
||||
char **<[strp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vsprintf(<[str]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vsnprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vprintf_r(<[reent]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vfprintf_r(<[reent]>, <[fp]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vasprintf_r(<[reent]>, <[strp]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char **<[strp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsnprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<vprintf>>, <<vfprintf>>, <<vasprintf>>, <<vsprintf>> and <<vsnprintf>> are
|
||||
(respectively) variants of <<printf>>, <<fprintf>>, <<asprintf>>, <<sprintf>>,
|
||||
and <<snprintf>>. They differ only in allowing their caller to pass the
|
||||
variable argument list as a <<va_list>> object (initialized by <<va_start>>)
|
||||
rather than directly accepting a variable number of arguments.
|
||||
|
||||
RETURNS
|
||||
The return values are consistent with the corresponding functions:
|
||||
<<vasprintf>>/<<vsprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<vprintf>> and <<vfprintf>> return the number of characters transmitted.
|
||||
If an error occurs, <<vprintf>> and <<vfprintf>> return <<EOF>> and
|
||||
<<vasprintf>> returns -1. No error returns occur for <<vsprintf>>.
|
||||
|
||||
PORTABILITY
|
||||
ANSI C requires all three functions.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
/*static char *sccsid = "from: @(#)vfprintf.c 5.50 (Berkeley) 12/16/92";*/
|
||||
static char *rcsid = "$Id$";
|
||||
|
@ -180,21 +180,19 @@ static char *rcsid = "$Id$";
|
|||
#endif
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <reent.h>
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <sys/lock.h>
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "local.h"
|
||||
#include "fvwrite.h"
|
||||
#include "vfieeefp.h"
|
||||
|
@ -212,9 +210,9 @@ static char *rcsid = "$Id$";
|
|||
* then reset it so that it can be reused.
|
||||
*/
|
||||
static int
|
||||
__sprint(fp, uio)
|
||||
FILE *fp;
|
||||
register struct __suio *uio;
|
||||
_DEFUN(__sprint, (fp, uio),
|
||||
FILE *fp _AND
|
||||
register struct __suio *uio)
|
||||
{
|
||||
register int err;
|
||||
|
||||
|
@ -234,10 +232,10 @@ __sprint(fp, uio)
|
|||
* worries about ungetc buffers and so forth.
|
||||
*/
|
||||
static int
|
||||
__sbprintf(fp, fmt, ap)
|
||||
register FILE *fp;
|
||||
const char *fmt;
|
||||
va_list ap;
|
||||
_DEFUN(__sbprintf, (fp, fmt, ap),
|
||||
register FILE *fp _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE fake;
|
||||
|
@ -285,13 +283,15 @@ __sbprintf(fp, fmt, ap)
|
|||
#define DEFPREC 6
|
||||
|
||||
#ifdef _NO_LONGDBL
|
||||
static char *cvt _PARAMS((struct _reent *, double, int, int, char *, int *, int, int *));
|
||||
static char *
|
||||
_EXFUN(cvt, (struct _reent *, double, int, int, char *, int *, int, int *));
|
||||
#else
|
||||
static char *cvt _PARAMS((struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *));
|
||||
extern int _ldcheck _PARAMS((_LONG_DOUBLE *));
|
||||
static char *
|
||||
_EXFUN(cvt, (struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *));
|
||||
extern int _EXFUN(_ldcheck,(_LONG_DOUBLE *));
|
||||
#endif
|
||||
|
||||
static int exponent _PARAMS((char *, int, int));
|
||||
static int _EXFUN(exponent, (char *, int, int));
|
||||
|
||||
#else /* no FLOATING_POINT */
|
||||
|
||||
|
@ -308,7 +308,7 @@ static int exponent _PARAMS((char *, int, int));
|
|||
#endif
|
||||
|
||||
typedef quad_t * quad_ptr_t;
|
||||
typedef void * void_ptr_t;
|
||||
typedef _PTR void_ptr_t;
|
||||
typedef char * char_ptr_t;
|
||||
typedef long * long_ptr_t;
|
||||
typedef int * int_ptr_t;
|
||||
|
@ -337,9 +337,10 @@ union arg_val
|
|||
wint_t val_wint_t;
|
||||
};
|
||||
|
||||
static union arg_val *get_arg (struct _reent *data, int n, char *fmt,
|
||||
static union arg_val *
|
||||
_EXFUN(get_arg, (struct _reent *data, int n, char *fmt,
|
||||
va_list *ap, int *numargs, union arg_val *args,
|
||||
int *arg_type, char **last_fmt);
|
||||
int *arg_type, char **last_fmt));
|
||||
#endif /* !_NO_POS_ARGS */
|
||||
|
||||
/*
|
||||
|
@ -757,7 +758,7 @@ reswitch: switch (ch) {
|
|||
if (ch == 'C' || (flags & LONGINT)) {
|
||||
mbstate_t ps;
|
||||
|
||||
memset((void *)&ps, '\0', sizeof(mbstate_t));
|
||||
memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
|
||||
if ((size = (int)_wcrtomb_r (data, cp,
|
||||
(wchar_t)GET_ARG (N, ap, wint_t),
|
||||
&ps)) == -1)
|
||||
|
@ -930,7 +931,7 @@ reswitch: switch (ch) {
|
|||
|
||||
wcp = (_CONST wchar_t *)cp;
|
||||
size = m = 0;
|
||||
memset((void *)&ps, '\0', sizeof(mbstate_t));
|
||||
memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
|
||||
|
||||
/* Count number of bytes needed for multibyte
|
||||
string that will be produced from widechar
|
||||
|
@ -965,7 +966,7 @@ reswitch: switch (ch) {
|
|||
goto error;
|
||||
|
||||
/* Convert widechar string to multibyte string. */
|
||||
memset((void *)&ps, '\0', sizeof(mbstate_t));
|
||||
memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
|
||||
if (_wcsrtombs_r (data, malloc_buf,
|
||||
&wcp, size, &ps) != size)
|
||||
goto error;
|
||||
|
@ -1213,16 +1214,29 @@ extern char *_ldtoa_r _PARAMS((struct _reent *, _LONG_DOUBLE, int,
|
|||
#define word0(x) ldword0(x)
|
||||
#endif
|
||||
|
||||
static char *
|
||||
cvt(data, value, ndigits, flags, sign, decpt, ch, length)
|
||||
struct _reent *data;
|
||||
#ifdef _NO_LONGDBL
|
||||
double value;
|
||||
static char *
|
||||
_DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length),
|
||||
struct _reent *data _AND
|
||||
double value _AND
|
||||
int ndigits _AND
|
||||
int flags _AND
|
||||
char *sign _AND
|
||||
int *decpt _AND
|
||||
int ch _AND
|
||||
int *length)
|
||||
#else
|
||||
_LONG_DOUBLE value;
|
||||
static char *
|
||||
_DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length),
|
||||
struct _reent *data _AND
|
||||
_LONG_DOUBLE value _AND
|
||||
int ndigits _AND
|
||||
int flags _AND
|
||||
char *sign _AND
|
||||
int *decpt _AND
|
||||
int ch _AND
|
||||
int *length)
|
||||
#endif
|
||||
int ndigits, flags, *decpt, ch, *length;
|
||||
char *sign;
|
||||
{
|
||||
int mode, dsgn;
|
||||
char *digits, *bp, *rve;
|
||||
|
@ -1283,9 +1297,10 @@ cvt(data, value, ndigits, flags, sign, decpt, ch, length)
|
|||
}
|
||||
|
||||
static int
|
||||
exponent(p0, exp, fmtch)
|
||||
char *p0;
|
||||
int exp, fmtch;
|
||||
_DEFUN(exponent, (p0, exp, fmtch),
|
||||
char *p0 _AND
|
||||
int exp _AND
|
||||
int fmtch)
|
||||
{
|
||||
register char *p, *t;
|
||||
char expbuf[40];
|
||||
|
@ -1389,7 +1404,7 @@ typedef enum {
|
|||
PWPOS, /* get positional parameter value for variable width or precision */
|
||||
} ACTION;
|
||||
|
||||
const static CH_CLASS chclass[256] = {
|
||||
_CONST static CH_CLASS chclass[256] = {
|
||||
/* 00-07 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
|
||||
/* 08-0f */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
|
||||
/* 10-17 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
|
||||
|
@ -1424,7 +1439,7 @@ const static CH_CLASS chclass[256] = {
|
|||
/* f8-ff */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
|
||||
};
|
||||
|
||||
const static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
|
||||
_CONST static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
|
||||
/* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
|
||||
/* START */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE },
|
||||
/* SFLAG */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE },
|
||||
|
@ -1439,7 +1454,7 @@ const static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
|
|||
/* VPDIG */ { DONE, DONE, PREC, DONE, DONE, DONE, DONE, DONE, DONE },
|
||||
};
|
||||
|
||||
const static ACTION action_table[MAX_STATE][MAX_CH_CLASS] = {
|
||||
_CONST static ACTION action_table[MAX_STATE][MAX_CH_CLASS] = {
|
||||
/* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
|
||||
/* START */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP },
|
||||
/* SFLAG */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP },
|
||||
|
@ -1456,9 +1471,15 @@ const static ACTION action_table[MAX_STATE][MAX_CH_CLASS] = {
|
|||
|
||||
/* function to get positional parameter N where n = N - 1 */
|
||||
static union arg_val *
|
||||
get_arg (struct _reent *data, int n, char *fmt, va_list *ap,
|
||||
int *numargs_p, union arg_val *args,
|
||||
int *arg_type, char **last_fmt)
|
||||
_DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
|
||||
struct _reent *data _AND
|
||||
int n _AND
|
||||
char *fmt _AND
|
||||
va_list *ap _AND
|
||||
int *numargs_p _AND
|
||||
union arg_val *args _AND
|
||||
int *arg_type _AND
|
||||
char **last_fmt)
|
||||
{
|
||||
int ch;
|
||||
int number, flags;
|
||||
|
|
|
@ -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
|
||||
<<vscanf>>, <<vfscanf>>, <<vsscanf>>---format argument list
|
||||
|
@ -16,11 +33,11 @@ ANSI_SYNOPSIS
|
|||
int vfscanf(FILE *<[fp]>, 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]>);
|
||||
int _vfscanf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
||||
int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
||||
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]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
|
@ -41,18 +58,18 @@ TRAD_SYNOPSIS
|
|||
va_list <[list]>;
|
||||
|
||||
int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
|
||||
char *<[reent]>;
|
||||
struct _reent *<[reent]>;
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
@ -85,24 +102,8 @@ These are GNU extensions.
|
|||
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 <reent.h>
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
#include <stdio.h>
|
||||
|
@ -222,10 +223,10 @@ _DEFUN (vfscanf, (fp, fmt, ap),
|
|||
}
|
||||
|
||||
int
|
||||
__svfscanf (fp, fmt0, ap)
|
||||
register FILE *fp;
|
||||
char _CONST *fmt0;
|
||||
va_list ap;
|
||||
_DEFUN(__svfscanf, (fp, fmt0, ap),
|
||||
register FILE *fp _AND
|
||||
char _CONST *fmt0 _AND
|
||||
va_list ap)
|
||||
{
|
||||
return __svfscanf_r (_REENT, fp, fmt0, ap);
|
||||
}
|
||||
|
@ -244,11 +245,11 @@ _DEFUN (_vfscanf_r, (data, fp, fmt, ap),
|
|||
|
||||
|
||||
int
|
||||
__svfscanf_r (rptr, fp, fmt0, ap)
|
||||
struct _reent *rptr;
|
||||
register FILE *fp;
|
||||
char _CONST *fmt0;
|
||||
va_list ap;
|
||||
_DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
|
||||
struct _reent *rptr _AND
|
||||
register FILE *fp _AND
|
||||
char _CONST *fmt0 _AND
|
||||
va_list ap)
|
||||
{
|
||||
register u_char *fmt = (u_char *) fmt0;
|
||||
register int c; /* character from format, or conversion */
|
||||
|
@ -566,7 +567,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
|
|||
buf[n++] = *fp->_p;
|
||||
fp->_r -= 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))
|
||||
== (size_t)-1)
|
||||
goto input_failure; /* Invalid sequence */
|
||||
|
@ -695,7 +696,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
|
|||
buf[n++] = *fp->_p;
|
||||
fp->_r -= 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))
|
||||
== (size_t)-1)
|
||||
goto input_failure;
|
||||
|
@ -1171,9 +1172,9 @@ all_done:
|
|||
|
||||
/*static*/
|
||||
u_char *
|
||||
__sccl (tab, fmt)
|
||||
register char *tab;
|
||||
register u_char *fmt;
|
||||
_DEFUN(__sccl, (tab, fmt),
|
||||
register char *tab _AND
|
||||
register u_char *fmt)
|
||||
{
|
||||
register int c, n, v;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* doc in vfprintf.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,16 +14,16 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* doc in vfprintf.c */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
|
|
@ -18,18 +18,14 @@
|
|||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* vscanf
|
||||
*/
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
|
|
|
@ -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.
|
||||
* All rights reserved.
|
||||
|
@ -18,6 +14,7 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* doc in vfprintf.c */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* doc in vfprintf.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,6 +14,7 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* doc in vfprintf.c */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
|
|
|
@ -28,12 +28,11 @@
|
|||
#endif
|
||||
#include "local.h"
|
||||
|
||||
static
|
||||
_READ_WRITE_RETURN_TYPE
|
||||
eofread1 (cookie, buf, len)
|
||||
_PTR cookie;
|
||||
char *buf;
|
||||
int len;
|
||||
static _READ_WRITE_RETURN_TYPE
|
||||
_DEFUN(eofread1, (cookie, buf, len),
|
||||
_PTR cookie _AND
|
||||
char *buf _AND
|
||||
int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -16,11 +14,13 @@
|
|||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* No user fns here. Pesch 15apr92. */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
#include "fvwrite.h"
|
||||
|
@ -32,9 +32,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
|||
*/
|
||||
|
||||
int
|
||||
__swbuf (c, fp)
|
||||
register int c;
|
||||
register FILE *fp;
|
||||
_DEFUN(__swbuf, (c, fp),
|
||||
register int c _AND
|
||||
register FILE *fp)
|
||||
{
|
||||
register int n;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "local.h"
|
||||
|
|
Loading…
Reference in New Issue