2023-01-31 08:40:15 -05:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_dprintarg.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2022/10/23 18:08:31 by cchauvet #+# #+# */
|
2023-02-14 01:26:18 -05:00
|
|
|
/* Updated: 2023/02/03 12:52:38 by cchauvet ### ########.fr */
|
2023-01-31 08:40:15 -05:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "ft_printf.h"
|
|
|
|
|
|
|
|
int ft_dprintarg(int fd, int arg, va_list args)
|
|
|
|
{
|
|
|
|
if (arg == 'i' || arg == 'd')
|
|
|
|
return (ft_dprintl_base(fd, va_arg(args, int), "0123456789"));
|
|
|
|
if (arg == 'X')
|
|
|
|
return (ft_dprint_upperx(fd, va_arg(args, unsigned int)));
|
|
|
|
if (arg == 'x')
|
|
|
|
return (ft_dprintx(fd, va_arg(args, unsigned int)));
|
|
|
|
if (arg == 'u')
|
|
|
|
return (ft_dprintul(fd, va_arg(args, unsigned int)));
|
|
|
|
if (arg == 'c')
|
|
|
|
return (ft_putchar_fd(fd, va_arg(args, int)));
|
|
|
|
if (arg == 'S')
|
|
|
|
return (ft_dprintstrtab(fd, va_arg(args, char **)));
|
|
|
|
if (arg == 's')
|
2023-02-14 01:26:18 -05:00
|
|
|
return (ft_putstr_fd_p(fd, va_arg(args, char *)));
|
2023-01-31 08:40:15 -05:00
|
|
|
if (arg == '%')
|
|
|
|
return (ft_putchar_fd(fd, '%'));
|
|
|
|
if (arg == 'p')
|
|
|
|
return (ft_dprintptr(fd, va_arg(args, void *)));
|
|
|
|
return (0);
|
|
|
|
}
|