Y a exam desoler bb pas le temps de te mettre un vrai commit jtm
This commit is contained in:
parent
5d425048f2
commit
9a87ad7097
13 changed files with 457 additions and 8 deletions
11
Makefile
11
Makefile
|
|
@ -6,7 +6,7 @@
|
||||||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||||
# Updated: 2024/03/25 15:30:19 by maiboyer ### ########.fr #
|
# Updated: 2024/03/28 15:17:18 by rparodi ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -23,12 +23,13 @@ CC = cc
|
||||||
RM = rm -rf
|
RM = rm -rf
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -g3 -MMD
|
CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -g3 -MMD -lreadline
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
LIB =
|
LIB = ./libft/get_next_line.c \
|
||||||
|
./libft/get_next_line_utils.c
|
||||||
|
|
||||||
SRC =
|
SRC = ./sources/main.c
|
||||||
|
|
||||||
# Objects
|
# Objects
|
||||||
OBJDIRNAME = ./objects
|
OBJDIRNAME = ./objects
|
||||||
|
|
@ -54,7 +55,7 @@ bonus: header $(OBJ) $(LIB_OBJ) footer
|
||||||
@mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME)
|
@mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME)
|
||||||
@printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n'
|
@printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n'
|
||||||
@printf '$(GREY) Be Carefull ur in $(END)$(GREEN)Debug Mode$(END)\n'
|
@printf '$(GREY) Be Carefull ur in $(END)$(GREEN)Debug Mode$(END)\n'
|
||||||
@cc $(CFLAGS) -D DEBUG=42 -o $(NAME) $(OBJ) $(LIB_OBJ)
|
@cc $(CFLAGS) -D DEBUG=42 -o $(NAME) $(OBJ) ./stdme/build/libft.a
|
||||||
|
|
||||||
# Clean (make clean)
|
# Clean (make clean)
|
||||||
clean:
|
clean:
|
||||||
|
|
|
||||||
32
includes/minishell.h
Normal file
32
includes/minishell.h
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* minishell.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/03/28 14:41:15 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/03/28 15:21:29 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef MINISHELL_H
|
||||||
|
#define MINISHELL_H
|
||||||
|
|
||||||
|
# include "./type_rust.h"
|
||||||
|
# include "../libft/get_next_line.h"
|
||||||
|
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <fcntl.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <string.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/wait.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdarg.h>
|
||||||
|
# include <readline/readline.h>
|
||||||
|
# include <readline/history.h>
|
||||||
|
i32 main(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
38
includes/type_rust.h
Normal file
38
includes/type_rust.h
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* type_rust.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/03/28 14:44:20 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/03/28 15:01:47 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef TYPE_RUST_H
|
||||||
|
#define TYPE_RUST_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
# define bool int
|
||||||
|
# define true 1
|
||||||
|
# define false 0
|
||||||
|
|
||||||
|
# define u8 unsigned char
|
||||||
|
# define u16 unsigned short
|
||||||
|
# define u32 unsigned int
|
||||||
|
# define u64 unsigned long long
|
||||||
|
|
||||||
|
# define i8 char
|
||||||
|
# define i16 short
|
||||||
|
# define i32 int
|
||||||
|
# define i64 long long
|
||||||
|
|
||||||
|
# define usize size_t
|
||||||
|
# define isize ssize_t
|
||||||
|
|
||||||
|
# define f32 float
|
||||||
|
# define f64 double
|
||||||
|
|
||||||
|
#endif
|
||||||
78
libft/get_next_line.c
Normal file
78
libft/get_next_line.c
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* get_next_line.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/18 17:12:02 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2023/11/22 13:31:13 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "get_next_line.h"
|
||||||
|
|
||||||
|
char *ft_check(char *memory, int fd)
|
||||||
|
{
|
||||||
|
char *buffer;
|
||||||
|
int bytescopy;
|
||||||
|
|
||||||
|
bytescopy = 1;
|
||||||
|
buffer = (char *)malloc(sizeof(char) * (BUFFER_SIZE + 1));
|
||||||
|
if (!buffer)
|
||||||
|
return (NULL);
|
||||||
|
while (ft_strchr(memory, '\n') <= 0 && bytescopy)
|
||||||
|
{
|
||||||
|
bytescopy = read(fd, buffer, BUFFER_SIZE);
|
||||||
|
if (bytescopy == -1)
|
||||||
|
return (ft_free(buffer));
|
||||||
|
buffer[bytescopy] = '\0';
|
||||||
|
memory = ft_strjoin(memory, buffer, 0, -1);
|
||||||
|
}
|
||||||
|
free(buffer);
|
||||||
|
return (memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *file_converted(int fd)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
int read_bits;
|
||||||
|
char *str;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
c = 1;
|
||||||
|
read_bits = 1;
|
||||||
|
str = (char *)malloc(sizeof(char) * BUFFER_SIZE);
|
||||||
|
if (!str)
|
||||||
|
return (NULL);
|
||||||
|
while (read_bits != 0 && i < BUFFER_SIZE)
|
||||||
|
{
|
||||||
|
read_bits = read(fd, &c, 1);
|
||||||
|
str[i] = c;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
str[i] = '\0';
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_free(char *str)
|
||||||
|
{
|
||||||
|
free(str);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *get_next_line(int fd)
|
||||||
|
{
|
||||||
|
static char *memory = NULL;
|
||||||
|
char *line;
|
||||||
|
|
||||||
|
if (fd < 0 || BUFFER_SIZE <= 0)
|
||||||
|
return (NULL);
|
||||||
|
memory = ft_check(memory, fd);
|
||||||
|
if (!memory)
|
||||||
|
return (ft_free(memory));
|
||||||
|
line = ft_get_line(memory);
|
||||||
|
memory = ft_get_next(memory);
|
||||||
|
return (line);
|
||||||
|
}
|
||||||
33
libft/get_next_line.h
Normal file
33
libft/get_next_line.h
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* get_next_line.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/18 17:12:04 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2023/11/23 18:15:34 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef GET_NEXT_LINE_H
|
||||||
|
# define GET_NEXT_LINE_H
|
||||||
|
# ifndef BUFFER_SIZE
|
||||||
|
# define BUFFER_SIZE 420
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
char *ft_get_line(char *str);
|
||||||
|
char *get_next_line(int fd);
|
||||||
|
int ft_strchr(char *str, char c);
|
||||||
|
char *ft_get_next(char *str);
|
||||||
|
char *ft_get_line(char *str);
|
||||||
|
char *ft_strjoin(char *s1, char *s2, int i, int j);
|
||||||
|
size_t ft_strlen(char const *str);
|
||||||
|
char *file_converted(int fd);
|
||||||
|
char *ft_free(char *str);
|
||||||
|
char *ft_check(char *memory, int fd);
|
||||||
|
|
||||||
|
#endif
|
||||||
119
libft/get_next_line_utils.c
Normal file
119
libft/get_next_line_utils.c
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* get_next_line_utils.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/18 17:14:47 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2023/11/22 13:35:03 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "get_next_line.h"
|
||||||
|
|
||||||
|
size_t ft_strlen(char const *str)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
while (str[i])
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_strjoin(char *s1, char *s2, int i, int j)
|
||||||
|
{
|
||||||
|
char *temp;
|
||||||
|
|
||||||
|
if (!s1)
|
||||||
|
{
|
||||||
|
s1 = (char *)malloc(1);
|
||||||
|
s1[i] = '\0';
|
||||||
|
}
|
||||||
|
if (!s2 || !s1)
|
||||||
|
return (NULL);
|
||||||
|
temp = (char *)malloc((ft_strlen(s1) + ft_strlen(s2) + 1));
|
||||||
|
if (!temp)
|
||||||
|
return (NULL);
|
||||||
|
while (s1[i])
|
||||||
|
{
|
||||||
|
temp[i] = s1[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while (s2[++j])
|
||||||
|
temp[i + j] = s2[j];
|
||||||
|
temp[i + j] = '\0';
|
||||||
|
free(s1);
|
||||||
|
return (temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_get_line(char *str)
|
||||||
|
{
|
||||||
|
char *temp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (!str[i])
|
||||||
|
return (NULL);
|
||||||
|
while (str[i] && str[i] != '\n')
|
||||||
|
i++;
|
||||||
|
temp = (char *)malloc((i + 2));
|
||||||
|
if (!temp)
|
||||||
|
return (NULL);
|
||||||
|
i = 0;
|
||||||
|
while (str[i] && str[i] != '\n')
|
||||||
|
{
|
||||||
|
temp[i] = str[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (str[i] == '\n')
|
||||||
|
{
|
||||||
|
temp[i] = str[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
temp[i] = '\0';
|
||||||
|
return (temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_get_next(char *str)
|
||||||
|
{
|
||||||
|
char *temp;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (str[i] && str[i] != '\n')
|
||||||
|
i++;
|
||||||
|
if (!str[i])
|
||||||
|
return (ft_free(str));
|
||||||
|
temp = (char *)malloc((ft_strlen(str) - i));
|
||||||
|
if (!temp)
|
||||||
|
return (NULL);
|
||||||
|
j = i + 1;
|
||||||
|
while (str[++i])
|
||||||
|
temp[i - j] = str[i];
|
||||||
|
temp[i - j] = '\0';
|
||||||
|
free(str);
|
||||||
|
return (temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ft_strchr(char *str, char c)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
while (str[i])
|
||||||
|
{
|
||||||
|
if (str[i] == c)
|
||||||
|
return (i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
20
libft/main.c
Normal file
20
libft/main.c
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include "get_next_line.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int fd = open("get_next_line.c", O_RDONLY);
|
||||||
|
int i = 0;
|
||||||
|
char *next_line = NULL;
|
||||||
|
while (i < 10000000)
|
||||||
|
{
|
||||||
|
next_line = get_next_line(fd);
|
||||||
|
if (!next_line)
|
||||||
|
return (printf("next_line[%d] = %s\n", i, next_line));
|
||||||
|
printf("next_line[%d] = %s", i, next_line);
|
||||||
|
free(next_line);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
BIN
minishell
Executable file
BIN
minishell
Executable file
Binary file not shown.
|
|
@ -6,15 +6,15 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/06 18:51:07 by maiboyer #+# #+# */
|
/* Created: 2024/01/06 18:51:07 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/01/06 18:52:58 by maiboyer ### ########.fr */
|
/* Updated: 2024/03/28 12:37:04 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef MAIN_H
|
#ifndef MAIN_H
|
||||||
# define MAIN_H
|
# define MAIN_H
|
||||||
|
|
||||||
# include "me/fs/open.h"
|
# include "../me/fs/open.h"
|
||||||
# include "me/fs/read.h"
|
# include "../me/fs/read.h"
|
||||||
# include "me/fs/write.h"
|
# include "me/fs/write.h"
|
||||||
# include "me/gnl/gnl.h"
|
# include "me/gnl/gnl.h"
|
||||||
# include "me/mem/mem_find_bytes.h"
|
# include "me/mem/mem_find_bytes.h"
|
||||||
|
|
|
||||||
31
rust/parser/src/adapt_in_c/includes/enum.h
Normal file
31
rust/parser/src/adapt_in_c/includes/enum.h
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* enum.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/03/28 12:44:05 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/03/28 13:09:06 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef ENUM_H
|
||||||
|
#define ENUM_H
|
||||||
|
|
||||||
|
#include "./rust_type.h"
|
||||||
|
|
||||||
|
enum e_separator_op
|
||||||
|
{
|
||||||
|
Semi,
|
||||||
|
Fork,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum e_pipeline_kind
|
||||||
|
{
|
||||||
|
Or,
|
||||||
|
And,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
33
rust/parser/src/adapt_in_c/includes/rust_type.h
Normal file
33
rust/parser/src/adapt_in_c/includes/rust_type.h
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* rust_type.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/03/28 12:50:51 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/03/28 12:52:53 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef RUST_TYPE_H
|
||||||
|
#define RUST_TYPE_H
|
||||||
|
|
||||||
|
# define bool int
|
||||||
|
# define true 1
|
||||||
|
# define false 0
|
||||||
|
# define u8 unsigned char
|
||||||
|
# define u16 unsigned short
|
||||||
|
# define u32 unsigned int
|
||||||
|
# define u64 unsigned long long
|
||||||
|
# define i8 char
|
||||||
|
# define i16 short
|
||||||
|
# define i32 int
|
||||||
|
# define i64 long long
|
||||||
|
# define usize size_t
|
||||||
|
# define isize ssize_t
|
||||||
|
# define f32 float
|
||||||
|
# define f64 double
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
29
rust/parser/src/adapt_in_c/includes/shcat.h
Normal file
29
rust/parser/src/adapt_in_c/includes/shcat.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* shcat.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/03/28 12:42:55 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/03/28 12:53:50 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef SHCAT_H
|
||||||
|
#define SHCAT_H
|
||||||
|
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <fcntl.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <string.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/wait.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdarg.h>
|
||||||
|
# include <stddef.h>
|
||||||
|
|
||||||
|
# include "./enum.h"
|
||||||
|
# include "./rust_type.h"
|
||||||
|
#endif
|
||||||
35
sources/main.c
Normal file
35
sources/main.c
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* main.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/03/28 15:20:38 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "../includes/minishell.h"
|
||||||
|
|
||||||
|
void ft_take_cmd(void)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
char *next_line = NULL;
|
||||||
|
while (i < 10000000)
|
||||||
|
{
|
||||||
|
next_line = readline("shcat > ");
|
||||||
|
if (!next_line)
|
||||||
|
exit(1);
|
||||||
|
printf("%s\n", next_line);
|
||||||
|
add_history(next_line);
|
||||||
|
free(next_line);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
printf("Welcome to our Minishell !\n");
|
||||||
|
ft_take_cmd();
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue