This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

reentrant siprintf


Hello. Here is the reentrant siprintf version + small doc fix.

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
Index: siprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/siprintf.c,v
retrieving revision 1.3
diff -c -r1.3 siprintf.c
*** siprintf.c	23 Apr 2004 20:01:55 -0000	1.3
--- siprintf.c	4 May 2004 13:14:13 -0000
***************
*** 27,32 ****
--- 27,38 ----
  
          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,63 ****
--- 64,71 ----
  #include <limits.h>
  #include "local.h"
  
+ #ifndef _REENT_ONLY
+ 
  int
  #ifdef _HAVE_STDC
  _DEFUN(siprintf, (str, fmt),
***************
*** 87,89 ****
--- 95,132 ----
    *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);
+ }
+ 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]