diff options
Diffstat (limited to 'src/p_args.c')
-rw-r--r-- | src/p_args.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/p_args.c b/src/p_args.c index 7d5a579..7f5302f 100644 --- a/src/p_args.c +++ b/src/p_args.c @@ -24,23 +24,36 @@ /* 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_print(char *words[]) + p_meet_bs(char *ptr, t_quote_mode mode) { - char **ptr; - - ptr = words; - while (*ptr != NULL) + if (mode != Q_SINGLE) { - ft_printf("[%s]\n", *ptr); - ptr++; + if (*(ptr + 1) == C_BACKS) + { + *ptr = C_SUB; + *(ptr + 1) = C_SUB; + } } } -/* ================== */ -/* TODO: DELETE ABOVE */ -/* ================== */ - static t_quote_mode p_meet_dquote(char *head, char *ptr, t_quote_mode mode) { @@ -116,6 +129,7 @@ static uint16_t while (*ptr != C_NUL) { if (*ptr == C_BACKS) + p_meet_bs(ptr, mode); if (*ptr == C_DQUOTE) mode = p_meet_dquote((char*)word, ptr, mode); else if (*ptr == C_SQUOTE) @@ -143,7 +157,6 @@ static char uint16_t to_del; argc = p_count_args(word, start); - ft_printf("argc: %hu\n", argc); if ((words = (char**)malloc((argc + 1) * sizeof(char*))) == NULL) return (NULL); words[argc] = NULL; @@ -153,7 +166,6 @@ static char return (NULL); } p_args_escape_chars_and_quotes(words); - p_print(words); return (words); } @@ -163,7 +175,6 @@ char char **words; words = NULL; - ft_printf("word at start: [%s]\n", word); if (redir == 0) { if ((words = p_split_words_no_rdr(word)) == NULL) |