csh and tcsh work

Sources of csh/printf.c

csh と tcsh のソース

Bill Joy

First published: October, 1978.

Copyright © 1979 Regents of the University of California.

  1. 1
    /* Copyright (c) 1979 Regents of the University of California */
  2. 2
    /*
  3. 3
     * Hacked "printf" which prints through putchar.
  4. 4
     * DONT USE WITH STDIO!
  5. 5
     */
  6. 6
    printf(fmt, args)
  7. 7
    char *fmt;
  8. 8
    {
  9. 9
    	_doprnt(fmt, &args, 0);
  10. 10
    }
  11. 11
  12. 12
    _strout(count, string, adjust, foo, fillch)
  13. 13
    register char *string;
  14. 14
    register int count;
  15. 15
    int adjust;
  16. 16
    register struct { int a[6]; } *foo;
  17. 17
    {
  18. 18
  19. 19
    	if (foo != 0)
  20. 20
    		abort();
  21. 21
    	while (adjust < 0) {
  22. 22
    		if (*string=='-' && fillch=='0') {
  23. 23
    			putchar(*string++);
  24. 24
    			count--;
  25. 25
    		}
  26. 26
    		putchar(fillch);
  27. 27
    		adjust++;
  28. 28
    	}
  29. 29
    	while (--count>=0)
  30. 30
    		putchar(*string++);
  31. 31
    	while (adjust) {
  32. 32
    		putchar(fillch);
  33. 33
    		adjust--;
  34. 34
    	}
  35. 35
    }

To the top of this page