2023-02-14 11:11:39 -05:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* minishell.h :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2023/02/14 13:45:30 by cchauvet #+# #+# */
|
|
|
|
/* Updated: 2023/02/14 14:54:25 by cchauvet ### ########.fr */
|
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2023-02-14 01:21:24 -05:00
|
|
|
#ifndef MINISHELL_H
|
|
|
|
# define MINISHELL_H
|
2023-01-31 09:02:23 -05:00
|
|
|
# include "libftx/libftx.h"
|
2023-02-01 11:28:38 -05:00
|
|
|
# include "utils/utils.h"
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <sys/stat.h>
|
|
|
|
# include <fcntl.h>
|
2023-02-14 01:21:24 -05:00
|
|
|
# include <sys/wait.h>
|
|
|
|
# include <stdio.h>
|
|
|
|
# include <readline/readline.h>
|
|
|
|
# include <readline/history.h>
|
|
|
|
|
|
|
|
t_list **init_env(char **env);
|
2023-02-14 07:38:40 -05:00
|
|
|
int set_value_key(t_list **env, char *key, char *value);
|
2023-02-14 01:21:24 -05:00
|
|
|
char *get_value_index(int index, t_list **head);
|
|
|
|
char *get_value_key(char *key, t_list **head);
|
2023-02-06 14:41:10 -05:00
|
|
|
int ft_syntatic_verif(const char *str);
|
|
|
|
int ft_file_is_readable(const char *path);
|
|
|
|
int ft_file_is_writeable(const char *path);
|
|
|
|
char *ft_get_file_path(const char *infile);
|
|
|
|
int ft_infile(char *line);
|
|
|
|
int ft_outfile(char *line);
|
|
|
|
int ft_heredoc(char *stop);
|
|
|
|
size_t ft_seglen_quoted(const char *str, char c);
|
2023-02-14 07:38:40 -05:00
|
|
|
int ft_cmds_executor(t_list **cmds, char **env);
|
2023-02-06 14:41:10 -05:00
|
|
|
char **ft_split_quoted(const char *s, char c);
|
2023-02-14 11:11:39 -05:00
|
|
|
void env_del(void *content);
|
2023-01-31 08:40:15 -05:00
|
|
|
|
2023-02-06 14:41:10 -05:00
|
|
|
typedef struct s_cmd
|
2023-01-31 08:40:15 -05:00
|
|
|
{
|
2023-02-14 01:21:24 -05:00
|
|
|
int fd_in;
|
|
|
|
int fd_out;
|
2023-02-06 14:41:10 -05:00
|
|
|
char *executable;
|
2023-02-09 12:47:05 -05:00
|
|
|
char **args;
|
2023-02-14 01:21:24 -05:00
|
|
|
} t_cmd;
|
|
|
|
|
|
|
|
typedef struct s_data
|
|
|
|
{
|
|
|
|
t_list **env;
|
2023-02-14 07:38:40 -05:00
|
|
|
int heredoc;
|
2023-02-14 01:21:24 -05:00
|
|
|
} t_data;
|
2023-01-31 09:02:23 -05:00
|
|
|
|
|
|
|
#endif
|