added test function

This commit is contained in:
vagrant
2019-02-11 06:20:04 +00:00
parent 74b3f069bc
commit 973ac2479a
6 changed files with 119 additions and 2 deletions

18
srcs/ft_putchar.c Normal file
View File

@@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/07 19:03:57 by tmaze #+# #+# */
/* Updated: 2018/04/07 23:02:29 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putchar(char c)
{
write(1, &c, 1);
}

20
srcs/ft_putendl.c Normal file
View File

@@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putendl.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/07 22:37:44 by tmaze #+# #+# */
/* Updated: 2019/01/13 17:44:21 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putendl(char const *s)
{
if (s != NULL)
ft_putstr(s);
ft_putchar('\n');
}

19
srcs/ft_putstr.c Normal file
View File

@@ -0,0 +1,19 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/07 19:13:17 by tmaze #+# #+# */
/* Updated: 2018/04/12 11:23:29 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putstr(char const *s)
{
if (s != NULL)
write(1, s, ft_strlen(s));
}

View File

@@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/07 14:14:38 by tmaze #+# #+# */
/* Updated: 2019/02/07 17:11:26 by tmaze ### ########.fr */
/* Updated: 2019/02/09 14:36:30 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
@@ -23,6 +23,26 @@ void pf_initflags(t_flags *flags)
flags->size = '\0';
}
void pf_putflags(t_flags *flags)
{
ft_putendl("--- putflags ---");
ft_putstr("convtype->");
ft_putnbr(flags->convtype);
ft_putstr("/nminus->");
ft_putchar(flags->minus);
ft_putstr("/nsign->");
ft_putchar(flags->sign);
ft_putstr("/nhash->");
ft_putchar(flags->hash);
ft_putstr("/nwidth->");
ft_putnbr(flags->width);
ft_putstr("/nprecision->");
ft_putnbr(flags->precision);
ft_putstr("/nsize->");
ft_putchar(flags->size);
ft_putchar("/n");
}
size_t pf_getflags(const char *format, t_flags *flags)
{
size_t i;