-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.c
More file actions
48 lines (45 loc) · 1.61 KB
/
Copy pathparse.c
File metadata and controls
48 lines (45 loc) · 1.61 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbarba-v <dbarba-v@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/02 19:22:15 by dbarba-v #+# #+# */
/* Updated: 2026/01/19 10:37:07 by dbarba-v ### ########.fr */
/* */
/* ************************************************************************** */
#include "parse.h"
#include "assemble.h"
#include "cub3d.h"
#include "errors.h"
#include <stdlib.h>
/**
* @brief Validates and retrieves lines from the scene file.
*
* @param argc The number of command-line arguments.
* @param argv The array of command-line arguments.
* @return t_lines* A pointer to a t_lines structure containing the file content,
* or NULL on failure.
*/
t_lines *parse_scene_file(int argc, char **argv)
{
t_lines *lines;
char *filename;
if (argc < 2)
{
error_argc(EXPECTED_ARGC);
return (NULL);
}
filename = join_split(argv, 1);
if (!filename)
return (NULL);
if (validate_file(filename) == EXIT_FAILURE)
{
free(filename);
return (NULL);
}
lines = retrieve_lines(filename);
free(filename);
return (lines);
}