-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf_putpercent.c
26 lines (24 loc) · 1.22 KB
/
ft_printf_putpercent.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_putpercent.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dnakano <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/11 08:59:45 by dnakano #+# #+# */
/* Updated: 2020/10/18 12:59:51 by dnakano ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdarg.h>
#include "libftprintf.h"
int ft_printf_putpercent(t_printf_flags *flags)
{
if (flags->width == -1)
flags->width = 0;
if (flags->flag & FLAG_LEFTADJUST)
ft_putchar_fd('%', 1);
ft_printf_putpadding(flags->width - 1, flags);
if (!(flags->flag & FLAG_LEFTADJUST))
ft_putchar_fd('%', 1);
return (flags->width ? flags->width : 1);
}