Annotation of 40BSD/cmd/spell/spellout.c, revision 1.1

1.1     ! root        1: #include "spell.h"
        !             2: 
        !             3: main(argc, argv)
        !             4: char **argv;
        !             5: {
        !             6:        register i, j;
        !             7:        long h;
        !             8:        register long *lp;
        !             9:        char word[NW];
        !            10:        int dflag = 0;
        !            11:        int indict;
        !            12:        register char *wp;
        !            13: 
        !            14:        if (argc>1 && argv[1][0]=='-' && argv[1][1]=='d') {
        !            15:                dflag = 1;
        !            16:                argc--;
        !            17:                argv++;
        !            18:        }
        !            19:        if(argc<=1) {
        !            20:                fprintf(stderr,"spellout: arg count\n");
        !            21:                exit(1);
        !            22:        }
        !            23:        if(!prime(argc,argv)) {
        !            24:                fprintf(stderr,
        !            25:                    "spellout: cannot initialize hash table\n");
        !            26:                exit(1);
        !            27:        }
        !            28:        while (fgets(word, sizeof(word), stdin)) {
        !            29:                indict = 1;
        !            30:                for (i=0; i<NP; i++) {
        !            31:                        for (wp = word, h = 0, lp = pow2[i];
        !            32:                                (j = *wp) != '\0'; ++wp, ++lp)
        !            33:                                h += j * *lp;
        !            34:                        h %= p[i];
        !            35:                        if (get(h)==0) {
        !            36:                                indict = 0;
        !            37:                                break;
        !            38:                        }
        !            39:                }
        !            40:                if (dflag == indict)
        !            41:                        fputs(word, stdout);
        !            42:        }
        !            43: }

unix.superglobalmegacorp.com

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