summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/automatic.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/automatic.c')
-rw-r--r--mdk-stage1/automatic.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/mdk-stage1/automatic.c b/mdk-stage1/automatic.c
index 1c6e021a0..5e9ed56a2 100644
--- a/mdk-stage1/automatic.c
+++ b/mdk-stage1/automatic.c
@@ -1,7 +1,7 @@
/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
+ * Guillaume Cottenceau (gc)
*
- * Copyright 2000 MandrakeSoft
+ * Copyright 2000 Mandriva
*
* This software may be freely redistributed under the terms of the GNU
* public license.
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include "tools.h"
+#include "utils.h"
#include "stage1.h"
#include "frontend.h"
#include "log.h"
@@ -45,14 +46,14 @@ void grab_automatic_params(char * line)
int j = i;
while (line[i] != ':' && line[i] != '\0')
i++;
- name = memdup(&line[j], i-j + 1);
+ name = _memdup(&line[j], i-j + 1);
name[i-j] = 0;
k = i+1;
i++;
while (line[i] != ',' && line[i] != '\0')
i++;
- value = memdup(&line[k], i-k + 1);
+ value = _memdup(&line[k], i-k + 1);
value[i-k] = 0;
tmp_params[p].name = name;
@@ -64,7 +65,7 @@ void grab_automatic_params(char * line)
}
tmp_params[p++].name = NULL;
- automatic_params = memdup(tmp_params, sizeof(struct param_elem) * p);
+ automatic_params = _memdup(tmp_params, sizeof(struct param_elem) * p);
log_message("AUTOMATIC MODE: got %d params", p-1);
}
@@ -78,7 +79,8 @@ char * get_auto_value(char * auto_param)
{ { "method", "met" }, { "network", "netw" }, { "interface", "int" }, { "gateway", "gat" },
{ "netmask", "netm" }, { "adsluser", "adslu" }, { "adslpass", "adslp" }, { "hostname", "hos" },
{ "domain", "dom" }, { "server", "ser" }, { "directory", "dir" }, { "user", "use" },
- { "pass", "pas" }, { "disk", "dis" }, { "partition", "par" }, { NULL, NULL } };
+ { "pass", "pas" }, { "disk", "dis" }, { "partition", "par" }, { "proxy_host", "proxh" },
+ { "proxy_port", "proxp" }, { NULL, NULL } };
struct param_elem * ptr_alias = short_aliases;
while (ptr_alias->name) {
if (streq(auto_param, ptr_alias->name))
@@ -99,9 +101,9 @@ char * get_auto_value(char * auto_param)
enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, char * auto_param, char ** elems_auto)
{
- if (!IS_AUTOMATIC)
+ if (!IS_AUTOMATIC) {
return ask_from_list(msg, elems, choice);
- else {
+ } else {
char ** sav_elems = elems;
char * tmp = get_auto_value(auto_param);
while (elems && *elems) {
@@ -113,16 +115,16 @@ enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, ch
elems++;
elems_auto++;
}
- unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
+ unset_automatic(); /* we are in a fallback mode */
return ask_from_list(msg, sav_elems, choice);
}
}
enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** elems_comments, char ** choice, char * auto_param, char ** elems_auto)
{
- if (!IS_AUTOMATIC)
+ if (!IS_AUTOMATIC) {
return ask_from_list_comments(msg, elems, elems_comments, choice);
- else {
+ } else {
char ** sav_elems = elems;
char * tmp = get_auto_value(auto_param);
while (elems && *elems) {
@@ -134,7 +136,7 @@ enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** e
elems++;
elems_auto++;
}
- unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
+ unset_automatic(); /* we are in a fallback mode */
return ask_from_list_comments(msg, sav_elems, elems_comments, choice);
}
}
@@ -142,9 +144,9 @@ enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** e
enum return_type ask_from_entries_auto(char *msg, char ** questions, char *** answers, int entry_size, char ** questions_auto, void (*callback_func)(char ** strings))
{
- if (!IS_AUTOMATIC)
+ if (!IS_AUTOMATIC) {
return ask_from_entries(msg, questions, answers, entry_size, callback_func);
- else {
+ } else {
char * tmp_answers[50];
int i = 0;
while (questions && *questions) {
@@ -155,7 +157,7 @@ enum return_type ask_from_entries_auto(char *msg, char ** questions, char *** an
questions_auto++;
}
- *answers = memdup(tmp_answers, sizeof(char *) * i);
+ *answers = _memdup(tmp_answers, sizeof(char *) * i);
return RETURN_OK;
}
}