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

1.1       root        1: # include  "stdio.h"
                      2: # include "ctype.h"
                      3: # include "assert.h"
                      4: char *infile, *udir, *uname; extern int yylineno;
                      5: int destyet=0;
                      6: main (argc, argv)
                      7:        char *argv[];
                      8: {
                      9: /*
                     10:  * argv 1  list of users
                     11:  * argv 2  list of stories
                     12:  */
                     13: FILE *fu, *fs;
                     14: char uline[250], *strchr(), *svc();
                     15: int k;
                     16: extern FILE *yyin;
                     17: assert(argc>2);
                     18: fu = fopen(argv[1], "r");
                     19: fs = fopen(argv[2], "r");
                     20: assert(fu!=NULL);
                     21: assert(fs!=NULL);
                     22: while (fgets( uline, 250, fu))
                     23:        {
                     24:        trimnl(uline);
                     25:        uname = strchr(uline, ' ');
                     26:        assert(uname!=0);
                     27:        *uname++ = 0; /* now uline is file, uname is name */
                     28:        udir = strchr(uname, ' ');
                     29:        assert(udir!=0);
                     30:        *udir++ = 0; /* now udir is directory */
                     31:        udir = svc(udir);
                     32:        yyin = fopen(infile=uline, "r");
                     33:        yylineno=destyet=0;
                     34:        if (yyin==NULL)
                     35:                {
                     36:                fprintf(stderr, "Can't read %s\n",uline);
                     37:                continue;
                     38:                }
                     39:        k = yyparse();
                     40:        fclose(yyin);
                     41:        }
                     42: dump();
                     43: }
                     44: 
                     45: trimnl(s)
                     46:        char *s;
                     47: {
                     48: while (*s) s++;
                     49: if (*--s== '\n') *s=0;
                     50: }

unix.superglobalmegacorp.com

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