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 / 11printf.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  795b  |  55 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(string, count, adjust, file, fillch)
  14. register char *string;
  15. register int count;
  16. int adjust;
  17. register struct { int a; } *file;
  18. {
  19.  
  20.     while (adjust < 0) {
  21.         if (*string=='-' && fillch=='0') {
  22. #ifdef TRACE
  23.             if (file)
  24.                 putc(*string++, file);
  25.             else
  26. #endif
  27.                 putchar(*string++);
  28.             count--;
  29.         }
  30. #ifdef TRACE
  31.         if (file)
  32.             putc(fillch, file);
  33.         else
  34. #endif
  35.             putchar(fillch);
  36.         adjust++;
  37.     }
  38.     while (--count>=0)
  39. #ifdef TRACE
  40.         if (file)
  41.             putc(*string++, file);
  42.         else
  43. #endif
  44.             putchar(*string++);
  45.     while (adjust) {
  46. #ifdef TRACE
  47.         if (file)
  48.             putc(fillch, file);
  49.         else
  50. #endif
  51.             putchar(fillch);
  52.         adjust--;
  53.     }
  54. }
  55.