-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.h
More file actions
51 lines (40 loc) · 1.07 KB
/
shell.h
File metadata and controls
51 lines (40 loc) · 1.07 KB
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
//
// Created by Ugnius on 2/21/2019.
//
#ifndef HW3_SHELL_H
#define HW3_SHELL_H
#include <stddef.h>
#include <signal.h>
#include <sys/types.h>
#define ARG_MAX sysconf(_SC_ARG_MAX)
#define true 1
#define false 0
extern volatile sig_atomic_t FLAG_PID;
/*
* Reference used: https://www.gnu.org/software/libc/manual/html_node/Data-Structures.html#Data-Structures
*/
typedef struct process {
struct process *next;
pid_t pid;
char **argv;
int argc;
} process;
/*
* Reference used: https://www.gnu.org/software/libc/manual/html_node/Data-Structures.html#Data-Structures
*/
typedef struct job {
char *command;
pid_t pgid;
process *first;
char *inFile;
char *outFile;
int append;
int background;
} job;
int parseCommand(char *command, job *j);
int stringsEqual(char *s1, char *s2);
// Pipe/redirects
// Reference used: https://www.cs.purdue.edu/homes/grr/SystemsProgrammingBook/Book/Chapter5-WritingYourOwnShell.pdf
int commandHandler(char *command);
void mainInputLoop();
#endif //HW3_SHELL_H