home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / ex / printf.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  883b  |  57 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. #ifdef TRACE
  3. #include <stdio.h>
  4. #undef putchar
  5. #endif
  6.  
  7. printf(fmt, args)
  8. {
  9.  
  10.     _doprnt(fmt, &args, 0);
  11. }
  12.  
  13. _strout(count, string, adjust, flail, fillch)
  14. register char *string;
  15. register count;
  16. register int adjust;
  17. #ifdef TRACE
  18. register struct _iobuf *flail;
  19. #else
  20. register struct {int i; } *flail;
  21. #endif
  22. {
  23.     if (adjust < 0) {
  24.         if (*string=='-' && fillch=='0') {
  25. #ifdef TRACE
  26.             if (flail)
  27.                 putc(*string++, flail);
  28.             else
  29. #endif
  30.                 putchar(*string++);
  31.             count--;
  32.         }
  33.         adjust= -adjust;
  34.         while (--adjust>=0)
  35. #ifdef TRACE
  36.             if (flail)
  37.                 putc(fillch, flail);
  38.             else
  39. #endif
  40.                 putchar(fillch);
  41.     }
  42.     while (--count>=0)
  43. #ifdef TRACE
  44.         if (flail)
  45.             putc(*string++, flail);
  46.         else
  47. #endif
  48.             putchar(*string++);
  49.     while (--adjust>=0)
  50. #ifdef TRACE
  51.         if (flail)
  52.             putc(fillch, flail);
  53.         else
  54. #endif
  55.             putchar(fillch);
  56. }
  57.