Exemple #1
0
int umc_main(int argc, char *argv[])
{
    os_setup_signal_exit(NULL);
    os_setup_signal_callstack(NULL);
    
    return os_main(__main, argc, argv);
}
Exemple #2
0
int main(int argc, char* argv[])
{
	char** copyv;
	int i;

	/* duplicate the arguments */
	copyv = alloca((argc+1) * sizeof(char*));
	for(i=0;i<argc;++i) {
		copyv[i] = alloca(strlen(argv[i]) + 1);
		strcpy(copyv[i], argv[i]);
	}
	copyv[i] = 0;

	/* set the entry point to restart the program */
	if (sigsetjmp(OS_HUP, 1) != 0) {

		/* restart the program */
		execv(copyv[0], copyv);

		/* abort if fail */
		abort();
	}

	if (target_init() != 0)
		return EXIT_FAILURE;

	if (file_init() != 0) {
		target_done();
		return EXIT_FAILURE;
	}

	if (os_main(argc, argv) != 0) {
		file_done();
		target_done();
		return EXIT_FAILURE;
	}

	file_done();
	target_done();

	return EXIT_SUCCESS;
}