diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-28 16:38:35 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-28 16:38:35 +0000 |
| commit | 2d776fcd61be168e1ff0ff2e4a5e71835e7cea19 (patch) | |
| tree | 7cf274897bf540d5332d446f583ffd066e4e2e1d /src/director.c | |
| parent | b877ae23ac5d380ab3aa48d7724045cf4883b186 (diff) | |
- prekopanie adresarovej struktury, prva cast
git-svn-id: http://opensvn.csie.org/tuxanci_ng@77 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
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); -} - - |