process.h
来自「这是一个linux下的Shell.有命令历史和命令提示」· C头文件 代码 · 共 109 行
H
109 行
//the information of process.//not include pipestruct pro_info{ pro_info() { init(); }; void init(void) { argv = 0; id = -1; //id == -1 processs has't be running. -2 run over. bigger than 0 runnnig. background = false; input_filepath = 0; input_fid = -1; output_filepath = 0; output_fid = -1; output_over_tail = false; }; ~pro_info() { if(argv) { char** temp = argv; while(*(argv++)) delete *argv; delete temp; } delete input_filepath; delete output_filepath; } pro_info& operator=(pro_info& x) { int num = 0; char** temp = x.argv; if(!temp) { argv = 0; input_filepath = 0; output_filepath = 0; } else { background = x.background; while(*(temp++)) { num++; } argv = new char*[num + 1]; argv[num] = 0; for(int i = 0; i < num;i++) { argv[i] = new char[strlen(x.argv[i]) + 1]; strcpy(argv[i], x.argv[i]); } if(x.input_filepath) { input_filepath = new char[strlen(x.input_filepath) + 1]; strcpy(input_filepath, x.input_filepath); input_fid = x.input_fid; } else input_filepath = 0; if(x.output_filepath) { output_filepath = new char[strlen(x.output_filepath) + 1]; strcpy(output_filepath, x.output_filepath); output_fid = x.output_fid; output_over_tail = x.output_over_tail; } else output_filepath = 0; } return x; } char** argv; int id; bool background; char* input_filepath; int input_fid; char* output_filepath; int output_fid; bool output_over_tail;};struct process_node{ process_node() { pro.init(); next = 0; pipe_read = pipe_write = -1; readFlag = false; writeFlag = false; }; ~process_node() { } pro_info pro; process_node* next; int pipe_read; int pipe_write; bool readFlag; bool writeFlag;};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?