Commit 2e4c9891 authored by Gabriel Genois's avatar Gabriel Genois

...

parent 99e20b0e
Pipeline #90 passed with stages
in 57 seconds
......@@ -27,6 +27,8 @@ typedef struct s_pfdata
void ftpf_tmp_printpfdata(t_pfdata **dt);
char *ftpf_strings_null(void);
int ft_lstfromwchar(t_pfdata **pfdata, wchar_t **item);
void ftpf_width(t_pfdata **dt, va_list *data, int *pos);
void ftpf_flags_widecheck(t_pfdata **dt);
void ftpf_flags(t_pfdata **dt, int *pos);
......
......@@ -6,7 +6,7 @@
/* By: ggenois <ggenois@student.le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/05/19 16:03:09 by ggenois #+# ## ## #+# */
/* Updated: 2018/11/03 21:57:42 by ggenois ### #+. /#+ ###.fr */
/* Updated: 2018/11/03 22:33:22 by ggenois ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
......@@ -178,8 +178,8 @@ int main(int argc, char **argv)
//i = ft_printf("Je suis un printf");
//i = ft_printf("%.2s is a string", "");
//i = ft_printf("%s is a string", "");
i = ft_printf("%S", L"米");
i = printf("%S", L"米");
i = ft_printf("%S", L"米");
ft_putchar('\n');
ft_putnbr(i);
}
......
......@@ -6,7 +6,7 @@
# By: ggenois <ggenois@student.le-101.fr> +:+ +: +: +:+ #
# #+# #+ #+ #+# #
# Created: 2017/11/23 11:34:53 by ggenois #+# ## ## #+# #
# Updated: 2018/09/06 14:46:00 by ggenois ### #+. /#+ ###.fr #
# Updated: 2018/11/03 22:45:08 by ggenois ### #+. /#+ ###.fr #
# / #
# / #
# **************************************************************************** #
......@@ -21,6 +21,7 @@ ftpf_utils.c\
ftpf_get_n.c\
ftpf_flags.c\
ftpf_width.c\
ftpf_lstw.c\
ftpf_precision.c
PROJECT = libftprintf
......
#include "../includes/ft_printf.h"
char *ftpf_strings_null(void)
{
char *s;
s = ft_strnew(7);
ft_memcpy(s, "(null)", 7);
return (s);
}
t_list *ftpf_lstnew_w(wchar_t *data)
{
t_list *item;
item = (t_list *) malloc(sizeof(t_list));
item->content = (wchar_t*) malloc(sizeof(wchar_t));
item->content = data;
item->content_size = sizeof(wchar_t);
return (item);
}
int ft_lstfromwchar(t_pfdata **dt, wchar_t **item)
{
int ilenght;
int ilenghtbck;
ilenght = 0;
while ((*item)[ilenght] > 0 && (*item)[ilenght] != L'\0')
ilenght++;
ilenghtbck = ilenght;
while (--ilenght)
{
ft_lstadd(&(*dt)->data, ftpf_lstnew_w(&(*item)[ilenght]));
}
return (ilenghtbck);
}
\ No newline at end of file
......@@ -6,28 +6,18 @@
/* By: ggenois <ggenois@student.le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/05/19 16:09:47 by ggenois #+# ## ## #+# */
/* Updated: 2018/11/03 22:16:41 by ggenois ### #+. /#+ ###.fr */
/* Updated: 2018/11/03 23:02:50 by ggenois ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "../includes/ft_printf.h"
char *ftpf_strings_null(void)
{
char *s;
s = ft_strnew(7);
ft_memcpy(s, "(null)", 7);
return (s);
}
int ftpf_strings_w(t_pfdata **dt, va_list *data)
{
wchar_t c;
wchar_t *s;
char *tmp;
int i;
int l;
l = 1;
......@@ -39,6 +29,7 @@ int ftpf_strings_w(t_pfdata **dt, va_list *data)
else if ((*dt)->t == 'S' || (*dt)->t == 's')
{
s = va_arg((*data), wchar_t *);
if (s == NULL)
{
tmp = ftpf_strings_null();
......@@ -47,14 +38,7 @@ int ftpf_strings_w(t_pfdata **dt, va_list *data)
}
else
{
i = 0;
while (s[i] >= 0 && s[i] != L'\0')
i++;
l = i;
while (--i >= 0)
ft_lstadd(&(*dt)->data, ft_lstnew(&s[i], sizeof(wchar_t)));
l = ft_lstfromwchar(dt, &s);
}
}
return (l);
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment