home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / libsrc~1.z / libsrc~1 / sprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-28  |  720 b   |  39 lines

  1. #define __SRC__
  2. #include <stdarg.h>
  3. #include <stdio.h>
  4. #include <limits.h>
  5. #include <ansi.h>
  6.  
  7. extern int doprnt();
  8.  
  9.  
  10. int sprintf(buf, fmt, arg)
  11.     char *buf;
  12.     _CONST char *fmt;
  13.     int arg;
  14.     {
  15.     register int n;
  16.     FILE sf = 
  17.     {0L, (unsigned char *)buf, (unsigned char *)buf,
  18.          _IOWRT|_IOSTRING|_IOFBF, 0, INT_MAX,'\0'};
  19.     
  20.     n = _doprnt(&sf, fmt, &arg);
  21.     *(sf._ptr) = '\0';        /* always tie of the string */
  22.     return(n);
  23.     }
  24.  
  25. int vsprintf(buf, fmt, args)
  26.     char *buf;
  27.     _CONST char *fmt;
  28.     va_list args;
  29.     {
  30.     register int n;
  31.     FILE sf = 
  32.     {0L, (unsigned char *)buf, (unsigned char *)buf,
  33.          _IOWRT|_IOSTRING|_IOFBF, 0, INT_MAX,'\0'};
  34.  
  35.     n = _doprnt(&sf, fmt, args);
  36.     *(sf._ptr) = '\0';        /* always tie of the string */
  37.     return(n);
  38.     }
  39.