mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 03:16:51 +01:00
「🔨」 fix: fixed quote unclosed
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/06/21 11:59:34 by adjoly #+# #+# */
|
||||
/* Updated: 2024/07/16 16:15:41 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/07/17 17:14:35 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,6 +15,13 @@
|
||||
#include "tokenizer.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char *go_to_nxt_quote(char *rl, t_quote quote_type)
|
||||
{
|
||||
while (*rl && __is_quote(*rl) != quote_type)
|
||||
rl++;
|
||||
return (rl);
|
||||
}
|
||||
|
||||
bool watch_quote(char *rl)
|
||||
{
|
||||
char *tmp;
|
||||
@ -22,10 +29,10 @@ bool watch_quote(char *rl)
|
||||
tmp = rl;
|
||||
while (*tmp)
|
||||
{
|
||||
if (__is_quote(*tmp) != FALSE)
|
||||
if (*tmp == DOUBLE || *tmp == SINGLE)
|
||||
{
|
||||
tmp = search_for_next_quote(tmp + 1, __is_quote(*tmp));
|
||||
if (!tmp)
|
||||
tmp = go_to_nxt_quote(tmp + 1, __is_quote(*tmp));
|
||||
if (!*tmp)
|
||||
return (true);
|
||||
}
|
||||
tmp++;
|
||||
@ -35,7 +42,7 @@ bool watch_quote(char *rl)
|
||||
|
||||
bool check_quote(char *readline)
|
||||
{
|
||||
if (watch_quote(readline))
|
||||
if (watch_quote(readline))
|
||||
return (send_error_parsing("quote not closed"));
|
||||
return (false);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/20 20:06:13 by adjoly #+# #+# */
|
||||
/* Updated: 2024/07/16 15:55:00 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/07/17 16:20:46 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,17 +17,10 @@
|
||||
char *search_for_next_quote(char *s, t_quote quote_type)
|
||||
{
|
||||
char *tmp;
|
||||
t_quote o_quote;
|
||||
|
||||
tmp = s;
|
||||
if (quote_type == DOUBLE)
|
||||
o_quote = SINGLE;
|
||||
else if (quote_type == SINGLE)
|
||||
o_quote = DOUBLE;
|
||||
while (*tmp && __is_quote(*tmp) != quote_type && __is_quote(*tmp) != o_quote)
|
||||
while (*tmp && __is_quote(*tmp) != quote_type)
|
||||
tmp++;
|
||||
if (__is_quote(*tmp) != quote_type)
|
||||
return (NULL);
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/06/29 13:32:35 by adjoly #+# #+# */
|
||||
/* Updated: 2024/06/29 13:32:50 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/07/17 17:08:41 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
|
||||
t_quote __is_quote(char c)
|
||||
{
|
||||
if (!c)
|
||||
return (FALSE);
|
||||
if (c == SINGLE)
|
||||
return (SINGLE);
|
||||
if (c == DOUBLE)
|
||||
|
@ -6,13 +6,16 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/04 15:00:32 by adjoly #+# #+# */
|
||||
/* Updated: 2024/07/09 16:12:16 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/07/17 16:04:23 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parsing.h"
|
||||
#include "libft.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
t_cmd *split_cmd(char *cmd_av, t_cmd *cmd)
|
||||
{
|
||||
char **split;
|
||||
@ -24,5 +27,6 @@ t_cmd *split_cmd(char *cmd_av, t_cmd *cmd)
|
||||
if (!cmd->cmd)
|
||||
return (NULL);
|
||||
cmd->argv = split;
|
||||
printf("%s\n", cmd->cmd);
|
||||
return (cmd);
|
||||
}
|
||||
|
Reference in New Issue
Block a user