void do_even_more_shit(char **env, char **path) { int i; t_print *print; /* char **commands;*/ (void)env; (void)path; print = (t_print*)malloc(sizeof(t_print)); print->line = NULL; print->histo = NULL; while (create_prompt(NULL)) { change_term_info(malloc_struct()); i = -1; wait_and_read(print); build_history_list(print); /* ************************************************************************** */ /* STRSPLIT SUR LES ; A REMPLACER PAR LE PARSER ? */ /* LA LIGNE DE COMMANDE EST STOCKEE DANS LA STRUCTURE PRINT : PRINT->LINE */ /*commands = ft_strsplit(print->line, ';');*/ /* ************************************************************************** */ /**************************************************************************** */ /* JE FAIS UN STRCMP-exit POUR QUITTER EN ATTENDANT LA GESTION DES BUILTINS */ /* CE BLOC DEVRA ETRE SUPPRIME */ if (ft_strcmp(print->line, "exit") == 0) { change_back_term_info(NULL); exit(-1); } /* ************************************************************************** */ /* ************************************************************************** */ /* REMISE A ZERO DES PARAMETRES DU SHELL AVANT L'EXECUTION D'UNE COMMANDE */ if (print->line != NULL) free(print->line); FP("\n"); tputs(tgetstr("ei", NULL), 1, out); change_back_term_info(NULL); /* ************************************************************************** */ /* ************************************************************************** */ /* EXECUTION DES COMMANDES SEPAREES PAR LES ; */ /*while (++i, commands[i] != NULL) start_commands(commands[i], &env, path); delete_char_tab_tab(commands);*/ /* ************************************************************************** */ revers_insert_mode(print); } free(print); }
/************************************************************************ * 函数名: find_sub_strcut_desc * 作 者: sx * 描 述: 根据索引信息,返回该结构体的两种描述信息 * 1.这个函数,可以根据以下方式,构造自己的函数,并将函数名做为 * xml2struct,struct2xml的第4个参数传进来. * 2.下面函数里,都是做示范的.真正的struct描述信息,要使用者来完成 * 输入参数: int index,索引 * FIELD_TYPE * in_fdarray,描述的各字段的详细信息 * 输出参数: char *out_msg_buf,复制的 INPUT_MESSAGE *in_inputmsg信息 * 返回值: 复制的 FIELD_TYPE * in_fdarray 详细信息. (malloc出来的) ************************************************************************/ char * find_sub_strcut_desc(int index, INPUT_MESSAGE *out_inputmsg) { if (index == Record_INDEX) { INPUT_MESSAGE msg = { "Record",2,TEST_MODE }; FIELD_TYPE fdarray[] = { {"BeginTime", 100, TYPE_STRING, 0, 0 }, {"EndTime", 100, TYPE_STRING, 0, 0 } }; return malloc_struct(&msg, (char *)out_inputmsg, fdarray); } if (index == StoreRecord_INDEX) { INPUT_MESSAGE msg = { "StoreRecord",3,TEST_MODE }; FIELD_TYPE fdarray[] = { {"DevType", sizeof(int), TYPE_INT, 0, 0 }, {"ID", sizeof(int), TYPE_INT, 0, 0 }, {"Record", sizeof(Record),TYPE_STRUCT, 8, Record_INDEX } }; return malloc_struct(&msg, (char *)out_inputmsg, fdarray); } if (index == test_xml_INDEX) { INPUT_MESSAGE msg = { "test_xml",3,TEST_MODE }; FIELD_TYPE fdarray[] = { {"ID", sizeof(int), TYPE_INT, 3, 0 }, {"StoreRecord", sizeof(StoreRecord),TYPE_STRUCT,3, StoreRecord_INDEX }, {"StoreRecord2", sizeof(StoreRecord2),TYPE_STRUCT,3, StoreRecord_INDEX }, }; return malloc_struct(&msg, (char *)out_inputmsg, fdarray); }; return NULL; }