bquotes and '-c' work again
This commit is contained in:
parent
043b0247b8
commit
6f4ecd2960
4 changed files with 10 additions and 9 deletions
|
|
@ -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/17 20:52:27 by jhalford ### ########.fr */
|
/* Updated: 2017/03/17 21:13:09 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
struct s_data
|
struct s_data
|
||||||
{
|
{
|
||||||
t_flag opts;
|
t_flag opts;
|
||||||
|
int fd;
|
||||||
char **env;
|
char **env;
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
|
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/17 16:10:40 by gwojda ### ########.fr */
|
/* Updated: 2017/03/17 21:14:15 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ int readline(int has_prompt, char **input)
|
||||||
if (!has_prompt)
|
if (!has_prompt)
|
||||||
data_singleton()->line.prompt_size = 1;
|
data_singleton()->line.prompt_size = 1;
|
||||||
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
|
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
|
||||||
return ((ret = get_next_line(STDIN, input)) >= 0 ? !ret : ret);
|
return ((ret = get_next_line(data_singleton()->fd, input)) >= 0 ? !ret : ret);
|
||||||
readline_init(has_prompt);
|
readline_init(has_prompt);
|
||||||
ret = ft_read_stdin(input);
|
ret = ft_read_stdin(input);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
|
||||||
|
|
@ -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/17 20:51:06 by jhalford ### ########.fr */
|
/* Updated: 2017/03/17 21:16:25 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ int data_init(int ac, char **av)
|
||||||
{
|
{
|
||||||
t_data *data;
|
t_data *data;
|
||||||
char *term_name;
|
char *term_name;
|
||||||
char* shlvl;
|
char *shlvl;
|
||||||
|
|
||||||
data = data_singleton();
|
data = data_singleton();
|
||||||
data->argc = ac;
|
data->argc = ac;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
|
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/16 23:25:29 by ariard ### ########.fr */
|
/* Updated: 2017/03/17 21:16:24 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -33,11 +33,10 @@ int get_input_fd(char **av)
|
||||||
else if (data->opts & SH_OPTS_LC)
|
else if (data->opts & SH_OPTS_LC)
|
||||||
{
|
{
|
||||||
pipe(fds);
|
pipe(fds);
|
||||||
dup2_close(fds[PIPE_READ], 10);
|
|
||||||
fd = 10;
|
|
||||||
file = *cliopts_getdata(av);
|
file = *cliopts_getdata(av);
|
||||||
write(fds[PIPE_WRITE], file, ft_strlen(file));
|
write(fds[PIPE_WRITE], file, ft_strlen(file));
|
||||||
close(fds[PIPE_WRITE]);
|
close(fds[PIPE_WRITE]);
|
||||||
|
dup2_close(fds[PIPE_READ], (fd = 10));
|
||||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||||
return (fd);
|
return (fd);
|
||||||
}
|
}
|
||||||
|
|
@ -93,6 +92,7 @@ int shell_init(int ac, char **av)
|
||||||
}
|
}
|
||||||
if (cliopts_get(av, g_opts, data))
|
if (cliopts_get(av, g_opts, data))
|
||||||
return (ft_perror());
|
return (ft_perror());
|
||||||
|
data->fd = get_input_fd(av);
|
||||||
if (SH_IS_INTERACTIVE(data->opts))
|
if (SH_IS_INTERACTIVE(data->opts))
|
||||||
interactive_settings();
|
interactive_settings();
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue