2022-10-06 20:30:03 -04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
2022-10-23 13:01:50 -04:00
|
|
|
/* ft_skipflag.c :+: :+: :+: */
|
2022-10-06 20:30:03 -04:00
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
2022-10-23 13:01:50 -04:00
|
|
|
/* Created: 2022/10/12 14:47:52 by cchauvet #+# #+# */
|
|
|
|
/* Updated: 2022/10/12 16:14:07 by cchauvet ### ########.fr */
|
2022-10-06 20:30:03 -04:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2022-10-23 13:01:50 -04:00
|
|
|
#include "ft_printf.h"
|
2022-10-06 20:30:03 -04:00
|
|
|
|
2022-10-23 13:01:50 -04:00
|
|
|
int ft_skipflag(const char *str)
|
2022-10-06 20:30:03 -04:00
|
|
|
{
|
2022-10-23 13:01:50 -04:00
|
|
|
size_t i;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
if (str[i] != '%')
|
|
|
|
return (0);
|
|
|
|
i++;
|
|
|
|
if (str[i] == '\0')
|
|
|
|
return (-1);
|
|
|
|
while (ft_isdigit(str[i]))
|
|
|
|
i++;
|
|
|
|
if (ft_isarg(str[i]))
|
|
|
|
return (i + 1);
|
2022-10-10 13:33:47 -04:00
|
|
|
return (0);
|
2022-10-06 20:30:03 -04:00
|
|
|
}
|