-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommand.h
More file actions
47 lines (32 loc) · 958 Bytes
/
Command.h
File metadata and controls
47 lines (32 loc) · 958 Bytes
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
#ifndef MYSHELL_COMMAND_H
#define MYSHELL_COMMAND_H
#include <vector>
#include <string>
#include <functional>
#include <curses.h>
#include <zconf.h>
#include "Token.h"
#include "Shell.h"
constexpr size_t BUFFSIZE = 4096;
class Command {
public:
explicit Command(std::vector<Token> &t);
Command(const Command &c);
Command &operator=(const Command &c) = delete;
~Command();
void execute(Shell *shell);
void set_IFD(const int &fd);
void set_OFD(const int &fd);
private:
void set_redirected_files(std::vector<Token> ¶ms);
void set_background_mode(std::vector<Token> ¶ms);
bool is_background = false;
int input_file = STDIN_FILENO;
int output_file = STDOUT_FILENO;
int error_file = STDERR_FILENO;
std::string cmd_name;
int cmd_argc;
char **cmd_argv;
static std::map<std::string, std::function<int(int, char **, Shell *)>> internal_functions;
};
#endif //MYSHELL_COMMAND_H