+ readline() replace gnl() in here_doc
+ "int error" in struct "t_cmd"
This commit is contained in:
LuckyLaszlo
2021-11-16 22:30:20 +01:00
17 changed files with 378 additions and 208 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
/* Updated: 2021/11/16 08:04:08 by lperrey ### ########.fr */
/* Updated: 2021/11/16 21:06:00 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,11 +16,10 @@
// Init
int init(t_all *c, char *envp[]);
char **retrieve_path(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);
int *termios_changed); // WIP, TEST, TEMP, PLACEHOLDER, NOT IMPORTANT, :)
int set_signals_handling(struct sigaction *signal_behaviour);
// Shell modes
void shell_loop(t_all *c);
@@ -45,9 +44,14 @@ int redirections(t_token *token_list, t_cmd **cmd_arr);
int exec_cmd_line(t_all *c);
// Builtins
int builtin_env(int argc, char *argv[], t_all *c);
int builtin_cd(int argc, char *argv[], t_all *c);
int builtin_pwd(int argc, char *argv[], t_all *c);
int builtin_export(int argc, char *argv[], t_all *c);
int builtin_unset(int argc, char *argv[], t_all *c);
int builtin_exit(int argc, char *argv[], t_all *c);
int builtin_env(int argc, char *argv[], t_all *c);
int builtin_echo(int argc, char *argv[], t_all *c);
int getenv_position(char **envp, char *name);
// Free
int free_exit(t_all *c, int exit_status);
@@ -75,4 +79,8 @@ int ft_reti_perror_io(int ret, char *err_str, char *io_file);
char **ft_split_quotes(char const *s, char c);
char *ft_strdup_quotes(const char *s);
// signals.c
void sigint_handler_interactiv(int signum);
void sigint_handler_execution(int signum);
#endif

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
/* Updated: 2021/11/16 08:45:10 by lperrey ### ########.fr */
/* Updated: 2021/11/16 21:38:28 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -46,6 +46,7 @@ typedef struct s_cmd
int fd_in;
int fd_out;
pid_t pid;
int error;
} t_cmd;
typedef struct s_all
@@ -57,10 +58,10 @@ typedef struct s_all
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 termios ori_termios;
// struct termios interactive_termios;
// int termios_changed;
// struct sigaction ori_signal_behaviour;
struct sigaction signal_behaviour;
} t_all;