From bc2386cc831182e6aa60031c26a9df87c585a3b7 Mon Sep 17 00:00:00 2001 From: Loic Deridder Date: Sat, 15 Feb 2025 09:28:53 +0100 Subject: [PATCH] fix + norm --- Makefile | 4 ++-- lib/libft/srcs/sprintf/ft_sprintf.c | 1 + srcs/env/var.c | 1 + srcs/execution/exec_heredoc.c | 2 -- srcs/execution/exec_redir.c | 1 + srcs/execution/exec_utils.c | 3 ++- srcs/expander/expand_var.c | 1 + srcs/parsing/heredoc/heredoc.c | 7 ++----- srcs/parsing/heredoc/heredoc_utils.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 7e6f116..6d800ad 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CC = gcc +CC = cc WFLAGS = -Wall -Werror -Wextra -g -g3 -ggdb LINK = -lreadline @@ -29,7 +29,7 @@ $(LIBFT): $(LIBFT_SRCS) $(OBJDIR)/%.o: $(SRCDIR)/%.c @mkdir -p $(dir $@) - @$(CC) $(WFLAGS) -gdwarf-4 -MMD -MP -I$(INCDIR) -D DIO_PATH="\"$(HOME)/ast.xml\"" -c $< -o $@ $(LINK) + @$(CC) $(WFLAGS) -gdwarf-4 -MMD -MP -I$(INCDIR) -D DIO_PATH="\"$(HOME)/ast.xml\"" -c $< -o $@ $(NAME): $(LIBFT) $(OBJS) @$(CC) $(WFLAGS) -gdwarf-4 $(OBJS) $(LIBFT) -D DIO_PATH="\"$(HOME)/ast.xml\"" -o $(NAME) $(LINK) diff --git a/lib/libft/srcs/sprintf/ft_sprintf.c b/lib/libft/srcs/sprintf/ft_sprintf.c index 0ed60ce..9af0905 100644 --- a/lib/libft/srcs/sprintf/ft_sprintf.c +++ b/lib/libft/srcs/sprintf/ft_sprintf.c @@ -23,6 +23,7 @@ static char *add_arg(char c, char *str, va_list args) { char *out; + out = NULL; if (c == 'c') out = ft_strfjoinc(str, va_arg(args, int)); else if (c == 's') diff --git a/srcs/env/var.c b/srcs/env/var.c index 3529ee5..e0e70b2 100644 --- a/srcs/env/var.c +++ b/srcs/env/var.c @@ -80,6 +80,7 @@ bool is_valid_key(char *key, t_msh *msh) char *tmp; int i; + i = 0; tmp = ft_strjoin(key, "="); if (!tmp) return (false); diff --git a/srcs/execution/exec_heredoc.c b/srcs/execution/exec_heredoc.c index 9958647..fb2e69a 100644 --- a/srcs/execution/exec_heredoc.c +++ b/srcs/execution/exec_heredoc.c @@ -92,11 +92,9 @@ int ifhere_remove_quote(t_ast_n *node, int j) void read_input(t_ast_n *node, int j) { char *str; - // int len; int check; check = ifhere_remove_quote(node, j); - // len = ft_strlen(node->files[j]); str = get_next_line(node->msh->here_fd, 0); while (str && ft_strncmp(str, node->files[j], ft_strlen(str) - 1) != 0) { diff --git a/srcs/execution/exec_redir.c b/srcs/execution/exec_redir.c index 233a490..caaac22 100644 --- a/srcs/execution/exec_redir.c +++ b/srcs/execution/exec_redir.c @@ -16,6 +16,7 @@ int handle_file(t_ast_n *node, int check, int i) { int fd; + fd = 0; if (check == 1 && access(node->files[i], F_OK)) { ft_fprintf(2, "%s: %s\n", node->files[i], "No such file or directory"); diff --git a/srcs/execution/exec_utils.c b/srcs/execution/exec_utils.c index ad7dd3c..3637bc1 100644 --- a/srcs/execution/exec_utils.c +++ b/srcs/execution/exec_utils.c @@ -6,7 +6,7 @@ /* By: lderidde +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/02/12 09:57:39 by lderidde #+# #+# */ -/* Updated: 2025/02/12 13:30:44 by lderidde ### ########.fr */ +/* Updated: 2025/02/15 09:22:23 by lderidde ### ########.fr */ /* */ /* ************************************************************************** */ @@ -68,6 +68,7 @@ char *execextract_env(char *str, char **envp) char *tmp; i = 1; + tmp = NULL; while (str[i] && execis_validchar(str[i])) i++; if (i > 1) diff --git a/srcs/expander/expand_var.c b/srcs/expander/expand_var.c index 2432303..e2d6112 100644 --- a/srcs/expander/expand_var.c +++ b/srcs/expander/expand_var.c @@ -35,6 +35,7 @@ static char *extract_env(char *str, char **envp) char *tmp; i = 1; + tmp = NULL; while (str[i] && is_exvalidchar(str[i])) i++; if (i > 1) diff --git a/srcs/parsing/heredoc/heredoc.c b/srcs/parsing/heredoc/heredoc.c index c7e3a6a..8028e50 100644 --- a/srcs/parsing/heredoc/heredoc.c +++ b/srcs/parsing/heredoc/heredoc.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* heredoc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: nalebrun +#+ +:+ +#+ */ +/* By: lderidde +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/02/11 09:01:14 by lderidde #+# #+# */ -/* Updated: 2025/02/11 16:31:50 by nalebrun ### ########.fr */ +/* Updated: 2025/02/15 09:28:28 by lderidde ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,6 @@ static void remove_quote(char **new, char *limiter, char c) { - // char *new; int i; int k; int len; @@ -33,8 +32,6 @@ static void remove_quote(char **new, char *limiter, char c) else (*new)[i++] = limiter[k++]; } - // ft_free(str); - // *str = new; } static int ifremove_quote(char **new, char *limiter) diff --git a/srcs/parsing/heredoc/heredoc_utils.c b/srcs/parsing/heredoc/heredoc_utils.c index 64683c2..6adb53e 100644 --- a/srcs/parsing/heredoc/heredoc_utils.c +++ b/srcs/parsing/heredoc/heredoc_utils.c @@ -6,7 +6,7 @@ /* By: lderidde +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/02/12 13:41:03 by lderidde #+# #+# */ -/* Updated: 2025/02/12 13:41:03 by lderidde ### ########.fr */ +/* Updated: 2025/02/15 09:25:49 by lderidde ### ########.fr */ /* */ /* ************************************************************************** */