-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
35 lines (31 loc) · 1.3 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcogne-- <mcogne--@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/27 01:33:49 by mcogne-- #+# #+# */
/* Updated: 2024/11/01 07:00:24 by mcogne-- ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
static short map_validate_ext(char *path)
{
size_t len;
len = ft_strlen(path);
if (len < 4)
return (1);
if (ft_strncmp(path + len - 4, ".ber", len) == 0)
return (0);
return (1);
}
int main(int argc, char **argv)
{
if (argc != 2)
ft_msg_put_exrror("Usage: ./so_long [path to map.ber]");
if (map_validate_ext(argv[1]))
ft_msg_put_exrror("Arg: Please use a .ber file");
so_long(argv[1]);
return (0);
}