0
0

Add main.* and remove .gitignore

This commit is contained in:
2021-08-16 08:26:30 +02:00
parent a808b91a50
commit 44692816d5
85 changed files with 1352 additions and 30 deletions

View File

@@ -1,7 +0,0 @@
**/main.c
**/main.sh
**/a.out
**/a.sh
**/Makefile
**/*.swp
**/*~

View File

@@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/09 13:15:38 by gbaconni #+# #+# */
/* Updated: 2021/08/11 14:30:26 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
char *ft_strcpy(char *dest, char *src);
int main(void)
{
char src[32];
char dest[32];
char *result;
printf("Input [max 31]: ");
scanf("%s", src);
result = ft_strcpy(dest, src);
printf("src=%s dest=%s result=%s (ft_strcpy)\n", src, dest, result);
result = strcpy(dest, src);
printf("src=%s dest=%s result=%s (strcpy)\n", src, dest, result);
return (0);
}

View File

@@ -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

View File

@@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/09 18:18:58 by gbaconni #+# #+# */
/* Updated: 2021/08/11 18:07:07 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
char *ft_strncpy(char *dest, char *src, unsigned int n);
int main(void)
{
char src[32];
char dest[64];
unsigned int n;
char *result;
n = 0;
printf("Input String [max 31]: ");
scanf("%s", src);
printf("Input Size: ");
scanf("%d", &n);
result = ft_strncpy(dest, src, n);
printf("src=%s dest=%s n=%d result=%s (ft_strncpy)\n", src, dest, n, result);
result = strncpy(dest, src, n);
printf("src=%s dest=%s n=%d result=%s (strncpy)\n", src, dest, n, result);
return (0);
}

View File

@@ -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

Binary file not shown.

View File

@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/09 17:44:56 by gbaconni #+# #+# */
/* Updated: 2021/08/09 17:48:47 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int ft_str_is_alpha(char *str);
int main(void)
{
char str[32];
int result;
printf("Input [max 31]: ");
scanf("%s", str);
result = ft_str_is_alpha(str);
printf("str=%s result=%d\n", str, result);
return (0);
}

View File

@@ -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

Binary file not shown.

View File

@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/10 10:13:03 by gbaconni #+# #+# */
/* Updated: 2021/08/10 10:15:13 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int ft_str_is_numeric(char *str);
int main(void)
{
char str[32];
int result;
printf("Input [max 31]: ");
scanf("%s", str);
result = ft_str_is_numeric(str);
printf("str=%s result=%d\n", str, result);
return (0);
}

View File

@@ -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

Binary file not shown.

View File

@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/10 10:44:33 by gbaconni #+# #+# */
/* Updated: 2021/08/10 10:44:58 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int ft_str_is_lowercase(char *str);
int main(void)
{
char str[32];
int result;
printf("Input [max 31]: ");
scanf("%s", str);
result = ft_str_is_lowercase(str);
printf("str=%s result=%d\n", str, result);
return (0);
}

View File

@@ -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

Binary file not shown.

View File

@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/10 10:48:33 by gbaconni #+# #+# */
/* Updated: 2021/08/10 10:48:53 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int ft_str_is_uppercase(char *str);
int main(void)
{
char str[32];
int result;
printf("Input [max 31]: ");
scanf("%s", str);
result = ft_str_is_uppercase(str);
printf("str=%s result=%d\n", str, result);
return (0);
}

View File

@@ -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

Binary file not shown.

View File

@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/10 11:05:36 by gbaconni #+# #+# */
/* Updated: 2021/08/10 11:05:59 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int ft_str_is_printable(char *str);
int main(void)
{
char str[32];
int result;
printf("Input [max 31]: ");
scanf("%s", str);
result = ft_str_is_printable(str);
printf("str=%s result=%d\n", str, result);
return (0);
}

View File

@@ -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

View File

@@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/10 11:12:33 by gbaconni #+# #+# */
/* Updated: 2021/08/10 11:25:31 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
char *ft_strupcase(char *str);
int main(void)
{
char str[32];
char *result;
printf("Input [max 31]: ");
scanf("%s", str);
printf("str=%s\n", str);
result = ft_strupcase(str);
printf("str=%s result=%s\n", str, result);
return (0);
}

View File

@@ -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

View File

@@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/10 11:40:15 by gbaconni #+# #+# */
/* Updated: 2021/08/10 11:40:52 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
char *ft_strlowcase(char *str);
int main(void)
{
char str[32];
char *result;
printf("Input [max 31]: ");
scanf("%s", str);
printf("str=%s\n", str);
result = ft_strlowcase(str);
printf("str=%s result=%s\n", str, result);
return (0);
}

View File

@@ -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

View File

@@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/10 11:43:49 by gbaconni #+# #+# */
/* Updated: 2021/08/10 11:55:53 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
char *ft_strcapitalize(char *str);
int main(void)
{
char str[256];
char *result;
printf("Input [max 255]: ");
scanf("%255[^\n]", str);
printf("str=%s\n", str);
result = ft_strcapitalize(str);
printf("str=%s result=%s\n", str, result);
return (0);
}

View File

@@ -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

Binary file not shown.

View File

@@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/11 09:43:24 by gbaconni #+# #+# */
/* Updated: 2021/08/11 10:43:00 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size);
int main(void)
{
unsigned int size;
unsigned int result;
char src[16];
char dest[16];
printf("Input Text [max 15]: ");
scanf("%15[^\n]", src);
printf("Input Size: ");
scanf("%u", &size);
result = ft_strlcpy(dest, src, size);
printf("src=%s dest=%s result=%d (ft_strlcpy)\n", src, dest, result);
result = strlcpy(dest, src, size);
printf("src=%s dest=%s result=%d (strlcpy)\n", src, dest, result);
return (0);
}

View File

@@ -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

Binary file not shown.

View File

@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/11 11:24:31 by gbaconni #+# #+# */
/* Updated: 2021/08/12 11:44:53 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
void ft_putstr_non_printable(char *str);
int main(void)
{
const char *test = "Coucou\ntu vas bien ?";
char str[256];
printf("Input [max 255]: ");
scanf("%255[^\n]", str);
printf("str=%s\n", str);
ft_putstr_non_printable(str);
printf("test=%s\n", test);
ft_putstr_non_printable((char *)test);
return (0);
}

View File

@@ -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