| 347 | } |
| 348 | |
| 349 | static int conf_string(struct menu *menu) |
| 350 | { |
| 351 | struct symbol *sym = menu->sym; |
| 352 | const char *def; |
| 353 | |
| 354 | while (1) { |
| 355 | printf("%*s%s ", indent - 1, "", menu->prompt->text); |
| 356 | printf("(%s) ", sym->name); |
| 357 | def = sym_get_string_value(sym); |
| 358 | if (def) |
| 359 | printf("[%s] ", def); |
| 360 | if (!conf_askvalue(sym, def)) |
| 361 | return 0; |
| 362 | switch (line[0]) { |
| 363 | case '\n': |
| 364 | break; |
| 365 | case '?': |
| 366 | /* print help */ |
| 367 | if (line[1] == '\n') { |
| 368 | print_help(menu); |
| 369 | def = NULL; |
| 370 | break; |
| 371 | } |
| 372 | /* fall through */ |
| 373 | default: |
| 374 | line[strlen(line)-1] = 0; |
| 375 | def = line; |
| 376 | } |
| 377 | if (def && sym_set_string_value(sym, def)) |
| 378 | return 0; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | static int conf_sym(struct menu *menu) |
| 383 | { |
no test coverage detected