Пример #1
0
int main(int ac, char **av)
{
	char *mode;
	int res;

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

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

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	reset_dialog();
	init_dialog(NULL);
	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;
	} while (res == KEY_ESC);
	end_dialog();

	switch (res) {
	case 0:
		if (conf_write(filename)) {
			fprintf(stderr, _("\n\n"
				"Error during writing of the configuration.\n"
				"Your configuration changes were NOT saved."
				"\n\n"));
			return 1;
		}
	case -1:
		printf(_("\n\n"
			"*** End of configuration.\n"
			"\n\n"));
		break;
	default:
		fprintf(stderr, _("\n\n"
			"Your configuration changes were NOT saved."
			"\n\n"));
	}

	return 0;
}
Пример #2
0
int main(int ac, char **av)
{
	struct symbol *sym;
	char *mode;
	int res;

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

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

	sym = sym_lookup("KERNELVERSION", 0);
	sym_calc_value(sym);
	sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	reset_dialog();
	init_dialog(menu_backtitle);
	do {
		conf(&rootmenu);
		dialog_clear();
		res = dialog_yesno(NULL,
				   _("Do you wish to save your "
				     "new kernel configuration?\n"
				     "<ESC><ESC> to continue."),
				   6, 60);
	} while (res == KEY_ESC);
	end_dialog();
	if (res == 0) {
		if (conf_write(NULL)) {
			fprintf(stderr, _("\n\n"
				"Error during writing of the kernel configuration.\n"
				"Your kernel configuration changes were NOT saved."
				"\n\n"));
			return 1;
		}
		printf(_("\n\n"
			"*** End of Linux kernel configuration.\n"
			"*** Execute 'make' to build the kernel or try 'make help'."
			"\n\n"));
	} else {
		fprintf(stderr, _("\n\n"
			"Your kernel configuration changes were NOT saved."
			"\n\n"));
	}

	return 0;
}
Пример #3
0
int main(int ac, char **av)
{
	struct symbol *sym;
	char *mode;
	int stat;

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

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

	sym = sym_lookup("KERNELVERSION", 0);
	sym_calc_value(sym);
	sprintf(menu_backtitle, _("swupdate %s Configuration"),
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	conf(&rootmenu);

	do {
		cprint_init();
		cprint("--yesno");
		cprint(_("Do you wish to save your new configuration?"));
		cprint("5");
		cprint("60");
		stat = exec_conf();
	} while (stat < 0);

	if (stat == 0) {
		if (conf_write(NULL)) {
			fprintf(stderr, _("\n\n"
				"Error during writing of the configuration.\n"
				"Your configuration changes were NOT saved."
				"\n\n"));
			return 1;
		}
		printf(_("\n\n"
			"*** End of configuration.\n"
			"*** Execute 'make' to build the project or try 'make help'."
			"\n\n"));
	} else {
		fprintf(stderr, _("\n\n"
			"Your configuration changes were NOT saved."
			"\n\n"));
	}

	return 0;
}
Пример #4
0
int main(int ac, char **av)
{
	struct symbol *sym;
	char *mode;
	int stat;

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

	sym = sym_lookup("KERNELRELEASE", 0);
	sym_calc_value(sym);
	sprintf(menu_backtitle, "Linux Kernel v%s Configuration",
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	conf(&rootmenu);

	do {
		cprint_init();
		cprint("--yesno");
		cprint("Do you wish to save your new kernel configuration?");
		cprint("5");
		cprint("60");
		stat = exec_conf();
	} while (stat < 0);

	if (stat == 0) {
		if (conf_write(NULL)) {
			fprintf(stderr, "\n\n"
				"Error during writing of the kernel configuration.\n"
				"Your kernel configuration changes were NOT saved."
				"\n\n");
			return 1;
		}
		printf("\n\n"
			"*** End of Linux kernel configuration.\n"
			"*** Execute 'make' to build the kernel or try 'make help'."
			"\n\n");
	} else {
		fprintf(stderr, "\n\n"
			"Your kernel configuration changes were NOT saved."
			"\n\n");
	}

	return 0;
}
Пример #5
0
int main(int ac, char **av)
{
	int stat;
	char *mode;
	struct symbol *sym;

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

	sym = sym_lookup("VERSION", 0);
	sym_calc_value(sym);
	snprintf(menu_backtitle, 128, "Core v%s Configuration",
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}
  
	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	init_dialog();
	signal(SIGWINCH, winch_handler); 
	conf(&rootmenu);
	end_dialog();

	/* Restart dialog to act more like when lxdialog was still separate */
	init_dialog();
	do {
		stat = dialog_yesno(NULL, 
				"Do you wish to save your new Core configuration?", 5, 60);
	} while (stat < 0);
	end_dialog();

	if (stat == 0) {
		conf_write(NULL);
		printf("\n\n"
			"*** End of Core configuration.\n"
			"*** Check the top-level Makefile for additional configuration options.\n\n");
	} else
		printf("\n\nYour Core configuration changes were NOT saved.\n\n");

	return 0;
}
Пример #6
0
int main(int ac, char **av)
{
	struct symbol *sym;
	char *mode;
	int stat;

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

	sym = sym_lookup("VERSION", 0);
	sym_calc_value(sym);
	snprintf(menu_backtitle, 128, "BusyBox v%s Configuration",
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	init_dialog();
	signal(SIGWINCH, winch_handler);
	conf(&rootmenu);
	end_dialog();

	/* Restart dialog to act more like when lxdialog was still separate */
	init_dialog();
	do {
		stat = dialog_yesno(NULL,
				    "Do you wish to save your new diagnostic program configuration?", 6, 60);
	} while (stat < 0);
	end_dialog();

	if (stat == 0) {
		conf_write(NULL);
		printf("\n\n"
			"*** End of SQ diagnostic program configuration.\n");
		printf("*** Execute 'make' to build the diagnostic program or try 'make help'.\n\n");
	} else
		printf("\n\nYour diagnostic program configuration changes were NOT saved.\n\n");

	return 0;
}
Пример #7
0
static int exec_conf(void)
{
	int pipefd[2], stat, size;
	struct sigaction sa;
	sigset_t sset, osset;

	sigemptyset(&sset);
	sigaddset(&sset, SIGINT);
	sigprocmask(SIG_BLOCK, &sset, &osset);

	signal(SIGINT, SIG_DFL);

	sa.sa_handler = winch_handler;
	sigemptyset(&sa.sa_mask);
	sa.sa_flags = SA_RESTART;
	sigaction(SIGWINCH, &sa, NULL);

	*argptr++ = NULL;

	pipe(pipefd);
	pid = fork();
	if (pid == 0) {
		sigprocmask(SIG_SETMASK, &osset, NULL);
		dup2(pipefd[1], 2);
		close(pipefd[0]);
		close(pipefd[1]);
		execv(args[0], args);
		_exit(EXIT_FAILURE);
	}

	close(pipefd[1]);
	bufptr = input_buf;
	while (1) {
		size = input_buf + sizeof(input_buf) - bufptr;
		size = read(pipefd[0], bufptr, size);
		if (size <= 0) {
			if (size < 0) {
				if (errno == EINTR || errno == EAGAIN)
					continue;
				perror("read");
			}
			break;
		}
		bufptr += size;
	}
	*bufptr++ = 0;
	close(pipefd[0]);
	waitpid(pid, &stat, 0);

	if (do_resize) {
		init_wsize();
		do_resize = 0;
		sigprocmask(SIG_SETMASK, &osset, NULL);
		return -1;
	}
	if (WIFSIGNALED(stat)) {
		printf("\finterrupted(%d)\n", WTERMSIG(stat));
		exit(1);
	}
#if 0
	printf("\fexit state: %d\nexit data: '%s'\n", WEXITSTATUS(stat), input_buf);
	sleep(1);
#endif
	sigpending(&sset);
	if (sigismember(&sset, SIGINT)) {
		printf("\finterrupted\n");
		exit(1);
	}
	sigprocmask(SIG_SETMASK, &osset, NULL);

	return WEXITSTATUS(stat);
}