This commit is contained in:
gwojda 2017-03-24 16:59:36 +01:00
parent 05e4ce4c02
commit 57d206d7c7
8 changed files with 21 additions and 25 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */ /* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
/* Updated: 2017/03/24 15:07:50 by gwojda ### ########.fr */ /* Updated: 2017/03/24 16:17:40 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -81,7 +81,7 @@ void process_format(t_list **p, int firstp, int opts);
*/ */
void pprint(t_process *p); void pprint(t_process *p);
int pprint_subshell(t_process *p);; int pprint_subshell(t_process *p);
int pprint_brace(t_process *p); int pprint_brace(t_process *p);
int pprint_while(t_process *p); int pprint_while(t_process *p);
int pprint_if(t_process *p); int pprint_if(t_process *p);

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* types.h :+: :+: :+: */ /* types.h :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */ /* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
/* Updated: 2017/03/22 19:36:55 by jhalford ### ########.fr */ /* Updated: 2017/03/24 16:21:12 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -55,7 +55,7 @@ typedef struct s_ld t_ld;
** Execution types ** Execution types
*/ */
typedef int t_condition; typedef int t_condition;
typedef struct s_job t_job; typedef struct s_job t_job;
typedef struct s_process t_process; typedef struct s_process t_process;
typedef int (t_execf)(const char *path, typedef int (t_execf)(const char *path,
@ -67,8 +67,6 @@ typedef union u_process_data t_process_data;
typedef struct s_process_map t_process_map; typedef struct s_process_map t_process_map;
typedef struct s_data_cond t_data_while; typedef struct s_data_cond t_data_while;
typedef struct s_data_cond t_data_if; typedef struct s_data_cond t_data_if;
typedef struct s_data_cond t_data_if;
/* /*
** Parser types ** Parser types

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* btree_map.c :+: :+: :+: */ /* btree_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 11:50:46 by jhalford #+# #+# */ /* Created: 2017/03/08 11:50:46 by jhalford #+# #+# */
/* Updated: 2017/03/21 15:42:18 by jhalford ### ########.fr */ /* Updated: 2017/03/24 15:49:42 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* error.c :+: :+: :+: */ /* error.c :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/14 16:47:00 by jhalford #+# #+# */ /* Created: 2017/03/14 16:47:00 by jhalford #+# #+# */
/* Updated: 2017/03/24 15:36:34 by jhalford ### ########.fr */ /* Updated: 2017/03/24 16:22:55 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -39,6 +39,7 @@ int error_set(int n, ...)
int ft_perror(char *utility) int ft_perror(char *utility)
{ {
ft_dprintf(2, "{red}%s: %s{eoc}\n", utility ? utility : g_argv[0], g_errmsg); ft_dprintf(2, "{red}%s: %s{eoc}\n", utility ? utility : g_argv[0],
g_errmsg);
return (g_errnum); return (g_errnum);
} }

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/24 15:03:02 by wescande #+# #+# */ /* Created: 2017/03/24 15:03:02 by wescande #+# #+# */
/* Updated: 2017/03/24 15:30:13 by wescande ### ########.fr */ /* Updated: 2017/03/24 16:22:13 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -26,11 +26,8 @@ int builtin_func(const char *path,
if (!argv || !argv[0] || argv[1]) if (!argv || !argv[0] || argv[1])
return (SH_ERR("usage: %s", FUNC_USAGE) ? 1 : 1); return (SH_ERR("usage: %s", FUNC_USAGE) ? 1 : 1);
list = data_singleton()->lst_func; list = data_singleton()->lst_func;
DG();
int toto = 0;
while (list) while (list)
{ {
DG(">>>>>>>%d", toto++);
if (!(ast = list->content)) if (!(ast = list->content))
return (SH_ERR("unexpected error")); return (SH_ERR("unexpected error"));
name = token_to_argv(((t_astnode *)(*ast)->item)->data.cmd.token, 1); name = token_to_argv(((t_astnode *)(*ast)->item)->data.cmd.token, 1);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/20 15:01:45 by jhalford #+# #+# */ /* Created: 2017/01/20 15:01:45 by jhalford #+# #+# */
/* Updated: 2017/03/24 15:10:57 by jhalford ### ########.fr */ /* Updated: 2017/03/24 16:23:51 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -39,7 +39,7 @@ int bt_read_init(t_read *data, char **av)
if (isatty(STDIN)) if (isatty(STDIN))
data->opts |= BT_READ_INTER; data->opts |= BT_READ_INTER;
if (bt_read_terminit(data) < 0) if (bt_read_terminit(data) < 0)
exit (1); exit(1);
if ((cliopts_get(av, g_read_opts, data))) if ((cliopts_get(av, g_read_opts, data)))
return (ft_perror("read")); return (ft_perror("read"));
return (0); return (0);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */ /* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
/* Updated: 2017/03/24 13:51:24 by wescande ### ########.fr */ /* Updated: 2017/03/24 16:27:51 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -92,12 +92,12 @@ int data_init(int ac, char **av)
term_name = "dumb"; term_name = "dumb";
if (tgetent(NULL, term_name) != 1) if (tgetent(NULL, term_name) != 1)
{ {
ft_dprintf(2, "{red}TERM name is not a tty\n{eoc}"); SH_ERR("TERM name is not a tty");
return (-1); return (-1);
} }
if (path_binary_save(av[0])) if (path_binary_save(av[0]))
{ {
ft_dprintf(2, "{red}Failed to resolve binary name\n{eoc}"); SH_ERR("Failed to resolve binary name");
return (-1); return (-1);
} }
return (0); return (0);

View file

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* ::: :::::::: */
/* tree_type.c :+: :+: :+: */ /* ft_putast.c :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 18:18:04 by jhalford #+# #+# */ /* Created: 2016/11/14 18:18:04 by jhalford #+# #+# */
/* Updated: 2017/03/14 22:11:26 by ariard ### ########.fr */ /* Updated: 2017/03/24 16:28:14 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,7 +16,7 @@ char *ft_putast(void *nodein)
{ {
t_astnode *node; t_astnode *node;
node = nodein; node = nodein;
if (node->type == TK_BANG) if (node->type == TK_BANG)
return ("TK_BANG"); return ("TK_BANG");
if (node->type == TK_DSEMI) if (node->type == TK_DSEMI)