Merge branch 'master' of https://github.com/jzck/42sh
"with error from 42shelltester"
This commit is contained in:
commit
d3324cacd6
18 changed files with 28 additions and 58 deletions
|
|
@ -109,9 +109,13 @@ int builtin_read(const char *path, char *const av[], char *const envp[])
|
|||
if ((ret = bt_read_init(&data, (char **)av)) != 0)
|
||||
SH_ERR("usage: %s%s", US_READ, US_READ_1);
|
||||
else if ((ret = bt_read_loop(&data)))
|
||||
{
|
||||
;
|
||||
}
|
||||
else if (data.input && (ret = bt_read_assign(&data)))
|
||||
{
|
||||
;
|
||||
}
|
||||
bt_read_exit(&data);
|
||||
return (ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/23 16:25:23 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/24 16:36:39 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:22:12 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -45,7 +45,6 @@ int exec_func(t_btree **ast)
|
|||
t_btree *func_ast;
|
||||
t_list *old_func;
|
||||
|
||||
DG();
|
||||
func_ast = btree_map(*ast, &node_copy);
|
||||
if ((old_func = is_already_func(&func_ast)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/24 15:51:24 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:22:18 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -36,7 +36,6 @@ int process_redirect(t_process *p)
|
|||
fd_replace(p->fdout, STDOUT);
|
||||
while (redirs)
|
||||
{
|
||||
DG();
|
||||
redir = redirs->content;
|
||||
if (redir->n > 9)
|
||||
return (bad_fd(redir->n));
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/08 00:02:58 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/24 15:54:27 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:22:23 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,7 +19,6 @@ void *redir_copy(void *data)
|
|||
|
||||
if (!data)
|
||||
return (NULL);
|
||||
DG();
|
||||
old = data;
|
||||
new = (t_redir *)ft_memalloc(sizeof(t_redir));
|
||||
new->type = old->type;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/06 22:03:53 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/24 15:59:36 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:22:28 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,7 +21,6 @@ int redirect_great(t_redir *redir)
|
|||
if ((fdold = open(redir->word,
|
||||
O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0)
|
||||
exit(1);
|
||||
DG("%d %d", fdold, fdnew);
|
||||
dup2(fdold, fdnew);
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* job_format_head.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:10:38 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/21 14:55:16 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:22:36 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,6 +20,5 @@ void job_format_head(t_job *j)
|
|||
job_getrank(&rank);
|
||||
crank = j->id == rank[0] ? '+' : ' ';
|
||||
crank = j->id == rank[1] ? '-' : crank;
|
||||
DG("raks [%i:%i]", rank[0], rank[1]);
|
||||
ft_printf("{mag}[%i]%c {eoc}", j->id, crank);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* job_hup_all.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/20 11:37:40 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/24 15:40:55 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:22:42 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,11 +25,9 @@ void job_hup_all(void)
|
|||
while (jlist)
|
||||
{
|
||||
job = jlist->content;
|
||||
DG("gonna SIGHUP %i", job->pgid);
|
||||
builtin_jobs(NULL, NULL, NULL);
|
||||
if (job->pgid != 1)
|
||||
kill(-job->pgid, SIGHUP);
|
||||
DG("after SIGHUP %i", job->pgid);
|
||||
jlist = jlist->next;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/22 16:32:56 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:26:50 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -24,6 +24,7 @@ int put_job_in_foreground(t_job *j, int cont)
|
|||
tcsetattr(STDIN, TCSADRAIN, &j->tmodes);
|
||||
if (kill(-j->pgid, SIGCONT) < 0)
|
||||
DG("kill(SIGCONT) failed");
|
||||
//msg d'erreur a changer ici
|
||||
}
|
||||
job_wait(j->id);
|
||||
if (SH_IS_INTERACTIVE(data_singleton()->opts))
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* sigint_handler.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/10 15:14:47 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/22 18:17:42 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:24:18 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -16,5 +16,4 @@ void sigint_handler(int signo)
|
|||
{
|
||||
(void)signo;
|
||||
set_exitstatus(1, 1);
|
||||
DG("pid:%i got SIGINT", getpid());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* sigttin_handler.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/22 17:22:10 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:24:13 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,5 +15,4 @@
|
|||
void sigttin_handler(int signo)
|
||||
{
|
||||
(void)signo;
|
||||
DG("got SIGTTIN, pid=%i, pgid=%i", getpid(), getpgrp());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 10:30:55 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:23:18 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,5 +15,4 @@
|
|||
void sigttou_handler(int signo)
|
||||
{
|
||||
(void)signo;
|
||||
DG("got SIGTTOU, pid=%i, pgid=%i", getpid(), getpgid(getpid()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/16 20:25:08 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/24 17:07:56 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:15:18 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* token_print.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/22 17:13:31 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:24:09 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,8 +20,6 @@ void token_print(t_list *lst)
|
|||
{
|
||||
if (lst->content)
|
||||
token = lst->content;
|
||||
if (token->type)
|
||||
DG("token : %s data [%s]", read_state(token->type), token->data);
|
||||
lst = lst->next;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/24 17:11:37 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:24:04 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -66,7 +66,6 @@ int main(int ac, char **av, char **env)
|
|||
t_btree *ast;
|
||||
|
||||
g_argv = av;
|
||||
DG("----------------");
|
||||
if (shell_init(ac, av, env) != 0)
|
||||
return (1);
|
||||
token = NULL;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* add_file.c :+: :+: :+: */
|
||||
/* add_redir.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/17 16:39:05 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/24 15:55:55 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:24:01 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -71,7 +71,6 @@ int add_redir_word(t_btree **ast, t_list **lst)
|
|||
|
||||
token = (*lst)->content;
|
||||
node = (*ast)->item;
|
||||
DG("node type is %s", read_state(node->type));
|
||||
if (node->data.cmd.redir)
|
||||
{
|
||||
redir = (ft_lstlast(node->data.cmd.redir))->content;
|
||||
|
|
@ -112,7 +111,6 @@ int add_redir_type(t_btree **ast, t_list **lst)
|
|||
gen_node(ast);
|
||||
token = (*lst)->content;
|
||||
node = (*ast)->item;
|
||||
DG("node type is %s", read_state(node->type));
|
||||
if (!(node->type == TK_IO_NUMBER))
|
||||
{
|
||||
redir_init(token->type, &redir);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/23 16:48:38 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:23:26 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -397,16 +397,3 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state)
|
|||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
** DG("aggregate head %s && sym %s",
|
||||
** read_state(*head), read_state(*new_sym));
|
||||
*/
|
||||
|
||||
/*
|
||||
** DG("MATCH : %s", read_state(g_aggrematch[i].new_sym));
|
||||
*/
|
||||
|
||||
/*
|
||||
** DG("stack after pop: %s", read_state(*head));
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/23 16:48:22 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:23:52 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -1295,7 +1295,3 @@ int eval_sym(t_list **stack, t_sym new_sym)
|
|||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
** DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/20 14:59:23 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/24 17:25:03 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -221,7 +221,6 @@ char *read_state(t_sym current)
|
|||
|
||||
int ft_read_stack(t_sym *stack)
|
||||
{
|
||||
DG("read stack :");
|
||||
while (*stack)
|
||||
DG("%s", read_state(*stack--));
|
||||
return (0);
|
||||
|
|
@ -236,7 +235,5 @@ int ft_show_heredoc_data(t_astnode *node)
|
|||
redir = (node->data.cmd.redir)->content;
|
||||
if (redir->type != TK_DLESS)
|
||||
return (1);
|
||||
DG("heredoc_data=[%s] @ %p", redir->heredoc_data, redir->heredoc_data);
|
||||
DG("redir @ %p", redir);
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue