#include #include #include #include #include #include #include #include #include int printhelp() { printf("blah\n"); return 1; } int listdir(char *filename, int options) { DIR *d; struct dirent *e; d = opendir("."); if (d==NULL) { fprintf(stderr,"cannot access %s: No such file or directory\n",filename); abort(); return 1; } //oneshot flag, if ever implemented if(options == 0) { while ((e=readdir(d)) != NULL) { printf(":%d: %s\n",e->d_type,e->d_name); } } if(options == 1) { printhelp(); } if(options == 4) { while ((e=readdir(d)) != NULL) { //printf("%s\n",strcat("test","blah")); //printf("%s\n",strcat(bdir,e->d_name)); if(e->d_type == 4) { //char *tmp; //listdir(strcat(bdir,e->d_name),4); } } } closedir(d); return 0; } int main(int argc, char **argv) { strcat("test","test"); if(argc == 1) { listdir(".",4); return 1; } int i; const char flags[][255] = { "-h","-a","-R","-l","-t" }; const int flagval[] = { 1,2,4,8,16 }; const int NOFLAGS = 5; int options = 4; for(i=1;i