diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-06-14 21:26:36 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-06-14 21:26:36 +0200 |
| commit | 91d91b0f54ec9795beaf673f20ff87b894a558c4 (patch) | |
| tree | bc6e084703bd677fcf4ca3ee82898688fc3e2ee7 /src/lexer | |
| parent | 47fff4418d3a83ae214429f395232c3536ff03c4 (diff) | |
| download | minishell-91d91b0f54ec9795beaf673f20ff87b894a558c4.tar.gz minishell-91d91b0f54ec9795beaf673f20ff87b894a558c4.tar.bz2 minishell-91d91b0f54ec9795beaf673f20ff87b894a558c4.zip | |
WIP: Added eval cmd with redirection and builtins
Diffstat (limited to 'src/lexer')
| -rw-r--r-- | src/lexer/token.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lexer/token.c b/src/lexer/token.c index 490c7b1..0a13526 100644 --- a/src/lexer/token.c +++ b/src/lexer/token.c @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/09 13:38:08 by charles #+# #+# */ -/* Updated: 2020/06/09 17:55:23 by charles ### ########.fr */ +/* Updated: 2020/06/14 20:51:25 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,10 +16,11 @@ t_token *token_new(enum e_token_tag tag, char *content) { t_token *token; - if (content == NULL - || (token = (t_token*)malloc(sizeof(t_token))) == NULL) + if ((token = (t_token*)malloc(sizeof(t_token))) == NULL) return (NULL); - if ((token->content = ft_strdup(content)) == NULL) + if (content == NULL) + token->content = NULL; + else if ((token->content = ft_strdup(content)) == NULL) { free(token); return (NULL); |
