diff --git a/libft/Makefile b/libft/Makefile index ea74a85b..525990c1 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -6,7 +6,7 @@ # By: jhalford +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2017/02/07 16:09:36 by jhalford #+# #+# # -# Updated: 2017/02/18 13:58:40 by jhalford ### ########.fr # +# Updated: 2017/02/18 14:23:51 by jhalford ### ########.fr # # # # **************************************************************************** # @@ -144,6 +144,7 @@ sstr/ft_sstrprint_fd.c\ sstr/ft_sstrsort.c\ str/ft_atoi.c\ str/ft_convert_base.c\ +str/ft_putaddr_fd.c\ str/ft_split_whitespaces.c\ str/ft_str3join.c\ str/ft_strappend.c\ diff --git a/libft/includes/color.h b/libft/includes/color.h index 2a0b9dfa..698e6c51 100644 --- a/libft/includes/color.h +++ b/libft/includes/color.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/25 13:36:48 by jhalford #+# #+# */ -/* Updated: 2017/02/07 20:09:07 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 20:01:33 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -45,7 +45,7 @@ typedef struct s_color t_color; # define BG_CYAN "\e[46m" # define BG_DEFAULT "\e[49m" -# define FBG_DEFAULT "\e[49m\e[20m" +# define FBG_DEFAULT FG_DEFAULT BG_DEFAULT void ft_color_reset(void); void ft_color_set(t_color color); diff --git a/libft/includes/libft.h b/libft/includes/libft.h index 2ea48e6c..bbb8eb25 100644 --- a/libft/includes/libft.h +++ b/libft/includes/libft.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */ -/* Updated: 2017/02/18 13:21:14 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 18:48:49 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -68,11 +68,13 @@ int ft_putchar(int c); void ft_putstr(char const *s); void ft_putendl(char const *s); void ft_putnbr(int n); +void ft_putaddr(void *a); + void ft_putchar_fd(char c, int fd); void ft_putstr_fd(char const *s, int fd); void ft_putendl_fd(char const *s, int fd); void ft_putnbr_fd(int n, int fd); -void ft_putaddr(void *a); +void ft_putaddr_fd(void *a, int fd); void *ft_realloc(void *data, int size); diff --git a/libft/includes/str.h b/libft/includes/str.h index e8faf617..2c95ad51 100644 --- a/libft/includes/str.h +++ b/libft/includes/str.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/18 13:05:53 by jhalford #+# #+# */ -/* Updated: 2017/02/18 13:20:56 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 18:47:45 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/math/ft_ilen.c b/libft/src/math/ft_ilen.c index e22953ce..bbce37b5 100644 --- a/libft/src/math/ft_ilen.c +++ b/libft/src/math/ft_ilen.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/07 13:53:53 by jhalford #+# #+# */ -/* Updated: 2016/11/07 14:44:35 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 15:41:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/math/ft_lltoa_base.c b/libft/src/math/ft_lltoa_base.c index 905dadef..69d31aff 100644 --- a/libft/src/math/ft_lltoa_base.c +++ b/libft/src/math/ft_lltoa_base.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/07 13:10:42 by jhalford #+# #+# */ -/* Updated: 2017/01/22 16:39:08 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 15:23:41 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/math/ft_ulltoa_base.c b/libft/src/math/ft_ulltoa_base.c index 5c33f30d..5a5a3675 100644 --- a/libft/src/math/ft_ulltoa_base.c +++ b/libft/src/math/ft_ulltoa_base.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/07 13:07:50 by jhalford #+# #+# */ -/* Updated: 2016/11/07 13:12:41 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 16:07:02 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/printing/ft_putaddr.c b/libft/src/printing/ft_putaddr.c index 2ba4028b..4ef50482 100644 --- a/libft/src/printing/ft_putaddr.c +++ b/libft/src/printing/ft_putaddr.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/21 15:13:34 by jhalford #+# #+# */ -/* Updated: 2016/11/21 15:13:35 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 18:47:36 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,5 +14,5 @@ void ft_putaddr(void *a) { - ft_printf("%p", a); + ft_putaddr_fd(a, 1); } diff --git a/libft/src/printing/ft_putnbr.c b/libft/src/printing/ft_putnbr.c index d8aa57a4..2f0a4a94 100644 --- a/libft/src/printing/ft_putnbr.c +++ b/libft/src/printing/ft_putnbr.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/08/02 21:25:03 by jhalford #+# #+# */ -/* Updated: 2016/08/04 21:28:16 by jhalford ### ########.fr */ +/* Updated: 2017/02/18 17:47:04 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/str/ft_putaddr_fd.c b/libft/src/str/ft_putaddr_fd.c new file mode 100644 index 00000000..261f3a72 --- /dev/null +++ b/libft/src/str/ft_putaddr_fd.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putaddr_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/02/18 18:47:04 by jhalford #+# #+# */ +/* Updated: 2017/02/18 18:48:58 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_putaddr_fd(void *a, int fd) +{ + char out[19]; + unsigned long long addr; + int i; + + addr = (unsigned long long)a; + out[18] = 0; + i = 17; + while (addr) + { + out[i--] = "0123456789abcdef"[addr % 16]; + addr = addr / 16; + } + out[i--] = 'x'; + out[i] = '0'; + ft_putstr_fd(out + i, fd); +}