blob: a8413221be756bc301896e40027b1360a1bb401b (
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
|
/* ************************************************************************** */
/* 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 <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <inttypes.h>
int
main(void)
{
char c;
char *arg;
uint8_t i;
i = 0;
while (1)
{
if (!(arg = (char*)ft_calloc(129, sizeof(char))))
return (1);
write(1, "joe-shell~> ", 12);
i = 0;
while (read(1, &c, 1) > 0)
{
if (c == '\n')
break ;
if (i > 128)
{
write(1, "Command too long!\n", 18);
return (2);
}
arg[i] = c;
i++;
}
arg[i] = '\0';
}
free(arg);
return (0);
}
|