Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_printf | ||
4 | ** File description: | ||
5 | ** Flag to print a %o (an int in octal) | ||
6 | */ | ||
7 | /** | ||
8 | * @file flag_o.c | ||
9 | * @brief The file containing the flag_o function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "myprintf.h" | ||
14 | |||
15 | 11 | int flag_o(va_list list, formating_t *formating) | |
16 | { | ||
17 | 11 | size_t temp = va_arg(list, size_t); | |
18 | 11 | char *convert_base = specify_it_base(formating, temp, "01234567"); | |
19 | |||
20 | 11 | precise_it_int(convert_base, formating, temp); | |
21 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
11 | if (formating->id_ft == 3 && convert_base[0] != '0') { |
22 | 1 | my_revstr(convert_base); | |
23 | 1 | my_strcat(convert_base, "0"); | |
24 | 1 | my_revstr(convert_base); | |
25 | } | ||
26 | 11 | format_it_int(convert_base, formating, temp); | |
27 | 11 | return my_putstr_fd_free(convert_base, formating->fd); | |
28 | } | ||
29 |