ack/lang/cem/libcc/stdio/sprintf.c

27 lines
489 B
C
Raw Normal View History

1987-03-31 10:45:53 +00:00
/* $Header$ */
1987-01-27 15:57:55 +00:00
#include <stdio.h>
1988-04-15 14:43:19 +00:00
#include <varargs.h>
1987-01-27 15:57:55 +00:00
1988-04-15 14:43:19 +00:00
char *sprintf(va_alist)
va_dcl
1987-01-27 15:57:55 +00:00
{
1988-04-15 14:43:19 +00:00
char *buf, *format;
1987-01-27 15:57:55 +00:00
FILE _tempfile;
1988-04-15 14:43:19 +00:00
va_list ap;
1987-01-27 15:57:55 +00:00
1988-04-15 14:43:19 +00:00
va_start(ap);
buf = va_arg(ap, char *);
format = va_arg(ap, char *);
_tempfile._fd = -1;
_tempfile._flags = IO_WRITEMODE + IO_UNBUFF;
_tempfile._buf = (unsigned char *) buf;
_tempfile._ptr = (unsigned char *) buf;
_tempfile._count = 32767;
1987-01-27 15:57:55 +00:00
1988-04-15 14:43:19 +00:00
_doprnt(format, ap, &_tempfile);
1987-01-27 15:57:55 +00:00
putc('\0',&_tempfile);
1988-04-15 14:43:19 +00:00
va_end(ap);
1987-01-27 15:57:55 +00:00
return buf;
}