#define CMD_BUNCH_SIZE 50 //cmd bunch size #define DIR_CU_SIZE 100 //dir current name size #define PATH_BUNCH_SIZE 50 //path bunch size #define CMD_SIZE 200 //cmd size #define PATH_SIZE 200 //path size #define DIR_BAK_SIZE 500 //cd - #define TEXT_SIZE 200 //<< #define HIS_CMD_NUM 20 //saved number of history cmd
typedefstruct my_history //history struct { char his_cmd[CMD_SIZE]; struct my_history *next_f; struct my_history *next_b; }TYPE; extern TYPE *head;//head pointer of history chain
externchar*argv[CMD_BUNCH_SIZE];// externchar my_dir_bak[DIR_BAK_SIZE];// externchar my_dir_cu[DIR_CU_SIZE];// externchar*path_argv[PATH_BUNCH_SIZE];// externint flag_cmd;//variable flag of the whole represent different cmd externchar temp_cmd[CMD_SIZE];//veriable of the whole programe in job_fg()
externvoid get_cmd(int connfd,char*buf,char*rebuf);// externvoid my_cmd(int connfd,int p_size,int c_size);//execut within amd without cmd externint cut_cmd(char*buf);//cut cmd externchar*cut_dir(char*buf);//cut _current_dir externint environment_init(char*path_buf);//environment init externint cut_path(char*buf);//cut path externint cmd_found(char*buf,int p_size);//search cmd externint cmd_differ(int c_size);//differentiate cmd (redriect, grep,in, out) externvoid my_redirect(int temp_size,int p_size,int c_size);//redriect externvoid my_pipe(int connfd,int temp_size,int c_size,int p_size);//grep cmd externchar*format_cmd(char*buf);//format cmd externchar*my_replace(char*str_parent,char*str_old,char*str_new);//replace str extern TYPE *history_init(TYPE *tail);//history init extern TYPE *add_history(char*buf);//add history cmd extern TYPE *print_history();//cmd history extern TYPE *history_save();//save