aboutsummaryrefslogtreecommitdiff
path: root/convert_str.c
diff options
context:
space:
mode:
Diffstat (limited to 'convert_str.c')
-rw-r--r--convert_str.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/convert_str.c b/convert_str.c
index 3cea2dc..c636e32 100644
--- a/convert_str.c
+++ b/convert_str.c
@@ -1,15 +1,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 = va_arg(ap, char*);
+ 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);
}