merging luke remote with origin local
This commit is contained in:
@@ -6,13 +6,15 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/28 20:45:09 by hulamy ### ########.fr */
|
||||
/* Updated: 2021/11/02 13:48:36 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
static char **tokens_list_to_argv(t_token *t); // temp test
|
||||
//static char **tokens_list_to_argv(t_token *t); // temp test
|
||||
void sigint_handler(int signum); //tmp
|
||||
void sigquit_aka_eof_handler(int signum); //tmp
|
||||
|
||||
void close_fd(t_cmd *cmd)
|
||||
{
|
||||
@@ -64,11 +66,43 @@ void shell_loop(t_all *c)
|
||||
{
|
||||
add_history(line_input);
|
||||
c->token_list = input_to_tokens(line_input);
|
||||
|
||||
// TEMP
|
||||
// A faire aprés être sortie du mode interactif
|
||||
// - Ignorer tout les signaux
|
||||
// - Remettre ori_termios
|
||||
c->signal_behaviour.sa_handler = SIG_IGN;
|
||||
sigaction(SIGINT, &c->signal_behaviour, NULL);
|
||||
sigaction(SIGQUIT, &c->signal_behaviour, NULL);
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &c->ori_termios);
|
||||
if (!fork())
|
||||
{
|
||||
char *arg_test[3];
|
||||
|
||||
arg_test[0] = ft_strdup("sleep");
|
||||
arg_test[1] = ft_strdup("3");
|
||||
arg_test[2] = NULL;
|
||||
sigaction(SIGQUIT, &c->ori_signal_behaviour, NULL);
|
||||
sigaction(SIGINT, &c->ori_signal_behaviour, NULL);
|
||||
execve("/bin/sleep", arg_test, c->envp);
|
||||
}
|
||||
else
|
||||
{
|
||||
int wait_test;
|
||||
wait(&wait_test);
|
||||
c->signal_behaviour.sa_handler = sigint_handler;
|
||||
sigaction(SIGINT, &c->signal_behaviour, NULL);
|
||||
c->signal_behaviour.sa_handler = SIG_IGN;
|
||||
sigaction(SIGQUIT, &c->signal_behaviour, NULL);
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &c->interactive_termios);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// EXEC_PIPES_AND_CO()
|
||||
|
||||
// temp placeholder
|
||||
if (ft_strncmp(c->token_list->content, "env", 4) == 0)
|
||||
/* if (ft_strncmp(c->token_list->content, "env", 4) == 0)
|
||||
builtin_env(0, NULL, c);
|
||||
else if (ft_strncmp(c->token_list->content, "exit", 5) == 0)
|
||||
builtin_exit(0, NULL, c);
|
||||
@@ -85,12 +119,14 @@ void shell_loop(t_all *c)
|
||||
// ft_lstprint((t_list *)c->token_list, 1);
|
||||
execute_cmd(c->envp, c->cmd_arr);
|
||||
ft_lstclear((t_list **)&c->token_list, free);
|
||||
}
|
||||
} */
|
||||
}
|
||||
else if (!line_input)
|
||||
write(1, "\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
static char **tokens_list_to_argv(t_token *t) // temp test
|
||||
/* static char **tokens_list_to_argv(t_token *t) // temp test
|
||||
{
|
||||
size_t i;
|
||||
char **argv;
|
||||
@@ -105,29 +141,4 @@ static char **tokens_list_to_argv(t_token *t) // temp test
|
||||
t = t->next;
|
||||
}
|
||||
return (argv);
|
||||
}
|
||||
|
||||
void wip_test()
|
||||
{
|
||||
char term_desc[2048];
|
||||
char *term_type;
|
||||
int term_width;
|
||||
int term_height;
|
||||
int ret;
|
||||
|
||||
term_type = getenv("TERM");
|
||||
if (term_type == 0)
|
||||
ft_putstr_fd("Specify a terminal type with `setenv TERM <yourtype>'.\n", 2);
|
||||
ret = tgetent(term_desc, term_type);
|
||||
if (ret < 0)
|
||||
ft_putstr_fd("Could not access the termcap data base.\n", 2);
|
||||
if (ret == 0)
|
||||
ft_putstr_fd("Terminal type `%s' is not defined.\n", 2);
|
||||
term_height = tgetnum ("li");
|
||||
term_width = tgetnum ("co");
|
||||
/* Extract information that termcap functions use. */
|
||||
/* temp = tgetstr ("pc", BUFFADDR);
|
||||
PC = temp ? *temp : 0;
|
||||
BC = tgetstr ("le", BUFFADDR);
|
||||
UP = tgetstr ("up", BUFFADDR); */
|
||||
}
|
||||
} */
|
||||
|
||||
Reference in New Issue
Block a user