home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Mint
/
mntlib32.zoo
/
sprintf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-08
|
1KB
|
61 lines
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#include "lib.h"
#ifndef __GNUC__
static FILE dummyf =
{0L, (unsigned char *)0, (unsigned char *)0,
_IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX, '\0'};
#endif
__EXTERN int _doprnt __PROTO((FILE *file, const char *fmt, va_list argp));
#ifdef __STDC__
int sprintf(char *buf, const char *fmt, ...)
#else
int sprintf(buf, fmt)
char *buf;
const char *fmt;
#endif
{
register int n;
va_list argp;
#ifdef __GNUC__
FILE sf =
{0L, (unsigned char *)buf, (unsigned char *)buf,
_IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
#else
FILE sf;
sf = dummyf;
sf._ptr = sf._base = (unsigned char *)buf;
#endif
va_start(argp, fmt);
n = _doprnt(&sf, fmt, argp);
*(sf._ptr) = '\0'; /* always tie of the string */
return(n);
}
int vsprintf(buf, fmt, args)
char *buf;
const char *fmt;
va_list args;
{
register int n;
#ifdef __GNUC__
FILE sf =
{0L, (unsigned char *)buf, (unsigned char *)buf,
_IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
#else
FILE sf;
sf = dummyf;
sf._ptr = sf._base = (unsigned char *)buf;
#endif
n = _doprnt(&sf, fmt, args);
*(sf._ptr) = '\0'; /* always tie of the string */
return(n);
}