return = 0 means we are successful. * -1 means go on doing what you were doing */
| 652 | * -1 means go on doing what you were doing |
| 653 | */ |
| 654 | static int do_exit(void) |
| 655 | { |
| 656 | int res; |
| 657 | if (!conf_get_changed()) { |
| 658 | global_exit = 1; |
| 659 | return 0; |
| 660 | } |
| 661 | res = btn_dialog(main_window, |
| 662 | "Do you wish to save your new configuration?\n" |
| 663 | "<ESC> to cancel and resume nconfig.", |
| 664 | 2, |
| 665 | " <save> ", |
| 666 | "<don't save>"); |
| 667 | if (res == KEY_EXIT) { |
| 668 | global_exit = 0; |
| 669 | return -1; |
| 670 | } |
| 671 | |
| 672 | /* if we got here, the user really wants to exit */ |
| 673 | switch (res) { |
| 674 | case 0: |
| 675 | res = conf_write(filename); |
| 676 | if (res) |
| 677 | btn_dialog( |
| 678 | main_window, |
| 679 | "Error during writing of configuration.\n" |
| 680 | "Your configuration changes were NOT saved.", |
| 681 | 1, |
| 682 | "<OK>"); |
| 683 | conf_write_autoconf(0); |
| 684 | break; |
| 685 | default: |
| 686 | btn_dialog( |
| 687 | main_window, |
| 688 | "Your configuration changes were NOT saved.", |
| 689 | 1, |
| 690 | "<OK>"); |
| 691 | break; |
| 692 | } |
| 693 | global_exit = 1; |
| 694 | return 0; |
| 695 | } |
| 696 | |
| 697 | struct search_data { |
| 698 | struct list_head *head; |
no test coverage detected