put_addrfd

This commit is contained in:
Jack Halford 2017-02-18 20:11:09 +01:00
parent a01ceeaaf7
commit 68d10bf7a7
10 changed files with 47 additions and 12 deletions

View file

@ -6,7 +6,7 @@
# By: jhalford <jack@crans.org> +#+ +:+ +#+ # # By: jhalford <jack@crans.org> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2017/02/07 16:09:36 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\ sstr/ft_sstrsort.c\
str/ft_atoi.c\ str/ft_atoi.c\
str/ft_convert_base.c\ str/ft_convert_base.c\
str/ft_putaddr_fd.c\
str/ft_split_whitespaces.c\ str/ft_split_whitespaces.c\
str/ft_str3join.c\ str/ft_str3join.c\
str/ft_strappend.c\ str/ft_strappend.c\

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/25 13:36:48 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_CYAN "\e[46m"
# define BG_DEFAULT "\e[49m" # 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_reset(void);
void ft_color_set(t_color color); void ft_color_set(t_color color);

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:49:04 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_putstr(char const *s);
void ft_putendl(char const *s); void ft_putendl(char const *s);
void ft_putnbr(int n); void ft_putnbr(int n);
void ft_putaddr(void *a);
void ft_putchar_fd(char c, int fd); void ft_putchar_fd(char c, int fd);
void ft_putstr_fd(char const *s, int fd); void ft_putstr_fd(char const *s, int fd);
void ft_putendl_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_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); void *ft_realloc(void *data, int size);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/18 13:05:53 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:53:53 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:10:42 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:07:50 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/21 15:13:34 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) void ft_putaddr(void *a)
{ {
ft_printf("%p", a); ft_putaddr_fd(a, 1);
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/02 21:25:03 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putaddr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}