-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.h
More file actions
29 lines (24 loc) · 694 Bytes
/
command.h
File metadata and controls
29 lines (24 loc) · 694 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
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
using namespace std;
class Command
{
public:
static const char DELIMITER = ' ';
Command(string rawCommand); // constructor
Command(string rawCommand, int *inPipe, int *outPipe); // constructor
void run();
private:
string rawCommand;
int *inPipe;
int *outPipe;
vector<string> tokenize(string rawCommand); //function that parses command line into strings
void execute(vector<string> args);
void childExecute(vector<string> args);
void setInPipe(int *input);
void setOutPipe(int *output);
// Static helper function
static char *const *stringVectorToCharArray(vector<string> toConvert);
};