redirect setup

This commit is contained in:
Quinten Mennen 2025-02-20 17:54:34 +01:00
parent 3fdfebea7b
commit a9f356176f
3 changed files with 25 additions and 15 deletions

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* :::::::: */ /* ::: :::::::: */
/* typedef.h :+: :+: */ /* typedef.h :+: :+: :+: */
/* +:+ */ /* +:+ +:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/05 12:36:08 by whaffman #+# #+# */ /* Created: 2025/02/05 12:36:08 by whaffman #+# #+# */
/* Updated: 2025/02/20 11:37:00 by whaffman ######## odam.nl */ /* Updated: 2025/02/20 16:45:55 by qmennen ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -52,11 +52,19 @@ typedef struct s_lexer
char current_char; char current_char;
} t_lexer; } t_lexer;
typedef struct s_redirect
{
enum e_token_type type;
char *value;
} t_redirect;
typedef struct s_command typedef struct s_command
{ {
char *command; char *command;
char **args; char **args;
t_list *environment; t_list *environment;
t_list *redirect_in;
t_list *redirect_out;
int fd_in; int fd_in;
int fd_out; int fd_out;
int n_fds; int n_fds;

View File

@ -6,7 +6,7 @@
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/18 19:00:35 by qmennen #+# #+# */ /* Created: 2025/02/18 19:00:35 by qmennen #+# #+# */
/* Updated: 2025/02/19 15:20:04 by qmennen ### ########.fr */ /* Updated: 2025/02/20 16:38:28 by qmennen ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -51,6 +51,7 @@ char *expander_parse_string(char *s, t_minishell *minishell)
else else
string[j++] = s[i++]; string[j++] = s[i++];
} }
//TODO: Figure out why echo "> echo "\as"" breaks
string[j] = 0; string[j] = 0;
free_variables(variables); free_variables(variables);

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* :::::::: */ /* ::: :::::::: */
/* lexer_parse_input.c :+: :+: */ /* lexer_parse_input.c :+: :+: :+: */
/* +:+ */ /* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/05 19:09:20 by qmennen #+# #+# */ /* Created: 2025/02/05 19:09:20 by qmennen #+# #+# */
/* Updated: 2025/02/19 17:59:44 by whaffman ######## odam.nl */ /* Updated: 2025/02/20 16:42:39 by qmennen ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -31,6 +31,7 @@ t_list *ft_parse_input(t_lexer *lexer)
list = NULL; list = NULL;
while (TRUE) while (TRUE)
{ {
//TODO: Check if unicode support is viable
token = ft_token_next(lexer); token = ft_token_next(lexer);
if (token->type == T_EOF || token->type == T_ERROR) //TODO T_ERROR removes the inf loop if (token->type == T_EOF || token->type == T_ERROR) //TODO T_ERROR removes the inf loop
break ; break ;