home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / VIDEO / VVPRINTF.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  887 b   |  41 lines

  1. /* vvprintf.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <stdio.h>
  5. #include <stdarg.h>
  6. #include <sys/video.h>
  7. #include "video2.h"
  8.  
  9. static int _v_flush (FILE *stream, int c)
  10. {
  11.   int n;
  12.  
  13.   n = stream->ptr - stream->buffer;
  14.   if (n > 0)
  15.     _v_puts_len (stream->buffer, n);
  16.   stream->ptr = stream->buffer;
  17.   *stream->ptr++ = (char)c;
  18.   stream->wcount = stream->buf_size - 1;
  19.   return (0);
  20. }
  21.  
  22.  
  23. int v_vprintf (const char *fmt, va_list arg_ptr)
  24. {
  25.   FILE trick;
  26.   int result;
  27.   char buf[512];
  28.  
  29.   trick.buffer = buf;
  30.   trick.ptr = buf;
  31.   trick.rcount = 0;
  32.   trick.wcount = sizeof (buf);
  33.   trick.handle = -1;
  34.   trick.flags = _IOOPEN|_IOSTRING|_IOBUFUSER|_IOWRT;
  35.   trick.buf_size = sizeof (buf);
  36.   trick.flush = _v_flush;
  37.   result = _output (&trick, fmt, arg_ptr);
  38.   _v_flush (&trick, 0);
  39.   return (result);
  40. }
  41.