merge correctif > < >& <&
3
This commit is contained in:
commit
a0086265e4
11 changed files with 30 additions and 46 deletions
|
|
@ -178,7 +178,6 @@ lexer/insert_newline.c\
|
||||||
lexer/lexer_assignement_word.c\
|
lexer/lexer_assignement_word.c\
|
||||||
lexer/lexer_backslash.c\
|
lexer/lexer_backslash.c\
|
||||||
lexer/lexer_bquote.c\
|
lexer/lexer_bquote.c\
|
||||||
lexer/lexer_comment.c\
|
|
||||||
lexer/lexer_curly_braces.c\
|
lexer/lexer_curly_braces.c\
|
||||||
lexer/lexer_default.c\
|
lexer/lexer_default.c\
|
||||||
lexer/lexer_delim.c\
|
lexer/lexer_delim.c\
|
||||||
|
|
|
||||||
|
|
@ -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/03/05 16:28:17 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 17:29:09 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -42,7 +42,6 @@ enum e_lexstate
|
||||||
BACKSLASH,
|
BACKSLASH,
|
||||||
CURLY_BRACKETS,
|
CURLY_BRACKETS,
|
||||||
ASSIGNEMENT_WORD,
|
ASSIGNEMENT_WORD,
|
||||||
COMMENT,
|
|
||||||
END,
|
END,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 16:32:22 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 18:08:57 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -45,11 +45,12 @@ int launch_process(t_process *p)
|
||||||
}
|
}
|
||||||
process_setgroup(p, 0);
|
process_setgroup(p, 0);
|
||||||
process_setsig();
|
process_setsig();
|
||||||
DG("gonna redirect");
|
|
||||||
if (process_redirect(p))
|
if (process_redirect(p))
|
||||||
exit (1);
|
exit (1);
|
||||||
|
if (p->attributes & PROCESS_BUILTIN)
|
||||||
|
exit((*p->execf)(p->path, p->av, data_singleton()->env));
|
||||||
(*p->execf)(p->path, p->av, data_singleton()->env);
|
(*p->execf)(p->path, p->av, data_singleton()->env);
|
||||||
ft_dprintf(2, "{red}%s: internal excve error{eoc}\n", SHELL_NAME);
|
ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->av[0]);
|
||||||
}
|
}
|
||||||
else if (pid > 0)
|
else if (pid > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */
|
/* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 16:32:15 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 18:09:31 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/12 14:01:59 by jhalford #+# #+# */
|
/* Created: 2017/01/12 14:01:59 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 16:45:40 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 18:07:24 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
char *command_getoutput(char *command)
|
char *command_getoutput(char *command)
|
||||||
{
|
{
|
||||||
return (command);
|
return (ft_strdup(command));
|
||||||
/* int fds[2]; */
|
/* int fds[2]; */
|
||||||
/* t_btree *ast; */
|
/* t_btree *ast; */
|
||||||
/* t_astnode item; */
|
/* t_astnode item; */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
|
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 16:28:14 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 17:29:24 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,8 +20,6 @@ t_lexstate get_state_global(t_lexer *lexer)
|
||||||
DG("check, c=%c", lexer->str[lexer->pos]);
|
DG("check, c=%c", lexer->str[lexer->pos]);
|
||||||
if (ft_is_delim(c))
|
if (ft_is_delim(c))
|
||||||
return (DELIM);
|
return (DELIM);
|
||||||
else if (c == '#')
|
|
||||||
return (COMMENT);
|
|
||||||
else if (c == '&' || c == ';' || c == '|')
|
else if (c == '&' || c == ';' || c == '|')
|
||||||
return (SEP);
|
return (SEP);
|
||||||
else if (c == '\\')
|
else if (c == '\\')
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* lexer_comment.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2017/02/07 12:15:59 by jhalford #+# #+# */
|
|
||||||
/* Updated: 2017/03/05 15:31:17 by wescande ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "lexer.h"
|
|
||||||
|
|
||||||
int lexer_comment(t_list **alst, t_lexer *lexer)
|
|
||||||
{
|
|
||||||
// t_token *token;
|
|
||||||
|
|
||||||
// token = (*alst)->content;
|
|
||||||
if (lexer->str[lexer->pos] == '\n')
|
|
||||||
return (lexer_lex(&(*alst)->next, lexer));
|
|
||||||
return (lexer_comment(alst, lexer));
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 18:36:58 by jhalford #+# #+# */
|
/* Created: 2016/11/28 18:36:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/20 20:52:24 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 17:09:20 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,23 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* lexer_end.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/03/05 16:58:24 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/03/05 17:29:17 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "lexer.h"
|
#include "lexer.h"
|
||||||
|
|
||||||
int lexer_end(t_list **alst, t_lexer *lexer)
|
int lexer_end(t_list **alst, t_lexer *lexer)
|
||||||
{
|
{
|
||||||
t_token *token;
|
t_token *token;
|
||||||
|
|
||||||
if ((*alst && (lexer->state == QUOTE
|
if ((*alst && (lexer->state == QUOTE || lexer->state == DQUOTE
|
||||||
|| lexer->state == DQUOTE
|
|| lexer->state == BQUOTE)) || get_lexer_stack(*lexer) == DLESS)
|
||||||
|| lexer->state == BQUOTE))
|
|
||||||
|| get_lexer_stack(*lexer) == DLESS)
|
|
||||||
{
|
{
|
||||||
ft_strappend(&lexer->str, (char[]){'\n', 0});
|
ft_strappend(&lexer->str, (char[]){'\n', 0});
|
||||||
lexer->pos++;
|
lexer->pos++;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */
|
/* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 18:32:09 by wescande ### ########.fr */
|
/* Updated: 2017/03/05 18:42:43 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -33,7 +33,6 @@ int (*g_lexer[])(t_list **alst, t_lexer *lexer) =
|
||||||
&lexer_backslash,
|
&lexer_backslash,
|
||||||
&lexer_curly_braces,
|
&lexer_curly_braces,
|
||||||
&lexer_assignement_word,
|
&lexer_assignement_word,
|
||||||
&lexer_comment,
|
|
||||||
&lexer_end,
|
&lexer_end,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -51,9 +50,10 @@ int lexer_lex(t_list **alst, t_lexer *lexer)
|
||||||
{
|
{
|
||||||
t_token *token;
|
t_token *token;
|
||||||
|
|
||||||
ft_putnbr(__LINE__);
|
if (lexer->str[lexer->pos] == 0
|
||||||
ft_putendl(__FILE__);
|
|| (lexer->str[lexer->pos] == '#'
|
||||||
if (lexer->str[lexer->pos] == 0)
|
&& lexer->state != QUOTE
|
||||||
|
&& lexer->state != DQUOTE))
|
||||||
return (lexer_end(alst, lexer));
|
return (lexer_end(alst, lexer));
|
||||||
if (!*alst)
|
if (!*alst)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/11 14:04:48 by jhalford #+# #+# */
|
/* Created: 2017/01/11 14:04:48 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 16:28:38 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 17:45:37 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue