mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
wordsplit: handle double quotes
This commit is contained in:
parent
5276aba278
commit
1676cf6696
2 changed files with 27 additions and 7 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 17:02:32 by khais #+# #+# */
|
||||
/* Updated: 2025/02/14 18:45:45 by khais ### ########.fr */
|
||||
/* Updated: 2025/02/17 13:54:58 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -76,7 +76,15 @@ t_wordlist *minishell_wordsplit(char *original)
|
|||
// be delimited.
|
||||
if (original[idx] == '\0')
|
||||
wordlist = delimit(wordlist, &token, ¤tly_in_word);
|
||||
else if (original[idx] == '\'')
|
||||
// If the current character is single-quote, or double-quote and it is
|
||||
// not quoted, it shall affect quoting for subsequent characters up to
|
||||
// the end of the quoted text. The rules for quoting are as described in
|
||||
// Quoting . The result token shall contain exactly the characters that
|
||||
// appear in the input, unmodified, including any embedded or enclosing
|
||||
// quotes or substitution operators, between the <quotation-mark> and
|
||||
// the end of the quoted text. The token shall not be delimited by the
|
||||
// end of the quoted field.
|
||||
else if (original[idx] == '\'' || original[idx] == '"')
|
||||
currently_in_quotes = quote_flip(&token, original[idx], currently_in_quotes);
|
||||
// If the current character is an unquoted <blank>, any token containing
|
||||
// the previous character is delimited and the current character shall
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue