-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell-behavior.h
41 lines (30 loc) · 1002 Bytes
/
shell-behavior.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
#ifndef SHELL_BEHAVIOR_H
#define SHELL_BEHAVIOR_H
#include "utils.h"
#include "job-control.h"
#define MAX_LINE_LENGTH 1024
typedef enum {
EXIT_SHELL,
EMPTY_LINE,
EXECUTE_COMMAND
} LineType;
extern RunningMode runningMode;
extern JobList _jobList; // store all background job
extern JobList _finishedJobList; // store all finished background job for async mode
extern pid_t fgPid; // running foreground process
void setRunningMode(int argc, char **argv);
void writePrompt();
void setSignalHandler();
void SIGINTHandler(int sig);
void SIGTSTPHandler(int sig);
void SIGTTINHandler(int sig);
void SIGCONTHandler(int sig);
void SIGCHLDHandler(int sig);
void readUserInput(char **line);
LineType parseUserInput(char *line);
LineType readAndParseUserInput(char **line);
LineType readAndParseFileInput(char **line, size_t *len);
int parseLine(char *line, struct parsed_command **cmd);
void executeLine(struct parsed_command *cmd);
void handlePipeline(struct parsed_command *cmd);
#endif