summaryrefslogtreecommitdiffstats
path: root/src/p_args.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/p_args.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/p_args.c b/src/p_args.c
index ae92523..b449ba3 100644
--- a/src/p_args.c
+++ b/src/p_args.c
@@ -20,27 +20,6 @@
#include "p_args_escape.h"
#include "u_utils.h"
-/* ================= */
-/* TODO: DELETE THIS */
-/* ================= */
-
-/* static void */
-/* p_print(char *words[]) */
-/* { */
-/* char **ptr; */
-
-/* ptr = words; */
-/* while (*ptr != NULL) */
-/* { */
-/* ft_printf("[%s]\n", *ptr); */
-/* ptr++; */
-/* } */
-/* } */
-
-/* ================== */
-/* TODO: DELETE ABOVE */
-/* ================== */
-
static void
p_meet_bs(char *ptr, t_quote_mode mode)
{
@@ -166,15 +145,14 @@ static char
return (NULL);
}
p_args_escape_chars_and_quotes(words);
- /* p_print(words); */
- /* exit(0); */
return (words);
}
char
- **p_split_args(const char word[], int8_t redir)
+ **p_split_args(char word[], int8_t redir)
{
char **words;
+ size_t i;
words = NULL;
if (redir == 0)
@@ -183,6 +161,16 @@ char
return (NULL);
return (words);
}
+ i = ft_strlen(word);
+ while (ft_ischarset("<>", word[i]) == FALSE)
+ i--;
+ i--;
+ while (redir > 0 && ft_isdigit(word[i]) == TRUE)
+ i--;
+ word[i] = C_NUL;
+ ft_printf("[%s]\n", word);
+ if ((words = p_split_words_no_rdr(word)) == NULL)
+ return (NULL);
return (words);
/* char **words; */
/* char *subst; */