diff --git a/C_Piscine_C_06/Makefile b/C_Piscine_C_06/Makefile new file mode 100644 index 0000000..a6e9859 --- /dev/null +++ b/C_Piscine_C_06/Makefile @@ -0,0 +1,23 @@ + +# +# Copyright (c) 2021 Guy Baconniere. +# +## How to use this Makefile +# +# cd git +# mkdir ex00 +# cd ex00 +# make -f ../../Makefile ex00 +# + +clone: + @git clone git@vogsphere.42lausanne.ch:vogsphere/intra-uuid-32120416-363c-477f-8da3-664139b0117f-3725548 git + +cc: + @norminette -R CheckForbiddenSourceHeader + @gcc -Wall -Wextra -Werror -o a.out *.c + @./a.out + @rm -f a.out + +all: clone + diff --git a/C_Piscine_C_06/git/ex00/ft_print_program_name.c b/C_Piscine_C_06/git/ex00/ft_print_program_name.c new file mode 100644 index 0000000..370d296 --- /dev/null +++ b/C_Piscine_C_06/git/ex00/ft_print_program_name.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_print_program_name.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/16 17:13:03 by gbaconni #+# #+# */ +/* Updated: 2021/08/16 18:10:43 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +int main(int argc, char *argv[]) +{ + int size; + + size = 0; + while (argc != -1 && argv[0][++size] != '\0') + continue ; + write(1, argv[0], size); + return (0); +} diff --git a/C_Piscine_C_06/git/ex00/main.sh b/C_Piscine_C_06/git/ex00/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_06/git/ex00/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_06/git/ex01/ft_print_params.c b/C_Piscine_C_06/git/ex01/ft_print_params.c new file mode 100644 index 0000000..be9ee25 --- /dev/null +++ b/C_Piscine_C_06/git/ex01/ft_print_params.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_print_params.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/16 18:11:54 by gbaconni #+# #+# */ +/* Updated: 2021/08/16 18:30:48 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +int main(int argc, char *argv[]) +{ + int size; + int i; + + size = 0; + i = 1; + while (argc > 0 && i < argc) + { + while (argv[i][++size] != '\0') + continue ; + write(1, argv[i], size); + write(1, "\n", 1); + i++; + } + return (0); +} diff --git a/C_Piscine_C_06/git/ex01/main.sh b/C_Piscine_C_06/git/ex01/main.sh new file mode 100755 index 0000000..6014300 --- /dev/null +++ b/C_Piscine_C_06/git/ex01/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out $@ +rm -f a.out