summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/disk.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-01-12 22:46:50 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-01-12 22:46:50 +0000
commita22c56359677c75d8671d53c9d1c9a63409b7a19 (patch)
tree4b81e2aca13f67e44a095dffd1b01a6b732f33e6 /mdk-stage1/disk.c
parent337771650fe20f2661eed86c7594f5fe17503397 (diff)
downloaddrakx-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/disk.c')
-rw-r--r--mdk-stage1/disk.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
index 7c8f2406c..9e0946313 100644
--- a/mdk-stage1/disk.c
+++ b/mdk-stage1/disk.c
@@ -24,8 +24,6 @@
#include <stdio.h>
#include <string.h>
#include <sys/mount.h>
-#include <dirent.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "stage1.h"
@@ -38,22 +36,18 @@
#include "disk.h"
-
-static char * list_directory(char * direct)
+static char * disk_extract_list_directory(char * direct)
{
- char tmp[500] = "";
- int nb = 0;
- struct dirent *ep;
- DIR *dp = opendir(direct);
- while (dp && nb < 5 && (ep = readdir(dp))) {
- if (strcmp(ep->d_name, ".") && strcmp(ep->d_name, "..")) {
- strcat(tmp, strdup(ep->d_name));
- strcat(tmp, "\n");
- nb++;
- }
+ char ** full = list_directory(direct);
+ char tmp[2000] = "";
+ int i;
+ for (i=0; i<5 ; i++) {
+ if (!full || !*full)
+ break;
+ strcat(tmp, *full);
+ strcat(tmp, "\n");
+ full++;
}
- if (dp)
- closedir(dp);
return strdup(tmp);
}
@@ -129,7 +123,7 @@ static enum return_type try_with_device(char *dev_name)
if (access(location_full, R_OK)) {
error_message("Directory or ISO image file could not be found on partition.\n"
"Here's a short extract of the files in the root of the partition:\n"
- "%s", list_directory(disk_own_mount));
+ "%s", disk_extract_list_directory(disk_own_mount));
umount(disk_own_mount);
return try_with_device(dev_name);
}
@@ -152,7 +146,7 @@ static enum return_type try_with_device(char *dev_name)
error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
"(I need the subdirectory " RAMDISK_LOCATION ")\n"
"Here's a short extract of the files in the directory:\n"
- "%s", list_directory(IMAGE_LOCATION));
+ "%s", disk_extract_list_directory(IMAGE_LOCATION));
umount(disk_own_mount);
return try_with_device(dev_name);
}
@@ -168,7 +162,7 @@ static enum return_type try_with_device(char *dev_name)
error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
"(I need the subdirectory " LIVE_LOCATION ")\n"
"Here's a short extract of the files in the directory:\n"
- "%s", list_directory(IMAGE_LOCATION));
+ "%s", disk_extract_list_directory(IMAGE_LOCATION));
umount(disk_own_mount);
return try_with_device(dev_name);
}