summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_b_echo.c54
-rw-r--r--src/ft_m_loop.c6
-rw-r--r--src/ft_m_prompt.c2
3 files changed, 33 insertions, 29 deletions
diff --git a/src/ft_b_echo.c b/src/ft_b_echo.c
index b837cac..de5431f 100644
--- a/src/ft_b_echo.c
+++ b/src/ft_b_echo.c
@@ -56,30 +56,26 @@ char
return (str);
}
-void
- ft_e_fill(char *ptr[], char **str)
-{
- char *bs;
-
- ft_sprintf(*str, "%s", *ptr);
- ptr++;
- while (*ptr)
- {
- ft_sprintf(*str + ft_strlen(*str), " %s", *ptr);
- ptr++;
- }
- if (*str[0] == '\"' || *str[0] == '\'')
- {
- *str = ft_strtrim(*str, "\"\'");
- ft_printf("%s", *str);
- }
- else if ((bs = ft_strrchr(*str, '\\')))
- {
- ft_e_put(*str, 0);
- }
- else
- ft_printf("%s", *str);
-}
+/***********************************************/
+/* void */
+/* ft_e_fill(char *ptr[], char **str) */
+/* { */
+/* char *bs; */
+/* */
+/* ft_sprintf(*str, "%s", *ptr); */
+/* if (*str[0] == '\"' || *str[0] == '\'') */
+/* { */
+/* *str = ft_strtrim(*str, "\"\'"); */
+/* ft_printf("%s", *str); */
+/* } */
+/* else if ((bs = ft_strrchr(*str, '\\'))) */
+/* { */
+/* ft_e_put(*str, 0); */
+/* } */
+/* else */
+/* ft_printf("%s", *str); */
+/* } */
+/***********************************************/
uint8_t
ft_b_echo(char *args[],
@@ -103,7 +99,15 @@ uint8_t
ptr += 1;
}
if (argc - nopt >= 1)
- ft_e_fill(ptr, &str);
+ {
+ ft_printf("%s", *ptr);
+ ptr++;
+ while (*ptr)
+ {
+ ft_printf(" %s", *ptr);
+ ptr++;
+ }
+ }
}
free(str);
if (nopt == 0)
diff --git a/src/ft_m_loop.c b/src/ft_m_loop.c
index 8302bfc..6a05dd6 100644
--- a/src/ft_m_loop.c
+++ b/src/ft_m_loop.c
@@ -32,13 +32,13 @@ uint8_t
ft_memcpy(prog, line, (quote - line));
buf = ft_strdup(line + (quote - line) + 1);
gnl = 1;
- while (gnl > 0 && (!(quote = ft_strrchr(buf, '\"'))))
+ while (gnl > 0 && ((!(quote = ft_strrchr(buf, '\"'))) && (!(quote = ft_strrchr(buf, '\'')))))
{
ft_m_cont_prompt();
gnl = get_next_line(STDIN_FILENO, &line);
ft_sprintf(buf + ft_strlen(buf), "\n%s", line);
}
- buf = ft_strtrim(buf, "\"\'");
+ buf = ft_strtrim(buf, "\"'");
ft_p_line(ft_strjoin(prog, buf), msh);
ft_memdel((void*)&line);
ft_memdel((void*)&buf);
@@ -61,7 +61,7 @@ uint8_t
gnl = get_next_line(STDIN_FILENO, &line);
if (line[0] != '\0')
{
- if (!(quote = ft_strchr(line, '\"')))
+ if (!(quote = ft_strchr(line, '\'')) && !(quote = ft_strchr(line, '\"')))
{
ft_p_line(line, msh);
ft_memdel((void*)&line);
diff --git a/src/ft_m_prompt.c b/src/ft_m_prompt.c
index 8f59a9e..d6a73fd 100644
--- a/src/ft_m_prompt.c
+++ b/src/ft_m_prompt.c
@@ -17,7 +17,7 @@
void
ft_m_cont_prompt(void)
{
- ft_printf(">");
+ ft_printf("> ");
/* TODO :ft_printf("%s", msh->ps_two); */
}