MCPcopy Create free account
hub / github.com/Entware/Entware / do_exit

Function do_exit

scripts/config/nconf.c:654–695  ·  view source on GitHub ↗

return = 0 means we are successful. * -1 means go on doing what you were doing */

Source from the content-addressed store, hash-verified

652 * -1 means go on doing what you were doing
653 */
654static 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
697struct search_data {
698 struct list_head *head;

Callers 2

handle_f9Function · 0.85
mainFunction · 0.85

Calls 4

conf_get_changedFunction · 0.85
btn_dialogFunction · 0.85
conf_writeFunction · 0.85
conf_write_autoconfFunction · 0.85

Tested by

no test coverage detected