-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnpshell.hpp
More file actions
68 lines (46 loc) · 1.25 KB
/
Copy pathnpshell.hpp
File metadata and controls
68 lines (46 loc) · 1.25 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef NPSHELL_HPP
#define NPSHELL_HPP
#include <iostream>
#include <string>
#include <queue>
#include <list>
#include <stdlib.h>
#include <unistd.h>
#include <csignal>
#include <sys/wait.h>
#include <string.h>
#include <time.h>
#include <cstring>
#include <stdio.h>
#endif
void sighandle(int sig){}
class single_line_result{
private:
bool redirect_flag;
int counter;
std::string result;
public:
single_line_result();
void set_redirect_flag(bool value);
bool get_redirect_flag();
void set_counter(int value);
int get_counter();
void set_result(std::string value);
std::string get_result();
};
class npshell{
private:
std::list<single_line_result> single_line_results;
std::queue<std::string> cmds;
std::string input;
std::string get_input();
void set_env();
void print_env();
std::string get_cmd_from_string(std::string single_cmd, size_t space_position);
std::string get_argument_from_string(std::string single_cmd, size_t space_position);
void parse_input();
void execute_cmd();
public:
void set_input(std::string value);
int process_single_line_cmd();
};