-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_print_unsigned.c
41 lines (38 loc) · 1.77 KB
/
ft_print_unsigned.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_unsigned.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ohachim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/14 10:40:49 by ohachim #+# #+# */
/* Updated: 2019/05/26 07:08:01 by ohachim ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_print_unsigned(va_list arg, const char *format, t_rem *rems)
{
char *p;
char type_spec;
rems->fi_wi = ft_field_width(format, rems->cursor, arg);
rems->precision = ft_precision(format, rems->cursor, arg);
type_spec = ft_scan_flag(format, rems->cursor);
if (type_spec == 'l')
p = ft_construct_s(ft_itoa_imp_u(va_arg(arg, unsigned long int)) \
, format, rems, "");
else if (type_spec == 'L')
p = ft_construct_s(ft_itoa_imp_u(va_arg(arg \
, unsigned long long int))
, format, rems, "");
else if (type_spec == 'H')
p = ft_construct_s(ft_itoa_imp_u((unsigned char)va_arg(arg \
, unsigned int)), format, rems, "");
else if (type_spec == 'h')
p = ft_construct_s(ft_itoa_imp_u((unsigned short int)va_arg(arg \
, unsigned int)), format, rems, "");
else
p = ft_construct_s(ft_itoa_imp_u(va_arg(arg, unsigned int)), \
format, rems, "");
ft_putstr_rem(p, rems);
free(p);
}