merging luke remote with origin local

This commit is contained in:
hugogogo
2021-11-02 13:56:26 +01:00
26 changed files with 548 additions and 312 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/13 16:09:32 by lperrey ### ########.fr */
/* Updated: 2021/10/26 14:53:32 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,6 +15,7 @@
# include "libft.h"
# include <fcntl.h>
# include <unistd.h>
# include <sys/ioctl.h>
# include <stdlib.h>
# include <string.h>
# include <errno.h>
@@ -26,13 +27,17 @@
# include <signal.h>
# include <dirent.h>
# include <termios.h>
# include <curses.h> // sudo apt install libncurses-dev (OR libncurses5-dev)
// sudo apt install libncurses-dev (OR libncurses5-dev)
# include <curses.h>
# include <term.h>
# include <stdio.h>
# include <readline/readline.h> // sudo apt install libreadline-dev
// sudo apt install libreadline-dev
# include <readline/readline.h>
# include <readline/history.h>
# include <stdio.h>
# include "minishell_structs.h"
# include "minishell_macro.h"
# include "minishell_term_colors.h"
@@ -52,8 +57,8 @@
** <fcntl.h>: open()
** <unistd.h>: read(), write(), close(), fork(), getcwd(), chdir(),
** stat(), lstat(), fstat(), execve(), dup(), dup2(), pipe(),
** isatty(), ttyname(), ttyslot(), ioctl(),
** tcsetattr(), tcgetattr()
** isatty(), ttyname(), ttyslot(), tcsetattr(), tcgetattr()
** <sys/ioctl.h>: ioctl()
** <stdlib.h>: malloc(), free(), exit(), getenv()
** <string.h>: strerror(), define NULL, define size_t
** <errno.h>: define errno

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:35:55 by lperrey #+# #+# */
/* Updated: 2021/10/08 03:01:43 by lperrey ### ########.fr */
/* Updated: 2021/10/30 22:32:48 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,4 +18,10 @@
# define PROMPT_CHEVRON "> "
# define PROMPT_EURO "\001€\002 \001\b\002"
enum e_lexer_return
{
CONTINUE_TOKEN = 1,
DELIMITE_TOKEN
};
#endif

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
/* Updated: 2021/10/28 20:49:30 by hulamy ### ########.fr */
/* Updated: 2021/11/02 13:53:08 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,9 +15,15 @@
// Init
int init(t_all *c, char *envp[]);
int set_signals_handling(struct sigaction *ori_signal_behaviour,
struct sigaction *signal_behaviour);
int set_terminal_attributes(struct termios *ori_termios,
struct termios *interactive_termios,
int *termios_changed);
// Shell loop
// Shell modes
void shell_loop(t_all *c);
void shell_script(t_all *c);
// Lexer
t_token *input_to_tokens(char *input);
@@ -47,6 +53,6 @@ size_t ft_2d_arrlen(void *ptr); // Replace ft_arrlen()
char **ft_dup_2d_char_arr(char **ptr);
void *ft_resize_2d_arr(void *ptr, size_t add_nbr);
void print_matrix(char **matrix, char *sep);
void print_token(t_token *token, char *sep);
t_list *ft_lstbeforelast(t_list *lst);
#endif

View File

@@ -6,23 +6,27 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
/* Updated: 2021/10/24 19:18:28 by lperrey ### ########.fr */
/* Updated: 2021/10/30 13:31:07 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MINISHELL_STRUCTS_H
# define MINISHELL_STRUCTS_H
struct s_all *g_all;
enum e_token_id
{
T_TOKEN = 0,
T_LESS = '<',
T_GREAT = '>',
T_PIPE = '|',
T_DLESS, //'<<'
T_DGREAT, //'>>'
T_DLESS,
T_DGREAT,
T_WORD
};
// T_DLESS == '<<'
// T_DGREAT == '>>'
typedef struct s_token
{
@@ -31,8 +35,7 @@ typedef struct s_token
enum e_token_id id;
} t_token;
struct s_all;
typedef int (*t_builtin_ptr)(int,char **,struct s_all *);
typedef int (*t_builtin_ptr)(int,char **,struct s_all *);
typedef struct s_cmd
{
@@ -45,12 +48,17 @@ typedef struct s_cmd
typedef struct s_all
{
t_cmd **cmd_arr;
char **envp;
char *prompt_base;
char *prompt;
t_token *token_list;
int last_exit_status;
t_cmd **cmd_arr;
char **envp;
char *prompt_base;
char *prompt;
t_token *token_list;
int last_exit_status;
struct termios ori_termios;
struct termios interactive_termios;
int termios_changed;
struct sigaction ori_signal_behaviour;
struct sigaction signal_behaviour;
} t_all;
#endif