This commit is contained in:
parent
bfb7c13e94
commit
163c93c0c2
9 changed files with 16 additions and 23 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
|
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/13 13:52:40 by jhalford ### ########.fr */
|
/* Updated: 2017/03/13 14:29:46 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/09 15:14:37 by jhalford ### ########.fr */
|
/* Updated: 2017/03/13 14:47:29 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
|
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/13 14:21:27 by jhalford ### ########.fr */
|
/* Updated: 2017/03/13 14:37:01 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/13 14:12:52 by jhalford ### ########.fr */
|
/* Updated: 2017/03/13 14:43:26 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/14 11:27:03 by gwojda #+# #+# */
|
/* Created: 2017/02/14 11:27:03 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/13 14:23:03 by jhalford ### ########.fr */
|
/* Updated: 2017/03/13 14:30:48 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,7 +21,6 @@ void ft_add_in_history_file(char *str)
|
||||||
char **hist;
|
char **hist;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
/* DG("gonna add [%s] in history"); */
|
|
||||||
hist = ft_strsplit(str, '\n');
|
hist = ft_strsplit(str, '\n');
|
||||||
if (!(home = ft_getenv(data_singleton()->env, "HOME")))
|
if (!(home = ft_getenv(data_singleton()->env, "HOME")))
|
||||||
return ;
|
return ;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */
|
/* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/09 11:21:06 by gwojda ### ########.fr */
|
/* Updated: 2017/03/13 14:47:06 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,13 +16,13 @@ void free_history_list(t_list_history *head)
|
||||||
{
|
{
|
||||||
t_list_history *prev;
|
t_list_history *prev;
|
||||||
|
|
||||||
free(head->prev);
|
if (!head)
|
||||||
|
return ;
|
||||||
while (head)
|
while (head)
|
||||||
{
|
{
|
||||||
ft_strdel(&head->str);
|
ft_strdel(&head->str);
|
||||||
prev = head;
|
prev = head;
|
||||||
head = head->next;
|
head = head->next;
|
||||||
free(prev);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/10 15:48:30 by gwojda ### ########.fr */
|
/* Updated: 2017/03/13 14:43:28 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,15 +15,11 @@
|
||||||
int readline(int fd, int prompt, char **input)
|
int readline(int fd, int prompt, char **input)
|
||||||
{
|
{
|
||||||
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
|
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
|
||||||
{
|
return (get_next_line(fd, input) == 0);
|
||||||
if (get_next_line(fd, input) == 0)
|
|
||||||
return (1);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
readline_init(prompt);
|
readline_init(prompt);
|
||||||
*input = ft_read_stdin();
|
*input = ft_read_stdin();
|
||||||
if (STR)
|
if (STR)
|
||||||
ft_current_str(STR, POS);
|
ft_current_str(STR, POS);
|
||||||
ft_putchar('\n');
|
ft_putchar('\n');
|
||||||
if (!prompt)
|
if (!prompt)
|
||||||
*input = ft_history_parsing();
|
*input = ft_history_parsing();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/13 14:23:21 by jhalford ### ########.fr */
|
/* Updated: 2017/03/13 14:47:13 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -31,11 +31,13 @@ int handle_instruction(int fd)
|
||||||
if ((ret = readline(fd, get_lexer_stack(lexer) ||
|
if ((ret = readline(fd, get_lexer_stack(lexer) ||
|
||||||
parser.state == UNDEFINED || lexer.state == HEREDOC, &str)))
|
parser.state == UNDEFINED || lexer.state == HEREDOC, &str)))
|
||||||
{
|
{
|
||||||
|
DG("readline trap");
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
return (parser.state == UNDEFINED ? error_eof(&token,
|
return (parser.state == UNDEFINED ? error_eof(&token,
|
||||||
&parser, &ast) : 1);
|
&parser, &ast) : 1);
|
||||||
}
|
}
|
||||||
|
DG("INPUT STRING IS [%s]", str);
|
||||||
if (lexer.state == HEREDOC)
|
if (lexer.state == HEREDOC)
|
||||||
{
|
{
|
||||||
ft_strappend(&lexer.str, (char[]){'\n', 0});
|
ft_strappend(&lexer.str, (char[]){'\n', 0});
|
||||||
|
|
@ -71,7 +73,6 @@ int handle_instruction(int fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
btree_print(STDBUG, ast, &ft_putast);
|
btree_print(STDBUG, ast, &ft_putast);
|
||||||
/* ft_show_heredoc_data(ast->left->item); */
|
|
||||||
if (ft_exec(&ast))
|
if (ft_exec(&ast))
|
||||||
return (1);
|
return (1);
|
||||||
instruction_free(&token, &parser, &ast);
|
instruction_free(&token, &parser, &ast);
|
||||||
|
|
@ -124,11 +125,8 @@ int main(int ac, char **av)
|
||||||
}
|
}
|
||||||
DG("JOBC is %s, fd=[%i]", SH_HAS_JOBC(data_singleton()->opts)?"ON":"OFF", fd);
|
DG("JOBC is %s, fd=[%i]", SH_HAS_JOBC(data_singleton()->opts)?"ON":"OFF", fd);
|
||||||
while (handle_instruction(fd) == 0)
|
while (handle_instruction(fd) == 0)
|
||||||
{
|
|
||||||
// lexer_clean;
|
|
||||||
// parser_clean;
|
|
||||||
;
|
;
|
||||||
}
|
DG("gonna exit");
|
||||||
builtin_exit(NULL, NULL, NULL);
|
builtin_exit(NULL, NULL, NULL);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 20:15:35 by ariard #+# #+# */
|
/* Created: 2017/02/09 20:15:35 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/11 16:10:56 by ariard ### ########.fr */
|
/* Updated: 2017/03/13 14:41:45 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue