0
0
This commit is contained in:
Guy Baconniere
2021-08-16 18:30:54 +02:00
parent ef1c6b5e75
commit d717434d41
5 changed files with 96 additions and 0 deletions

23
C_Piscine_C_06/Makefile Normal file
View File

@@ -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-32120416-363c-477f-8da3-664139b0117f-3725548 git
cc:
@norminette -R CheckForbiddenSourceHeader
@gcc -Wall -Wextra -Werror -o a.out *.c
@./a.out
@rm -f a.out
all: clone

View File

@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_program_name.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/16 17:13:03 by gbaconni #+# #+# */
/* Updated: 2021/08/16 18:10:43 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int size;
size = 0;
while (argc != -1 && argv[0][++size] != '\0')
continue ;
write(1, argv[0], size);
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,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/16 18:11:54 by gbaconni #+# #+# */
/* Updated: 2021/08/16 18:30:48 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int size;
int i;
size = 0;
i = 1;
while (argc > 0 && i < argc)
{
while (argv[i][++size] != '\0')
continue ;
write(1, argv[i], size);
write(1, "\n", 1);
i++;
}
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