aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions
c5a653595337db7176f3b83a8b44'>commitdiffstats
path: root/mdk-stage1/automatic.c
blob: 1c6e021a0533535b128a0f8fac7bd588444cca85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
 * Guillaume Cottenceau (gc@mandrakesoft.com)
 *
 * Copyright 2000 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.
 *
 */

/*
 * This is supposed to replace the redhat "kickstart", by name but
 * also by design (less code pollution).
 *
 */


#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "tools.h"
#include "stage1.h"
#include "frontend.h"
#include "log.h"

#include "automatic.h"


static struct param_elem * automatic_params;
static char * value_not_bound = "";

void grab_automatic_params(char * line)
{
	int i, p;
	struct param_elem tmp_params[50];

	i = 0; p = 0;
	while (line[i] != '\0') {
		char *name, *value;
		int k;
		int j = i;
		while (line[i] != ':' && line[i] != '\0')
			i++;
		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[i-k] = 0;

		tmp_params[p].name = name;
		tmp_params[p].value = value;
		p++;
		if (line[i] == '\0')
			break;
		i++;
	}

	tmp_params[p++].name = NULL;
	automatic_params = memdup(tmp_params, sizeof(struct param_elem) * p);

	log_message("AUTOMATIC MODE: got %d params", p-1);
}


char * get_auto_value(char * auto_param)
{
	struct param_elem * ptr = automatic_params;

	struct param_elem short_aliases[] =
		{ { "method", "met" }, { "network", "netw" }, { "interface", "int" }, { "gateway", "gat" },
		  { "netmask", "netm" }, { "adsluser", "adslu" }, { "adslpass", "adslp" }, { "hostname", "hos" },