diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-10-14 16:26:31 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-10-14 16:26:31 +0200 |
| commit | 60733a2298c7a93fe681f78af9b69e1639a791b5 (patch) | |
| tree | b1097d7596a7e369ecd12059533da4173967411e /printer.c | |
| parent | 374a9c43da4c2ee0ac19798abc840cd57cb7cf15 (diff) | |
| download | ft_printf-60733a2298c7a93fe681f78af9b69e1639a791b5.tar.gz ft_printf-60733a2298c7a93fe681f78af9b69e1639a791b5.tar.bz2 ft_printf-60733a2298c7a93fe681f78af9b69e1639a791b5.zip | |
WIP: format parsing arguments extraction
Changed pformat struct, everything is broken
Diffstat (limited to 'printer.c')
| -rw-r--r-- | printer.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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); } |
