conflicts resolved
This commit is contained in:
commit
b613f9fb89
19 changed files with 127 additions and 68 deletions
|
|
@ -6,14 +6,14 @@
|
||||||
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
||||||
# Updated: 2017/02/06 21:49:51 by jhalford ### ########.fr #
|
# Updated: 2017/02/07 16:11:13 by jhalford ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
NAME = 42sh
|
NAME = 42sh
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
FLAGS = -Wall -Wextra -Werror -g
|
FLAGS = -Wall -Wextra -Werror
|
||||||
D_FLAGS = -g
|
D_FLAGS = -g
|
||||||
|
|
||||||
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
||||||
|
|
@ -54,6 +54,7 @@ completion/c_terminal.c\
|
||||||
completion/completion.c\
|
completion/completion.c\
|
||||||
exec/ast_free.c\
|
exec/ast_free.c\
|
||||||
exec/bad_fd.c\
|
exec/bad_fd.c\
|
||||||
|
exec/close_fdsave.c\
|
||||||
exec/exec_ampersand.c\
|
exec/exec_ampersand.c\
|
||||||
exec/exec_and_if.c\
|
exec/exec_and_if.c\
|
||||||
exec/exec_command.c\
|
exec/exec_command.c\
|
||||||
|
|
@ -67,6 +68,7 @@ exec/ft_findexec.c\
|
||||||
exec/launch_process.c\
|
exec/launch_process.c\
|
||||||
exec/process_redirect.c\
|
exec/process_redirect.c\
|
||||||
exec/process_reset.c\
|
exec/process_reset.c\
|
||||||
|
exec/process_resetfds.c\
|
||||||
exec/process_setexec.c\
|
exec/process_setexec.c\
|
||||||
exec/process_setgroup.c\
|
exec/process_setgroup.c\
|
||||||
exec/process_setsig.c\
|
exec/process_setsig.c\
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/07 12:09:05 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 17:49:55 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -59,6 +59,9 @@ struct s_exec
|
||||||
int aol_search;
|
int aol_search;
|
||||||
t_job job;
|
t_job job;
|
||||||
t_process process;
|
t_process process;
|
||||||
|
int fd0save;
|
||||||
|
int fd1save;
|
||||||
|
int fd2save;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct s_execmap
|
struct s_execmap
|
||||||
|
|
@ -93,10 +96,12 @@ int process_setexec(t_type type, t_process *p);
|
||||||
int process_setgroup(t_process *p, pid_t pid);
|
int process_setgroup(t_process *p, pid_t pid);
|
||||||
void process_setsig(void);
|
void process_setsig(void);
|
||||||
void process_free(void *content, size_t content_size);
|
void process_free(void *content, size_t content_size);
|
||||||
void process_reset(void);
|
void process_reset(t_process *p);
|
||||||
|
void process_resetfds(void);
|
||||||
|
void close_fdsave(void);
|
||||||
|
|
||||||
int fd_is_valid(int fd);
|
int fd_is_valid(int fd);
|
||||||
void bad_fd(int fd);
|
int bad_fd(int fd);
|
||||||
int process_redirect(t_process *p);
|
int process_redirect(t_process *p);
|
||||||
int redirect_great(t_redir *redir);
|
int redirect_great(t_redir *redir);
|
||||||
int redirect_less(t_redir *redir);
|
int redirect_less(t_redir *redir);
|
||||||
|
|
|
||||||
|
|
@ -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/02/07 17:32:51 by wescande ### ########.fr */
|
/* Updated: 2017/02/07 18:06:00 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,15 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 22:32:43 by jhalford #+# #+# */
|
/* Created: 2017/02/06 22:32:43 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/06 22:34:21 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 16:02:12 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "minishell.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void bad_fd(int fd)
|
int bad_fd(int fd)
|
||||||
{
|
{
|
||||||
ft_dprintf(2, "{red}%s: %i: Bad file descriptor{eoc}\n",
|
ft_dprintf(2, "{red}%s: %i: Bad file descriptor{eoc}\n",
|
||||||
SHELL_NAME, fd);
|
SHELL_NAME, fd);
|
||||||
exit(1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
42sh/src/exec/close_fdsave.c
Normal file
23
42sh/src/exec/close_fdsave.c
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* close_fdsave.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/02/07 17:45:23 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/02/07 17:54:07 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "exec.h"
|
||||||
|
|
||||||
|
void close_fdsave(void)
|
||||||
|
{
|
||||||
|
t_exec *exec;
|
||||||
|
|
||||||
|
exec = &data_singleton()->exec;
|
||||||
|
close(exec->fd0save);
|
||||||
|
close(exec->fd1save);
|
||||||
|
close(exec->fd2save);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
|
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/07 17:33:15 by wescande ### ########.fr */
|
/* Updated: 2017/02/07 18:06:13 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -65,10 +65,7 @@ int exec_command(t_btree **ast)
|
||||||
job->pgid = 0;
|
job->pgid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->av = NULL;
|
process_reset(p);
|
||||||
p->pid = 0;
|
|
||||||
p->attributes &= ~(PROCESS_STATE_MASK | PROCESS_TYPE_MASK);
|
|
||||||
p->redirs = NULL;
|
|
||||||
btree_delone(ast, &ast_free);
|
btree_delone(ast, &ast_free);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/14 17:27:51 by jhalford #+# #+# */
|
/* Created: 2016/11/14 17:27:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/06 16:12:14 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 15:24:11 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/07 12:11:34 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 17:54:12 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -24,7 +24,11 @@ int launch_process(t_process *p)
|
||||||
set_exitstatus(127, 1);
|
set_exitstatus(127, 1);
|
||||||
}
|
}
|
||||||
else if (p->attributes & PROCESS_BUILTIN && IS_PIPESINGLE(p->attributes))
|
else if (p->attributes & PROCESS_BUILTIN && IS_PIPESINGLE(p->attributes))
|
||||||
|
{
|
||||||
|
if (process_redirect(p))
|
||||||
|
return (1);
|
||||||
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env), 1);
|
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env), 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->attributes &= ~PROCESS_STATE_MASK;
|
p->attributes &= ~PROCESS_STATE_MASK;
|
||||||
|
|
@ -39,9 +43,11 @@ int launch_process(t_process *p)
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
{
|
{
|
||||||
|
close_fdsave();
|
||||||
process_setgroup(p, 0);
|
process_setgroup(p, 0);
|
||||||
process_setsig();
|
process_setsig();
|
||||||
process_redirect(p);
|
if (process_redirect(p))
|
||||||
|
exit (1);
|
||||||
(*p->execf)(p->path, p->av, data_singleton()->env);
|
(*p->execf)(p->path, p->av, data_singleton()->env);
|
||||||
exit(43);
|
exit(43);
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +58,7 @@ int launch_process(t_process *p)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
else if (pid == -1)
|
else if (pid == -1)
|
||||||
ft_dprintf(2, "{red}internal fork error{eoc}\n");
|
ft_dprintf(2, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/07 12:01:06 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 17:36:46 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -32,18 +32,19 @@ int process_redirect(t_process *p)
|
||||||
redirs = p->redirs;
|
redirs = p->redirs;
|
||||||
while (redirs)
|
while (redirs)
|
||||||
{
|
{
|
||||||
i = 0;
|
|
||||||
redir = redirs->content;
|
redir = redirs->content;
|
||||||
if (redir->n > 9)
|
if (redir->n > 9)
|
||||||
{
|
{
|
||||||
bad_fd(redir->n);
|
bad_fd(redir->n);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
i = 0;
|
||||||
while (g_redirmap[i].type)
|
while (g_redirmap[i].type)
|
||||||
{
|
{
|
||||||
if (g_redirmap[i].type == redir->type)
|
if (g_redirmap[i].type == redir->type)
|
||||||
{
|
{
|
||||||
(g_redirmap[i].f)(redir);
|
if ((g_redirmap[i].f)(redir))
|
||||||
|
return (1);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|
@ -53,14 +54,8 @@ int process_redirect(t_process *p)
|
||||||
if (p->toclose != STDIN)
|
if (p->toclose != STDIN)
|
||||||
close(p->toclose);
|
close(p->toclose);
|
||||||
if (p->fdin != STDIN)
|
if (p->fdin != STDIN)
|
||||||
{
|
dup2_close(p->fdin, STDIN);
|
||||||
dup2(p->fdin, STDIN);
|
|
||||||
close(p->fdin);
|
|
||||||
}
|
|
||||||
if (p->fdout != STDOUT)
|
if (p->fdout != STDOUT)
|
||||||
{
|
dup2_close(p->fdout, STDOUT);
|
||||||
dup2(p->fdout, STDOUT);
|
|
||||||
close(p->fdout);
|
|
||||||
}
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* process_reset.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/02/07 17:44:22 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/02/07 17:48:22 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
|
|
||||||
void process_reset(void)
|
void process_reset(t_process *p)
|
||||||
{
|
{
|
||||||
t_data *data;
|
process_resetfds();
|
||||||
|
p->av = NULL;
|
||||||
data = data_singleton();
|
p->pid = 0;
|
||||||
|
p->redirs = NULL;
|
||||||
|
p->attributes &= ~(PROCESS_STATE_MASK | PROCESS_TYPE_MASK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
42sh/src/exec/process_resetfds.c
Normal file
23
42sh/src/exec/process_resetfds.c
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* process_resetfds.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/02/07 17:39:14 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/02/07 17:50:52 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "minishell.h"
|
||||||
|
|
||||||
|
void process_resetfds(void)
|
||||||
|
{
|
||||||
|
t_exec *exec;
|
||||||
|
|
||||||
|
exec = &data_singleton()->exec;
|
||||||
|
dup2(exec->fd0save, 0);
|
||||||
|
dup2(exec->fd1save, 1);
|
||||||
|
dup2(exec->fd2save, 2);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 22:12:31 by jhalford #+# #+# */
|
/* Created: 2017/02/06 22:12:31 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/07 12:01:45 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 17:54:40 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,26 +17,20 @@ int redirect_greatand(t_redir *redir)
|
||||||
int fdold;
|
int fdold;
|
||||||
int fdnew;
|
int fdnew;
|
||||||
|
|
||||||
if (redir->word.fd == redir->n)
|
|
||||||
return (0);
|
|
||||||
if (redir->word.fd > 9)
|
|
||||||
bad_fd(redir->word.fd);
|
|
||||||
if (redir->close)
|
if (redir->close)
|
||||||
{
|
{
|
||||||
close(redir->n);
|
close(redir->n);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
else
|
if (redir->word.fd == redir->n)
|
||||||
{
|
return (0);
|
||||||
|
if (redir->word.fd > 9)
|
||||||
|
return (bad_fd(redir->word.fd));
|
||||||
fdold = redir->word.fd;
|
fdold = redir->word.fd;
|
||||||
fdnew = redir->n;
|
fdnew = redir->n;
|
||||||
}
|
|
||||||
if (fd_is_valid(fdold))
|
if (fd_is_valid(fdold))
|
||||||
{
|
dup2_close(fdold, fdnew);
|
||||||
dup2(fdold, fdnew);
|
|
||||||
close(fdold);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
bad_fd(fdold);
|
return (bad_fd(fdold));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 22:09:53 by jhalford #+# #+# */
|
/* Created: 2017/02/06 22:09:53 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/06 22:38:46 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 16:05:09 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 22:11:18 by jhalford #+# #+# */
|
/* Created: 2017/02/06 22:11:18 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/07 12:01:56 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 17:54:57 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,26 +17,23 @@ int redirect_lessand(t_redir *redir)
|
||||||
int fdold;
|
int fdold;
|
||||||
int fdnew;
|
int fdnew;
|
||||||
|
|
||||||
if (redir->word.fd == redir->n)
|
|
||||||
return (0);
|
|
||||||
if (redir->word.fd > 9)
|
|
||||||
bad_fd(redir->word.fd);
|
|
||||||
if (redir->close)
|
if (redir->close)
|
||||||
{
|
{
|
||||||
close(redir->n);
|
close(redir->n);
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
else
|
if (redir->word.fd == redir->n)
|
||||||
{
|
return (0);
|
||||||
|
if (redir->word.fd > 9)
|
||||||
|
return (bad_fd(redir->word.fd));
|
||||||
fdold = redir->word.fd;
|
fdold = redir->word.fd;
|
||||||
fdnew = redir->n;
|
fdnew = redir->n;
|
||||||
}
|
|
||||||
if (fd_is_valid(fdold))
|
if (fd_is_valid(fdold))
|
||||||
{
|
{
|
||||||
dup2(fdold, fdnew);
|
dup2(fdold, fdnew);
|
||||||
close(fdold);
|
close(fdold);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
bad_fd(fdold);
|
return (bad_fd(fdold));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/08 15:58:20 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 16:04:57 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ void set_exitstatus(int status, int override)
|
||||||
exitval = 128 + WTERMSIG(status);
|
exitval = 128 + WTERMSIG(status);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DG("fail: process was not exited nor signaled.");
|
DG("%s: process was not exited nor signaled.", SHELL_NAME);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/02/03 15:25:55 by gwojda ### ########.fr */
|
/* Updated: 2017/02/07 17:23:02 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -31,6 +31,9 @@ int data_init(void)
|
||||||
data->exec.process.pid = 0;
|
data->exec.process.pid = 0;
|
||||||
data->exec.process.attributes = PROCESS_PIPESTART | PROCESS_PIPEEND;
|
data->exec.process.attributes = PROCESS_PIPESTART | PROCESS_PIPEEND;
|
||||||
data->exec.process.redirs = NULL;
|
data->exec.process.redirs = NULL;
|
||||||
|
data->exec.fd0save = dup(0);
|
||||||
|
data->exec.fd1save = dup(1);
|
||||||
|
data->exec.fd2save = dup(2);
|
||||||
|
|
||||||
data->exec.aol_status = NULL;
|
data->exec.aol_status = NULL;
|
||||||
data->exec.aol_search = 0;
|
data->exec.aol_search = 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/06 16:46:48 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 17:18:21 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/14 12:49:45 by jhalford #+# #+# */
|
/* Created: 2016/11/14 12:49:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/06 16:29:54 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 15:26:25 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/14 12:49:45 by jhalford #+# #+# */
|
/* Created: 2016/11/14 12:49:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/06 16:30:41 by jhalford ### ########.fr */
|
/* Updated: 2017/02/07 15:32:44 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue