summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-04-30 17:23:04 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-04-30 17:23:04 +0000
commit324ebed124c5b0f78a1e343fbbd6ee41c2814b49 (patch)
treea7ef301fd2b693090efc71ad725bd33ecfc589f4
parenta0252e4b88e646f21e649a64124870f265b7c45c (diff)
downloaddrakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar.gz
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar.bz2
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar.xz
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.zip
Provide some description of the drivers
-rw-r--r--mdk-stage1/Makefile9
-rw-r--r--mdk-stage1/modules.c20
-rw-r--r--mdk-stage1/modules_descr.h50
-rw-r--r--mdk-stage1/newt-frontend.c13
-rw-r--r--mdk-stage1/stdio-frontend.c78
-rw-r--r--mdk-stage1/tools.c13
-rw-r--r--mdk-stage1/tools.h3
7 files changed, 121 insertions, 65 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile
index 283f64ee9..46c03182d 100644
--- a/mdk-stage1/Makefile
+++ b/mdk-stage1/Makefile
@@ -203,4 +203,11 @@ tar-mkinitrd_helper: clean
ifeq (.depend,$(wildcard .depend))
include .depend
-endif
+endif
+
+
+*-CDROM.o: %-CDROM.o: %.o
+
+*-DISK.o: %-DISK.o: %.o
+
+*-NETWORK.o: %-NETWORK.o: %.o
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index f3d43bd32..51e2b6902 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -30,6 +30,7 @@
#include "log.h"
#include "mar/mar-extract-only.h"
#include "frontend.h"
+#include "modules_descr.h"
#include "modules.h"
@@ -346,7 +347,24 @@ enum return_type ask_insmod(enum driver_type type)
snprintf(msg, sizeof(msg), "Which driver should I try to gain %s access?", mytype);
- results = ask_from_list(msg, mar_list_contents(archive_name), &choice);
+ {
+ char ** drivers = mar_list_contents(archive_name);
+ char ** descrs = malloc(sizeof(char *) * string_array_length(drivers));
+ char ** p_drivers = drivers;
+ char ** p_descrs = descrs;
+ while (p_drivers && *p_drivers) {
+ int i;
+ *p_descrs = NULL;
+ for (i = 0 ; i < modules_descriptions_num ; i++) {
+ if (!strncmp(*p_drivers, modules_descriptions[i].module, strlen(modules_descriptions[i].module))
+ && (*p_drivers)[strlen(modules_descriptions[i].module)] == '.') /* one contains '.o' not the other */
+ *p_descrs = modules_descriptions[i].descr;
+ }
+ p_drivers++;
+ p_descrs++;
+ }
+ results = ask_from_list_comments(msg, drivers, descrs, &choice);
+ }
if (results == RETURN_OK) {
choice[strlen(choice)-2] = '\0'; /* remove trailing .o */
diff --git a/mdk-stage1/modules_descr.h b/mdk-stage1/modules_descr.h
new file mode 100644
index 000000000..356605137
--- /dev/null
+++ b/mdk-stage1/modules_descr.h
@@ -0,0 +1,50 @@
+/*
+ * Guillaume Cottenceau (gc@mandrakesoft.com)
+ *
+ * Copyright 2001 MandrakeSoft
+ *
+ * This software may be freely redistributed under the terms of the GNU
+ * public license.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _MODULES_DESCR_H_
+#define _MODULES_DESCR_H_
+
+struct module_descr {
+ const char * module;
+ char * descr;
+};
+
+struct module_descr modules_descriptions[] = {
+ /* description of network drivers that have not very explicit names */
+ { "ne", "NE1000/NE2000/clones" },
+ { "ne2k-pci", "PCI NE2000" },
+ { "depca", "DEC DEPCA/DE100/DE101/DE200/DE201/DE202/DE210/DE422" },
+ { "dgrs", "Digi RightSwitch SE-X" },
+ { "ewrk3", "DEC DE203/DE204/DE205" },
+ { "lance", "Allied Telesis AT1500, HP J2405A, NE2100/NE2500" },
+ { "sis900", "SiS 900/7016/630E, Am79c901, RTL8201" },
+ { "via-rhine", "VIA VT86c100A Rhine-II, 3043 Rhine-I" },
+ { "tulip", "DEC 21040-family based cards" },
+ { "wd", "WD8003/WD8013" },
+
+ /* description of scsi drivers that have not very explicit names */
+ { "53c7,8xx", "NCR53c810/700" },
+ { "sim710", "NCR53c710" },
+ { "aic7xxx", "Adaptec 7xxx family (AIC/AHA/etc)" },
+ { "atp870u", "ACARD/ARTOP AEC-6710/6712" },
+ { "ncr53c8xx", "Symbios 53c family" },
+ { "sym53c8xx", "Symbios 53c family" },
+ { "sim710", "NCR53C710 family" },
+
+};
+
+int modules_descriptions_num = sizeof(modules_descriptions) / sizeof(struct module_descr);
+
+
+#endif
diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c
index 416d05ae6..85f56ec10 100644
--- a/mdk-stage1/newt-frontend.c
+++ b/mdk-stage1/newt-frontend.c
@@ -187,14 +187,17 @@ enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_
i = 0;
while (elems && *elems) {
- items[i] = malloc(sizeof(char) * (strlen(*elems) + strlen(*elems_comments) + 4));
+ int j = (*elems_comments) ? strlen(*elems_comments) : 0;
+ items[i] = malloc(sizeof(char) * (strlen(*elems) + j + 4));
strcpy(items[i], *elems);
- strcat(items[i], " (");
- strcat(items[i], *elems_comments);
- strcat(items[i], ")");
+ if (*elems_comments) {
+ strcat(items[i], " (");
+ strcat(items[i], *elems_comments);
+ strcat(items[i], ")");
+ }
+ elems_comments++;
i++;
elems++;
- elems_comments++;
}
items[i] = NULL;
diff --git a/mdk-stage1/stdio-frontend.c b/mdk-stage1/stdio-frontend.c
index a8622bf1c..ec6601e9c 100644
--- a/mdk-stage1/stdio-frontend.c
+++ b/mdk-stage1/stdio-frontend.c
@@ -254,25 +254,38 @@ void end_progression(void)
enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_comments, char ** choice)
{
char ** sav_elems = elems;
- int i, j;
+ int i = 1;
+ int j = 0;
+
+ printf("> %s\n[ 0] Cancel", msg);
- printf("> %s\n(0) Cancel\n", msg);
- i = 1;
while (elems && *elems) {
- printf("(%d) %s (%s)\n", i, *elems, *elems_comments);
+ if (elems_comments && *elems_comments) {
+ printf("\n[%2d] %s (%s)", i, *elems, *elems_comments);
+ j = 0;
+ } else {
+ if (j == 0)
+ printf("\n");
+ printf("[%2d] %-14s ", i, *elems);
+ j++;
+ }
+ if (j == 4)
+ j = 0;
+
+ if (elems_comments)
+ elems_comments++;
i++;
elems++;
- elems_comments++;
}
- printf("? ");
+ printf("\n? ");
j = get_int_response();
if (j == 0)
return RETURN_BACK;
- if (j >= 1 && j < i) {
+ if (j >= 1 && j <= i) {
*choice = strdup(sav_elems[j-1]);
return RETURN_OK;
}
@@ -283,56 +296,7 @@ enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_
enum return_type ask_from_list(char *msg, char ** elems, char ** choice)
{
- char ** sav_elems = elems;
- int i, j;
-
- i = 0;
- while (elems && *elems) {
- i++;
- elems++;
- }
-
- if (i < 10) {
- printf("> %s\n(0) Cancel\n", msg);
- for (j=0; j<i; j++)
- printf("(%d) %s\n", j+1, sav_elems[j]);
- }
- else {
- printf("> %s\n( 0) Cancel\n", msg);
- if (i < 20)
- for (j=0; j<i; j++)
- printf("(%2d) %s\n", j+1, sav_elems[j]);
- else {
- if (i < 40)
- for (j=0; j<i-1; j += 2)
- printf("(%2d) %-34s (%2d) %s\n", j+1, sav_elems[j], j+2, sav_elems[j+1]);
- else
- for (j=0; j<i-3; j += 4)
- printf("(%2d) %-14s (%2d) %-14s (%2d) %-14s (%2d) %s\n",
- j+1, sav_elems[j], j+2, sav_elems[j+1], j+3, sav_elems[j+2], j+4, sav_elems[j+3]);
- if (j < i) {
- while (j < i) {
- printf("(%2d) %-14s ", j+1, sav_elems[j]);
- j++;
- }
- printf("\n");
- }
- }
- }
-
- printf("? ");
-
- j = get_int_response();
-
- if (j == 0)
- return RETURN_BACK;
-
- if (j >= 1 && j <= i) {
- *choice = strdup(sav_elems[j-1]);
- return RETURN_OK;
- }
-
- return RETURN_ERROR;
+ return ask_from_list_comments(msg, elems, NULL, choice);
}
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index 9d0f083f6..cd1b40fe8 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -408,3 +408,16 @@ char ** list_directory(char * direct)
tmp[i] = NULL;
return memdup(tmp, sizeof(char*) * (i+1));
}
+
+
+int string_array_length(char ** a)
+{
+ int i = 0;
+ if (!a)
+ return -1;
+ while (a && *a) {
+ a++;
+ i++;
+ }
+ return i;
+}
diff --git a/mdk-stage1/tools.h b/mdk-stage1/tools.h
index 85295492b..5d38b0364 100644
--- a/mdk-stage1/tools.h
+++ b/mdk-stage1/tools.h
@@ -39,6 +39,7 @@ void add_to_env(char * name, char * value);
void handle_env(char ** env);
char ** grab_env(void);
char ** list_directory(char * direct);
+int string_array_length(char ** a);
struct param_elem
{
@@ -47,6 +48,6 @@ struct param_elem
};
#define ptr_begins_static_str(pointer,static_str) (!strncmp(pointer,static_str,sizeof(static_str)-1))
-
+#define streq !strcmp
#endif