-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.h
55 lines (43 loc) · 991 Bytes
/
command.h
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 command_h
#define command_h
#include <bits/stdc++.h>
/* Prototypes */
void catchSIGINT(int);
void handleSIGCHLD(int);
int changeCurrentDirectory(void);
void add_dir_to_path(char *);
void removeNewline(char*, int);
void openLogFile();
void closeLogFile();
// Command Data Structure
struct SimpleCommand
{
// Available space for arguments currently preallocated
int _numberOfAvailableArguments;
// Number of arguments
int _numberOfArguments;
char **_arguments;
int is_internal = 1;
SimpleCommand();
void insertArgument(char *argument);
};
struct Command
{
int _numberOfAvailableSimpleCommands;
int _numberOfSimpleCommands;
SimpleCommand **_simpleCommands;
char *_outFile;
char *_inputFile;
char *_errFile;
int _background;
int _append;
void prompt();
void print();
void execute();
void clear();
Command();
void insertSimpleCommand(SimpleCommand *simpleCommand);
static Command _currentCommand;
static SimpleCommand *_currentSimpleCommand;
};
#endif