-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from LeaYeh/feat-executor-expansion
[FEAT] Apply expansion during executing command
- Loading branch information
Showing
38 changed files
with
505 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# By: ldulling <[email protected]> +#+ +:+ +#+ # | ||
# +#+#+#+#+#+ +#+ # | ||
# Created: 2023/12/23 03:22:46 by ldulling #+# #+# # | ||
# Updated: 2024/01/06 13:17:59 by ldulling ### ########.fr # | ||
# Updated: 2024/01/18 23:33:23 by ldulling ### ########.fr # | ||
# # | ||
# **************************************************************************** # | ||
|
||
|
@@ -46,7 +46,7 @@ MAKEFLAGS := -j -s | |
# Files | ||
|
||
# TODO: need to remove forbidden wildcard | ||
SRC := $(wildcard source/*.c source/*/*.c source/*/*/*.c tests/*.c) | ||
SRC := $(wildcard source/*.c source/*/*.c source/*/*/*.c source/*/*/*/*.c tests/*.c) | ||
OBJ := $(SRC:%.c=$(OBJ_DIR)/%.o) | ||
DEP := $(SRC:%.c=$(DEP_DIR)/%.d) | ||
|
||
|
@@ -148,7 +148,7 @@ endif | |
|
||
# **************************** CUSTOM MESSAGES ******************************* # | ||
|
||
MSG_START := "\e[3mBuilding \e[1;34mCrash \e[0m" | ||
MSG_START := "\e[3mBuilding \e[1;34m🌊rash \e[0;3m... \e[0m" | ||
MSG_PROGRESS := "\e[3m🌊\e[0m" | ||
MSG_SUCCESS := "\e[1;3;36m\nDONE!\n\e[0m" | ||
MSG_NO_CHNG := "\e[3;37mEverything up-to-date!\n\e[0m" | ||
|
@@ -167,3 +167,4 @@ print-% : | |
|
||
# test without env value: env -i | ||
# detect memory leak: valgrind -s --leak-check=full --show-leak-kinds=all --suppressions=./minishell.supp ./minishell | ||
# valgrind -s --leak-check=full --show-leak-kinds=all --track-fds=yes --trace-children=yes --suppressions=./minishell.supp ./minishell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: ldulling <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/12/28 23:25:46 by ldulling #+# #+# */ | ||
/* Updated: 2024/01/06 01:11:29 by ldulling ### ########.fr */ | ||
/* Updated: 2024/01/18 14:08:52 by ldulling ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -19,15 +19,13 @@ enum e_is_open_pair_operations | |
{ | ||
GET = 0, | ||
TOGGLE, | ||
RESET | ||
RESET, | ||
CLEAN | ||
}; | ||
|
||
/* bad_substitution.c */ | ||
bool bad_substitution(char *str); | ||
|
||
/* create_expanded_list.c */ | ||
bool create_expanded_list(t_list **lst, char *dup); | ||
|
||
/* expand_special_param.c */ | ||
bool expand_exit_code(char **str, size_t *i, int exit_code); | ||
|
||
|
@@ -37,12 +35,11 @@ size_t count_var_len(char *str); | |
char *get_replacement(char *var, t_list *env_list); | ||
|
||
/* expander.c */ | ||
bool ft_expander(char **str, t_list **lst, t_shell *shell); | ||
int ft_expander(char *str, t_list **lst, t_shell *shell); | ||
|
||
/* expander_utils.c */ | ||
size_t count_offset(char *str); | ||
size_t count_replace_len(char *str); | ||
void free_and_reset(char *dup, char **str); | ||
bool is_open_pair(unsigned char c, int operation); | ||
void skip_to_dollar_not_in_single_quotes(char *str, size_t *i); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
libraries/libft/src/libft/lists/doubly_linked/ft_lstnew_back_d.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_lstnew_back_d.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: ldulling <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/01/06 20:30:19 by ldulling #+# #+# */ | ||
/* Updated: 2024/01/18 01:13:59 by ldulling ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
/** | ||
* The ft_lstnew_back_d function creates a new node with the provided content | ||
* and adds it to the end of the doubly linked list. | ||
* | ||
* @param lst The address of the list to add the new node to. | ||
* @param content The content to be added to the new node. | ||
* | ||
* @return Returns true if the new node was successfully added, false if | ||
* malloc failed. | ||
* | ||
*/ | ||
bool ft_lstnew_back_d(t_list_d **lst, void *content) | ||
{ | ||
t_list_d *new_node; | ||
|
||
new_node = ft_lstnew_d(content); | ||
if (new_node == NULL) | ||
return (false); | ||
ft_lstadd_back_d(lst, new_node); | ||
return (true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: ldulling <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/09/24 16:05:19 by ldulling #+# #+# */ | ||
/* Updated: 2023/11/27 00:25:51 by ldulling ### ########.fr */ | ||
/* Updated: 2024/01/18 04:48:36 by ldulling ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -16,7 +16,7 @@ t_list_d *ft_lstnew_d(void *content) | |
{ | ||
t_list_d *new_node; | ||
|
||
new_node = malloc(sizeof(t_list_d)); | ||
new_node = (t_list_d *) malloc(sizeof(t_list_d)); | ||
if (new_node == NULL) | ||
return (NULL); | ||
new_node->content = content; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: ldulling <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/09/24 16:05:19 by ldulling #+# #+# */ | ||
/* Updated: 2023/09/24 16:22:04 by ldulling ### ########.fr */ | ||
/* Updated: 2024/01/18 04:48:50 by ldulling ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -16,7 +16,7 @@ t_list *ft_lstnew(void *content) | |
{ | ||
t_list *new_node; | ||
|
||
new_node = malloc(sizeof(t_list)); | ||
new_node = (t_list *) malloc(sizeof(t_list)); | ||
if (new_node == NULL) | ||
return (NULL); | ||
new_node->content = content; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: ldulling <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/09/24 16:08:06 by ldulling #+# #+# */ | ||
/* Updated: 2023/09/24 16:22:06 by ldulling ### ########.fr */ | ||
/* Updated: 2024/01/18 03:43:31 by ldulling ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -17,14 +17,12 @@ int ft_lstsize(t_list *lst) | |
int n; | ||
t_list *cur; | ||
|
||
if (lst == NULL) | ||
return (0); | ||
n = 0; | ||
cur = lst; | ||
while (cur != NULL) | ||
{ | ||
cur = cur->next; | ||
n++; | ||
cur = cur->next; | ||
} | ||
return (n); | ||
} |
Oops, something went wrong.