Annotation of researchv10no/cmd/ap/apkeys/dlex.l, revision 1.1.1.1

1.1       root        1: %%
                      2: [-'A-Za-z0-9#]+        {lcase(yytext);yylval=svc(sufstr(yytext)); return(WORD);}
                      3: "!"    return(NEG);
                      4: ","    return(COMMA);
                      5: "."    return(DOT);
                      6: "*H"   return(HEAD);
                      7: "*P"   return(PARA);
                      8: "*S"   return(STORY);
                      9: ">".*  {yylval=svc(yytext); return(WRITE);}
                     10: ">>".* {yylval=svc(yytext); return(APPEND);}
                     11: "|".*  {yylval=svc(yytext); return(PIPE);}
                     12: \n     return(NL);
                     13: .      ;
                     14: %%
                     15: yyerror(s)
                     16: {
                     17: extern char *infile;
                     18: fprintf(stderr, "%s\n", s);
                     19: fprintf(stderr, "Bad input spec file %s line %d\n", infile, yylineno);
                     20: }
                     21: yywrap()
                     22: {
                     23: return(1); /* always stop on eof */
                     24: }
                     25: char *
                     26: svc(s)
                     27:        char *s;
                     28: {
                     29: char *p, *calloc();
                     30: p = calloc(strlen(s)+1,1);
                     31: assert(p!=0);
                     32: strcpy(p,s);
                     33: return(p);
                     34: }
                     35: lcase(s)
                     36:        register char *s;
                     37: {
                     38: register int c;
                     39: register char *p;
                     40: if (*s==0) return;
                     41: for(p=s+1; c= *p; p++)
                     42:        if (isupper(c))
                     43:                return;
                     44: if (isupper( c = *s))
                     45:        *s = tolower(c);
                     46: }

unix.superglobalmegacorp.com

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