summaryrefslogtreecommitdiffstats
path: root/src/m_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-27 18:55:07 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-27 18:55:07 +0200
commit487a66394061f2d14a2fa421302966b5442d643f (patch)
tree34237d4e9cb85f94bcefd46f399d2224dff3f6b3 /src/m_loop.c
parentCorrect shell prompt (diff)
download42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.gz
42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.bz2
42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.xz
42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.zst
42-minishell-487a66394061f2d14a2fa421302966b5442d643f.zip
I couldn't see shit
Diffstat (limited to '')
-rw-r--r--src/m_loop.c (renamed from src/ft_m_loop.c)38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/ft_m_loop.c b/src/m_loop.c
index 3f40fba..fe3fbcd 100644
--- a/src/ft_m_loop.c
+++ b/src/m_loop.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* ft_m_loop.c :+: :+: :+: */
+/* m_loop.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
@@ -15,14 +15,14 @@
#include <stdlib.h>
#include <unistd.h>
-#include "ft_e_lcom.h"
-#include "ft_m_prompt.h"
-#include "ft_p_line.h"
-#include "ft_s_lcom.h"
+#include "e_lcom.h"
+#include "m_prompt.h"
+#include "p_line.h"
+#include "s_lcom.h"
static char
- *ft_strjoin_m(char *s1,
+ *strjoin_m(char *s1,
char *s2,
uint8_t mode)
{
@@ -49,7 +49,7 @@ static char
}
void
- ft_m_loop_cont(t_msh *msh,
+ m_loop_cont(t_msh *msh,
char *line,
char *quote,
int8_t gnl)
@@ -65,24 +65,24 @@ void
while (gnl > 0 && ((!(quote = ft_strrchr(buf, '\"'))) &&
(!(quote = ft_strrchr(buf, '\'')))))
{
- ft_m_cont_prompt();
+ m_cont_prompt();
gnl = get_next_line(STDIN_FILENO, &line);
- buf = ft_strjoin_m(buf, line, 0);
+ buf = strjoin_m(buf, line, 0);
ft_memdel((void*)&line);
}
fin = ft_strtrim(buf, "\"'");
ft_memdel((void*)&buf);
fin = (ft_strrchr(fin, '\'')) ? ft_strsubst(fin, "\'", "") : fin;
- fin = ft_strjoin_m(prog, fin, 1);
- ft_p_line(fin, msh);
+ fin = strjoin_m(prog, fin, 1);
+ p_line(fin, msh);
ft_memdel((void*)&prog);
ft_memdel((void*)&fin);
- ft_e_lcom(msh);
- ft_lcom_clear(&msh->curr);
+ e_lcom(msh);
+ lcom_clear(&msh->curr);
}
uint8_t
- ft_m_loop(t_msh *msh)
+ m_loop(t_msh *msh)
{
char *line;
char *quote;
@@ -94,20 +94,20 @@ uint8_t
pipefd[1] = STDIN_FILENO;
while (gnl > 0)
{
- ft_m_prompt(msh);
+ m_prompt(msh);
gnl = get_next_line(STDIN_FILENO, &line);
if (line[0] != '\0')
{
if (!(quote = ft_strchr(line, '\'')) && !(quote = ft_strchr(line, '\"')))
{
- ft_p_line(line, msh);
+ p_line(line, msh);
ft_memdel((void*)&line);
- ft_e_lcom(msh);
- ft_lcom_clear(&msh->curr);
+ e_lcom(msh);
+ lcom_clear(&msh->curr);
}
else
{
- ft_m_loop_cont(msh, line, quote, 1);
+ m_loop_cont(msh, line, quote, 1);
if (line != NULL)
ft_memdel((void*)&line);
}