-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_fill_conv_flags.c
42 lines (40 loc) · 1.48 KB
/
ft_fill_conv_flags.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fill_conv_flags.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asibille <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/18 09:55:27 by asibille #+# #+# */
/* Updated: 2022/01/18 09:55:32 by asibille ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_fill_conv_flags(t_conv_flags *fl, const char *s, size_t *i)
{
while (s[*i] == '-' || s[*i] == '0'
|| s[*i] == '#' || s[*i] == '+' || s[*i] == ' ')
{
if (s[*i] == '-')
fl->minus = 1;
else if (s[*i] == '0')
fl->zero = 1;
else if (s[*i] == '#')
fl->hashtag = 1;
else if (s[*i] == '+')
fl->plus = 1;
else if (s[*i] == ' ')
fl->space = 1;
++(*i);
}
fl->width = ft_atoi(&s[*i]);
while (ft_isdigit(s[*i]))
++(*i);
if (s[*i] == '.' && ++(*i))
fl->ispoint = 1;
fl->point = ft_atoi(&s[*i]);
while (ft_isdigit(s[*i]))
++(*i);
fl->type = s[*i];
++(*i);
}