Annotation of 42BSD/usr.bin/spell/spellout.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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