merge
This commit is contained in:
commit
f8753646e2
36 changed files with 118 additions and 109 deletions
|
|
@ -180,9 +180,9 @@ job_control/job_format_head.c\
|
|||
job_control/job_free.c\
|
||||
job_control/job_getprocess.c\
|
||||
job_control/job_getrank.c\
|
||||
job_control/job_hup_all.c\
|
||||
job_control/job_is_completed.c\
|
||||
job_control/job_is_stopped.c\
|
||||
job_control/job_kill_all.c\
|
||||
job_control/job_notify_change.c\
|
||||
job_control/job_notify_new.c\
|
||||
job_control/job_remove.c\
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* builtin_read.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/20 15:02:39 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/15 19:13:26 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:36:08 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -40,7 +40,8 @@ struct s_read
|
|||
char *input;
|
||||
};
|
||||
|
||||
int builtin_read(const char *path, char *const av[], char *const envp[]);
|
||||
int builtin_read(const char *path, char *const av[],
|
||||
char *const envp[]);
|
||||
|
||||
int bt_read_init(t_read *data, char **av);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/08 16:34:51 by sbenning #+# #+# */
|
||||
/* Updated: 2017/03/15 18:47:56 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:33:06 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/17 17:24:03 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:32:15 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -57,9 +57,6 @@
|
|||
|
||||
# define CORRUPT 1
|
||||
|
||||
//# define STR data_singleton()->line.input
|
||||
//# define POS data_singleton()->line.pos
|
||||
|
||||
# define ERROR_CNTL_R 1
|
||||
|
||||
typedef struct s_list_history
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/17 23:10:35 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:38:24 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ void job_run(t_job *job, int foreground);
|
|||
int job_wait(int id);
|
||||
void job_remove(int id);
|
||||
void job_free(void *content, size_t content_size);
|
||||
void job_kill_all(void);
|
||||
void job_hup_all(void);
|
||||
|
||||
int put_job_in_foreground(t_job *job, int cont);
|
||||
int put_job_in_background(t_job *job, int cont);
|
||||
|
|
@ -79,7 +79,7 @@ void process_format(t_list **p, int firstp, int opts);
|
|||
** Mapping pour afficher les process
|
||||
*/
|
||||
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_while(t_process *p);
|
||||
int pprint_if(t_process *p);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 11:22:08 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:43:04 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -63,9 +63,8 @@ struct s_rvwords
|
|||
int type;
|
||||
};
|
||||
|
||||
extern t_rvwords g_rvwords[];
|
||||
|
||||
extern int (*g_lexer[])(t_list **alst, t_lexer *lexer);
|
||||
/* extern t_rvwords g_rvwords[]; */
|
||||
/* extern int (*g_lexer[])(t_list **alst, t_lexer *lexer); */
|
||||
|
||||
int ft_post_tokenize(t_list **alst, char **str);
|
||||
|
||||
|
|
|
|||
|
|
@ -94,8 +94,6 @@ struct s_treematch
|
|||
int (*add)(t_btree **ast, t_list **lst);
|
||||
};
|
||||
|
||||
extern t_treematch g_treematch[];
|
||||
|
||||
int build_tree(t_btree **ast, t_list **lst);
|
||||
|
||||
int add_sep(t_btree **ast, t_list **lst);
|
||||
|
|
@ -153,7 +151,8 @@ struct s_distrostree
|
|||
int (*add)(t_btree **ast, t_list **lst);
|
||||
};
|
||||
|
||||
extern t_distrostree g_distrostree[];
|
||||
/* extern t_distrostree g_distrostree[]; */
|
||||
/* extern t_treematch g_treematch[]; */
|
||||
|
||||
struct s_redir
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/03 14:57:21 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/08 12:03:14 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:25:42 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,7 +18,9 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *))
|
|||
|
||||
if (!lst)
|
||||
return (NULL);
|
||||
elem = ft_lstnew((*f)(lst->content), lst->content_size);
|
||||
if (!(elem = (t_list *)malloc(sizeof(*elem))))
|
||||
return (NULL);
|
||||
elem->content = (*f)(lst->content);
|
||||
elem->next = ft_lstmap(lst->next, f);
|
||||
return (elem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/29 15:57:38 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/13 15:41:27 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:23:44 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* id.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/20 12:20:59 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 12:21:01 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *id(void *data)
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* bt_read_term.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/25 16:02:05 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/15 21:23:41 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:23:46 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 14:14:20 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 12:52:05 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:43:49 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/18 15:41:42 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:17:40 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -26,15 +26,15 @@ int builtin_exit(const char *path, char *const av[], char *const envp[])
|
|||
if (SH_HAS_JOBC(data_singleton()->opts) && jlist && !notified)
|
||||
{
|
||||
notified = 1;
|
||||
ft_dprintf(2, "{red}%s: you have live jobs (running or suspended).{eoc}\n", SHELL_NAME);
|
||||
ft_dprintf(2, "%s: you have live jobs (running or suspended)\n",
|
||||
data_singleton()->argv[0]);
|
||||
return (0);
|
||||
}
|
||||
if (av && av[1])
|
||||
status = ft_atoi(av[1]);
|
||||
else
|
||||
status = ft_atoi(ft_getenv(data_singleton()->env, "?"));
|
||||
status = (av && av[1]) ?
|
||||
ft_atoi(av[1]) : ft_atoi(ft_getenv(data_singleton()->env, "?"));
|
||||
if (SH_IS_INTERACTIVE(data_singleton()->opts))
|
||||
tcsetattr(STDIN, TCSANOW, &data_singleton()->jobc.shell_tmodes);
|
||||
job_hup_all();
|
||||
data_exit();
|
||||
exit(status);
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/15 11:39:37 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/20 14:01:11 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:44:02 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
static t_cliopts export_opts[] =
|
||||
static t_cliopts g_export_opts[] =
|
||||
{
|
||||
{'p', NULL, BT_EXPORT_LP, 0, NULL},
|
||||
{0, NULL, 0, 0, NULL},
|
||||
|
|
@ -44,23 +44,20 @@ int builtin_export(
|
|||
(void)envp;
|
||||
(void)path;
|
||||
data.flag = 0;
|
||||
if (cliopts_get((char**)av, export_opts, &data))
|
||||
if (cliopts_get((char**)av, g_export_opts, &data))
|
||||
ft_perror();
|
||||
if (data.flag & BT_EXPORT_LP)
|
||||
return (builtin_return_status(0, bt_export_print()));
|
||||
av = data.av_data;
|
||||
while (*av)
|
||||
{
|
||||
if ((equal = ft_strchr(*av, '=')))
|
||||
{
|
||||
equal = ft_strchr(*av, '=');
|
||||
if (equal)
|
||||
*equal = 0;
|
||||
builtin_setenv("internal", (char*[]){"global", *av, equal + 1}, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
equal = ft_getenv(data_singleton()->local_var, *av);
|
||||
equal ? equal++ : equal;
|
||||
builtin_setenv("internal", (char*[]){"global", *av, equal}, NULL);
|
||||
}
|
||||
builtin_unsetenv("internal", (char*[]){"local", *av, NULL}, NULL);
|
||||
av++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/17 18:54:00 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/20 14:14:59 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:45:09 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
# define MATHERR_0 "math : invalid number of arguments\n"
|
||||
# define MATHERR_1 "math : invalid variable name\n"
|
||||
# define MATHERR_2 "math : invalid operator\n"
|
||||
# define MATHERR_3 "math : invalid operand\n"
|
||||
# define MATHERR_4 "math : division by 0\n"
|
||||
#define MATHERR_0 "math : invalid number of arguments\n"
|
||||
#define MATHERR_1 "math : invalid variable name\n"
|
||||
#define MATHERR_2 "math : invalid operator\n"
|
||||
#define MATHERR_3 "math : invalid operand\n"
|
||||
#define MATHERR_4 "math : division by 0\n"
|
||||
|
||||
static int error_msg(char *msg)
|
||||
{
|
||||
|
|
@ -109,6 +109,6 @@ int builtin_math(const char *path, char *const av[], char *const envp[])
|
|||
return (builtin_return_status(0, error_msg(MATHERR_3)));
|
||||
if (do_math(&value, operator, operand))
|
||||
return (builtin_return_status(0, 1));
|
||||
builtin_setenv("setenv", (char *[]){"local", var, value, 0}, data_singleton()->local_var);
|
||||
builtin_setenv("setenv", (char *[]){"local", var, value, 0}, NULL);
|
||||
return (builtin_return_status(0, 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* builtin_read.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/20 15:01:45 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 12:53:06 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:46:56 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ int bt_read_init(t_read *data, char **av)
|
|||
data->timeout = 0;
|
||||
data->input = NULL;
|
||||
if ((cliopts_get(av, g_read_opts, data)))
|
||||
return(ft_perror() ? 2 : 2);
|
||||
return (ft_perror() ? 2 : 2);
|
||||
if (bt_read_terminit(data) < 0)
|
||||
return (-1);
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 08:51:51 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:35:49 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ int exec_reset(void)
|
|||
exec->attrs = 0;
|
||||
exec->job.id = 0;
|
||||
exec->job.pgid = 0;
|
||||
exec->job.attrs = 0;
|
||||
exec->job.attrs = JOB_NOTIFIED;
|
||||
exec->job.first_process = NULL;
|
||||
tcgetattr(STDIN, &exec->job.tmodes);
|
||||
jobc->first_job = NULL;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 10:57:06 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:22:50 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/08 00:02:58 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/13 14:20:56 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:21:26 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/03 18:12:57 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/18 18:59:57 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:21:21 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/26 10:43:16 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/18 14:29:15 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:09:01 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ static void ft_clear_prompt(size_t *pos, size_t srch_pos)
|
|||
ft_puttermcaps("cd");
|
||||
}
|
||||
|
||||
static int ft_surch_and_realloc(char **str, char **str_srch,
|
||||
static int search(char **str, char **str_srch,
|
||||
int ret, size_t *srch_pos)
|
||||
{
|
||||
if (!(*str_srch = ft_realloc_imput(*str_srch, ret, *srch_pos)))
|
||||
|
|
@ -51,7 +51,7 @@ static void ft_give_new_prompt(char *str_srch, size_t srch_pos)
|
|||
}
|
||||
}
|
||||
|
||||
static void ft_modify_str(char *str_srch, size_t srch_pos, char **str,
|
||||
static int ft_modify_str(char *str_srch, size_t srch_pos, char **str,
|
||||
size_t *pos)
|
||||
{
|
||||
ft_clear_prompt(pos, srch_pos);
|
||||
|
|
@ -63,6 +63,7 @@ static void ft_modify_str(char *str_srch, size_t srch_pos, char **str,
|
|||
ft_get_next_str(*str, pos);
|
||||
}
|
||||
free(str_srch);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int ft_surch_in_history(char **str, size_t *pos)
|
||||
|
|
@ -79,8 +80,7 @@ int ft_surch_in_history(char **str, size_t *pos)
|
|||
ft_give_new_prompt(str_srch, srch_pos);
|
||||
ret = 0;
|
||||
read(0, &ret, sizeof(int));
|
||||
if (ft_isprint(ret) &&
|
||||
ft_surch_and_realloc(str, &str_srch, ret, &srch_pos) < 0)
|
||||
if (ft_isprint(ret) && search(str, &str_srch, ret, &srch_pos) < 0)
|
||||
return (-1);
|
||||
else if (!ft_isprint(ret) && ret == 127 && srch_pos)
|
||||
{
|
||||
|
|
@ -92,6 +92,5 @@ int ft_surch_in_history(char **str, size_t *pos)
|
|||
else if (ret != 127 && !ft_isprint(ret))
|
||||
break ;
|
||||
}
|
||||
ft_modify_str(str_srch, srch_pos, str, pos);
|
||||
return (0);
|
||||
return (ft_modify_str(str_srch, srch_pos, str, pos));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/08 14:30:07 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 11:00:49 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:12:16 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -37,7 +37,6 @@ int builtin_fg(const char *path, char *const av[], char *const envp[])
|
|||
}
|
||||
else
|
||||
{
|
||||
DG("rank:%i:%i", rank[0], rank[1]);
|
||||
if ((jlist = ft_lst_find(jobc->first_job, &rank[0], job_cmp_id)))
|
||||
job_run(jlist->content, 1);
|
||||
else if ((jlist = ft_lst_find(jobc->first_job, &rank[1], job_cmp_id)))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 17:43:01 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/08 18:52:24 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:47:48 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 13:01:19 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/18 00:07:12 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:15:50 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -27,8 +27,7 @@ int do_job_notification(void)
|
|||
{
|
||||
j = jlist->content;
|
||||
jlist = jlist->next;
|
||||
if (job_is_completed(j->id)
|
||||
|| (job_is_stopped(j->id) && !(j->attrs & JOB_NOTIFIED)))
|
||||
if ((job_is_stopped(j->id) && !(j->attrs & JOB_NOTIFIED)))
|
||||
{
|
||||
ret = 1;
|
||||
job_notify_change(j->id);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 13:54:51 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 10:57:09 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:32:08 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/09 13:22:16 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:39:38 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* job_kill_all.c :+: :+: :+: */
|
||||
/* job_hup_all.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/08 15:36:56 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/09 16:35:51 by jhalford ### ########.fr */
|
||||
/* Created: 2017/03/20 11:37:40 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 11:37:53 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
void job_kill_all(void)
|
||||
void job_hup_all(void)
|
||||
{
|
||||
t_jobc *jobc;
|
||||
t_list *jlist;
|
||||
|
|
@ -23,7 +23,7 @@ void job_kill_all(void)
|
|||
while (jlist)
|
||||
{
|
||||
job = jlist->content;
|
||||
kill(-job->pgid, SIGKILL);
|
||||
kill(-job->pgid, SIGHUP);
|
||||
jlist = jlist->next;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 15:10:20 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 11:10:14 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:30:44 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 15:06:45 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 11:10:12 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:32:00 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,8 +25,8 @@ int job_is_stopped(int id)
|
|||
while (lst)
|
||||
{
|
||||
p = lst->content;
|
||||
if (!(p->state == PROCESS_COMPLETED)
|
||||
|| !(p->state == PROCESS_SUSPENDED))
|
||||
if (!((p->state == PROCESS_COMPLETED)
|
||||
|| !(p->state == PROCESS_SUSPENDED)))
|
||||
return (0);
|
||||
lst = lst->next;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 12:51:08 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 10:20:57 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:40:09 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 12:56:11 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/16 18:32:15 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 12:12:45 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/08 14:40:40 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 10:56:42 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:33:55 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:05:55 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 10:54:51 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:47:49 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/16 16:53:06 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:39:42 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/20 09:57:09 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 14:16:03 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,7 +19,11 @@ int readline(int has_prompt, char **input)
|
|||
if (!has_prompt)
|
||||
data_singleton()->line.prompt_size = 1;
|
||||
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
|
||||
return ((ret = get_next_line(data_singleton()->fd, input)) >= 0 ? !ret : ret);
|
||||
{
|
||||
if ((ret = get_next_line(data_singleton()->fd, input)) >= 0)
|
||||
return (!ret);
|
||||
return (ret);
|
||||
}
|
||||
readline_init(has_prompt);
|
||||
ret = ft_read_stdin(input);
|
||||
if (ret < 0)
|
||||
|
|
@ -30,6 +34,7 @@ int readline(int has_prompt, char **input)
|
|||
ft_putchar('\n');
|
||||
if (has_prompt)
|
||||
ret = ft_history_parsing(has_prompt, input);
|
||||
ft_strdel(&data_singleton()->line.copy_tmp);
|
||||
if (tcsetattr(0, TCSANOW, ft_save_termios(0)) == -1)
|
||||
return (-1);
|
||||
return (ret);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 11:30:08 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/20 11:30:42 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue