summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-12-18 15:28:28 +0100
committersalad <fmoenne-@student.le-101.fr>2020-12-18 15:28:28 +0100
commit40676b37c8320ae708ec4303af0ea2a649ec74d7 (patch)
treee72bcb83ef67f138c2539e6bc8fade62276bbc3b
parentnomergethislol (diff)
download42-minishell-40676b37c8320ae708ec4303af0ea2a649ec74d7.tar.gz
42-minishell-40676b37c8320ae708ec4303af0ea2a649ec74d7.tar.bz2
42-minishell-40676b37c8320ae708ec4303af0ea2a649ec74d7.tar.xz
42-minishell-40676b37c8320ae708ec4303af0ea2a649ec74d7.tar.zst
42-minishell-40676b37c8320ae708ec4303af0ea2a649ec74d7.zip
spammingnormcommits
-rw-r--r--src/b_alias_register.c8
-rw-r--r--src/c_input.c3
-rw-r--r--src/m_loop.c2
-rw-r--r--src/m_minishell.c5
-rw-r--r--src/s_init_next.c2
5 files changed, 8 insertions, 12 deletions
diff --git a/src/b_alias_register.c b/src/b_alias_register.c
index 8f75e36..0170a59 100644
--- a/src/b_alias_register.c
+++ b/src/b_alias_register.c
@@ -31,14 +31,16 @@ static void b_cpy_alias(char name[], char *ptr, char value[])
rptr++;
tmp = *(rptr + ft_strlen(name));
*(rptr + ft_strlen(name)) = C_NUL;
- if (ft_strncmp(rptr, name, ft_strlen(name) + 1) == 0) {
+ if (ft_strncmp(rptr, name, ft_strlen(name) + 1) == 0)
+ {
*(rptr + ft_strlen(name)) = tmp;
ft_strlcpy(value, ptr, ARG_MAX);
ft_memmove(value + (rptr - ptr) + 1, value + (rptr - ptr),
ft_strlen(value + (rptr - ptr)) + 1);
*(value + (rptr - ptr)) = C_BACKS;
}
- else {
+ else
+ {
*(rptr + ft_strlen(name)) = tmp;
ft_strlcpy(value, ptr, ARG_MAX);
}
@@ -63,5 +65,3 @@ void b_register_arg(const char arg[], t_msh *msh)
u_set_alias_value(name, value, msh);
}
}
-
-
diff --git a/src/c_input.c b/src/c_input.c
index 9023f37..141538d 100644
--- a/src/c_input.c
+++ b/src/c_input.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <libft.h>
#include <term.h>
+#include <signal.h>
#include "c_ctrls.h"
#include "c_init.h"
@@ -28,6 +29,8 @@ short
{
char *term;
+ signal(SIGINT, c_signal_int);
+ signal(SIGQUIT, c_signal_ign);
if (tcaps)
{
term = getenv("TERM");
diff --git a/src/m_loop.c b/src/m_loop.c
index 017c5af..e493c7d 100644
--- a/src/m_loop.c
+++ b/src/m_loop.c
@@ -144,8 +144,6 @@ unsigned char m_loop(int fd, t_msh *msh)
msh->curr_hist_ptr = hist;
c_get_msh(1, msh);
c_set_ptr(TRUE, 0, msh);
- signal(SIGINT, c_signal_int);
- signal(SIGQUIT, c_signal_ign);
while (gnl > 0)
{
gnl = (fd == STDIN_FILENO) ? c_gnl(fd, &line, 1, msh) :
diff --git a/src/m_minishell.c b/src/m_minishell.c
index e5ec69e..987cfc0 100644
--- a/src/m_minishell.c
+++ b/src/m_minishell.c
@@ -32,11 +32,6 @@ int main(int argc, char *const argv[], char *const envp[])
ft_dprintf(STDERR_FILENO, "%s\n", strerror(errno));
return (M_RET_ALLOC);
}
- /* if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) */
- /* { */
- /* ft_dprintf(STDERR_FILENO, "minishell: innapropriate ioctl device.\n"); */
- /* exit(1); */
- /* } */
ret = m_argv(argc, argv, msh);
s_destroy(msh);
return (ret);
diff --git a/src/s_init_next.c b/src/s_init_next.c
index d506d9d..9a98e9a 100644
--- a/src/s_init_next.c
+++ b/src/s_init_next.c
@@ -103,7 +103,7 @@ char **s_dupenv(char *const envp[])
i++;
}
if (s_cpy_path(ptr, nenvp, &i) == 1)
- return (s_dupenv_del(nenvp, i));
+ return (s_dupenv_del(nenvp, i));
nenvp[i] = NULL;
return (nenvp);
}