Files
42_INT_07_minishell/tests/unit_tests/wip/main.c
2021-12-05 14:16:11 +01:00

42 lines
729 B
C

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <readline/readline.h>
#define CYAN "\001\e[1;36m\002"
#define WHITE "\001\e[1;37m\002"
#define RESET "\001\e[0m\002"
int main(void)
{
char *line_input;
char *heredoc;
char *delimiter;
char *here_line;
line_input = NULL;
while (1)
{
line_input = readline(WHITE"mybash> "RESET);
if (line_input)
{
heredoc = strstr(line_input, " << ");
if (heredoc)
{
delimiter = heredoc + strlen(" << ");
while(1)
{
here_line = NULL;
here_line = readline(CYAN"> "RESET);
if (!strncmp(here_line, delimiter, strlen(here_line) + 1))
break ;
}
}
}
if (!line_input)
exit(0);
}
return (0);
}