commit 7b176ca15040c6b657322c8856de25560f0a6c9a Author: kitoy Date: Wed Nov 8 13:55:48 2023 +0100 Initial commit diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6bc576a --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +PROG_NAME=args_count +BASE=/usr/local + + +$(PROG_NAME): ./src/$(PROG_NAME).c + $(CC) $< -o ./bin/$(PROG_NAME) + +install: + install ./bin/$(PROG_NAME) $(BASE)/bin/$(PROG_NAME) + +deinstall: + rm -fr $(BASE)/bin/$(PROG_NAME) + +clean: + rm -fr ./bin/* diff --git a/src/args_count.c b/src/args_count.c new file mode 100644 index 0000000..3827368 --- /dev/null +++ b/src/args_count.c @@ -0,0 +1,17 @@ +#include +#include + + +int +main(int argc, char *argv[]) { + if ( argc == 0) + { + printf("Le nombre d'arguments est 1 \n"); + } + else + { + printf("Le nombre d'arguments est de : %d \n", argc); + } + + exit (EXIT_SUCCESS); +} diff --git a/src/args_count.c~ b/src/args_count.c~ new file mode 100644 index 0000000..6293f52 --- /dev/null +++ b/src/args_count.c~ @@ -0,0 +1,17 @@ +#include +#include + + +int +main(int argc, char *argv[]) { + if ( argc == 0) + { + printf("Le nombre d'arguments est 1"); + } + else + { + printf("Le nombre d'arguments est de : %d", argc); + } + + exit (EXIT_SUCCESS); +}