-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
52 lines (46 loc) · 1.49 KB
/
main.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: naqua <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/06 15:22:22 by hirebbec #+# #+# */
/* Updated: 2022/07/12 17:29:14 by naqua ### ########.fr */
/* */
/* ************************************************************************** */
#include "./include/cub3d.h"
void ft_argc_num_checker(int argc)
{
if (argc != 2)
{
ft_putendl_fd("Error\nWrong number of arguments", 2);
exit(1);
}
}
void ft_argv_checker(char *argv)
{
int len;
int fd;
len = 0;
while (argv[len])
len++;
if (argv[len - 1] != 'b' || argv[len - 2] != 'u' || argv[len - 3] != 'c'
|| argv[len - 4] != '.')
{
ft_putendl_fd("Error\nWrong file", 2);
exit(1);
}
fd = open(argv, O_RDONLY);
if (fd == -1)
{
ft_putendl_fd("Error\nCannot read file or file does not exist", 2);
exit(1);
}
}
int main(int argc, char **argv)
{
t_game game;
init(argc, argv, &game);
raycast(&game);
}