-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf12.c
89 lines (82 loc) · 2.07 KB
/
ft_printf12.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf12.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: plisieck <plisieck@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/02/08 16:18:05 by plisieck #+# #+# */
/* Updated: 2015/02/08 16:52:31 by plisieck ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int opt2(t_specs opt, char *c, int *i, char **str)
{
if (*str[0] == 0)
{
if (!(opt.flags & 0x04))
{
*str = treat_options(*str, opt, c[*i], 1);
ft_putstr(*str);
}
ft_putchar(0);
if (opt.flags & 0x04)
{
*str = treat_options(*str, opt, c[*i], 1);
ft_putstr(*str);
}
(*i)++;
return (ft_strlen(*str) + 1);
}
else
*str = treat_options(*str, opt, c[*i], 0);
return (0);
}
wchar_t *ft_option_big_c(va_list ap)
{
wchar_t *wstr;
wstr = (wchar_t*)malloc(sizeof(wchar_t) * 2);
wstr[0] = va_arg(ap, int);
wstr[1] = '\0';
return (wstr);
}
int ft_option_big_c2(t_specs opt, char *c, int *i, wchar_t **wstr)
{
if (*wstr[0] == 0)
{
if (!(opt.flags & 0x04))
{
*wstr = wtrt_opt(L"", opt, c[*i], 1);
ft_wputstr(*wstr);
}
ft_putchar(0);
if (opt.flags & 0x04)
{
*wstr = wtrt_opt(L"", opt, c[*i], 1);
ft_wputstr(*wstr);
}
(*i)++;
return (ft_wstrlen(*wstr) + 1);
}
else
*wstr = wtrt_opt(*wstr, opt, c[*i], 0);
return (0);
}
void split_if(char *str, int **i)
{
if (str)
{
ft_putstr(str);
(**i)++;
}
}
int split_if2(wchar_t **wstr, int *i)
{
if (*wstr)
{
ft_wputstr(*wstr);
(*i)++;
return (ft_wstrlen(*wstr));
}
return (0);
}