some norme -> completion, hash, builtin, history, lexer, line_edit
This commit is contained in:
parent
3c39c485cb
commit
46387a1f6e
10 changed files with 33 additions and 32 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/10/15 13:27:14 by alao #+# #+# */
|
/* Created: 2016/10/15 13:27:14 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/19 15:34:38 by gwojda ### ########.fr */
|
/* Updated: 2017/03/20 14:41:04 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -22,7 +22,8 @@ static int c_chevron(t_comp *c)
|
||||||
|
|
||||||
pos = c->ircmd;
|
pos = c->ircmd;
|
||||||
if (pos >= ft_strlen(c->rcmd))
|
if (pos >= ft_strlen(c->rcmd))
|
||||||
pos = ft_strlen(c->rcmd) - (ft_strlen(data_singleton()->line.input) - pos);
|
pos = ft_strlen(c->rcmd) - (ft_strlen(data_singleton()->line.input)
|
||||||
|
- pos);
|
||||||
while (pos)
|
while (pos)
|
||||||
{
|
{
|
||||||
if (c->rcmd[pos] == '<' || c->rcmd[pos] == '>')
|
if (c->rcmd[pos] == '<' || c->rcmd[pos] == '>')
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* builtin_fg.c :+: :+: :+: */
|
/* builtin_fg.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/08 14:30:07 by jhalford #+# #+# */
|
/* Created: 2017/01/08 14:30:07 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 12:12:16 by jhalford ### ########.fr */
|
/* Updated: 2017/03/20 14:42:22 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/20 14:16:03 by gwojda ### ########.fr */
|
/* Updated: 2017/03/20 14:49:03 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/18 15:43:07 by gwojda ### ########.fr */
|
/* Updated: 2017/03/20 14:44:51 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,6 @@ void data_exit(void)
|
||||||
t_data *data;
|
t_data *data;
|
||||||
|
|
||||||
data = data_singleton();
|
data = data_singleton();
|
||||||
/* ft_strdel(&data->line.input); */
|
|
||||||
ft_sstrfree(data->env);
|
ft_sstrfree(data->env);
|
||||||
ft_sstrfree(data->local_var);
|
ft_sstrfree(data->local_var);
|
||||||
ft_sstrfree(data->argv);
|
ft_sstrfree(data->argv);
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/10 11:36:39 by jhalford #+# #+# */
|
/* Created: 2017/01/10 11:36:39 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/16 15:12:53 by jhalford ### ########.fr */
|
/* Updated: 2017/03/20 14:45:01 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "minishell.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
t_data *data_singleton()
|
t_data *data_singleton(void)
|
||||||
{
|
{
|
||||||
static t_data *data = NULL;
|
static t_data *data = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* main.c :+: :+: :+: */
|
/* main.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Updated: 2017/03/17 10:51:23 by gwojda ### ########.fr */
|
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
|
||||||
|
/* Updated: 2017/03/20 14:46:44 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -67,7 +68,7 @@ int main(int ac, char **av)
|
||||||
DG("{inv}{bol}{gre}start of shell{eoc}");
|
DG("{inv}{bol}{gre}start of shell{eoc}");
|
||||||
if (shell_init(ac, av) != 0)
|
if (shell_init(ac, av) != 0)
|
||||||
return (1);
|
return (1);
|
||||||
DG("JOBC is %s", SH_HAS_JOBC(data_singleton()->opts)?"ON":"OFF");
|
DG("JOBC is %s", SH_HAS_JOBC(data_singleton()->opts) ? "ON" : "OFF");
|
||||||
token = NULL;
|
token = NULL;
|
||||||
ast = NULL;
|
ast = NULL;
|
||||||
data = data_singleton();
|
data = data_singleton();
|
||||||
|
|
|
||||||
|
|
@ -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/20 11:30:42 by jhalford ### ########.fr */
|
/* Updated: 2017/03/20 14:54:28 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -47,7 +47,8 @@ static int get_input_fd(t_data *data)
|
||||||
ft_printf("{red}%s: %s: No such file or directory\n{eoc}",
|
ft_printf("{red}%s: %s: No such file or directory\n{eoc}",
|
||||||
data->argv[0], file);
|
data->argv[0], file);
|
||||||
else if (S_ISDIR(buf.st_mode))
|
else if (S_ISDIR(buf.st_mode))
|
||||||
ft_printf("{red}%s: %s: is a directory\n{eoc}", data->argv[0], file);
|
ft_printf("{red}%s: %s: is a directory\n{eoc}", data->argv[0],
|
||||||
|
file);
|
||||||
else if ((fds[PIPE_READ] = open(file, O_RDONLY | O_CLOEXEC)) < 0)
|
else if ((fds[PIPE_READ] = open(file, O_RDONLY | O_CLOEXEC)) < 0)
|
||||||
ft_printf("{red}%s: %s: No such file or directory\n{eoc}",
|
ft_printf("{red}%s: %s: No such file or directory\n{eoc}",
|
||||||
data->argv[0], file);
|
data->argv[0], file);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/24 18:41:50 by ariard #+# #+# */
|
/* Created: 2017/02/24 18:41:50 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/18 15:50:28 by ariard ### ########.fr */
|
/* Updated: 2017/03/20 14:57:34 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/15 16:33:57 by ariard ### ########.fr */
|
/* Updated: 2017/03/20 14:59:23 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ char *read_state(t_sym current)
|
||||||
if (current == TK_DONE)
|
if (current == TK_DONE)
|
||||||
return ("TK_DONE");
|
return ("TK_DONE");
|
||||||
if (current == AND_OR_MINOR)
|
if (current == AND_OR_MINOR)
|
||||||
return("AND_OR_MINOR");
|
return ("AND_OR_MINOR");
|
||||||
if (current == AND_OR_MAJOR)
|
if (current == AND_OR_MAJOR)
|
||||||
return ("AND_OR_MAJOR");
|
return ("AND_OR_MAJOR");
|
||||||
if (current == TK_COMMAND)
|
if (current == TK_COMMAND)
|
||||||
|
|
@ -227,7 +227,6 @@ int ft_read_stack(t_sym *stack)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ft_show_heredoc_data(t_astnode *node)
|
int ft_show_heredoc_data(t_astnode *node)
|
||||||
{
|
{
|
||||||
t_redir *redir;
|
t_redir *redir;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/18 17:13:31 by ariard #+# #+# */
|
/* Created: 2017/03/18 17:13:31 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/18 17:15:11 by ariard ### ########.fr */
|
/* Updated: 2017/03/20 14:57:58 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue