diff options
Diffstat (limited to '')
100 files changed, 249 insertions, 338 deletions
| diff --git a/src/b_alias.c b/src/b_alias.c index 62c2e5e..7526064 100644 --- a/src/b_alias.c +++ b/src/b_alias.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include <unistd.h>  #ifdef __linux__ @@ -26,7 +25,7 @@  #include "u_alias.h"  #include "u_utils.h" -static uint8_t	b_print_arg_next(char *ptr, +static unsigned char	b_print_arg_next(char *ptr,  								const char arg[],  								t_bool invalid,  								t_msh *msh) @@ -57,7 +56,7 @@ static uint8_t	b_print_arg_next(char *ptr,  	return (0);  } -static uint8_t	b_print_arg(const char arg[], t_msh *msh) +static unsigned char	b_print_arg(const char arg[], t_msh *msh)  {  	char	*ptr;  	t_bool	invalid; @@ -93,11 +92,11 @@ static void		b_register_arg(const char arg[], t_msh *msh)  	}  } -uint8_t			b_alias(char *args[], t_msh *msh) +unsigned char			b_alias(char *args[], t_msh *msh)  { -	const uint64_t	argc = u_builtins_get_argc((const char**)args); -	int32_t			i; -	uint8_t			ret; +	const unsigned long	argc = u_builtins_get_argc((const char**)args); +	int			i; +	unsigned char			ret;  	ret = 0;  	if (argc == 0) @@ -123,8 +122,8 @@ uint8_t			b_alias(char *args[], t_msh *msh)  void			b_alias_mute(char *args[], t_msh *msh)  { -	const uint64_t	argc = u_builtins_get_argc((const char**)args); -	int32_t			i; +	const unsigned long	argc = u_builtins_get_argc((const char**)args); +	int			i;  	if (argc > 0)  	{ diff --git a/src/b_alias.h b/src/b_alias.h index 9d7f1e5..44b2fec 100644 --- a/src/b_alias.h +++ b/src/b_alias.h @@ -13,11 +13,10 @@  #ifndef B_ALIAS_H  # define B_ALIAS_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	b_alias(char *args[], t_msh *msh); +unsigned char	b_alias(char *args[], t_msh *msh);  void	b_alias_mute(char *args[], t_msh *msh);  #endif @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #ifdef __linux__  # include <linux/limits.h> @@ -107,9 +106,9 @@ static void	b_upgrade_pwd(const char path[], t_msh *msh)  		f_alloc_and_destroy_msh(msh);  } -uint8_t		b_cd(char *args[], t_msh *msh) +unsigned char		b_cd(char *args[], t_msh *msh)  { -	const uint64_t	argc = u_builtins_get_argc((const char**)args); +	const unsigned long	argc = u_builtins_get_argc((const char**)args);  	char			path[PATH_MAX];  	if (argc >= 2) @@ -13,10 +13,9 @@  #ifndef B_CD_H  # define B_CD_H -# include <stdint.h>  # include "s_struct.h" -uint8_t b_cd(char *args[], t_msh *msh); +unsigned char b_cd(char *args[], t_msh *msh);  #endif diff --git a/src/b_echo.c b/src/b_echo.c index f931f36..f62b2be 100644 --- a/src/b_echo.c +++ b/src/b_echo.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdio.h>  #include <stdlib.h> @@ -29,11 +28,11 @@ static void	b_print_content(char *ptr[])  	}  } -uint8_t		b_echo(char *args[], t_msh *msh) +unsigned char		b_echo(char *args[], t_msh *msh)  { -	const uint64_t	argc = u_builtins_get_argc((const char **)args); +	const unsigned long	argc = u_builtins_get_argc((const char **)args);  	char			**ptr; -	int8_t			nopt; +	char			nopt;  	(void)msh;  	ptr = args; diff --git a/src/b_echo.h b/src/b_echo.h index 4ebf202..a18299e 100644 --- a/src/b_echo.h +++ b/src/b_echo.h @@ -13,10 +13,9 @@  #ifndef B_ECHO_H  # define B_ECHO_H -# include <stdint.h>  # include "s_struct.h" -uint8_t b_echo(char *args[], t_msh *msh); +unsigned char b_echo(char *args[], t_msh *msh);  #endif diff --git a/src/b_env.c b/src/b_env.c index a19aadd..8bc501f 100644 --- a/src/b_env.c +++ b/src/b_env.c @@ -11,12 +11,11 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include "f_fail.h"  #include "s_struct.h" -uint8_t	b_env(char *args[], t_msh *msh) +unsigned char	b_env(char *args[], t_msh *msh)  {  	char	**ptr; diff --git a/src/b_env.h b/src/b_env.h index 847f458..2c8c3c8 100644 --- a/src/b_env.h +++ b/src/b_env.h @@ -13,10 +13,9 @@  #ifndef B_ENV_H  # define B_ENV_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	b_env(char *args[], t_msh *msh); +unsigned char	b_env(char *args[], t_msh *msh);  #endif diff --git a/src/b_exit.c b/src/b_exit.c index 113313d..11a72a3 100644 --- a/src/b_exit.c +++ b/src/b_exit.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include <unistd.h>  #include "f_fail.h" @@ -25,10 +24,10 @@  ** TODO: handle non-numeric args[0]  */ -uint8_t	b_exit(char *args[], t_msh *msh) +unsigned char	b_exit(char *args[], t_msh *msh)  { -	uint8_t			ret; -	const uint64_t	argc = u_builtins_get_argc((const char**)args); +	unsigned char			ret; +	const unsigned long	argc = u_builtins_get_argc((const char**)args);  	if (argc > 1)  	{ diff --git a/src/b_exit.h b/src/b_exit.h index dcdceee..ca184c2 100644 --- a/src/b_exit.h +++ b/src/b_exit.h @@ -13,10 +13,9 @@  #ifndef B_EXIT_H  # define B_EXIT_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	b_exit(char *args[], t_msh *msh); +unsigned char	b_exit(char *args[], t_msh *msh);  #endif diff --git a/src/b_export.c b/src/b_export.c index 04a7bd0..f5d3360 100644 --- a/src/b_export.c +++ b/src/b_export.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include "b_env.h"  #include "b_export_next.h" @@ -101,10 +100,10 @@ static void	b_classic_export(char *ptr[], t_msh *msh)  	}  } -uint8_t		b_export(char *args[], t_msh *msh) +unsigned char		b_export(char *args[], t_msh *msh)  {  	char	**ptr; -	uint8_t	r; +	unsigned char	r;  	if (args[0] == NULL)  		return (b_env(NULL, msh)); diff --git a/src/b_export.h b/src/b_export.h index 2c2a708..b6dcea6 100644 --- a/src/b_export.h +++ b/src/b_export.h @@ -14,7 +14,6 @@  # define B_EXPORT_H  # include <libft.h> -# include <stdint.h>  # include "s_struct.h" @@ -23,6 +22,6 @@ t_bool	check_equals(const char *arg);  void	b_add_to_env_from_globals(const char varname[],  								const char var[],  								t_msh *msh); -uint8_t b_export(char *args[], t_msh *msh); +unsigned char b_export(char *args[], t_msh *msh);  #endif diff --git a/src/b_export_mute.c b/src/b_export_mute.c index 414db95..2b78d27 100644 --- a/src/b_export_mute.c +++ b/src/b_export_mute.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include "b_export.h"  #include "b_export_next.h" @@ -46,10 +45,10 @@ static void	b_classic_export_mute(char *ptr[], t_msh *msh)  	}  } -uint8_t		b_export_mute(char *args[], t_msh *msh) +unsigned char		b_export_mute(char *args[], t_msh *msh)  {  	char	**ptr; -	uint8_t	r; +	unsigned char	r;  	if (args[0] == NULL)  		return (0); diff --git a/src/b_export_mute.h b/src/b_export_mute.h index 6a4f56c..0a6472e 100644 --- a/src/b_export_mute.h +++ b/src/b_export_mute.h @@ -13,11 +13,10 @@  #ifndef B_EXPORT_MUTE_H  # define B_EXPORT_MUTE_H -# include <stdint.h>  # include "b_export.h"  # include "s_struct.h" -uint8_t	b_export_mute(char *args[], t_msh *msh); +unsigned char	b_export_mute(char *args[], t_msh *msh);  #endif diff --git a/src/b_export_next.c b/src/b_export_next.c index 3457f6d..a1cae4a 100644 --- a/src/b_export_next.c +++ b/src/b_export_next.c @@ -42,7 +42,7 @@ static char		**b_get_var(const char arg[], t_msh *msh)  	return (var);  } -static int64_t	b_is_it_in_env(const char varname[], t_msh *msh) +static long	b_is_it_in_env(const char varname[], t_msh *msh)  {  	char	**env_dup;  	size_t	i; @@ -90,7 +90,7 @@ void			b_export_with_equals(const char arg[], t_msh *msh)  {  	char	varval[4096];  	char	**var; -	int64_t	env_i; +	long	env_i;  	varval[0] = C_NUL;  	var = b_get_var(arg, msh); @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stddef.h>  #include <unistd.h> @@ -20,9 +19,9 @@  #include "s_struct.h"  #include "u_utils.h" -static uint64_t	b_get_total_hist(t_msh *msh) +static unsigned long	b_get_total_hist(t_msh *msh)  { -	uint64_t	total; +	unsigned long	total;  	char		*ptr;  	total = 0; @@ -46,12 +45,12 @@ static uint64_t	b_get_total_hist(t_msh *msh)  	return (total);  } -static uint32_t	b_print_prev_history(uint64_t asked, uint64_t total, t_msh *msh) +static unsigned int	b_print_prev_history(unsigned long asked, unsigned long total, t_msh *msh)  {  	char	*hist;  	char	*tok; -	int64_t	to_print; -	int64_t	i; +	long	to_print; +	long	i;  	to_print = total - asked;  	to_print = (to_print < 0) ? (0) : (to_print); @@ -73,12 +72,12 @@ static uint32_t	b_print_prev_history(uint64_t asked, uint64_t total, t_msh *msh)  	return (i);  } -static void		b_print_history(uint64_t asked, uint64_t total, t_msh *msh) +static void		b_print_history(unsigned long asked, unsigned long total, t_msh *msh)  {  	char	*hist;  	char	*tok; -	int64_t	to_print; -	int64_t	i; +	long	to_print; +	long	i;  	to_print = total - asked;  	to_print = (to_print < 0) ? (0) : (to_print); @@ -112,9 +111,9 @@ static t_bool	b_check_numeric(const char arg[])  	return (TRUE);  } -uint8_t			b_h(char *args[], t_msh *msh) +unsigned char			b_h(char *args[], t_msh *msh)  { -	const uint64_t	argc = u_builtins_get_argc((const char **)args); +	const unsigned long	argc = u_builtins_get_argc((const char **)args);  	if (argc > 1)  	{ @@ -13,10 +13,9 @@  #ifndef B_H_H  # define B_H_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	b_h(char *args[], t_msh *msh); +unsigned char	b_h(char *args[], t_msh *msh);  #endif diff --git a/src/b_pwd.c b/src/b_pwd.c index 11d9afa..73e52ab 100644 --- a/src/b_pwd.c +++ b/src/b_pwd.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include <errno.h> @@ -20,7 +19,7 @@  #include "u_vars.h"  #include "u_vars_next.h" -uint8_t	b_pwd(char *args[], t_msh *msh) +unsigned char	b_pwd(char *args[], t_msh *msh)  {  	char	*cwd; diff --git a/src/b_pwd.h b/src/b_pwd.h index 0f5603f..10cb864 100644 --- a/src/b_pwd.h +++ b/src/b_pwd.h @@ -13,10 +13,9 @@  #ifndef B_PWD_H  # define B_PWD_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	b_pwd(char *args[], t_msh *msh); +unsigned char	b_pwd(char *args[], t_msh *msh);  #endif diff --git a/src/b_sqb.c b/src/b_sqb.c index 4ffb001..1c24e7f 100644 --- a/src/b_sqb.c +++ b/src/b_sqb.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include "b_sqb_err.h" @@ -22,9 +21,9 @@  #include "s_struct.h"  #include "u_utils.h" -static uint8_t	b_get_sqb_id(char *argv[], t_msh *msh) +static unsigned char	b_get_sqb_id(char *argv[], t_msh *msh)  { -	uint8_t	i; +	unsigned char	i;  	i = 0;  	while (i < B_ID_SQB_COUNT) @@ -44,10 +43,10 @@ static uint8_t	b_get_sqb_id(char *argv[], t_msh *msh)  	return (i);  } -static uint8_t	b_eval_sqb(char *argv[], t_msh *msh) +static unsigned char	b_eval_sqb(char *argv[], t_msh *msh)  { -	uint8_t	id; -	uint8_t	ret; +	unsigned char	id; +	unsigned char	ret;  	id = b_get_sqb_id(argv, msh);  	if (id == B_ID_SQB_COUNT) @@ -70,9 +69,9 @@ static uint8_t	b_eval_sqb(char *argv[], t_msh *msh)  	return (ret);  } -uint8_t			b_sqb(char *args[], t_msh *msh) +unsigned char			b_sqb(char *args[], t_msh *msh)  { -	const uint64_t	argc = u_builtins_get_argc((const char**)args); +	const unsigned long	argc = u_builtins_get_argc((const char**)args);  	if (ft_strncmp(args[argc - 1], "]", 2) != 0)  	{ diff --git a/src/b_sqb.h b/src/b_sqb.h index 2f2a972..51449ea 100644 --- a/src/b_sqb.h +++ b/src/b_sqb.h @@ -13,10 +13,9 @@  #ifndef FT_B_SQB_H  # define FT_B_SQB_H -# include <stdint.h>  # include "s_struct.h" -uint8_t b_sqb(char *args[], t_msh *msh); +unsigned char b_sqb(char *args[], t_msh *msh);  #endif diff --git a/src/b_sqb_err.c b/src/b_sqb_err.c index d530de5..697bca8 100644 --- a/src/b_sqb_err.c +++ b/src/b_sqb_err.c @@ -11,13 +11,12 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include "d_define.h"  #include "u_utils.h" -static uint8_t	b_single_op(const uint64_t argc, char *argv[]) +static unsigned char	b_single_op(const unsigned long argc, char *argv[])  {  	if (argc > 3)  	{ @@ -27,7 +26,7 @@ static uint8_t	b_single_op(const uint64_t argc, char *argv[])  	return (0);  } -static uint8_t	b_expect_arg(const uint64_t argc, char *argv[]) +static unsigned char	b_expect_arg(const unsigned long argc, char *argv[])  {  	if (argc == 3)  	{ @@ -37,7 +36,7 @@ static uint8_t	b_expect_arg(const uint64_t argc, char *argv[])  	return (0);  } -static uint8_t	b_double_op(const uint64_t argc, char *argv[]) +static unsigned char	b_double_op(const unsigned long argc, char *argv[])  {  	if (argc > 4)  	{ @@ -47,7 +46,7 @@ static uint8_t	b_double_op(const uint64_t argc, char *argv[])  	return (0);  } -static uint8_t	b_bad_nbr(char *argv[]) +static unsigned char	b_bad_nbr(char *argv[])  {  	char	*ptr; @@ -76,9 +75,9 @@ static uint8_t	b_bad_nbr(char *argv[])  	return (0);  } -uint8_t			b_sqb_err_check(uint8_t id, char *argv[]) +unsigned char			b_sqb_err_check(unsigned char id, char *argv[])  { -	const uint64_t	argc = u_builtins_get_argc((const char**)argv); +	const unsigned long	argc = u_builtins_get_argc((const char**)argv);  	if (id >= B_ID_SQB_NT)  	{ diff --git a/src/b_sqb_err.h b/src/b_sqb_err.h index f8fca45..9e9f72b 100644 --- a/src/b_sqb_err.h +++ b/src/b_sqb_err.h @@ -13,8 +13,7 @@  #ifndef B_SQB_ERR_H  # define B_SQB_ERR_H -# include <stdint.h> -uint8_t	b_sqb_err_check(uint8_t id, char *argv[]); +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 a853b81..836aa01 100644 --- a/src/b_sqb_file.c +++ b/src/b_sqb_file.c @@ -13,13 +13,12 @@  #include <sys/types.h>  #include <sys/stat.h>  #include <libft.h> -#include <stdint.h>  #include <fcntl.h>  #include <unistd.h>  #include "d_define.h" -static t_bool	b_file_tests(uint8_t 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); @@ -47,7 +46,7 @@ static t_bool	b_file_tests(uint8_t id, const char path[], struct stat sb)  	return (FALSE);  } -uint8_t			b_sqb_file_tests(uint8_t id, char *argv[]) +unsigned char			b_sqb_file_tests(unsigned char id, char *argv[])  {  	struct stat	sb; @@ -64,7 +63,7 @@ uint8_t			b_sqb_file_tests(uint8_t id, char *argv[])  	return (1);  } -static t_bool	b_sqb_file_comp_tests(uint8_t id, +static t_bool	b_sqb_file_comp_tests(unsigned char id,  									struct stat sb1,  									struct stat sb2)  { @@ -77,7 +76,7 @@ static t_bool	b_sqb_file_comp_tests(uint8_t id,  	return (FALSE);  } -uint8_t			b_sqb_double_file_tests(uint8_t 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 ebdc5e3..6116b75 100644 --- a/src/b_sqb_file.h +++ b/src/b_sqb_file.h @@ -13,9 +13,8 @@  #ifndef B_SQB_FILE_H  # define B_SQB_FILE_H -# include <stdint.h> -uint8_t	b_sqb_file_tests(uint8_t id, char *argv[]); -uint8_t	b_sqb_double_file_tests(uint8_t id, char *argv[]); +unsigned char	b_sqb_file_tests(unsigned char id, char *argv[]); +unsigned char	b_sqb_double_file_tests(unsigned char id, char *argv[]);  #endif diff --git a/src/b_sqb_nbr.c b/src/b_sqb_nbr.c index 0f96e82..0e2ab73 100644 --- a/src/b_sqb_nbr.c +++ b/src/b_sqb_nbr.c @@ -11,11 +11,10 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include "d_define.h" -static t_bool	b_sqb_nbr_tests(uint8_t id, int32_t n1, int32_t n2) +static t_bool	b_sqb_nbr_tests(unsigned char id, int n1, int n2)  {  	if (id == B_ID_SQB_EQ && n1 == n2)  		return (TRUE); @@ -32,7 +31,7 @@ static t_bool	b_sqb_nbr_tests(uint8_t id, int32_t n1, int32_t n2)  	return (FALSE);  } -uint8_t			b_sqb_nbr(uint8_t 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 d5946e3..7448354 100644 --- a/src/b_sqb_nbr.h +++ b/src/b_sqb_nbr.h @@ -13,8 +13,7 @@  #ifndef B_SQB_NBR_H  # define B_SQB_NBR_H -# include <stdint.h> -uint8_t	b_sqb_nbr(uint8_t id, char *argv[]); +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 fa4381a..51fdd8d 100644 --- a/src/b_sqb_str.c +++ b/src/b_sqb_str.c @@ -11,11 +11,10 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include "d_define.h" -static t_bool	b_sqb_str_comp(uint8_t 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) @@ -26,7 +25,7 @@ static t_bool	b_sqb_str_comp(uint8_t id, const char s1[], const char s2[])  	return (FALSE);  } -uint8_t			b_sqb_str(uint8_t 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 59a1019..b20e36d 100644 --- a/src/b_sqb_str.h +++ b/src/b_sqb_str.h @@ -13,8 +13,7 @@  #ifndef B_SQB_STR_H  # define B_SQB_STR_H -# include <stdint.h> -uint8_t	b_sqb_str(uint8_t id, char *argv[]); +unsigned char	b_sqb_str(unsigned char id, char *argv[]);  #endif diff --git a/src/b_type.c b/src/b_type.c index d01a0b4..4cca44c 100644 --- a/src/b_type.c +++ b/src/b_type.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <dirent.h>  #include <fcntl.h>  #include <unistd.h> @@ -28,9 +27,9 @@  #include "u_path.h"  #include "u_utils.h" -static int8_t	b_absolute_path_exists(char com[]) +static char	b_absolute_path_exists(char com[])  { -	int32_t	fd; +	int	fd;  	DIR		*dir;  	if ((dir = opendir(com)) != NULL) @@ -60,7 +59,7 @@ static void		b_type_get_path(char fullpath[], char com[], t_msh *msh)  	u_search_in_path(fullpath, com, PATH_MAX, msh);  } -static uint8_t	b_check_nonbuilt(char *ptr, uint8_t ret, t_msh *msh) +static unsigned char	b_check_nonbuilt(char *ptr, unsigned char ret, t_msh *msh)  {  	char	fullpath[PATH_MAX]; @@ -76,7 +75,7 @@ static uint8_t	b_check_nonbuilt(char *ptr, uint8_t ret, t_msh *msh)  	return (ret);  } -static uint8_t	b_check_builtins(char *ptr) +static unsigned char	b_check_builtins(char *ptr)  {  	char	tmp[M_BUILTINS_REF_LEN];  	char	*tok_bu; @@ -96,11 +95,11 @@ static uint8_t	b_check_builtins(char *ptr)  	return (1);  } -uint8_t			b_type(char *args[], t_msh *msh) +unsigned char			b_type(char *args[], t_msh *msh)  {  	t_lalias	*p_alias;  	char		**ptr; -	int32_t		ret; +	int		ret;  	ptr = args;  	if (*ptr == NULL) diff --git a/src/b_type.h b/src/b_type.h index e27d836..ae3b96f 100644 --- a/src/b_type.h +++ b/src/b_type.h @@ -13,10 +13,9 @@  #ifndef B_TYPE_H  # define B_TYPE_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	b_type(char *args[], t_msh *msh); +unsigned char	b_type(char *args[], t_msh *msh);  #endif diff --git a/src/b_unset.c b/src/b_unset.c index 7e32540..d4e0f31 100644 --- a/src/b_unset.c +++ b/src/b_unset.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include "f_fail.h" @@ -94,10 +93,10 @@ static t_bool	b_removed_from_env(const char arg[], t_msh *msh)  	return (FALSE);  } -uint8_t			b_unset(char *args[], t_msh *msh) +unsigned char			b_unset(char *args[], t_msh *msh)  {  	char	**ptr; -	int8_t	r; +	char	r;  	if (args[0] == NULL)  		return (0); diff --git a/src/b_unset.h b/src/b_unset.h index 6be5cf8..c7865a6 100644 --- a/src/b_unset.h +++ b/src/b_unset.h @@ -13,10 +13,9 @@  #ifndef B_UNSET_H  # define B_UNSET_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	b_unset(char *args[], t_msh *msh); +unsigned char	b_unset(char *args[], t_msh *msh);  #endif diff --git a/src/e_builtins.c b/src/e_builtins.c index d08cf63..2ecac83 100644 --- a/src/e_builtins.c +++ b/src/e_builtins.c @@ -13,7 +13,6 @@  #include <sys/wait.h>  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include <unistd.h>  #include "b_builtins.h" @@ -39,9 +38,9 @@ static void	e_export_env_fork(const t_com *ptr, t_msh *msh)  	}  } -static void	e_builtin_child(const t_com *ptr, uint8_t bu_id, t_msh *msh) +static void	e_builtin_child(const t_com *ptr, unsigned char bu_id, t_msh *msh)  { -	int32_t	ret; +	int	ret;  	if (ptr->env_fork != NULL)  		e_export_env_fork(ptr, msh); @@ -60,11 +59,11 @@ static void	e_builtin_child(const t_com *ptr, uint8_t bu_id, t_msh *msh)  static void	e_builtin_parent(pid_t pid,  							const t_com *ptr, -							uint8_t bu_id, +							unsigned char bu_id,  							t_msh *msh)  { -	int32_t	status; -	int32_t	ret; +	int	status; +	int	ret;  	while (wait(&status) != pid)  		; @@ -93,7 +92,7 @@ static void	e_builtin_parent(pid_t pid,  ** TODO: handle fork() failed  */ -void		e_builtin(const t_com *ptr, uint8_t bu_id, t_msh *msh) +void		e_builtin(const t_com *ptr, unsigned char bu_id, t_msh *msh)  {  	pid_t	pid; diff --git a/src/e_builtins.h b/src/e_builtins.h index be73661..3549e54 100644 --- a/src/e_builtins.h +++ b/src/e_builtins.h @@ -13,10 +13,9 @@  #ifndef E_BUILTINS_H  # define E_BUILTINS_H -# include <stdint.h>  # include "s_struct.h" -void	e_builtin(const t_com *ptr, uint8_t bu_id, t_msh *msh); +void	e_builtin(const t_com *ptr, unsigned char bu_id, t_msh *msh);  #endif diff --git a/src/e_externs.c b/src/e_externs.c index 0490e82..a27e4ca 100644 --- a/src/e_externs.c +++ b/src/e_externs.c @@ -12,7 +12,6 @@  #include <sys/wait.h>  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include <string.h>  #include <fcntl.h> @@ -39,7 +38,7 @@  static void	e_extern_child(const char fullpath[], t_com *ptr, t_msh *msh)  {  	char	buff[7]; -	int32_t	fd; +	int	fd;  	if ((fd = open(fullpath, O_RDONLY)) != -1)  	{ @@ -92,11 +91,11 @@ static void	e_fullpath_not_found(t_com *ptr, t_msh *msh)  static void	e_exec_path(const char fullpath[],  						t_com *ptr, -						uint8_t fp_ret, +						unsigned char fp_ret,  						t_msh *msh)  {  	pid_t	pid; -	int32_t	status; +	int	status;  	if ((pid = fork()) == 0)  	{ @@ -121,7 +120,7 @@ static void	e_exec_path(const char fullpath[],  void		e_extern(t_com *ptr, t_msh *msh)  {  	char	fullpath[PATH_MAX]; -	uint8_t	fp_ret; +	unsigned char	fp_ret;  	fullpath[0] = C_NUL;  	if (ptr->bin != NULL && (ft_ischarset("./", ptr->bin[0]) == TRUE diff --git a/src/e_line.c b/src/e_line.c index 726c3f3..3a072c4 100644 --- a/src/e_line.c +++ b/src/e_line.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include "e_builtins.h" @@ -24,7 +23,7 @@  void	e_line_block(t_msh *msh)  { -	uint8_t	bu_id; +	unsigned char	bu_id;  	if (msh->pipes != NULL)  		e_pipes(msh); diff --git a/src/e_line.h b/src/e_line.h index e3e1e8f..8dc8a83 100644 --- a/src/e_line.h +++ b/src/e_line.h @@ -13,7 +13,6 @@  #ifndef E_LINE_H  # define E_LINE_H -# include <stdint.h>  # include "s_struct.h" diff --git a/src/e_pipes.c b/src/e_pipes.c index 9ab08ba..4ad9e46 100644 --- a/src/e_pipes.c +++ b/src/e_pipes.c @@ -13,7 +13,6 @@  #include <sys/wait.h>  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #ifdef __linux__  # include <linux/limits.h>  #else @@ -29,11 +28,11 @@  #include "u_utils.h"  #include "u_path.h" -static uint8_t	e_get_current_path(char fullpath[], +static unsigned char	e_get_current_path(char fullpath[],  									struct s_lpipes *ptr,  									t_msh *msh)  { -	uint8_t	fp_ret; +	unsigned char	fp_ret;  	fp_ret = 0;  	if (ptr->com->bin != NULL && ft_ischarset("/.", ptr->com->bin[0]) == TRUE) @@ -58,15 +57,15 @@ static uint8_t	e_get_current_path(char fullpath[],  ** TODO: handle fork() failed, etc  */ -static int32_t	e_unroll_pipes(int32_t fd[256][2], +static int	e_unroll_pipes(int fd[256][2],  							size_t pipes,  							t_msh *msh)  {  	struct s_lpipes	*head;  	char			fullpath[PATH_MAX]; -	int32_t			pid; -	uint16_t		i; -	uint8_t			fp_ret; +	int			pid; +	unsigned short		i; +	unsigned char			fp_ret;  	head = msh->pipes;  	i = 0; @@ -94,10 +93,10 @@ static int32_t	e_unroll_pipes(int32_t fd[256][2],  static void		e_pipe_exec(size_t pipes, t_msh *msh)  { -	int32_t		fd[256][2]; -	int32_t		pid; -	int32_t		status; -	uint16_t	i; +	int		fd[256][2]; +	int		pid; +	int		status; +	unsigned short	i;  	i = 0;  	while (i < pipes && i < 255) diff --git a/src/e_pipes_next.c b/src/e_pipes_next.c index 250439f..6cca414 100644 --- a/src/e_pipes_next.c +++ b/src/e_pipes_next.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include <fcntl.h>  #include <unistd.h>  #include <errno.h> @@ -42,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]; -	int32_t	fd; +	int	fd;  	if ((fd = open(fullpath, O_RDONLY)) != -1)  	{ @@ -69,12 +68,12 @@ static void	e_exec_child(const char fullpath[], t_com *ptr, t_msh *msh)  }  void		e_pipe_child(char fullpath[], -						uint8_t fp_ret, +						unsigned char fp_ret,  						t_com *ptr,  						t_msh *msh)  { -	uint8_t	bu_id; -	uint8_t	ret; +	unsigned char	bu_id; +	unsigned char	ret;  	e_dup_redirs(ptr, msh);  	if (ft_strncmp(fullpath, "builtin", 8) == 0) @@ -111,7 +110,7 @@ size_t		e_get_pipes_count(struct s_lpipes *ptr)  	return (pipes);  } -void		e_close_unused_fds(int32_t fd[256][2], size_t pipes) +void		e_close_unused_fds(int fd[256][2], size_t pipes)  {  	size_t	i; diff --git a/src/e_pipes_next.h b/src/e_pipes_next.h index 13bf6df..f112313 100644 --- a/src/e_pipes_next.h +++ b/src/e_pipes_next.h @@ -14,12 +14,11 @@  # define E_PIPES_NEXT_H  # include <stddef.h> -# include <stdint.h>  # include "s_struct.h" -void	e_pipe_child(char fullpath[], uint8_t 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(int32_t fd[256][2], size_t pipes); +void	e_close_unused_fds(int fd[256][2], size_t pipes);  #endif diff --git a/src/e_redirs.c b/src/e_redirs.c index f559ca1..ddfdb53 100644 --- a/src/e_redirs.c +++ b/src/e_redirs.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stddef.h>  #include <fcntl.h>  #include <unistd.h> @@ -23,7 +22,7 @@  static void	e_redir_minus_two(struct s_lredir *ptr)  { -	int32_t	fd[2]; +	int	fd[2];  	if (ptr->heredoc == NULL)  	{ @@ -38,7 +37,7 @@ static void	e_redir_minus_two(struct s_lredir *ptr)  static void	e_redir_minus_one(struct s_lredir *ptr, t_msh *msh)  { -	int32_t	fd; +	int	fd;  	if ((fd = open(ptr->path, O_RDONLY)) == -1)  	{ @@ -51,7 +50,7 @@ static void	e_redir_minus_one(struct s_lredir *ptr, t_msh *msh)  static void	e_redir_plus_one(struct s_lredir *ptr, t_msh *msh)  { -	int32_t	fd; +	int	fd;  	if ((fd = open(ptr->path, O_CREAT | O_TRUNC | O_WRONLY, 0644)) == -1)  	{ @@ -64,7 +63,7 @@ static void	e_redir_plus_one(struct s_lredir *ptr, t_msh *msh)  static void	e_redir_plus_two(struct s_lredir *ptr, t_msh *msh)  { -	int32_t	fd; +	int	fd;  	if ((fd = open(ptr->path, O_CREAT | O_APPEND | O_WRONLY, 0644)) == -1)  	{ diff --git a/src/f_shlvl.c b/src/f_shlvl.c index 986c1fe..58fedb0 100644 --- a/src/f_shlvl.c +++ b/src/f_shlvl.c @@ -11,9 +11,8 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h> -void	f_shlvl_too_high(int32_t shlvl) +void	f_shlvl_too_high(int shlvl)  {  	ft_dprintf(2,  		"minishell: warning: shell level (%d) too high, resetting to 1\n", diff --git a/src/f_shlvl.h b/src/f_shlvl.h index 8d0fcf9..3b6418f 100644 --- a/src/f_shlvl.h +++ b/src/f_shlvl.h @@ -13,8 +13,7 @@  #ifndef F_SHLVL_H  # define F_SHLVL_H -# include <stdint.h> -void	f_shlvl_too_high(int32_t shlvl); +void	f_shlvl_too_high(int shlvl);  #endif diff --git a/src/m_argv.c b/src/m_argv.c index d29ac5d..90ddd27 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -13,7 +13,6 @@  #include <sys/stat.h>  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include <fcntl.h>  #include <unistd.h> @@ -31,7 +30,7 @@ static char	*m_get_prev_hist(t_msh *msh)  	struct stat	sb;  	char		*hist;  	char		histfile[PATH_MAX]; -	int32_t		fd; +	int		fd;  	hist = NULL;  	u_get_var_value(histfile, "$HISTFILE", PATH_MAX, msh); @@ -51,7 +50,7 @@ static char	*m_get_prev_hist(t_msh *msh)  static void	m_read_script(char *const argv[], t_msh *msh)  { -	int32_t	fd; +	int	fd;  	if ((fd = open(*(argv + 1), O_RDONLY)) == -1)  		f_open_file(*(argv + 1), msh); @@ -62,7 +61,7 @@ static void	m_read_script(char *const argv[], t_msh *msh)  	close(fd);  } -uint8_t		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 3e8deda..7664306 100644 --- a/src/m_argv.h +++ b/src/m_argv.h @@ -13,10 +13,9 @@  #ifndef M_ARGV_H  # define M_ARGV_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	m_argv(int argc, char *const argv[], t_msh *msh); +unsigned char	m_argv(int argc, char *const argv[], t_msh *msh);  #endif diff --git a/src/m_comm.c b/src/m_comm.c index 7dc574d..36f90ac 100644 --- a/src/m_comm.c +++ b/src/m_comm.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include "d_enum.h"  #include "e_line.h" @@ -19,7 +18,7 @@  #include "p_line.h"  #include "s_line.h" -uint8_t	m_comm(const char line[], t_msh *msh) +unsigned char	m_comm(const char line[], t_msh *msh)  {  	if (line[0] != '\0')  	{ diff --git a/src/m_comm.h b/src/m_comm.h index aedb5a3..600f8e8 100644 --- a/src/m_comm.h +++ b/src/m_comm.h @@ -13,10 +13,9 @@  #ifndef M_COMM_H  # define M_COMM_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	m_comm(const char line[], t_msh *msh); +unsigned char	m_comm(const char line[], t_msh *msh);  #endif diff --git a/src/m_loop.c b/src/m_loop.c index 732c005..d8ea680 100644 --- a/src/m_loop.c +++ b/src/m_loop.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include <fcntl.h>  #include <unistd.h> @@ -34,7 +33,7 @@  #include "u_parse.h"  #include "u_vars.h" -static void	m_parse_and_run_line(char line[], uint8_t previf, t_msh *msh) +static void	m_parse_and_run_line(char line[], unsigned char previf, t_msh *msh)  {  	t_line_block	*ptr; @@ -66,7 +65,7 @@ static void	m_parse_and_run_line(char line[], uint8_t previf, t_msh *msh)  void		m_dump_hist(char hist[], t_msh *msh)  {  	char	histfile[PATH_MAX]; -	int32_t	fd; +	int	fd;  	if (hist[0] != C_NUL && ft_strlen(hist) > 0)  	{ @@ -85,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 uint16_t	hist_i = 0; +	static unsigned short	hist_i = 0;  	if (hist_i == 0)  		hist[0] = '\0'; @@ -126,11 +125,11 @@ static void	m_delete_comments(char line[])  	}  } -uint8_t		m_loop(int32_t fd, t_msh *msh) +unsigned char		m_loop(int fd, t_msh *msh)  {  	static char	hist[255 * 4096];  	char		*line; -	int8_t		gnl; +	char		gnl;  	gnl = 1;  	msh->curr_hist_ptr = hist; diff --git a/src/m_loop.h b/src/m_loop.h index a8bc871..d494742 100644 --- a/src/m_loop.h +++ b/src/m_loop.h @@ -13,11 +13,10 @@  #ifndef M_LOOP_H  # define M_LOOP_H -# include <stdint.h>  # include "s_struct.h"  void	m_dump_hist(char hist[], t_msh *msh); -uint8_t	m_loop(int32_t fd, 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 55a3b27..49deb52 100644 --- a/src/m_loop_counter.c +++ b/src/m_loop_counter.c @@ -11,13 +11,12 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include "m_prompt.h"  #include "s_struct.h" -char	*m_counter_line_backslash(int32_t fd, uint8_t psx, char *l, t_msh *msh) +char	*m_counter_line_backslash(int fd, unsigned char psx, char *l, t_msh *msh)  {  	char	*counter_line; @@ -37,7 +36,7 @@ char	*m_counter_line_backslash(int32_t fd, uint8_t psx, char *l, t_msh *msh)  	return (l);  } -char	*m_counter_line_pipes(int32_t fd, uint8_t psx, char *line, t_msh *msh) +char	*m_counter_line_pipes(int fd, unsigned char psx, char *line, t_msh *msh)  {  	char	*counter_line; @@ -57,7 +56,7 @@ char	*m_counter_line_pipes(int32_t fd, uint8_t psx, char *line, t_msh *msh)  	return (line);  } -char	*m_counter_line_quotes(int32_t fd, uint8_t 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 3762c2f..eb4d4e5 100644 --- a/src/m_loop_counter.h +++ b/src/m_loop_counter.h @@ -13,12 +13,11 @@  #ifndef M_LOOP_COUNTER_H  # define M_LOOP_COUNTER_H -# include <stdint.h>  # include "s_struct.h" -char	*m_counter_line_backslash(int32_t fd, uint8_t psx, char *l, t_msh *msh); -char	*m_counter_line_pipes(int32_t fd, uint8_t psx, char *line, t_msh *msh); -char	*m_counter_line_quotes(int32_t fd, uint8_t 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.c b/src/m_loop_multis.c index 83a9930..8fc9e7d 100644 --- a/src/m_loop_multis.c +++ b/src/m_loop_multis.c @@ -83,7 +83,7 @@ static t_bool	m_check_missing_quotes(char line[])  	return (FALSE);  } -char			*m_check_multi_quotes(int32_t fd, char line[], t_msh *msh) +char			*m_check_multi_quotes(int fd, char line[], t_msh *msh)  {  	t_bool	reparse; @@ -100,7 +100,7 @@ char			*m_check_multi_quotes(int32_t fd, char line[], t_msh *msh)  	return (line);  } -char			*m_check_multis(int32_t fd, char line[], t_msh *msh) +char			*m_check_multis(int fd, char line[], t_msh *msh)  {  	line = m_check_multi_backslash(fd, line, msh);  	line = m_check_multi_pipe(fd, line, msh); diff --git a/src/m_loop_multis.h b/src/m_loop_multis.h index 237f698..bdb6273 100644 --- a/src/m_loop_multis.h +++ b/src/m_loop_multis.h @@ -13,11 +13,10 @@  #ifndef M_LOOP_MULTIS_H  # define M_LOOP_MULTIS_H -# include <stdint.h>  # include "s_struct.h" -char	*m_check_multi_quotes(int32_t fd, char line[], t_msh *msh); -char	*m_check_multis(int32_t fd, char line[], t_msh *msh); +char	*m_check_multi_quotes(int fd, char line[], t_msh *msh); +char	*m_check_multis(int fd, char line[], t_msh *msh);  #endif diff --git a/src/m_loop_next.c b/src/m_loop_next.c index a31e850..e29b6dd 100644 --- a/src/m_loop_next.c +++ b/src/m_loop_next.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include "d_define.h" @@ -20,7 +19,7 @@  #include "s_struct.h"  #include "u_utils.h" -char	*m_check_multi_backslash(int32_t fd, char line[], t_msh *msh) +char	*m_check_multi_backslash(int fd, char line[], t_msh *msh)  {  	if (line[ft_strlen(line) - 1] == '\\')  	{ @@ -30,7 +29,7 @@ char	*m_check_multi_backslash(int32_t fd, char line[], t_msh *msh)  	return (line);  } -char	*m_check_multi_pipe(int32_t fd, char line[], t_msh *msh) +char	*m_check_multi_pipe(int fd, char line[], t_msh *msh)  {  	char	*pipe; @@ -52,7 +51,7 @@ char	*m_check_multi_pipe(int32_t fd, char line[], t_msh *msh)  	return (line);  } -char	*m_check_multi_and(int32_t fd, char line[], t_msh *msh) +char	*m_check_multi_and(int fd, char line[], t_msh *msh)  {  	char	*and; diff --git a/src/m_loop_next.h b/src/m_loop_next.h index 4c3e48a..b130627 100644 --- a/src/m_loop_next.h +++ b/src/m_loop_next.h @@ -13,12 +13,11 @@  #ifndef M_LOOP_NEXT_H  # define M_LOOP_NEXT_H -# include <stdint.h>  # include "s_struct.h" -char	*m_check_multi_backslash(int32_t fd, char line[], t_msh *msh); -char	*m_check_multi_pipe(int32_t fd, char line[], t_msh *msh); -char	*m_check_multi_and(int32_t fd, char line[], t_msh *msh); +char	*m_check_multi_backslash(int fd, char line[], t_msh *msh); +char	*m_check_multi_pipe(int fd, char line[], t_msh *msh); +char	*m_check_multi_and(int fd, char line[], t_msh *msh);  #endif diff --git a/src/m_minishell.c b/src/m_minishell.c index e9475b3..6227e3d 100644 --- a/src/m_minishell.c +++ b/src/m_minishell.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include <string.h>  #include <unistd.h> @@ -25,7 +24,7 @@  int	main(int argc, char *const argv[], char *const envp[])  { -	int32_t	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 424e17b..a78ea95 100644 --- a/src/m_mshrc.c +++ b/src/m_mshrc.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include <fcntl.h>  #include <unistd.h> @@ -26,12 +25,12 @@  #include "m_loop.h"  #include "u_vars.h" -uint8_t	m_source_mshrc(t_msh *msh) +unsigned char	m_source_mshrc(t_msh *msh)  {  	char	file[PATH_MAX];  	char	home[PATH_MAX]; -	int32_t	fd; -	uint8_t	ret; +	int	fd; +	unsigned char	ret;  	file[0] = C_NUL;  	u_get_var_value(home, "$HOME", PATH_MAX, msh); diff --git a/src/m_mshrc.h b/src/m_mshrc.h index 8adbd38..910e276 100644 --- a/src/m_mshrc.h +++ b/src/m_mshrc.h @@ -13,10 +13,9 @@  #ifndef M_MSHRC_H  # define M_MSHRC_H -# include <stdint.h>  # include "s_struct.h" -uint8_t	m_source_mshrc(t_msh *msh); +unsigned char	m_source_mshrc(t_msh *msh);  #endif diff --git a/src/m_prompt.c b/src/m_prompt.c index 4f80627..e36a07e 100644 --- a/src/m_prompt.c +++ b/src/m_prompt.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stddef.h> -#include <stdint.h>  #include <unistd.h>  #ifdef __linux__  # include <linux/limits.h> @@ -44,12 +43,12 @@ static void	m_subst_prompt_rice(char var[], t_msh *msh)  	}  } -static void	m_update_psx(uint8_t x, t_msh *msh) +static void	m_update_psx(unsigned char x, t_msh *msh)  {  	char	var[ARG_MAX];  	char	psx[5]; -	ft_sprintf(psx, "$PS%hu", (uint16_t)x); +	ft_sprintf(psx, "$PS%hu", (unsigned short)x);  	u_get_var_value(var, psx, ARG_MAX, msh);  	if (var[0] == C_NUL)  	{ @@ -60,7 +59,7 @@ static void	m_update_psx(uint8_t x, t_msh *msh)  	ft_strlcpy(msh->ps[x - 1], var, 255);  } -void		m_prompt_psx(uint8_t x, t_msh *msh) +void		m_prompt_psx(unsigned char x, t_msh *msh)  {  	m_update_psx(x, msh);  	ft_dprintf(STDERR_FILENO, "%s", msh->ps[x - 1]); diff --git a/src/m_prompt.h b/src/m_prompt.h index 585d81f..c22da29 100644 --- a/src/m_prompt.h +++ b/src/m_prompt.h @@ -13,10 +13,9 @@  #ifndef M_PROMPT_H  # define M_PROMPT_H -# include <stdint.h>  # include "s_struct.h" -void	m_prompt_psx(uint8_t x, t_msh *msh); +void	m_prompt_psx(unsigned char x, t_msh *msh);  #endif diff --git a/src/m_prompt_seq.c b/src/m_prompt_seq.c index 2a77371..398b141 100644 --- a/src/m_prompt_seq.c +++ b/src/m_prompt_seq.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stddef.h> -#include <stdint.h>  #include <unistd.h>  #ifdef __linux__  # include <linux/limits.h> diff --git a/src/p_args.c b/src/p_args.c index d005947..f50d52b 100644 --- a/src/p_args.c +++ b/src/p_args.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include "d_define.h" @@ -53,9 +52,9 @@ static char		*p_skip_whitespace(char *ptr)  ** TODO: quotes parse error  */ -static uint16_t	p_count_args(const char word[], +static unsigned short	p_count_args(const char word[],  							size_t start[], -							uint16_t count, +							unsigned short count,  							t_quote_mode mode)  {  	char			*ptr; @@ -88,8 +87,8 @@ char			**p_split_args(char word[])  {  	size_t		start[512];  	char		**words; -	uint16_t	argc; -	uint16_t	to_del; +	unsigned short	argc; +	unsigned short	to_del;  	words = NULL;  	argc = p_count_args(word, start, 1, Q_NONE); diff --git a/src/p_args.h b/src/p_args.h index 2403fea..a7db861 100644 --- a/src/p_args.h +++ b/src/p_args.h @@ -13,7 +13,6 @@  #ifndef P_ARGS_H  # define P_ARGS_H -# include <stdint.h>  char	**p_split_args(char word[]); diff --git a/src/p_args_next.c b/src/p_args_next.c index 1528883..83319be 100644 --- a/src/p_args_next.c +++ b/src/p_args_next.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #ifdef __linux__  # include <linux/limits.h>  #else @@ -24,7 +23,7 @@  static char	*p_give_me_an_arg(char tmp[],  							const char word[], -							const uint16_t i, +							const unsigned short i,  							const size_t start[])  {  	tmp[0] = '\0'; @@ -34,9 +33,9 @@ static char	*p_give_me_an_arg(char tmp[],  	return (tmp);  } -void		p_del_alloced_words(char *words[], uint16_t to_del) +void		p_del_alloced_words(char *words[], unsigned short to_del)  { -	uint16_t	i; +	unsigned short	i;  	i = 0;  	while (i < to_del) @@ -46,13 +45,13 @@ void		p_del_alloced_words(char *words[], uint16_t to_del)  	}  } -uint16_t	p_dup_words(char *words[], +unsigned short	p_dup_words(char *words[],  						const char word[], -						const uint16_t argc, +						const unsigned short argc,  						const size_t start[])  {  	char		tmp[ARG_MAX]; -	uint16_t	i; +	unsigned short	i;  	i = 0;  	while (i < argc) diff --git a/src/p_args_next.h b/src/p_args_next.h index f21dfd9..22d06a9 100644 --- a/src/p_args_next.h +++ b/src/p_args_next.h @@ -13,12 +13,11 @@  #ifndef P_ARGS_NEXT_H  # define P_ARGS_NEXT_H -# include <stdint.h> -uint16_t	p_dup_words(char *words[], +unsigned short	p_dup_words(char *words[],  						const char word[], -						const uint16_t argc, +						const unsigned short argc,  						const size_t start[]); -void		p_del_alloced_words(char *words[], uint16_t to_del); +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 e147a9f..f3b5b44 100644 --- a/src/p_lblock.c +++ b/src/p_lblock.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include <fcntl.h>  #include <unistd.h>  #include <errno.h> @@ -27,9 +26,9 @@  #include "u_parse.h"  #include "u_utils.h" -static uint8_t	p_get_nextif(char *words[], size_t i) +static unsigned char	p_get_nextif(char *words[], size_t i)  { -	uint8_t	nextif; +	unsigned char	nextif;  	nextif = 0;  	if (words[i][ft_strlen(words[i]) - 1] == '0') @@ -66,11 +65,11 @@ t_bool			p_find_good_pipe(const char word[])  	return (FALSE);  } -static int8_t	p_loop(char *words[], t_msh *msh) +static char	p_loop(char *words[], t_msh *msh)  {  	t_line_block	*link;  	size_t			i; -	uint8_t			nextif; +	unsigned char			nextif;  	i = 0;  	while (words[i] != NULL) @@ -84,7 +83,7 @@ static int8_t	p_loop(char *words[], t_msh *msh)  	return (0);  } -int8_t			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_lblock.h b/src/p_lblock.h index 9f92beb..2b777fa 100644 --- a/src/p_lblock.h +++ b/src/p_lblock.h @@ -14,11 +14,10 @@  # define P_LBLOCK_H  # include <libft.h> -# include <stdint.h>  # include "s_struct.h"  t_bool	p_find_good_pipe(const char word[]); -int8_t	p_line_block(const char line[], t_msh *msh); +char	p_line_block(const char line[], t_msh *msh);  #endif diff --git a/src/p_lblock_next.c b/src/p_lblock_next.c index 9708a09..bc8b54b 100644 --- a/src/p_lblock_next.c +++ b/src/p_lblock_next.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #ifdef __linux__  # include <linux/limits.h>  #else @@ -30,7 +29,7 @@  #include "u_vars.h"  #include "u_vars_next.h" -static char		**p_alloc_rewords(char *words[], int64_t j, t_msh *msh) +static char		**p_alloc_rewords(char *words[], long j, t_msh *msh)  {  	char	**rewords; @@ -44,12 +43,12 @@ static char		**p_alloc_rewords(char *words[], int64_t j, t_msh *msh)  static char		**p_add_to_variables_and_delete(char *words[],  												t_bool reg, -												int64_t i, +												long i,  												t_msh *msh)  {  	char	**rewords; -	int64_t	j; -	int64_t	k; +	long	j; +	long	k;  	j = -1;  	while (reg == TRUE && words[++j] != NULL && j < i) @@ -74,9 +73,9 @@ static char		**p_add_to_variables_and_delete(char *words[],  	return (rewords);  } -static void		p_add_to_env_fork(int64_t i, char *words[], t_msh *msh) +static void		p_add_to_env_fork(long i, char *words[], t_msh *msh)  { -	int64_t	j; +	long	j;  	j = 0;  	while (j < i) @@ -87,7 +86,7 @@ static void		p_add_to_env_fork(int64_t i, char *words[], t_msh *msh)  	msh->env_fork_tmp[j][0] = '\0';  } -static char		*p_set_ptr(char *words[], int64_t i, t_bool *reg, t_bool *isvar) +static char		*p_set_ptr(char *words[], long i, t_bool *reg, t_bool *isvar)  {  	char	*ptr; @@ -102,7 +101,7 @@ static char		*p_set_ptr(char *words[], int64_t i, t_bool *reg, t_bool *isvar)  char			**p_check_args_equals(char *words[], t_msh *msh)  {  	char	*ptr; -	int64_t	i; +	long	i;  	t_bool	reg;  	t_bool	isvar; diff --git a/src/p_lblock_next.h b/src/p_lblock_next.h index 650d2ab..8c0123d 100644 --- a/src/p_lblock_next.h +++ b/src/p_lblock_next.h @@ -14,7 +14,6 @@  # define P_LBLOCK_NEXT_H  # include <libft.h> -# include <stdint.h>  # include "s_struct.h" diff --git a/src/p_redirs.c b/src/p_redirs.c index c12201e..aee845b 100644 --- a/src/p_redirs.c +++ b/src/p_redirs.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stddef.h>  #include <unistd.h>  #ifdef __linux__ @@ -30,14 +29,14 @@  #include "u_parse.h"  #include "u_vars.h" -static uint8_t	p_append_redir(const char path[], -							int32_t fd_rdr[], +static unsigned char	p_append_redir(const char path[], +							int fd_rdr[],  							t_com *com,  							t_msh *msh)  {  	struct s_lredir	*new; -	int32_t			fd; -	int8_t			redir; +	int			fd; +	char			redir;  	fd = fd_rdr[FD];  	redir = fd_rdr[RDR]; @@ -85,7 +84,7 @@ static size_t	p_get_path(char path[],  	return (pos[1]);  } -static int32_t	p_get_fd(const char word[], char *ptr) +static int	p_get_fd(const char word[], char *ptr)  {  	char	digit[255];  	char	*tmp; @@ -110,12 +109,12 @@ static int32_t	p_get_fd(const char word[], char *ptr)  	return (ft_atoi(digit));  } -static uint8_t	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];  	size_t				pos[2]; -	int32_t				fd_rdr[2]; +	int				fd_rdr[2];  	pos[0] = 0;  	if ((fd_rdr[FD] = p_get_fd(word, ptr)) == -1) @@ -138,7 +137,7 @@ static uint8_t	p_get_redir(char word[], char *ptr, t_com *com, t_msh *msh)  	return (p_append_redir(path, fd_rdr, com, msh));  } -int8_t			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 2e0c996..6ca4230 100644 --- a/src/p_redirs.h +++ b/src/p_redirs.h @@ -13,7 +13,6 @@  #ifndef P_REDIRS_H  # define P_REDIRS_H -# include <stdint.h>  # include "s_struct.h" @@ -27,9 +26,9 @@ struct	s_rdr_tmp  {  	const char	*word;  	char		*ptr; -	int8_t		redir; +	char		redir;  }; -int8_t	p_redirs(char word[], t_com **com, t_msh *msh); +char	p_redirs(char word[], t_com **com, t_msh *msh);  #endif diff --git a/src/p_redirs_heredoc.c b/src/p_redirs_heredoc.c index 95aefa6..6f10dd4 100644 --- a/src/p_redirs_heredoc.c +++ b/src/p_redirs_heredoc.c @@ -11,14 +11,13 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <unistd.h>  #include "d_define.h"  #include "m_prompt.h"  #include "s_struct.h" -static void	p_skip_tabs(char *line[], const int8_t redir) +static void	p_skip_tabs(char *line[], const char redir)  {  	char	*ptr; @@ -41,11 +40,11 @@ static void	p_append_line(char *heredoc[], const char line[])  	ptr[ft_strlen(ptr)] = C_LF;  } -char		*p_get_heredoc(const char path[], const int8_t redir, t_msh *msh) +char		*p_get_heredoc(const char path[], const char redir, t_msh *msh)  {  	char	*heredoc;  	char	*line; -	int8_t	gnl; +	char	gnl;  	if ((heredoc = ft_strdup("")) == NULL)  		return (NULL); diff --git a/src/p_redirs_heredoc.h b/src/p_redirs_heredoc.h index 66d326a..2ab479d 100644 --- a/src/p_redirs_heredoc.h +++ b/src/p_redirs_heredoc.h @@ -13,10 +13,9 @@  #ifndef P_REDIRS_HEREDOC_H  # define P_REDIRS_HEREDOC_H -# include <stdint.h>  # include "s_struct.h" -char	*p_get_heredoc(const char path[], const int8_t redir, t_msh *msh); +char	*p_get_heredoc(const char path[], const char redir, t_msh *msh);  #endif diff --git a/src/p_split.c b/src/p_split.c index a8f4b5d..a1135ba 100644 --- a/src/p_split.c +++ b/src/p_split.c @@ -89,9 +89,9 @@ static void	*p_del_split(char *words[], size_t todel)  static char	**p_get_words(const char line[], const t_split_block *sp)  {  	char	**words; -	int64_t	i; +	long	i;  	size_t	oldpos; -	int8_t	oldif; +	char	oldif;  	if ((words = (char**)malloc((sp->count + 1) * sizeof(char*))) == NULL)  		return (NULL); diff --git a/src/p_split.h b/src/p_split.h index 710df74..94ff29f 100644 --- a/src/p_split.h +++ b/src/p_split.h @@ -14,7 +14,6 @@  # define P_SPLIT_H  # include <stddef.h> -# include <stdint.h>  # ifdef __linux__  #  include <linux/limits.h>  # else @@ -24,8 +23,8 @@  typedef struct	s_split_block  {  	size_t		pos[ARG_MAX / 2]; -	int8_t		nextif[ARG_MAX / 2]; -	uint32_t	count; +	char		nextif[ARG_MAX / 2]; +	unsigned int	count;  }				t_split_block;  char			**p_split_line(char line[]); diff --git a/src/p_subst_alias.c b/src/p_subst_alias.c index fb85b35..3ce1bbc 100644 --- a/src/p_subst_alias.c +++ b/src/p_subst_alias.c @@ -77,13 +77,13 @@ static size_t	p_subst_alias_return(struct s_subst_alias s,  									size_t used[],  									size_t i)  { -	int64_t	j; +	long	j;  	if ((s.usedcmp = u_get_alias_value(s.value, s.tmp, ARG_MAX, s.msh)) != 0)  	{  		s.good = TRUE;  		j = -1; -		while (++j < (int64_t)i) +		while (++j < (long)i)  			s.good = (used[j] == s.usedcmp) ? (FALSE) : (s.good);  		if (s.good == TRUE)  		{ diff --git a/src/p_subst_vars.c b/src/p_subst_vars.c index 47f250b..823970b 100644 --- a/src/p_subst_vars.c +++ b/src/p_subst_vars.c @@ -36,7 +36,7 @@ static char	*p_double_them_bs(char varval[])  	return (varval);  } -static void	p_subst_this_var(char **p, int64_t i, char word[], t_msh *msh) +static void	p_subst_this_var(char **p, long i, char word[], t_msh *msh)  {  	char	tmp[ARG_MAX];  	char	varval[ARG_MAX]; diff --git a/src/s_com.c b/src/s_com.c index 14dc4ef..2797847 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -30,10 +30,10 @@  #include "s_lredir.h"  #include "s_struct.h" -static int8_t	s_fill_com(char *words[], t_com **com) +static char	s_fill_com(char *words[], t_com **com)  { -	uint64_t	i; -	uint64_t	j; +	unsigned long	i; +	unsigned long	j;  	if (words[0] == NULL)  		return (0); diff --git a/src/s_init.c b/src/s_init.c index 41416e8..a572c32 100644 --- a/src/s_init.c +++ b/src/s_init.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include <unistd.h>  #ifdef __linux__ @@ -101,7 +100,7 @@ static void	s_null_some(t_msh *msh)  	msh->prev_hist = NULL;  } -t_msh		*s_init_msh(int32_t argc, char *const argv[], char *const envp[]) +t_msh		*s_init_msh(int argc, char *const argv[], char *const envp[])  {  	t_msh	*msh;  	char	cwd[PATH_MAX]; diff --git a/src/s_init.h b/src/s_init.h index 0acf60e..643c720 100644 --- a/src/s_init.h +++ b/src/s_init.h @@ -14,10 +14,9 @@  # define S_INIT_H  # include <stdlib.h> -# include <stdint.h>  # include "s_struct.h" -t_msh	*s_init_msh(int32_t argc, char *const argv[], char *const envp[]); +t_msh	*s_init_msh(int argc, char *const argv[], char *const envp[]);  #endif diff --git a/src/s_init_next.c b/src/s_init_next.c index 8731957..000ba0a 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]; -	int32_t	shlvl; +	int	shlvl;  	u_get_var_value(tmp, "$SHLVL", 255, msh);  	if (tmp[0] == C_NUL) @@ -52,7 +52,7 @@ void	s_inc_shlvl(t_msh *msh)  	}  } -char	**s_dupenv_del(char **nenvp, uint64_t i) +char	**s_dupenv_del(char **nenvp, unsigned long i)  {  	while (i > 0)  	{ @@ -65,7 +65,7 @@ char	**s_dupenv_del(char **nenvp, uint64_t i)  char	**s_dupenv(char *const envp[])  { -	uint64_t	i; +	unsigned long	i;  	char		**nenvp;  	i = 0; diff --git a/src/s_init_next.h b/src/s_init_next.h index cc99a06..dbb6cd4 100644 --- a/src/s_init_next.h +++ b/src/s_init_next.h @@ -16,7 +16,7 @@  # include "s_struct.h"  void	s_inc_shlvl(t_msh *msh); -char	**s_dupenv_del(char **nenvp, uint64_t i); +char	**s_dupenv_del(char **nenvp, unsigned long i);  char	**s_dupenv(char *const envp[]);  void	s_set_cwd(char cwd[], t_msh *msh); diff --git a/src/s_line.c b/src/s_line.c index 9d44eb6..ff74922 100644 --- a/src/s_line.c +++ b/src/s_line.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include "d_define.h"  #include "p_line.h" @@ -63,7 +62,7 @@ void			s_line_clear(t_line_block **line)  	*line = NULL;  } -t_line_block	*s_line_new(const char word[], uint8_t nextif) +t_line_block	*s_line_new(const char word[], unsigned char nextif)  {  	t_line_block	*link; diff --git a/src/s_line.h b/src/s_line.h index 7d510c4..0ee1773 100644 --- a/src/s_line.h +++ b/src/s_line.h @@ -13,13 +13,12 @@  #ifndef S_LINE_H  # define S_LINE_H -# include <stdint.h>  # include "s_struct.h"  void			s_line_add_back(t_line_block **aline, t_line_block *new);  void			s_line_clear(t_line_block **line); -t_line_block	*s_line_new(const char word[], uint8_t nextif); +t_line_block	*s_line_new(const char word[], unsigned char nextif);  t_line_block	*s_line_last(t_line_block *line);  #endif diff --git a/src/s_lpipes.c b/src/s_lpipes.c index 0f0529a..dc5feea 100644 --- a/src/s_lpipes.c +++ b/src/s_lpipes.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include <sys/types.h>  #ifdef __linux__  # include <linux/limits.h> @@ -85,7 +84,7 @@ struct s_lpipes	*s_split_pipes(const char word[], t_msh *msh)  	struct s_lpipes	*lpipes;  	size_t			pos[256];  	char			tmp[ARG_MAX]; -	int16_t			i; +	short			i;  	ft_bzero(pos, 256 * sizeof(size_t));  	s_get_split_pos(pos, word); diff --git a/src/s_lpipes_split.c b/src/s_lpipes_split.c index 4da4a03..3dde313 100644 --- a/src/s_lpipes_split.c +++ b/src/s_lpipes_split.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #ifdef __linux__  # include <linux/limits.h>  #else @@ -24,7 +23,7 @@  #include "u_parse.h"  #include "u_utils.h" -void	s_set_tmp(char tmp[], size_t pos[], int16_t i, const char word[]) +void	s_set_tmp(char tmp[], size_t pos[], short i, const char word[])  {  	if (pos[i] != 0)  		ft_strlcpy(tmp, @@ -41,12 +40,12 @@ void	s_get_split_pos(size_t pos[], const char word[])  {  	char			*ptr;  	t_quote_mode	mode; -	uint16_t		i; +	unsigned short		i;  	ptr = (char*)word;  	mode = Q_NONE;  	i = 1; -	while (*ptr != C_NUL && (uint16_t)i < 256) +	while (*ptr != C_NUL && (unsigned short)i < 256)  	{  		if (*ptr == C_PIPE)  		{ diff --git a/src/s_lpipes_split.h b/src/s_lpipes_split.h index aa978f4..385759b 100644 --- a/src/s_lpipes_split.h +++ b/src/s_lpipes_split.h @@ -14,9 +14,8 @@  # define S_LPIPES_SPLIT_H  # include <stddef.h> -# include <stdint.h> -void	s_set_tmp(char tmp[], size_t pos[], int16_t i, const char word[]); +void	s_set_tmp(char tmp[], size_t pos[], short i, const char word[]);  void	s_get_split_pos(size_t pos[], const char word[]);  #endif diff --git a/src/s_lredir.c b/src/s_lredir.c index 59ed6e1..517c2de 100644 --- a/src/s_lredir.c +++ b/src/s_lredir.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #include <string.h>  #include <fcntl.h> @@ -69,10 +68,10 @@ void			s_lredir_clear(struct s_lredir **lredir)  	*lredir = NULL;  } -static int32_t	s_get_right_fd(const char path[]) +static int	s_get_right_fd(const char path[])  {  	char	*ptr; -	int32_t	rfd; +	int	rfd;  	ptr = (char*)path;  	while (ft_isdigit(*ptr) == TRUE) @@ -91,7 +90,7 @@ static int32_t	s_get_right_fd(const char path[])  	return (rfd);  } -struct s_lredir	*s_lredir_new(const char path[], int32_t fd, int8_t redir) +struct s_lredir	*s_lredir_new(const char path[], int fd, char redir)  {  	struct s_lredir	*rdr; diff --git a/src/s_lredir.h b/src/s_lredir.h index e649f43..3b06e51 100644 --- a/src/s_lredir.h +++ b/src/s_lredir.h @@ -13,12 +13,11 @@  #ifndef S_LREDIR_H  # define S_LREDIR_H -# include <stdint.h>  # include "s_struct.h"  void			s_lredir_add_back(t_lredir **lredir, t_lredir *new);  void			s_lredir_clear(struct s_lredir **lredir); -struct s_lredir	*s_lredir_new(const char path[], int32_t fd, int8_t redir); +struct s_lredir	*s_lredir_new(const char path[], int fd, char redir);  #endif diff --git a/src/s_struct.h b/src/s_struct.h index d948090..5d19dd4 100644 --- a/src/s_struct.h +++ b/src/s_struct.h @@ -13,7 +13,6 @@  #ifndef S_STRUCT_H  # define S_STRUCT_H -# include <stdint.h>  # include <stddef.h>  # ifdef __linux__  #  include <linux/limits.h> @@ -39,7 +38,7 @@ typedef struct			s_lalias  }						t_lalias;  /* -** redir(int8_t) index +** redir(char) index  ** -------------------  ** -3: <<-  ** -2: << @@ -54,9 +53,9 @@ typedef struct			s_lredir  {  	char				path[PATH_MAX];  	char				*heredoc; -	int32_t				fd; -	int32_t				right_fd; -	int8_t				redir; +	int				fd; +	int				right_fd; +	char				redir;  	struct s_lredir		*next;  }						t_lredir; @@ -75,7 +74,7 @@ struct					s_lpipes  };  /* -** nextif(uint8_t) index +** nextif(unsigned char) index  ** ---------------------  ** 0: ;  ** 1: && @@ -85,7 +84,7 @@ struct					s_lpipes  typedef struct			s_line_block  {  	char				*lblock; -	uint8_t				nextif; +	unsigned char				nextif;  	struct s_line_block	*next;  }						t_line_block; @@ -96,7 +95,7 @@ typedef struct			s_msh  	struct s_lpipes		*pipes;  	struct s_lvars		*vars;  	struct s_lalias		*alias; -	int32_t				argc; +	int				argc;  	char				**argv;  	char				**envp;  	char				*prev_hist; @@ -105,9 +104,9 @@ typedef struct			s_msh  	char				env_fork_tmp[128][4096];  	char				sqb_ref[B_ID_SQB_COUNT][4];  	char				*cwd; -	int32_t				fd; -	uint8_t				(*bu_ptr[B_BUILTINS_COUNT])(char **, struct s_msh*); -	uint8_t				ret; +	int				fd; +	unsigned char				(*bu_ptr[B_BUILTINS_COUNT])(char **, struct s_msh*); +	unsigned char				ret;  }						t_msh;  #endif diff --git a/src/u_alias.c b/src/u_alias.c index b505e2a..4aab600 100644 --- a/src/u_alias.c +++ b/src/u_alias.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stddef.h>  #include "d_define.h" diff --git a/src/u_alias.h b/src/u_alias.h index a6e8907..c980bd2 100644 --- a/src/u_alias.h +++ b/src/u_alias.h @@ -17,7 +17,7 @@  # include "s_struct.h" -uint8_t	u_get_alias_value(char str[], +unsigned char	u_get_alias_value(char str[],  						const char name[],  						size_t dstsize,  						t_msh *msh); diff --git a/src/u_path.c b/src/u_path.c index 0223164..02f3059 100644 --- a/src/u_path.c +++ b/src/u_path.c @@ -42,7 +42,7 @@ static void		u_get_fullpath(char fullpath[],  	}  } -static int8_t	u_read_dir(DIR *dir, +static char	u_read_dir(DIR *dir,  						struct s_path s,  						const char com[],  						char fullpath[]) @@ -63,7 +63,7 @@ static int8_t	u_read_dir(DIR *dir,  	return (-1);  } -uint8_t			u_search_in_path(char fullpath[], +unsigned char			u_search_in_path(char fullpath[],  								const char com[],  								size_t dstsize,  								t_msh *msh) @@ -71,7 +71,7 @@ uint8_t			u_search_in_path(char fullpath[],  	char			tmp[ARG_MAX];  	struct s_path	s;  	DIR				*dir; -	int8_t			ret; +	char			ret;  	if (u_get_var_value(tmp, "$PATH", ARG_MAX, msh) != 0)  		return (2); diff --git a/src/u_path.h b/src/u_path.h index d2f31e5..16b02dc 100644 --- a/src/u_path.h +++ b/src/u_path.h @@ -23,7 +23,7 @@ struct		s_path  	size_t	dstsize;  }; -uint8_t		u_search_in_path(char fullpath[], +unsigned char		u_search_in_path(char fullpath[],  							const char com[],  							size_t dstsize,  							t_msh *msh); diff --git a/src/u_utils.c b/src/u_utils.c index d56d7c0..5394705 100644 --- a/src/u_utils.c +++ b/src/u_utils.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include <unistd.h>  #include "d_define.h" @@ -28,7 +27,7 @@ t_bool		u_is_not_escaped(const char *head, const char *ptr)  	return (FALSE);  } -void		u_eof_fd(int32_t fd) +void		u_eof_fd(int fd)  {  	char	*line; @@ -61,9 +60,9 @@ char		**u_get_env_var_names(t_msh *msh)  	return (vars);  } -uint64_t	u_builtins_get_argc(const char *args[]) +unsigned long	u_builtins_get_argc(const char *args[])  { -	uint64_t	argc; +	unsigned long	argc;  	argc = 0;  	while (args[argc] != NULL) @@ -73,11 +72,11 @@ uint64_t	u_builtins_get_argc(const char *args[])  	return (argc);  } -uint8_t		u_get_builtin_id(const char bin[]) +unsigned char		u_get_builtin_id(const char bin[])  {  	char	tmp[M_BUILTINS_REF_LEN];  	char	*tok; -	uint8_t	i; +	unsigned char	i;  	i = 0;  	ft_strlcpy(tmp, M_BUILTINS_REF, M_BUILTINS_REF_LEN); diff --git a/src/u_utils.h b/src/u_utils.h index e136ecc..33e0f5d 100644 --- a/src/u_utils.h +++ b/src/u_utils.h @@ -14,14 +14,13 @@  # define U_UTILS_H  # include <libft.h> -# include <stdint.h>  # include "s_struct.h"  t_bool		u_is_not_escaped(const char *head, const char *ptr); -void		u_eof_fd(int32_t fd); -uint64_t	u_builtins_get_argc(const char *args[]); +void		u_eof_fd(int fd); +unsigned long	u_builtins_get_argc(const char *args[]);  char		**u_get_env_var_names(t_msh *msh); -uint8_t		u_get_builtin_id(const char bin[]); +unsigned char		u_get_builtin_id(const char bin[]);  #endif diff --git a/src/u_vars.c b/src/u_vars.c index 3b4b553..e096730 100644 --- a/src/u_vars.c +++ b/src/u_vars.c @@ -12,7 +12,6 @@  #include <libft.h>  #include <stdlib.h> -#include <stdint.h>  #include "d_define.h"  #include "f_fail.h" @@ -56,7 +55,7 @@ static void	u_get_special_var(char str[],  					t_msh *msh)  {  	char		tmp[255]; -	int32_t		n; +	int		n;  	if (ft_strncmp(varname, M_RET_VAR, 3) == 0)  	{ @@ -110,7 +109,7 @@ void		u_get_custom_var(char str[],  ** varname[] wasn't found.  */ -uint8_t		u_get_var_value(char str[], +unsigned char		u_get_var_value(char str[],  							const char varname[],  							size_t dstsize,  							t_msh *msh) diff --git a/src/u_vars.h b/src/u_vars.h index e27a142..337c357 100644 --- a/src/u_vars.h +++ b/src/u_vars.h @@ -13,7 +13,6 @@  #ifndef U_VARS_H  # define U_VARS_H -# include <stdint.h>  # include <stddef.h>  # include "s_struct.h" @@ -22,7 +21,7 @@ void	u_get_custom_var(char str[],  						const char varname[],  						size_t dstsize,  						t_msh *msh); -uint8_t	u_get_var_value(char str[], +unsigned char	u_get_var_value(char str[],  						const char varname[],  						size_t dstsize,  						t_msh *msh); diff --git a/src/u_vars_next.c b/src/u_vars_next.c index 0e3c33d..05538d4 100644 --- a/src/u_vars_next.c +++ b/src/u_vars_next.c @@ -11,7 +11,6 @@  /* ************************************************************************** */  #include <libft.h> -#include <stdint.h>  #include <stdlib.h>  #ifdef __linux__  # include <linux/limits.h> @@ -25,10 +24,10 @@  #include "u_parse.h"  #include "u_utils.h" -static int64_t	u_get_env_var_line(const char varname[], t_msh *msh) +static long	u_get_env_var_line(const char varname[], t_msh *msh)  {  	char	**env_dup; -	int64_t	i; +	long	i;  	env_dup = u_get_env_var_names(msh);  	i = 0; @@ -85,7 +84,7 @@ void			u_subst_var_value(const char varname[],  								t_msh *msh)  {  	char	new_line_fmt[ARG_MAX]; -	int64_t	env_line; +	long	env_line;  	if ((env_line = u_get_env_var_line(varname + 1, msh)) > -1)  	{ | 
