-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags_h.c
53 lines (50 loc) · 1.55 KB
/
flags_h.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
43
44
45
46
47
48
49
50
51
52
53
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* flags_h_l_L.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nahmed-m <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/21 18:26:39 by nahmed-m #+# #+# */
/* Updated: 2016/02/01 01:55:22 by nahmed-m ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static void verif_flags(char *fmt, t_var *e)
{
if (fmt[e->i] == 'h' && fmt[e->i + 1] == 'h')
{
e->f_hh = 1;
e->i++;
}
else if (fmt[e->i] == 'l' && fmt[e->i + 1] == 'l')
{
e->f_ll = 1;
e->i++;
}
else if (fmt[e->i] == 'h')
e->f_h = 1;
else if (fmt[e->i] == 'l')
e->f_l = 1;
else if (fmt[e->i] == 'j')
e->f_j = 1;
else if (fmt[e->i] == 'z')
e->f_z = 1;
}
void flags_h(char *fmt, t_var *e)
{
while (fmt[e->i] == 'h' || fmt[e->i] == 'l' || fmt[e->i] == 'j' ||
fmt[e->i] == 'z')
{
if (fmt[e->i + 1] == '\0')
{
e->error = 1;
return ;
}
else
verif_flags(fmt, e);
e->i++;
}
if (fmt[e->i] == '#')
flags_effect(fmt, e);
}