Initial commit

This commit is contained in:
kitoy 2023-11-08 13:55:48 +01:00
commit 7b176ca150
3 changed files with 49 additions and 0 deletions

15
Makefile Normal file
View File

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

17
src/args_count.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdlib.h>
#include <stdio.h>
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);
}

17
src/args_count.c~ Normal file
View File

@ -0,0 +1,17 @@
#include <stdlib.h>
#include <stdio.h>
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);
}