diff options
Diffstat (limited to '')
| -rw-r--r-- | src/b_h.c | 27 | 
1 files changed, 24 insertions, 3 deletions
@@ -12,22 +12,43 @@  #include <libft.h>  #include <stdint.h> +#include <stddef.h>  #include <unistd.h>  #include "d_define.h" +#include "f_fail.h"  #include "s_struct.h"  #include "u_utils.h" -static void		b_print_history_number(const char arg[]) +static void		b_print_history(const char arg[], t_msh *msh)  { +	char		*prev_hist; +	char		*tok; +	uint32_t	i; +  	(void)arg; +	i = 1; +	if (msh->prev_hist != NULL) +	{ +		if ((prev_hist = ft_strdup(msh->prev_hist)) == NULL) +			return ; +		tok = ft_strtok(prev_hist, "\n"); +		ft_printf("qwqwe\n"); +		while (tok != NULL) +		{ +			ft_printf("%-5u  %s\n", i, tok); +			i++; +			tok = ft_strtok(NULL, "\n"); +		} +		ft_memdel((void*)&prev_hist); +	}  }  static t_bool	b_check_numeric(const char arg[])  {  	char	*ptr; -	ptr = arg; +	ptr = (char*)arg;  	while (*ptr != C_NUL)  	{  		if (ft_isdigit(*ptr) == FALSE) @@ -57,7 +78,7 @@ uint8_t			b_h(char *args[], t_msh *msh)  	}  	else  	{ -		b_print_history(*args); +		b_print_history(*args, msh);  	}  	return (0);  }  | 
