Annotation of 41BSD/cmd/oldcsh/printf.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.