-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.h
More file actions
58 lines (51 loc) · 2.6 KB
/
shell.h
File metadata and controls
58 lines (51 loc) · 2.6 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
52
53
54
55
56
57
58
#ifndef SHELL_H
#define SHELL_H
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
#define PROMPT "osh> "
#define ASCII \
" ----- \n " \
"------------------- \n ------------------------- " \
" \n ----------------------------- \n " \
"--------------------------------- \n " \
"------------------------------------- \n " \
" -----------=###---------*##=----------- \n " \
"---------=###=-----------=###+---------- \n " \
"-------+####=---------------=####+------- \n " \
"------###*=---------------------=*###------ \n " \
"---------+#######=-------=*######+--------- \n " \
"-------+###+++++###-----###+++++###+--------\n " \
"----------+==+=-------------======----------\n " \
"---------==+===-------------=+=+==--------- \n " \
"----------==+==----*###*----==+=+=--------- \n " \
"--------==+=+=--=#######=--======-------- \n " \
"--------+====--##*****##--=+=+==-------- \n " \
"-------==+=+=--#+++++++#=-==+=+=------- \n " \
"-------==+==--#*+++++*#--======------ \n " \
"----==+=+=---=+++++=---=+=+==---- \n " \
"---+====-------------==+=+=-- \n " \
"+=+=+==+==+=+====+==+==+===+=======+=+=+= \n " \
"+=+===+==+==+=+=+==+==+==+=+=+=+=+=+=====+= \n " \
"++++++=+=++=++=== \n" \
" Me doing this assignment (Crying emoji)"
typedef struct {
char** last_command;
int length;
} History;
extern History history;
int GetInput(char** line);
char** Split(const char* line, const char* delimiter, int* length);
void RunLine(char** args, int length);
void StoreHistory(char** args, int length);
void FreeHistory();
void FreeArgs(char** args, int length);
void PrintLastCommand();
void HandlePipes(char* input);
void HandleRedirection(char** args, int* length);
int RunTests();
#endif