"brackets resolution"
This commit is contained in:
Antoine Riard 2017-03-22 18:22:22 +01:00
commit 3dd57d8a8e
13 changed files with 21 additions and 20 deletions

View file

@ -6,7 +6,7 @@
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */ /* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/09 02:05:22 by sbenning #+# #+# */ /* Created: 2016/12/09 02:05:22 by sbenning #+# #+# */
/* Updated: 2017/03/16 15:58:25 by jhalford ### ########.fr */ /* Updated: 2017/03/22 17:51:49 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */ /* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */
/* Updated: 2017/03/21 10:02:04 by gwojda ### ########.fr */ /* Updated: 2017/03/22 17:53:46 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */ /* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
/* Updated: 2017/03/22 17:29:24 by ariard ### ########.fr */ /* Updated: 2017/03/22 18:13:32 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 22:04:42 by wescande #+# #+# */ /* Created: 2017/03/07 22:04:42 by wescande #+# #+# */
/* Updated: 2017/03/21 00:51:39 by wescande ### ########.fr */ /* Updated: 2017/03/22 18:04:44 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,6 +18,7 @@ int plaunch_until(t_process *p)
ret = 0; ret = 0;
ft_exec(&p->data.d_until.condition); ft_exec(&p->data.d_until.condition);
/* signal(SIGINT, sigint_handler); */
while (ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0")) while (ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0"))
{ {
ft_exec(&p->data.d_until.content); ft_exec(&p->data.d_until.content);

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 17:20:53 by wescande #+# #+# */ /* Created: 2017/03/07 17:20:53 by wescande #+# #+# */
/* Updated: 2017/03/21 00:48:16 by wescande ### ########.fr */ /* Updated: 2017/03/22 18:01:02 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,6 +18,7 @@ int plaunch_while(t_process *p)
ret = 0; ret = 0;
ft_exec(&p->data.d_while.condition); ft_exec(&p->data.d_while.condition);
signal(SIGINT, sigint_handler);
while (!(ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0"))) while (!(ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0")))
{ {
ft_exec(&p->data.d_while.content); ft_exec(&p->data.d_while.content);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/13 22:21:19 by jhalford #+# #+# */ /* Created: 2017/03/13 22:21:19 by jhalford #+# #+# */
/* Updated: 2017/03/22 16:34:15 by jhalford ### ########.fr */ /* Updated: 2017/03/22 17:52:47 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -17,10 +17,7 @@ int process_fork(t_process *p)
pid_t pid; pid_t pid;
if ((pid = fork()) == -1) if ((pid = fork()) == -1)
{ exit(SH_ERR("fork(): %s", strerror(errno)));
ft_dprintf(3, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
exit(1);
}
else if (pid) else if (pid)
return (pid); return (pid);
if (!p) if (!p)

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/15 11:49:05 by jhalford #+# #+# */ /* Created: 2016/12/15 11:49:05 by jhalford #+# #+# */
/* Updated: 2017/03/22 17:29:38 by jhalford ### ########.fr */ /* Updated: 2017/03/22 17:48:54 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 15:14:47 by jhalford #+# #+# */ /* Created: 2016/12/10 15:14:47 by jhalford #+# #+# */
/* Updated: 2017/01/22 20:56:45 by ariard ### ########.fr */ /* Updated: 2017/03/22 18:04:22 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,5 +15,6 @@
void sigint_handler(int signo) void sigint_handler(int signo)
{ {
(void)signo; (void)signo;
set_exitstatus(1, 1);
DG("pid:%i got SIGINT", getpid()); DG("pid:%i got SIGINT", getpid());
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/05 16:29:35 by jhalford #+# #+# */ /* Created: 2017/03/05 16:29:35 by jhalford #+# #+# */
/* Updated: 2017/03/05 16:29:36 by jhalford ### ########.fr */ /* Updated: 2017/03/22 18:13:49 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,12 +22,13 @@ int lexer_curly_braces(t_list **alst, t_lexer *lexer)
if (lexer->str[lexer->pos] == '{') if (lexer->str[lexer->pos] == '{')
{ {
token->type = TK_LBRACE; token->type = TK_LBRACE;
push(&lexer->stack, PAREN); push(&lexer->stack, CURLY_BRACKETS);
} }
else if (get_lexer_stack(*lexer)) else
{ {
token->type = TK_RBRACE; token->type = TK_RBRACE;
pop(&lexer->stack); if (get_lexer_stack(*lexer) == CURLY_BRACKETS)
pop(&lexer->stack);
} }
lexer->pos++; lexer->pos++;
lexer->state = DEFAULT; lexer->state = DEFAULT;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */ /* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */
/* Updated: 2017/03/20 15:02:05 by jhalford ### ########.fr */ /* Updated: 2017/03/22 18:13:29 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/03 17:37:15 by jhalford #+# #+# */ /* Created: 2017/03/03 17:37:15 by jhalford #+# #+# */
/* Updated: 2017/03/22 17:16:17 by jhalford ### ########.fr */ /* Updated: 2017/03/22 18:13:07 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
/* Updated: 2017/03/22 17:37:32 by jhalford ### ########.fr */ /* Updated: 2017/03/22 17:44:44 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/22 16:07:14 by jhalford #+# #+# */ /* Created: 2017/03/22 16:07:14 by jhalford #+# #+# */
/* Updated: 2017/03/22 16:25:14 by jhalford ### ########.fr */ /* Updated: 2017/03/22 17:49:38 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */