28 lines
1.2 kB
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* print_c_bonus.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: mleitao <mleitao@student.42.fr> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2026/03/31 01:38:40 by mleitao #+# #+# */
9/* Updated: 2026/05/02 01:02:18 by mleitao ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "printers_bonus.h"
14#include "utils.h"
15
16int print_c(t_data *d, char c)
17{
18 if (!d->format.minus)
19 if (apply_width(d, 1) < 0)
20 return (-1);
21 if (putnchar(c, 1) != 1)
22 return (-1);
23 d->chars_written++;
24 if (d->format.minus)
25 if (apply_width(d, 1) < 0)
26 return (-1);
27 return (0);
28}