rectif exec of script + rectif job_control+ MOTHER FUCKER YEAH
This commit is contained in:
parent
aebb4f7613
commit
84bf7575c2
15 changed files with 54 additions and 28 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 16:07:29 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 00:45:28 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ union u_process_data
|
||||||
struct s_data_tree function;
|
struct s_data_tree function;
|
||||||
struct s_data_cond d_while;
|
struct s_data_cond d_while;
|
||||||
struct s_data_cond d_until;
|
struct s_data_cond d_until;
|
||||||
struct s_data_cond d_if;
|
struct s_data_tree d_if;
|
||||||
struct s_data_list d_for;
|
struct s_data_list d_for;
|
||||||
struct s_data_list d_case;
|
struct s_data_list d_case;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */
|
/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 10:35:37 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 02:11:31 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
# include "glob.h"
|
# include "glob.h"
|
||||||
# include "completion.h"
|
# include "completion.h"
|
||||||
# include "hash.h"
|
# include "hash.h"
|
||||||
|
/* # define malloc(x) NULL */
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
# define DEBUG_MODE 0
|
# define DEBUG_MODE 0
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/15 13:12:06 by jhalford #+# #+# */
|
/* Created: 2016/11/15 13:12:06 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 21:18:01 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 01:17:07 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -43,7 +43,6 @@ static int ft_loop_read(int fd, char **line, char *save)
|
||||||
|
|
||||||
while ((ret = read(fd, buf, BUFF_SIZE)) > 0)
|
while ((ret = read(fd, buf, BUFF_SIZE)) > 0)
|
||||||
{
|
{
|
||||||
DG("boucle");
|
|
||||||
buf[ret] = 0;
|
buf[ret] = 0;
|
||||||
tmp = *line;
|
tmp = *line;
|
||||||
if ((pos = ft_strchr(buf, '\n')))
|
if ((pos = ft_strchr(buf, '\n')))
|
||||||
|
|
@ -59,7 +58,6 @@ static int ft_loop_read(int fd, char **line, char *save)
|
||||||
}
|
}
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
DG("GNL ret %i, fd=%i", **line ? 1 : 0, fd);
|
|
||||||
return (**line ? 1 : 0);
|
return (**line ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:14:20 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:14:20 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 20:51:55 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 01:14:41 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -60,10 +60,17 @@ static void env_replace(char ***custom_env, char *arg)
|
||||||
|
|
||||||
static int env_treat_flag(char ***custom_env, char *const *arg[])
|
static int env_treat_flag(char ***custom_env, char *const *arg[])
|
||||||
{
|
{
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
while (*(++*arg))
|
while (*(++*arg))
|
||||||
{
|
{
|
||||||
if (!ft_strcmp(**arg, "-i"))
|
if (!ft_strcmp(**arg, "-i"))
|
||||||
|
{
|
||||||
|
tmp = ft_strjoin("PATH=", ft_getenv(*custom_env, "PATH"));
|
||||||
ft_tabdel(custom_env);
|
ft_tabdel(custom_env);
|
||||||
|
*custom_env = ft_sstradd(NULL, tmp);
|
||||||
|
ft_strdel(&tmp);
|
||||||
|
}
|
||||||
else if (!ft_strcmp(**arg, "-u"))
|
else if (!ft_strcmp(**arg, "-u"))
|
||||||
{
|
{
|
||||||
++*arg;
|
++*arg;
|
||||||
|
|
@ -112,5 +119,6 @@ int builtin_env(const char *path,
|
||||||
else
|
else
|
||||||
pid = command_setoutput(argv, env);
|
pid = command_setoutput(argv, env);
|
||||||
ft_tabdel(&env);
|
ft_tabdel(&env);
|
||||||
|
DG("%d", pid);
|
||||||
return (builtin_return_status(pid, 0));
|
return (builtin_return_status(pid, 0));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
|
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/20 20:41:34 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 01:21:04 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ t_process_map g_process_map[] =
|
||||||
{PROCESS_BRACE, plaunch_brace, pprint_brace, pfree_subshell},
|
{PROCESS_BRACE, plaunch_brace, pprint_brace, pfree_subshell},
|
||||||
{PROCESS_WHILE, plaunch_while, pprint_while, pfree_cond},
|
{PROCESS_WHILE, plaunch_while, pprint_while, pfree_cond},
|
||||||
{PROCESS_UNTIL, plaunch_until, pprint_until, pfree_cond},
|
{PROCESS_UNTIL, plaunch_until, pprint_until, pfree_cond},
|
||||||
{PROCESS_IF, plaunch_if, pprint_if, pfree_cond},
|
{PROCESS_IF, plaunch_if, pprint_if, pfree_subshell},
|
||||||
{PROCESS_FOR, plaunch_for, pprint_for, pfree_list},
|
{PROCESS_FOR, plaunch_for, pprint_for, pfree_list},
|
||||||
{PROCESS_CASE, plaunch_case, pprint_case, pfree_list},
|
{PROCESS_CASE, plaunch_case, pprint_case, pfree_list},
|
||||||
{PROCESS_EMPTY, plaunch_empty, NULL, NULL},
|
{PROCESS_EMPTY, plaunch_empty, NULL, NULL},
|
||||||
|
|
@ -51,5 +51,7 @@ int exec_leaf(t_btree **ast)
|
||||||
job->pgid = 0;
|
job->pgid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
DG("WHY HERE?");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/13 19:09:30 by jhalford #+# #+# */
|
/* Created: 2017/03/13 19:09:30 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 15:50:10 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 00:52:20 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,5 +15,5 @@
|
||||||
int plaunch_brace(t_process *p)
|
int plaunch_brace(t_process *p)
|
||||||
{
|
{
|
||||||
ft_exec(&p->data.brace.content);
|
ft_exec(&p->data.brace.content);
|
||||||
return (ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/15 00:49:20 by wescande #+# #+# */
|
/* Created: 2017/03/15 00:49:20 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/20 15:51:47 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 00:51:01 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -36,5 +36,5 @@ int plaunch_for(t_process *p)
|
||||||
}
|
}
|
||||||
temp = temp->next;
|
temp = temp->next;
|
||||||
}
|
}
|
||||||
return (ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 17:26:53 by wescande #+# #+# */
|
/* Created: 2017/03/07 17:26:53 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/20 15:50:23 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 00:53:01 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,5 +16,6 @@ int plaunch_if(t_process *p)
|
||||||
{
|
{
|
||||||
data_singleton()->exec.attrs &= ~EXEC_IF_BRANCH;
|
data_singleton()->exec.attrs &= ~EXEC_IF_BRANCH;
|
||||||
ft_exec(&p->data.d_if.content);
|
ft_exec(&p->data.d_if.content);
|
||||||
return (ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
/* set_exitstatus(ft_atoi(ft_getenv(data_singleton()->env, "?"))); */
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 00:11:44 by wescande #+# #+# */
|
/* Created: 2017/03/08 00:11:44 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/20 15:50:25 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 00:52:42 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,4 +16,5 @@ int plaunch_subshell(t_process *p)
|
||||||
{
|
{
|
||||||
ft_exec(&p->data.subshell.content);
|
ft_exec(&p->data.subshell.content);
|
||||||
exit(ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
exit(ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/20 15:50:27 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 00:51:39 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -24,5 +24,6 @@ int plaunch_until(t_process *p)
|
||||||
ret = ft_atoi(ft_getenv(data_singleton()->env, "?"));
|
ret = ft_atoi(ft_getenv(data_singleton()->env, "?"));
|
||||||
ft_exec(&p->data.d_until.condition);
|
ft_exec(&p->data.d_until.condition);
|
||||||
}
|
}
|
||||||
return (ret);
|
set_exitstatus(ret, 1);
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/20 15:50:29 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 00:48:16 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -24,5 +24,6 @@ int plaunch_while(t_process *p)
|
||||||
ret = ft_atoi(ft_getenv(data_singleton()->env, "?"));
|
ret = ft_atoi(ft_getenv(data_singleton()->env, "?"));
|
||||||
ft_exec(&p->data.d_while.condition);
|
ft_exec(&p->data.d_while.condition);
|
||||||
}
|
}
|
||||||
return (ret);
|
set_exitstatus(ret, 1);
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/20 20:52:03 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 01:26:45 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -45,8 +45,9 @@ static int do_the_fork_if_i_have_to(t_process *p)
|
||||||
set_exitstatus(1, 1);
|
set_exitstatus(1, 1);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
set_exitstatus(p->map.launch(p), 1);
|
return (p->map.launch(p));
|
||||||
return (0);
|
/* set_exitstatus(p->map.launch(p), 1); */
|
||||||
|
/* return (0); */
|
||||||
}
|
}
|
||||||
return (do_the_muther_forker(p));
|
return (do_the_muther_forker(p));
|
||||||
}
|
}
|
||||||
|
|
@ -58,10 +59,12 @@ int process_launch(t_process *p)
|
||||||
p->state = PROCESS_RUNNING;
|
p->state = PROCESS_RUNNING;
|
||||||
if (!(pid = do_the_fork_if_i_have_to(p)))
|
if (!(pid = do_the_fork_if_i_have_to(p)))
|
||||||
{
|
{
|
||||||
|
DG("NO_FORK");
|
||||||
process_resetfds(p);
|
process_resetfds(p);
|
||||||
process_free(p, 0);
|
process_free(p, 0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
DG("FORK");
|
||||||
p->pid = pid;
|
p->pid = pid;
|
||||||
process_setgroup(p, pid);
|
process_setgroup(p, pid);
|
||||||
if (p->fdin != STDIN)
|
if (p->fdin != STDIN)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/14 19:44:25 by wescande #+# #+# */
|
/* Created: 2017/03/14 19:44:25 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/20 18:16:20 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 01:21:38 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -63,6 +63,7 @@ static void execute_command(char *const av[], char **env)
|
||||||
data->opts &= ~SH_INTERACTIVE;
|
data->opts &= ~SH_INTERACTIVE;
|
||||||
data->opts &= ~SH_OPTS_JOBC;
|
data->opts &= ~SH_OPTS_JOBC;
|
||||||
command = manage_command(av);
|
command = manage_command(av);
|
||||||
|
DG("DO THE EXEC");
|
||||||
if (do_lexer_routine(&token, command))
|
if (do_lexer_routine(&token, command))
|
||||||
{
|
{
|
||||||
ft_dprintf(2, "{red}%s: syntax error in command substitution{eoc}\n",
|
ft_dprintf(2, "{red}%s: syntax error in command substitution{eoc}\n",
|
||||||
|
|
@ -108,6 +109,7 @@ int command_setoutput(char *const av[], char **env)
|
||||||
|
|
||||||
if (!av)
|
if (!av)
|
||||||
return (0);
|
return (0);
|
||||||
|
pid = 0;
|
||||||
if (!(pid = do_the_muther_forker(NULL)))
|
if (!(pid = do_the_muther_forker(NULL)))
|
||||||
execute_command(av, env);
|
execute_command(av, env);
|
||||||
return (pid);
|
return (pid);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 13:54:51 by jhalford #+# #+# */
|
/* Created: 2016/12/13 13:54:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 20:51:59 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 01:30:10 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -24,7 +24,8 @@ int job_addprocess(t_process *p)
|
||||||
job_update_id();
|
job_update_id();
|
||||||
job->id = jobc->current_id;
|
job->id = jobc->current_id;
|
||||||
job->pgid = SH_IS_INTERACTIVE(data_singleton()->opts) ?
|
job->pgid = SH_IS_INTERACTIVE(data_singleton()->opts) ?
|
||||||
p->pid : data_singleton()->jobc.shell_pgid;
|
/* p->pid : data_singleton()->jobc.shell_pgid; */
|
||||||
|
p->pid : getpgid(0);
|
||||||
ft_lstadd(&jobc->first_job, ft_lstnew(job, sizeof(*job)));
|
ft_lstadd(&jobc->first_job, ft_lstnew(job, sizeof(*job)));
|
||||||
}
|
}
|
||||||
job = jobc->first_job->content;
|
job = jobc->first_job->content;
|
||||||
|
|
|
||||||
|
|
@ -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/20 09:57:11 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 01:50:24 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -64,8 +64,15 @@ int data_init(int ac, char **av)
|
||||||
lexer_init(&data->lexer);
|
lexer_init(&data->lexer);
|
||||||
parser_init(&data->parser);
|
parser_init(&data->parser);
|
||||||
if ((term_name = ft_getenv(data->env, "TERM")) == NULL)
|
if ((term_name = ft_getenv(data->env, "TERM")) == NULL)
|
||||||
return (-1);
|
{
|
||||||
|
/* ft_dprintf(2, "{red}TERM not set\n{eoc}"); */
|
||||||
|
term_name = "dumb";
|
||||||
|
/* return (-1); */
|
||||||
|
}
|
||||||
if (tgetent(NULL, term_name) != 1)
|
if (tgetent(NULL, term_name) != 1)
|
||||||
|
{
|
||||||
|
ft_dprintf(2, "{red}TERM name is not a tty\n{eoc}");
|
||||||
return (-1);
|
return (-1);
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue