Add ft_vprintf_precision_bonus and define HEXA_LOWER HEXA_UPPER

This commit is contained in:
gbaconni
2022-04-29 11:00:53 +02:00
parent 63712bd5d6
commit 34fe699fea
9 changed files with 104 additions and 51 deletions

View File

@@ -6,7 +6,7 @@
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/20 11:56:37 by gbaconni #+# #+# */
/* Updated: 2022/04/29 09:03:47 by gbaconni ### lausanne.ch */
/* Updated: 2022/04/29 10:52:32 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
@@ -25,29 +25,17 @@ int ft_vprintf_string(const char *format, va_list ap)
ret = ft_puts("(null)");
return (ret);
}
const char *f;
#ifdef BONUS
int precision;
int len;
int flags;
precision = 0;
flags = ft_vprintf_flags_bonus(format, ap);
(void) flags;
f = format;
while (*f != '\0')
{
if (ft_isdigit(*f))
precision = precision * 10 + *f - '0';
if (ft_strchr(SPECIFIERS, *f) != NULL)
break ;
f++;
}
precision = ft_vprintf_precision_bonus(format, ap);
if (precision > 0)
{
len = precision - ft_strlen(s);
while (len-- > 0)
ret += ft_putchar(' ');
}
#endif
ret += ft_puts(s);
return (ret);
}