update: fixed small errors
This commit is contained in:
parent
f5a8c2be04
commit
d97efa87a7
16 changed files with 59 additions and 140 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/07 18:01:52 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/12 17:52:39 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/10/13 17:35:46 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
#include "me/printf/_internal_printf.h"
|
||||
#include "me/string/string.h"
|
||||
#include "me/types.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void me_printf_append_string(t_const_str to_write, t_usize to_write_len,
|
||||
void *p_args)
|
||||
|
|
@ -31,6 +32,6 @@ void me_printf_write(t_const_str to_write, \
|
|||
t_fprintf_arg *arg;
|
||||
|
||||
arg = (t_fprintf_arg *)p_args;
|
||||
write_fd(arg->fd, (t_u8 *)to_write, to_write_len, NULL);
|
||||
(write_fd(arg->fd, (t_u8 *)to_write, to_write_len, NULL));
|
||||
arg->total_print += to_write_len;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/05 19:55:09 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/12 17:52:43 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/10/13 17:42:02 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,13 +18,18 @@
|
|||
|
||||
t_usize me_vprintf_fd(t_fd *fd, t_const_str fmt, va_list *args)
|
||||
{
|
||||
t_fprintf_arg passthru;
|
||||
t_sprintf_arg passthru;
|
||||
t_string buf;
|
||||
|
||||
if (fd == NULL || fmt == NULL || args == NULL)
|
||||
return (0);
|
||||
passthru.fd = fd;
|
||||
buf = string_new(16);
|
||||
passthru.buffer = &buf;
|
||||
passthru.total_print = 0;
|
||||
me_printf_str_inner(fmt, &me_printf_write, args, (void *)&passthru);
|
||||
me_printf_str_inner(fmt, &me_printf_append_string, args, (void *)&passthru);
|
||||
if (write_fd(fd, (void *)buf.buf, buf.len, NULL))
|
||||
perror("write");
|
||||
string_free(buf);
|
||||
return (passthru.total_print);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/09 14:57:28 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/12 17:52:44 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/10/13 17:41:28 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue