From 6bf5dd01493dd6bf644a4896c666535e5eaa8d67 Mon Sep 17 00:00:00 2001 From: Cabergs Charles Date: Mon, 15 Jul 2019 08:15:37 +0200 Subject: c07 passed, c08 in progress, rush01(+ 6x6 try) --- c09/ex00/ft_putchar.c | 18 ++++++++++++++++++ c09/ex00/ft_putstr.c | 19 +++++++++++++++++++ c09/ex00/ft_strcmp.c | 21 +++++++++++++++++++++ c09/ex00/ft_strlen.c | 22 ++++++++++++++++++++++ c09/ex00/ft_swap.c | 20 ++++++++++++++++++++ c09/ex00/libft_creator.sh | 3 +++ c09/ex01/Makefile | 28 ++++++++++++++++++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 c09/ex00/ft_putchar.c create mode 100644 c09/ex00/ft_putstr.c create mode 100644 c09/ex00/ft_strcmp.c create mode 100644 c09/ex00/ft_strlen.c create mode 100644 c09/ex00/ft_swap.c create mode 100644 c09/ex00/libft_creator.sh create mode 100644 c09/ex01/Makefile (limited to 'c09') diff --git a/c09/ex00/ft_putchar.c b/c09/ex00/ft_putchar.c new file mode 100644 index 0000000..8a53dc8 --- /dev/null +++ b/c09/ex00/ft_putchar.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putchar.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/02 22:03:32 by cacharle #+# #+# */ +/* Updated: 2019/07/03 14:21:40 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +void ft_putchar(char c) +{ + write(1, &c, 1); +} diff --git a/c09/ex00/ft_putstr.c b/c09/ex00/ft_putstr.c new file mode 100644 index 0000000..c4f4564 --- /dev/null +++ b/c09/ex00/ft_putstr.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putstr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/11 16:17:16 by cacharle #+# #+# */ +/* Updated: 2019/07/11 16:18:11 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +void ft_putstr(char *str) +{ + while (*str) + write(1, str++, 1); +} diff --git a/c09/ex00/ft_strcmp.c b/c09/ex00/ft_strcmp.c new file mode 100644 index 0000000..8870811 --- /dev/null +++ b/c09/ex00/ft_strcmp.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strcmp.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/11 16:20:33 by cacharle #+# #+# */ +/* Updated: 2019/07/11 16:21:55 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int ft_strcmp(char *s1, char *s2) +{ + while (*s1 == *s2 && *s1 && *s2) + { + s1++; + s2++; + } + return (*s1 - *s2); +} diff --git a/c09/ex00/ft_strlen.c b/c09/ex00/ft_strlen.c new file mode 100644 index 0000000..91e6948 --- /dev/null +++ b/c09/ex00/ft_strlen.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strlen.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/11 16:19:43 by cacharle #+# #+# */ +/* Updated: 2019/07/11 16:20:18 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int ft_strlen(char *str) +{ + int i; + + i = 0; + while (str[i]) + i++; + return (i); +} + diff --git a/c09/ex00/ft_swap.c b/c09/ex00/ft_swap.c new file mode 100644 index 0000000..989b2c2 --- /dev/null +++ b/c09/ex00/ft_swap.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_swap.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/11 16:18:42 by cacharle #+# #+# */ +/* Updated: 2019/07/11 16:19:31 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +void ft_swap(int *a, int *b) +{ + int tmp; + + tmp = *a; + *a = *b; + *b = tmp; +} diff --git a/c09/ex00/libft_creator.sh b/c09/ex00/libft_creator.sh new file mode 100644 index 0000000..f799ee2 --- /dev/null +++ b/c09/ex00/libft_creator.sh @@ -0,0 +1,3 @@ +#!/bin/sh +gcc -c *.c +ar -rcs libft.a *.o diff --git a/c09/ex01/Makefile b/c09/ex01/Makefile new file mode 100644 index 0000000..0fec395 --- /dev/null +++ b/c09/ex01/Makefile @@ -0,0 +1,28 @@ +SRCDIR = srcs +SRC = ft_putchar.c ft_swap.c ft_putstr.c ft_strlen.c ft_strcmp.c +OBJ = $(SRC:.c = .o) +INCLUDEDIR = includes +INCLUDES = ft.h +CC = gcc +CCFLAGS = -Wall -Wextra -Werror +OUT = libft.a + +all: OUT +.PHONY: all + +$(OUT): $(OBJ) + ar -crs $(OBJ) + +$(OBJ): %.o: %.c + $(CC) $(CCFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + rm -f srcs/*.o + +.PHONY: fclean +fclean: clean + rm $(OUT) + +.PHONY: re +re: fclean all -- cgit