aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'cmd.h')
-rw-r--r--cmd.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/cmd.h b/cmd.h
index 38b3fa1..d591111 100644
--- a/cmd.h
+++ b/cmd.h
@@ -1,16 +1,21 @@
1#ifndef CMD_H 1#ifndef CMD_H
2#define CMD_H 2#define CMD_H
3 3
4#include <pwd.h>
4#include <stdbool.h> 5#include <stdbool.h>
5#include <stdio.h> 6#include <stdio.h>
6#include <stdlib.h> 7#include <stdlib.h>
7#include <string.h> 8#include <string.h>
9#include <sys/types.h>
10#include <sys/wait.h>
11#include <unistd.h>
12#include <fcntl.h>
8 13
9typedef enum { 14typedef enum {
10 CMD_TYPE_NORMAL, 15 CMD_NORMAL,
11 CMD_TYPE_PIPE, 16 CMD_PIPE,
12 CMD_TYPE_AND, 17 CMD_AND,
13 CMD_TYPE_OR, 18 CMD_OR,
14 // add more command types as needed 19 // add more command types as needed
15} CommandType; 20} CommandType;
16 21
@@ -20,9 +25,13 @@ typedef struct Command {
20 int argc; 25 int argc;
21 struct Command *left; // a pointer to the left sub-command 26 struct Command *left; // a pointer to the left sub-command
22 struct Command *right; // a pointer to the right sub-command 27 struct Command *right; // a pointer to the right sub-command
28 int redirectFD[3];
29 char *redirectFile[3];
30 bool background;
23} Command; 31} Command;
24 32
25Command* newcmd(); 33void showPrompt();
34Command *newcmd();
26int runcmd(Command *cmd); 35int runcmd(Command *cmd);
27void freecmd(Command *cmd); 36void freecmd(Command *cmd);
28void printcmd(Command *cmd); 37void printcmd(Command *cmd);