diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-01-12 22:46:50 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-01-12 22:46:50 +0000 |
commit | a22c56359677c75d8671d53c9d1c9a63409b7a19 (patch) | |
tree | 4b81e2aca13f67e44a095dffd1b01a6b732f33e6 /mdk-stage1/tools.c | |
parent | 337771650fe20f2661eed86c7594f5fe17503397 (diff) | |
download | drakx-a22c56359677c75d8671d53c9d1c9a63409b7a19.tar drakx-a22c56359677c75d8671d53c9d1c9a63409b7a19.tar.gz drakx-a22c56359677c75d8671d53c9d1c9a63409b7a19.tar.bz2 drakx-a22c56359677c75d8671d53c9d1c9a63409b7a19.tar.xz drakx-a22c56359677c75d8671d53c9d1c9a63409b7a19.zip |
- add load of third party modules in Expert mode (PS rulz)
Diffstat (limited to 'mdk-stage1/tools.c')
-rw-r--r-- | mdk-stage1/tools.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index 7266409c5..2a50c0ee4 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -27,6 +27,8 @@ #include <string.h> #include <ctype.h> #include <stdio.h> +#include <dirent.h> +#include <sys/types.h> #include <zlib.h> #include "stage1.h" #include "log.h" @@ -337,3 +339,22 @@ void add_to_env(char * name, char * value) env_size++; my_env[env_size] = NULL; } + + +char ** list_directory(char * direct) +{ + char * tmp[500]; + int i = 0; + struct dirent *ep; + DIR *dp = opendir(direct); + while (dp && (ep = readdir(dp))) { + if (strcmp(ep->d_name, ".") && strcmp(ep->d_name, "..")) { + tmp[i] = strdup(ep->d_name); + i++; + } + } + if (dp) + closedir(dp); + tmp[i] = NULL; + return memdup(tmp, sizeof(char*) * (i+1)); +} |