-
Notifications
You must be signed in to change notification settings - Fork 9
/
command.hh
54 lines (45 loc) · 1015 Bytes
/
command.hh
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
#ifndef command_h
#define command_h
#include "simpleCommand.hh"
//C++
#include <string>
#include <algorithm>
#include <iterator>
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
#include "y.tab.hh"
//C
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
// Command Data Structure
struct Command {
int _numOfAvailableSimpleCommands;
int _numOfSimpleCommands;
SimpleCommand ** _simpleCommands;
char * _outFile;
char * _inFile;
char * _errFile;
int _append; //>> flag
int _background;
int _inCounter; //# of in
int _outCounter; //# of out
void prompt();
void print();
void execute();
void clear();
int BuiltIn(int i);
Command();
void insertSimpleCommand( SimpleCommand * simpleCommand );
static Command _currentCommand;
static SimpleCommand *_currentSimpleCommand;
};
#endif