blob: c636e3231c15445a479a83b3c7075b8aa7b596d0 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* convert_str.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/30 23:22:25 by cacharle #+# #+# */
/* Updated: 2019/10/30 23:22:45 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdarg.h>
#include "libft.h"
#include "header.h"
char *convert_str(va_list ap, t_pformat *pformat)
{
char *str;
str = va_arg(ap, char*);
str = str == NULL ? ft_strdup("(null)") : ft_strdup(str);
if (pformat->precision != -1 && pformat->precision < (int)ft_strlen(str))
str[pformat->precision] = '\0';
str = handle_padding(pformat, str);
return (str);
}
|