From cae2dfe4d67706fedf471ddaf716eaf4175b4ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Fri, 7 Mar 2025 11:52:28 +0100 Subject: [PATCH] here_doc: basic setup --- Makefile | 1 + src/executing/here_doc/here_doc.c | 13 +++++++++++++ src/executing/here_doc/here_doc.h | 18 ++++++++++++++++++ src/parser/worddesc/worddesc.c | 2 +- src/parser/worddesc/worddesc.h | 4 ++-- src/parser/wordlist/wordlist.h | 7 +++++-- tests/Makefile | 1 + tests/test_here_doc.c | 19 +++++++++++++++++++ 8 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 src/executing/here_doc/here_doc.c create mode 100644 src/executing/here_doc/here_doc.h create mode 100644 tests/test_here_doc.c diff --git a/Makefile b/Makefile index 5a55b5b..79962e8 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ srcs = \ src/env/env_convert.c \ src/env/env_manip.c \ src/env/envp.c \ + src/executing/here_doc/here_doc.c \ src/ft_errno.c \ src/get_command.c \ src/parser/command_list/command_list_builder.c \ diff --git a/src/executing/here_doc/here_doc.c b/src/executing/here_doc/here_doc.c new file mode 100644 index 0000000..459c222 --- /dev/null +++ b/src/executing/here_doc/here_doc.c @@ -0,0 +1,13 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* here_doc.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: khais +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/03/07 11:42:29 by khais #+# #+# */ +/* Updated: 2025/03/07 11:42:36 by khais ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "here_doc.h" diff --git a/src/executing/here_doc/here_doc.h b/src/executing/here_doc/here_doc.h new file mode 100644 index 0000000..d4f30c8 --- /dev/null +++ b/src/executing/here_doc/here_doc.h @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* here_doc.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: khais +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/03/07 11:41:27 by khais #+# #+# */ +/* Updated: 2025/03/07 11:42:19 by khais ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef HERE_DOC_H +# define HERE_DOC_H + +# include "../../parser/worddesc/worddesc.h" + +#endif // HERE_DOC_H diff --git a/src/parser/worddesc/worddesc.c b/src/parser/worddesc/worddesc.c index 6058601..198992f 100644 --- a/src/parser/worddesc/worddesc.c +++ b/src/parser/worddesc/worddesc.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/02/13 17:20:36 by khais #+# #+# */ -/* Updated: 2025/03/09 12:36:22 by khais ### ########.fr */ +/* Updated: 2025/03/11 11:13:33 by khais ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/parser/worddesc/worddesc.h b/src/parser/worddesc/worddesc.h index 61218cc..e3c4e2e 100644 --- a/src/parser/worddesc/worddesc.h +++ b/src/parser/worddesc/worddesc.h @@ -5,8 +5,8 @@ /* +:+ +:+ +:+ */ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/02/13 15:47:58 by khais #+# #+# */ -/* Updated: 2025/03/09 12:36:05 by khais ### ########.fr */ +/* Created: 2025/03/11 11:13/50 by khais #+# #+# */ +/* Updated: 2025/03/11 11:13:50 by khais ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/parser/wordlist/wordlist.h b/src/parser/wordlist/wordlist.h index 13b6e36..6a04bc6 100644 --- a/src/parser/wordlist/wordlist.h +++ b/src/parser/wordlist/wordlist.h @@ -5,8 +5,8 @@ /* +:+ +:+ +:+ */ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/02/13 15:46:02 by khais #+# #+# */ -/* Updated: 2025/03/10 14:27:27 by khais ### ########.fr */ +/* Created: 2025/03/11 11:14:10 by khais #+# #+# */ +/* Updated: 2025/03/11 11:14:32 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -43,5 +43,8 @@ void wordlist_debug(t_wordlist *wordlist); t_wordlist *wordlist_copy(const t_wordlist *wordlist); void wordlist_destroy_idx(t_wordlist **wordlist, int idx); t_worddesc *wordlist_pop_idx(t_wordlist **wordlist, int idx); +int wordlist_size(t_wordlist *wordlist); +t_wordlist *wordlist_last(t_wordlist *list); +t_wordlist *wordlist_get_elem(t_wordlist *list, int idx); #endif diff --git a/tests/Makefile b/tests/Makefile index 8391cd7..0bffde6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,6 +1,7 @@ # make gets confused if a file with the same name exists in the sources, so some # file are prefixed with test_ rawtests = \ + test_here_doc \ test_wordlist_idx \ test_redirection_parsing \ quote_removal \ diff --git a/tests/test_here_doc.c b/tests/test_here_doc.c new file mode 100644 index 0000000..ca41eeb --- /dev/null +++ b/tests/test_here_doc.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* test_here_doc.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: khais +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/03/07 11:43:32 by khais #+# #+# */ +/* Updated: 2025/03/10 18:21:43 by khais ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "testutil.h" +#include "libft.h" +#include +int main(void) { + return (0); +}