author | llornkcor <llornkcor> | 2003-01-21 03:17:22 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-01-21 03:17:22 (UTC) |
commit | 39491a189517289bb0bdd88bf2d1776d25168239 (patch) (unidiff) | |
tree | 899c1255612bd50b398b8c9449b20eed0878aa15 | |
parent | 6998d9a576bcfc137ae243a7b64fe9e668e7339f (diff) | |
download | opie-39491a189517289bb0bdd88bf2d1776d25168239.zip opie-39491a189517289bb0bdd88bf2d1776d25168239.tar.gz opie-39491a189517289bb0bdd88bf2d1776d25168239.tar.bz2 |
change Linux Kernel Configuration string
-rw-r--r-- | scripts/kconfig/mconf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index eba5ff7..26a94e7 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -1,780 +1,780 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
3 | * Released under the terms of the GNU GPL v2.0. | 3 | * Released under the terms of the GNU GPL v2.0. |
4 | * | 4 | * |
5 | * Introduced single menu mode (show all sub-menus in one large tree). | 5 | * Introduced single menu mode (show all sub-menus in one large tree). |
6 | * 2002-11-06 Petr Baudis <pasky@ucw.cz> | 6 | * 2002-11-06 Petr Baudis <pasky@ucw.cz> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <sys/ioctl.h> | 9 | #include <sys/ioctl.h> |
10 | #include <sys/wait.h> | 10 | #include <sys/wait.h> |
11 | #include <ctype.h> | 11 | #include <ctype.h> |
12 | #include <errno.h> | 12 | #include <errno.h> |
13 | #include <fcntl.h> | 13 | #include <fcntl.h> |
14 | #include <limits.h> | 14 | #include <limits.h> |
15 | #include <signal.h> | 15 | #include <signal.h> |
16 | #include <stdarg.h> | 16 | #include <stdarg.h> |
17 | #include <stdlib.h> | 17 | #include <stdlib.h> |
18 | #include <string.h> | 18 | #include <string.h> |
19 | #include <termios.h> | 19 | #include <termios.h> |
20 | #include <unistd.h> | 20 | #include <unistd.h> |
21 | 21 | ||
22 | #define LKC_DIRECT_LINK | 22 | #define LKC_DIRECT_LINK |
23 | #include "lkc.h" | 23 | #include "lkc.h" |
24 | 24 | ||
25 | static char menu_backtitle[128]; | 25 | static char menu_backtitle[128]; |
26 | static const char menu_instructions[] = | 26 | static const char menu_instructions[] = |
27 | "Arrow keys navigate the menu. " | 27 | "Arrow keys navigate the menu. " |
28 | "<Enter> selects submenus --->. " | 28 | "<Enter> selects submenus --->. " |
29 | "Highlighted letters are hotkeys. " | 29 | "Highlighted letters are hotkeys. " |
30 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " | 30 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " |
31 | "Press <Esc><Esc> to exit, <?> for Help. " | 31 | "Press <Esc><Esc> to exit, <?> for Help. " |
32 | "Legend: [*] built-in [ ] excluded <M> module < > module capable", | 32 | "Legend: [*] built-in [ ] excluded <M> module < > module capable", |
33 | radiolist_instructions[] = | 33 | radiolist_instructions[] = |
34 | "Use the arrow keys to navigate this window or " | 34 | "Use the arrow keys to navigate this window or " |
35 | "press the hotkey of the item you wish to select " | 35 | "press the hotkey of the item you wish to select " |
36 | "followed by the <SPACE BAR>. " | 36 | "followed by the <SPACE BAR>. " |
37 | "Press <?> for additional information about this option.", | 37 | "Press <?> for additional information about this option.", |
38 | inputbox_instructions_int[] = | 38 | inputbox_instructions_int[] = |
39 | "Please enter a decimal value. " | 39 | "Please enter a decimal value. " |
40 | "Fractions will not be accepted. " | 40 | "Fractions will not be accepted. " |
41 | "Use the <TAB> key to move from the input field to the buttons below it.", | 41 | "Use the <TAB> key to move from the input field to the buttons below it.", |
42 | inputbox_instructions_hex[] = | 42 | inputbox_instructions_hex[] = |
43 | "Please enter a hexadecimal value. " | 43 | "Please enter a hexadecimal value. " |
44 | "Use the <TAB> key to move from the input field to the buttons below it.", | 44 | "Use the <TAB> key to move from the input field to the buttons below it.", |
45 | inputbox_instructions_string[] = | 45 | inputbox_instructions_string[] = |
46 | "Please enter a string value. " | 46 | "Please enter a string value. " |
47 | "Use the <TAB> key to move from the input field to the buttons below it.", | 47 | "Use the <TAB> key to move from the input field to the buttons below it.", |
48 | setmod_text[] = | 48 | setmod_text[] = |
49 | "This feature depends on another which has been configured as a module.\n" | 49 | "This feature depends on another which has been configured as a module.\n" |
50 | "As a result, this feature will be built as a module.", | 50 | "As a result, this feature will be built as a module.", |
51 | nohelp_text[] = | 51 | nohelp_text[] = |
52 | "There is no help available for this kernel option.\n", | 52 | "There is no help available for this kernel option.\n", |
53 | load_config_text[] = | 53 | load_config_text[] = |
54 | "Enter the name of the configuration file you wish to load. " | 54 | "Enter the name of the configuration file you wish to load. " |
55 | "Accept the name shown to restore the configuration you " | 55 | "Accept the name shown to restore the configuration you " |
56 | "last retrieved. Leave blank to abort.", | 56 | "last retrieved. Leave blank to abort.", |
57 | load_config_help[] = | 57 | load_config_help[] = |
58 | "\n" | 58 | "\n" |
59 | "For various reasons, one may wish to keep several different kernel\n" | 59 | "For various reasons, one may wish to keep several different kernel\n" |
60 | "configurations available on a single machine.\n" | 60 | "configurations available on a single machine.\n" |
61 | "\n" | 61 | "\n" |
62 | "If you have saved a previous configuration in a file other than the\n" | 62 | "If you have saved a previous configuration in a file other than the\n" |
63 | "kernel's default, entering the name of the file here will allow you\n" | 63 | "kernel's default, entering the name of the file here will allow you\n" |
64 | "to modify that configuration.\n" | 64 | "to modify that configuration.\n" |
65 | "\n" | 65 | "\n" |
66 | "If you are uncertain, then you have probably never used alternate\n" | 66 | "If you are uncertain, then you have probably never used alternate\n" |
67 | "configuration files. You should therefor leave this blank to abort.\n", | 67 | "configuration files. You should therefor leave this blank to abort.\n", |
68 | save_config_text[] = | 68 | save_config_text[] = |
69 | "Enter a filename to which this configuration should be saved " | 69 | "Enter a filename to which this configuration should be saved " |
70 | "as an alternate. Leave blank to abort.", | 70 | "as an alternate. Leave blank to abort.", |
71 | save_config_help[] = | 71 | save_config_help[] = |
72 | "\n" | 72 | "\n" |
73 | "For various reasons, one may wish to keep different kernel\n" | 73 | "For various reasons, one may wish to keep different kernel\n" |
74 | "configurations available on a single machine.\n" | 74 | "configurations available on a single machine.\n" |
75 | "\n" | 75 | "\n" |
76 | "Entering a file name here will allow you to later retrieve, modify\n" | 76 | "Entering a file name here will allow you to later retrieve, modify\n" |
77 | "and use the current configuration as an alternate to whatever\n" | 77 | "and use the current configuration as an alternate to whatever\n" |
78 | "configuration options you have selected at that time.\n" | 78 | "configuration options you have selected at that time.\n" |
79 | "\n" | 79 | "\n" |
80 | "If you are uncertain what all this means then you should probably\n" | 80 | "If you are uncertain what all this means then you should probably\n" |
81 | "leave this blank.\n" | 81 | "leave this blank.\n" |
82 | ; | 82 | ; |
83 | 83 | ||
84 | static char buf[4096], *bufptr = buf; | 84 | static char buf[4096], *bufptr = buf; |
85 | static char input_buf[4096]; | 85 | static char input_buf[4096]; |
86 | static char filename[PATH_MAX+1] = ".config"; | 86 | static char filename[PATH_MAX+1] = ".config"; |
87 | static char *args[1024], **argptr = args; | 87 | static char *args[1024], **argptr = args; |
88 | static int indent = 0; | 88 | static int indent = 0; |
89 | static struct termios ios_org; | 89 | static struct termios ios_org; |
90 | static int rows, cols; | 90 | static int rows, cols; |
91 | static struct menu *current_menu; | 91 | static struct menu *current_menu; |
92 | static int child_count; | 92 | static int child_count; |
93 | static int do_resize; | 93 | static int do_resize; |
94 | static int single_menu_mode; | 94 | static int single_menu_mode; |
95 | 95 | ||
96 | static void conf(struct menu *menu); | 96 | static void conf(struct menu *menu); |
97 | static void conf_choice(struct menu *menu); | 97 | static void conf_choice(struct menu *menu); |
98 | static void conf_string(struct menu *menu); | 98 | static void conf_string(struct menu *menu); |
99 | static void conf_load(void); | 99 | static void conf_load(void); |
100 | static void conf_save(void); | 100 | static void conf_save(void); |
101 | static void show_textbox(const char *title, const char *text, int r, int c); | 101 | static void show_textbox(const char *title, const char *text, int r, int c); |
102 | static void show_helptext(const char *title, const char *text); | 102 | static void show_helptext(const char *title, const char *text); |
103 | static void show_help(struct menu *menu); | 103 | static void show_help(struct menu *menu); |
104 | static void show_readme(void); | 104 | static void show_readme(void); |
105 | 105 | ||
106 | static void cprint_init(void); | 106 | static void cprint_init(void); |
107 | static int cprint1(const char *fmt, ...); | 107 | static int cprint1(const char *fmt, ...); |
108 | static void cprint_done(void); | 108 | static void cprint_done(void); |
109 | static int cprint(const char *fmt, ...); | 109 | static int cprint(const char *fmt, ...); |
110 | 110 | ||
111 | static void init_wsize(void) | 111 | static void init_wsize(void) |
112 | { | 112 | { |
113 | struct winsize ws; | 113 | struct winsize ws; |
114 | char *env; | 114 | char *env; |
115 | 115 | ||
116 | if (ioctl(1, TIOCGWINSZ, &ws) == -1) { | 116 | if (ioctl(1, TIOCGWINSZ, &ws) == -1) { |
117 | rows = 24; | 117 | rows = 24; |
118 | cols = 80; | 118 | cols = 80; |
119 | } else { | 119 | } else { |
120 | rows = ws.ws_row; | 120 | rows = ws.ws_row; |
121 | cols = ws.ws_col; | 121 | cols = ws.ws_col; |
122 | if (!rows) { | 122 | if (!rows) { |
123 | env = getenv("LINES"); | 123 | env = getenv("LINES"); |
124 | if (env) | 124 | if (env) |
125 | rows = atoi(env); | 125 | rows = atoi(env); |
126 | if (!rows) | 126 | if (!rows) |
127 | rows = 24; | 127 | rows = 24; |
128 | } | 128 | } |
129 | if (!cols) { | 129 | if (!cols) { |
130 | env = getenv("COLUMNS"); | 130 | env = getenv("COLUMNS"); |
131 | if (env) | 131 | if (env) |
132 | cols = atoi(env); | 132 | cols = atoi(env); |
133 | if (!cols) | 133 | if (!cols) |
134 | cols = 80; | 134 | cols = 80; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | if (rows < 19 || cols < 80) { | 138 | if (rows < 19 || cols < 80) { |
139 | fprintf(stderr, "Your display is too small to run Menuconfig!\n"); | 139 | fprintf(stderr, "Your display is too small to run Menuconfig!\n"); |
140 | fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); | 140 | fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); |
141 | exit(1); | 141 | exit(1); |
142 | } | 142 | } |
143 | 143 | ||
144 | rows -= 4; | 144 | rows -= 4; |
145 | cols -= 5; | 145 | cols -= 5; |
146 | } | 146 | } |
147 | 147 | ||
148 | static void cprint_init(void) | 148 | static void cprint_init(void) |
149 | { | 149 | { |
150 | bufptr = buf; | 150 | bufptr = buf; |
151 | argptr = args; | 151 | argptr = args; |
152 | memset(args, 0, sizeof(args)); | 152 | memset(args, 0, sizeof(args)); |
153 | indent = 0; | 153 | indent = 0; |
154 | child_count = 0; | 154 | child_count = 0; |
155 | cprint("./scripts/lxdialog/lxdialog"); | 155 | cprint("./scripts/lxdialog/lxdialog"); |
156 | cprint("--backtitle"); | 156 | cprint("--backtitle"); |
157 | cprint(menu_backtitle); | 157 | cprint(menu_backtitle); |
158 | } | 158 | } |
159 | 159 | ||
160 | static int cprint1(const char *fmt, ...) | 160 | static int cprint1(const char *fmt, ...) |
161 | { | 161 | { |
162 | va_list ap; | 162 | va_list ap; |
163 | int res; | 163 | int res; |
164 | 164 | ||
165 | if (!*argptr) | 165 | if (!*argptr) |
166 | *argptr = bufptr; | 166 | *argptr = bufptr; |
167 | va_start(ap, fmt); | 167 | va_start(ap, fmt); |
168 | res = vsprintf(bufptr, fmt, ap); | 168 | res = vsprintf(bufptr, fmt, ap); |
169 | va_end(ap); | 169 | va_end(ap); |
170 | bufptr += res; | 170 | bufptr += res; |
171 | 171 | ||
172 | return res; | 172 | return res; |
173 | } | 173 | } |
174 | 174 | ||
175 | static void cprint_done(void) | 175 | static void cprint_done(void) |
176 | { | 176 | { |
177 | *bufptr++ = 0; | 177 | *bufptr++ = 0; |
178 | argptr++; | 178 | argptr++; |
179 | } | 179 | } |
180 | 180 | ||
181 | static int cprint(const char *fmt, ...) | 181 | static int cprint(const char *fmt, ...) |
182 | { | 182 | { |
183 | va_list ap; | 183 | va_list ap; |
184 | int res; | 184 | int res; |
185 | 185 | ||
186 | *argptr++ = bufptr; | 186 | *argptr++ = bufptr; |
187 | va_start(ap, fmt); | 187 | va_start(ap, fmt); |
188 | res = vsprintf(bufptr, fmt, ap); | 188 | res = vsprintf(bufptr, fmt, ap); |
189 | va_end(ap); | 189 | va_end(ap); |
190 | bufptr += res; | 190 | bufptr += res; |
191 | *bufptr++ = 0; | 191 | *bufptr++ = 0; |
192 | 192 | ||
193 | return res; | 193 | return res; |
194 | } | 194 | } |
195 | 195 | ||
196 | pid_t pid; | 196 | pid_t pid; |
197 | 197 | ||
198 | static void winch_handler(int sig) | 198 | static void winch_handler(int sig) |
199 | { | 199 | { |
200 | if (!do_resize) { | 200 | if (!do_resize) { |
201 | kill(pid, SIGINT); | 201 | kill(pid, SIGINT); |
202 | do_resize = 1; | 202 | do_resize = 1; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | static int exec_conf(void) | 206 | static int exec_conf(void) |
207 | { | 207 | { |
208 | int pipefd[2], stat, size; | 208 | int pipefd[2], stat, size; |
209 | struct sigaction sa; | 209 | struct sigaction sa; |
210 | sigset_t sset, osset; | 210 | sigset_t sset, osset; |
211 | 211 | ||
212 | sigemptyset(&sset); | 212 | sigemptyset(&sset); |
213 | sigaddset(&sset, SIGINT); | 213 | sigaddset(&sset, SIGINT); |
214 | sigprocmask(SIG_BLOCK, &sset, &osset); | 214 | sigprocmask(SIG_BLOCK, &sset, &osset); |
215 | 215 | ||
216 | signal(SIGINT, SIG_DFL); | 216 | signal(SIGINT, SIG_DFL); |
217 | 217 | ||
218 | sa.sa_handler = winch_handler; | 218 | sa.sa_handler = winch_handler; |
219 | sigemptyset(&sa.sa_mask); | 219 | sigemptyset(&sa.sa_mask); |
220 | sa.sa_flags = SA_RESTART; | 220 | sa.sa_flags = SA_RESTART; |
221 | sigaction(SIGWINCH, &sa, NULL); | 221 | sigaction(SIGWINCH, &sa, NULL); |
222 | 222 | ||
223 | *argptr++ = NULL; | 223 | *argptr++ = NULL; |
224 | 224 | ||
225 | pipe(pipefd); | 225 | pipe(pipefd); |
226 | pid = fork(); | 226 | pid = fork(); |
227 | if (pid == 0) { | 227 | if (pid == 0) { |
228 | sigprocmask(SIG_SETMASK, &osset, NULL); | 228 | sigprocmask(SIG_SETMASK, &osset, NULL); |
229 | dup2(pipefd[1], 2); | 229 | dup2(pipefd[1], 2); |
230 | close(pipefd[0]); | 230 | close(pipefd[0]); |
231 | close(pipefd[1]); | 231 | close(pipefd[1]); |
232 | execv(args[0], args); | 232 | execv(args[0], args); |
233 | _exit(EXIT_FAILURE); | 233 | _exit(EXIT_FAILURE); |
234 | } | 234 | } |
235 | 235 | ||
236 | close(pipefd[1]); | 236 | close(pipefd[1]); |
237 | bufptr = input_buf; | 237 | bufptr = input_buf; |
238 | while (1) { | 238 | while (1) { |
239 | size = input_buf + sizeof(input_buf) - bufptr; | 239 | size = input_buf + sizeof(input_buf) - bufptr; |
240 | size = read(pipefd[0], bufptr, size); | 240 | size = read(pipefd[0], bufptr, size); |
241 | if (size <= 0) { | 241 | if (size <= 0) { |
242 | if (size < 0) { | 242 | if (size < 0) { |
243 | if (errno == EINTR || errno == EAGAIN) | 243 | if (errno == EINTR || errno == EAGAIN) |
244 | continue; | 244 | continue; |
245 | perror("read"); | 245 | perror("read"); |
246 | } | 246 | } |
247 | break; | 247 | break; |
248 | } | 248 | } |
249 | bufptr += size; | 249 | bufptr += size; |
250 | } | 250 | } |
251 | *bufptr++ = 0; | 251 | *bufptr++ = 0; |
252 | close(pipefd[0]); | 252 | close(pipefd[0]); |
253 | waitpid(pid, &stat, 0); | 253 | waitpid(pid, &stat, 0); |
254 | 254 | ||
255 | if (do_resize) { | 255 | if (do_resize) { |
256 | init_wsize(); | 256 | init_wsize(); |
257 | do_resize = 0; | 257 | do_resize = 0; |
258 | sigprocmask(SIG_SETMASK, &osset, NULL); | 258 | sigprocmask(SIG_SETMASK, &osset, NULL); |
259 | return -1; | 259 | return -1; |
260 | } | 260 | } |
261 | if (WIFSIGNALED(stat)) { | 261 | if (WIFSIGNALED(stat)) { |
262 | printf("\finterrupted(%d)\n", WTERMSIG(stat)); | 262 | printf("\finterrupted(%d)\n", WTERMSIG(stat)); |
263 | exit(1); | 263 | exit(1); |
264 | } | 264 | } |
265 | #if 0 | 265 | #if 0 |
266 | printf("\fexit state: %d\nexit data: '%s'\n", WEXITSTATUS(stat), input_buf); | 266 | printf("\fexit state: %d\nexit data: '%s'\n", WEXITSTATUS(stat), input_buf); |
267 | sleep(1); | 267 | sleep(1); |
268 | #endif | 268 | #endif |
269 | sigpending(&sset); | 269 | sigpending(&sset); |
270 | if (sigismember(&sset, SIGINT)) { | 270 | if (sigismember(&sset, SIGINT)) { |
271 | printf("\finterrupted\n"); | 271 | printf("\finterrupted\n"); |
272 | exit(1); | 272 | exit(1); |
273 | } | 273 | } |
274 | sigprocmask(SIG_SETMASK, &osset, NULL); | 274 | sigprocmask(SIG_SETMASK, &osset, NULL); |
275 | 275 | ||
276 | return WEXITSTATUS(stat); | 276 | return WEXITSTATUS(stat); |
277 | } | 277 | } |
278 | 278 | ||
279 | static void build_conf(struct menu *menu) | 279 | static void build_conf(struct menu *menu) |
280 | { | 280 | { |
281 | struct symbol *sym; | 281 | struct symbol *sym; |
282 | struct property *prop; | 282 | struct property *prop; |
283 | struct menu *child; | 283 | struct menu *child; |
284 | int type, tmp, doint = 2; | 284 | int type, tmp, doint = 2; |
285 | tristate val; | 285 | tristate val; |
286 | char ch; | 286 | char ch; |
287 | 287 | ||
288 | if (!menu_is_visible(menu)) | 288 | if (!menu_is_visible(menu)) |
289 | return; | 289 | return; |
290 | 290 | ||
291 | sym = menu->sym; | 291 | sym = menu->sym; |
292 | prop = menu->prompt; | 292 | prop = menu->prompt; |
293 | if (!sym) { | 293 | if (!sym) { |
294 | if (prop && menu != current_menu) { | 294 | if (prop && menu != current_menu) { |
295 | const char *prompt = menu_get_prompt(menu); | 295 | const char *prompt = menu_get_prompt(menu); |
296 | switch (prop->type) { | 296 | switch (prop->type) { |
297 | case P_MENU: | 297 | case P_MENU: |
298 | child_count++; | 298 | child_count++; |
299 | cprint("m%p", menu); | 299 | cprint("m%p", menu); |
300 | 300 | ||
301 | if (single_menu_mode) { | 301 | if (single_menu_mode) { |
302 | cprint1("%s%*c%s", | 302 | cprint1("%s%*c%s", |
303 | menu->data ? "-->" : "++>", | 303 | menu->data ? "-->" : "++>", |
304 | indent + 1, ' ', prompt); | 304 | indent + 1, ' ', prompt); |
305 | } else { | 305 | } else { |
306 | if (menu->parent != &rootmenu) | 306 | if (menu->parent != &rootmenu) |
307 | cprint1(" %*c", indent + 1, ' '); | 307 | cprint1(" %*c", indent + 1, ' '); |
308 | cprint1("%s --->", prompt); | 308 | cprint1("%s --->", prompt); |
309 | } | 309 | } |
310 | 310 | ||
311 | cprint_done(); | 311 | cprint_done(); |
312 | if (single_menu_mode && menu->data) | 312 | if (single_menu_mode && menu->data) |
313 | goto conf_childs; | 313 | goto conf_childs; |
314 | return; | 314 | return; |
315 | default: | 315 | default: |
316 | if (prompt) { | 316 | if (prompt) { |
317 | child_count++; | 317 | child_count++; |
318 | cprint(":%p", menu); | 318 | cprint(":%p", menu); |
319 | cprint("---%*c%s", indent + 1, ' ', prompt); | 319 | cprint("---%*c%s", indent + 1, ' ', prompt); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | } else | 322 | } else |
323 | doint = 0; | 323 | doint = 0; |
324 | goto conf_childs; | 324 | goto conf_childs; |
325 | } | 325 | } |
326 | 326 | ||
327 | type = sym_get_type(sym); | 327 | type = sym_get_type(sym); |
328 | if (sym_is_choice(sym)) { | 328 | if (sym_is_choice(sym)) { |
329 | struct symbol *def_sym = sym_get_choice_value(sym); | 329 | struct symbol *def_sym = sym_get_choice_value(sym); |
330 | struct menu *def_menu = NULL; | 330 | struct menu *def_menu = NULL; |
331 | 331 | ||
332 | child_count++; | 332 | child_count++; |
333 | for (child = menu->list; child; child = child->next) { | 333 | for (child = menu->list; child; child = child->next) { |
334 | if (menu_is_visible(child) && child->sym == def_sym) | 334 | if (menu_is_visible(child) && child->sym == def_sym) |
335 | def_menu = child; | 335 | def_menu = child; |
336 | } | 336 | } |
337 | 337 | ||
338 | val = sym_get_tristate_value(sym); | 338 | val = sym_get_tristate_value(sym); |
339 | if (sym_is_changable(sym)) { | 339 | if (sym_is_changable(sym)) { |
340 | cprint("t%p", menu); | 340 | cprint("t%p", menu); |
341 | switch (type) { | 341 | switch (type) { |
342 | case S_BOOLEAN: | 342 | case S_BOOLEAN: |
343 | cprint1("[%c]", val == no ? ' ' : '*'); | 343 | cprint1("[%c]", val == no ? ' ' : '*'); |
344 | break; | 344 | break; |
345 | case S_TRISTATE: | 345 | case S_TRISTATE: |
346 | switch (val) { | 346 | switch (val) { |
347 | case yes: ch = '*'; break; | 347 | case yes: ch = '*'; break; |
348 | case mod: ch = 'M'; break; | 348 | case mod: ch = 'M'; break; |
349 | default: ch = ' '; break; | 349 | default: ch = ' '; break; |
350 | } | 350 | } |
351 | cprint1("<%c>", ch); | 351 | cprint1("<%c>", ch); |
352 | break; | 352 | break; |
353 | } | 353 | } |
354 | } else { | 354 | } else { |
355 | cprint("%c%p", def_menu ? 't' : ':', menu); | 355 | cprint("%c%p", def_menu ? 't' : ':', menu); |
356 | cprint1(" "); | 356 | cprint1(" "); |
357 | } | 357 | } |
358 | 358 | ||
359 | cprint1("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | 359 | cprint1("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); |
360 | if (val == yes) { | 360 | if (val == yes) { |
361 | if (def_menu) { | 361 | if (def_menu) { |
362 | cprint1(" (%s)", menu_get_prompt(def_menu)); | 362 | cprint1(" (%s)", menu_get_prompt(def_menu)); |
363 | cprint1(" --->"); | 363 | cprint1(" --->"); |
364 | cprint_done(); | 364 | cprint_done(); |
365 | if (def_menu->list) { | 365 | if (def_menu->list) { |
366 | indent += 2; | 366 | indent += 2; |
367 | build_conf(def_menu); | 367 | build_conf(def_menu); |
368 | indent -= 2; | 368 | indent -= 2; |
369 | } | 369 | } |
370 | } else | 370 | } else |
371 | cprint_done(); | 371 | cprint_done(); |
372 | return; | 372 | return; |
373 | } | 373 | } |
374 | cprint_done(); | 374 | cprint_done(); |
375 | } else { | 375 | } else { |
376 | child_count++; | 376 | child_count++; |
377 | val = sym_get_tristate_value(sym); | 377 | val = sym_get_tristate_value(sym); |
378 | if (sym_is_choice_value(sym) && val == yes) { | 378 | if (sym_is_choice_value(sym) && val == yes) { |
379 | cprint(":%p", menu); | 379 | cprint(":%p", menu); |
380 | cprint1(" "); | 380 | cprint1(" "); |
381 | } else { | 381 | } else { |
382 | switch (type) { | 382 | switch (type) { |
383 | case S_BOOLEAN: | 383 | case S_BOOLEAN: |
384 | cprint("t%p", menu); | 384 | cprint("t%p", menu); |
385 | cprint1("[%c]", val == no ? ' ' : '*'); | 385 | cprint1("[%c]", val == no ? ' ' : '*'); |
386 | break; | 386 | break; |
387 | case S_TRISTATE: | 387 | case S_TRISTATE: |
388 | cprint("t%p", menu); | 388 | cprint("t%p", menu); |
389 | switch (val) { | 389 | switch (val) { |
390 | case yes: ch = '*'; break; | 390 | case yes: ch = '*'; break; |
391 | case mod: ch = 'M'; break; | 391 | case mod: ch = 'M'; break; |
392 | default: ch = ' '; break; | 392 | default: ch = ' '; break; |
393 | } | 393 | } |
394 | cprint1("<%c>", ch); | 394 | cprint1("<%c>", ch); |
395 | break; | 395 | break; |
396 | default: | 396 | default: |
397 | cprint("s%p", menu); | 397 | cprint("s%p", menu); |
398 | tmp = cprint1("(%s)", sym_get_string_value(sym)); | 398 | tmp = cprint1("(%s)", sym_get_string_value(sym)); |
399 | tmp = indent - tmp + 4; | 399 | tmp = indent - tmp + 4; |
400 | if (tmp < 0) | 400 | if (tmp < 0) |
401 | tmp = 0; | 401 | tmp = 0; |
402 | cprint1("%*c%s%s", tmp, ' ', menu_get_prompt(menu), | 402 | cprint1("%*c%s%s", tmp, ' ', menu_get_prompt(menu), |
403 | sym_has_value(sym) ? "" : " (NEW)"); | 403 | sym_has_value(sym) ? "" : " (NEW)"); |
404 | cprint_done(); | 404 | cprint_done(); |
405 | goto conf_childs; | 405 | goto conf_childs; |
406 | } | 406 | } |
407 | } | 407 | } |
408 | cprint1("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), | 408 | cprint1("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), |
409 | sym_has_value(sym) ? "" : " (NEW)"); | 409 | sym_has_value(sym) ? "" : " (NEW)"); |
410 | cprint_done(); | 410 | cprint_done(); |
411 | } | 411 | } |
412 | 412 | ||
413 | conf_childs: | 413 | conf_childs: |
414 | indent += doint; | 414 | indent += doint; |
415 | for (child = menu->list; child; child = child->next) | 415 | for (child = menu->list; child; child = child->next) |
416 | build_conf(child); | 416 | build_conf(child); |
417 | indent -= doint; | 417 | indent -= doint; |
418 | } | 418 | } |
419 | 419 | ||
420 | static void conf(struct menu *menu) | 420 | static void conf(struct menu *menu) |
421 | { | 421 | { |
422 | struct menu *submenu; | 422 | struct menu *submenu; |
423 | const char *prompt = menu_get_prompt(menu); | 423 | const char *prompt = menu_get_prompt(menu); |
424 | struct symbol *sym; | 424 | struct symbol *sym; |
425 | char active_entry[40]; | 425 | char active_entry[40]; |
426 | int stat, type, i; | 426 | int stat, type, i; |
427 | 427 | ||
428 | unlink("lxdialog.scrltmp"); | 428 | unlink("lxdialog.scrltmp"); |
429 | active_entry[0] = 0; | 429 | active_entry[0] = 0; |
430 | while (1) { | 430 | while (1) { |
431 | cprint_init(); | 431 | cprint_init(); |
432 | cprint("--title"); | 432 | cprint("--title"); |
433 | cprint("%s", prompt ? prompt : "Main Menu"); | 433 | cprint("%s", prompt ? prompt : "Main Menu"); |
434 | cprint("--menu"); | 434 | cprint("--menu"); |
435 | cprint(menu_instructions); | 435 | cprint(menu_instructions); |
436 | cprint("%d", rows); | 436 | cprint("%d", rows); |
437 | cprint("%d", cols); | 437 | cprint("%d", cols); |
438 | cprint("%d", rows - 10); | 438 | cprint("%d", rows - 10); |
439 | cprint("%s", active_entry); | 439 | cprint("%s", active_entry); |
440 | current_menu = menu; | 440 | current_menu = menu; |
441 | build_conf(menu); | 441 | build_conf(menu); |
442 | if (!child_count) | 442 | if (!child_count) |
443 | break; | 443 | break; |
444 | if (menu == &rootmenu) { | 444 | if (menu == &rootmenu) { |
445 | cprint(":"); | 445 | cprint(":"); |
446 | cprint("--- "); | 446 | cprint("--- "); |
447 | cprint("L"); | 447 | cprint("L"); |
448 | cprint("Load an Alternate Configuration File"); | 448 | cprint("Load an Alternate Configuration File"); |
449 | cprint("S"); | 449 | cprint("S"); |
450 | cprint("Save Configuration to an Alternate File"); | 450 | cprint("Save Configuration to an Alternate File"); |
451 | } | 451 | } |
452 | stat = exec_conf(); | 452 | stat = exec_conf(); |
453 | if (stat < 0) | 453 | if (stat < 0) |
454 | continue; | 454 | continue; |
455 | 455 | ||
456 | if (stat == 1 || stat == 255) | 456 | if (stat == 1 || stat == 255) |
457 | break; | 457 | break; |
458 | 458 | ||
459 | type = input_buf[0]; | 459 | type = input_buf[0]; |
460 | if (!type) | 460 | if (!type) |
461 | continue; | 461 | continue; |
462 | 462 | ||
463 | for (i = 0; input_buf[i] && !isspace(input_buf[i]); i++) | 463 | for (i = 0; input_buf[i] && !isspace(input_buf[i]); i++) |
464 | ; | 464 | ; |
465 | if (i >= sizeof(active_entry)) | 465 | if (i >= sizeof(active_entry)) |
466 | i = sizeof(active_entry) - 1; | 466 | i = sizeof(active_entry) - 1; |
467 | input_buf[i] = 0; | 467 | input_buf[i] = 0; |
468 | strcpy(active_entry, input_buf); | 468 | strcpy(active_entry, input_buf); |
469 | 469 | ||
470 | sym = NULL; | 470 | sym = NULL; |
471 | submenu = NULL; | 471 | submenu = NULL; |
472 | if (sscanf(input_buf + 1, "%p", &submenu) == 1) | 472 | if (sscanf(input_buf + 1, "%p", &submenu) == 1) |
473 | sym = submenu->sym; | 473 | sym = submenu->sym; |
474 | 474 | ||
475 | switch (stat) { | 475 | switch (stat) { |
476 | case 0: | 476 | case 0: |
477 | switch (type) { | 477 | switch (type) { |
478 | case 'm': | 478 | case 'm': |
479 | if (single_menu_mode) | 479 | if (single_menu_mode) |
480 | submenu->data = (void *) !submenu->data; | 480 | submenu->data = (void *) !submenu->data; |
481 | else | 481 | else |
482 | conf(submenu); | 482 | conf(submenu); |
483 | break; | 483 | break; |
484 | case 't': | 484 | case 't': |
485 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) | 485 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) |
486 | conf_choice(submenu); | 486 | conf_choice(submenu); |
487 | break; | 487 | break; |
488 | case 's': | 488 | case 's': |
489 | conf_string(submenu); | 489 | conf_string(submenu); |
490 | break; | 490 | break; |
491 | case 'L': | 491 | case 'L': |
492 | conf_load(); | 492 | conf_load(); |
493 | break; | 493 | break; |
494 | case 'S': | 494 | case 'S': |
495 | conf_save(); | 495 | conf_save(); |
496 | break; | 496 | break; |
497 | } | 497 | } |
498 | break; | 498 | break; |
499 | case 2: | 499 | case 2: |
500 | if (sym) | 500 | if (sym) |
501 | show_help(submenu); | 501 | show_help(submenu); |
502 | else | 502 | else |
503 | show_readme(); | 503 | show_readme(); |
504 | break; | 504 | break; |
505 | case 3: | 505 | case 3: |
506 | if (type == 't') { | 506 | if (type == 't') { |
507 | if (sym_set_tristate_value(sym, yes)) | 507 | if (sym_set_tristate_value(sym, yes)) |
508 | break; | 508 | break; |
509 | if (sym_set_tristate_value(sym, mod)) | 509 | if (sym_set_tristate_value(sym, mod)) |
510 | show_textbox(NULL, setmod_text, 6, 74); | 510 | show_textbox(NULL, setmod_text, 6, 74); |
511 | } | 511 | } |
512 | break; | 512 | break; |
513 | case 4: | 513 | case 4: |
514 | if (type == 't') | 514 | if (type == 't') |
515 | sym_set_tristate_value(sym, no); | 515 | sym_set_tristate_value(sym, no); |
516 | break; | 516 | break; |
517 | case 5: | 517 | case 5: |
518 | if (type == 't') | 518 | if (type == 't') |
519 | sym_set_tristate_value(sym, mod); | 519 | sym_set_tristate_value(sym, mod); |
520 | break; | 520 | break; |
521 | case 6: | 521 | case 6: |
522 | if (type == 't') | 522 | if (type == 't') |
523 | sym_toggle_tristate_value(sym); | 523 | sym_toggle_tristate_value(sym); |
524 | else if (type == 'm') | 524 | else if (type == 'm') |
525 | conf(submenu); | 525 | conf(submenu); |
526 | break; | 526 | break; |
527 | } | 527 | } |
528 | } | 528 | } |
529 | } | 529 | } |
530 | 530 | ||
531 | static void show_textbox(const char *title, const char *text, int r, int c) | 531 | static void show_textbox(const char *title, const char *text, int r, int c) |
532 | { | 532 | { |
533 | int fd; | 533 | int fd; |
534 | 534 | ||
535 | fd = creat(".help.tmp", 0777); | 535 | fd = creat(".help.tmp", 0777); |
536 | write(fd, text, strlen(text)); | 536 | write(fd, text, strlen(text)); |
537 | close(fd); | 537 | close(fd); |
538 | do { | 538 | do { |
539 | cprint_init(); | 539 | cprint_init(); |
540 | if (title) { | 540 | if (title) { |
541 | cprint("--title"); | 541 | cprint("--title"); |
542 | cprint("%s", title); | 542 | cprint("%s", title); |
543 | } | 543 | } |
544 | cprint("--textbox"); | 544 | cprint("--textbox"); |
545 | cprint(".help.tmp"); | 545 | cprint(".help.tmp"); |
546 | cprint("%d", r); | 546 | cprint("%d", r); |
547 | cprint("%d", c); | 547 | cprint("%d", c); |
548 | } while (exec_conf() < 0); | 548 | } while (exec_conf() < 0); |
549 | unlink(".help.tmp"); | 549 | unlink(".help.tmp"); |
550 | } | 550 | } |
551 | 551 | ||
552 | static void show_helptext(const char *title, const char *text) | 552 | static void show_helptext(const char *title, const char *text) |
553 | { | 553 | { |
554 | show_textbox(title, text, rows, cols); | 554 | show_textbox(title, text, rows, cols); |
555 | } | 555 | } |
556 | 556 | ||
557 | static void show_help(struct menu *menu) | 557 | static void show_help(struct menu *menu) |
558 | { | 558 | { |
559 | const char *help; | 559 | const char *help; |
560 | char *helptext; | 560 | char *helptext; |
561 | struct symbol *sym = menu->sym; | 561 | struct symbol *sym = menu->sym; |
562 | 562 | ||
563 | help = sym->help; | 563 | help = sym->help; |
564 | if (!help) | 564 | if (!help) |
565 | help = nohelp_text; | 565 | help = nohelp_text; |
566 | if (sym->name) { | 566 | if (sym->name) { |
567 | helptext = malloc(strlen(sym->name) + strlen(help) + 16); | 567 | helptext = malloc(strlen(sym->name) + strlen(help) + 16); |
568 | sprintf(helptext, "CONFIG_%s:\n\n%s", sym->name, help); | 568 | sprintf(helptext, "CONFIG_%s:\n\n%s", sym->name, help); |
569 | show_helptext(menu_get_prompt(menu), helptext); | 569 | show_helptext(menu_get_prompt(menu), helptext); |
570 | free(helptext); | 570 | free(helptext); |
571 | } else | 571 | } else |
572 | show_helptext(menu_get_prompt(menu), help); | 572 | show_helptext(menu_get_prompt(menu), help); |
573 | } | 573 | } |
574 | 574 | ||
575 | static void show_readme(void) | 575 | static void show_readme(void) |
576 | { | 576 | { |
577 | do { | 577 | do { |
578 | cprint_init(); | 578 | cprint_init(); |
579 | cprint("--textbox"); | 579 | cprint("--textbox"); |
580 | cprint("scripts/README.Menuconfig"); | 580 | cprint("scripts/README.Menuconfig"); |
581 | cprint("%d", rows); | 581 | cprint("%d", rows); |
582 | cprint("%d", cols); | 582 | cprint("%d", cols); |
583 | } while (exec_conf() == -1); | 583 | } while (exec_conf() == -1); |
584 | } | 584 | } |
585 | 585 | ||
586 | static void conf_choice(struct menu *menu) | 586 | static void conf_choice(struct menu *menu) |
587 | { | 587 | { |
588 | const char *prompt = menu_get_prompt(menu); | 588 | const char *prompt = menu_get_prompt(menu); |
589 | struct menu *child; | 589 | struct menu *child; |
590 | struct symbol *active; | 590 | struct symbol *active; |
591 | int stat; | 591 | int stat; |
592 | 592 | ||
593 | while (1) { | 593 | while (1) { |
594 | cprint_init(); | 594 | cprint_init(); |
595 | cprint("--title"); | 595 | cprint("--title"); |
596 | cprint("%s", prompt ? prompt : "Main Menu"); | 596 | cprint("%s", prompt ? prompt : "Main Menu"); |
597 | cprint("--radiolist"); | 597 | cprint("--radiolist"); |
598 | cprint(radiolist_instructions); | 598 | cprint(radiolist_instructions); |
599 | cprint("15"); | 599 | cprint("15"); |
600 | cprint("70"); | 600 | cprint("70"); |
601 | cprint("6"); | 601 | cprint("6"); |
602 | 602 | ||
603 | current_menu = menu; | 603 | current_menu = menu; |
604 | active = sym_get_choice_value(menu->sym); | 604 | active = sym_get_choice_value(menu->sym); |
605 | for (child = menu->list; child; child = child->next) { | 605 | for (child = menu->list; child; child = child->next) { |
606 | if (!menu_is_visible(child)) | 606 | if (!menu_is_visible(child)) |
607 | continue; | 607 | continue; |
608 | cprint("%p", child); | 608 | cprint("%p", child); |
609 | cprint("%s", menu_get_prompt(child)); | 609 | cprint("%s", menu_get_prompt(child)); |
610 | cprint(child->sym == active ? "ON" : "OFF"); | 610 | cprint(child->sym == active ? "ON" : "OFF"); |
611 | } | 611 | } |
612 | 612 | ||
613 | stat = exec_conf(); | 613 | stat = exec_conf(); |
614 | switch (stat) { | 614 | switch (stat) { |
615 | case 0: | 615 | case 0: |
616 | if (sscanf(input_buf, "%p", &menu) != 1) | 616 | if (sscanf(input_buf, "%p", &menu) != 1) |
617 | break; | 617 | break; |
618 | sym_set_tristate_value(menu->sym, yes); | 618 | sym_set_tristate_value(menu->sym, yes); |
619 | return; | 619 | return; |
620 | case 1: | 620 | case 1: |
621 | show_help(menu); | 621 | show_help(menu); |
622 | break; | 622 | break; |
623 | case 255: | 623 | case 255: |
624 | return; | 624 | return; |
625 | } | 625 | } |
626 | } | 626 | } |
627 | } | 627 | } |
628 | 628 | ||
629 | static void conf_string(struct menu *menu) | 629 | static void conf_string(struct menu *menu) |
630 | { | 630 | { |
631 | const char *prompt = menu_get_prompt(menu); | 631 | const char *prompt = menu_get_prompt(menu); |
632 | int stat; | 632 | int stat; |
633 | 633 | ||
634 | while (1) { | 634 | while (1) { |
635 | cprint_init(); | 635 | cprint_init(); |
636 | cprint("--title"); | 636 | cprint("--title"); |
637 | cprint("%s", prompt ? prompt : "Main Menu"); | 637 | cprint("%s", prompt ? prompt : "Main Menu"); |
638 | cprint("--inputbox"); | 638 | cprint("--inputbox"); |
639 | switch (sym_get_type(menu->sym)) { | 639 | switch (sym_get_type(menu->sym)) { |
640 | case S_INT: | 640 | case S_INT: |
641 | cprint(inputbox_instructions_int); | 641 | cprint(inputbox_instructions_int); |
642 | break; | 642 | break; |
643 | case S_HEX: | 643 | case S_HEX: |
644 | cprint(inputbox_instructions_hex); | 644 | cprint(inputbox_instructions_hex); |
645 | break; | 645 | break; |
646 | case S_STRING: | 646 | case S_STRING: |
647 | cprint(inputbox_instructions_string); | 647 | cprint(inputbox_instructions_string); |
648 | break; | 648 | break; |
649 | default: | 649 | default: |
650 | /* panic? */; | 650 | /* panic? */; |
651 | } | 651 | } |
652 | cprint("10"); | 652 | cprint("10"); |
653 | cprint("75"); | 653 | cprint("75"); |
654 | cprint("%s", sym_get_string_value(menu->sym)); | 654 | cprint("%s", sym_get_string_value(menu->sym)); |
655 | stat = exec_conf(); | 655 | stat = exec_conf(); |
656 | switch (stat) { | 656 | switch (stat) { |
657 | case 0: | 657 | case 0: |
658 | if (sym_set_string_value(menu->sym, input_buf)) | 658 | if (sym_set_string_value(menu->sym, input_buf)) |
659 | return; | 659 | return; |
660 | show_textbox(NULL, "You have made an invalid entry.", 5, 43); | 660 | show_textbox(NULL, "You have made an invalid entry.", 5, 43); |
661 | break; | 661 | break; |
662 | case 1: | 662 | case 1: |
663 | show_help(menu); | 663 | show_help(menu); |
664 | break; | 664 | break; |
665 | case 255: | 665 | case 255: |
666 | return; | 666 | return; |
667 | } | 667 | } |
668 | } | 668 | } |
669 | } | 669 | } |
670 | 670 | ||
671 | static void conf_load(void) | 671 | static void conf_load(void) |
672 | { | 672 | { |
673 | int stat; | 673 | int stat; |
674 | 674 | ||
675 | while (1) { | 675 | while (1) { |
676 | cprint_init(); | 676 | cprint_init(); |
677 | cprint("--inputbox"); | 677 | cprint("--inputbox"); |
678 | cprint(load_config_text); | 678 | cprint(load_config_text); |
679 | cprint("11"); | 679 | cprint("11"); |
680 | cprint("55"); | 680 | cprint("55"); |
681 | cprint("%s", filename); | 681 | cprint("%s", filename); |
682 | stat = exec_conf(); | 682 | stat = exec_conf(); |
683 | switch(stat) { | 683 | switch(stat) { |
684 | case 0: | 684 | case 0: |
685 | if (!input_buf[0]) | 685 | if (!input_buf[0]) |
686 | return; | 686 | return; |
687 | if (!conf_read(input_buf)) | 687 | if (!conf_read(input_buf)) |
688 | return; | 688 | return; |
689 | show_textbox(NULL, "File does not exist!", 5, 38); | 689 | show_textbox(NULL, "File does not exist!", 5, 38); |
690 | break; | 690 | break; |
691 | case 1: | 691 | case 1: |
692 | show_helptext("Load Alternate Configuration", load_config_help); | 692 | show_helptext("Load Alternate Configuration", load_config_help); |
693 | break; | 693 | break; |
694 | case 255: | 694 | case 255: |
695 | return; | 695 | return; |
696 | } | 696 | } |
697 | } | 697 | } |
698 | } | 698 | } |
699 | 699 | ||
700 | static void conf_save(void) | 700 | static void conf_save(void) |
701 | { | 701 | { |
702 | int stat; | 702 | int stat; |
703 | 703 | ||
704 | while (1) { | 704 | while (1) { |
705 | cprint_init(); | 705 | cprint_init(); |
706 | cprint("--inputbox"); | 706 | cprint("--inputbox"); |
707 | cprint(save_config_text); | 707 | cprint(save_config_text); |
708 | cprint("11"); | 708 | cprint("11"); |
709 | cprint("55"); | 709 | cprint("55"); |
710 | cprint("%s", filename); | 710 | cprint("%s", filename); |
711 | stat = exec_conf(); | 711 | stat = exec_conf(); |
712 | switch(stat) { | 712 | switch(stat) { |
713 | case 0: | 713 | case 0: |
714 | if (!input_buf[0]) | 714 | if (!input_buf[0]) |
715 | return; | 715 | return; |
716 | if (!conf_write(input_buf)) | 716 | if (!conf_write(input_buf)) |
717 | return; | 717 | return; |
718 | show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); | 718 | show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); |
719 | break; | 719 | break; |
720 | case 1: | 720 | case 1: |
721 | show_helptext("Save Alternate Configuration", save_config_help); | 721 | show_helptext("Save Alternate Configuration", save_config_help); |
722 | break; | 722 | break; |
723 | case 255: | 723 | case 255: |
724 | return; | 724 | return; |
725 | } | 725 | } |
726 | } | 726 | } |
727 | } | 727 | } |
728 | 728 | ||
729 | static void conf_cleanup(void) | 729 | static void conf_cleanup(void) |
730 | { | 730 | { |
731 | tcsetattr(1, TCSAFLUSH, &ios_org); | 731 | tcsetattr(1, TCSAFLUSH, &ios_org); |
732 | unlink(".help.tmp"); | 732 | unlink(".help.tmp"); |
733 | unlink("lxdialog.scrltmp"); | 733 | unlink("lxdialog.scrltmp"); |
734 | } | 734 | } |
735 | 735 | ||
736 | int main(int ac, char **av) | 736 | int main(int ac, char **av) |
737 | { | 737 | { |
738 | struct symbol *sym; | 738 | struct symbol *sym; |
739 | char *mode; | 739 | char *mode; |
740 | int stat; | 740 | int stat; |
741 | 741 | ||
742 | conf_parse(av[1]); | 742 | conf_parse(av[1]); |
743 | conf_read(NULL); | 743 | conf_read(NULL); |
744 | 744 | ||
745 | sym = sym_lookup("KERNELRELEASE", 0); | 745 | sym = sym_lookup("KERNELRELEASE", 0); |
746 | sym_calc_value(sym); | 746 | sym_calc_value(sym); |
747 | sprintf(menu_backtitle, "Linux Kernel v%s Configuration", | 747 | sprintf(menu_backtitle, "Opie %s Configuration", |
748 | sym_get_string_value(sym)); | 748 | sym_get_string_value(sym)); |
749 | 749 | ||
750 | mode = getenv("MENUCONFIG_MODE"); | 750 | mode = getenv("MENUCONFIG_MODE"); |
751 | if (mode) { | 751 | if (mode) { |
752 | if (!strcasecmp(mode, "single_menu")) | 752 | if (!strcasecmp(mode, "single_menu")) |
753 | single_menu_mode = 1; | 753 | single_menu_mode = 1; |
754 | } | 754 | } |
755 | 755 | ||
756 | tcgetattr(1, &ios_org); | 756 | tcgetattr(1, &ios_org); |
757 | atexit(conf_cleanup); | 757 | atexit(conf_cleanup); |
758 | init_wsize(); | 758 | init_wsize(); |
759 | conf(&rootmenu); | 759 | conf(&rootmenu); |
760 | 760 | ||
761 | do { | 761 | do { |
762 | cprint_init(); | 762 | cprint_init(); |
763 | cprint("--yesno"); | 763 | cprint("--yesno"); |
764 | cprint("Do you wish to save your new configuration?"); | 764 | cprint("Do you wish to save your new configuration?"); |
765 | cprint("5"); | 765 | cprint("5"); |
766 | cprint("60"); | 766 | cprint("60"); |
767 | stat = exec_conf(); | 767 | stat = exec_conf(); |
768 | } while (stat < 0); | 768 | } while (stat < 0); |
769 | 769 | ||
770 | if (stat == 0) { | 770 | if (stat == 0) { |
771 | conf_write(NULL); | 771 | conf_write(NULL); |
772 | printf("\n\n" | 772 | printf("\n\n" |
773 | "*** End of Linux kernel configuration.\n" | 773 | "*** End of Opie configuration.\n" |
774 | "*** Check the top-level Makefile for additional configuration.\n" | 774 | "*** Check the top-level Makefile for additional configuration.\n" |
775 | "*** Next, you may run 'make bzImage', 'make bzdisk', or 'make install'.\n\n"); | 775 | "*** Next, you may run 'makee'.\n\n"); |
776 | } else | 776 | } else |
777 | printf("\n\nYour kernel configuration changes were NOT saved.\n\n"); | 777 | printf("\n\nYour Opie configuration changes were NOT saved.\n\n"); |
778 | 778 | ||
779 | return 0; | 779 | return 0; |
780 | } | 780 | } |