49 lines
1.7 KiB
C
49 lines
1.7 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* lem_in.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2019/03/25 06:31:05 by mndhlovu #+# #+# */
|
|
/* Updated: 2019/03/25 06:31:09 by mndhlovu ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "lem_in.h"
|
|
|
|
int lm_error_exit(int flag)
|
|
{
|
|
if (flag == 0)
|
|
ft_printf("Invalid Map\n");
|
|
if (flag == 1)
|
|
ft_printf("Usage ./lem_in < map-file\n");
|
|
if (flag == 2)
|
|
ft_printf("Error opening the Map file\n");
|
|
return (1);
|
|
}
|
|
|
|
int main(int ac, char **av)
|
|
{
|
|
t_syntax synt;
|
|
//t_graph graph;
|
|
t_lmdata ldata;
|
|
t_holder holder;
|
|
int fd;
|
|
|
|
if (ac == 2)
|
|
{
|
|
if ((fd = open (av[1], O_RDONLY)) < -1)
|
|
return (lm_error_exit(2));
|
|
lm_init_data(&synt, &ldata, &holder);
|
|
lm_parser(fd, &synt, &ldata, &holder);
|
|
if (lm_validate(&synt, &ldata))
|
|
{
|
|
//validation works
|
|
ft_printf("Success\n");
|
|
}
|
|
else
|
|
ft_printf("Fail\n");
|
|
}
|
|
return (0);
|
|
} |