-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandle_hex.c
29 lines (26 loc) · 1.21 KB
/
handle_hex.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handle_hex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/04 20:53:11 by ralves-b #+# #+# */
/* Updated: 2022/07/07 22:39:15 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
t_str handle_hex(va_list args, int *count, t_flags *flags)
{
t_str str;
int temp;
temp = va_arg(args, int);
str.s = ft_itohex(temp);
str.size = ft_strlen(str.s);
*count += str.size;
if (flags->spcf == 'X')
str.s = ft_strtoupper(str.s);
if (str.size == 1 && str.s[0] == '0')
flags->null = TRUE;
return (str);
}