-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler_pourcent.c
30 lines (27 loc) · 1.19 KB
/
handler_pourcent.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
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handler_pourcent.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nde-maes <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/23 13:06:31 by nde-maes #+# #+# */
/* Updated: 2019/02/25 10:12:05 by nde-maes ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
char *handle_pourcent(t_dir *cur_dir)
{
char *res;
int width_extension_len;
if (!(res = (char*)malloc(2)))
exit(-1);
res[0] = '%';
res[1] = 0;
if (cur_dir->width > 1)
{
width_extension_len = cur_dir->width - 1;
res = handle_width(res, cur_dir, width_extension_len);
}
return (res);
}