-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_show_str.c
44 lines (39 loc) · 1.5 KB
/
ft_show_str.c
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_show_str.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ccastill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/09 03:43:18 by ccastill #+# #+# */
/* Updated: 2020/07/20 09:00:24 by ccastill ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_check_str(const char *new, t_list_printf *next)
{
char *conver;
conver = ft_substr(new, 0, (next->precision));
ft_putspace(conver, next);
free(conver);
conver = NULL;
}
void ft_show_str(t_list_printf *next)
{
char *new;
char *null;
null = "(null)";
new = next->str;
if (next->str == NULL)
new = null;
else
new = next->str;
if (next->flags >= 0 && next->punt == '.')
ft_check_str(new, next);
else if ((next->flags == 1) || (next->flags == '-') || (next->flags == '*'))
ft_putspace(new, next);
else if (next->flags == '0')
ft_putzero(new, next);
else
ft_putstr_fd(new, 1, next);
}