Ejemplo n.º 1
0
int MAMain() {
	WRITE_LOG("MAMain() 1\n");
	on_exit(exit_status_save, NULL);

	// switch stdout from console to maWriteLog.
	WRITE_LOG("open_maWriteLog\n");
	int wlfd = open_maWriteLog();
	dup2(wlfd, 1);
	dup2(wlfd, 2);
	close(wlfd);
	
	WRITE_LOG("setup_filesystem\n");
	setup_filesystem();
	chdir("/");
	
	WRITE_LOG("setup_stdin\n");
	setup_stdin();
	if(!stdin) {
		printf("Error opening stdin: %i (%m)\n", errno);
		exit(1);
	}

	printf("MAMain()\n");
	install_stdmalloc_hooks();
	int res = main(gArgc, gArgv);
	printf("main returned. exit(%i)\n", res);
	exit(res);
}
Ejemplo n.º 2
0
/* Handle suspension reasonably ... */
static void sig_suspend(int sig) {
  if (!interactive) {
    reset_stdin();    /* Reset the standard input channel */
    raise(SIGSTOP);             /* Actually suspend */
    setup_stdin();              /* Put it back */
  } else
    raise(SIGSTOP);             /* Actually suspend */
}
Ejemplo n.º 3
0
 int main()
// todo command line arguments
 { int fd1;
   char buf[1000];
   setup_stdin();
   fd1=init();
//todo make sure fd1 is ok
   if(fork()) from_to(fd1,1);
   else from_to(0,fd1);

   //todo sure would be nice to have an exit condition
     return 1;

 }