diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/b_export.c | 30 | ||||
| -rw-r--r-- | src/p_lcom_next.c | 2 | 
2 files changed, 18 insertions, 14 deletions
diff --git a/src/b_export.c b/src/b_export.c index 9cb1c14..8225b51 100644 --- a/src/b_export.c +++ b/src/b_export.c @@ -14,12 +14,13 @@  #include <stdlib.h>  #include <stdint.h> +#include "d_enum.h"  #include "b_env.h"  #include "f_fail.h"  #include "s_struct.h"  #include "u_utils.h" -static int8_t +static t_bool  	check_valid_identifier(const char *arg)  {  	char	*ptr; @@ -27,24 +28,24 @@ static int8_t  	ptr = (char*)arg;  	if (ft_isalpha(ptr[0]))  	{ -		return (1); +		return (TRUE);  	} -	return (0); +	return (FALSE);  } -static int8_t +static t_bool  	check_equals(const char *arg)  {  	char	*ptr;  	ptr = (char*)arg; -	while (*ptr) +	while (*ptr != '\0')  	{  		if (*ptr == '=') -			return (1); +			return (TRUE);  		ptr++;  	} -	return (0); +	return (FALSE);  }  uint8_t @@ -53,7 +54,7 @@ uint8_t  {  	const uint64_t	argc = get_argc((const char**)args);  	char			**ptr; -	int8_t			next; +	t_bool			next;  	uint8_t			r;  	if (argc == 0) @@ -65,16 +66,16 @@ uint8_t  	while (*ptr)  	{  		ft_printf("export: [%s]\n", *ptr); -		next = 0; -		if (!check_valid_identifier(*ptr)) +		next = FALSE; +		if (check_valid_identifier(*ptr) == FALSE)  		{  			f_fail_identifier("export", *ptr, msh); -			next = 1; +			next = TRUE;  			r = 1;  		} -		if (next == 0 && !check_equals(*ptr)) +		if (next == FALSE && check_equals(*ptr) == FALSE)  		{ -			next = 1; +			next = TRUE;  			/* TODO: export already set variable */  			/* examples: */  			/* ~> QWE=qwe */ @@ -83,6 +84,9 @@ uint8_t  			/* # non-existant variable QWE */  			/* ~> export QWE */  		} +		else if (next == FALSE && check_equals(*ptr) == TRUE) +		{ +		}  		ptr++;  	}  	 /* TODO: finish export */ diff --git a/src/p_lcom_next.c b/src/p_lcom_next.c index b106032..1df0a1f 100644 --- a/src/p_lcom_next.c +++ b/src/p_lcom_next.c @@ -194,7 +194,7 @@ char  		ptr = words[i];  		while (*ptr != '\0' && *ptr != '=')  			ptr++; -		if (*ptr == '\0' || words[i][0] == '=') +		if (*ptr == '\0' || words[i][0] == '=' || ft_isdigit(words[i][0]))  		{  			reg = FALSE;  			if (i == 0)  | 
