This commit is contained in:
Jack Halford 2017-03-24 15:31:00 +01:00
commit 01daa9995e
12 changed files with 21 additions and 40 deletions

View file

@ -6,7 +6,7 @@
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
# Updated: 2017/03/24 12:02:21 by gwojda ### ########.fr #
# Updated: 2017/03/24 14:53:07 by ariard ### ########.fr #
# #
# **************************************************************************** #
@ -65,7 +65,6 @@ completion/c_terminal.c\
completion/completion.c\
exec/ast_free.c\
exec/bad_fd.c\
exec/error_badidentifier.c\
exec/exec_ampersand.c\
exec/exec_and_if.c\
exec/exec_bang.c\

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
/* Updated: 2017/03/23 16:27:10 by ariard ### ########.fr */
/* Updated: 2017/03/24 14:47:12 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -166,8 +166,6 @@ void *redir_copy(void *data);
void redir_free(void *data, size_t content_size);
char **token_to_argv(t_ld *ld, int do_match);
int error_badidentifier(char *name);
t_btree *is_function(t_process *p);
/*

View file

@ -1,5 +1,8 @@
case van in
( "bus" ) echo Hello world ;;
( "velo" ) echo Comment va ;;
( "van" ) ls ;;
( "van" ) case tutu in
( toto ) pwd ;;
( tutu ) ls ;;
esac ;;
esac

View file

@ -1,21 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error_badidentifier.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/06 18:03:51 by ariard #+# #+# */
/* Updated: 2017/03/06 18:11:26 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int error_badidentifier(char *name)
{
ft_putstr_fd("`", 2);
ft_putstr(name);
ft_putstr_fd("' not a valid identifier", 2);
return (1);
}

View file

@ -6,12 +6,14 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/15 00:49:20 by wescande #+# #+# */
/* Updated: 2017/03/22 22:20:02 by ariard ### ########.fr */
/* Updated: 2017/03/24 14:52:00 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
#define FORERR_0 ": `%s' not a valid identifier"
int plaunch_for(t_process *p)
{
t_ld *temp;
@ -22,7 +24,7 @@ int plaunch_for(t_process *p)
temp = p->data.d_for.token;
var = ((char **)temp->content)[0];
if (!word_is_assignment(temp->content))
return (error_badidentifier(var));
return (SH_ERR(FORERR_0, var));
i = 0;
av = token_to_argv(temp, 1);
while (av[++i])

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/26 00:07:05 by ariard #+# #+# */
/* Updated: 2017/03/22 16:38:44 by gwojda ### ########.fr */
/* Updated: 2017/03/24 15:01:55 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -39,6 +39,7 @@ static int recognization_rvwords(t_token *pv_tk, t_token *at_tk)
|| pv_tk->type == TK_ELIF || pv_tk->type == TK_ELSE
|| pv_tk->type == TK_DSEMI || pv_tk->type == TK_PAREN_OPEN
|| pv_tk->type == TK_LBRACE || pv_tk->type == TK_UNTIL)
|| pv_tk->type == TK_PAREN_CLOSE
|| (pv_tk->type == TK_PAREN_CLOSE && at_tk->type == TK_PAREN_OPEN));
}

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/20 19:12:50 by ariard #+# #+# */
/* Updated: 2017/03/23 17:25:03 by ariard ### ########.fr */
/* Updated: 2017/03/24 14:49:17 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
/* Updated: 2017/03/24 15:26:50 by jhalford ### ########.fr */
/* Updated: 2017/03/24 15:30:51 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/04 20:42:13 by ariard #+# #+# */
/* Updated: 2017/03/22 15:30:25 by ariard ### ########.fr */
/* Updated: 2017/03/24 15:17:40 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -62,12 +62,12 @@ int add_case_cmd(t_btree **ast, t_list **lst)
node->nest++;
if (token->type == TK_ESAC && (node->type == TK_PAREN_OPEN
|| node->type == TK_CASE) && node->nest > 0)
return ((node->nest--));
node->nest--;
else if (token->type == TK_DSEMI && node->type == TK_PAREN_OPEN
&& node->nest == 0)
return ((node->full = 1));
else if ((token->type == TK_ESAC)
&& node->nest == 0)
else if ((token->type == TK_ESAC) && node->nest == 0
&& (node->type == TK_CASE || node->type == TK_PAREN_OPEN))
return ((node->full = 1));
else if (token->type == TK_PAREN_CLOSE)
return (0);

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 18:32:59 by ariard #+# #+# */
/* Updated: 2017/03/23 16:49:18 by ariard ### ########.fr */
/* Updated: 2017/03/24 15:01:36 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -84,7 +84,6 @@ int build_tree(t_btree **ast, t_list **lst)
i = 0;
token = (*lst)->content;
check_cache(token, cache);
DG("new");
while (g_treematch[i].type)
{
if ((isseparator(token, cache) && g_treematch[i].type == token->type))

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 16:17:38 by ariard #+# #+# */
/* Updated: 2017/03/18 19:18:34 by ariard ### ########.fr */
/* Updated: 2017/03/24 15:18:51 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 18:57:44 by ariard #+# #+# */
/* Updated: 2017/03/21 15:46:51 by jhalford ### ########.fr */
/* Updated: 2017/03/24 15:00:14 by ariard ### ########.fr */
/* */
/* ************************************************************************** */