-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf_get_print_rest.c
42 lines (38 loc) · 1.55 KB
/
ft_printf_get_print_rest.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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_printf_get_print_rest.c :+: :+: */
/* +:+ */
/* By: avan-ber <[email protected]> +#+ */
/* +#+ */
/* Created: 2019/12/20 17:07:52 by avan-ber #+# #+# */
/* Updated: 2019/12/28 15:38:50 by avan-ber ######## odam.nl */
/* */
/* ************************************************************************** */
#include "printf.h"
int get_size_n(t_flags flags, va_list ap, int count)
{
if (flags.length == 3)
fill_n_long(ap, count);
else if (flags.length == 4)
fill_n_longlong(ap, count);
else if (flags.length == 2)
fill_n_short(ap, count);
else if (flags.length == 1)
fill_n_shortshort(ap, count);
else
fill_n_int(ap, count);
return (0);
}
int get_size_str(t_flags flags, va_list ap)
{
if (flags.length == 3)
return (print_str_w(flags, va_arg(ap, wchar_t *)));
return (print_str(flags, va_arg(ap, char *)));
}
int get_size_char(t_flags flags, va_list ap)
{
if (flags.length == 3)
return (print_char_w(flags, va_arg(ap, wint_t)));
return (print_char(flags, va_arg(ap, int)));
}