From 50c660a9d6358545ee7d9059adbbe7c00e53ab7a Mon Sep 17 00:00:00 2001 From: Gregory Tertyshny Date: Mon, 26 Dec 2016 19:32:47 +0200 Subject: [PATCH] second and, maybe, last commit --- Makefile | 15 +++++++++------ auteur | 1 + libft/author | 1 - obj/.gitkeep | 0 src/check.c | 19 ++++++++++++++----- 5 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 auteur delete mode 100644 libft/author delete mode 100644 obj/.gitkeep diff --git a/Makefile b/Makefile index cea4267..993ca40 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: gtertysh +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/12/14 16:54:48 by gtertysh #+# #+# # -# Updated: 2016/12/23 19:59:53 by gtertysh ### ########.fr # +# Updated: 2016/12/26 19:11:43 by gtertysh ### ########.fr # # # # **************************************************************************** # @@ -51,19 +51,22 @@ CC = clang all: $(NAME) -$(NAME): $(OBJ) $(LIBFOLDER)$(LIB) +$(NAME): $(OBJ) $(LIBFOLDER)$(LIB) $(OBJDIR) $(CC) $(FLAGS) $(OBJ) $(LIBFLAGS) -o $(NAME) -$(OBJDIR)%.o : $(SRCDIR)%.c +$(OBJDIR)%.o : $(SRCDIR)%.c $(CC) $(FLAGS) $(INC) -c $< -o $@ +$(OBJDIR): + mkdir $(OBJDIR) + $(LIBFOLDER)$(LIB): make -C $(LIBFOLDER) -clean: +clean: libclean rm -rf $(OBJ) -fclean: clean +fclean: clean libfclean rm -rf $(NAME) libclean: @@ -72,4 +75,4 @@ libclean: libfclean: make fclean -C $(LIBFOLDER) -re: fclean libfclean all +re: clean all diff --git a/auteur b/auteur new file mode 100644 index 0000000..45726bb --- /dev/null +++ b/auteur @@ -0,0 +1 @@ +gtertysh:ykolomie diff --git a/libft/author b/libft/author deleted file mode 100644 index 913d4c1..0000000 --- a/libft/author +++ /dev/null @@ -1 +0,0 @@ -gtertysh diff --git a/obj/.gitkeep b/obj/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/check.c b/src/check.c index a64c573..867349c 100644 --- a/src/check.c +++ b/src/check.c @@ -6,7 +6,7 @@ /* By: gtertysh +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/26 15:30:15 by gtertysh #+# #+# */ -/* Updated: 2016/12/26 15:30:19 by gtertysh ### ########.fr */ +/* Updated: 2016/12/26 19:31:18 by gtertysh ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,14 +15,21 @@ void check_endline(char *str) { int i; + int hashes; - i = 4; + hashes = 0; + i = 0; while (i < 20) { - if (!(str[i] == '\n')) - error(); - i += 5; + if (str[i] == '#') + hashes++; + if ((i + 1) % 5 == 0) + if (str[i] != '\n') + error(); + i++; } + if (hashes != 4) + error(); } void check_char(char ch) @@ -38,6 +45,8 @@ void check_string(char *string_ttrs) i = 0; j = 0; + if (string_ttrs[0] == '\0') + error(); while (string_ttrs[i]) { check_char(string_ttrs[i]);