#include "engine.h"
#include <dirent.h>
#include <string.h>
fileinfo fi;
void findit(exp *ex){
	strcat(fi.wholename,"/");
	int le=strlen(fi.wholename);
	 DIR * dir=opendir(".");
	 struct dirent *e;
	 while ((e=readdir(dir))){
		if (strcmp(e->d_name,".")&&strcmp(e->d_name,"..")) {
		 fi.wholename[le]=0;
		 strcat(fi.wholename+le,e->d_name);

			evaluate(ex);
				if (e->d_type==DT_DIR){
					chdir(e->d_name);
					findit(ex);
					chdir("..");
				}
		 }
	 }
}
int main(int argc,int *argv[]){
	fi.wholename=malloc(1000);
	exp *e;
	INIT(e,logic);
	e->logic.oper=L_AND;
	INIT(e->logic.ex1,print);
	INIT(e->logic.ex2,print);
	e->logic.ex1->print.f=&fi;
	e->logic.ex2->print.f=&fi;

	findit(e);

	return 0;
}


