But i was tooooooooo lazy to go through the entire configuration file and writing the regular expression for all server configuration information.so i dropped the project.however the program i have written can be used as a skeleton for further improving the project.
here is the lex code.those who want c# code do mail me. :D
%{
#include<stdio.h>
#include<stdlib.h>
int count=0,flag=0,nummodule=0;
%}
%%
ServerRoot[ ]*[\"][a-zA-Z][:]*[/][/a-z0-9\.A-Z ]*[\"] { printf("%s\n",yytext); }
["#"]*Listen[ ]*[0-9]*[\.][0-9]*[\.][0-9]*[\.][0-9]* { flag=1; if(flag==0){ printf("%s\n",yytext); } else { printf("Listen undefined\n");}flag=0;}
Listen[ ]*[0-9]+ {printf("%s\n",yytext);}
["#"]*LoadModule[ ][a-zA-Z_0-9]*[ ][a-z/A-Z0-9\.]* { printf("%s\n",yytext);nummodule++; }
ServerAdmin[ ]*[@a-zA-Z\.0-9]* {printf("%s\n",yytext);}
ServerName[ ]*[[@a-zA-Z\.0-9]* {printf("%s\n",yytext);}
ErrorLog[ ]*[\"a-zA-Z0-9\/]* {printf("%s\n",yytext);}
DocumentRoot[ ]*[\"][a-zA-Z][:]*[/][/a-z0-9\.A-Z ]*[\"] { printf("%s\n",yytext);}
DirectoryIndex[ ]*[a-zA-Z_0-9]*[\.][a-zA-Z_0-9]* {printf("%s\n",yytext);}
ErrorLog[ ]*[\"][a-zA-Z_0-9]*[\/][a-zA-Z_0-9]*[\"] {printf("%s\n",yytext);}
\n ;
. ;
%%
int main(int argc,char *argv[])
{
yyin=fopen("httpd.conf","r");
yyout=fopen("sample.txt","w");
yylex();
return 0;
}
int yywrap()
{
return 1;
}
Dont get scared by looking into code if you are beginner.just get along.its one of the easiest :D