-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_param_unsigned.c
37 lines (34 loc) · 1.52 KB
/
ft_param_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_param_unsigned.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jraymond <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/02/02 16:55:59 by jraymond #+# #+# */
/* Updated: 2018/02/08 16:46:03 by jraymond ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_param_unsigned(t_printf *elem, va_list ap)
{
uintmax_t arg;
char *numb;
t_nbcaddpw nbca;
arg = ft_handle_usize(elem, ap);
numb = ft_ulltoa(arg);
if (elem->flags & ZERO && (elem->flags & MINUS || elem->flags & PRECI))
elem->flags ^= ZERO;
elem->flags & MORE ? elem->flags ^= MORE : 0;
elem->flags & SPACE ? elem->flags ^= SPACE : 0;
nb_c_add_pw(&nbca, elem, ft_uilen(arg), numb);
ft_handle_sign(elem, &nbca, numb);
if (arg == 0 && elem->flags & PRECI && elem->precision == 0)
{
ft_padding_numbnull(elem, &nbca);
return (0);
}
ft_padding_numbposi(elem, &nbca, numb);
ft_memdel((void**)&numb);
return (0);
}