tout a la norme

This commit is contained in:
Hugo LAMY
2020-02-27 12:10:07 +01:00
parent c1a6c0c5ed
commit 1bc1e87c67
6 changed files with 44 additions and 12 deletions

View File

@@ -1,10 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_convert.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/27 12:03:28 by hulamy #+# #+# */
/* Updated: 2020/02/27 12:03:38 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
/*
** FT_CONVERT :
** -convert the next argument into a string according to the following
** correspondances for diuxXcspefgn :
** correspondances for diuxXcspefgn :
** [char] [hhd, hhi, c] [int] [d i c]
** [short] [hd, hi] [int]
** [int] [d, i] [int]
@@ -73,7 +84,7 @@ char *ft_convert(va_list ap, char *type)
if ((s = ft_strchrset(type, "s")))
return (conv_u(s[0], va_arg(ap, unsigned long int)));
if (ft_strchr(type, '%'))
return(ft_strdup("%"));
return (ft_strdup("%"));
if (ft_strchrset(type, "efgn"))
return (NULL);
return (NULL);

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/27 11:55:43 by hulamy #+# #+# */
/* Updated: 2020/02/27 11:55:45 by hulamy ### ########.fr */
/* Updated: 2020/02/27 12:07:22 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -57,7 +57,7 @@ char *precision_int(char *print, int precision)
** -if flag '0' is present in %string, removes it (actually turn each occurence
** in a '.')
** -and transform 'print' according to the precision :
** -0 if .precision == 0 and print == "0": return (print[0] = '\0') (print nothing)
** -0 if .precision is 0 && print is "0": print nothing
** -1 if type is s: if length(s) > precision, removes end of 'print' to print
** only x chars, with x = precision
** -2 if type is "diouxX": call fonction 'precision_int' that return :
@@ -119,7 +119,7 @@ char *width_flags(char *print, char *tmp, char *s, int width)
}
else
{
c = (ft_strchr(s, '0')) ? '0' : ' ' ;
c = (ft_strchr(s, '0')) ? '0' : ' ';
while (i < (width - ft_strlen(print)))
tmp[i++] = c;
while (print[j])
@@ -154,7 +154,6 @@ char *ft_width(char *s, char *print)
return (print);
}
/*
** go through all the transformation flags needs
*/