Exemplo n.º 1
0
//begin main
int main (void) {

	char current[BOARD_SIZE][BOARD_SIZE] ;
	char future[BOARD_SIZE][BOARD_SIZE] ;

	initialize_board(current, ' ') ;
	initialize_board(future, ' ') ;

	char choice ;	
	int stillgoing = 1;

	while (stillgoing) {
		
		printf("\033[2J\033[H") ;

		copy_board(current, future) ;
		print_board(current) ;	

		printf("Please enter one of the following:\n a: to add a new cell\n r: to remove a cell\n n: to advance the simulation\n q: to quit\n p: to play the game forever\n") ;
		scanf("%c", &choice) ;
		
		stillgoing = user_action(current, future, choice) ;		
	}
	return 0 ;

}	//end main
Exemplo n.º 2
0
static bool postconfig_run(void)
{
  struct account account = {0};
  char *zone = 0;
  bool utc = true;
  
  if(chdir(INSTALL_ROOT) == -1)
  {
    error(strerror(errno));
    return false;
  }

  if(mount("none",INSTALL_ROOT "/dev","devtmpfs",0,0) == -1)
  {
    error(strerror(errno));
    return false;
  }
  
  if(mount("none",INSTALL_ROOT "/proc","proc",0,0) == -1)
  {
    error(strerror(errno));
    return false;
  }
  
  if(mount("none",INSTALL_ROOT "/sys","sysfs",0,0) == -1)
  {
    error(strerror(errno));
    return false;
  }
  
  if(!is_root_setup() && (!ui_window_root(&account) || !root_action(&account)))
  {
    account_free(&account);
    return false;
  }
  
  account_free(&account);
  
  if(!is_user_setup() && (!ui_window_user(&account) || !user_action(&account)))
  {
    account_free(&account);
    return false;
  }
  
  account_free(&account);

  if(!get_timezone_data() || !ui_window_time(tz_data,&zone,&utc) || !time_action(zone,utc))
    return false;

  if(umount2(INSTALL_ROOT "/dev",MNT_DETACH) == -1)
  {
    error(strerror(errno));
    return false;    
  }
  
  if(umount2(INSTALL_ROOT "/proc",MNT_DETACH) == -1)
  {
    error(strerror(errno));
    return false;
  }
  
  if(umount2(INSTALL_ROOT "/sys",MNT_DETACH) == -1)
  {
    error(strerror(errno));
    return false;
  }
  
  return true;
}