* libc/stdio/asiprintf.c (_asiprintf_r): Fix reentrancy.
(asiprintf): Avoid overhead.
* libc/stdio/asprintf.c (_asprintf_r): Fix reentrancy.
(asprintf): Avoid overhead.
* libc/stdio/diprintf.c (_diprintf_r, diprintf): New file.
* libc/stdio/dprintf.c (_dprintf_r, dprintf): Use _DEFUN.
* libc/stdio/fiprintf.c (_fiprintf_r): Add reentrant version.
(fiprintf): Avoid overhead.
* libc/stdio/fprintf.c (_fprintf_r): Add reentrant version.
(fprintf): Avoid overhead.
* libc/stdio/iprintf.c (_iprintf_r): Use _DEFUN.
(iprintf): Avoid overhead.
* libc/stdio/printf.c (_printf_r): Use _DEFUN.
(printf): Avoid overhead.
* libc/stdio/vasiprintf.c (vasiprintf): Reduce binary size.
* libc/stdio/vasprintf.c (vasprintf): Reduce binary size.
* libc/stdio/vdiprintf.c (_vdiprintf_r, vdiprintf): New file.
* libc/stdio/vdprintf.c (vdprintf): Avoid overhead.
* libc/stdio/vsiprintf.c (vsiprintf): Reduce binary size.
* libc/stdio/vsniprintf.c (vsniprintf): Reduce binary size.
* libc/stdio/vsnprintf.c (vsnprintf): Reduce binary size.
* libc/stdio/vsprintf.c (vsprintf): Reduce binary size.
* libc/stdio/Makefile.am (GENERAL_SOURCES): Add diprintf.c,
vdiprintf.c.
* libc/include/stdio.h (diprintf, _diprintf_r, vdiprintf)
(_vdiprintf_r, _fiprintf_r, _vfiprintf_r): Add prototypes.
+2007-04-04 Eric Blake <ebb9@byu.net>
+
+ * libc/stdio/asiprintf.c (_asiprintf_r): Fix reentrancy.
+ (asiprintf): Avoid overhead.
+ * libc/stdio/asprintf.c (_asprintf_r): Fix reentrancy.
+ (asprintf): Avoid overhead.
+ * libc/stdio/diprintf.c (_diprintf_r, diprintf): New file.
+ * libc/stdio/dprintf.c (_dprintf_r, dprintf): Use _DEFUN.
+ * libc/stdio/fiprintf.c (_fiprintf_r): Add reentrant version.
+ (fiprintf): Avoid overhead.
+ * libc/stdio/fprintf.c (_fprintf_r): Add reentrant version.
+ (fprintf): Avoid overhead.
+ * libc/stdio/iprintf.c (_iprintf_r): Use _DEFUN.
+ (iprintf): Avoid overhead.
+ * libc/stdio/printf.c (_printf_r): Use _DEFUN.
+ (printf): Avoid overhead.
+ * libc/stdio/vasiprintf.c (vasiprintf): Reduce binary size.
+ * libc/stdio/vasprintf.c (vasprintf): Reduce binary size.
+ * libc/stdio/vdiprintf.c (_vdiprintf_r, vdiprintf): New file.
+ * libc/stdio/vdprintf.c (vdprintf): Avoid overhead.
+ * libc/stdio/vsiprintf.c (vsiprintf): Reduce binary size.
+ * libc/stdio/vsniprintf.c (vsniprintf): Reduce binary size.
+ * libc/stdio/vsnprintf.c (vsnprintf): Reduce binary size.
+ * libc/stdio/vsprintf.c (vsprintf): Reduce binary size.
+ * libc/stdio/Makefile.am (GENERAL_SOURCES): Add diprintf.c,
+ vdiprintf.c.
+ * libc/include/stdio.h (diprintf, _diprintf_r, vdiprintf)
+ (_vdiprintf_r, _fiprintf_r, _vfiprintf_r): Add prototypes.
+
2007-03-30 Dave Korn <dave.korn@artimi.com>
* libc/include/stdio.h (_ELIDABLE_INLINE): New macro to conceal
int _EXFUN(asiprintf, (char **, const char *, ...));
int _EXFUN(asprintf, (char **, const char *, ...));
#ifndef dprintf
+int _EXFUN(diprintf, (int, const char *, ...));
int _EXFUN(dprintf, (int, const char *, ...));
#endif
int _EXFUN(fcloseall, (_VOID));
char * _EXFUN(tempnam, (const char *, const char *));
int _EXFUN(vasiprintf, (char **, const char *, __VALIST));
int _EXFUN(vasprintf, (char **, const char *, __VALIST));
+int _EXFUN(vdiprintf, (int, const char *, __VALIST));
int _EXFUN(vdprintf, (int, const char *, __VALIST));
int _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST));
int _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST));
int _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...));
int _EXFUN(_asprintf_r, (struct _reent *, char **, const char *, ...));
+int _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...));
int _EXFUN(_dprintf_r, (struct _reent *, int, const char *, ...));
+int _EXFUN(_fclose_r, (struct _reent *, FILE *));
int _EXFUN(_fcloseall_r, (struct _reent *));
FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *));
FILE * _EXFUN(_fopen_r, (struct _reent *, const char *, const char *));
-int _EXFUN(_fclose_r, (struct _reent *, FILE *));
char * _EXFUN(_fgets_r, (struct _reent *, char *, int, FILE *));
+int _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...));
int _EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...));
+int _EXFUN(_fprintf_r, (struct _reent *, FILE *, const char *, ...));
int _EXFUN(_fputc_r, (struct _reent *, int, FILE *));
int _EXFUN(_fputs_r, (struct _reent *, const char *, FILE *));
size_t _EXFUN(_fread_r, (struct _reent *, _PTR, size_t _size, size_t _n, FILE *));
int _EXFUN(_ungetc_r, (struct _reent *, int, FILE *));
int _EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST));
int _EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST));
+int _EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST));
int _EXFUN(_vdprintf_r, (struct _reent *, int, const char *, __VALIST));
int _EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST));
int _EXFUN(_vfprintf_r, (struct _reent *, FILE *, const char *, __VALIST));
GENERAL_SOURCES = \
clearerr.c \
+ diprintf.c \
dprintf.c \
fclose.c \
fdopen.c \
tmpfile.c \
tmpnam.c \
ungetc.c \
+ vdiprintf.c \
vdprintf.c \
viprintf.c \
viscanf.c \
vsprintf.c \
vsscanf.c \
wbuf.c \
- wsetup.c
+ wsetup.c
## The following are EL/IX level 2 interfaces
if ELIX_LEVEL_1
lib_a_AR = $(AR) $(ARFLAGS)
am__DEPENDENCIES_1 = $(lpfx)vfiprintf.$(oext) $(lpfx)vfprintf.$(oext) \
$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext)
-am__objects_1 = lib_a-clearerr.$(OBJEXT) lib_a-dprintf.$(OBJEXT) \
- lib_a-fclose.$(OBJEXT) lib_a-fdopen.$(OBJEXT) \
- lib_a-feof.$(OBJEXT) lib_a-ferror.$(OBJEXT) \
- lib_a-fflush.$(OBJEXT) lib_a-fgetc.$(OBJEXT) \
- lib_a-fgetpos.$(OBJEXT) lib_a-fgets.$(OBJEXT) \
- lib_a-fileno.$(OBJEXT) lib_a-findfp.$(OBJEXT) \
- lib_a-fiprintf.$(OBJEXT) lib_a-flags.$(OBJEXT) \
- lib_a-fopen.$(OBJEXT) lib_a-fprintf.$(OBJEXT) \
- lib_a-fputc.$(OBJEXT) lib_a-fputs.$(OBJEXT) \
- lib_a-fread.$(OBJEXT) lib_a-freopen.$(OBJEXT) \
- lib_a-fscanf.$(OBJEXT) lib_a-fiscanf.$(OBJEXT) \
- lib_a-fseek.$(OBJEXT) lib_a-fsetpos.$(OBJEXT) \
- lib_a-ftell.$(OBJEXT) lib_a-fvwrite.$(OBJEXT) \
- lib_a-fwalk.$(OBJEXT) lib_a-fwrite.$(OBJEXT) \
- lib_a-getc.$(OBJEXT) lib_a-getchar.$(OBJEXT) \
- lib_a-getc_u.$(OBJEXT) lib_a-getchar_u.$(OBJEXT) \
- lib_a-getdelim.$(OBJEXT) lib_a-getline.$(OBJEXT) \
- lib_a-gets.$(OBJEXT) lib_a-iprintf.$(OBJEXT) \
- lib_a-iscanf.$(OBJEXT) lib_a-makebuf.$(OBJEXT) \
- lib_a-perror.$(OBJEXT) lib_a-printf.$(OBJEXT) \
- lib_a-putc.$(OBJEXT) lib_a-putchar.$(OBJEXT) \
- lib_a-putc_u.$(OBJEXT) lib_a-putchar_u.$(OBJEXT) \
- lib_a-puts.$(OBJEXT) lib_a-refill.$(OBJEXT) \
- lib_a-remove.$(OBJEXT) lib_a-rename.$(OBJEXT) \
- lib_a-rewind.$(OBJEXT) lib_a-rget.$(OBJEXT) \
- lib_a-scanf.$(OBJEXT) lib_a-sccl.$(OBJEXT) \
- lib_a-setbuf.$(OBJEXT) lib_a-setbuffer.$(OBJEXT) \
- lib_a-setlinebuf.$(OBJEXT) lib_a-setvbuf.$(OBJEXT) \
- lib_a-siprintf.$(OBJEXT) lib_a-siscanf.$(OBJEXT) \
- lib_a-sniprintf.$(OBJEXT) lib_a-snprintf.$(OBJEXT) \
- lib_a-sprintf.$(OBJEXT) lib_a-sscanf.$(OBJEXT) \
- lib_a-stdio.$(OBJEXT) lib_a-tmpfile.$(OBJEXT) \
- lib_a-tmpnam.$(OBJEXT) lib_a-ungetc.$(OBJEXT) \
+am__objects_1 = lib_a-clearerr.$(OBJEXT) lib_a-diprintf.$(OBJEXT) \
+ lib_a-dprintf.$(OBJEXT) lib_a-fclose.$(OBJEXT) \
+ lib_a-fdopen.$(OBJEXT) lib_a-feof.$(OBJEXT) \
+ lib_a-ferror.$(OBJEXT) lib_a-fflush.$(OBJEXT) \
+ lib_a-fgetc.$(OBJEXT) lib_a-fgetpos.$(OBJEXT) \
+ lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
+ lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
+ lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
+ lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
+ lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
+ lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
+ lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
+ lib_a-fsetpos.$(OBJEXT) lib_a-ftell.$(OBJEXT) \
+ lib_a-fvwrite.$(OBJEXT) lib_a-fwalk.$(OBJEXT) \
+ lib_a-fwrite.$(OBJEXT) lib_a-getc.$(OBJEXT) \
+ lib_a-getchar.$(OBJEXT) lib_a-getc_u.$(OBJEXT) \
+ lib_a-getchar_u.$(OBJEXT) lib_a-getdelim.$(OBJEXT) \
+ lib_a-getline.$(OBJEXT) lib_a-gets.$(OBJEXT) \
+ lib_a-iprintf.$(OBJEXT) lib_a-iscanf.$(OBJEXT) \
+ lib_a-makebuf.$(OBJEXT) lib_a-perror.$(OBJEXT) \
+ lib_a-printf.$(OBJEXT) lib_a-putc.$(OBJEXT) \
+ lib_a-putchar.$(OBJEXT) lib_a-putc_u.$(OBJEXT) \
+ lib_a-putchar_u.$(OBJEXT) lib_a-puts.$(OBJEXT) \
+ lib_a-refill.$(OBJEXT) lib_a-remove.$(OBJEXT) \
+ lib_a-rename.$(OBJEXT) lib_a-rewind.$(OBJEXT) \
+ lib_a-rget.$(OBJEXT) lib_a-scanf.$(OBJEXT) \
+ lib_a-sccl.$(OBJEXT) lib_a-setbuf.$(OBJEXT) \
+ lib_a-setbuffer.$(OBJEXT) lib_a-setlinebuf.$(OBJEXT) \
+ lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
+ lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
+ lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
+ lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
+ lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
+ lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
lib_a-vdprintf.$(OBJEXT) lib_a-viprintf.$(OBJEXT) \
lib_a-viscanf.$(OBJEXT) lib_a-vprintf.$(OBJEXT) \
lib_a-vscanf.$(OBJEXT) lib_a-vsiprintf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@ $(am__objects_2)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
-am__objects_3 = clearerr.lo dprintf.lo fclose.lo fdopen.lo feof.lo \
- ferror.lo fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo \
- findfp.lo fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo \
- fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo \
- fsetpos.lo ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo \
- getchar.lo getc_u.lo getchar_u.lo getdelim.lo getline.lo \
- gets.lo iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo \
- putc.lo putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo \
- remove.lo rename.lo rewind.lo rget.lo scanf.lo sccl.lo \
- setbuf.lo setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo \
- siscanf.lo sniprintf.lo snprintf.lo sprintf.lo sscanf.lo \
- stdio.lo tmpfile.lo tmpnam.lo ungetc.lo vdprintf.lo \
- viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
- vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
- wbuf.lo wsetup.lo
+am__objects_3 = clearerr.lo diprintf.lo dprintf.lo fclose.lo fdopen.lo \
+ feof.lo ferror.lo fflush.lo fgetc.lo fgetpos.lo fgets.lo \
+ fileno.lo findfp.lo fiprintf.lo flags.lo fopen.lo fprintf.lo \
+ fputc.lo fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo \
+ fseek.lo fsetpos.lo ftell.lo fvwrite.lo fwalk.lo fwrite.lo \
+ getc.lo getchar.lo getc_u.lo getchar_u.lo getdelim.lo \
+ getline.lo gets.lo iprintf.lo iscanf.lo makebuf.lo perror.lo \
+ printf.lo putc.lo putchar.lo putc_u.lo putchar_u.lo puts.lo \
+ refill.lo remove.lo rename.lo rewind.lo rget.lo scanf.lo \
+ sccl.lo setbuf.lo setbuffer.lo setlinebuf.lo setvbuf.lo \
+ siprintf.lo siscanf.lo sniprintf.lo snprintf.lo sprintf.lo \
+ sscanf.lo stdio.lo tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo \
+ vdprintf.lo viprintf.lo viscanf.lo vprintf.lo vscanf.lo \
+ vsiprintf.lo vsiscanf.lo vsnprintf.lo vsniprintf.lo \
+ vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
@ELIX_LEVEL_1_FALSE@am__objects_4 = asiprintf.lo asprintf.lo \
@ELIX_LEVEL_1_FALSE@ fcloseall.lo fseeko.lo ftello.lo getw.lo \
@ELIX_LEVEL_1_FALSE@ mktemp.lo putw.lo vasiprintf.lo \
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
GENERAL_SOURCES = \
clearerr.c \
+ diprintf.c \
dprintf.c \
fclose.c \
fdopen.c \
tmpfile.c \
tmpnam.c \
ungetc.c \
+ vdiprintf.c \
vdprintf.c \
viprintf.c \
viscanf.c \
vsprintf.c \
vsscanf.c \
wbuf.c \
- wsetup.c
+ wsetup.c
@ELIX_LEVEL_1_FALSE@ELIX_SOURCES = \
@ELIX_LEVEL_1_FALSE@ asiprintf.c \
lib_a-clearerr.obj: clearerr.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clearerr.obj `if test -f 'clearerr.c'; then $(CYGPATH_W) 'clearerr.c'; else $(CYGPATH_W) '$(srcdir)/clearerr.c'; fi`
+lib_a-diprintf.o: diprintf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-diprintf.o `test -f 'diprintf.c' || echo '$(srcdir)/'`diprintf.c
+
+lib_a-diprintf.obj: diprintf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-diprintf.obj `if test -f 'diprintf.c'; then $(CYGPATH_W) 'diprintf.c'; else $(CYGPATH_W) '$(srcdir)/diprintf.c'; fi`
+
lib_a-dprintf.o: dprintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-dprintf.o `test -f 'dprintf.c' || echo '$(srcdir)/'`dprintf.c
lib_a-ungetc.obj: ungetc.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ungetc.obj `if test -f 'ungetc.c'; then $(CYGPATH_W) 'ungetc.c'; else $(CYGPATH_W) '$(srcdir)/ungetc.c'; fi`
+lib_a-vdiprintf.o: vdiprintf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vdiprintf.o `test -f 'vdiprintf.c' || echo '$(srcdir)/'`vdiprintf.c
+
+lib_a-vdiprintf.obj: vdiprintf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vdiprintf.obj `if test -f 'vdiprintf.c'; then $(CYGPATH_W) 'vdiprintf.c'; else $(CYGPATH_W) '$(srcdir)/vdiprintf.c'; fi`
+
lib_a-vdprintf.o: vdprintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vdprintf.o `test -f 'vdprintf.c' || echo '$(srcdir)/'`vdprintf.c
#include <_ansi.h>
#include <reent.h>
#include <stdio.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <limits.h>
#include "local.h"
int
-#ifdef _HAVE_STDC
_DEFUN(_asiprintf_r, (ptr, strp, fmt),
struct _reent *ptr _AND
char **strp _AND
- _CONST char *fmt _DOTS)
-#else
-_asiprintf_r(ptr, strp, fmt, va_alist)
- struct _reent *ptr;
- char **strp;
- _CONST char *fmt;
- va_dcl
-#endif
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfiprintf (&f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
#ifndef _REENT_ONLY
int
-#ifdef _HAVE_STDC
_DEFUN(asiprintf, (strp, fmt),
char **strp _AND
- _CONST char *fmt _DOTS)
-#else
-asiprintf(strp, fmt, va_alist)
- char **strp;
- _CONST char *fmt;
- va_dcl
-#endif
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfiprintf (&f, fmt, ap);
+ ret = _vfiprintf_r (_REENT, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
return (ret);
}
-#endif
+#endif /* ! _REENT_ONLY */
#include <_ansi.h>
#include <reent.h>
#include <stdio.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <limits.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)
-#else
-_asprintf_r(ptr, strp, fmt, va_alist)
- struct _reent *ptr;
- char **strp;
- _CONST char *fmt;
- va_dcl
-#endif
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfprintf (&f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
#ifndef _REENT_ONLY
int
-#ifdef _HAVE_STDC
_DEFUN(asprintf, (strp, fmt),
char **strp _AND
- _CONST char *fmt _DOTS)
-#else
-asprintf(strp, fmt, va_alist)
- char **strp;
- _CONST char *fmt;
- va_dcl
-#endif
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfprintf (&f, fmt, ap);
+ ret = _vfprintf_r (_REENT, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
return (ret);
}
-#endif
+#endif /* ! _REENT_ONLY */
--- /dev/null
+/* Copyright (C) 2005, 2007 Shaun Jackman
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+/*
+FUNCTION
+<<diprintf>>, <<vdiprintf>>---print to a file descriptor
+
+INDEX
+ diprintf
+INDEX
+ vdiprintf
+
+ANSI_SYNOPSIS
+ #include <stdio.h>
+ #include <stdarg.h>
+ int diprintf(int <[fd]>, const char *<[format]>, ...);
+ int vdiprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
+ int _diprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+ const char *<[format]>, ...);
+ int _vidprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+ const char *<[format]>, va_list <[ap]>);
+
+DESCRIPTION
+<<diprintf>> and <<vdiprintf>> are similar to <<dprintf>> and <<vdprintf>>,
+except that only integer format specifiers are processed.
+
+RETURNS
+Similar to <<dprintf>> and <<vdprintf>>.
+
+PORTABILITY
+This set of functions is an integer-only extension, and is not portable.
+
+Supporting OS subroutines required: <<sbrk>>, <<write>>.
+*/
+
+#include <_ansi.h>
+#include <reent.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdarg.h>
+
+int
+_DEFUN(_diprintf_r, (ptr, fd, format),
+ struct _reent *ptr _AND
+ int fd _AND
+ const char *format _DOTS)
+{
+ va_list ap;
+ int n;
+
+ va_start (ap, format);
+ n = _vdiprintf_r (ptr, fd, format, ap);
+ va_end (ap);
+ return n;
+}
+
+#ifndef _REENT_ONLY
+
+int
+_DEFUN(diprintf, (fd, format),
+ int fd _AND
+ const char *format _DOTS)
+{
+ va_list ap;
+ int n;
+
+ va_start (ap, format);
+ n = _vdiprintf_r (_REENT, fd, format, ap);
+ va_end (ap);
+ return n;
+}
+
+#endif /* ! _REENT_ONLY */
-/* Copyright 2005 Shaun Jackman
+/* Copyright 2005, 2007 Shaun Jackman
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <stdarg.h>
int dprintf(int <[fd]>, const char *<[format]>, ...);
int vdprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
- int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+ int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
const char *<[format]>, ...);
- int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+ int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
const char *<[format]>, va_list <[ap]>);
TRAD_SYNOPSIS
#include <reent.h>
#include <stdio.h>
#include <unistd.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#ifdef _HAVE_STDC
int
-_dprintf_r(struct _reent *ptr, int fd, _CONST char *format, ...)
-#else
-int
-_dprintf_r(ptr, fd, format, va_alist)
- struct _reent *ptr;
- int fd;
- char *format;
- va_dcl
-#endif
+_DEFUN(_dprintf_r, (ptr, fd, format),
+ struct _reent *ptr _AND
+ int fd _AND
+ const char *format _DOTS)
{
va_list ap;
int n;
_REENT_SMALL_CHECK_INIT (ptr);
-#ifdef _HAVE_STDC
- va_start (ap, format);
-#else
- va_start (ap);
-#endif
+ va_start (ap, format);
n = _vdprintf_r (ptr, fd, format, ap);
va_end (ap);
return n;
#ifndef _REENT_ONLY
-#ifdef _HAVE_STDC
-int
-dprintf(int fd, _CONST char *format, ...)
-#else
int
-dprintf(fd, format, va_alist)
- struct _reent *ptr;
- int fd;
- char *format;
- va_dcl
-#endif
+_DEFUN(dprintf, (fd, format),
+ int fd _AND
+ const char *format _DOTS)
{
- va_list ap;
- int n;
- _REENT_SMALL_CHECK_INIT (_REENT);
-#ifdef _HAVE_STDC
- va_start (ap, format);
-#else
- va_start (ap);
-#endif
- n = _vdprintf_r (_REENT, fd, format, ap);
- va_end (ap);
- return n;
+ va_list ap;
+ int n;
+ struct _reent *ptr = _REENT;
+
+ _REENT_SMALL_CHECK_INIT (ptr);
+ va_start (ap, format);
+ n = _vdprintf_r (ptr, fd, format, ap);
+ va_end (ap);
+ return n;
}
#endif /* ! _REENT_ONLY */
*/
#include <_ansi.h>
+#include <reent.h>
#include <stdio.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#ifdef _HAVE_STDC
int
-fiprintf(FILE * fp, _CONST char *fmt,...)
-#else
+_DEFUN(_fiprintf_r, (ptr, fp, fmt),
+ struct _reent *ptr _AND
+ FILE * fp _AND
+ const char *fmt _DOTS)
+{
+ int ret;
+ va_list ap;
+
+ va_start (ap, fmt);
+ ret = _vfiprintf_r (ptr, fp, fmt, ap);
+ va_end (ap);
+ return ret;
+}
+
+#ifndef _REENT_ONLY
+
int
-fiprintf(fp, fmt, va_alist)
- FILE *fp;
- char *fmt;
- va_dcl
-#endif
+_DEFUN(fiprintf, (fp, fmt),
+ FILE * fp _AND
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfiprintf (fp, fmt, ap);
+ ret = _vfiprintf_r (_REENT, fp, fmt, ap);
va_end (ap);
return ret;
}
+
+#endif /* ! _REENT_ONLY */
*/
#include <_ansi.h>
+#include <reent.h>
#include <stdio.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#ifdef _HAVE_STDC
int
-fprintf(FILE * fp, _CONST char *fmt,...)
-#else
+_DEFUN(_fprintf_r, (ptr, fp, fmt),
+ struct _reent *ptr _AND
+ FILE *fp _AND
+ const char *fmt _DOTS)
+{
+ int ret;
+ va_list ap;
+
+ va_start (ap, fmt);
+ ret = _vfprintf_r (ptr, fp, fmt, ap);
+ va_end (ap);
+ return ret;
+}
+
+#ifndef _REENT_ONLY
+
int
-fprintf(fp, fmt, va_alist)
- FILE *fp;
- char *fmt;
- va_dcl
-#endif
+_DEFUN(fprintf, (fp, fmt),
+ FILE *fp _AND
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfprintf (fp, fmt, ap);
+ ret = _vfprintf_r (_REENT, fp, fmt, ap);
va_end (ap);
return ret;
}
+
+#endif /* ! _REENT_ONLY */
#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
-#ifdef _HAVE_STDC
int
-iprintf(_CONST char *fmt,...)
-#else
-int
-iprintf(fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
+_DEFUN(iprintf, (fmt),
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
+ struct _reent *ptr = _REENT;
- _REENT_SMALL_CHECK_INIT (_REENT);
-#ifdef _HAVE_STDC
+ _REENT_SMALL_CHECK_INIT (ptr);
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfiprintf (stdout, fmt, ap);
+ ret = _vfiprintf_r (ptr, _stdout_r (ptr), fmt, ap);
va_end (ap);
return ret;
}
#endif /* ! _REENT_ONLY */
-#ifdef _HAVE_STDC
int
-_iprintf_r(struct _reent *ptr, _CONST char *fmt, ...)
-#else
-int
-_iprintf_r(ptr, fmt, va_alist)
- struct _reent *ptr;
- char *fmt;
- va_dcl
-#endif
+_DEFUN(_iprintf_r, (ptr, fmt),
+ struct _reent *ptr _AND
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
_REENT_SMALL_CHECK_INIT (ptr);
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
ret = _vfiprintf_r (ptr, _stdout_r (ptr), fmt, ap);
va_end (ap);
return ret;
}
-
#include <_ansi.h>
#include <reent.h>
#include <stdio.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, ...)
-#else
-int
-_printf_r(ptr, fmt, va_alist)
- struct _reent *ptr;
- char *fmt;
- va_dcl
-#endif
+_DEFUN(_printf_r, (ptr, fmt),
+ struct _reent *ptr _AND
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
_REENT_SMALL_CHECK_INIT (ptr);
-#ifdef _HAVE_STDC
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
va_end (ap);
return ret;
#ifndef _REENT_ONLY
-#ifdef _HAVE_STDC
-int
-printf(_CONST char *fmt, ...)
-#else
int
-printf(fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
+_DEFUN(printf, (fmt),
+ const char *fmt _DOTS)
{
int ret;
va_list ap;
+ struct _reent *ptr = _REENT;
- _REENT_SMALL_CHECK_INIT (_REENT);
-#ifdef _HAVE_STDC
+ _REENT_SMALL_CHECK_INIT (ptr);
va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfprintf (_stdout_r (_REENT), fmt, ap);
+ ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
va_end (ap);
return ret;
}
#include <_ansi.h>
#include <stdio.h>
#include <limits.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#ifndef _REENT_ONLY
int
_DEFUN(vasiprintf, (strp, fmt, ap),
char **strp _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR | __SMBF;
- f._bf._base = f._p = NULL;
- f._bf._size = f._w = 0;
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (_REENT, &f, fmt, ap);
- if (ret >= 0)
- {
- *f._p = 0;
- *strp = f._bf._base;
- }
- return ret;
+ return _vasiprintf_r (_REENT, strp, fmt, ap);
}
#endif /* !_REENT_ONLY */
_DEFUN(_vasiprintf_r, (ptr, strp, fmt, ap),
struct _reent *ptr _AND
char **strp _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
int ret;
#include <_ansi.h>
#include <stdio.h>
#include <limits.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#ifndef _REENT_ONLY
int
_DEFUN(vasprintf, (strp, fmt, ap),
char **strp _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR | __SMBF;
- f._bf._base = f._p = NULL;
- f._bf._size = f._w = 0;
- f._file = -1; /* No file. */
- ret = _vfprintf_r (_REENT, &f, fmt, ap);
- if (ret >= 0)
- {
- *f._p = 0;
- *strp = f._bf._base;
- }
- return ret;
+ return _vasprintf_r (_REENT, strp, fmt, ap);
}
#endif /* !_REENT_ONLY */
_DEFUN(_vasprintf_r, (ptr, strp, fmt, ap),
struct _reent *ptr _AND
char **strp _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
int ret;
--- /dev/null
+/* Copyright 2005, 2007 Shaun Jackman
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <_ansi.h>
+#include <reent.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+
+int
+_DEFUN(_vdiprintf_r, (ptr, fd, format, ap),
+ struct _reent *ptr _AND
+ int fd _AND
+ const char *format _AND
+ va_list ap)
+{
+ char *p;
+ int n;
+
+ _REENT_SMALL_CHECK_INIT (ptr);
+ n = _vasiprintf_r (ptr, &p, format, ap);
+ if (n == -1) return -1;
+ n = _write_r (ptr, fd, p, n);
+ _free_r (ptr, p);
+ return n;
+}
+
+#ifndef _REENT_ONLY
+
+int
+_DEFUN(vdiprintf, (fd, format, ap),
+ int fd _AND
+ const char *format _AND
+ va_list ap)
+{
+ return _vdiprintf_r (_REENT, fd, format, ap);
+}
+
+#endif /* ! _REENT_ONLY */
-/* Copyright 2005 Shaun Jackman
+/* Copyright 2005, 2007 Shaun Jackman
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
int
-_DEFUN (_vdprintf_r, (ptr, fd, format, ap),
- struct _reent *ptr _AND
- int fd _AND
- _CONST char *format _AND
- va_list ap)
+_DEFUN(_vdprintf_r, (ptr, fd, format, ap),
+ struct _reent *ptr _AND
+ int fd _AND
+ const char *format _AND
+ va_list ap)
{
- char *p;
- int n;
- _REENT_SMALL_CHECK_INIT (ptr);
- n = _vasprintf_r (ptr, &p, format, ap);
- if (n == -1) return -1;
- n = _write_r (ptr, fd, p, n);
- _free_r (ptr, p);
- return n;
+ char *p;
+ int n;
+
+ _REENT_SMALL_CHECK_INIT (ptr);
+ n = _vasprintf_r (ptr, &p, format, ap);
+ if (n == -1)
+ return -1;
+ n = _write_r (ptr, fd, p, n);
+ _free_r (ptr, p);
+ return n;
}
#ifndef _REENT_ONLY
-int
-_DEFUN (vdprintf, (fd, format, ap),
- int fd _AND
- _CONST char *format _AND
- va_list ap)
+int
+_DEFUN(vdprintf, (fd, format, ap),
+ int fd _AND
+ const char *format _AND
+ va_list ap)
{
- _REENT_SMALL_CHECK_INIT (_REENT);
- return _vdprintf_r (_REENT, fd, format, ap);
+ return _vdprintf_r (_REENT, fd, format, ap);
}
#endif /* ! _REENT_ONLY */
#include <reent.h>
#include <stdio.h>
#include <limits.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#ifndef _REENT_ONLY
+#ifndef _REENT_ONLY
int
_DEFUN(vsiprintf, (str, fmt, ap),
char *str _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = INT_MAX;
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (_REENT, &f, fmt, ap);
- *f._p = 0;
- return ret;
+ return _vsiprintf_r (_REENT, str, fmt, ap);
}
#endif /* !_REENT_ONLY */
_DEFUN(_vsiprintf_r, (ptr, str, fmt, ap),
struct _reent *ptr _AND
char *str _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
int ret;
*f._p = 0;
return ret;
}
-
#include <reent.h>
#include <stdio.h>
#include <limits.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <errno.h>
#ifndef _REENT_ONLY
_DEFUN(vsniprintf, (str, size, fmt, ap),
char *str _AND
size_t size _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
- int ret;
- FILE f;
- struct _reent *ptr = _REENT;
-
- if (size > INT_MAX)
- {
- ptr->_errno = EOVERFLOW;
- return EOF;
- }
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (ptr, &f, fmt, ap);
- if (ret < EOF)
- ptr->_errno = EOVERFLOW;
- if (size > 0)
- *f._p = 0;
- return ret;
+ return _vsniprintf_r (_REENT, str, size, fmt, ap);
}
#endif /* !_REENT_ONLY */
struct _reent *ptr _AND
char *str _AND
size_t size _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
int ret;
#include <reent.h>
#include <stdio.h>
#include <limits.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <errno.h>
#ifndef _REENT_ONLY
_DEFUN(vsnprintf, (str, size, fmt, ap),
char *str _AND
size_t size _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
- int ret;
- FILE f;
- struct _reent *ptr = _REENT;
-
- if (size > INT_MAX)
- {
- ptr->_errno = EOVERFLOW;
- return EOF;
- }
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
- ret = _vfprintf_r (ptr, &f, fmt, ap);
- if (ret < EOF)
- ptr->_errno = EOVERFLOW;
- if (size > 0)
- *f._p = 0;
- return ret;
+ return _vsnprintf_r (_REENT, str, size, fmt, ap);
}
#endif /* !_REENT_ONLY */
struct _reent *ptr _AND
char *str _AND
size_t size _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
int ret;
#include <reent.h>
#include <stdio.h>
#include <limits.h>
-#ifdef _HAVE_STDC
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#ifndef _REENT_ONLY
+#ifndef _REENT_ONLY
int
_DEFUN(vsprintf, (str, fmt, ap),
char *str _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = INT_MAX;
- f._file = -1; /* No file. */
- ret = _vfprintf_r (_REENT, &f, fmt, ap);
- *f._p = 0;
- return ret;
+ return _vsprintf_r (_REENT, str, fmt, ap);
}
#endif /* !_REENT_ONLY */
_DEFUN(_vsprintf_r, (ptr, str, fmt, ap),
struct _reent *ptr _AND
char *str _AND
- _CONST char *fmt _AND
+ const char *fmt _AND
va_list ap)
{
int ret;
*f._p = 0;
return ret;
}
-