WIP exec_cmd_line()
+ fix error handle in redirections() + rename ft_free_cmd_arr() to free_pipeline() + "char **path" added to "struct t_all" + misc
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
|
||||
/* Updated: 2021/11/14 12:23:38 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/11/16 08:04:08 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
// 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,
|
||||
@@ -40,6 +41,9 @@ int words_expansions(t_token *token_list);
|
||||
int token_expansions(t_token **t);
|
||||
int redirections(t_token *token_list, t_cmd **cmd_arr);
|
||||
|
||||
// Exec
|
||||
int exec_cmd_line(t_all *c);
|
||||
|
||||
// Builtins
|
||||
int builtin_env(int argc, char *argv[], t_all *c);
|
||||
int builtin_exit(int argc, char *argv[], t_all *c);
|
||||
@@ -47,7 +51,9 @@ int builtin_echo(int argc, char *argv[], t_all *c);
|
||||
|
||||
// Free
|
||||
int free_exit(t_all *c, int exit_status);
|
||||
void ft_free_cmd_arr(t_cmd **cmd_arr);
|
||||
void free_pipeline(t_cmd **pipeline_ptr[]);
|
||||
void close_pipeline_fd(t_cmd *pipeline[]);
|
||||
typedef void (*t_free_f)(void *); // generic
|
||||
|
||||
// Generic
|
||||
char *ft_strjoinfree(char *s1, char *s2);
|
||||
@@ -61,7 +67,7 @@ void *ft_resize_2d_arr(void *ptr, size_t add_nbr);
|
||||
void print_matrix(char **matrix, char *sep);
|
||||
t_list *ft_lstbeforelast(t_list *lst);
|
||||
t_list *ft_lstnew_generic(size_t lst_sizse, size_t content_size);
|
||||
typedef void *(*t_dup_func)(void *);
|
||||
typedef void *(*t_dup_f)(void *);
|
||||
void *ft_dup_2d_arr(void *ptr, void *(*dup_func)(void *));
|
||||
void ft_perror_io(char *err_str, char *io_file);
|
||||
int ft_reti_perror_io(int ret, char *err_str, char *io_file);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
|
||||
/* Updated: 2021/11/11 07:21:47 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/11/16 08:45:10 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -36,21 +36,23 @@ typedef struct s_token
|
||||
enum e_token_id id;
|
||||
} t_token;
|
||||
|
||||
typedef int (*t_builtin_ptr)(int,char **,struct s_all *);
|
||||
typedef int (*t_builtin_f)(int,char **,struct s_all *);
|
||||
|
||||
typedef struct s_cmd
|
||||
{
|
||||
char **argv;
|
||||
pid_t pid;
|
||||
t_builtin_ptr *builtin_command;
|
||||
int fd_in;
|
||||
int fd_out;
|
||||
char **argv;
|
||||
char *path;
|
||||
t_builtin_f builtin_func;
|
||||
int fd_in;
|
||||
int fd_out;
|
||||
pid_t pid;
|
||||
} t_cmd;
|
||||
|
||||
typedef struct s_all
|
||||
{
|
||||
t_cmd **cmd_arr;
|
||||
char **envp;
|
||||
char **path;
|
||||
char *prompt_base;
|
||||
char *prompt;
|
||||
t_token *token_list;
|
||||
|
||||
Reference in New Issue
Block a user