home *** CD-ROM | disk | FTP | other *** search
- #include <stdarg.h>
- #include <stdio.h>
- #include <limits.h>
- #include "lib.h"
-
- #if __STDC__
- int sprintf(char *buf, const char *fmt, ...)
- #else
- int sprintf(buf, fmt) char *buf; const char *fmt;
- #endif
- {
- va_list args;
- register int n;
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
-
- va_start(args, fmt);
- n = _doprnt(&sf, fmt, args);
- *(sf._ptr) = '\0'; /* always tie off the string */
- va_end(args);
- return(n);
- }
-
- int
- vsprintf(buf, fmt, args)
- char *buf;
- const char *fmt;
- va_list args;
- {
- register int n;
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
-
- n = _doprnt(&sf, fmt, args);
- *(sf._ptr) = '\0'; /* always tie of the string */
- return(n);
- }
-