From a6d9260dfcb975acc00e8ddc1be64c4ba9dc3a3c Mon Sep 17 00:00:00 2001 From: Thitiwut Somsa Date: Sat, 18 Dec 2021 23:15:20 +0700 Subject: [PATCH] update --- c00/ex00/ft_putchar.c | 17 ----------------- c01/ex00/ft_ft.c | 16 ---------------- "c02/ex07/\\" | 26 -------------------------- c06 | 1 + check_c07/ex00/main.c | 18 ++++++++++++++++++ check_c07/ex01/main.c | 15 +++++++++++++++ check_c07/ex02/main.c | 17 +++++++++++++++++ check_c07/ex03/main.c | 28 ++++++++++++++++++++++++++++ check_c07/ex04/main.c | 11 +++++++++++ check_c07/ex05/main.c | 15 +++++++++++++++ check_c07/gccmain.sh | 7 +++++++ 11 files changed, 112 insertions(+), 59 deletions(-) delete mode 100644 c00/ex00/ft_putchar.c delete mode 100644 c01/ex00/ft_ft.c delete mode 100644 "c02/ex07/\\" create mode 160000 c06 create mode 100644 check_c07/ex00/main.c create mode 100644 check_c07/ex01/main.c create mode 100644 check_c07/ex02/main.c create mode 100644 check_c07/ex03/main.c create mode 100644 check_c07/ex04/main.c create mode 100644 check_c07/ex05/main.c create mode 100755 check_c07/gccmain.sh diff --git a/c00/ex00/ft_putchar.c b/c00/ex00/ft_putchar.c deleted file mode 100644 index 1b3fa7e..0000000 --- a/c00/ex00/ft_putchar.c +++ /dev/null @@ -1,17 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putchar.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: tsomsa +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2021/11/25 15:57:29 by tsomsa #+# #+# */l00 -/* Updated: 2021/11/25 15:58:23 by tsomsa ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include - -voidft_putchar(char c) -{ - write(1, &c, 1); -} \ No newline at end of file diff --git a/c01/ex00/ft_ft.c b/c01/ex00/ft_ft.c deleted file mode 100644 index ccd8a90..0000000 --- a/c01/ex00/ft_ft.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_ft.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: tsomsa +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2021/12/01 01:58:17 by tsomsa #+# #+# */ -/* Updated: 2021/12/01 01:59:05 by tsomsa ### ########.fr */ -/* */ -/* ************************************************************************** */ - -voidft_ft(int *nbr) -{ - *nbr = 42; -} \ No newline at end of file diff --git "a/c02/ex07/\\" "b/c02/ex07/\\" deleted file mode 100644 index 93150ec..0000000 --- "a/c02/ex07/\\" +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strupcase.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: tsomsa +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2021/12/02 21:22:02 by tsomsa #+# #+# */ -/* Updated: 2021/12/02 21:43:56 by tsomsa ### ########.fr */ -/* */ -/* ************************************************************************** */ - -char *ft_strupcase(char *str) -{ - int i; - - i = 0; - while (str[i] != '\0') - { - if (str[i] >= 97 && str[i] <= 122) - str[i] = str[i] - 32; - i++; - } - return str; -} - diff --git a/c06 b/c06 new file mode 160000 index 0000000..759d6fd --- /dev/null +++ b/c06 @@ -0,0 +1 @@ +Subproject commit 759d6fdf4abe6b2e03d2bf0bf1131cead4893c09 diff --git a/check_c07/ex00/main.c b/check_c07/ex00/main.c new file mode 100644 index 0000000..a83dc32 --- /dev/null +++ b/check_c07/ex00/main.c @@ -0,0 +1,18 @@ +#include + +char *ft_strdup(char *src); + +int main(void) +{ + char *s; + + printf("Expect.\n"); + printf("Test text.bad.\n"); + printf("Test text.\n"); + printf("Result.\n"); + s = ft_strdup("Test text.bad."); + printf("%s\n",s); + s[10] = 0; + printf("%s\n",s); +} + diff --git a/check_c07/ex01/main.c b/check_c07/ex01/main.c new file mode 100644 index 0000000..391acf6 --- /dev/null +++ b/check_c07/ex01/main.c @@ -0,0 +1,15 @@ +#include + +int *ft_range(int min, int max); + +int main(void) +{ + int *a; + int *b; + + a = ft_range(5,5); + b = ft_range(5,9); + printf("Expect.0x0 5 6 7 8\n"); + printf("Result.%p %d %d %d %d\n",a,b[0],b[1],b[2],b[3]); +} + diff --git a/check_c07/ex02/main.c b/check_c07/ex02/main.c new file mode 100644 index 0000000..950a4d6 --- /dev/null +++ b/check_c07/ex02/main.c @@ -0,0 +1,17 @@ +#include + +int ft_ultimate_range(int **range, int min, int max); + +int main(void) +{ + int *a; + int *b; + int c; + int d; + + c = ft_ultimate_range(&a,5,5); + d = ft_ultimate_range(&b,5,9); + printf("Expect.0 4 0x0 5 6 7 8\n"); + printf("Result.%d %d %p %d %d %d %d\n",c,d,a,b[0],b[1],b[2],b[3]); +} + diff --git a/check_c07/ex03/main.c b/check_c07/ex03/main.c new file mode 100644 index 0000000..c402ed7 --- /dev/null +++ b/check_c07/ex03/main.c @@ -0,0 +1,28 @@ +#include +#include + +char *ft_strjoin(int size, char **strs, char *sep); + +int main(int argc, char **argv) +{ + char *strs[10]; + char *str; + int i; + + strs[0] = "abc"; + strs[1] = "def"; + strs[2] = ""; + strs[3] = "m"; + strs[4] = "badfsfsaf"; + + i = 3; + if (argc>1) + { + i = argv[1][0] - '0'; + } + + str = ft_strjoin(i,strs, " x "); + printf("%s\n",str); + free(str); + return 0; +} diff --git a/check_c07/ex04/main.c b/check_c07/ex04/main.c new file mode 100644 index 0000000..ccfec4f --- /dev/null +++ b/check_c07/ex04/main.c @@ -0,0 +1,11 @@ +#include + +char *ft_convert_base(char *nbr, char *base_from, char *base_to); + +int main(void) +{ + char *str; + + str = ft_convert_base("5647","0123456789","0123456789ABCDEF"); + printf("%s\n",str); +} diff --git a/check_c07/ex05/main.c b/check_c07/ex05/main.c new file mode 100644 index 0000000..3c4878a --- /dev/null +++ b/check_c07/ex05/main.c @@ -0,0 +1,15 @@ +#include + +char **ft_split(char *str, char *charset); + +int main(void) +{ + char **strs; + + strs = ft_split("fsasfadsfsdfsbcxbcxbcxbbb", "abc"); + + int i=0; + while (strs[i]) + printf("%s\n",strs[i++]); + return (0); +} diff --git a/check_c07/gccmain.sh b/check_c07/gccmain.sh new file mode 100755 index 0000000..272b9b4 --- /dev/null +++ b/check_c07/gccmain.sh @@ -0,0 +1,7 @@ +if [ -f "a.out" ] ; then + rm a.out +fi +Norminette -R CheckForbiddenSourceHeader $1 $2 +gcc -Wall -Wextra -Werror $1 $2 main.c +./a.out | cat -e +