-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
36 lines (33 loc) · 702 Bytes
/
main.c
File metadata and controls
36 lines (33 loc) · 702 Bytes
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
/*
** EPITECH PROJECT, 2025
** B-PSU-200-LYN-2-1-minishell1-pierre.baud
** File description:
** main
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "my.h"
int main(int argc, char **argv, char **env)
{
char **envc;
char *line = NULL;
size_t len = 0;
int status = 0;
envc = copy_env(env);
if (argc > 1)
return 84;
if (argv[1] != NULL)
return 84;
if (isatty(STDIN_FILENO))
shell_loop(&envc);
else {
status = getline(&line, &len, stdin);
while (status != -1) {
process_input(line, &envc);
status = getline(&line, &len, stdin);
}
}
return 0;
}