From 3bf091476a0a544e388e9c8b7aab3371a7d936b5 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 24 Nov 2004 00:45:41 +0000 Subject: 2004-11-23 Jeff Johnston * libc/include/stdio.h: Add new iprintf and iscanf variants. Also do some reordering. * libc/machine/powerpc/vfscanf.c: Remove __sccl function. * libc/stdio/Makefile.am: Add support for new iprintf and iscanf family functions. * libc/stdio/Makefile.in: Regenerated. * libc/stdio/fiprintf.c: Remove doc to siprintf.c. * libc/stdio/iprintf.c: Ditto. * libc/stdio/local.h (__svfiscanf_r): New prototype. * libc/stdio/siprintf.c: Add docs for various iprintf family functions. * libc/stdio/sniprintf.c: Move docs to siprintf.c. * libc/stdio/stdio.tex: Add new functions. * libc/stdio/vfscanf.c: Split out __sccl function to separate file and add special name defines so this file can be used to build vfiscanf.o. * libc/stdio/asiprintf.c: New file. * libc/stdio/fiscanf.c: Ditto. * libc/stdio/iscanf.c: Ditto. * libc/stdio/sccl.c: Ditto. * libc/stdio/siscanf.c: Ditto. * libc/stdio/vasiprintf.c: Ditto. * libc/stdio/viprintf.c: Ditto. * libc/stdio/viscanf.c: Ditto. * libc/stdio/vsiprintf.c: Ditto. * libc/stdio/vsiscanf.c: Ditto. * libc/stdio/vsniprintf.c: Ditto. --- newlib/libc/stdio/siprintf.c | 96 +++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 33 deletions(-) (limited to 'newlib/libc/stdio/siprintf.c') diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index 838200805..18ba489b7 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -17,37 +17,68 @@ /* FUNCTION -<>---write formatted output (integer only) + <>, <>, <>, <>, <>---format output +INDEX + fiprintf +INDEX + iprintf +INDEX + asiprintf INDEX siprintf +INDEX + sniprintf ANSI_SYNOPSIS #include + int iprintf(const char *<[format]> [, <[arg]>, ...]); + int fiprintf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]); int siprintf(char *<[str]>, const char *<[format]> [, <[arg]>, ...]); + int asiprintf(char **<[strp]>, const char *<[format]> [, <[arg]>, ...]); + int sniprintf(char *<[str]>, size_t <[size]>, const char *<[format]> [, <[arg]>, ...]); TRAD_SYNOPSIS - #include + #include - int siprintf(<[str]>, <[format]>, [, <[arg]>, ...]) - char *<[str]>; - const char *<[format]>; + int iprintf(<[format]> [, <[arg]>, ...]) + char *<[format]>; + + int fiprintf(<[fd]>, <[format]> [, <[arg]>, ...]); + FILE *<[fd]>; + char *<[format]>; + + int asiprintf(<[strp]>, <[format]> [, <[arg]>, ...]); + char **<[strp]>; + char *<[format]>; + + int siprintf(<[str]>, <[format]> [, <[arg]>, ...]); + char *<[str]>; + char *<[format]>; + + int sniprintf(<[str]>, size_t <[size]>, <[format]> [, <[arg]>, ...]); + char *<[str]>; + size_t <[size]>; + char *<[format]>; DESCRIPTION -<> is a restricted version of <>: it has the same -arguments and behavior, save that it cannot perform any floating-point -formatting: the <>, <>, <>, <>, and <> type specifiers -are not recognized. + <>, <>, <>, <>, + <>, are the same as <>, <>, + <>, <>, and <>, respectively, + only that they restrict usage to non-floating-point format + specifiers. RETURNS - <> returns the number of bytes in the output string, - save that the concluding <> is not counted. - <> returns when the end of the format string is - encountered. +<> and <> return the number of bytes in the output string, +save that the concluding <> is not counted. +<> and <> return the number of characters transmitted. +If an error occurs, <> and <> return <> and +<> returns -1. No error returns occur for <>. PORTABILITY -<> is not required by ANSI C. +<>, <>, <>, <>, and <> +are newlib extensions. Supporting OS subroutines required: <>, <>, <>, <>, <>, <>, <>. @@ -64,18 +95,18 @@ Supporting OS subroutines required: <>, <>, <>, #include #include "local.h" -#ifndef _REENT_ONLY - int #ifdef _HAVE_STDC -_DEFUN(siprintf, (str, fmt), - char *str _AND +_DEFUN(_siprintf_r, (ptr, str, fmt), + struct _reent *ptr _AND + char *str _AND _CONST char *fmt _DOTS) #else -siprintf(str, fmt, va_alist) - char *str; - _CONST char *fmt; - va_dcl +_siprintf_r(ptr, str, fmt, va_alist) + struct _reent *ptr; + char *str; + _CONST char *fmt; + va_dcl #endif { int ret; @@ -91,26 +122,24 @@ siprintf(str, fmt, va_alist) #else va_start (ap); #endif - ret = vfiprintf (&f, fmt, ap); + ret = _vfiprintf_r (ptr, &f, fmt, ap); va_end (ap); *f._p = 0; return (ret); } -#endif /* ! _REENT_ONLY */ +#ifndef _REENT_ONLY int #ifdef _HAVE_STDC -_DEFUN(_siprintf_r, (rptr, str, fmt), - struct _reent *rptr _AND - char *str _AND +_DEFUN(siprintf, (str, fmt), + char *str _AND _CONST char *fmt _DOTS) #else -_siprintf_r(rptr, str, fmt, va_alist) - struct _reent *rptr; - char *str; - _CONST char *fmt; - va_dcl +siprintf(str, fmt, va_alist) + char *str; + _CONST char *fmt; + va_dcl #endif { int ret; @@ -126,9 +155,10 @@ _siprintf_r(rptr, str, fmt, va_alist) #else va_start (ap); #endif - ret = _vfiprintf_r (rptr, &f, fmt, ap); + ret = _vfiprintf_r (_REENT, &f, fmt, ap); va_end (ap); *f._p = 0; return (ret); } +#endif -- cgit v1.2.3