-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_set_format.c
More file actions
46 lines (42 loc) · 1.41 KB
/
Copy pathft_set_format.c
File metadata and controls
46 lines (42 loc) · 1.41 KB
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
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_set_format.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sujo <sujo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/05/23 16:21:59 by sujo #+# #+# */
/* Updated: 2021/05/23 16:25:29 by sujo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void set_format_star(va_list ap, t_format *info)
{
if (info->dot == 0)
{
info->width = va_arg(ap, int);
if (info->width < 0)
{
info->width *= -1;
info->left = 1;
info->zero = 0;
}
if (info->width == 0)
info->zero = 0;
}
else
{
info->precision = va_arg(ap, int);
if (info->precision < 0)
info->precision = -2;
}
}
void set_format_num(t_format *info, char *str, int *idx)
{
int num;
num = get_number(str, idx);
if (info->dot == 0)
info->width = num;
else
info->precision = num;
}