blob: 372e04f19776f3433ef4fbbc176bf37ba635691a (
plain)
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
|
/* ************************************************************************** */
/* LE - / */
/* / */
/* main.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2019/10/29 08:47:37 by rbousset #+# ## ## #+# */
/* Updated: 2019/10/29 08:47:39 by rbousset ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include <libft.h>
#include <minishell.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <inttypes.h>
int
main(void)
{
char c;
char *arg;
uint8_t i;
i = 0;
arg = NULL;
while (1)
{
ft_putstr(FT_PS1);
if (arg)
{
free(arg);
arg = NULL;
}
if (!(arg = (char*)ft_calloc(129, sizeof(char))))
return (1);
i = 0;
while (read(1, &c, 1) > 0)
{
if (c == '\n')
break ;
arg[i] = c;
i++;
}
arg[i] = '\0';
ft_process_arg(arg);
}
free(arg);
arg = NULL;
return (0);
}
|