From a22c56359677c75d8671d53c9d1c9a63409b7a19 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Fri, 12 Jan 2001 22:46:50 +0000 Subject: - add load of third party modules in Expert mode (PS rulz) --- mdk-stage1/tools.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'mdk-stage1/tools.c') 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 #include #include +#include +#include #include #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)); +} -- cgit v1.2.1