-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_types_utils.c
executable file
·68 lines (63 loc) · 1.57 KB
/
ft_types_utils.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_types_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bscamand <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/11 13:56:23 by bscamand #+# #+# */
/* Updated: 2021/01/11 15:04:35 by bscamand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void ft_type_diu(t_parser *ptr)
{
if (*STR == 'd' || *STR == 'i')
{
if (*STR == 'd')
TYPE = 'd';
else
TYPE = 'i';
DI = va_arg(ARGS, int);
}
else
{
TYPE = 'u';
U = va_arg(ARGS, unsigned int);
}
}
void ft_type_cs(t_parser *ptr)
{
if (*STR == 'c')
{
TYPE = 'c';
ZERO = 0;
TAP = ' ';
C = va_arg(ARGS, unsigned int);
}
else
{
TYPE = 's';
S = va_arg(ARGS, char*);
if (!S)
S = "(null)";
}
}
void ft_type_pp(t_parser *ptr)
{
if (*STR == 'p')
{
TYPE = 'p';
P = va_arg(ARGS, unsigned long long int);
}
else
TYPE = '%';
}
void ft_type_x(t_parser *ptr)
{
if (*STR == 'x')
TYPE = 'x';
else
TYPE = 'X';
X = va_arg(ARGS, unsigned int);
}