-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_match_specifier.c
30 lines (27 loc) · 1.25 KB
/
ft_match_specifier.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_match_specifier.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mlegeay <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/05/30 04:43:56 by mlegeay #+# #+# */
/* Updated: 2017/05/30 07:23:26 by mlegeay ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_match_specifier(t_list *f, va_list *ap)
{
int i;
t_spec specifiers[16];
i = 0;
if (ft_check(f) == -1)
return (-1);
ft_init_specifiers(specifiers);
f->spe = f->frmt[f->index];
while (specifiers[i].c != f->spe && specifiers[i].c != 0)
i++;
if (specifiers[i].c == 0)
return (ft_printf_undefined(f));
return (specifiers[i].ptr(f, ap));
}