replaced occurrences of last exit_status

+ deleted envp comments
+ WIP Macro exit status
+ TODO : Invalid free of environ in readline
This commit is contained in:
LuckyLaszlo
2021-11-27 12:59:16 +01:00
parent 843b6d84c5
commit 3baf91afb3
16 changed files with 59 additions and 65 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/03 19:14:46 by lperrey #+# #+# */
/* Updated: 2021/10/26 14:53:32 by lperrey ### ########.fr */
/* Updated: 2021/11/27 09:09:31 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -38,8 +38,8 @@
# include <stdio.h>
# include "minishell_structs.h"
# include "minishell_macro.h"
# include "minishell_structs.h"
# include "minishell_term_colors.h"
# include "minishell_user_macro.h"
# include "minishell_prototypes.h"

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:35:55 by lperrey #+# #+# */
/* Updated: 2021/10/30 22:32:48 by lperrey ### ########.fr */
/* Updated: 2021/11/27 10:43:43 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,10 +18,37 @@
# define PROMPT_CHEVRON "> "
# define PROMPT_EURO "\001€\002 \001\b\002"
# define EXIT_CMD_NOT_FOUND 127
# define EXIT_CMD_NOT_EXE 126
# define EXIT_SIGNAL 128
// 1 and 125 inclusive
# define EXIT_REDIRECTION 22
# define EXIT_EXPANSION 33
enum e_lexer_return
{
CONTINUE_TOKEN = 1,
DELIMITE_TOKEN
};
enum e_token_id
{
T_LESS = '<',
T_GREAT = '>',
T_PIPE = '|',
T_DLESS,
T_DGREAT,
T_WORD,
T_REDIRECTION_WORD
};
// T_DLESS == '<<'
// T_DGREAT == '>>'
enum e_quotes_state
{
IN_QUOTES = '\'',
IN_DQUOTES = '\"'
};
#endif

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
/* Updated: 2021/11/26 21:45:26 by lperrey ### ########.fr */
/* Updated: 2021/11/27 12:28:20 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,10 +16,12 @@
// variable globale
int g_switch_heredoc_sigint;
extern char **environ;
char **g_ori_environ; // WIP free test
// Init
int init(t_all *c);
char **retrieve_path(char *envp[]);
char *init_prompt(char *prompt_base);
char **retrieve_path(void);
int set_terminal_attributes(struct termios *ori_termios,
struct termios *interactive_termios,
int *termios_changed); // WIP, TEST, TEMP, PLACEHOLDER, NOT IMPORTANT, :)
@@ -49,7 +51,7 @@ int exec_cmd_line(t_all *c);
int pipeline(t_all *c);
int cmd_find_access(t_cmd *cmd, char *path[]);
int cmd_exec_in_subshell(t_cmd *cmd, t_all *c);
void wait_subshell(pid_t last_cmd_pid, int *last_exit_status);
void wait_subshell(pid_t last_cmd_pid);
int simple_command_builtin(t_cmd *cmd, t_all *c);
// Builtins

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
/* Updated: 2021/11/26 21:53:39 by lperrey ### ########.fr */
/* Updated: 2021/11/27 11:28:13 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,25 +15,6 @@
struct s_all;
enum e_token_id
{
T_LESS = '<',
T_GREAT = '>',
T_PIPE = '|',
T_DLESS,
T_DGREAT,
T_WORD,
T_REDIRECTION_WORD
};
// T_DLESS == '<<'
// T_DGREAT == '>>'
enum e_quotes_state
{
IN_QUOTES = '\'',
IN_DQUOTES = '\"'
};
typedef struct s_token
{
char *content;
@@ -57,12 +38,10 @@ typedef struct s_cmd
typedef struct s_all
{
t_cmd **cmd_arr;
// char **envp;
char **path;
char *prompt_base;
char *prompt;
t_token *token_list;
int last_exit_status;
// struct termios ori_termios;
// struct termios interactive_termios;
// int termios_changed;