diff --git a/Filelist.sh.mk b/Filelist.sh.mk index 562390d1..f586bc95 100644 --- a/Filelist.sh.mk +++ b/Filelist.sh.mk @@ -1,8 +1,8 @@ SRC_FILES = \ -_env_norm_helper \ -_helper_main \ env \ +_env_norm_helper \ ft_exit \ +_helper_main \ main \ node/node \ signal_handler \ diff --git a/allocator/Filelist.aq.mk b/allocator/Filelist.aq.mk index ead60e1c..63698d77 100644 --- a/allocator/Filelist.aq.mk +++ b/allocator/Filelist.aq.mk @@ -9,11 +9,11 @@ me_alloc/merge_blocks \ me_alloc/pages \ me_alloc/realloc \ vg/dummy_block \ -vg/dummy_mem_status \ vg/dummy_mempool \ vg/dummy_mempool_bis \ +vg/dummy_mem_status \ vg/valgrind_block \ -vg/valgrind_mem_status \ vg/valgrind_mempool \ vg/valgrind_mempool_bis \ +vg/valgrind_mem_status \ diff --git a/ast/Filelist.ast.mk b/ast/Filelist.ast.mk index 00c506a1..327e50c7 100644 --- a/ast/Filelist.ast.mk +++ b/ast/Filelist.ast.mk @@ -1,8 +1,4 @@ SRC_FILES = \ -_here_doc \ -_not_done_boucle_print \ -_not_done_function \ -_not_done_scripting_print \ ast_alloc/ast_alloc \ ast_alloc/ast_alloc_scripting \ ast_free/ast_free \ @@ -23,6 +19,10 @@ from_node/other_node \ from_node/redirect_node \ from_node/scripting_node \ from_node/string_node \ +_here_doc \ +_not_done_boucle_print \ +_not_done_function \ +_not_done_scripting_print \ print_ast/ast_print \ print_ast/ast_print_arithmetic \ print_ast/ast_print_command \ diff --git a/exec/Filelist.exec.mk b/exec/Filelist.exec.mk index 694e0d16..05d8f824 100644 --- a/exec/Filelist.exec.mk +++ b/exec/Filelist.exec.mk @@ -1,33 +1,34 @@ SRC_FILES = \ -builtins/_debug \ builtins/cd \ +builtins/_debug \ builtins/echo \ builtins/env \ builtins/exit \ builtins/export \ builtins/pwd \ builtins/unset \ -run_arithmetic/_get_op \ -run_arithmetic/_run_arith \ -run_arithmetic/_to_ast_node \ +_read_dir \ run_arithmetic/arithmetic \ run_arithmetic/arithmetic_operation \ +run_arithmetic/_get_op \ run_arithmetic/operator_bis \ +run_arithmetic/_run_arith \ +run_arithmetic/_to_ast_node \ run_ast/_ast_into_str \ run_ast/_ast_into_str2 \ run_ast/_ast_into_str3 \ run_ast/_ast_into_str4 \ -run_ast/_run_exit_code \ -run_ast/_run_exp_operators \ -run_ast/_spawn_cmd \ run_ast/run_builtins \ run_ast/run_cmd_sub \ run_ast/run_command \ +run_ast/_run_exit_code \ run_ast/run_expansion \ run_ast/run_expansion_builtin \ +run_ast/_run_exp_operators \ run_ast/run_list \ run_ast/run_pipeline \ run_ast/run_program \ run_ast/run_subshell \ run_ast/run_words \ +run_ast/_spawn_cmd \ diff --git a/exec/src/_read_dir.c b/exec/src/_read_dir.c new file mode 100644 index 00000000..746554f9 --- /dev/null +++ b/exec/src/_read_dir.c @@ -0,0 +1,73 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* _read_dir.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/09/17 21:43:33 by rparodi #+# #+# */ +/* Updated: 2024/09/17 22:39:54 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include +#include "app/env.h" +#include "exec/_run_ast.h" +#include "me/fs/fs.h" +#include "me/os/os.h" +#include "me/str/str.h" +#include +#include +#include +#include "line/line.h" +#include "me/string/string.h" +#include "me/types.h" +#include "me/vec/vec_str.h" +#include "exec/builtins.h" +#include "me/printf/printf.h" +#include "me/string/string.h" +#include "me/types.h" + +/** + * @brief the pushing files on vector + * + * @param path path to parse + * @param out the return value + * @return ERROR (1) / NO_ERROR (0) + */ +t_error listing_files(t_string path, t_vec_str *out) +{ + DIR *tmp; + struct dirent *entry; + + tmp = opendir(path.buf); + if (tmp == NULL) + return (ERROR); + while ((entry = readdir(tmp)) != NULL) + vec_str_push(out, entry->d_name); + return (NO_ERROR); +} + +/** + * @brief list all files in the current directory + * + * @param out the return value + * @return ERROR (1) / NO_ERROR (0) + */ +t_error list_files_in_current_directory(t_vec_str *out) +{ + t_vec_str *tmp; + t_string path; + + (void)out; + tmp = NULL; + while (getcwd(path.buf, path.capacity - 1) == NULL) + if (errno == ERANGE) + string_reserve(&path, path.capacity * 3); + if (!listing_files(path, tmp)) + return (NO_ERROR); + return (out = tmp, NO_ERROR); +} diff --git a/line/Filelist.line.mk b/line/Filelist.line.mk index 4d84cc2e..2c93bfb5 100644 --- a/line/Filelist.line.mk +++ b/line/Filelist.line.mk @@ -2,11 +2,11 @@ SRC_FILES = \ line \ line_edit_actions \ line_edit_actions2 \ +line_editing \ +line_editing2 \ line_edit_mode \ line_edit_mode_interal \ line_edit_mode_specific_key \ -line_editing \ -line_editing2 \ line_globals \ line_history \ line_internals \ diff --git a/stdme/Filelist.me.mk b/stdme/Filelist.me.mk index 03b7c42f..7f234e90 100644 --- a/stdme/Filelist.me.mk +++ b/stdme/Filelist.me.mk @@ -35,10 +35,10 @@ fs/fs_internal \ fs/getters \ fs/putfd \ gnl/get_next_line \ +hash/hasher \ hash/hash_signed \ hash/hash_str \ hash/hash_unsigned \ -hash/hasher \ hash/sip/sip13 \ hash/sip/sip_utils \ hash/sip/sip_utils2 \ @@ -86,6 +86,10 @@ printf/printf \ printf/printf_fd \ printf/printf_str \ printf/vprintf \ +string/mod \ +string/string_insert \ +string/string_remove \ +string/string_reserve \ str/str_clone \ str/str_compare \ str/str_find_chr \ @@ -102,10 +106,6 @@ str/str_n_find_str \ str/str_split \ str/str_substring \ str/str_trim \ -string/mod \ -string/string_insert \ -string/string_remove \ -string/string_reserve \ GEN_FILES = \ convert/i16_to_str \