From 60733a2298c7a93fe681f78af9b69e1639a791b5 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 14 Oct 2019 16:26:31 +0200 Subject: WIP: format parsing arguments extraction Changed pformat struct, everything is broken --- printer.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'printer.c') diff --git a/printer.c b/printer.c index 043bf23..de36b4e 100644 --- a/printer.c +++ b/printer.c @@ -118,17 +118,17 @@ char *convert_to_str(t_pformat *pformat, va_list ap) t_conversion conversion = pformat->conversion; str = NULL; - if (pformat->min_field_width_wildcard) + if (pformat->min_width.wildcard.exist) { - if (pformat->min_field_width != -1) + if (pformat->min_width != -1) va_arg(ap, int); else { - pformat->min_field_width = va_arg(ap, int); - if (pformat->min_field_width < 0) + pformat->min_width = va_arg(ap, int); + if (pformat->min_width < 0) { pformat->left_adjusted = TRUE; - pformat->min_field_width = -pformat->min_field_width; + pformat->min_width = -pformat->min_width; } } } @@ -172,15 +172,15 @@ void handle_padding(t_pformat *pformat, char *str) int len; int i; - if (pformat->min_field_width == -1) + if (pformat->min_width == -1) return; - if ((len = ft_strlen(str)) >= pformat->min_field_width) + if ((len = ft_strlen(str)) >= pformat->min_width) return; - tmp = (char*)malloc(sizeof(char) * (pformat->min_field_width + 1)); + tmp = (char*)malloc(sizeof(char) * (pformat->min_width + 1)); if (!pformat->left_adjusted) { i = 0; - while (i <= pformat->min_field_width - len) + while (i <= pformat->min_width - len) tmp[i++] = pformat->zero_padding ? '0' : ' '; ft_strcpy(tmp + i - 1, str); ft_strcpy(str, tmp); @@ -189,7 +189,7 @@ void handle_padding(t_pformat *pformat, char *str) { ft_strcpy(tmp, str); i = len; - while (i < pformat->min_field_width) + while (i < pformat->min_width) tmp[i++] = ' '; ft_strcpy(str, tmp); } -- cgit