-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes_input.c
72 lines (64 loc) · 1.12 KB
/
types_input.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
69
70
71
72
#include "lem_in.h"
int type_num_ants(char *str)
{
if (if_is_digit_str(str))
if (count_ants(str))
return (1);
return (0);
}
int type_room(char *str)
{
char **s;
unsigned long int len;
if (!str)
return (0);
s = ft_strsplit(str, ' ');
len = two_dem_strlen(s) - 1;
if (len != 3)
{
free_twodem_str(s);
return (0);
}
if (if_is_alnum_str(s[0]))
{
if (if_is_digit_sign_str(s[1]) && if_is_digit_sign_str(s[2]))
{
if (limit_int(atoi_lemin(s[1])) && limit_int(atoi_lemin(s[2])))
{
free_twodem_str(s);
return (1);
}
}
}
free_twodem_str(s);
return (0);
}
int type_start_end(char *str)
{
if (!strcmp(str, "##start") || !strcmp(str, "##end"))
return (1);
return (0);
}
int type_connect(char *str)
{
char **s;
unsigned long int len;
s = ft_strsplit(str, '-');
len = two_dem_strlen(s) - 1;
if (len == 2)
{
if (if_is_alnum_str(s[0]) || if_is_alnum_str(s[1]))
{
free_twodem_str(s);
return (1);
}
}
free_twodem_str(s);
return (0);
}
int type_comment(char *str)
{
if (*str == '#' && (ft_strcmp(str, "##start") && ft_strcmp(str, "##end")))
return (1);
return (0);
}