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