buggy version of the parser. debugging with fsanitizer
This commit is contained in:
48
srcs/lem_in.c
Normal file
48
srcs/lem_in.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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;
|
||||
int fd;
|
||||
|
||||
lm_init_data(&synt, &ldata);
|
||||
if (ac > 1)
|
||||
{
|
||||
if ((fd = open (av[1], O_RDONLY)) < -1)
|
||||
return (lm_error_exit(2));
|
||||
if (lm_parser(fd, &synt, &ldata, &graph))
|
||||
{
|
||||
//the parser was successful in extracting data from the map
|
||||
//here goes the function for making the adjacency list
|
||||
ft_printf("number of ants %d\n", ldata.nbants);
|
||||
ft_printf("start flags status %d, location %d \n", synt.s_cmd, synt.s_pos);
|
||||
ft_printf("end flag status %d, location %d \n", synt.e_cmd, synt.e_pos);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
Reference in New Issue
Block a user