-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_print_xp_prcnt.c
executable file
·73 lines (67 loc) · 1.86 KB
/
ft_print_xp_prcnt.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
66
67
68
69
70
71
72
73
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_xp_prcnt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bscamand <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/11 14:22:26 by bscamand #+# #+# */
/* Updated: 2021/01/11 14:29:56 by bscamand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void ft_print_prcnt(t_parser *ptr)
{
if (MINUS)
{
ft_putchar_fd('%', 1, ptr);
ft_putchar_fd_tap(TAP, 1, ptr, WIDTH - 1);
}
else
{
ft_putchar_fd_tap(TAP, 1, ptr, WIDTH - 1);
ft_putchar_fd('%', 1, ptr);
}
}
void ft_print_p(t_parser *ptr)
{
char *p_str;
char *ox;
ox = "0x";
p_str = ft_itoa_hex(P, ptr);
P_STR = p_str;
free(p_str);
LEN_P = ft_strlen(P_STR);
ft_accuracy_len(LEN_P, ptr);
if (!ACCURACY && !P)
{
P_STR = "";
if (!(ft_accuracy_and_value_p(P_STR, ox, ptr)))
ft_accuracy_and_value_p(P_STR, ox, ptr);
else
return ;
}
else if (MINUS)
ft_process_p_minus(ox, ptr);
else
ft_process_p(ox, ptr);
}
void ft_print_x(t_parser *ptr)
{
char *x_str;
x_str = ft_itoa_hex(X, ptr);
X_STR = x_str;
free(x_str);
LEN_X = ft_strlen(X_STR);
if (!ACCURACY && !X)
{
if (!(ft_accuracy_and_value_ux(X_STR, ptr)))
ft_accuracy_and_value_ux(X_STR, ptr);
else
return ;
}
else if (MINUS)
ft_process_x_minus(ptr);
else
ft_process_x(ptr);
}