mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
Parse-cmd: fix and add comment
This commit is contained in:
parent
0a80b9fbe3
commit
10d7b65b08
2 changed files with 17 additions and 6 deletions
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* minishell.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/28 14:55/31 by khais #+# #+# */
|
||||
/* Updated: 2025/03/28 14:55:31 by khais ### ########.fr */
|
||||
/* Created: 2025/03/28 14:55:31 by khais #+# #+# */
|
||||
/* Updated: 2025/03/28 16:42:57 by jguelen ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -57,6 +57,9 @@ typedef enum e_cmd_type
|
|||
typedef struct s_cmd
|
||||
{
|
||||
t_cmd_type type;
|
||||
/*
|
||||
** flags will probably be useless to us for now.
|
||||
*/
|
||||
int flags;
|
||||
/*
|
||||
** Line number the command starts on -> will probably be unused.
|
||||
|
|
@ -73,6 +76,7 @@ typedef struct s_cmd
|
|||
|
||||
typedef enum e_connector
|
||||
{
|
||||
FT_INVALID_CONNECTOR,
|
||||
FT_PIPE,
|
||||
FT_AND,
|
||||
FT_OR,
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* remove_quotes.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/28 13:52:02 by khais #+# #+# */
|
||||
/* Updated: 2025/03/07 11:20:48 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/28 16:05:25 by jguelen ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,6 +15,13 @@
|
|||
#include "../matchers/quote.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static bool is_ignore_mark(char c)
|
||||
{
|
||||
if (c == '\'' || c == '"' || c == '$' || c == '&')
|
||||
return (true);
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
** use the marker in the given worddesc to create a new worddesc by removing
|
||||
** unquoted quotes.
|
||||
|
|
@ -37,7 +44,7 @@ t_worddesc *remove_quotes(t_worddesc *word)
|
|||
i = 0;
|
||||
while (word->word[i] != '\0')
|
||||
{
|
||||
if (!is_quote(word->word[i]) || is_quote(word->marker[i]))
|
||||
if (!is_quote(word->word[i]) || is_ignore_mark(word->marker[i]))
|
||||
buf = ft_buffer_pushchar(buf, word->word[i]);
|
||||
i++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue