bquotes and '-c' work again

This commit is contained in:
Jack Halford 2017-03-17 21:16:54 +01:00
parent 043b0247b8
commit 6f4ecd2960
4 changed files with 10 additions and 9 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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,12 +41,13 @@
struct s_data
{
t_flag opts;
int fd;
char **env;
int argc;
char **argv;
t_line line;
t_lexer lexer;
t_parser parser;
t_parser parser;
t_comp *comp;
t_exec exec;
t_jobc jobc;

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
data_singleton()->line.prompt_size = 1;
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);
ret = ft_read_stdin(input);
if (ret < 0)

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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;
char *term_name;
char* shlvl;
char *shlvl;
data = data_singleton();
data->argc = ac;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{
pipe(fds);
dup2_close(fds[PIPE_READ], 10);
fd = 10;
file = *cliopts_getdata(av);
write(fds[PIPE_WRITE], file, ft_strlen(file));
close(fds[PIPE_WRITE]);
dup2_close(fds[PIPE_READ], (fd = 10));
fcntl(fd, F_SETFD, FD_CLOEXEC);
return (fd);
}
@ -93,6 +92,7 @@ int shell_init(int ac, char **av)
}
if (cliopts_get(av, g_opts, data))
return (ft_perror());
data->fd = get_input_fd(av);
if (SH_IS_INTERACTIVE(data->opts))
interactive_settings();
return (0);