home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / unix / gawk.sit / source / missing.d / vprintf.c < prev   
C/C++ Source or Header  |  1990-07-29  |  844b  |  55 lines

  1. #include <stdio.h>
  2. #include <varargs.h>
  3.  
  4. #ifndef BUFSIZ
  5. #include <stdio.h>
  6. #endif
  7.  
  8. #ifndef va_dcl
  9. #include <varargs.h>
  10. #endif
  11.  
  12. int
  13. vsprintf(str, fmt, ap)
  14.     char *str, *fmt;
  15.     va_list ap;
  16. {
  17.     FILE f;
  18.     int len;
  19.  
  20.     f._flag = _IOWRT+_IOSTRG;
  21.     f._ptr = (char *)str;    /* My copy of BSD stdio.h has this as (char *)
  22.                  * with a comment that it should be
  23.                  * (unsigned char *).  Since this code is
  24.                  * intended for use on a vanilla BSD system,
  25.                  * we'll stick with (char *) for now.
  26.                  */
  27.     f._cnt = 32767;
  28.     len = _doprnt(fmt, ap, &f);
  29.     *f._ptr = 0;
  30.     return (len);
  31. }
  32.  
  33. int
  34. vfprintf(iop, fmt, ap)
  35.     FILE *iop;
  36.     char *fmt;
  37.     va_list ap;
  38. {
  39.     int len;
  40.  
  41.     len = _doprnt(fmt, ap, iop);
  42.     return (ferror(iop) ? EOF : len);
  43. }
  44.  
  45. int
  46. vprintf(fmt, ap)
  47.     char *fmt;
  48.     va_list ap;
  49. {
  50.     int len;
  51.  
  52.     len = _doprnt(fmt, ap, stdout);
  53.     return (ferror(stdout) ? EOF : len);
  54. }
  55.