-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_printf_aux3.c
55 lines (50 loc) · 1.6 KB
/
ft_printf_aux3.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_aux3.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ngouy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/02/17 16:53:03 by ngouy #+# #+# */
/* Updated: 2015/02/17 17:07:56 by ngouy ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
void ft_printf_an(char *test, wchar_t **temp1, wchar_t *temp2)
{
int j;
int i;
int l;
l = 0;
j = l;
i = ft_strlen(test) + 5;
while (j != i)
{
if (test[j++] == 'c')
{
while (*temp2++)
(*temp1)[l++] = *(temp2 - 1);
}
else
(*temp1)[l++] = test[j - 1];
}
}
wchar_t *ft_testccc(t_opt *opt, va_list ap, int *cpt)
{
char *test;
wchar_t *temp1;
wchar_t *temp2;
temp2 = int_to_c(va_arg(ap, wchar_t));
if (*temp2 == 0)
opt->spec = 10;
else
opt->larg -= (ft_wcharlen(temp2) - 1);
test = "c";
opt->out = 'c';
opt->prec = 0;
test = ft_apply_opt(test, opt);
opt->out = 'C';
temp1 = malloc(sizeof(wchar_t) * ft_strlen(test) + 5);
ft_printf_an(test, &temp1, temp2);
return (temp1);
}