Annotation of researchv10no/cmd/cfront/libstring/test8.c, revision 1.1

1.1     ! root        1: // list test program.  Takes one arg and standard input.  Removes
        !             2: // all copies of arg from input
        !             3: 
        !             4: #include "String.h"
        !             5: #include "list.h"
        !             6: 
        !             7: listdeclare(String)
        !             8: 
        !             9: String_list
        !            10: remove(String s, String_list ls)
        !            11: {
        !            12:        String_list ans;
        !            13:        while ( ls ) {
        !            14:                String  temp;
        !            15:                ls.getX(temp);
        !            16:                if ( s != temp )
        !            17:                        ans.put(temp);
        !            18:        }
        !            19:        return ans;
        !            20: }
        !            21: 
        !            22: 
        !            23: main(int argc, char **argv)
        !            24: {
        !            25:        String_list     slist;
        !            26:        String  temp;
        !            27:        if ( argc != 2 ) {
        !            28:                cout << "must supply an arg\n";
        !            29:                exit(1);
        !            30:        }
        !            31:        String  arg(argv[1]);
        !            32:        while ( cin >> temp)
        !            33:                slist.put(temp);
        !            34:        cout << remove(arg, slist) << "\n";
        !            35: }

unix.superglobalmegacorp.com

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