diff options
Diffstat (limited to '')
| -rw-r--r-- | src/m_loop_next.c | 5 | ||||
| -rw-r--r-- | src/p_args.c | 25 | 
2 files changed, 16 insertions, 14 deletions
| diff --git a/src/m_loop_next.c b/src/m_loop_next.c index d6c085e..1163a49 100644 --- a/src/m_loop_next.c +++ b/src/m_loop_next.c @@ -153,10 +153,7 @@ static void  	{  		if (*ptr == C_SQUOTE)  		{ -			if (*(ptr - 1) != C_BACKSLASH) -				q[0] += 1; -			else if (*(ptr - 2) == C_BACKSLASH) -				q[0] += 1; +			q[0] += 1;  		}  		else if (*ptr == C_DQUOTE)  		{ diff --git a/src/p_args.c b/src/p_args.c index 1cab59d..d42dabe 100644 --- a/src/p_args.c +++ b/src/p_args.c @@ -37,18 +37,25 @@ p_print(char *words[])  /* TODO: DELETE ABOVE */  /* ================== */ -static void -	p_skip_delim(char *ptr, char c) +static char +	*p_skip_delim(char *ptr, char c)  {  	ptr++;  	while (*ptr != C_NULL && *ptr != c)  	{  		ptr++; -		if (*ptr == c && *(ptr - 1) == C_BACKSLASH) -			ptr++; +		if (*ptr == c && c == C_DQUOTE) +		{ +			if (*(ptr - 1) == C_BACKSLASH) +			{ +				if (*(ptr - 2) != C_BACKSLASH) +					ptr++; +			} +		}  	}  	if (*ptr != C_NULL)  		ptr++; +	return (ptr);  }  static uint16_t @@ -71,13 +78,11 @@ static uint16_t  			}  		}  	} -	else if (*ptr == C_SQUOTE) -	{ -		p_skip_delim(ptr, C_SQUOTE); -	} -	else if (*ptr == C_DQUOTE) +	else if (*ptr == C_SQUOTE || *ptr == C_DQUOTE)  	{ -		p_skip_delim(ptr, C_DQUOTE); +		ptr = p_skip_delim(ptr, *ptr); +		if (ft_isspace(*ptr) == FALSE) +			return (p_count_args(ptr, argc));  	}  	return (p_count_args(ptr, argc + 1));  } | 
