diff options
| author | Rob Landley <rob@landley.net> | 2005-09-14 14:40:01 +0000 |
|---|---|---|
| committer | Rob Landley <rob@landley.net> | 2005-09-14 14:40:01 +0000 |
| commit | 2ee82723a8a90d7aefa445e288b1f3427d75301d (patch) | |
| tree | 0d421789cdce38007ff3a3064d92abdec8a4882f /scripts | |
| parent | 1e51925684d45b65cc0ed1f3e25a0ef52c82c471 (diff) | |
| download | busybox-w32-2ee82723a8a90d7aefa445e288b1f3427d75301d.tar.gz busybox-w32-2ee82723a8a90d7aefa445e288b1f3427d75301d.tar.bz2 busybox-w32-2ee82723a8a90d7aefa445e288b1f3427d75301d.zip | |
Our config should write out each symbol once and only once, but still write
out all symbols in all sub-menus. I think this finally does it right.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/config/confdata.c | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c index 327cf9a4f..5a3de978d 100644 --- a/scripts/config/confdata.c +++ b/scripts/config/confdata.c | |||
| @@ -255,6 +255,21 @@ int conf_read(const char *name) | |||
| 255 | return 0; | 255 | return 0; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | struct menu *next_menu(struct menu *menu) | ||
| 259 | { | ||
| 260 | if (menu->list) return menu->list; | ||
| 261 | do { | ||
| 262 | if (menu->next) { | ||
| 263 | menu = menu->next; | ||
| 264 | break; | ||
| 265 | } | ||
| 266 | } while ((menu = menu->parent)); | ||
| 267 | |||
| 268 | return menu; | ||
| 269 | } | ||
| 270 | |||
| 271 | #define SYMBOL_FORCEWRITE (1<<31) | ||
| 272 | |||
| 258 | int conf_write(const char *name) | 273 | int conf_write(const char *name) |
| 259 | { | 274 | { |
| 260 | FILE *out, *out_h; | 275 | FILE *out, *out_h; |
| @@ -318,27 +333,34 @@ int conf_write(const char *name) | |||
| 318 | if (!sym_change_count) | 333 | if (!sym_change_count) |
| 319 | sym_clear_all_valid(); | 334 | sym_clear_all_valid(); |
| 320 | 335 | ||
| 336 | /* Force write of all non-duplicate symbols. */ | ||
| 337 | |||
| 338 | /* Write out everything by default. */ | ||
| 339 | for(menu = rootmenu.list; menu; menu = next_menu(menu)) | ||
| 340 | if (menu->sym) menu->sym->flags |= SYMBOL_FORCEWRITE; | ||
| 341 | |||
| 321 | menu = rootmenu.list; | 342 | menu = rootmenu.list; |
| 322 | while (menu) { | 343 | while (menu) { |
| 323 | sym = menu->sym; | 344 | sym = menu->sym; |
| 324 | if (!sym) { | 345 | if (!sym) { |
| 325 | if (menu_is_visible(menu)) { | 346 | if (!menu_is_visible(menu)) |
| 326 | str = menu_get_prompt(menu); | 347 | goto next; |
| 327 | fprintf(out, "\n" | 348 | str = menu_get_prompt(menu); |
| 328 | "#\n" | 349 | fprintf(out, "\n" |
| 329 | "# %s\n" | 350 | "#\n" |
| 330 | "#\n", str); | 351 | "# %s\n" |
| 331 | if (out_h) | 352 | "#\n", str); |
| 332 | fprintf(out_h, "\n" | 353 | if (out_h) |
| 333 | "/*\n" | 354 | fprintf(out_h, "\n" |
| 334 | " * %s\n" | 355 | "/*\n" |
| 335 | " */\n", str); | 356 | " * %s\n" |
| 336 | } | 357 | " */\n", str); |
| 337 | } else if (!(sym->flags & SYMBOL_CHOICE)) { | 358 | } else if (!(sym->flags & SYMBOL_CHOICE)) { |
| 338 | sym_calc_value(sym); | 359 | sym_calc_value(sym); |
| 339 | //if (!(sym->flags & SYMBOL_WRITE)) | 360 | if (!(sym->flags & SYMBOL_FORCEWRITE)) |
| 340 | // goto next; | 361 | goto next; |
| 341 | sym->flags &= ~SYMBOL_WRITE; | 362 | |
| 363 | sym->flags &= ~SYMBOL_FORCEWRITE; | ||
| 342 | type = sym->type; | 364 | type = sym->type; |
| 343 | if (type == S_TRISTATE) { | 365 | if (type == S_TRISTATE) { |
| 344 | sym_calc_value(modules_sym); | 366 | sym_calc_value(modules_sym); |
| @@ -409,19 +431,8 @@ int conf_write(const char *name) | |||
| 409 | break; | 431 | break; |
| 410 | } | 432 | } |
| 411 | } | 433 | } |
| 412 | 434 | next: | |
| 413 | if (menu->list) { | 435 | menu = next_menu(menu); |
| 414 | menu = menu->list; | ||
| 415 | continue; | ||
| 416 | } | ||
| 417 | if (menu->next) | ||
| 418 | menu = menu->next; | ||
| 419 | else while ((menu = menu->parent)) { | ||
| 420 | if (menu->next) { | ||
| 421 | menu = menu->next; | ||
| 422 | break; | ||
| 423 | } | ||
| 424 | } | ||
| 425 | } | 436 | } |
| 426 | fclose(out); | 437 | fclose(out); |
| 427 | if (out_h) { | 438 | if (out_h) { |
