summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libft/include/libft.h16
-rw-r--r--libft/src/ft_isalnum.c6
-rw-r--r--libft/src/ft_isalpha.c20
-rw-r--r--libft/src/ft_isascii.c8
-rw-r--r--libft/src/ft_ischarset.c6
-rw-r--r--libft/src/ft_isdigit.c8
-rw-r--r--libft/src/ft_isprint.c8
-rw-r--r--libft/src/ft_isspace.c7
-rw-r--r--src/b_export.c2
-rw-r--r--src/b_type.c2
-rw-r--r--src/b_unset.c2
-rw-r--r--src/e_externs.c2
-rw-r--r--src/e_externs_pipes.c2
-rw-r--r--src/p_lcom.c10
-rw-r--r--src/p_lcom_next.c9
-rw-r--r--src/s_com.c2
16 files changed, 61 insertions, 49 deletions
diff --git a/libft/include/libft.h b/libft/include/libft.h
index 0cd5ed1..7019d6b 100644
--- a/libft/include/libft.h
+++ b/libft/include/libft.h
@@ -121,18 +121,20 @@ char **ft_split(const char *s, char c);
** INT
*/
-uint8_t ft_isspace(int c);
-uint8_t ft_ischarset(const char *charset, int c);
uint8_t ft_intlen(long n);
uint8_t ft_intlen_base(long n, char *base);
uint8_t ft_uintlen(unsigned long n);
uint8_t ft_uintlen_base(unsigned long n, char *base);
int ft_memcmp(const void *s1, const void *s2, size_t n);
-int ft_isalpha(int c);
-int ft_isdigit(int c);
-int ft_isalnum(int c);
-int ft_isascii(int c);
-int ft_isprint(int c);
+t_bool ft_isspace(int c);
+t_bool ft_ischarset(const char *charset, int c);
+t_bool ft_isupper(int c);
+t_bool ft_islower(int c);
+t_bool ft_isalpha(int c);
+t_bool ft_isdigit(int c);
+t_bool ft_isalnum(int c);
+t_bool ft_isascii(int c);
+t_bool ft_isprint(int c);
int ft_toupper(int c);
int ft_tolower(int c);
int ft_strncmp(const char *s1, const char *s2, size_t n);
diff --git a/libft/src/ft_isalnum.c b/libft/src/ft_isalnum.c
index e764ac6..fca042d 100644
--- a/libft/src/ft_isalnum.c
+++ b/libft/src/ft_isalnum.c
@@ -12,10 +12,10 @@
#include <libft.h>
-int
+t_bool
ft_isalnum(int c)
{
if (ft_isalpha(c) || ft_isdigit(c))
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
diff --git a/libft/src/ft_isalpha.c b/libft/src/ft_isalpha.c
index 562825d..3b7a88f 100644
--- a/libft/src/ft_isalpha.c
+++ b/libft/src/ft_isalpha.c
@@ -10,26 +10,28 @@
/* */
/* ************************************************************************** */
-static int
+#include <libft.h>
+
+t_bool
ft_isupper(int c)
{
if (c >= 65 && c <= 90)
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
-static int
+t_bool
ft_islower(int c)
{
if (c >= 97 && c <= 122)
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
-int
+t_bool
ft_isalpha(int c)
{
if (ft_isupper(c) || ft_islower(c))
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
diff --git a/libft/src/ft_isascii.c b/libft/src/ft_isascii.c
index 8d2f3f2..04e63c3 100644
--- a/libft/src/ft_isascii.c
+++ b/libft/src/ft_isascii.c
@@ -10,10 +10,12 @@
/* */
/* ************************************************************************** */
-int
+#include <libft.h>
+
+t_bool
ft_isascii(int c)
{
if (c >= 0 && c <= 127)
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
diff --git a/libft/src/ft_ischarset.c b/libft/src/ft_ischarset.c
index 95b9172..eb57d87 100644
--- a/libft/src/ft_ischarset.c
+++ b/libft/src/ft_ischarset.c
@@ -14,7 +14,7 @@
#include <stddef.h>
#include <inttypes.h>
-uint8_t
+t_bool
ft_ischarset(const char *charset, int c)
{
size_t i;
@@ -23,8 +23,8 @@ uint8_t
while (charset[i])
{
if (charset[i] == c)
- return (1);
+ return (TRUE);
i++;
}
- return (0);
+ return (FALSE);
}
diff --git a/libft/src/ft_isdigit.c b/libft/src/ft_isdigit.c
index ebe1f40..3c73f92 100644
--- a/libft/src/ft_isdigit.c
+++ b/libft/src/ft_isdigit.c
@@ -10,10 +10,12 @@
/* */
/* ************************************************************************** */
-int
+#include <libft.h>
+
+t_bool
ft_isdigit(int c)
{
if (c >= 48 && c <= 57)
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
diff --git a/libft/src/ft_isprint.c b/libft/src/ft_isprint.c
index 12fdb7a..f4d1b73 100644
--- a/libft/src/ft_isprint.c
+++ b/libft/src/ft_isprint.c
@@ -10,10 +10,12 @@
/* */
/* ************************************************************************** */
-int
+#include <libft.h>
+
+t_bool
ft_isprint(int c)
{
if (c >= 32 && c <= 126)
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
diff --git a/libft/src/ft_isspace.c b/libft/src/ft_isspace.c
index 188e94a..b9b653f 100644
--- a/libft/src/ft_isspace.c
+++ b/libft/src/ft_isspace.c
@@ -10,9 +10,10 @@
/* */
/* ************************************************************************** */
+#include <libft.h>
#include <inttypes.h>
-uint8_t
+t_bool
ft_isspace(int c)
{
if (c == '\t' ||
@@ -21,6 +22,6 @@ uint8_t
c == '\f' ||
c == '\r' ||
c == ' ')
- return (1);
- return (0);
+ return (TRUE);
+ return (FALSE);
}
diff --git a/src/b_export.c b/src/b_export.c
index 4267b4d..9987583 100644
--- a/src/b_export.c
+++ b/src/b_export.c
@@ -31,7 +31,7 @@ t_bool
char *ptr;
ptr = (char*)arg;
- if (ft_isalpha(ptr[0]) || ptr[0] == '_')
+ if (ft_isalpha(ptr[0]) == TRUE || ptr[0] == '_')
{
return (TRUE);
}
diff --git a/src/b_type.c b/src/b_type.c
index 0d80869..e55a87c 100644
--- a/src/b_type.c
+++ b/src/b_type.c
@@ -50,7 +50,7 @@ static char
envpath = NULL;
fullpath = NULL;
- if (ft_ischarset("/.", com[0]))
+ if (ft_ischarset("/.", com[0]) == TRUE)
{
if (absolute_path_exists(com))
{
diff --git a/src/b_unset.c b/src/b_unset.c
index 00fab78..0df411a 100644
--- a/src/b_unset.c
+++ b/src/b_unset.c
@@ -27,7 +27,7 @@ static t_bool
ptr = (char*)arg;
r = TRUE;
- if (ft_isalpha(ptr[0]) == 0)
+ if (ft_isalpha(ptr[0]) == FALSE)
{
r = FALSE;
}
diff --git a/src/e_externs.c b/src/e_externs.c
index 46afb28..5128bc8 100644
--- a/src/e_externs.c
+++ b/src/e_externs.c
@@ -81,7 +81,7 @@ void
char **envpath;
char *fullpath;
- if (ft_ischarset("./", ptr->bin[0]))
+ if (ft_ischarset("./", ptr->bin[0]) == TRUE)
{
exec_path(ptr->bin, ptr, msh);
return ;
diff --git a/src/e_externs_pipes.c b/src/e_externs_pipes.c
index e1518fa..858e60f 100644
--- a/src/e_externs_pipes.c
+++ b/src/e_externs_pipes.c
@@ -153,7 +153,7 @@ void
i = 0;
while (rptr != NULL)
{
- if (ft_ischarset("/.", rptr->com->bin[0]))
+ if (ft_ischarset("/.", rptr->com->bin[0]) == TRUE)
{
if ((fullpath[i] = ft_strdup(rptr->com->bin)) == NULL)
f_alloc_and_destroy_msh(msh);
diff --git a/src/p_lcom.c b/src/p_lcom.c
index 0e849a0..13b4d11 100644
--- a/src/p_lcom.c
+++ b/src/p_lcom.c
@@ -28,15 +28,15 @@ static void
rdr_err_check(char *ptr,
t_com **com)
{
- if ((*com)->redir == -1 && ft_ischarset("><", *(ptr + 1)))
+ if ((*com)->redir == -1 && ft_ischarset("><", *(ptr + 1)) == TRUE)
{
/* TODO: syntax err */
}
- else if ((*com)->redir == 1 && ft_ischarset("<", *(ptr + 1)))
+ else if ((*com)->redir == 1 && ft_ischarset("<", *(ptr + 1)) == TRUE)
{
/* TODO: syntax err */
}
- else if ((*com)->redir == 2 && ft_ischarset("<>", *(ptr + 1)))
+ else if ((*com)->redir == 2 && ft_ischarset("<>", *(ptr + 1)) == TRUE)
{
/* TODO: syntax err */
}
@@ -72,7 +72,7 @@ static void
get_rdrfd(const char *ptr,
t_com **com)
{
- while (ft_isdigit(*ptr))
+ while (ft_isdigit(*ptr) == TRUE)
{
ptr--;
}
@@ -112,7 +112,7 @@ int8_t
}
if ((*com)->redir > 0)
{
- if (ft_isdigit(*(ptr - 1)))
+ if (ft_isdigit(*(ptr - 1)) == TRUE)
get_rdrfd(ptr - 1, com);
else
(*com)->rdrfd = STDOUT_FILENO;
diff --git a/src/p_lcom_next.c b/src/p_lcom_next.c
index cdceef5..3f18ec1 100644
--- a/src/p_lcom_next.c
+++ b/src/p_lcom_next.c
@@ -36,7 +36,7 @@ static int8_t
s_varname = NULL;
varlen = i + 1;
while ((*p_words)[varlen] != '\0' &&
- !ft_ischarset("$=/#@%^*+{}[],.-", (*p_words)[varlen]))
+ ft_ischarset("$=/#@%^*+{}[],.-", (*p_words)[varlen]) == FALSE)
varlen += 1;
if (!(s_varname = ft_substr(*p_words, (uint32_t)i, varlen - i)))
return (-1);
@@ -86,9 +86,9 @@ char
return (words);
}
i = 0;
- while (word[i] && !ft_ischarset("<>", word[i]))
+ while (word[i] && ft_ischarset("<>", word[i]) == FALSE)
i++;
- while (redir > 0 && ft_isdigit(word[i]))
+ while (redir > 0 && ft_isdigit(word[i]) == TRUE)
i--;
if (!(subst = ft_substr(word, 0, i)))
return (NULL);
@@ -213,7 +213,8 @@ char
reg = TRUE;
isvar = TRUE;
}
- if (*ptr == '\0' || words[i][0] == '=' || ft_isdigit(words[i][0]) == 1)
+ if (*ptr == '\0' || words[i][0] == '=' ||
+ ft_isdigit(words[i][0]) == TRUE)
{
reg = FALSE;
if (i == 0)
diff --git a/src/s_com.c b/src/s_com.c
index 2abbe9e..1bde96c 100644
--- a/src/s_com.c
+++ b/src/s_com.c
@@ -40,7 +40,7 @@ static int8_t
{
/* TODO: cut fd number "msh ~> echo a 2>file" */
/* ^ */
- if (ft_ischarset("<>", words[i][0]))
+ if (ft_ischarset("<>", words[i][0]) == TRUE)
break ;
i++;
}