aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-09 14:21:13 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-09 14:21:13 +0200
commitea2199c8805b5db5b31c46d0c5feb37f607a8394 (patch)
treebb57667c6392f3bdb25bee7ea2260dd26b24f859 /src/main.c
parent283778a44b07ca56695ef6a878a0d5cc5393e237 (diff)
downloadminishell-ea2199c8805b5db5b31c46d0c5feb37f607a8394.tar.gz
minishell-ea2199c8805b5db5b31c46d0c5feb37f607a8394.tar.bz2
minishell-ea2199c8805b5db5b31c46d0c5feb37f607a8394.zip
Fixing parenthesis redirection, Added better prompt
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/main.c b/src/main.c
index b3ef218..6a0d36a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -6,7 +6,7 @@
/* By: cacharle <cacharle@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/28 11:45:44 by cacharle #+# #+# */
-/* Updated: 2020/08/28 17:16:18 by charles ### ########.fr */
+/* Updated: 2020/09/09 14:20:41 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -29,15 +29,11 @@ void tok_lst_debug(t_tok_lst *tokens);
/*
** TODO
** $?
-** pipeline
+** concurrent pipeline
** cmd variable preprocess
** PATH with no permission, link and other file system fun stuff
-** escape lexer ------- ok
-** escape split preprocessing (escaped spaces)
** signal on whole line instead of single command
-** parsing error ------ ok
** env local to current minishell process
-** BETTER ERROR HANDLING IS BECOMING URGENT (spagetti code everywhere)
*/
bool env_set_default(t_env env, char *key, char *value)
@@ -75,9 +71,9 @@ int main(int argc, char **argv, char **envp)
// env_export(env, "_", env_exec_path);
g_last_status_code = 0;
- /* signal(SIGINT, signal_sigint); */
- /* signal(SIGQUIT, signal_sigquit); */
- /* signal(SIGTERM, signal_sigterm); */
+ signal(SIGINT, signal_sigint);
+ signal(SIGQUIT, signal_sigquit);
+ signal(SIGTERM, signal_sigterm);
char *last_slash = ft_strrchr(argv[0], '/');
if (last_slash == NULL)
@@ -118,12 +114,12 @@ int main(int argc, char **argv, char **envp)
int ret;
char *line;
- ft_putstr_fd("> ", STDERR_FILENO);
+ print_prompt();
while ((ret = ft_getline(STDOUT_FILENO, &line)) == FTGL_OK)
{
if (*line == '\0')
{
- ft_putstr_fd("> ", STDERR_FILENO);
+ print_prompt();
continue;
}
t_tok_lst *lex_out = lexer(line);
@@ -135,14 +131,14 @@ int main(int argc, char **argv, char **envp)
return (1);
if (parser_out->syntax_error)
{
- ft_putstr_fd("> ", STDERR_FILENO);
+ print_prompt();
continue;
}
int fds[2] = {MS_NO_FD, MS_NO_FD};
int eval_out = eval(fds, env, path, parser_out->ast);
(void)eval_out;
- ft_putstr_fd("> ", STDERR_FILENO);
+ print_prompt();
}
if (ret != FTGL_EOF)
return (1);