aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-07-02 23:44:43 +0200
committerCharles <sircharlesaze@gmail.com>2019-07-02 23:44:43 +0200
commit9bde00749e9944c357267a024b3ec78d81a6799c (patch)
treeda718a1c479f0846d29326c63e925a35c1e9d4ee
parent194a9c63eea7c053ea8eddcc6e24a5f4053febe7 (diff)
downloadpiscine-9bde00749e9944c357267a024b3ec78d81a6799c.tar.gz
piscine-9bde00749e9944c357267a024b3ec78d81a6799c.tar.bz2
piscine-9bde00749e9944c357267a024b3ec78d81a6799c.zip
c00 start, shell01 ex01 correcion
-rw-r--r--.gitignore1
-rw-r--r--c00/ex00/ft_putchar.c28
-rw-r--r--c00/ex01/ft_print_alphabet.c33
-rw-r--r--c00/ex02/ft_print_reverse_alphabet.c33
-rw-r--r--c00/ex03/ft_print_numbers.c33
-rw-r--r--c00/ex04/ft_is_negative.c36
-rw-r--r--c00/ex05/ft_print_comb.c61
-rwxr-xr-xj01/ex01/print_groups.sh1
-rwxr-xr-xj01/ex04/MAC.sh1
-rwxr-xr-xj01/ex08/add_chelou.sh12
-rw-r--r--shell00/ex00/z (renamed from j00/ex00/z)0
-rw-r--r--shell00/ex01/testShell00.tar (renamed from j00/ex01/testShell00.tar)bin2048 -> 2048 bytes
-rw-r--r--shell00/ex02/exo2.tar (renamed from j00/ex02/exo2.tar)bin6144 -> 6144 bytes
-rw-r--r--shell00/ex03/klist.txt (renamed from j00/ex03/klist.txt)0
-rwxr-xr-xshell00/ex04/midLS (renamed from j00/ex04/midLS)0
-rwxr-xr-xshell00/ex05/git_commit.sh (renamed from j00/ex05/git_commit.sh)0
-rw-r--r--shell00/ex06/.gitignore (renamed from j00/ex06/.gitignore)0
-rwxr-xr-xshell00/ex06/git_ignore.sh (renamed from j00/ex06/git_ignore.sh)0
-rw-r--r--shell00/ex07/b (renamed from j00/ex07/b)0
-rwxr-xr-xshell00/ex08/clean (renamed from j00/ex08/clean)0
-rwxr-xr-xshell01/ex01/print_groups.sh1
-rwxr-xr-xshell01/ex02/find_sh.sh (renamed from j01/ex02/find_sh.sh)0
-rwxr-xr-xshell01/ex03/count_files.sh (renamed from j01/ex03/count_files.sh)0
-rwxr-xr-xshell01/ex04/MAC.sh1
-rw-r--r--shell01/ex05/"\?$*'MaRViN'*$?\" (renamed from j01/ex05/"\?$*'MaRViN'*$?\")0
-rwxr-xr-xshell01/ex06/skip.sh (renamed from j01/ex06/skip.sh)0
-rwxr-xr-xshell01/ex07/r_dwssap.sh (renamed from j01/ex07/r_dwssap.sh)0
-rwxr-xr-xshell01/ex08/add_chelou.sh14
28 files changed, 241 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cba7efc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+a.out
diff --git a/c00/ex00/ft_putchar.c b/c00/ex00/ft_putchar.c
new file mode 100644
index 0000000..b09b871
--- /dev/null
+++ b/c00/ex00/ft_putchar.c
@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_putchar.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/02 22:03:32 by cacharle #+# #+# */
+/* Updated: 2019/07/02 22:33:32 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include <unistd.h>
+
+void ft_putchar(char c);
+
+void ft_putchar(char c)
+{
+ write(1, &c, 1);
+}
+
+int main(void)
+{
+ ft_putchar('a');
+ ft_putchar('b');
+ ft_putchar('c');
+ return (0);
+}
diff --git a/c00/ex01/ft_print_alphabet.c b/c00/ex01/ft_print_alphabet.c
new file mode 100644
index 0000000..f75442d
--- /dev/null
+++ b/c00/ex01/ft_print_alphabet.c
@@ -0,0 +1,33 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_print_alphabet.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/02 22:18:43 by cacharle #+# #+# */
+/* Updated: 2019/07/02 22:33:52 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include <unistd.h>
+
+void ft_print_alphabet(void);
+
+void ft_print_alphabet(void)
+{
+ char letter;
+
+ letter = 'a';
+ while (letter != 'z' + 1)
+ {
+ write(1, &letter, 1);
+ letter++;
+ }
+}
+
+int main(void)
+{
+ ft_print_alphabet();
+ return (0);
+}
diff --git a/c00/ex02/ft_print_reverse_alphabet.c b/c00/ex02/ft_print_reverse_alphabet.c
new file mode 100644
index 0000000..d36b6c0
--- /dev/null
+++ b/c00/ex02/ft_print_reverse_alphabet.c
@@ -0,0 +1,33 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_print_reverse_alphabet.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/02 22:27:12 by cacharle #+# #+# */
+/* Updated: 2019/07/02 22:31:18 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include <unistd.h>
+
+void ft_print_reverse_alphabet(void);
+
+void ft_print_reverse_alphabet(void)
+{
+ char letter;
+
+ letter = 'z';
+ while (letter != 'a' - 1)
+ {
+ write(1, &letter, 1);
+ letter--;
+ }
+}
+
+int main(void)
+{
+ ft_print_reverse_alphabet();
+ return (0);
+}
diff --git a/c00/ex03/ft_print_numbers.c b/c00/ex03/ft_print_numbers.c
new file mode 100644
index 0000000..9f8f947
--- /dev/null
+++ b/c00/ex03/ft_print_numbers.c
@@ -0,0 +1,33 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_print_numbers.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/02 22:36:58 by cacharle #+# #+# */
+/* Updated: 2019/07/02 22:40:46 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include <unistd.h>
+
+void ft_print_numbers(void);
+
+void ft_print_numbers(void)
+{
+ char number;
+
+ number = '0';
+ while (number != '9' + 1)
+ {
+ write(1, &number, 1);
+ number++;
+ }
+}
+
+int main(void)
+{
+ ft_print_numbers();
+ return (0);
+}
diff --git a/c00/ex04/ft_is_negative.c b/c00/ex04/ft_is_negative.c
new file mode 100644
index 0000000..58c1b60
--- /dev/null
+++ b/c00/ex04/ft_is_negative.c
@@ -0,0 +1,36 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_is_negative.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/02 22:43:22 by cacharle #+# #+# */
+/* Updated: 2019/07/02 22:50:01 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include <unistd.h>
+
+void ft_is_negative(int n);
+
+void ft_is_negative(int n)
+{
+ char negative_char;
+ char positive_char;
+
+ negative_char = 'N';
+ positive_char = 'P';
+ if (n < 0)
+ write(1, &negative_char, 1);
+ else
+ write(1, &positive_char, 1);
+}
+
+int main(void)
+{
+ ft_is_negative(-1);
+ ft_is_negative(1);
+ ft_is_negative(0);
+ return (0);
+}
diff --git a/c00/ex05/ft_print_comb.c b/c00/ex05/ft_print_comb.c
new file mode 100644
index 0000000..1a1ddf3
--- /dev/null
+++ b/c00/ex05/ft_print_comb.c
@@ -0,0 +1,61 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_print_comb.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/02 22:55:29 by cacharle #+# #+# */
+/* Updated: 2019/07/02 23:14:29 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include <unistd.h>
+
+void ft_print_comb(void);
+
+void write_xyz_comb(int x, int y, int z)
+{
+ char x_char;
+ char y_char;
+ char z_char;
+
+ x_char = x + '0';
+ y_char = y + '0';
+ z_char = z + '0';
+ write(1, &x_char, 1);
+ write(1, &y_char, 1);
+ write(1, &z_char, 1);
+}
+
+void ft_print_comb(void)
+{
+ char x;
+ char y;
+ char z;
+
+ x = 0;
+ y = 0;
+ z = 0;
+ while (x < 10)
+ {
+ while (y < 10)
+ {
+ while (z < 10)
+ {
+ if (x != y && x != z && y != z)
+ write_xyz_comb(x, y, z);
+ z++;
+ }
+ y++;
+ }
+ x++;
+ }
+}
+
+int main(void)
+{
+ ft_print_comb();
+ return (0);
+}
+
diff --git a/j01/ex01/print_groups.sh b/j01/ex01/print_groups.sh
deleted file mode 100755
index b233ef0..0000000
--- a/j01/ex01/print_groups.sh
+++ /dev/null
@@ -1 +0,0 @@
-groups $FT_USER | tr " " ","
diff --git a/j01/ex04/MAC.sh b/j01/ex04/MAC.sh
deleted file mode 100755
index ec2dc93..0000000
--- a/j01/ex04/MAC.sh
+++ /dev/null
@@ -1 +0,0 @@
-ifconfig -a | grep -E "ether\s([0-9a-f]{2}:){5}[0-9a-f]{2}" | sed "s/.*ether //g" | sed "s/ $//g" | sort | uniq
diff --git a/j01/ex08/add_chelou.sh b/j01/ex08/add_chelou.sh
deleted file mode 100755
index 05e222c..0000000
--- a/j01/ex08/add_chelou.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-echo $FT_NBR1
-B10_1=$(echo $FT_NBR1 | tr "'\\$(echo '\"')?!" "01234")
-echo $B10_1
-echo $FT_NBR2
-B10_2=$(echo $FT_NBR2 | tr "mrdoc" "01234")
-echo $B10_2
-
-ADD=$(echo "ibase=5; obase=13; $B10_1 + $B10_2" | bc)
-echo $ADD
-
-ADD_CONV=$(echo $ADD | tr "0123456789abc" "gtaio luSmemf")
-echo $ADD_CONV
diff --git a/j00/ex00/z b/shell00/ex00/z
index e900b1c..e900b1c 100644
--- a/j00/ex00/z
+++ b/shell00/ex00/z
diff --git a/j00/ex01/testShell00.tar b/shell00/ex01/testShell00.tar
index 000c1fc..000c1fc 100644
--- a/j00/ex01/testShell00.tar
+++ b/shell00/ex01/testShell00.tar
Binary files differ
diff --git a/j00/ex02/exo2.tar b/shell00/ex02/exo2.tar
index 9bd61b0..9bd61b0 100644
--- a/j00/ex02/exo2.tar
+++ b/shell00/ex02/exo2.tar
Binary files differ
diff --git a/j00/ex03/klist.txt b/shell00/ex03/klist.txt
index 19c5ebc..19c5ebc 100644
--- a/j00/ex03/klist.txt
+++ b/shell00/ex03/klist.txt
diff --git a/j00/ex04/midLS b/shell00/ex04/midLS
index 2b9b431..2b9b431 100755
--- a/j00/ex04/midLS
+++ b/shell00/ex04/midLS
diff --git a/j00/ex05/git_commit.sh b/shell00/ex05/git_commit.sh
index 4a62cc5..4a62cc5 100755
--- a/j00/ex05/git_commit.sh
+++ b/shell00/ex05/git_commit.sh
diff --git a/j00/ex06/.gitignore b/shell00/ex06/.gitignore
index f539d25..f539d25 100644
--- a/j00/ex06/.gitignore
+++ b/shell00/ex06/.gitignore
diff --git a/j00/ex06/git_ignore.sh b/shell00/ex06/git_ignore.sh
index f539d25..f539d25 100755
--- a/j00/ex06/git_ignore.sh
+++ b/shell00/ex06/git_ignore.sh
diff --git a/j00/ex07/b b/shell00/ex07/b
index c2dab24..c2dab24 100644
--- a/j00/ex07/b
+++ b/shell00/ex07/b
diff --git a/j00/ex08/clean b/shell00/ex08/clean
index 43d8991..43d8991 100755
--- a/j00/ex08/clean
+++ b/shell00/ex08/clean
diff --git a/shell01/ex01/print_groups.sh b/shell01/ex01/print_groups.sh
new file mode 100755
index 0000000..b3d02de
--- /dev/null
+++ b/shell01/ex01/print_groups.sh
@@ -0,0 +1 @@
+groups $FT_USER | tr " " "," | tr -d "\n"
diff --git a/j01/ex02/find_sh.sh b/shell01/ex02/find_sh.sh
index 3f13587..3f13587 100755
--- a/j01/ex02/find_sh.sh
+++ b/shell01/ex02/find_sh.sh
diff --git a/j01/ex03/count_files.sh b/shell01/ex03/count_files.sh
index 4b9918a..4b9918a 100755
--- a/j01/ex03/count_files.sh
+++ b/shell01/ex03/count_files.sh
diff --git a/shell01/ex04/MAC.sh b/shell01/ex04/MAC.sh
new file mode 100755
index 0000000..8c5f269
--- /dev/null
+++ b/shell01/ex04/MAC.sh
@@ -0,0 +1 @@
+ifconfig -a | grep -E "ether\s([0-9a-f]{2}:){5}[0-9a-f]{2}" | cut -f 1
diff --git a/j01/ex05/"\?$*'MaRViN'*$?\" b/shell01/ex05/"\?$*'MaRViN'*$?\"
index f70d7bb..f70d7bb 100644
--- a/j01/ex05/"\?$*'MaRViN'*$?\"
+++ b/shell01/ex05/"\?$*'MaRViN'*$?\"
diff --git a/j01/ex06/skip.sh b/shell01/ex06/skip.sh
index 830c966..830c966 100755
--- a/j01/ex06/skip.sh
+++ b/shell01/ex06/skip.sh
diff --git a/j01/ex07/r_dwssap.sh b/shell01/ex07/r_dwssap.sh
index e40a78b..e40a78b 100755
--- a/j01/ex07/r_dwssap.sh
+++ b/shell01/ex07/r_dwssap.sh
diff --git a/shell01/ex08/add_chelou.sh b/shell01/ex08/add_chelou.sh
new file mode 100755
index 0000000..7cb1112
--- /dev/null
+++ b/shell01/ex08/add_chelou.sh
@@ -0,0 +1,14 @@
+echo $FT_NBR1
+B10_1=$(echo $FT_NBR1 | tr "'\\$(echo '\"')?!" "43210")
+echo $B10_1
+echo $FT_NBR2
+B10_2=$(echo $FT_NBR2 | tr "mrdoc" "43210")
+echo $B10_2
+
+B5_ADD=$(echo "ibase=5; obase=5; $B10_1 + $B10_2" | bc)
+echo "ibase=5;obase=13; $B5_ADD" | bc
+# ADD=$(echo "ibase=5; obase=13; $B10_1 + $B10_2" | bc)
+# echo $ADD
+
+ADD_CONV=$(echo $B5_ADD | tr "0123456789ABC" "gtaio luSnemf")
+echo $ADD_CONV