-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_conv.c
More file actions
50 lines (47 loc) · 1.57 KB
/
Copy pathget_conv.c
File metadata and controls
50 lines (47 loc) · 1.57 KB
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
/* ************************************************************************** */
/* */
/* :::::::: */
/* get_conv.c :+: :+: */
/* +:+ */
/* By: rvan-sch <[email protected]> +#+ */
/* +#+ */
/* Created: 2020/01/29 19:03:22 by rvan-sch #+# #+# */
/* Updated: 2020/02/17 19:30:44 by rvan-sch ######## odam.nl */
/* */
/* ************************************************************************** */
#include "header.h"
int ft_isconv(t_conv *conv, char c)
{
ft_clear_isconv(conv);
conv->f = c == 'f';
conv->c = c == 'c';
conv->s = c == 's';
conv->p = c == 'p';
conv->d = c == 'd';
conv->i = c == 'i';
conv->u = c == 'u';
conv->x = c == 'x';
conv->big_x = c == 'X';
conv->n = c == 'n';
conv->prc = c == '%';
if (conv->i)
conv->d = 1;
if (conv->c || conv->s || conv->p || conv->d || conv->i || conv->u ||
conv->x || conv->big_x || conv->n || conv->prc || conv->f)
return (1);
return (0);
}
void ft_clear_isconv(t_conv *conv)
{
conv->c = 0;
conv->s = 0;
conv->p = 0;
conv->d = 0;
conv->i = 0;
conv->u = 0;
conv->x = 0;
conv->big_x = 0;
conv->n = 0;
conv->prc = 0;
conv->f = 0;
}