#include "types.h" #include "flowpool.h" #include #include #include #include static struct FLOWFILE *head; int flowpool_init() { return 0; } int flowpool_readdir(char *dirname) { DIR *flowdir; struct dirent *entries; struct FLOWFILE *newflow; flowdir=opendir(dirname); if (!flowdir) { perror("opendir"); exit(1); } while ((entries = readdir(flowdir)) != NULL) { printf("T:%d N:%s\n",entries->d_type,entries->d_name ); LIST_INSERT_HEAD( head, newflow, element ); } closedir(flowdir); return 0; } int main(int argc, char *argv[]){ struct stat sb; if (argc != 2 ) { fprintf(stderr,"%s: Need one argument\n",argv[0]); exit(1); } if (stat(argv[1], &sb ) == -1) { perror("stat"); exit(1); } if (sb.st_mode & S_IFDIR ) { /* Flowdir */ printf("DIR\n"); flowpool_readdir(argv[1]); } else if (sb.st_mode & S_IFREG ) printf("File\n"); else printf("UKN\n"); }