diff --git a/42sh/includes/lexer.h b/42sh/includes/lexer.h index a3508bc6..b23aa027 100644 --- a/42sh/includes/lexer.h +++ b/42sh/includes/lexer.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */ -/* Updated: 2017/02/03 13:25:50 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 15:06:59 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/includes/types.h b/42sh/includes/types.h index 72e30a72..9e86571c 100644 --- a/42sh/includes/types.h +++ b/42sh/includes/types.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */ -/* Updated: 2017/02/03 14:54:04 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 15:03:52 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/process_do_redirection.c b/42sh/src/exec/process_do_redirection.c index 2cb1c02b..2246941d 100644 --- a/42sh/src/exec/process_do_redirection.c +++ b/42sh/src/exec/process_do_redirection.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/03 13:46:40 by jhalford #+# #+# */ -/* Updated: 2017/02/03 14:55:44 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 15:01:18 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/ft_lexer.c b/42sh/src/lexer/ft_lexer.c index a0abdd90..78a67328 100644 --- a/42sh/src/lexer/ft_lexer.c +++ b/42sh/src/lexer/ft_lexer.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/02 15:30:59 by jhalford #+# #+# */ -/* Updated: 2017/02/02 15:42:24 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 15:15:13 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,9 +15,18 @@ int ft_lexer(t_list **alst, char **command) { int ret; + char *str; ret = 0; if (!*command) + return (1); + str = *command; + while (ft_is_delim(*str)) + str++; + str = ft_strdup(str); + ft_strdel(command); + *command = str; + if (!*str) ret = 1; else if (ft_tokenize(alst, *command, DEFAULT)) ret = 1; diff --git a/42sh/src/lexer/ft_tokenize.c b/42sh/src/lexer/ft_tokenize.c index cfdfe43d..9da0c518 100644 --- a/42sh/src/lexer/ft_tokenize.c +++ b/42sh/src/lexer/ft_tokenize.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */ -/* Updated: 2017/02/03 13:26:57 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 15:06:52 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_delim.c b/42sh/src/lexer/lexer_delim.c index f0ceb531..e941277f 100644 --- a/42sh/src/lexer/lexer_delim.c +++ b/42sh/src/lexer/lexer_delim.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:58:44 by jhalford #+# #+# */ -/* Updated: 2017/01/26 16:30:43 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 15:15:14 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,7 @@ int lexer_delim(t_list **alst, char *str) { t_token *token; - token = (*alst)->content; + token = *alst ? (*alst)->content : NULL; while (ft_is_delim(*str)) str++; if (token->type) diff --git a/42sh/src/lexer/lexer_sep.c b/42sh/src/lexer/lexer_sep.c index 54f7c20e..ccc4ef59 100644 --- a/42sh/src/lexer/lexer_sep.c +++ b/42sh/src/lexer/lexer_sep.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/30 16:29:57 by jhalford #+# #+# */ -/* Updated: 2017/01/10 14:39:52 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 15:02:07 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */