diff options
Diffstat (limited to 'src/director.c')
| -rwxr-xr-x | src/director.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/director.c b/src/director.c deleted file mode 100755 index 6d2fe8c..0000000 --- a/src/director.c +++ /dev/null @@ -1,66 +0,0 @@ - -#include <dirent.h> -#include <sys/types.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <unistd.h> -#include <assert.h> - -#include "main.h" -#include "list.h" -#include "string_length.h" - -typedef struct director_struct -{ - char *path; - list_t *list; -} director_t; - - -director_t* loadDirector(char *s) -{ - director_t *new; - DIR *dir; - struct dirent *item; - char path[STR_PATH_SIZE]; - - assert( s != 0 ); - - new = malloc( sizeof(director_t) ); - memset(new, 0, sizeof(director_t) ); - - new->list = newList(); - - if( s[0] == '/' ) - { - strcpy(path, s); - } - else - { - getcwd(path, STR_PATH_SIZE); - strcat(path, s+1); - } - - new->path = strdup(path); - - dir = opendir(new->path); - - while( ( item = readdir(dir) ) != NULL ) - addList(new->list, strdup(item->d_name) ); - - closedir(dir); - - return new; -} - -void destroyDirector(director_t *p) -{ - assert( p != NULL ); - - destroyListItem(p->list, free); - free(p->path); - free(p); -} - - |