2023-10-26 16:57:23 +02:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* :::::::: */
|
|
|
|
/* parse.c :+: :+: */
|
|
|
|
/* +:+ */
|
|
|
|
/* By: houtworm <codam@houtworm.net> +#+ */
|
|
|
|
/* +#+ */
|
|
|
|
/* Created: 2023/10/26 16:48:55 by houtworm #+# #+# */
|
2023-10-27 15:18:02 +02:00
|
|
|
/* Updated: 2023/10/27 13:49:00 by djonker ######## odam.nl */
|
2023-10-26 16:57:23 +02:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "../cub3d.h"
|
|
|
|
|
2023-10-26 17:40:01 +02:00
|
|
|
t_varlist ft_parseconfigfile(t_varlist vl, char *filename)
|
2023-10-26 16:57:23 +02:00
|
|
|
{
|
2023-10-26 17:40:01 +02:00
|
|
|
int fd;
|
|
|
|
char *line;
|
|
|
|
|
|
|
|
fd = open(filename, O_RDONLY);
|
|
|
|
if (fd == -1)
|
|
|
|
ft_errorexit("file does not exist", "parseconfigfile", 1);
|
|
|
|
while (get_next_line(fd, &line))
|
2023-10-26 16:57:23 +02:00
|
|
|
{
|
2023-10-26 17:40:01 +02:00
|
|
|
free(line);
|
2023-10-26 16:57:23 +02:00
|
|
|
}
|
2023-10-27 15:18:02 +02:00
|
|
|
vl.map = ft_getmap();
|
2023-10-26 17:40:01 +02:00
|
|
|
return (vl);
|
2023-10-26 16:57:23 +02:00
|
|
|
}
|