Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2004-05-08 01:00:41 +0400
committerJeff Johnston <jjohnstn@redhat.com>2004-05-08 01:00:41 +0400
commit186420eccf901499b2503548e0cd51c76f781954 (patch)
tree8b1a455ea5df3517d59fdf29b755a7512a353c45 /newlib/libc/stdio/siprintf.c
parent631fbe65fa105a836d21838152f2125067f2f27a (diff)
2004-05-07 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/iprintf.c (_iprintf_r): Fix old-style argument list for reentrant pointer. Call _vfiprintf_r. * libc/stdio/siprintf.c (_siprintf_r): New function. * libc/stdio/vfprintf.c (__sbprintf): Add reetrant struct pointer argument. Change all callers. Call _VFPRINTF_R. * libc/include/stdio.h (_siprintf_r, _vfiprintf_r): New prototypes.
Diffstat (limited to 'newlib/libc/stdio/siprintf.c')
-rw-r--r--newlib/libc/stdio/siprintf.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c
index 146233971..95ff8084f 100644
--- a/newlib/libc/stdio/siprintf.c
+++ b/newlib/libc/stdio/siprintf.c
@@ -27,6 +27,12 @@ ANSI_SYNOPSIS
int siprintf(char *<[str]>, const char *<[format]> [, <[arg]>, ...]);
+TRAD_SYNOPSIS
+ #include <stdio.h>
+
+ int siprintf(<[str]>, <[format]>, [, <[arg]>, ...])
+ char *<[str]>;
+ const char *<[format]>;
DESCRIPTION
<<siprintf>> is a restricted version of <<sprintf>>: it has the same
@@ -58,6 +64,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <limits.h>
#include "local.h"
+#ifndef _REENT_ONLY
+
int
#ifdef _HAVE_STDC
_DEFUN(siprintf, (str, fmt),
@@ -87,3 +95,38 @@ siprintf(str, fmt, va_alist)
*f._p = 0;
return (ret);
}
+
+#endif /* ! _REENT_ONLY */
+
+int
+#ifdef _HAVE_STDC
+_DEFUN(_siprintf_r, (rptr, str, fmt),
+ struct _reent *rptr _AND
+ 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
+#endif
+{
+ int ret;
+ va_list ap;
+ FILE f;
+
+ f._flags = __SWR | __SSTR;
+ f._bf._base = f._p = (unsigned char *) str;
+ f._bf._size = f._w = INT_MAX;
+#ifdef _HAVE_STDC
+ va_start (ap, fmt);
+#else
+ va_start (ap);
+#endif
+ ret = _vfiprintf_r (rptr, &f, fmt, ap);
+ va_end (ap);
+ *f._p = 0;
+ return (ret);
+}
+