aboutsummaryrefslogtreecommitdiff
path: root/test_mini/libft/src/io/ft_printf/internals/convert_char.c
diff options
context:
space:
mode:
authornass1pro <nass1pro@gmail.com>2020-06-12 13:52:58 +0200
committernass1pro <nass1pro@gmail.com>2020-06-13 11:45:50 +0200
commitd971bd8d16608f316396aba7a579d0b1f1af5aeb (patch)
tree98ec558582ed20a120e13b4a376fd206fb620da0 /test_mini/libft/src/io/ft_printf/internals/convert_char.c
parent3136f59540a8dd29e2f096be5a8943e2ddd28431 (diff)
downloadminishell-d971bd8d16608f316396aba7a579d0b1f1af5aeb.tar.gz
minishell-d971bd8d16608f316396aba7a579d0b1f1af5aeb.tar.bz2
minishell-d971bd8d16608f316396aba7a579d0b1f1af5aeb.zip
Added e_token enum
Diffstat (limited to 'test_mini/libft/src/io/ft_printf/internals/convert_char.c')
-rw-r--r--test_mini/libft/src/io/ft_printf/internals/convert_char.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/test_mini/libft/src/io/ft_printf/internals/convert_char.c b/test_mini/libft/src/io/ft_printf/internals/convert_char.c
deleted file mode 100644
index c5f3a93..0000000
--- a/test_mini/libft/src/io/ft_printf/internals/convert_char.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* convert_char.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2019/10/30 23:22:29 by cacharle #+# #+# */
-/* Updated: 2019/11/05 23:44:42 by cacharle ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include "ft_vasprintf.h"
-
-static char *handle_width_char(t_pformat *pformat, char *str)
-{
- char *tmp;
- int i;
-
- pformat->size = 1;
- if (1 >= pformat->width)
- return (str);
- if ((tmp = (char*)malloc(sizeof(char) * (pformat->width + 1))) == NULL)
- return (NULL);
- if (pformat->flags & FLAG_MINUS)
- {
- ft_memcpy(tmp, str, (i = 1) + 1);
- while (i < pformat->width)
- tmp[i++] = ' ';
- tmp[i] = 0;
- }
- else
- {
- i = 0;
- while (i <= pformat->width - 1)
- tmp[i++] = pformat->flags & FLAG_ZERO ? '0' : ' ';
- ft_memcpy(tmp + i - 1, str, 2);
- }
- free(str);
- pformat->size = pformat->width;
- return (tmp);
-}
-
-char *convert_char(va_list ap, t_pformat *pformat)
-{
- char *str;
-
- if ((str = ft_strnew(2)) == NULL)
- return (NULL);
- str[0] = va_arg(ap, int);
- str[1] = '\0';
- return (handle_width_char(pformat, str));
-}