skeletton untested project
This commit is contained in:
commit
6fc620e8f4
187 changed files with 6584 additions and 0 deletions
52
libft/ft_printf/ft_cases_easy_bonus.c
Executable file
52
libft/ft_printf/ft_cases_easy_bonus.c
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_cases_easy_bonus.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/23 13:03:05 by thrieg #+# #+# */
|
||||
/* Updated: 2025/02/16 19:07:51 by thrieg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../libft.h"
|
||||
#include "ft_printf.h"
|
||||
#include "ft_printf_bonus.h"
|
||||
|
||||
int padding_if_needed_before(
|
||||
t_arglist *arglist,
|
||||
char caller,
|
||||
size_t len,
|
||||
t_vector *vec);
|
||||
int padding_if_needed_after(
|
||||
t_arglist *arglist,
|
||||
char caller,
|
||||
size_t len,
|
||||
t_vector *vec);
|
||||
|
||||
//flag 0 has undefined behavior with c so the minimum width has to be spaces
|
||||
int ft_case_c_bonus(t_vector *vec, va_list *args, t_arglist *arglist)
|
||||
{
|
||||
if (padding_if_needed_before(arglist, 'c', 1, vec) < 0)
|
||||
return (0);
|
||||
if (!ft_vector_pushback(vec, (char)va_arg(*args, int)))
|
||||
return (0);
|
||||
if (padding_if_needed_after(arglist, 'c', 1, vec) < 0)
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int ft_case_percent_bonus(t_vector *vec)
|
||||
{
|
||||
if (!ft_vector_pushback(vec, '%'))
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int ft_case_d_bonus(t_vector *vec, va_list *args, t_arglist *arglist);
|
||||
|
||||
int ft_case_i_bonus(t_vector *vec, va_list *args, t_arglist *arglist)
|
||||
{
|
||||
return (ft_case_d_bonus(vec, args, arglist));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue