Annotation of 42BSD/usr.lib/learn/C/L5.1g, revision 1.1

1.1     ! root        1: #print
        !             2: Write a program to copy its input to its output,
        !             3: replacing each string of one or more blanks by
        !             4: a single blank.
        !             5: #once #create Ref
        !             6:    This    has   lines   with several     blanks    
        !             7: including some in  funny places.    
        !             8: #once #create Ref1
        !             9:           
        !            10: #once #create Answer
        !            11:  This has lines with several blanks 
        !            12: including some in funny places. 
        !            13:  
        !            14: #user
        !            15: a.out <Ref >test
        !            16: a.out <Ref1 >>test
        !            17: #cmp test Answer
        !            18: #succeed
        !            19: One way:
        !            20: 
        !            21:  #include <stdio.h>
        !            22: 
        !            23: main()
        !            24: {
        !            25:        int c;
        !            26: 
        !            27:        for (c = getchar(); c != EOF; ) {
        !            28:                putchar(c);
        !            29:                if (c == ' ')
        !            30:                        while ((c = getchar()) == ' ')
        !            31:                                ;
        !            32:                else
        !            33:                        c = getchar();
        !            34:        }
        !            35: }
        !            36: #log
        !            37: #next
        !            38: 9.1a 10

unix.superglobalmegacorp.com

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