-
Notifications
You must be signed in to change notification settings - Fork 1
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 #133 from Haliris/err_msg_spaceadd
Fixed err message and Leak from orphaned pipe token
- Loading branch information
Showing
9 changed files
with
24 additions
and
22 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: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/07/18 10:00:44 by bthomas #+# #+# */ | ||
/* Updated: 2024/07/28 14:17:06 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 14:16:22 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -18,7 +18,7 @@ void call_env(t_data *data, char **command) | |
|
||
if (command[1]) | ||
{ | ||
ft_putstr_fd("env: '", 2); | ||
ft_putstr_fd("env: \'", 2); | ||
ft_putstr_fd(command[1], 2); | ||
ft_putstr_fd("\': Permission denied.\n", 2); | ||
return ; | ||
|
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: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/07/12 20:32:33 by bthomas #+# #+# */ | ||
/* Updated: 2024/07/29 12:05:18 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 15:18:38 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -19,6 +19,8 @@ static bool invalid_key(char *s) | |
i = 0; | ||
while (s && s[i]) | ||
{ | ||
if (i == 0 && !ft_isalpha(s[i])) | ||
return (true); | ||
if (invalid_path_char(s[i])) | ||
return (true); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/07/20 12:36:56 by bthomas #+# #+# */ | ||
/* Updated: 2024/07/29 13:41:33 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 14:12:46 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
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: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/07/25 10:40:12 by bthomas #+# #+# */ | ||
/* Updated: 2024/07/29 10:24:50 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 14:44:11 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
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: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/07/07 11:46:10 by bthomas #+# #+# */ | ||
/* Updated: 2024/07/25 17:45:55 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 14:56:59 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -25,16 +25,14 @@ t_tokentype get_last_tk_type(t_data *data) | |
t_token *get_token(t_data *data, char *lexstr, char *path, t_tokentype type) | ||
{ | ||
t_token *token; | ||
t_token *last; | ||
|
||
if (type == TK_PIPE) | ||
last = lex_get_last_token(data); | ||
if (last && last->type == TK_PIPE && lexstr && *lexstr == '|') | ||
{ | ||
if (!data->token) | ||
return (free(lexstr), NULL); | ||
token = data->token; | ||
while (token->next) | ||
token = token->next; | ||
if (token->type == TK_PIPE || token->type == TK_REDIR) | ||
return (free(lexstr), NULL); | ||
free(lexstr); | ||
lexstr = NULL; | ||
return (NULL); | ||
} | ||
token = ft_calloc(1, sizeof(t_token)); | ||
if (!token) | ||
|
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: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/06/28 17:48:06 by bento #+# #+# */ | ||
/* Updated: 2024/07/28 16:14:06 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 14:56:01 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -119,9 +119,9 @@ int lexer(t_data *data) | |
|
||
input_len = ft_strlen(data->input); | ||
if (build_tokenlist1(data, input_len)) | ||
return (1); | ||
return (LEXER_ERROR); | ||
if (invalid_tokens(data)) | ||
return (1); | ||
return (LEXER_ERROR); | ||
if (build_heredocs(data) == PANIC) | ||
{ | ||
unlink_heredocs(data); | ||
|
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: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/07/07 16:48:14 by bthomas #+# #+# */ | ||
/* Updated: 2024/07/29 13:41:11 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 14:41:07 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
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: bthomas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/07/10 12:26:40 by bthomas #+# #+# */ | ||
/* Updated: 2024/07/29 12:00:47 by bthomas ### ########.fr */ | ||
/* Updated: 2024/07/29 14:36:25 by bthomas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -41,7 +41,8 @@ static bool is_orphaned_op(t_token *token) | |
is_echo = false; | ||
if (token->type == TK_BUILTIN && ft_strcmp("echo", token->lexstr) == 0) | ||
is_echo = true; | ||
if (token->type == TK_PIPE && (!token->prev || !token->next)) | ||
if (token->type == TK_PIPE && ((!token->prev || !token->next) | ||
|| token->next->type == TK_PIPE)) | ||
return (true); | ||
if (token->type == TK_OPERATOR && !next && !is_echo | ||
&& !in_builtin(token, "export")) | ||
|