Add ft_eoflags to replace ft_skipchars. Improve Makefile
This commit is contained in:
40
libftprintf/ft_eoflags.c
Normal file
40
libftprintf/ft_eoflags.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_eoflags.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/04/26 10:13:59 by gbaconni #+# #+# */
|
||||
/* Updated: 2022/04/26 12:00:16 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libftprintf.h"
|
||||
|
||||
int ft_eoflags(const char *s)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
const char *chars = "cspdiuxX%";
|
||||
|
||||
ret = 0;
|
||||
if (s == NULL)
|
||||
return (ret);
|
||||
while (*s != '\0')
|
||||
{
|
||||
i = 0;
|
||||
while (chars[i] != '\0')
|
||||
{
|
||||
if (chars[i] == *s)
|
||||
break ;
|
||||
i++;
|
||||
}
|
||||
if (chars[i] != *s)
|
||||
ret++;
|
||||
else
|
||||
break ;
|
||||
s++;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
Reference in New Issue
Block a user