-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_show_d.c
35 lines (32 loc) · 1.44 KB
/
ft_show_d.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_show_d.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ccastill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/08 19:13:24 by ccastill #+# #+# */
/* Updated: 2020/07/20 08:23:49 by ccastill ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_show_d(t_list_printf *next)
{
char *new;
new = ft_itoa(next->i);
if ((next->i == 0 && next->flags == '-' && next->punt == '.') ||
(next->i == 0 && next->punt == '.'))
new[0] = '\0';
if (new[0] == '-')
next->neg = 1;
if (next->flags >= 1 && next->punt > 1)
ft_putspace_zero(new, next);
else if ((next->flags == 1) || (next->flags == '-') || (next->flags == '*'))
ft_putspace(new, next);
else if ((next->flags == '0') || (next->punt == '.'))
ft_putzero(new, next);
else
ft_putstr_fd(new, 1, next);
free(new);
new = NULL;
}