home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / dca2troff / misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-02-18  |  575 b   |  44 lines

  1. #include "dca2troff.h"
  2.  
  3.  
  4. do_flush(count)
  5. int count;
  6. {
  7.     char c;
  8.     if ( count == 0 )
  9.     return;
  10.     while ( count > 0 )
  11.     {
  12.     c = get1ch();
  13.     --count;
  14.     }
  15. }
  16.  
  17. /* flush a structured field */
  18. flush_sf()
  19. {
  20.     do_flush(sf_length - sf_incnt);
  21. }
  22.  
  23. /* get a char from stdin, increment the sf count */
  24. get1ch()
  25. {
  26.     ++sf_incnt;
  27.     return (getchar());
  28. }
  29.  
  30. /* get a 2 byte number from the input */
  31. get1num()
  32. {
  33.     int c, num;
  34.     c = get1ch();        /* get 1st byte of length */
  35.     if ( c == EOF )
  36.         exit(0);    /* all done */
  37.     c &= 0377;
  38.     num = c << 8;
  39.     c = get1ch();
  40.     c &= 0377;
  41.     num = num + c;
  42.     return(num);
  43. }
  44.