-
Notifications
You must be signed in to change notification settings - Fork 0
/
minishell.h
executable file
·157 lines (126 loc) · 4.04 KB
/
minishell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pmoreno- <pmoreno-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/07 12:56:53 by potero-d #+# #+# */
/* Updated: 2022/08/11 12:37:34 by potero-d ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MINISHELL_H
# define MINISHELL_H
# include<unistd.h>
# include<stdlib.h>
# include<stdio.h>
# include<readline/readline.h>
# include<readline/history.h>
# include<fcntl.h>
# include<errno.h>
# include<signal.h>
# include<termios.h>
# include "libft.h"
# include "structs.h"
void rl_replace_line(const char *text, int clear_undo);
/*Main*/
int execute(t_data *data);
int main(int argc, char **argv2, char **envp);
int cont_arg(t_argv **argv);
/*Argv*/
void read_str(t_argv *argv, char *str);
int words(char *str);
void arguments(t_argv **argv, char *str);
void min_split(t_data *data);
/*Free*/
void free_arg_str(char *str, t_argv *argv);
void free_env(t_myenv *myenv);
void free_env_char(char **str);
/*List*/
t_argv *lstnew(char *str);
int lstsize(t_argv *argv);
t_argv *lstlast(t_argv *lst);
void lst_add_back(t_argv **argv, t_argv *new);
void add_front(t_argv **argv, t_argv *new);
/*Echo*/
void min_echo(t_argv **argv);
int check_flags(char *flag);
/*PWD*/
void min_pwd(t_myenv **myenv);
/*Env*/
t_myenv *envnew(char *str);
t_myenv *envlast(t_myenv *myenv);
void env_add_back(t_myenv **myenv, t_myenv *new);
void min_getenv(char **envp, t_myenv **myenv);
char **env_to_char(t_myenv **myenv);
/*Cd*/
void min_cd(t_data *data);
void change_pwd(t_myenv **myenv);
/*Export*/
void min_export(t_data *data);
t_myenv *export_new(char *str);
int exist_key(char *key, t_myenv *myenv);
int cont_env(t_myenv *myenv);
/*Export_two*/
void min_just_export(t_myenv *myenv);
int just_exist_key(char *str, t_myenv *myenv);
t_myenv *export_just_new(char *str);
/*Unset*/
void min_unset(t_data *data);
void aux_unset(t_myenv **myenv, t_argv *argv);
/*Expand*/
void expand(t_data *data);
int change(int i, char c);
void min_home(t_data *data);
/*Expand_two*/
char *change_str(char *str, t_myenv **myenv, int *len);
/*Print*/
void print_env(t_myenv **env);
void print_list(t_argv **argv);
/*Cmmd*/
int command(t_data *data);
int execute_cmmd(t_data *data);
void direction(t_data *data);
/*Cmmd_Path*/
int cmmd_addarg(char **new_path, char *path, char *arg);
void not_cmmd(char *str);
char *cmmd_find_path(char **envp);
char *cmmd_path(char **path, char *arg);
/*Pipex*/
int pipe_execute(t_data *data);
/*Remove_quotes*/
char *quotes(char *arg);
void remove_quotes(t_argv **argv);
/*Error*/
int command_found(t_data *data);
void update_error(t_data *data);
//void pipe_error(t_data *data);
int child_error(t_argv *arg, int error);
void fd_error(char *str);
/*Files*/
void check_files(t_data *data);
void set_initial_files(t_data *data);
void clean_split(t_argv *argv, int i, int z);
/*Infiles*/
int set_infile(t_argv *argv, int i);
int check_if_infile(t_argv *argv, int i);
/*Outfiles*/
int set_outfile(t_argv *argv, int i);
int check_if_outfile(t_argv *argv, int i);
/*SHLVL*/
char *shlvl(char *str);
/*Builtins*/
int min_builtins(t_argv *argv, t_data *data);
int exception(t_argv *arg, t_data *data);
void first_chr_pipe(char *str, t_argv *arg);
/*Here_doc*/
void min_here_doc(t_argv *arg);
/*Signal*/
void no_ctrlprint(void);
void sighandler(int signum);
void ctrlslash(int sig);
/*Exit*/
void min_exit(t_argv *arg, t_data *data);
void sighandlerhd(int signum);
void sigctrlc(int signum);
#endif