finally \o/

added ft_printf to libft
finalised ans tested ft_getline
This commit is contained in:
vagrant
2019-03-07 22:29:34 +00:00
parent 55767c36c6
commit 13d96a14d8
18 changed files with 75 additions and 81 deletions

View File

@@ -6,11 +6,11 @@
/* By: klebon <klebon@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/18 18:10:11 by klebon #+# #+# */
/* Updated: 2018/10/01 15:40:54 by klebon ### ########.fr */
/* Updated: 2019/03/07 22:25:11 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
#include "libft.h"
/*
** I have to handle minus, width
@@ -48,7 +48,7 @@ char *handler_2oct_char(wint_t c, t_conv *field)
char *output;
field->str_size = (field->fl_witdth > 2) ? field->fl_witdth : 2;
if (!(output = ft_strnewb(field->str_size)))
if (!(output = ft_strnew(field->str_size)))
return (NULL);
output[0] = (c >> 6) + 0xC0;
output[1] = (c & 0x3F) + 0x80;
@@ -61,7 +61,7 @@ char *handler_3oct_char(wint_t c, t_conv *field)
char *output;
field->str_size = (field->fl_witdth > 3) ? field->fl_witdth : 3;
if (!(output = ft_strnewb(field->str_size)))
if (!(output = ft_strnew(field->str_size)))
return (NULL);
output[0] = (c >> 12) + 0xE0;
output[1] = ((c >> 6) & 0x3F) + 0x80;
@@ -75,7 +75,7 @@ char *handler_4oct_char(wint_t c, t_conv *field)
char *output;
field->str_size = (field->fl_witdth > 4) ? field->fl_witdth : 4;
if (!(output = ft_strnewb(field->str_size)))
if (!(output = ft_strnew(field->str_size)))
return (NULL);
output[0] = (c >> 18) + 0xF0;
output[1] = ((c >> 12) & 0x3F) + 0x80;
@@ -96,7 +96,7 @@ char *handle_output_wchar(t_conv *field, va_list ap)
else if (c <= 0x7F || (MB_CUR_MAX == 1 && c <= 0xFF))
{
field->str_size = (field->fl_witdth > 1) ? field->fl_witdth : 1;
if (!(output = ft_strnewb(field->str_size)))
if (!(output = ft_strnew(field->str_size)))
return (NULL);
output[0] = (char)c;
ft_align_wchar(output, field);