little mod (makefile + read_file)

This commit is contained in:
Manzovince
2019-04-22 16:27:46 +02:00
parent b5f8e37699
commit 3f6f6f249a
2 changed files with 8 additions and 10 deletions

View File

@@ -6,13 +6,13 @@
# By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# #
# Updated: 2019/04/18 12:27:12 by vmanzoni ### ########.fr #
# Updated: 2019/04/22 15:32:49 by vmanzoni ### ########.fr #
# #
# **************************************************************************** #
NAME = fillit
OBJ_DIR = objs./
OBJ_DIR = ./objs
HEADER = fillit.h
SRCS = main.c \
@@ -20,7 +20,8 @@ SRCS = main.c \
handle_errors.c \
parse_input.c \
get_smallest_square.c \
print_fillit.c
print_fillit.c \
add_to_list.c
OBJS = $(SRCS:.c=.o)
LIB = libft/
@@ -33,7 +34,7 @@ RM = rm -rf
all: $(NAME)
$(NAME):
make -C libft/
make -C $(LIB)
$(CC) $(CFLAGS) -I$(HEADER) -c $(SRCS)
$(CC) -o $(NAME) $(OBJS) -L $(LIB) -lft
mkdir $(OBJ_DIR)

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
/* Updated: 2019/04/19 12:50:32 by hulamy ### ########.fr */
/* Updated: 2019/04/22 15:16:18 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
@@ -29,12 +29,9 @@ char *read_file(char *file)
|| !(result = malloc(sizeof(char) * rv)))
return (NULL);
buf[rv] = '\0';
i = 0;
while (buf[i])
{
i = -1;
while (buf[++i])
result[i] = buf[i];
i++;
}
result[i] = '\0';
close(fd);
return (result);