Improve main by implementing fmtsplit to split format into chunks and pass function pointer to compare ft_printf with printf

This commit is contained in:
gbaconni
2022-04-24 00:40:01 +02:00
parent 505f5d9912
commit d4fb946428
11 changed files with 236 additions and 271 deletions

View File

@@ -0,0 +1,35 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_skipchars.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/23 23:49:26 by gbaconni #+# #+# */
/* Updated: 2022/04/24 00:00:43 by gbaconni ### lausanne.ch */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
int ft_skipchars(const char *s, char *chars)
{
int ret;
int i;
int hits;
ret = 0;
while (*s != '\0')
{
i = 0;
hits = 0;
while (chars[i] != '\0')
hits += (chars[i++] == *s);
if (hits > 0)
ret++;
else
break ;
s++;
}
return (ret);
}