Repository navigation
Expand file tree
/
Copy pathmain.c
More file actions
53 lines (42 loc) · 1.7 KB
/
Copy pathmain.c
File metadata and controls
53 lines (42 loc) · 1.7 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
#include"header.h"
/*-----------------------------------------------------------
* Global variable to store child process exit status
*----------------------------------------------------------*/
int status = 0;
/*-----------------------------------------------------------
* Array to store all external commands
*----------------------------------------------------------*/
char *external_commands[MAX_EXT_CMD];
/*-----------------------------------------------------------
* Stores PID of currently running child process
*----------------------------------------------------------*/
pid_t child_pid = 0;
/*-----------------------------------------------------------
* Head pointer for linked list used in background jobs
*----------------------------------------------------------*/
Slist *head = NULL;
/*-----------------------------------------------------------
* Buffer to store shell prompt
*----------------------------------------------------------*/
char prompt[MAX_PROMPT];
/*-----------------------------------------------------------
* Buffer to store user input command
*----------------------------------------------------------*/
char input_string[MAX_INPUT];
/*-----------------------------------------------------------
* main()
* Entry point of minishell program
*----------------------------------------------------------*/
int main()
{
/* Clear terminal screen */
system("clear");
/*
* Initialize default shell prompt
* Example: minishell$:
*/
strcpy(prompt, "minishell$: ");
/* Start shell input handling */
scan_input(prompt, input_string);
return 0;
}