Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274302
b: refs/heads/master
c: 564899f
h: refs/heads/master
v: v3
  • Loading branch information
Davidlohr Bueso authored and Arnaud Lacombe committed Aug 30, 2011
1 parent 73efd9e commit bce0941
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 953742c8fe8ac45be453fee959d7be40cd89f920
refs/heads/master: 564899f9f0a2df85fa367c8749a1fef323cb3215
86 changes: 52 additions & 34 deletions trunk/scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <locale.h>

Expand Down Expand Up @@ -272,6 +273,7 @@ static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
static int show_all_options;
static int saved_x, saved_y;

static void conf(struct menu *menu);
static void conf_choice(struct menu *menu);
Expand Down Expand Up @@ -792,16 +794,63 @@ static void conf_save(void)
}
}

static int handle_exit(void)
{
int res;

dialog_clear();
if (conf_get_changed())
res = dialog_yesno(NULL,
_("Do you wish to save your new configuration ?\n"
"<ESC><ESC> to continue."),
6, 60);
else
res = -1;

end_dialog(saved_x, saved_y);

switch (res) {
case 0:
if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
"Error while writing of the configuration.\n"
"Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
/* fall through */
case -1:
printf(_("\n\n"
"*** End of the configuration.\n"
"*** Execute 'make' to start the build or try 'make help'."
"\n\n"));
res = 0;
break;
default:
fprintf(stderr, _("\n\n"
"Your configuration changes were NOT saved."
"\n\n"));
}

return res;
}

static void sig_handler(int signo)
{
exit(handle_exit());
}

int main(int ac, char **av)
{
int saved_x, saved_y;
char *mode;
int res;

setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);

signal(SIGINT, sig_handler);

conf_parse(av[1]);
conf_read(NULL);

Expand All @@ -823,40 +872,9 @@ int main(int ac, char **av)
set_config_filename(conf_get_configname());
do {
conf(&rootmenu);
dialog_clear();
if (conf_get_changed())
res = dialog_yesno(NULL,
_("Do you wish to save your "
"new configuration?\n"
"<ESC><ESC> to continue."),
6, 60);
else
res = -1;
res = handle_exit();
} while (res == KEY_ESC);
end_dialog(saved_x, saved_y);

switch (res) {
case 0:
if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
"Error while writing of the configuration.\n"
"Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
/* fall through */
case -1:
printf(_("\n\n"
"*** End of the configuration.\n"
"*** Execute 'make' to start the build or try 'make help'."
"\n\n"));
break;
default:
fprintf(stderr, _("\n\n"
"Your configuration changes were NOT saved."
"\n\n"));
}

return 0;
return res;
}

0 comments on commit bce0941

Please sign in to comment.