Add all files
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
**/.DS_Store
|
||||||
|
**/*~
|
||||||
|
**/.*.swap
|
||||||
|
|
||||||
# ---> C
|
# ---> C
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|||||||
Binary file not shown.
@@ -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
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Submodule
+1
Submodule C_Piscine_C_00/git added at bcd5d3704b
File diff suppressed because one or more lines are too long
@@ -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
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Submodule
+1
Submodule C_Piscine_C_01/git added at 1de01059c3
Submodule
+1
Submodule C_Piscine_C_01/git_old added at 3d5d3e9077
File diff suppressed because one or more lines are too long
@@ -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
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Submodule
+1
Submodule C_Piscine_C_02/git added at 75cf975de3
Submodule
+1
Submodule C_Piscine_C_02/git_old added at 54f578e865
Submodule
+1
Submodule C_Piscine_C_02/git_todo added at 44a279de36
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex00.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:02:50 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 17:02:48 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex01.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:03:03 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 16:59:55 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex02.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:03:45 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:03:53 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex03.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:03:58 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:04:00 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex04.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:07:35 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:11:12 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex05.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:13:08 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:13:13 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex06.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:13:19 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:13:37 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex07.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:13:42 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:13:47 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex08.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:13:52 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:13:55 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex09.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:14:28 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 15:14:31 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex10.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:16:23 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/11 15:01:07 by gbaconni ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ex11.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 15:48:26 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/11 16:50:37 by gbaconni ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
Executable
+8
@@ -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
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* rand_string.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tkondrac <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/08/08 12:07:16 by tkondrac #+# #+# */
|
||||||
|
/* Updated: 2021/08/08 13:04:23 by tkondrac ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
Submodule
+1
Submodule C_Piscine_C_02/tmp added at 75cf975de3
@@ -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
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Submodule
+1
Submodule C_Piscine_C_03/git added at e9226f4f8a
File diff suppressed because one or more lines are too long
@@ -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
|
||||||
|
|
||||||
Binary file not shown.
Submodule
+1
Submodule C_Piscine_C_04/git added at edd6a9c5c7
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -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
|
||||||
|
|
||||||
Binary file not shown.
Submodule
+1
Submodule C_Piscine_Shell_00/git added at c34d7f6d55
Submodule
+1
Submodule C_Piscine_Shell_00/git_old added at 50ee51f097
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -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...
|
||||||
|
|
||||||
@@ -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...
|
||||||
Binary file not shown.
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
test3
|
||||||
Executable
+1
@@ -0,0 +1 @@
|
|||||||
|
4242
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
4
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
42
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
4
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
test0
|
||||||
@@ -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
|
||||||
|
|
||||||
Binary file not shown.
Submodule
+1
Submodule C_Piscine_Shell_01/git added at 29fde0bf4e
Submodule
+1
Submodule C_Piscine_Shell_01/git_old added at e9d3fc51d7
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user