Merge branch 'master' of https://git.chauvet.pro/starnakin/minishell
This commit is contained in:
commit
cdde24f0d0
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/21 12:45:16 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/21 22:26:54 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/21 23:34:37 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -108,7 +108,7 @@ static int ft_own_cmd(t_list **env, t_cmd *cmd)
|
||||
else if (ft_strcmp(cmd->executable, "export") == 0)
|
||||
return_code = (print_export(env, cmd->fd_out));
|
||||
else if (ft_strcmp(cmd->executable, "cd") == 0)
|
||||
return_code = (move_folder(cmd->args[0], cmd->fd_out));
|
||||
return_code = (move_folder(cmd->args[1], cmd->fd_out));
|
||||
/* if (ft_strcmp(cmd->executable, "unset") == 0) */
|
||||
/* return_code = (unset(env, cmd->args, cmd->fd_out)); */
|
||||
else if (ft_strcmp(cmd->executable, "echo") == 0)
|
||||
|
18
main.c
18
main.c
@ -6,11 +6,10 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/21 22:05:04 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/21 23:54:44 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libftx/libftx.h"
|
||||
#include "minishell.h"
|
||||
|
||||
static char *ft_get_user_input(t_list **env)
|
||||
@ -43,14 +42,11 @@ static int ft_minishell(t_data *data, char *line)
|
||||
int infile;
|
||||
int outfile;
|
||||
|
||||
if (ft_syntatic_verif(line))
|
||||
return (1);
|
||||
line_clean = ft_normalizer(line);
|
||||
if (line_clean == NULL)
|
||||
return (1);
|
||||
if (ft_syntatic_verif(line_clean))
|
||||
{
|
||||
free(line_clean);
|
||||
return (1);
|
||||
}
|
||||
outfile = ft_outfile(line_clean);
|
||||
if (outfile == -2)
|
||||
{
|
||||
@ -105,11 +101,19 @@ int main(int ac, char **av, char **env)
|
||||
|
||||
#else
|
||||
|
||||
void ft_ctrlc(int num)
|
||||
{
|
||||
rl_on_new_line();
|
||||
ft_putchar_fd('\n', 1);
|
||||
rl_redisplay();
|
||||
}
|
||||
|
||||
int main(int ac, char **av, char **env)
|
||||
{
|
||||
t_data data;
|
||||
char *line;
|
||||
|
||||
signal(SIGINT, ft_ctrlc);
|
||||
data.env = init_env(env);
|
||||
if (data.env == NULL)
|
||||
return (1);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/21 13:00:05 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/21 13:00:06 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/21 23:40:20 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,7 +18,7 @@ static int ft_quote_verif(const char *str)
|
||||
{
|
||||
if (ft_is_in_quote(str, ft_strlen(str)))
|
||||
{
|
||||
ft_eprintf("minishell: Quote is note closed");
|
||||
ft_eprintf("minishell: Quote is not closed\n");
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
@ -78,7 +78,7 @@ static int ft_special_char_dub(const char *str)
|
||||
if ((y > 2 && (str[i] == '>' || str[i] == '<'))
|
||||
|| (y > 1 && str[i] == '|'))
|
||||
{
|
||||
ft_eprintf("minishell: to many %c in a row", str, str[i]);
|
||||
ft_eprintf("minishell: too many %c in a row\n", str, str[i]);
|
||||
return (1);
|
||||
}
|
||||
i = i + y;
|
||||
@ -96,8 +96,6 @@ int ft_empty_verif(const char *str)
|
||||
i = 0;
|
||||
while (str[i] == ' ')
|
||||
i++;
|
||||
if (str[i] == '\0')
|
||||
ft_eprintf("minishell: %s: command not found \n", str);
|
||||
return (str[i] == '\0');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user