int main(int argc, char **argv, char **env) { t_tetris game; t_list list; bool files; files = true; initialize_struct(&game); initialize_value(&game, argv[0], env); if (argc > 1) options(&game, argc, argv); init_list(&list); files = (!(initialize_files(&list, &game))) ? false : true; if (game.debug == true) mode_debug(&game, list); game.list = list; if (files == true) { if ((game.scene->rows + 2 > (tgetnum("lines"))) || (game.scene->colums + 43 > (tgetnum("cols")))) my_puterr("Terminal too small\n"); else if ((check_one_valid(&list)) == 1) initialize_game(&game); } my_free(&game, &list); endwin(); return (0); }
int exec_with_redirect_from_stdout(char *command_line, BOOL use_cmd_exe, char *** results) { execution_details * details = (execution_details *)palloc(sizeof(execution_details)); if (!initialize_files(details)) return FALSE; // use the current OS comspec for DOS commands, i.e., DIR char cmd[MAX_PATH] = { 0 }; prepare_command_line(cmd, command_line, use_cmd_exe); if (!execute_process(details, cmd)) return FALSE; int result_count = extract_result(details, results); close_handles(details); DeleteFile(details->temp_filename); pfree(details); return result_count; }