compiling

This commit is contained in:
Loic Deridder
2025-02-12 13:32:12 +01:00
parent d03d1cf9ef
commit 256724e601
32 changed files with 74 additions and 67 deletions

View File

@@ -13,7 +13,6 @@
#ifndef BUILTINS_H
# define BUILTINS_H
# include "../minishell.h"
# include <stdio.h>
# include <sys/types.h>
# include <signal.h>
@@ -23,9 +22,13 @@
# include <stdlib.h>
# include <string.h>
typedef struct s_ast_n t_ast_n;
typedef struct s_node t_node;
typedef struct s_msh t_msh;
# define UNSET_ARG "not enough arguments"
# define EXPRT_INV "not a valid identifier"
// void echo(char *msg, int flag);
int builtin_echo(t_ast_n *node, char **envp);
int builtin_exit(char **arg, bool depth, t_ast_n *node);
int builtin_pwd(char **arg);

View File

@@ -13,11 +13,12 @@
#ifndef ENV_H
# define ENV_H
# include "../minishell.h"
# include <unistd.h>
# include <stdlib.h>
# include <stdbool.h>
typedef struct s_msh t_msh;
//VAR
int count_var(char **envp);
int get_var_index(char *key, t_msh *msh);

View File

@@ -13,7 +13,6 @@
#ifndef EXEC_H
# define EXEC_H
# include "../minishell.h"
# include <stdio.h>
# include <sys/wait.h>
# include <sys/types.h>
@@ -21,6 +20,8 @@
# include <unistd.h>
# include <time.h>
typedef struct s_ast_n t_ast_n;
int execute_command(t_ast_n *node);
//EXEC_REDIR

View File

@@ -13,10 +13,11 @@
#ifndef EXPANDER_H
# define EXPANDER_H
# include "../minishell.h"
# include <sys/types.h>
# include <dirent.h>
typedef struct s_ast_n t_ast_n;
int in_dquote(char *str, char *ch);
int in_squote(char *str, char *ch);
int expand_var(t_ast_n *node, int j);

View File

@@ -13,26 +13,6 @@
#ifndef MINISHELL_H
# define MINISHELL_H
# define DEBUG 1
# ifndef DIO_PATH
# define DIO_PATH "ast.xml"
# endif
typedef struct s_ast_n t_ast_n;
typedef struct s_node t_node;
typedef struct s_msh
{
int ex_code;
t_ast_n *head;
int here_fd;
char *input;
int hist;
char **env;
} t_msh;
# include <stdio.h>
# include <readline/readline.h>
# include <readline/history.h>
@@ -41,8 +21,7 @@ typedef struct s_msh
# include <stdbool.h>
# include <signal.h>
# include <termios.h>
#include <sys/ioctl.h>
# include <sys/ioctl.h>
# include "../lib/libft/libft.h"
# include "parser/ast.h"
# include "parser/drawio.h"
@@ -54,6 +33,26 @@ typedef struct s_msh
# include "exec/exec.h"
# include "exec/expander.h"
# define DEBUG 1
# ifndef DIO_PATH
# define DIO_PATH "ast.xml"
# endif
typedef struct s_ast_n t_ast_n;
typedef struct s_node t_node;
typedef struct s_msh t_msh;
typedef struct s_msh
{
int ex_code;
t_ast_n *head;
int here_fd;
char *input;
int hist;
char **env;
} t_msh;
t_msh *init_msh(char **envp);
void free_msh(t_msh *msh);
void free_child(t_msh *msh);

View File

@@ -13,8 +13,8 @@
#ifndef AST_H
# define AST_H
/*# include "../../includes/env.h"*/
# include "../minishell.h"
typedef struct s_node t_node;
typedef struct s_msh t_msh;
typedef enum e_state
{

View File

@@ -13,7 +13,10 @@
#ifndef DRAWIO_H
# define DRAWIO_H
# include "../minishell.h"
# include "../../lib/libft/libft.h"
typedef struct s_ast_n t_ast_n;
typedef struct s_node t_node;
typedef struct s_dio_node
{

View File

@@ -13,7 +13,9 @@
#ifndef HEREDOC_H
# define HEREDOC_H
# include "../minishell.h"
typedef struct s_node t_node;
typedef struct s_msh t_msh;
void read_hereinput(char *limiter, t_node *lst, t_msh *msh);
void parse_heredoc(char *limiter, t_node *lst, t_msh *msh);

View File

@@ -13,7 +13,9 @@
#ifndef PARSING_H
# define PARSING_H
# include "../minishell.h"
typedef struct s_node t_node;
typedef struct s_ast_n t_ast_n;
typedef struct s_msh t_msh;
t_ast_n *parser(char *input, t_msh *msh);

View File

@@ -13,8 +13,6 @@
#ifndef TOKENIZER_H
# define TOKENIZER_H
# include "../minishell.h"
typedef enum e_token
{
UNSET,