Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions includes/parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* parsing.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuyane <apuyane@student.42angouleme.fr +#+ +:+ +#+ */
/* By: mcomin <mcomin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/30 07:27:45 by mcomin #+# #+# */
/* Updated: 2026/03/21 22:44:09 by apuyane ### ########.fr */
/* Updated: 2026/03/24 03:39:37 by mcomin ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -55,5 +55,6 @@ char **add_dir(char *directory, char **old_dir);
int strmatch(char *pattern, char *name);
char *get_matching(char *pattern, char **elements);
char *get_rand_numbers(int n);
char *reload_input_tab(char *input);

#endif
14 changes: 9 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@

bool is_invalid(char *line, t_data *data)
{
if (is_empty_or_spaces(line) || check_syntax(line))
if (is_empty_or_spaces(line))
return (true);
else if (check_syntax(line))
{
if (check_syntax(line))
data->exit_code = 2;
data->exit_code = 2;
return (true);
}
return (false);
Expand All @@ -49,11 +50,14 @@ void process_input(t_data *data, char *line)
redir = count_redir_input(line);
if (!is_invalid(line, data))
{
if (redir)
if (redir || ft_strchr(line, '\t'))
{
tmp = ft_strdup(line);
free_single(line);
line = reload_input_redir(tmp, redir);
if (ft_strchr(tmp, '\t'))
line = reload_input_tab(tmp);
else
line = reload_input_redir(tmp, redir);
free(tmp);
}
if (!parsing(data, line))
Expand Down
26 changes: 24 additions & 2 deletions src/parse/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,37 @@
/* ::: :::::::: */
/* check.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuyane <apuyane@student.42angouleme.fr +#+ +:+ +#+ */
/* By: mcomin <mcomin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/10 02:59:44 by mcomin #+# #+# */
/* Updated: 2026/03/21 05:59:29 by apuyane ### ########.fr */
/* Updated: 2026/03/24 03:39:57 by mcomin ### ########.fr */
/* */
/* ************************************************************************** */

#include "parsing.h"

char *reload_input_tab(char *input)
{
char *new_input;
int i;
int j;

new_input = ft_calloc(ft_strlen(input) + 1, sizeof(char));
if (!new_input)
return (NULL);
i = -1;
j = 0;
while (input[++i])
{
if (input[i] == '\t')
new_input[j] = ' ';
else
new_input[j] = input[i];
j++;
}
return (new_input);
}

int count_redir_input(char *input)
{
int i;
Expand Down
2 changes: 1 addition & 1 deletion src/parse/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mcomin <mcomin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/02/04 01:46:10 by mcomin #+# #+# */
/* Updated: 2026/03/03 02:27:45 by mcomin ### ########.fr */
/* Updated: 2026/03/24 04:06:46 by mcomin ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
9 changes: 9 additions & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build
includes
libs
Makefile
minishell
Readme.md
src
test
valgrind_supp
Loading