Define SPECIFIERS macro and use it everyhere.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/04/26 10:13:59 by gbaconni #+# #+# */
|
/* Created: 2022/04/26 10:13:59 by gbaconni #+# #+# */
|
||||||
/* Updated: 2022/04/26 13:24:34 by gbaconni ### ########.fr */
|
/* Updated: 2022/04/29 08:58:41 by gbaconni ### lausanne.ch */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ int ft_eoflags(const char *s)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
const char *chars = "cspdiuxX%";
|
const char *chars = SPECIFIERS;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/01/20 11:43:52 by gbaconni #+# #+# */
|
/* Created: 2022/01/20 11:43:52 by gbaconni #+# #+# */
|
||||||
/* Updated: 2022/04/26 15:20:34 by gbaconni ### ########.fr */
|
/* Updated: 2022/04/29 08:48:39 by gbaconni ### lausanne.ch */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/01/20 11:55:02 by gbaconni #+# #+# */
|
/* Created: 2022/01/20 11:55:02 by gbaconni #+# #+# */
|
||||||
/* Updated: 2022/04/29 08:42:35 by gbaconni ### lausanne.ch */
|
/* Updated: 2022/04/29 09:09:08 by gbaconni ### lausanne.ch */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ int ft_vprintf_decimal(const char *format, va_list ap)
|
|||||||
{
|
{
|
||||||
if (ft_isdigit(*f))
|
if (ft_isdigit(*f))
|
||||||
precision = precision * 10 + *f - '0';
|
precision = precision * 10 + *f - '0';
|
||||||
if (ft_strchr("cspdiuxX%", *f) != NULL)
|
if (ft_strchr(SPECIFIERS, *f) != NULL)
|
||||||
break ;
|
break ;
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/04/25 13:15:32 by gbaconni #+# #+# */
|
/* Created: 2022/04/25 13:15:32 by gbaconni #+# #+# */
|
||||||
/* Updated: 2022/04/26 17:18:20 by gbaconni ### ########.fr */
|
/* Updated: 2022/04/29 08:59:37 by gbaconni ### lausanne.ch */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -32,9 +32,9 @@ int ft_vprintf_flags_bonus(const char *format, va_list ap)
|
|||||||
ret |= F_SPACE;
|
ret |= F_SPACE;
|
||||||
else if (*f == '+')
|
else if (*f == '+')
|
||||||
ret |= F_PLUS;
|
ret |= F_PLUS;
|
||||||
else if (*f >= '0' && *f <= '9')
|
else if (ft_isdigit(*f))
|
||||||
break ;
|
break ;
|
||||||
if (*f == 'c' || *f == 's' || *f == 'p' || *f == 'd' || *f == 'i' || *f == 'u' || *f == 'x' || *f == 'X' || *f == '%')
|
if (ft_strchr(SPECIFIERS, *f) != NULL)
|
||||||
break ;
|
break ;
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/01/20 11:56:37 by gbaconni #+# #+# */
|
/* Created: 2022/01/20 11:56:37 by gbaconni #+# #+# */
|
||||||
/* Updated: 2022/04/29 08:42:02 by gbaconni ### lausanne.ch */
|
/* Updated: 2022/04/29 09:03:47 by gbaconni ### lausanne.ch */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ int ft_vprintf_string(const char *format, va_list ap)
|
|||||||
{
|
{
|
||||||
if (ft_isdigit(*f))
|
if (ft_isdigit(*f))
|
||||||
precision = precision * 10 + *f - '0';
|
precision = precision * 10 + *f - '0';
|
||||||
if (ft_strchr("cspdiuxX%", *f) != NULL)
|
if (ft_strchr(SPECIFIERS, *f) != NULL)
|
||||||
break ;
|
break ;
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/01/18 15:26:06 by gbaconni #+# #+# */
|
/* Created: 2022/01/18 15:26:06 by gbaconni #+# #+# */
|
||||||
/* Updated: 2022/04/26 10:41:36 by gbaconni ### ########.fr */
|
/* Updated: 2022/04/29 08:56:40 by gbaconni ### lausanne.ch */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -23,6 +23,8 @@
|
|||||||
# define NIL "(nil)"
|
# define NIL "(nil)"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# define SPECIFIERS "cspdiuxX%"
|
||||||
|
|
||||||
/* Helper */
|
/* Helper */
|
||||||
|
|
||||||
int ft_eoflags(const char *s);
|
int ft_eoflags(const char *s);
|
||||||
|
|||||||
Reference in New Issue
Block a user