-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_aux.c
68 lines (58 loc) · 1.71 KB
/
ft_aux.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_aux.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afukuhar <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/08/27 11:40:30 by afukuhar #+# #+# */
/* Updated: 2020/09/11 11:42:43 by afukuhar ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
/*
** Walk through string and return the position of first
** occurence of conversion specifier
** the str pointer must be the char right after the %
** int d i
** unsigned int o u x X
** double e E
** double f F
** double g G
** double a A
** int c
** const char * s
** void * p
** int * n
** char %
*/
char *nxt_conv_spec(char *str)
{
char *types;
types = "cspdiuxXnfge%";
while (*str && !ft_strchr(types, *str))
str++;
return (str);
}
/*
** Checks if the current character is a specifier
*/
int is_conv_spec(char c)
{
char *conv_specs;
conv_specs = "cspdiuxXnfge%";
if (ft_strchr(conv_specs, c))
return (1);
return (0);
}
/*
** Checks if the current character is a flag
*/
int is_flag(char c)
{
char *flags;
flags = "#0- +";
if (ft_strchr(flags, c))
return (1);
return (0);
}