extern ssize_t sfnputc(Sfio_t *, int, size_t);
extern int sfungetc(Sfio_t *, int);
extern int sfprintf(Sfio_t *, const char *, ...);
- extern int sfsprintf(char *, int, const char *, ...);
- extern int sfvsprintf(char *, int, const char *, va_list);
extern int sfvprintf(Sfio_t *, const char *, va_list);
extern int sfscanf(Sfio_t *, const char *, ...);
extern int sfsscanf(const char *, const char *, ...);
va_end(args);
return rv;
}
-
-int sfvsprintf(char *s, int n, const char *form, va_list args)
-{
- Sfio_t f;
- int rv;
-
- if (!s || n <= 0)
- return -1;
-
- /* make a fake stream */
- SFCLEAR(&f);
- f.flags = SF_STRING | SF_WRITE;
- f.mode = SF_WRITE;
- f.size = n - 1;
- f.data = f.next = f.endr = (uchar *) s;
- f.endb = f.endw = f.data + f.size;
-
- rv = sfvprintf(&f, form, args);
- *f.next = '\0';
- _Sfi = f.next - f.data;
-
- return rv;
-}
-
-int sfsprintf(char *s, int n, const char *form, ...)
-{
- va_list args;
- int rv;
- va_start(args, form);
- rv = sfvsprintf(s, n, form, args);
- va_end(args);
-
- return rv;
-}