close #200
This commit is contained in:
parent
d7ad419073
commit
31d0a2e5ed
16 changed files with 67 additions and 53 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/03/26 22:13:53 by jhalford ### ########.fr #
|
# Updated: 2017/03/26 22:15:25 by jhalford ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
NAME = 42sh
|
NAME = 42sh
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
FLAGS = -Wall -Wextra -Werror
|
FLAGS = -Wall -Wextra -Werror -fsanitize=address
|
||||||
D_FLAGS = -g
|
D_FLAGS = -g
|
||||||
|
|
||||||
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
||||||
|
|
|
||||||
|
|
@ -194,12 +194,13 @@ str/ft_strtok.c\
|
||||||
str/ft_strtrim.c\
|
str/ft_strtrim.c\
|
||||||
sys/create_directory.c\
|
sys/create_directory.c\
|
||||||
sys/dup2_close.c\
|
sys/dup2_close.c\
|
||||||
|
sys/fd_minor.c\
|
||||||
sys/fd_replace.c\
|
sys/fd_replace.c\
|
||||||
sys/ft_getenv.c\
|
sys/ft_getenv.c\
|
||||||
sys/ft_xattr_count.c\
|
sys/ft_xattr_count.c\
|
||||||
sys/ft_xattr_print.c\
|
sys/ft_xattr_print.c\
|
||||||
sys/is_directory.c\
|
sys/is_directory.c\
|
||||||
sys/open_access.c\
|
sys/try_access.c\
|
||||||
time/ft_mytime_free.c\
|
time/ft_mytime_free.c\
|
||||||
time/ft_mytime_get.c\
|
time/ft_mytime_get.c\
|
||||||
time/ft_time_isrecent.c
|
time/ft_time_isrecent.c
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/14 17:24:23 by jhalford #+# #+# */
|
/* Created: 2017/03/14 17:24:23 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/25 15:12:52 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:05:25 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -33,11 +33,12 @@ int ft_xattr_count(char *path);
|
||||||
|
|
||||||
char *ft_getenv(char **env, char *key);
|
char *ft_getenv(char **env, char *key);
|
||||||
|
|
||||||
int open_access(char *file, t_flag a_flag, t_flag o_flag, t_flag o_perm);
|
int try_access(char *file, int exists, t_flag a_flag);
|
||||||
int is_directory(const char *path);
|
int is_directory(const char *path);
|
||||||
char *create_directory(const char *path, const char *old_pathnames);
|
char *create_directory(const char *path, const char *old_pathnames);
|
||||||
|
|
||||||
int dup2_close(int fd1, int fd2);
|
int dup2_close(int fd1, int fd2);
|
||||||
int fd_replace(int fd1, int fd2);
|
int fd_replace(int fd1, int fd2);
|
||||||
|
int fd_minor(int fd, int minor);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/21 16:32:26 by jhalford #+# #+# */
|
/* Created: 2017/03/21 16:32:26 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/24 22:59:28 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:18:52 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,5 +16,5 @@ int fd_replace(int fd1, int fd2)
|
||||||
{
|
{
|
||||||
if (fd1 != fd2)
|
if (fd1 != fd2)
|
||||||
return (dup2_close(fd1, fd2));
|
return (dup2_close(fd1, fd2));
|
||||||
return (0);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,19 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/25 01:10:56 by jhalford #+# #+# */
|
/* Created: 2017/03/25 01:10:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/25 15:07:42 by jhalford ### ########.fr */
|
/* Updated: 2017/03/26 22:36:13 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "libft.h"
|
#include "libft.h"
|
||||||
|
|
||||||
int open_access(char *file, t_flag a_flag, t_flag o_flag, t_flag o_perm)
|
int try_access(char *file, int exists, t_flag a_flag)
|
||||||
{
|
{
|
||||||
int fd;
|
if (exists && access(file, F_OK) != 0)
|
||||||
|
return (ERR_SET(E_SYS_NOFILE, file) * 0 - 1);
|
||||||
if (a_flag & F_OK && access(file, F_OK) != 0)
|
else if (is_directory(file))
|
||||||
return (-ERR_SET(E_SYS_NOFILE, file));
|
return (ERR_SET(E_SYS_ISDIR, file) * 0 - 1);
|
||||||
if (is_directory(file))
|
else if (access(file, F_OK) == 0 && access(file, a_flag) != 0)
|
||||||
return (-ERR_SET(E_SYS_ISDIR, file));
|
return (ERR_SET(E_SYS_NOPERM, file) * 0 - 1);
|
||||||
if (access(file, F_OK) == 0 && access(file, a_flag) != 0)
|
return (0);
|
||||||
return (-ERR_SET(E_SYS_NOPERM, file));
|
|
||||||
if ((fd = open(file, o_flag, o_perm)) < 0)
|
|
||||||
exit(1);
|
|
||||||
return (fd);
|
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */
|
/* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/26 22:10:41 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:33:31 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -23,7 +23,5 @@ int exec_destroy(t_exec *exec)
|
||||||
ft_lstdel(&exec->op_stack, ft_lst_cfree);
|
ft_lstdel(&exec->op_stack, ft_lst_cfree);
|
||||||
ft_lstdel(&jobc->first_job, job_free);
|
ft_lstdel(&jobc->first_job, job_free);
|
||||||
i = -1;
|
i = -1;
|
||||||
while (++i < 10)
|
|
||||||
ft_lstdel(&exec->fd_save[i], ft_lst_cfree);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/26 21:31:05 by jhalford #+# #+# */
|
/* Created: 2017/03/26 21:31:05 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/26 21:31:24 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:58:34 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,11 +15,16 @@
|
||||||
int exec_popfds(void)
|
int exec_popfds(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int fd;
|
||||||
t_exec *exec;
|
t_exec *exec;
|
||||||
|
|
||||||
exec = &data_singleton()->exec;
|
exec = &data_singleton()->exec;
|
||||||
i = -1;
|
i = -1;
|
||||||
while (++i < 10)
|
while (++i < 10)
|
||||||
pop(&exec->fd_save[i]);
|
{
|
||||||
|
fd = pop(&exec->fd_save[i]);
|
||||||
|
if (fd != -1)
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/26 21:31:46 by jhalford #+# #+# */
|
/* Created: 2017/03/26 21:31:46 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/26 21:34:27 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:58:25 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,11 +15,15 @@
|
||||||
int exec_pushfds(void)
|
int exec_pushfds(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int fd;
|
||||||
t_exec *exec;
|
t_exec *exec;
|
||||||
|
|
||||||
exec = &data_singleton()->exec;
|
exec = &data_singleton()->exec;
|
||||||
i = -1;
|
i = -1;
|
||||||
while (++i < 10)
|
while (++i < 10)
|
||||||
push(&(exec->fd_save[i]), fcntl(i, F_DUPFD_CLOEXEC, 10));
|
{
|
||||||
|
fd = fcntl(i, F_DUPFD_CLOEXEC, 10);
|
||||||
|
push(&(exec->fd_save[i]), fd);
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 13:46:40 by jhalford #+# #+# */
|
/* Created: 2017/02/03 13:46:40 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 21:13:57 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:51:02 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,5 +19,6 @@ int fd_is_valid(int fd, int has_mode)
|
||||||
|
|
||||||
fd_modes = fcntl(fd, F_GETFL);
|
fd_modes = fcntl(fd, F_GETFL);
|
||||||
fd_flags = fcntl(fd, F_GETFD);
|
fd_flags = fcntl(fd, F_GETFD);
|
||||||
return ((fd_flags != -1 || errno != EBADF) && fd_modes & has_mode);
|
return ((fd_flags != -1 || errno != EBADF)
|
||||||
|
&& (has_mode == -1 || fd_modes & has_mode));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/26 22:13:57 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 01:01:27 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -54,10 +54,10 @@ int process_launch(t_process *p)
|
||||||
{
|
{
|
||||||
exec_pushfds();
|
exec_pushfds();
|
||||||
p->map.launch(p);
|
p->map.launch(p);
|
||||||
}
|
|
||||||
exec_popfds();
|
exec_popfds();
|
||||||
shell_resetfds();
|
shell_resetfds();
|
||||||
shell_resetsig();
|
shell_resetsig();
|
||||||
|
}
|
||||||
process_free(p, 0);
|
process_free(p, 0);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
|
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/26 22:14:09 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:10:47 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -58,15 +58,13 @@ int process_set(t_process *p, t_btree *ast)
|
||||||
|| (EXEC_IS_OR_IF(exec->attrs)
|
|| (EXEC_IS_OR_IF(exec->attrs)
|
||||||
&& ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0") == 0))
|
&& ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0") == 0))
|
||||||
return (1);
|
return (1);
|
||||||
fds[PIPE_WRITE] = STDOUT;
|
|
||||||
fds[PIPE_READ] = STDIN;
|
|
||||||
(op == TK_PIPE) ? pipe(fds) : (0);
|
|
||||||
exec->job.attrs |= (op == TK_AMP ? JOB_BG : 0);
|
exec->job.attrs |= (op == TK_AMP ? JOB_BG : 0);
|
||||||
p->fdin = exec->fdin;
|
p->fdin = exec->fdin;
|
||||||
p->to_close = fds[PIPE_READ];
|
(op == TK_PIPE) ? pipe(fds) : (0);
|
||||||
p->fdout = fds[PIPE_WRITE];
|
p->fdout = (op == TK_PIPE) ? fds[PIPE_WRITE] : STDOUT;
|
||||||
|
exec->fdin = (op == TK_PIPE) ? fds[PIPE_READ] : STDIN;
|
||||||
|
p->to_close = exec->fdin;
|
||||||
p->pid = 0;
|
p->pid = 0;
|
||||||
exec->fdin = fds[PIPE_READ];
|
|
||||||
if (ast)
|
if (ast)
|
||||||
p->redirs = ft_lstmap(
|
p->redirs = ft_lstmap(
|
||||||
((t_astnode *)ast->item)->data.cmd.redir, &redir_copy);
|
((t_astnode *)ast->item)->data.cmd.redir, &redir_copy);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 22:07:37 by jhalford #+# #+# */
|
/* Created: 2017/02/06 22:07:37 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/25 01:54:05 by jhalford ### ########.fr */
|
/* Updated: 2017/03/26 22:36:18 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,9 +18,12 @@ int redirect_dgreat(t_redir *redir)
|
||||||
int fdnew;
|
int fdnew;
|
||||||
|
|
||||||
fdnew = redir->n;
|
fdnew = redir->n;
|
||||||
if ((fdold = open_access(redir->word, R_OK,
|
fdnew = redir->n;
|
||||||
O_WRONLY | O_CREAT | O_APPEND, 0644)) < 0)
|
if ((try_access(redir->word, 0, W_OK)))
|
||||||
return (ft_perror(NULL));
|
return (ft_perror(NULL));
|
||||||
dup2(fdold, fdnew);
|
if ((fdold = open(redir->word, O_WRONLY | O_CREAT | O_APPEND, 0644)) < 0)
|
||||||
|
exit (1);
|
||||||
|
|
||||||
|
fd_replace(fdold, fdnew);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 22:03:53 by jhalford #+# #+# */
|
/* Created: 2017/02/06 22:03:53 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/25 02:25:57 by jhalford ### ########.fr */
|
/* Updated: 2017/03/26 22:36:20 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,9 +18,10 @@ int redirect_great(t_redir *redir)
|
||||||
int fdnew;
|
int fdnew;
|
||||||
|
|
||||||
fdnew = redir->n;
|
fdnew = redir->n;
|
||||||
if ((fdold = open_access(redir->word, R_OK,
|
if ((try_access(redir->word, 0, W_OK)))
|
||||||
O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0)
|
|
||||||
return (ft_perror(NULL));
|
return (ft_perror(NULL));
|
||||||
|
if ((fdold = open(redir->word, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0)
|
||||||
|
exit (1);
|
||||||
fd_replace(fdold, fdnew);
|
fd_replace(fdold, fdnew);
|
||||||
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/03/26 18:25:38 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 01:02:30 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,9 +18,10 @@ int redirect_less(t_redir *redir)
|
||||||
int fdnew;
|
int fdnew;
|
||||||
|
|
||||||
fdnew = redir->n;
|
fdnew = redir->n;
|
||||||
if ((fdold = open_access(redir->word, F_OK | W_OK,
|
if ((try_access(redir->word, 1, R_OK)) != 0)
|
||||||
O_RDONLY, 0)) < 0)
|
|
||||||
return (ft_perror(NULL));
|
return (ft_perror(NULL));
|
||||||
dup2(fdold, fdnew);
|
if ((fdold = open(redir->word, O_RDONLY, 0644)) < 0)
|
||||||
|
exit (1);
|
||||||
|
fd_replace(fdold, fdnew);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */
|
/* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/23 10:52:08 by gwojda ### ########.fr */
|
/* Updated: 2017/03/27 01:00:56 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,6 +19,7 @@ static int promt_git_status(int fd)
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
get_next_line(fd, &line);
|
get_next_line(fd, &line);
|
||||||
|
close(fd);
|
||||||
tmp = line;
|
tmp = line;
|
||||||
if (ft_strrchr(line, '/'))
|
if (ft_strrchr(line, '/'))
|
||||||
line = ft_strdup(ft_strrchr(line, '/') + 1);
|
line = ft_strdup(ft_strrchr(line, '/') + 1);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */
|
/* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/26 21:59:25 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 00:36:29 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
void data_exit(void)
|
void data_exit(void)
|
||||||
{
|
{
|
||||||
t_data *data;
|
t_data *data;
|
||||||
|
int i;
|
||||||
|
|
||||||
data = data_singleton();
|
data = data_singleton();
|
||||||
/* ft_strdel(&data->line.input); */
|
/* ft_strdel(&data->line.input); */
|
||||||
|
|
@ -25,6 +26,9 @@ void data_exit(void)
|
||||||
lexer_destroy(&data->lexer);
|
lexer_destroy(&data->lexer);
|
||||||
parser_destroy(&data->parser);
|
parser_destroy(&data->parser);
|
||||||
exec_destroy(&data->exec);
|
exec_destroy(&data->exec);
|
||||||
|
i = -1;
|
||||||
|
while (++i < 10)
|
||||||
|
ft_lstdel(&data->exec.fd_save[i], ft_lst_cfree);
|
||||||
ft_lstdel(&data->lst_func, &tree_func_free);
|
ft_lstdel(&data->lst_func, &tree_func_free);
|
||||||
ft_save_termios(-1);
|
ft_save_termios(-1);
|
||||||
ft_free_hash_table();
|
ft_free_hash_table();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue