summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSalad <water_appreciator@protonmail.com>2020-12-04 21:40:49 +0100
committerSalad <water_appreciator@protonmail.com>2020-12-04 21:40:49 +0100
commit46f8585e463d1617bb120894afaec7f51cf85153 (patch)
treeed4dc8f3c8a719de3fc54a6c228cfc0fdf2653c9
parentfix (diff)
download42-minishell-46f8585e463d1617bb120894afaec7f51cf85153.tar.gz
42-minishell-46f8585e463d1617bb120894afaec7f51cf85153.tar.bz2
42-minishell-46f8585e463d1617bb120894afaec7f51cf85153.tar.xz
42-minishell-46f8585e463d1617bb120894afaec7f51cf85153.tar.zst
42-minishell-46f8585e463d1617bb120894afaec7f51cf85153.zip
gnu c compiler compatible
-rw-r--r--Makefile2
-rw-r--r--src/c_init.c2
-rw-r--r--src/c_keys.c2
-rw-r--r--src/c_utils.c4
-rw-r--r--src/p_redirs.c2
5 files changed, 5 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index fb85687..c319f3b 100644
--- a/Makefile
+++ b/Makefile
@@ -122,7 +122,7 @@ ifeq (${OS}, FreeBSD)
CC = cc
endif
ifeq (${OS}, Linux)
-CC = clang
+CC = gcc
endif
ifeq (${OS}, Darwin)
CC = cc
diff --git a/src/c_init.c b/src/c_init.c
index 5ba6a67..7a1509c 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -163,10 +163,8 @@ static char
*c_process_key(char *buf, t_caps *tcaps, t_msh *msh)
{
static char *line = NULL;
- int i;
char *ptr;
- i = -1;
if (line == NULL)
if (!(line = ft_calloc(1, sizeof(char))))
return (NULL);
diff --git a/src/c_keys.c b/src/c_keys.c
index 3d80327..93bb04b 100644
--- a/src/c_keys.c
+++ b/src/c_keys.c
@@ -37,7 +37,7 @@ short
}
else if (i >= 1)
{
- while (--i >= 0)
+ while (--i > 0)
tputs(tgetstr("le", NULL), 1, ft_putchar);
}
tcaps->cpos = 0;
diff --git a/src/c_utils.c b/src/c_utils.c
index a25a35a..fa2eaaf 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -99,7 +99,7 @@ char
return (dst);
}
-static short
+static unsigned int
c_redraw_next(size_t plen, unsigned int len, t_caps *tcaps)
{
unsigned int i;
@@ -129,7 +129,7 @@ static short
return (len);
}
-short
+unsigned int
c_redraw_line(char *line, t_caps *tcaps, t_msh *msh)
{
unsigned int i;
diff --git a/src/p_redirs.c b/src/p_redirs.c
index b1e6914..8b38f44 100644
--- a/src/p_redirs.c
+++ b/src/p_redirs.c
@@ -129,7 +129,7 @@ static unsigned char p_get_redir(char word[],
fd_rdr[RDR] = (fd_rdr[RDR] == -2 && *(ptr + 2) == '-') ? (-3) : (fd_rdr[1]);
pos[0] = (fd_rdr[FD] == STDOUT_FILENO) ?
(ptr - word) : ((ptr - word) - ft_intlen(fd_rdr[FD]));
- pos[0] = (fd_rdr[FD] == -2) ? ((ptr - word) - 1) : (pos[0]);
+ pos[0] = (fd_rdr[FD] == -2) ? (size_t)((ptr - word) - 1) : (pos[0]);
fd_rdr[FD] = (fd_rdr[FD] == -2) ? (STDOUT_FILENO) : (fd_rdr[FD]);
tmp.word = word;
tmp.ptr = ptr;