-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.c
67 lines (62 loc) · 1.48 KB
/
flags.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
/*
** EPITECH PROJECT, 2023
** flags
** File description:
** flags
*/
#include "includes/my_printf.h"
flags_t diezflag(const char *format, int *i, int *lenght, flags_t flag_nbr)
{
if (format[*i + 1] == '#') {
flag_nbr.diez = flag_nbr.diez + 1;
flag_nbr.y = 1;
*i = *i + 1;
*lenght = *lenght;
return flag_nbr;
}
return flag_nbr;
}
flags_t blankflag(const char *format, int *i, int *lenght, flags_t flag_nbr)
{
if (format[*i + 1] == ' ') {
flag_nbr.blank = flag_nbr.blank + 1;
flag_nbr.y = 1;
*i = *i + 1;
*lenght = *lenght;
return flag_nbr;
}
return flag_nbr;
}
flags_t menosflag(const char *format, int *i, int *lenght, flags_t flag_nbr)
{
if (format[*i + 1] == '-') {
flag_nbr.menos = flag_nbr.menos + 1;
flag_nbr.y = 1;
*i = *i + 1;
*lenght = *lenght;
return flag_nbr;
}
return flag_nbr;
}
flags_t plusflag(const char *format, int *i, int *lenght, flags_t flag_nbr)
{
if (format[*i + 1] == '+') {
flag_nbr.plus = flag_nbr.plus + 1;
flag_nbr.y = 1;
*i = *i + 1;
*lenght = *lenght;
return flag_nbr;
}
return flag_nbr;
}
flags_t zeroflag(const char *format, int *i, int *lenght, flags_t flag_nbr)
{
if (format[*i + 1] == '0') {
flag_nbr.zero = flag_nbr.zero + 1;
flag_nbr.y = 1;
*i = *i + 1;
*lenght = *lenght;
return flag_nbr;
}
return flag_nbr;
}