Annotation of researchv10no/cmd/ap/apkeys/dist.c, revision 1.1.1.1

1.1       root        1: # include "stdio.h"
                      2: # include "assert.h"
                      3: # include "ctype.h"
                      4: # include "signal.h"
                      5: /*
                      6:  * select and send documents
                      7:  * keys files look like
                      8:  * *H tiles *P first paragraph *S whole story >Y write in Y
                      9:  * or |C pipe to command C or >>Y append to Y.
                     10:  * followed by keyword; keyword keyword ; keyword, keyword; keyword . keyword
                     11:  * optional !keyword for negation of appearance
                     12:  * no parens yet
                     13:  * (this order, same sentence, same file)
                     14:  */
                     15: char *fname, today[10];
                     16: int debug=0;
                     17: main(argc,argv)
                     18:        char *argv[];
                     19: {
                     20: /*
                     21:  * argv 1  list of users
                     22:  * argv 2  list of stories
                     23:  */
                     24: FILE *fs;
                     25: extern FILE *yyin;
                     26: char dline[250], *dp, *strchr();
                     27: int k;
                     28: long tm, time(); char *tx, *ctime();
                     29: extern FILE *yyin;
                     30: signal(SIGPIPE, SIG_IGN);
                     31: while (argv[1][0]=='-')
                     32:        {
                     33:        switch(argv[1][1])
                     34:                {
                     35:                case 'd': debug++; break;
                     36:                }
                     37:        argc--;argv++;
                     38:        }
                     39: assert(argc>2);
                     40: tm = time(0);
                     41: tx = ctime(&tm);
                     42: sprintf(today, "%3.3s%02.2d", tx+4,atoi(tx+8));
                     43: fs = fopen(argv[2], "r");
                     44: assert(fs!=NULL);
                     45: stread();
                     46: 
                     47: /* now read a data file */
                     48: fprintf(stderr, "finished stread\n");
                     49: while (fgets(dline, 200, fs))
                     50:        {
                     51:        trimnl(dline);
                     52:        yyin = fopen(dline, "r");
                     53:        fname=dline;
                     54:        if (yyin==NULL)
                     55:                continue;
                     56:        process();
                     57:        deliver();
                     58:        fclose(yyin);
                     59:        }
                     60: }

unix.superglobalmegacorp.com

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