diff --git a/.gitignore b/.gitignore index cd531cf..9ecd63f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +**/.DS_Store +**/*~ +**/.*.swap + # ---> C # Prerequisites *.d diff --git a/C_Piscine_BSQ/fr.subject.pdf b/C_Piscine_BSQ/fr.subject.pdf new file mode 100644 index 0000000..7817cdb Binary files /dev/null and b/C_Piscine_BSQ/fr.subject.pdf differ diff --git a/C_Piscine_C_00/Makefile b/C_Piscine_C_00/Makefile new file mode 100644 index 0000000..88f3392 --- /dev/null +++ b/C_Piscine_C_00/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-ea6878a3-f0df-459e-8895-725c64a4137b-3699508 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_00/c-00.tar b/C_Piscine_C_00/c-00.tar new file mode 100644 index 0000000..e1428bb Binary files /dev/null and b/C_Piscine_C_00/c-00.tar differ diff --git a/C_Piscine_C_00/fr.subject.pdf b/C_Piscine_C_00/fr.subject.pdf new file mode 100644 index 0000000..3a85c34 Binary files /dev/null and b/C_Piscine_C_00/fr.subject.pdf differ diff --git a/C_Piscine_C_00/git b/C_Piscine_C_00/git new file mode 160000 index 0000000..bcd5d37 --- /dev/null +++ b/C_Piscine_C_00/git @@ -0,0 +1 @@ +Subproject commit bcd5d3704b9b6906377c7c98d3509133cd0def87 diff --git a/C_Piscine_C_00/playlist.html b/C_Piscine_C_00/playlist.html new file mode 100644 index 0000000..515a615 --- /dev/null +++ b/C_Piscine_C_00/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - C-00 - YouTube
\ No newline at end of file diff --git a/C_Piscine_C_01/Makefile b/C_Piscine_C_01/Makefile new file mode 100644 index 0000000..9ba7009 --- /dev/null +++ b/C_Piscine_C_01/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-319e1bc9-2486-42de-9a56-7950c60a4835-3710898 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_01/c-01.tar b/C_Piscine_C_01/c-01.tar new file mode 100644 index 0000000..1120616 Binary files /dev/null and b/C_Piscine_C_01/c-01.tar differ diff --git a/C_Piscine_C_01/fr.subject.pdf b/C_Piscine_C_01/fr.subject.pdf new file mode 100644 index 0000000..18b5289 Binary files /dev/null and b/C_Piscine_C_01/fr.subject.pdf differ diff --git a/C_Piscine_C_01/git b/C_Piscine_C_01/git new file mode 160000 index 0000000..1de0105 --- /dev/null +++ b/C_Piscine_C_01/git @@ -0,0 +1 @@ +Subproject commit 1de01059c39cf016ee7343f2fcbb3092a611d5f2 diff --git a/C_Piscine_C_01/git_old b/C_Piscine_C_01/git_old new file mode 160000 index 0000000..3d5d3e9 --- /dev/null +++ b/C_Piscine_C_01/git_old @@ -0,0 +1 @@ +Subproject commit 3d5d3e90775f13342482bc0bb2cb2bb9b1bed91b diff --git a/C_Piscine_C_01/playlist.html b/C_Piscine_C_01/playlist.html new file mode 100644 index 0000000..ee2897d --- /dev/null +++ b/C_Piscine_C_01/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - C-01 - YouTube
\ No newline at end of file diff --git a/C_Piscine_C_02/Makefile b/C_Piscine_C_02/Makefile new file mode 100644 index 0000000..0ca48ff --- /dev/null +++ b/C_Piscine_C_02/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-0206809b-f597-4ba0-ab8d-b06ca894f9ce-3717791 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_02/c-02.tar b/C_Piscine_C_02/c-02.tar new file mode 100644 index 0000000..7528192 Binary files /dev/null and b/C_Piscine_C_02/c-02.tar differ diff --git a/C_Piscine_C_02/fr.subject.pdf b/C_Piscine_C_02/fr.subject.pdf new file mode 100644 index 0000000..3f91195 Binary files /dev/null and b/C_Piscine_C_02/fr.subject.pdf differ diff --git a/C_Piscine_C_02/git b/C_Piscine_C_02/git new file mode 160000 index 0000000..75cf975 --- /dev/null +++ b/C_Piscine_C_02/git @@ -0,0 +1 @@ +Subproject commit 75cf975de359f1d550bb2d6fb401606a13c764e1 diff --git a/C_Piscine_C_02/git_old b/C_Piscine_C_02/git_old new file mode 160000 index 0000000..54f578e --- /dev/null +++ b/C_Piscine_C_02/git_old @@ -0,0 +1 @@ +Subproject commit 54f578e865bc58cc509434e4ce5af519ee127115 diff --git a/C_Piscine_C_02/git_todo b/C_Piscine_C_02/git_todo new file mode 160000 index 0000000..44a279d --- /dev/null +++ b/C_Piscine_C_02/git_todo @@ -0,0 +1 @@ +Subproject commit 44a279de369b1c698dbd421fbdc0c9377ee923ff diff --git a/C_Piscine_C_02/playlist.html b/C_Piscine_C_02/playlist.html new file mode 100644 index 0000000..914de15 --- /dev/null +++ b/C_Piscine_C_02/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - C-02 - YouTube
\ No newline at end of file diff --git a/C_Piscine_C_02/tests_C02/ex00.c b/C_Piscine_C_02/tests_C02/ex00.c new file mode 100644 index 0000000..f9322b8 --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex00.c @@ -0,0 +1,34 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex00.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:02:50 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 17:02:48 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include "../ex00/ft_strcpy.c" + +int main(void) +{ + char s[42]; + char *d; + char *r; + + d = (char*)malloc(43 * sizeof(char)); + printf("Enter string (max 42 char): "); + scanf("%s", s); + r = ft_strcpy(d, s); + printf("destination : %s | return : %s\n", d, r); + free(d); + d = (char*)malloc(43 * sizeof(char)); + printf("strcpy : %s\n", strcpy(d, s)); + free(d); + return(0); +} diff --git a/C_Piscine_C_02/tests_C02/ex01.c b/C_Piscine_C_02/tests_C02/ex01.c new file mode 100644 index 0000000..034bd46 --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex01.c @@ -0,0 +1,57 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex01.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:03:03 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 16:59:55 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include "../ex01/ft_strncpy.c" +#include "rand_string.c" + +int ft_test(char *src, unsigned int l); + +int main(void) +{ + ft_test("0123456789", 15); + ft_test("test", 8); + ft_test("0123456789" , 3); + ft_test("un autre test" , 0); + return (0); +} + +int ft_test(char *src, unsigned int l) +{ + char *dest; + char *dest2; + int i; + + i = 0; + dest = (char*)malloc(11 * sizeof(char)); + while(i < 10) + { + *(dest + i) = '0'; + i++; + } + *(dest + i) = '\0'; + dest2 = ft_strncpy(dest, src, l); + printf("-------------\nTest\nsrc string : %s | copy lenght : %u\ndest string : %s | output string : %s\n", src, l, dest, dest2); +// Strncpy tests + while(i < 10) + { + *(dest + i) = '0'; + i++; + } + *(dest + i) = '\0'; + dest2 = strncpy(dest, src, l); + printf("TEST string : %s | output TEST : %s\n", dest, dest2); + free(dest); + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex02.c b/C_Piscine_C_02/tests_C02/ex02.c new file mode 100644 index 0000000..422d637 --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex02.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex02.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:03:45 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:03:53 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex02/ft_str_is_alpha.c" + +int main(void) +{ + char c[42]; + + while(1) + { + scanf("%s", c); + printf("is alpha ? : %d\n", ft_str_is_alpha(c)); + } + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex03.c b/C_Piscine_C_02/tests_C02/ex03.c new file mode 100644 index 0000000..4677f56 --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex03.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex03.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:03:58 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:04:00 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex03/ft_str_is_numeric.c" + +int main(void) +{ + char c[42]; + + while(1) + { + scanf("%s", c); + printf("is numeric ? : %d\n", ft_str_is_numeric(c)); + } + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex04.c b/C_Piscine_C_02/tests_C02/ex04.c new file mode 100644 index 0000000..b462f58 --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex04.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex04.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:07:35 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:11:12 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex04/ft_str_is_lowercase.c" + +int main(void) +{ + char c[42]; + + while(1) + { + scanf("%s", c); + printf("is lowercase ? : %d\n", ft_str_is_lowercase(c)); + } + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex05.c b/C_Piscine_C_02/tests_C02/ex05.c new file mode 100644 index 0000000..131abce --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex05.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex05.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:13:08 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:13:13 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex05/ft_str_is_uppercase.c" + +int main(void) +{ + char c[42]; + + while(1) + { + scanf("%s", c); + printf("is uppercase ? : %d\n", ft_str_is_uppercase(c)); + } + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex06.c b/C_Piscine_C_02/tests_C02/ex06.c new file mode 100644 index 0000000..6a1a239 --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex06.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex06.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:13:19 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:13:37 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex06/ft_str_is_printable.c" + +int main(void) +{ + char c[42]; + + while(1) + { + scanf("%s", c); + printf("is printable ? : %d\n", ft_str_is_printable(c)); + } + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex07.c b/C_Piscine_C_02/tests_C02/ex07.c new file mode 100644 index 0000000..7cc800a --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex07.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex07.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:13:42 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:13:47 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex07/ft_strupcase.c" + +int main(void) +{ + char c[42]; + + while(1) + { + scanf("%s", c); + printf("upcased : %s\n", ft_strupcase(c)); + } + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex08.c b/C_Piscine_C_02/tests_C02/ex08.c new file mode 100644 index 0000000..540718b --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex08.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex08.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:13:52 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:13:55 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex08/ft_strlowcase.c" + +int main(void) +{ + char c[42]; + + while(1) + { + scanf("%s", c); + printf("lowcased : %s\n", ft_strlowcase(c)); + } + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex09.c b/C_Piscine_C_02/tests_C02/ex09.c new file mode 100644 index 0000000..a497eeb --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex09.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex09.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:14:28 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 15:14:31 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex09/ft_strcapitalize.c" + +int main(void) +{ + char c[] = "salut, comment tu vas ? 42mots quarante-deux; cinquante+et+un"; + + printf("original :%s\n", c); + printf("capitalized :%s\n", ft_strcapitalize(c)); + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex10.c b/C_Piscine_C_02/tests_C02/ex10.c new file mode 100644 index 0000000..35d4267 --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex10.c @@ -0,0 +1,47 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex10.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:16:23 by tkondrac #+# #+# */ +/* Updated: 2021/08/11 15:01:07 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include "../ex10/ft_strlcpy.c" +#include "rand_string.c" +int ft_test(unsigned int s, unsigned int d); + +int main(void) +{ + ft_test(15 , 8); + ft_test(8 , 15); + ft_test(10 , 2); + ft_test(5 , 0); + return (0); +} + +int ft_test(unsigned int s, unsigned int d) +{ + char *dest; + char *src; + unsigned int n; + size_t t; + + dest = (char*)malloc(d * sizeof(char)); + src = rand_string(s); + n = ft_strlcpy(dest, src, d); + printf("-------------\nTest\nsrc string : %s | dest size : %u\ndest string : %s | output size : %d\n", src, d, dest, n); + free(dest); + dest = (char*)malloc(d * sizeof(char)); + t = strlcpy(dest, src, d); + printf("TEST string : %s | output TEST : %d\n", dest, n); + free(dest); + free(src); + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/ex11.c b/C_Piscine_C_02/tests_C02/ex11.c new file mode 100644 index 0000000..bc41edb --- /dev/null +++ b/C_Piscine_C_02/tests_C02/ex11.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ex11.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 15:48:26 by tkondrac #+# #+# */ +/* Updated: 2021/08/11 16:50:37 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "../ex11/ft_putstr_non_printable.c" + +int main(void) +{ + char c[] = "special : | speciaux : "; + + c[10] = '\n'; + c[25] = 14; + c[26] = 127; + printf("%s\n ------ \n", c); + ft_putstr_non_printable(c); + return (0); +} diff --git a/C_Piscine_C_02/tests_C02/main.sh b/C_Piscine_C_02/tests_C02/main.sh new file mode 100755 index 0000000..68e66ec --- /dev/null +++ b/C_Piscine_C_02/tests_C02/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +test=$1 +set -e +norminette -R CheckForbiddenSourceHeader ../$test/ft_*.c +gcc -Wall -Wextra -Werror -o a.out $test.c +#gcc -o a.out $test.c +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/tests_C02/rand_string.c b/C_Piscine_C_02/tests_C02/rand_string.c new file mode 100644 index 0000000..748cebe --- /dev/null +++ b/C_Piscine_C_02/tests_C02/rand_string.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* rand_string.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tkondrac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/08 12:07:16 by tkondrac #+# #+# */ +/* Updated: 2021/08/08 13:04:23 by tkondrac ### ########.fr */ +/* */ +/* ************************************************************************** */ +#include +#include +#include + +char *rand_string(unsigned int size) +{ + char *c; + unsigned int i; + + c = (char*)malloc(size * sizeof(char)); + i = 0; + srand(time(0)); + while(i < size - 1) + { + *(c + i) = (rand() % 94) + 32; + i++; + } + *(c + i) = '\0'; + return (c); +} diff --git a/C_Piscine_C_02/tmp b/C_Piscine_C_02/tmp new file mode 160000 index 0000000..75cf975 --- /dev/null +++ b/C_Piscine_C_02/tmp @@ -0,0 +1 @@ +Subproject commit 75cf975de359f1d550bb2d6fb401606a13c764e1 diff --git a/C_Piscine_C_03/Makefile b/C_Piscine_C_03/Makefile new file mode 100644 index 0000000..805846a --- /dev/null +++ b/C_Piscine_C_03/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-04054325-5e96-4318-8638-2bf50d0ddf0b-3712109 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_03/c-03.tar b/C_Piscine_C_03/c-03.tar new file mode 100644 index 0000000..b5a9e79 Binary files /dev/null and b/C_Piscine_C_03/c-03.tar differ diff --git a/C_Piscine_C_03/fr.subject.pdf b/C_Piscine_C_03/fr.subject.pdf new file mode 100644 index 0000000..ebf6b85 Binary files /dev/null and b/C_Piscine_C_03/fr.subject.pdf differ diff --git a/C_Piscine_C_03/git b/C_Piscine_C_03/git new file mode 160000 index 0000000..e9226f4 --- /dev/null +++ b/C_Piscine_C_03/git @@ -0,0 +1 @@ +Subproject commit e9226f4f8a7f34d15d3cc8e3cbf3ebeb87b83802 diff --git a/C_Piscine_C_03/playlist.html b/C_Piscine_C_03/playlist.html new file mode 100644 index 0000000..800e19f --- /dev/null +++ b/C_Piscine_C_03/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - C-03 - YouTube
\ No newline at end of file diff --git a/C_Piscine_C_04/Makefile b/C_Piscine_C_04/Makefile new file mode 100644 index 0000000..38762ac --- /dev/null +++ b/C_Piscine_C_04/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-acc6671c-36d9-4ab3-b584-e5cd3b782dc1-3717988 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_04/fr.subject.pdf b/C_Piscine_C_04/fr.subject.pdf new file mode 100644 index 0000000..7e5bf31 Binary files /dev/null and b/C_Piscine_C_04/fr.subject.pdf differ diff --git a/C_Piscine_C_04/git b/C_Piscine_C_04/git new file mode 160000 index 0000000..edd6a9c --- /dev/null +++ b/C_Piscine_C_04/git @@ -0,0 +1 @@ +Subproject commit edd6a9c5c76114d8a3fb6d577f3a4c2886a13545 diff --git a/C_Piscine_C_04/playlist.html b/C_Piscine_C_04/playlist.html new file mode 100644 index 0000000..e259ef2 --- /dev/null +++ b/C_Piscine_C_04/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - C-04 - YouTube
\ No newline at end of file diff --git a/C_Piscine_C_05/fr.subject.pdf b/C_Piscine_C_05/fr.subject.pdf new file mode 100644 index 0000000..6a6a6ff Binary files /dev/null and b/C_Piscine_C_05/fr.subject.pdf differ diff --git a/C_Piscine_C_05/playlist.html b/C_Piscine_C_05/playlist.html new file mode 100644 index 0000000..7902274 --- /dev/null +++ b/C_Piscine_C_05/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - C-05 - YouTube
\ No newline at end of file diff --git a/C_Piscine_C_06/fr.subject.pdf b/C_Piscine_C_06/fr.subject.pdf new file mode 100644 index 0000000..cc3ca61 Binary files /dev/null and b/C_Piscine_C_06/fr.subject.pdf differ diff --git a/C_Piscine_C_06/playlist.html b/C_Piscine_C_06/playlist.html new file mode 100644 index 0000000..0505f84 --- /dev/null +++ b/C_Piscine_C_06/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - C-06 - YouTube
\ No newline at end of file diff --git a/C_Piscine_Shell_00/Makefile b/C_Piscine_Shell_00/Makefile new file mode 100644 index 0000000..77946c0 --- /dev/null +++ b/C_Piscine_Shell_00/Makefile @@ -0,0 +1,127 @@ + +# +# Copyright (c) 2021 Guy Baconniere. +# +## How to use this Makefile +# +# cd git +# mkdir ex00 +# cd ex00 +# make -f ../../Makefile ex00 +# + +hash = \# + +clone: + @git clone git@vogsphere.42lausanne.ch:vogsphere/intra-uuid-6ab96e6e-8d3c-4e8c-98b0-b13b474817ad-3700999 git + +tarball: + @install -d -m 0750 resources + @tar -C resources -xvf resources.tar.gz + +ex00: + @rm -f z + @echo Z > z + @cat z + +ex01: + @rm -f testShell00.tar + @perl -e 'print "42"x20' > testShell00 + @touch -t 2106012342.00 testShell00 + @chmod 0455 testShell00 + @ls -l + @tar -cf testShell00.tar testShell00 + @rm -f testShell00 + +ex02: + @rm -fr test? exo2.tar + @mkdir test0 + @mkdir test2 + @printf "4242" > test1 + @printf "4" > test3 + @printf "42" > test4 + @touch -t 2106012047.00 test0 + @touch -t 2106012146.00 test1 + @touch -t 2106012245.00 test2 + @touch -t 2106012344.00 test3 + @touch -t 2106012343.00 test4 + @ln test3 test5 + @ln -s test0 test6 + @touch -h -t 2106012220.00 test6 + @chmod 0715 test0 + @chmod 0714 test1 + @chmod 0504 test2 + @chmod 0404 test3 + @chmod 0641 test4 + @chmod 0404 test5 + @chmod -h 0755 test6 + @ls -l + @tar -cf exo2.tar * + @rm -fr test? + +ex03: + @rm -f klist.txt + @klist -t || kinit -f -l 10h gbaconni@42LAUSANNE.CH + @klist > klist.txt + @cat klist.txt + +ex04: + @rm -fr midLS test? + @mkdir test0 + @touch -r /usr/bin/topsyscall test1 + @touch -r /bin/sh test2 + @touch test3 + @printf "#!/bin/sh\n" > midLS + @printf "ls -mptU\n" >> midLS + @chmod +x midLS + @./midLS + @rm -fr midLS test? + @printf "ls -mptU\n" > midLS + +ex05: + @rm -fr git_commit.sh + @printf "#!/bin/sh\n" > git_commit.sh + @printf "git log --pretty='%%H' --max-count=5\n" >> git_commit.sh + @chmod +x git_commit.sh + @bash git_commit.sh | cat -e + +ex06: + @rm -fr git_ignore.sh .DS_Store mywork.c~ + @touch .DS_Store mywork.c~ + @printf "#!/bin/sh\n" > git_ignore.sh + @printf "git ls-files --exclude-standard --ignored --others\n" >> git_ignore.sh + @chmod +x git_ignore.sh + @cd .. && bash ex06/git_ignore.sh | cat -e + @rm -fr .DS_Store mywork.c~ + +ex07: + @cp ../../resources/* . + @cp a b + @echo "Enter b" + @patch < sw.diff + @rm -f a sw.diff + +ex08: + @rm -f clean test? ?test + @touch -r /bin/sh "test$(hash)" + @touch "$(hash)test" + @touch "test~" + @touch "test0" + @printf "#!/bin/sh\n" > clean + @printf "find . -type f \( -name '*~' -o -name '#*#' \) -print -delete\n" >> clean + @chmod +x clean + @./clean + @ls -l + @rm -f clean test? ?test + @printf "find . -type f \( -name '*~' -o -name '#*#' \) -print -delete\n" >> clean + +ex09: + @rm -f ft_magic test? + @touch -r /bin/sh "test0" + @perl -e 'print "\0"x41 . "42"' > "test1" + @printf "41\tstring\t42\t42 file\n" > ft_magic + @file -m ft_magic * + @rm -f test? + +all: clone + diff --git a/C_Piscine_Shell_00/fr.subject.pdf b/C_Piscine_Shell_00/fr.subject.pdf new file mode 100644 index 0000000..2a80045 Binary files /dev/null and b/C_Piscine_Shell_00/fr.subject.pdf differ diff --git a/C_Piscine_Shell_00/git b/C_Piscine_Shell_00/git new file mode 160000 index 0000000..c34d7f6 --- /dev/null +++ b/C_Piscine_Shell_00/git @@ -0,0 +1 @@ +Subproject commit c34d7f6d55761bd6e937f7d97d9c0b44c72e2bed diff --git a/C_Piscine_Shell_00/git_old b/C_Piscine_Shell_00/git_old new file mode 160000 index 0000000..50ee51f --- /dev/null +++ b/C_Piscine_Shell_00/git_old @@ -0,0 +1 @@ +Subproject commit 50ee51f097502afd203999d771eb9b35298c8591 diff --git a/C_Piscine_Shell_00/playlist.html b/C_Piscine_Shell_00/playlist.html new file mode 100644 index 0000000..545fb58 --- /dev/null +++ b/C_Piscine_Shell_00/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - S-00 - YouTube
\ No newline at end of file diff --git a/C_Piscine_Shell_00/resources.tar.gz b/C_Piscine_Shell_00/resources.tar.gz new file mode 100644 index 0000000..6f50a53 Binary files /dev/null and b/C_Piscine_Shell_00/resources.tar.gz differ diff --git a/C_Piscine_Shell_00/resources/a b/C_Piscine_Shell_00/resources/a new file mode 100644 index 0000000..f24763a --- /dev/null +++ b/C_Piscine_Shell_00/resources/a @@ -0,0 +1,9 @@ +STARWARS +Episode IV, A NEW HOPE It is a period of civil war. + +Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire. +During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the DEATH STAR, +an armored space station with enough power to destroy an entire planet. + +Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy... + diff --git a/C_Piscine_Shell_00/resources/sw.diff b/C_Piscine_Shell_00/resources/sw.diff new file mode 100644 index 0000000..f4747ca --- /dev/null +++ b/C_Piscine_Shell_00/resources/sw.diff @@ -0,0 +1,18 @@ +1,2c1,8 +< STARWARS +< Episode IV, A NEW HOPE It is a period of civil war. +--- +> Episode V, A NEW H0PE It is a period of civil war +> Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire. +> During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the STAR DEATH, an armored space station with enough power to destroy an entire planet. +> +> +> Pursued by the Empire's sinister agents, +> Princess Mehdi races home aboard her starship, custodian of the stolen plans that can save her people and restore the dictatorship to the galaxie.. +> +4,6d9 +< Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire. +< During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the DEATH STAR, +< an armored space station with enough power to destroy an entire planet. +8d10 +< Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy... diff --git a/C_Piscine_Shell_00/tmp/exo2.tar b/C_Piscine_Shell_00/tmp/exo2.tar new file mode 100644 index 0000000..fa3ec78 Binary files /dev/null and b/C_Piscine_Shell_00/tmp/exo2.tar differ diff --git a/C_Piscine_Shell_00/tmp/t b/C_Piscine_Shell_00/tmp/t new file mode 120000 index 0000000..29f446a --- /dev/null +++ b/C_Piscine_Shell_00/tmp/t @@ -0,0 +1 @@ +test3 \ No newline at end of file diff --git a/C_Piscine_Shell_00/tmp/test1 b/C_Piscine_Shell_00/tmp/test1 new file mode 100755 index 0000000..629d685 --- /dev/null +++ b/C_Piscine_Shell_00/tmp/test1 @@ -0,0 +1 @@ +4242 \ No newline at end of file diff --git a/C_Piscine_Shell_00/tmp/test3 b/C_Piscine_Shell_00/tmp/test3 new file mode 100644 index 0000000..bf0d87a --- /dev/null +++ b/C_Piscine_Shell_00/tmp/test3 @@ -0,0 +1 @@ +4 \ No newline at end of file diff --git a/C_Piscine_Shell_00/tmp/test4 b/C_Piscine_Shell_00/tmp/test4 new file mode 100644 index 0000000..f70d7bb --- /dev/null +++ b/C_Piscine_Shell_00/tmp/test4 @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/C_Piscine_Shell_00/tmp/test5 b/C_Piscine_Shell_00/tmp/test5 new file mode 100644 index 0000000..bf0d87a --- /dev/null +++ b/C_Piscine_Shell_00/tmp/test5 @@ -0,0 +1 @@ +4 \ No newline at end of file diff --git a/C_Piscine_Shell_00/tmp/test6 b/C_Piscine_Shell_00/tmp/test6 new file mode 120000 index 0000000..a39c44c --- /dev/null +++ b/C_Piscine_Shell_00/tmp/test6 @@ -0,0 +1 @@ +test0 \ No newline at end of file diff --git a/C_Piscine_Shell_01/Makefile b/C_Piscine_Shell_01/Makefile new file mode 100644 index 0000000..a1e8765 --- /dev/null +++ b/C_Piscine_Shell_01/Makefile @@ -0,0 +1,81 @@ + +# +# Copyright (c) 2021 Guy Baconniere. +# +## How to use this Makefile +# +# cd git +# mkdir ex01 +# cd ex01 +# make -f ../../Makefile ex01 +# + +marvin = "\"\\\?\$$\*\'MaRViN\'\*\$$\?\\\"" + +clone: + @git clone git@vogsphere.42lausanne.ch:vogsphere/intra-uuid-a2e8ee6f-787d-4ee8-9eb4-359821770152-3701046 git + +ex01: + @rm -f print_groups.sh + @printf "#!/bin/sh\n" > print_groups.sh + @printf "id -Gn \$$FT_USER | tr ' ' ','\n" >> print_groups.sh + @chmod +x print_groups.sh + @FT_USER=daemon ./print_groups.sh | cat -e + +ex02: + @rm -f find_sh.sh file?.sh + @touch file1.sh file2.sh file3.sh + @printf "#!/bin/sh\n" > find_sh.sh + @printf "find . -type f -name '*.sh' -exec basename '{}' .sh \;\n" >> find_sh.sh + @chmod +x ./find_sh.sh + @./find_sh.sh | cat -e + @rm -f file?.sh + +ex03: + @rm -f count_files.sh file* + @touch file{1..40} + @printf "#!/bin/sh\n" > count_files.sh + @printf "find . \( -type f -o -type d \) | wc -l | tr -d ' '\n" >> count_files.sh + @chmod +x ./count_files.sh + @./count_files.sh | cat -e + @rm -f file* + +ex04: + @rm -f MAC.sh + @printf "#!/bin/sh\n" > MAC.sh + @printf "ifconfig | grep -oE 'ether .*' | cut -c7-23\n" >> MAC.sh + @chmod +x ./MAC.sh + @./MAC.sh | cat -e + +ex05: + @rm -f -- *MaRV* + @printf "42" > "$(marvin)" + @touch -t 10021221.00 "$(marvin)" + @chmod 0614 "$(marvin)" + @ls -lRA *MaRV* | cat -e + +ex06: + @rm -f skip.sh file* + @touch file{1..8} + @printf "#!/bin/sh\n" > skip.sh + @printf "ls -l | awk '{ if ((NR + 1) %% 2 == 0) print \$$0 }'\n" >> skip.sh + @chmod +x ./skip.sh + @./skip.sh | cat -e + @rm -f file* + +ex07: + @rm -f r_dwssap.sh + @printf "#!/bin/sh\n" > r_dwssap.sh + @printf "grep -v '^#' /etc/passwd | awk -F ':' '/^FT_LINE1/,/^FT_LINE2/ { n++; login=\$$1; rev=\"rev <<<\"login; rev | getline revlogin; close(rev); print ((n > 1) && ((n+1) %% 2 == 0))? revlogin:login }' | sort -rh | tr '\\\\n' ' ' | sed 's/ $$/./; s/ /, /g;'\n" >> r_dwssap.sh + @chmod +x ./r_dwssap.sh + @./r_dwssap.sh | cat -e + +ex08: + @rm -f add_chelou.sh + @printf "#!/bin/sh\n" > add_chelou.sh + @printf "echo Trop chelou de jouer avec tr et de jouer cet escape game.\n" >> add_chelou.sh + @chmod +x ./add_chelou.sh + @./add_chelou.sh | cat -e + +all: clone + diff --git a/C_Piscine_Shell_01/fr.subject.pdf b/C_Piscine_Shell_01/fr.subject.pdf new file mode 100644 index 0000000..6f4eba7 Binary files /dev/null and b/C_Piscine_Shell_01/fr.subject.pdf differ diff --git a/C_Piscine_Shell_01/git b/C_Piscine_Shell_01/git new file mode 160000 index 0000000..29fde0b --- /dev/null +++ b/C_Piscine_Shell_01/git @@ -0,0 +1 @@ +Subproject commit 29fde0bf4e7c91d264e03110be3b2a209cc6fa23 diff --git a/C_Piscine_Shell_01/git_old b/C_Piscine_Shell_01/git_old new file mode 160000 index 0000000..e9d3fc5 --- /dev/null +++ b/C_Piscine_Shell_01/git_old @@ -0,0 +1 @@ +Subproject commit e9d3fc51d723d666927b75ee5fe86e1f2e7a0c38 diff --git a/C_Piscine_Shell_01/playlist.html b/C_Piscine_Shell_01/playlist.html new file mode 100644 index 0000000..07c1267 --- /dev/null +++ b/C_Piscine_Shell_01/playlist.html @@ -0,0 +1,21 @@ +
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features
PEDAGO@42 - S-00 - YouTube
\ No newline at end of file