diff options
Diffstat (limited to 'src')
64 files changed, 198 insertions, 194 deletions
diff --git a/src/b_alias.c b/src/b_alias.c index 7526064..8c9af00 100644 --- a/src/b_alias.c +++ b/src/b_alias.c @@ -72,7 +72,7 @@ static unsigned char b_print_arg(const char arg[], t_msh *msh) return (b_print_arg_next(ptr, arg, invalid, msh)); } -static void b_register_arg(const char arg[], t_msh *msh) +static void b_register_arg(const char arg[], t_msh *msh) { char *ptr; char name[255]; @@ -95,8 +95,8 @@ static void b_register_arg(const char arg[], t_msh *msh) unsigned char b_alias(char *args[], t_msh *msh) { const unsigned long argc = u_builtins_get_argc((const char**)args); - int i; - unsigned char ret; + int i; + unsigned char ret; ret = 0; if (argc == 0) @@ -120,7 +120,7 @@ unsigned char b_alias(char *args[], t_msh *msh) return (ret); } -void b_alias_mute(char *args[], t_msh *msh) +void b_alias_mute(char *args[], t_msh *msh) { const unsigned long argc = u_builtins_get_argc((const char**)args); int i; diff --git a/src/b_alias.h b/src/b_alias.h index 44b2fec..36155a4 100644 --- a/src/b_alias.h +++ b/src/b_alias.h @@ -13,10 +13,9 @@ #ifndef B_ALIAS_H # define B_ALIAS_H - # include "s_struct.h" unsigned char b_alias(char *args[], t_msh *msh); -void b_alias_mute(char *args[], t_msh *msh); +void b_alias_mute(char *args[], t_msh *msh); #endif @@ -27,7 +27,7 @@ #include "u_vars.h" #include "u_vars_next.h" -static void b_set_oldpwd(t_msh *msh) +static void b_set_oldpwd(t_msh *msh) { char pwd[PATH_MAX]; char tmp[PATH_MAX]; @@ -49,7 +49,7 @@ static void b_set_oldpwd(t_msh *msh) } } -static void b_fill_repath(char rpath[], char *splited[]) +static void b_fill_repath(char rpath[], char *splited[]) { size_t i; size_t j; @@ -78,7 +78,7 @@ static void b_fill_repath(char rpath[], char *splited[]) } } -static void b_upgrade_pwd(const char path[], t_msh *msh) +static void b_upgrade_pwd(const char path[], t_msh *msh) { char **splited; char repath[262144]; @@ -106,10 +106,10 @@ static void b_upgrade_pwd(const char path[], t_msh *msh) f_alloc_and_destroy_msh(msh); } -unsigned char b_cd(char *args[], t_msh *msh) +unsigned char b_cd(char *args[], t_msh *msh) { const unsigned long argc = u_builtins_get_argc((const char**)args); - char path[PATH_MAX]; + char path[PATH_MAX]; if (argc >= 2) f_fail_too_many_args("cd", msh); @@ -13,7 +13,6 @@ #ifndef B_CD_H # define B_CD_H - # include "s_struct.h" unsigned char b_cd(char *args[], t_msh *msh); diff --git a/src/b_echo.c b/src/b_echo.c index f62b2be..b27d099 100644 --- a/src/b_echo.c +++ b/src/b_echo.c @@ -17,7 +17,7 @@ #include "s_struct.h" #include "u_utils.h" -static void b_print_content(char *ptr[]) +static void b_print_content(char *ptr[]) { ft_printf("%s", *ptr); ptr++; @@ -28,11 +28,11 @@ static void b_print_content(char *ptr[]) } } -unsigned char b_echo(char *args[], t_msh *msh) +unsigned char b_echo(char *args[], t_msh *msh) { const unsigned long argc = u_builtins_get_argc((const char **)args); - char **ptr; - char nopt; + char **ptr; + char nopt; (void)msh; ptr = args; diff --git a/src/b_echo.h b/src/b_echo.h index a18299e..8fda86c 100644 --- a/src/b_echo.h +++ b/src/b_echo.h @@ -13,7 +13,6 @@ #ifndef B_ECHO_H # define B_ECHO_H - # include "s_struct.h" unsigned char b_echo(char *args[], t_msh *msh); diff --git a/src/b_exit.h b/src/b_exit.h index ca184c2..74dee72 100644 --- a/src/b_exit.h +++ b/src/b_exit.h @@ -13,7 +13,6 @@ #ifndef B_EXIT_H # define B_EXIT_H - # include "s_struct.h" unsigned char b_exit(char *args[], t_msh *msh); diff --git a/src/b_export.c b/src/b_export.c index f5d3360..28cc5a9 100644 --- a/src/b_export.c +++ b/src/b_export.c @@ -24,7 +24,7 @@ #include "u_utils.h" #include "u_vars.h" -t_bool check_valid_identifier(const char arg[]) +t_bool check_valid_identifier(const char arg[]) { char *ptr; @@ -36,7 +36,7 @@ t_bool check_valid_identifier(const char arg[]) return (FALSE); } -t_bool check_equals(const char *arg) +t_bool check_equals(const char *arg) { char *ptr; @@ -52,9 +52,9 @@ t_bool check_equals(const char *arg) return (FALSE); } -void b_add_to_env_from_globals(const char varname[], - const char var[], - t_msh *msh) +void b_add_to_env_from_globals(const char varname[], + const char var[], + t_msh *msh) { size_t i; char **nenvp; @@ -79,7 +79,7 @@ void b_add_to_env_from_globals(const char varname[], msh->envp = nenvp; } -static void b_classic_export(char *ptr[], t_msh *msh) +static void b_classic_export(char *ptr[], t_msh *msh) { char varval[4096]; char fmt[4096]; @@ -100,9 +100,9 @@ static void b_classic_export(char *ptr[], t_msh *msh) } } -unsigned char b_export(char *args[], t_msh *msh) +unsigned char b_export(char *args[], t_msh *msh) { - char **ptr; + char **ptr; unsigned char r; if (args[0] == NULL) diff --git a/src/b_export.h b/src/b_export.h index b6dcea6..92ef7f2 100644 --- a/src/b_export.h +++ b/src/b_export.h @@ -17,11 +17,11 @@ # include "s_struct.h" -t_bool check_valid_identifier(const char arg[]); -t_bool check_equals(const char *arg); -void b_add_to_env_from_globals(const char varname[], - const char var[], - t_msh *msh); -unsigned char b_export(char *args[], t_msh *msh); +t_bool check_valid_identifier(const char arg[]); +t_bool check_equals(const char *arg); +void b_add_to_env_from_globals(const char varname[], + const char var[], + t_msh *msh); +unsigned char b_export(char *args[], t_msh *msh); #endif diff --git a/src/b_export_mute.h b/src/b_export_mute.h index 0a6472e..0f0551a 100644 --- a/src/b_export_mute.h +++ b/src/b_export_mute.h @@ -13,7 +13,6 @@ #ifndef B_EXPORT_MUTE_H # define B_EXPORT_MUTE_H - # include "b_export.h" # include "s_struct.h" @@ -13,7 +13,6 @@ #ifndef B_H_H # define B_H_H - # include "s_struct.h" unsigned char b_h(char *args[], t_msh *msh); diff --git a/src/b_pwd.h b/src/b_pwd.h index 10cb864..d69a504 100644 --- a/src/b_pwd.h +++ b/src/b_pwd.h @@ -13,7 +13,6 @@ #ifndef B_PWD_H # define B_PWD_H - # include "s_struct.h" unsigned char b_pwd(char *args[], t_msh *msh); diff --git a/src/b_sqb_err.h b/src/b_sqb_err.h index 9e9f72b..8bf902a 100644 --- a/src/b_sqb_err.h +++ b/src/b_sqb_err.h @@ -13,7 +13,6 @@ #ifndef B_SQB_ERR_H # define B_SQB_ERR_H - unsigned char b_sqb_err_check(unsigned char id, char *argv[]); #endif diff --git a/src/b_sqb_file.c b/src/b_sqb_file.c index 836aa01..5029d0a 100644 --- a/src/b_sqb_file.c +++ b/src/b_sqb_file.c @@ -18,7 +18,9 @@ #include "d_define.h" -static t_bool b_file_tests(unsigned char id, const char path[], struct stat sb) +static t_bool b_file_tests(unsigned char id, + const char path[], + struct stat sb) { if (id == B_ID_SQB_B && S_ISBLK(sb.st_mode) == 1) return (TRUE); @@ -46,7 +48,7 @@ static t_bool b_file_tests(unsigned char id, const char path[], struct stat sb) return (FALSE); } -unsigned char b_sqb_file_tests(unsigned char id, char *argv[]) +unsigned char b_sqb_file_tests(unsigned char id, char *argv[]) { struct stat sb; @@ -76,7 +78,7 @@ static t_bool b_sqb_file_comp_tests(unsigned char id, return (FALSE); } -unsigned char b_sqb_double_file_tests(unsigned char id, char *argv[]) +unsigned char b_sqb_double_file_tests(unsigned char id, char *argv[]) { struct stat sb[2]; diff --git a/src/b_sqb_file.h b/src/b_sqb_file.h index 6116b75..6a31c62 100644 --- a/src/b_sqb_file.h +++ b/src/b_sqb_file.h @@ -13,7 +13,6 @@ #ifndef B_SQB_FILE_H # define B_SQB_FILE_H - unsigned char b_sqb_file_tests(unsigned char id, char *argv[]); unsigned char b_sqb_double_file_tests(unsigned char id, char *argv[]); diff --git a/src/b_sqb_nbr.c b/src/b_sqb_nbr.c index 0e2ab73..3ee4867 100644 --- a/src/b_sqb_nbr.c +++ b/src/b_sqb_nbr.c @@ -31,7 +31,7 @@ static t_bool b_sqb_nbr_tests(unsigned char id, int n1, int n2) return (FALSE); } -unsigned char b_sqb_nbr(unsigned char id, char *argv[]) +unsigned char b_sqb_nbr(unsigned char id, char *argv[]) { if (b_sqb_nbr_tests(id, ft_atoi(argv[0]), ft_atoi(argv[2])) == TRUE) return (0); diff --git a/src/b_sqb_nbr.h b/src/b_sqb_nbr.h index 7448354..54a8cc8 100644 --- a/src/b_sqb_nbr.h +++ b/src/b_sqb_nbr.h @@ -13,7 +13,6 @@ #ifndef B_SQB_NBR_H # define B_SQB_NBR_H - unsigned char b_sqb_nbr(unsigned char id, char *argv[]); #endif diff --git a/src/b_sqb_str.c b/src/b_sqb_str.c index 51fdd8d..f845c1e 100644 --- a/src/b_sqb_str.c +++ b/src/b_sqb_str.c @@ -14,7 +14,9 @@ #include "d_define.h" -static t_bool b_sqb_str_comp(unsigned char id, const char s1[], const char s2[]) +static t_bool b_sqb_str_comp(unsigned char id, + const char s1[], + const char s2[]) { if (id == B_ID_SQB_EQUA && ft_strncmp(s1, s2, ft_strlen(s1) + 1) == 0) @@ -25,7 +27,7 @@ static t_bool b_sqb_str_comp(unsigned char id, const char s1[], const char s2[]) return (FALSE); } -unsigned char b_sqb_str(unsigned char id, char *argv[]) +unsigned char b_sqb_str(unsigned char id, char *argv[]) { if (id == B_ID_SQB_N) { diff --git a/src/b_sqb_str.h b/src/b_sqb_str.h index b20e36d..deb761f 100644 --- a/src/b_sqb_str.h +++ b/src/b_sqb_str.h @@ -13,7 +13,6 @@ #ifndef B_SQB_STR_H # define B_SQB_STR_H - unsigned char b_sqb_str(unsigned char id, char *argv[]); #endif diff --git a/src/b_type.c b/src/b_type.c index 4cca44c..5904742 100644 --- a/src/b_type.c +++ b/src/b_type.c @@ -27,10 +27,10 @@ #include "u_path.h" #include "u_utils.h" -static char b_absolute_path_exists(char com[]) +static char b_absolute_path_exists(char com[]) { int fd; - DIR *dir; + DIR *dir; if ((dir = opendir(com)) != NULL) { @@ -45,7 +45,7 @@ static char b_absolute_path_exists(char com[]) return (0); } -static void b_type_get_path(char fullpath[], char com[], t_msh *msh) +static void b_type_get_path(char fullpath[], char com[], t_msh *msh) { if (ft_ischarset("/.", com[0]) == TRUE) { @@ -59,7 +59,9 @@ static void b_type_get_path(char fullpath[], char com[], t_msh *msh) u_search_in_path(fullpath, com, PATH_MAX, msh); } -static unsigned char b_check_nonbuilt(char *ptr, unsigned char ret, t_msh *msh) +static unsigned char b_check_nonbuilt(char *ptr, + unsigned char ret, + t_msh *msh) { char fullpath[PATH_MAX]; @@ -99,7 +101,7 @@ unsigned char b_type(char *args[], t_msh *msh) { t_lalias *p_alias; char **ptr; - int ret; + int ret; ptr = args; if (*ptr == NULL) diff --git a/src/b_type.h b/src/b_type.h index ae3b96f..ab20aad 100644 --- a/src/b_type.h +++ b/src/b_type.h @@ -13,7 +13,6 @@ #ifndef B_TYPE_H # define B_TYPE_H - # include "s_struct.h" unsigned char b_type(char *args[], t_msh *msh); diff --git a/src/b_unset.c b/src/b_unset.c index d4e0f31..f5ab356 100644 --- a/src/b_unset.c +++ b/src/b_unset.c @@ -93,7 +93,7 @@ static t_bool b_removed_from_env(const char arg[], t_msh *msh) return (FALSE); } -unsigned char b_unset(char *args[], t_msh *msh) +unsigned char b_unset(char *args[], t_msh *msh) { char **ptr; char r; diff --git a/src/b_unset.h b/src/b_unset.h index c7865a6..448aaa1 100644 --- a/src/b_unset.h +++ b/src/b_unset.h @@ -13,7 +13,6 @@ #ifndef B_UNSET_H # define B_UNSET_H - # include "s_struct.h" unsigned char b_unset(char *args[], t_msh *msh); diff --git a/src/e_builtins.h b/src/e_builtins.h index 3549e54..cf5e477 100644 --- a/src/e_builtins.h +++ b/src/e_builtins.h @@ -13,7 +13,6 @@ #ifndef E_BUILTINS_H # define E_BUILTINS_H - # include "s_struct.h" void e_builtin(const t_com *ptr, unsigned char bu_id, t_msh *msh); diff --git a/src/e_externs.c b/src/e_externs.c index a27e4ca..6e1e75a 100644 --- a/src/e_externs.c +++ b/src/e_externs.c @@ -38,7 +38,7 @@ static void e_extern_child(const char fullpath[], t_com *ptr, t_msh *msh) { char buff[7]; - int fd; + int fd; if ((fd = open(fullpath, O_RDONLY)) != -1) { @@ -95,7 +95,7 @@ static void e_exec_path(const char fullpath[], t_msh *msh) { pid_t pid; - int status; + int status; if ((pid = fork()) == 0) { @@ -119,7 +119,7 @@ static void e_exec_path(const char fullpath[], void e_extern(t_com *ptr, t_msh *msh) { - char fullpath[PATH_MAX]; + char fullpath[PATH_MAX]; unsigned char fp_ret; fullpath[0] = C_NUL; diff --git a/src/e_line.h b/src/e_line.h index 8dc8a83..f90d40f 100644 --- a/src/e_line.h +++ b/src/e_line.h @@ -13,7 +13,6 @@ #ifndef E_LINE_H # define E_LINE_H - # include "s_struct.h" void e_line_block(t_msh *msh); diff --git a/src/e_pipes.c b/src/e_pipes.c index 4ad9e46..c55d46d 100644 --- a/src/e_pipes.c +++ b/src/e_pipes.c @@ -29,8 +29,8 @@ #include "u_path.h" static unsigned char e_get_current_path(char fullpath[], - struct s_lpipes *ptr, - t_msh *msh) + struct s_lpipes *ptr, + t_msh *msh) { unsigned char fp_ret; @@ -57,15 +57,15 @@ static unsigned char e_get_current_path(char fullpath[], ** TODO: handle fork() failed, etc */ -static int e_unroll_pipes(int fd[256][2], - size_t pipes, - t_msh *msh) +static int e_unroll_pipes(int fd[256][2], + size_t pipes, + t_msh *msh) { struct s_lpipes *head; char fullpath[PATH_MAX]; - int pid; - unsigned short i; - unsigned char fp_ret; + int pid; + unsigned short i; + unsigned char fp_ret; head = msh->pipes; i = 0; @@ -91,11 +91,11 @@ static int e_unroll_pipes(int fd[256][2], ** TODO: error mgmnt */ -static void e_pipe_exec(size_t pipes, t_msh *msh) +static void e_pipe_exec(size_t pipes, t_msh *msh) { - int fd[256][2]; - int pid; - int status; + int fd[255][2]; + int pid; + int status; unsigned short i; i = 0; @@ -116,7 +116,7 @@ static void e_pipe_exec(size_t pipes, t_msh *msh) msh->ret = WEXITSTATUS(status); } -void e_pipes(t_msh *msh) +void e_pipes(t_msh *msh) { const size_t pipes = e_get_pipes_count(msh->pipes); diff --git a/src/e_pipes_next.c b/src/e_pipes_next.c index 6cca414..93eb42e 100644 --- a/src/e_pipes_next.c +++ b/src/e_pipes_next.c @@ -41,7 +41,7 @@ static void e_fullpath_not_found(t_com *ptr, t_msh *msh) static void e_exec_child(const char fullpath[], t_com *ptr, t_msh *msh) { char buff[7]; - int fd; + int fd; if ((fd = open(fullpath, O_RDONLY)) != -1) { diff --git a/src/e_pipes_next.h b/src/e_pipes_next.h index f112313..b905e7d 100644 --- a/src/e_pipes_next.h +++ b/src/e_pipes_next.h @@ -17,7 +17,10 @@ # include "s_struct.h" -void e_pipe_child(char fullpath[], unsigned char fp_ret, t_com *ptr, t_msh *msh); +void e_pipe_child(char fullpath[], + unsigned char fp_ret, + t_com *ptr, + t_msh *msh); size_t e_get_pipes_count(struct s_lpipes *ptr); void e_close_unused_fds(int fd[256][2], size_t pipes); diff --git a/src/f_shlvl.h b/src/f_shlvl.h index 3b6418f..ca4d2a8 100644 --- a/src/f_shlvl.h +++ b/src/f_shlvl.h @@ -13,7 +13,6 @@ #ifndef F_SHLVL_H # define F_SHLVL_H - void f_shlvl_too_high(int shlvl); #endif diff --git a/src/m_argv.c b/src/m_argv.c index 90ddd27..655d54b 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -25,12 +25,12 @@ #include "s_struct.h" #include "u_vars.h" -static char *m_get_prev_hist(t_msh *msh) +static char *m_get_prev_hist(t_msh *msh) { struct stat sb; char *hist; char histfile[PATH_MAX]; - int fd; + int fd; hist = NULL; u_get_var_value(histfile, "$HISTFILE", PATH_MAX, msh); @@ -48,7 +48,7 @@ static char *m_get_prev_hist(t_msh *msh) return (hist); } -static void m_read_script(char *const argv[], t_msh *msh) +static void m_read_script(char *const argv[], t_msh *msh) { int fd; @@ -61,7 +61,7 @@ static void m_read_script(char *const argv[], t_msh *msh) close(fd); } -unsigned char m_argv(int argc, char *const argv[], t_msh *msh) +unsigned char m_argv(int argc, char *const argv[], t_msh *msh) { if (argc == 1) { diff --git a/src/m_argv.h b/src/m_argv.h index 7664306..af2711c 100644 --- a/src/m_argv.h +++ b/src/m_argv.h @@ -13,7 +13,6 @@ #ifndef M_ARGV_H # define M_ARGV_H - # include "s_struct.h" unsigned char m_argv(int argc, char *const argv[], t_msh *msh); diff --git a/src/m_comm.h b/src/m_comm.h index 600f8e8..08c889a 100644 --- a/src/m_comm.h +++ b/src/m_comm.h @@ -13,7 +13,6 @@ #ifndef M_COMM_H # define M_COMM_H - # include "s_struct.h" unsigned char m_comm(const char line[], t_msh *msh); diff --git a/src/m_loop.c b/src/m_loop.c index d8ea680..27ebecd 100644 --- a/src/m_loop.c +++ b/src/m_loop.c @@ -33,7 +33,9 @@ #include "u_parse.h" #include "u_vars.h" -static void m_parse_and_run_line(char line[], unsigned char previf, t_msh *msh) +static void m_parse_and_run_line(char line[], + unsigned char previf, + t_msh *msh) { t_line_block *ptr; @@ -62,10 +64,10 @@ static void m_parse_and_run_line(char line[], unsigned char previf, t_msh *msh) s_line_clear(&msh->curr); } -void m_dump_hist(char hist[], t_msh *msh) +void m_dump_hist(char hist[], t_msh *msh) { char histfile[PATH_MAX]; - int fd; + int fd; if (hist[0] != C_NUL && ft_strlen(hist) > 0) { @@ -82,7 +84,7 @@ void m_dump_hist(char hist[], t_msh *msh) } } -static void m_handle_hist(char hist[], char line[], t_msh *msh) +static void m_handle_hist(char hist[], char line[], t_msh *msh) { static unsigned short hist_i = 0; @@ -99,7 +101,7 @@ static void m_handle_hist(char hist[], char line[], t_msh *msh) } } -static void m_delete_comments(char line[]) +static void m_delete_comments(char line[]) { char *ptr; t_quote_mode mode; @@ -125,7 +127,7 @@ static void m_delete_comments(char line[]) } } -unsigned char m_loop(int fd, t_msh *msh) +unsigned char m_loop(int fd, t_msh *msh) { static char hist[255 * 4096]; char *line; diff --git a/src/m_loop.h b/src/m_loop.h index d494742..373a505 100644 --- a/src/m_loop.h +++ b/src/m_loop.h @@ -13,10 +13,9 @@ #ifndef M_LOOP_H # define M_LOOP_H - # include "s_struct.h" -void m_dump_hist(char hist[], t_msh *msh); +void m_dump_hist(char hist[], t_msh *msh); unsigned char m_loop(int fd, t_msh *msh); #endif diff --git a/src/m_loop_counter.c b/src/m_loop_counter.c index 49deb52..330d3f1 100644 --- a/src/m_loop_counter.c +++ b/src/m_loop_counter.c @@ -16,7 +16,10 @@ #include "m_prompt.h" #include "s_struct.h" -char *m_counter_line_backslash(int fd, unsigned char psx, char *l, t_msh *msh) +char *m_counter_line_backslash(int fd, + unsigned char psx, + char *l, + t_msh *msh) { char *counter_line; @@ -56,7 +59,10 @@ char *m_counter_line_pipes(int fd, unsigned char psx, char *line, t_msh *msh) return (line); } -char *m_counter_line_quotes(int fd, unsigned char psx, char *line, t_msh *msh) +char *m_counter_line_quotes(int fd, + unsigned char psx, + char *line, + t_msh *msh) { char *counter_line; diff --git a/src/m_loop_counter.h b/src/m_loop_counter.h index eb4d4e5..c9eb86d 100644 --- a/src/m_loop_counter.h +++ b/src/m_loop_counter.h @@ -13,11 +13,19 @@ #ifndef M_LOOP_COUNTER_H # define M_LOOP_COUNTER_H - # include "s_struct.h" -char *m_counter_line_backslash(int fd, unsigned char psx, char *l, t_msh *msh); -char *m_counter_line_pipes(int fd, unsigned char psx, char *line, t_msh *msh); -char *m_counter_line_quotes(int fd, unsigned char psx, char *line, t_msh *msh); +char *m_counter_line_backslash(int fd, + unsigned char psx, + char *l, + t_msh *msh); +char *m_counter_line_pipes(int fd, + unsigned char psx, + char *line, + t_msh *msh); +char *m_counter_line_quotes(int fd, + unsigned char psx, + char *line, + t_msh *msh); #endif diff --git a/src/m_loop_multis.h b/src/m_loop_multis.h index bdb6273..ddef634 100644 --- a/src/m_loop_multis.h +++ b/src/m_loop_multis.h @@ -13,7 +13,6 @@ #ifndef M_LOOP_MULTIS_H # define M_LOOP_MULTIS_H - # include "s_struct.h" char *m_check_multi_quotes(int fd, char line[], t_msh *msh); diff --git a/src/m_loop_next.h b/src/m_loop_next.h index b130627..6ec5a0c 100644 --- a/src/m_loop_next.h +++ b/src/m_loop_next.h @@ -13,7 +13,6 @@ #ifndef M_LOOP_NEXT_H # define M_LOOP_NEXT_H - # include "s_struct.h" char *m_check_multi_backslash(int fd, char line[], t_msh *msh); diff --git a/src/m_minishell.c b/src/m_minishell.c index 6227e3d..987cfc0 100644 --- a/src/m_minishell.c +++ b/src/m_minishell.c @@ -24,7 +24,7 @@ int main(int argc, char *const argv[], char *const envp[]) { - int ret; + int ret; t_msh *msh; if ((msh = s_init_msh(argc, argv, envp)) == NULL) diff --git a/src/m_mshrc.c b/src/m_mshrc.c index a78ea95..8fd9fcf 100644 --- a/src/m_mshrc.c +++ b/src/m_mshrc.c @@ -27,9 +27,9 @@ unsigned char m_source_mshrc(t_msh *msh) { - char file[PATH_MAX]; - char home[PATH_MAX]; - int fd; + char file[PATH_MAX]; + char home[PATH_MAX]; + int fd; unsigned char ret; file[0] = C_NUL; diff --git a/src/m_mshrc.h b/src/m_mshrc.h index 910e276..70f5d62 100644 --- a/src/m_mshrc.h +++ b/src/m_mshrc.h @@ -13,7 +13,6 @@ #ifndef M_MSHRC_H # define M_MSHRC_H - # include "s_struct.h" unsigned char m_source_mshrc(t_msh *msh); diff --git a/src/m_prompt.h b/src/m_prompt.h index c22da29..3170ecc 100644 --- a/src/m_prompt.h +++ b/src/m_prompt.h @@ -13,7 +13,6 @@ #ifndef M_PROMPT_H # define M_PROMPT_H - # include "s_struct.h" void m_prompt_psx(unsigned char x, t_msh *msh); diff --git a/src/p_args.c b/src/p_args.c index f50d52b..6a238ed 100644 --- a/src/p_args.c +++ b/src/p_args.c @@ -20,7 +20,7 @@ #include "u_parse.h" #include "u_utils.h" -static void p_meet_bs(char *ptr, t_quote_mode mode) +static void p_meet_bs(char *ptr, t_quote_mode mode) { if (mode != Q_SINGLE) { @@ -32,7 +32,9 @@ static void p_meet_bs(char *ptr, t_quote_mode mode) } } -static t_bool p_meet_whitespace(char *head, char *ptr, t_quote_mode mode) +static t_bool p_meet_whitespace(char *head, + char *ptr, + t_quote_mode mode) { if (mode == Q_NONE && u_is_not_escaped(head, ptr) == TRUE) { @@ -41,7 +43,7 @@ static t_bool p_meet_whitespace(char *head, char *ptr, t_quote_mode mode) return (FALSE); } -static char *p_skip_whitespace(char *ptr) +static char *p_skip_whitespace(char *ptr) { while (*ptr != C_NUL && ft_iswhitespace(*ptr)) ptr++; @@ -53,11 +55,11 @@ static char *p_skip_whitespace(char *ptr) */ static unsigned short p_count_args(const char word[], - size_t start[], - unsigned short count, - t_quote_mode mode) + size_t start[], + unsigned short count, + t_quote_mode mode) { - char *ptr; + char *ptr; ptr = (char *)word; ptr = p_skip_whitespace(ptr); @@ -83,10 +85,10 @@ static unsigned short p_count_args(const char word[], return (count); } -char **p_split_args(char word[]) +char **p_split_args(char word[]) { - size_t start[512]; - char **words; + size_t start[512]; + char **words; unsigned short argc; unsigned short to_del; diff --git a/src/p_args_next.c b/src/p_args_next.c index 83319be..8eb8e21 100644 --- a/src/p_args_next.c +++ b/src/p_args_next.c @@ -21,10 +21,10 @@ #include "p_args.h" #include "p_args_len.h" -static char *p_give_me_an_arg(char tmp[], - const char word[], - const unsigned short i, - const size_t start[]) +static char *p_give_me_an_arg(char tmp[], + const char word[], + const unsigned short i, + const size_t start[]) { tmp[0] = '\0'; ft_strlcpy(tmp, @@ -33,7 +33,7 @@ static char *p_give_me_an_arg(char tmp[], return (tmp); } -void p_del_alloced_words(char *words[], unsigned short to_del) +void p_del_alloced_words(char *words[], unsigned short to_del) { unsigned short i; @@ -46,11 +46,11 @@ void p_del_alloced_words(char *words[], unsigned short to_del) } unsigned short p_dup_words(char *words[], - const char word[], - const unsigned short argc, - const size_t start[]) + const char word[], + const unsigned short argc, + const size_t start[]) { - char tmp[ARG_MAX]; + char tmp[ARG_MAX]; unsigned short i; i = 0; diff --git a/src/p_args_next.h b/src/p_args_next.h index 22d06a9..826d3df 100644 --- a/src/p_args_next.h +++ b/src/p_args_next.h @@ -13,11 +13,12 @@ #ifndef P_ARGS_NEXT_H # define P_ARGS_NEXT_H +# include <stddef.h> unsigned short p_dup_words(char *words[], - const char word[], - const unsigned short argc, - const size_t start[]); -void p_del_alloced_words(char *words[], unsigned short to_del); + const char word[], + const unsigned short argc, + const size_t start[]); +void p_del_alloced_words(char *words[], unsigned short to_del); #endif diff --git a/src/p_lblock.c b/src/p_lblock.c index f3b5b44..3d04333 100644 --- a/src/p_lblock.c +++ b/src/p_lblock.c @@ -41,7 +41,7 @@ static unsigned char p_get_nextif(char *words[], size_t i) return (nextif); } -t_bool p_find_good_pipe(const char word[]) +t_bool p_find_good_pipe(const char word[]) { char *ptr; t_quote_mode mode; @@ -65,11 +65,11 @@ t_bool p_find_good_pipe(const char word[]) return (FALSE); } -static char p_loop(char *words[], t_msh *msh) +static char p_loop(char *words[], t_msh *msh) { t_line_block *link; size_t i; - unsigned char nextif; + unsigned char nextif; i = 0; while (words[i] != NULL) @@ -83,7 +83,7 @@ static char p_loop(char *words[], t_msh *msh) return (0); } -char p_line_block(const char line[], t_msh *msh) +char p_line_block(const char line[], t_msh *msh) { char **words; diff --git a/src/p_redirs.c b/src/p_redirs.c index aee845b..fc26a6e 100644 --- a/src/p_redirs.c +++ b/src/p_redirs.c @@ -30,12 +30,12 @@ #include "u_vars.h" static unsigned char p_append_redir(const char path[], - int fd_rdr[], - t_com *com, - t_msh *msh) + int fd_rdr[], + t_com *com, + t_msh *msh) { struct s_lredir *new; - int fd; + int fd; char redir; fd = fd_rdr[FD]; @@ -54,9 +54,9 @@ static unsigned char p_append_redir(const char path[], return (0); } -static size_t p_get_path(char path[], - struct s_rdr_tmp tmp, - t_msh *msh) +static size_t p_get_path(char path[], + struct s_rdr_tmp tmp, + t_msh *msh) { char h[PATH_MAX]; size_t pos[2]; @@ -84,7 +84,7 @@ static size_t p_get_path(char path[], return (pos[1]); } -static int p_get_fd(const char word[], char *ptr) +static int p_get_fd(const char word[], char *ptr) { char digit[255]; char *tmp; @@ -109,7 +109,10 @@ static int p_get_fd(const char word[], char *ptr) return (ft_atoi(digit)); } -static unsigned char p_get_redir(char word[], char *ptr, t_com *com, t_msh *msh) +static unsigned char p_get_redir(char word[], + char *ptr, + t_com *com, + t_msh *msh) { struct s_rdr_tmp tmp; char path[PATH_MAX]; @@ -137,7 +140,7 @@ static unsigned char p_get_redir(char word[], char *ptr, t_com *com, t_msh *msh) return (p_append_redir(path, fd_rdr, com, msh)); } -char p_redirs(char word[], t_com **com, t_msh *msh) +char p_redirs(char word[], t_com **com, t_msh *msh) { char *ptr; t_quote_mode mode; diff --git a/src/p_redirs.h b/src/p_redirs.h index 6ca4230..a580b28 100644 --- a/src/p_redirs.h +++ b/src/p_redirs.h @@ -13,7 +13,6 @@ #ifndef P_REDIRS_H # define P_REDIRS_H - # include "s_struct.h" enum e_fd_rdr_id diff --git a/src/p_redirs_heredoc.h b/src/p_redirs_heredoc.h index 2ab479d..a13a358 100644 --- a/src/p_redirs_heredoc.h +++ b/src/p_redirs_heredoc.h @@ -13,7 +13,6 @@ #ifndef P_REDIRS_HEREDOC_H # define P_REDIRS_HEREDOC_H - # include "s_struct.h" char *p_get_heredoc(const char path[], const char redir, t_msh *msh); diff --git a/src/p_split.h b/src/p_split.h index 94ff29f..c52d7df 100644 --- a/src/p_split.h +++ b/src/p_split.h @@ -20,13 +20,13 @@ # include <limits.h> # endif -typedef struct s_split_block +typedef struct s_split_block { - size_t pos[ARG_MAX / 2]; - char nextif[ARG_MAX / 2]; + size_t pos[ARG_MAX / 2]; + char nextif[ARG_MAX / 2]; unsigned int count; -} t_split_block; +} t_split_block; -char **p_split_line(char line[]); +char **p_split_line(char line[]); #endif diff --git a/src/s_com.c b/src/s_com.c index 2797847..e4275fd 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -30,7 +30,7 @@ #include "s_lredir.h" #include "s_struct.h" -static char s_fill_com(char *words[], t_com **com) +static char s_fill_com(char *words[], t_com **com) { unsigned long i; unsigned long j; diff --git a/src/s_init_next.c b/src/s_init_next.c index 000ba0a..4521ce1 100644 --- a/src/s_init_next.c +++ b/src/s_init_next.c @@ -32,7 +32,7 @@ void s_inc_shlvl(t_msh *msh) char fmt[8]; char tmp[255]; char str[255]; - int shlvl; + int shlvl; u_get_var_value(tmp, "$SHLVL", 255, msh); if (tmp[0] == C_NUL) @@ -66,7 +66,7 @@ char **s_dupenv_del(char **nenvp, unsigned long i) char **s_dupenv(char *const envp[]) { unsigned long i; - char **nenvp; + char **nenvp; i = 0; while (envp[i] != NULL) diff --git a/src/s_line.h b/src/s_line.h index 0ee1773..553f92c 100644 --- a/src/s_line.h +++ b/src/s_line.h @@ -13,7 +13,6 @@ #ifndef S_LINE_H # define S_LINE_H - # include "s_struct.h" void s_line_add_back(t_line_block **aline, t_line_block *new); diff --git a/src/s_lpipes_split.c b/src/s_lpipes_split.c index 3dde313..5cacd32 100644 --- a/src/s_lpipes_split.c +++ b/src/s_lpipes_split.c @@ -40,7 +40,7 @@ void s_get_split_pos(size_t pos[], const char word[]) { char *ptr; t_quote_mode mode; - unsigned short i; + unsigned short i; ptr = (char*)word; mode = Q_NONE; diff --git a/src/s_lredir.c b/src/s_lredir.c index 517c2de..1074382 100644 --- a/src/s_lredir.c +++ b/src/s_lredir.c @@ -68,10 +68,10 @@ void s_lredir_clear(struct s_lredir **lredir) *lredir = NULL; } -static int s_get_right_fd(const char path[]) +static int s_get_right_fd(const char path[]) { char *ptr; - int rfd; + int rfd; ptr = (char*)path; while (ft_isdigit(*ptr) == TRUE) diff --git a/src/s_lredir.h b/src/s_lredir.h index 3b06e51..a609aab 100644 --- a/src/s_lredir.h +++ b/src/s_lredir.h @@ -13,7 +13,6 @@ #ifndef S_LREDIR_H # define S_LREDIR_H - # include "s_struct.h" void s_lredir_add_back(t_lredir **lredir, t_lredir *new); diff --git a/src/u_alias.c b/src/u_alias.c index 4aab600..aeb5a06 100644 --- a/src/u_alias.c +++ b/src/u_alias.c @@ -17,7 +17,7 @@ #include "s_lalias.h" #include "s_struct.h" -size_t u_get_alias_value(char str[], +short u_get_alias_value(char str[], const char name[], size_t dstsize, t_msh *msh) diff --git a/src/u_alias.h b/src/u_alias.h index c980bd2..503c8f6 100644 --- a/src/u_alias.h +++ b/src/u_alias.h @@ -17,10 +17,10 @@ # include "s_struct.h" -unsigned char u_get_alias_value(char str[], - const char name[], - size_t dstsize, - t_msh *msh); +short u_get_alias_value(char str[], + const char name[], + size_t dstsize, + t_msh *msh); void u_set_alias_value(const char name[], const char value[], t_msh *msh); #endif diff --git a/src/u_path.h b/src/u_path.h index 16b02dc..b0822d5 100644 --- a/src/u_path.h +++ b/src/u_path.h @@ -17,15 +17,15 @@ # include "s_struct.h" -struct s_path +struct s_path { - char *tok_path; - size_t dstsize; + char *tok_path; + size_t dstsize; }; -unsigned char u_search_in_path(char fullpath[], - const char com[], - size_t dstsize, - t_msh *msh); +unsigned char u_search_in_path(char fullpath[], + const char com[], + size_t dstsize, + t_msh *msh); #endif diff --git a/src/u_utils.c b/src/u_utils.c index 5394705..902b7a8 100644 --- a/src/u_utils.c +++ b/src/u_utils.c @@ -18,7 +18,7 @@ #include "f_fail.h" #include "s_struct.h" -t_bool u_is_not_escaped(const char *head, const char *ptr) +t_bool u_is_not_escaped(const char *head, const char *ptr) { if (((ptr - head) == 0) || ((ptr - head) >= 1 && *(ptr - 1) != C_BACKS) || @@ -27,7 +27,7 @@ t_bool u_is_not_escaped(const char *head, const char *ptr) return (FALSE); } -void u_eof_fd(int fd) +void u_eof_fd(int fd) { char *line; @@ -36,7 +36,7 @@ void u_eof_fd(int fd) ft_memdel((void*)&line); } -char **u_get_env_var_names(t_msh *msh) +char **u_get_env_var_names(t_msh *msh) { char **vars; size_t i; @@ -72,10 +72,10 @@ unsigned long u_builtins_get_argc(const char *args[]) return (argc); } -unsigned char u_get_builtin_id(const char bin[]) +unsigned char u_get_builtin_id(const char bin[]) { - char tmp[M_BUILTINS_REF_LEN]; - char *tok; + char tmp[M_BUILTINS_REF_LEN]; + char *tok; unsigned char i; i = 0; diff --git a/src/u_utils.h b/src/u_utils.h index 33e0f5d..b535537 100644 --- a/src/u_utils.h +++ b/src/u_utils.h @@ -17,10 +17,10 @@ # include "s_struct.h" -t_bool u_is_not_escaped(const char *head, const char *ptr); -void u_eof_fd(int fd); +t_bool u_is_not_escaped(const char *head, const char *ptr); +void u_eof_fd(int fd); unsigned long u_builtins_get_argc(const char *args[]); -char **u_get_env_var_names(t_msh *msh); -unsigned char u_get_builtin_id(const char bin[]); +char **u_get_env_var_names(t_msh *msh); +unsigned char u_get_builtin_id(const char bin[]); #endif diff --git a/src/u_vars.c b/src/u_vars.c index e096730..266b94b 100644 --- a/src/u_vars.c +++ b/src/u_vars.c @@ -20,7 +20,7 @@ #include "s_struct.h" #include "u_utils.h" -static void u_get_frm_env(char str[], +static void u_get_frm_env(char str[], const char varname[], size_t dstsize, t_msh *msh) @@ -49,12 +49,12 @@ static void u_get_frm_env(char str[], ft_delwords(env_dup); } -static void u_get_special_var(char str[], - const char varname[], - size_t dstsize, - t_msh *msh) +static void u_get_special_var(char str[], + const char varname[], + size_t dstsize, + t_msh *msh) { - char tmp[255]; + char tmp[255]; int n; if (ft_strncmp(varname, M_RET_VAR, 3) == 0) @@ -76,7 +76,7 @@ static void u_get_special_var(char str[], } } -void u_get_custom_var(char str[], +void u_get_custom_var(char str[], const char varname[], size_t dstsize, t_msh *msh) @@ -109,10 +109,10 @@ void u_get_custom_var(char str[], ** varname[] wasn't found. */ -unsigned char u_get_var_value(char str[], - const char varname[], - size_t dstsize, - t_msh *msh) +unsigned char u_get_var_value(char str[], + const char varname[], + size_t dstsize, + t_msh *msh) { str[0] = C_NUL; u_get_special_var(str, varname, dstsize, msh); diff --git a/src/u_vars.h b/src/u_vars.h index 337c357..cffc7e8 100644 --- a/src/u_vars.h +++ b/src/u_vars.h @@ -17,13 +17,13 @@ # include "s_struct.h" -void u_get_custom_var(char str[], - const char varname[], - size_t dstsize, - t_msh *msh); +void u_get_custom_var(char str[], + const char varname[], + size_t dstsize, + t_msh *msh); unsigned char u_get_var_value(char str[], - const char varname[], - size_t dstsize, - t_msh *msh); + const char varname[], + size_t dstsize, + t_msh *msh); #endif |