-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsing_tools1.c
48 lines (43 loc) · 1.48 KB
/
parsing_tools1.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parsing_tools1.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vmiachko <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/03/06 12:28:15 by vmiachko #+# #+# */
/* Updated: 2018/03/10 14:14:11 by vmiachko ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int compare_width_precision(t_flags flag)
{
return (flag.width < flag.precision &&
flag.sign_minus && flag.width > 0
&& flag.precision > -1);
}
int find_spec(const char *str, char c)
{
int i;
i = 0;
while (str[i])
{
if (str[i] == c)
return (1);
++i;
}
return (0);
}
void read_after_percent1(char *format, t_flags *flag, size_t i)
{
if (format[i] == '-')
flag->minus = 1;
else if (format[i] == '+')
flag->plus = 1;
else if (format[i] == '#')
flag->hash = 1;
else if (format[i] == '0')
flag->zero = 1;
else if (format[i] == ' ')
flag->space = 1;
}