-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_c.c
More file actions
41 lines (38 loc) · 1.28 KB
/
ft_printf_c.c
File metadata and controls
41 lines (38 loc) · 1.28 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_c.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfrisby <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/07/11 13:10:59 by mfrisby #+# #+# */
/* Updated: 2017/07/11 13:11:00 by mfrisby ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void ft_printf_c(t_env *e)
{
char *tmp;
int c;
tmp = ft_strnew(2);
e->type = 'c';
if (e->m_l == 1)
{
ft_printf_cmaj(e);
return ;
}
else
c = va_arg(e->pa, int);
if (c == 0)
{
e->size++;
ft_printf_putflags(e, ft_strdup(""));
ft_printf_buffer_flush(e);
if (e->family == 0)
ft_putchar(0);
return ;
}
tmp[0] = c;
tmp[1] = '\0';
ft_printf_putflags(e, tmp);
}