-
Notifications
You must be signed in to change notification settings - Fork 0
/
pf_format_input.c
38 lines (35 loc) · 1.42 KB
/
pf_format_input.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pf_format_input.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gkhodizo <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/24 15:16:53 by gkhodizo #+# #+# */
/* Updated: 2020/08/01 18:47:36 by gkhodizo ### ########.fr */
/* */
/* ************************************************************************** */
/*
** The format_input() formats str, given flags, width and precision.
** Then it prints formatted str to stdout.
*/
#include "ft_printf.h"
void format_input(t_fmt *fmt, t_len *pf_len)
{
if (ft_strchr("csp%%", fmt->specifier))
{
format_precision_char(fmt);
if (fmt->specifier == '%')
format_width_num(fmt);
else
format_width_char(fmt);
}
else if (ft_strchr("duixX", fmt->specifier))
{
format_precision_num(fmt);
format_width_num(fmt);
}
pf_len->print_len += fmt->value_len;
ft_putstr_len(fmt->spec_value, fmt->value_len);
return ;
}