/* * Laboration 2 i C och UNIX * * Komplett shell * ========================================= * * Christian Ohlsson, di7chro@cse.kau.se * Stefan Sonesson, di7stes@cse.kau.se * * Karlstads Universitet, 991209 * * *=========================================== */ %{ #include "tree.h" #include "y.tab.h" %} WORD [a-zA-Z0-9_\-\./\*]+ %% [ \t]+ {/*Käkar upp white-space*/} "\n" { insert(NULL); return NL;} "&" { insert(NULL); return AND;} "|" { insert(NULL); return PIPE;} ";" { insert(NULL); return SEMI;} ">" { insert(NULL); return GREAT;} "<" { insert(NULL); return LESS;} ">>" { insert(NULL); return DBLARR;} "exit" { printf("OK, use the other stinky shell then...\n");exit(0);} {WORD} { yylval.txt=insert(yytext);return WORD;} . { fprintf(stderr,"What?\n",6);} %%