-
Notifications
You must be signed in to change notification settings - Fork 0
/
ishell.hpp
55 lines (38 loc) · 897 Bytes
/
ishell.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef __ISHELL_H_
#include <libgen.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef history_command // 命令行历史
{
size_t index; // 索引
string start_time; // 执行时间
string line; // 命令行内容
} history_command;
size_t history_command_pos = 0;
vector<history_command> history_command_line;
unordered_map<string, string> envs;
enum status
{
INIT = 1,
PIPE = 2,
WORD = 3,
};
struct termios old_attr, new_attr;
void init_environment(int argc, char **argv);
string get_env(string name);
string get_path();
void updated_pwd(string pass);
void env();
void cd_command(vector<string> &command);
void print_command_line_prefix();
#endif