aboutsummaryrefslogtreecommitdiff
path: root/convert_hex_low.c
blob: 39cc18855069d1b5454d87ea92a42c0f2c0e8845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdarg.h>
#include "header.h"

char	*convert_hex_low(va_list ap, t_pformat *pformat)
{
	unsigned int n = va_arg(ap, unsigned int);
	char *str = ITOA_HEX_LOW(n);
	str = handle_precision(pformat, str);
	if (pformat->flags & FLAG_ALTERNATE && n != 0)
	{
		char *tmp = ft_strjoin("0x", str);
		free(str);
		str = tmp;
	}
	str = handle_padding(pformat, str);
	return (str);
}