home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / utils / texi2ps / screenio.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-13  |  1.7 KB  |  65 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. /* texi2ps -- convert texinfo format files into Postscript files.
  3.  
  4.    Copyright (C) 1995 DJ Delorie (dj@delorie.com)
  5.  
  6.    texi2ps is distributed in the hope that it will be useful,
  7.    but WITHOUT ANY WARRANTY.  No author or distributor accepts
  8.    responsibility to anyone for the consequences of using it or for
  9.    whether it serves any particular purpose or works at all, unless he
  10.    says so in writing.  Refer to the GNU General Public License
  11.    for full details.
  12.  
  13.    Everyone is granted permission to copy, modify and redistribute
  14.    texi2ps, but only under the conditions described in the GNU
  15.    General Public License.   A copy of this license is supposed to
  16.    have been given to you along with texi2ps so you can know your
  17.    rights and responsibilities.  It should be in a file named COPYING.
  18.    Among other things, the copyright notice and this notice must be
  19.    preserved on all copies.  */
  20.  
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include <stdarg.h>
  24. #include "screenio.h"
  25.  
  26. static int last_l=0;
  27. int screenio_enabled = 0;
  28.  
  29. static void
  30. show(char *fmt, va_list a)
  31. {
  32.   int ol, l;
  33.   fputc('\r', stderr);
  34.   l = ol = vfprintf(stderr, fmt, a);
  35.   while (l < last_l)
  36.   {
  37.     fputc(' ', stderr);
  38.     l++;
  39.   }
  40.   fflush(stderr);
  41.   last_l = ol;
  42. }
  43.  
  44. void screenio_note(char *fmt, ...)
  45. {
  46.   va_list a=0;
  47.   if (!screenio_enabled)
  48.     return;
  49.   va_start(a,fmt);
  50.   show(fmt, a);
  51.   va_end(a);
  52. }
  53.  
  54. void screenio_print(char *fmt, ...)
  55. {
  56.   va_list a=0;
  57.   if (!screenio_enabled)
  58.     return;
  59.   va_start(a,fmt);
  60.   show(fmt, a);
  61.   va_end(a);
  62.   fputc('\n', stderr);
  63.   last_l = 0;
  64. }
  65.