-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_print_hexadecimal_help.c
65 lines (59 loc) · 2.11 KB
/
ft_print_hexadecimal_help.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_hexadecimal_help.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tblaase <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/09 18:38:31 by tblaase #+# #+# */
/* Updated: 2021/07/14 15:44:41 by tblaase ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void ft_hexadecimal_help_one(t_print *tab, int len, char *hexadecimal)
{
if (tab->precision > len)
ft_prec_greater_hexa_len(tab, len, hexadecimal);
else
tab->printlen = tab->printlen + ft_putstr_fd(hexadecimal, 1);
}
void ft_hexadecimal_help_two(t_print *tab, int len, char *hexadecimal)
{
if (tab->precision > len)
{
ft_width_right(tab, tab->precision);
ft_prec_greater_hexa_len(tab, len, hexadecimal);
}
else
{
tab->zero = 0;
ft_width_right(tab, len);
tab->printlen = tab->printlen + ft_putstr_fd(hexadecimal, 1);
}
}
void ft_hexadecimal_help_three(t_print *tab, int len, char *hexadecimal)
{
if (tab->precision > len)
{
ft_prec_greater_hexa_len(tab, len, hexadecimal);
ft_width_left(tab, tab->precision);
}
else
{
tab->printlen = tab->printlen + ft_putstr_fd(hexadecimal, 1);
ft_width_right(tab, len);
}
}
void ft_hexadecimal_help_four(t_print *tab, int len, char *hexadecimal)
{
if (tab->precision != -1)
tab->zero = 0;
ft_width_right(tab, len);
tab->printlen = tab->printlen + ft_putstr_fd(hexadecimal, 1);
}
void ft_hexadecimal_help_five(t_print *tab, int len, char *hexadecimal)
{
tab->zero = 0;
ft_width_right(tab, tab->precision);
ft_prec_greater_hexa_len(tab, len, hexadecimal);
}