commit e06b98052a8b45f7856dfc6a600c5cb8f6c052db Author: David Gailleton Date: Wed Nov 5 11:13:34 2025 +0100 Makefile. header file and 4 functions diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a239a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,57 @@ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +# debug information files +*.dwo + +libft.a diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5c56f78 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +CC = cc + +AR = ar + +ARFLAGS = rc + +CFLAGS = -Wall -Wextra -Werror -I libft.h + +NAME = libft.a + +SRC = ft_isalpha.c ft_isdigit.c ft_isalnum.c ft_isascii.c + +OBJDIR = objs + +OBJ = $(patsubst %, $(OBJDIR)/%o, $(SRC:.c=.)) + + +all: $(NAME) + +$(NAME): $(OBJ) + $(AR) $(ARFLAGS) $(NAME) $(OBJ) + ranlib $(NAME) + +$(OBJDIR)/%.o: %.c | $(OBJDIR) + $(CC) -o $@ -c $< $(CFLAGS) + +$(OBJDIR): + mkdir $@ + +clean: + rm -f $(OBJ) + +fclean: clean + rm -f $(NAME) + +re: fclean all + +.PHONY: all clean fclean re diff --git a/ft_isalnum.c b/ft_isalnum.c new file mode 100644 index 0000000..a4debf6 --- /dev/null +++ b/ft_isalnum.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isalnum.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dgaillet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/11/05 10:46:12 by dgaillet #+# #+# */ +/* Updated: 2025/11/05 10:47:18 by dgaillet ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_isalnum(int c) +{ + if (ft_isalpha(c) || ft_isdigit(c)) + return (1); + return (0); +} diff --git a/ft_isalpha.c b/ft_isalpha.c new file mode 100644 index 0000000..4f9b5b6 --- /dev/null +++ b/ft_isalpha.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isalpha.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dgaillet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/11/05 09:53:19 by dgaillet #+# #+# */ +/* Updated: 2025/11/05 09:56:42 by dgaillet ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +int ft_isalpha(int c) +{ + if ((c > 'a' && c < 'z') || (c > 'A' && c < 'Z')) + return (1); + return (0); +} diff --git a/ft_isascii.c b/ft_isascii.c new file mode 100644 index 0000000..2b3de58 --- /dev/null +++ b/ft_isascii.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isascii.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dgaillet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/11/05 10:48:02 by dgaillet #+# #+# */ +/* Updated: 2025/11/05 10:50:20 by dgaillet ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +int ft_isascii(int c) +{ + if (c >= 0 && c <= 127) + return (1); + return (0); +} diff --git a/ft_isdigit.c b/ft_isdigit.c new file mode 100644 index 0000000..151571d --- /dev/null +++ b/ft_isdigit.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isdigit.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dgaillet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/11/05 09:57:01 by dgaillet #+# #+# */ +/* Updated: 2025/11/05 10:45:10 by dgaillet ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +int ft_isdigit(int c) +{ + if (c > '0' && c < '9') + return (1); + return (0); +} diff --git a/libft.h b/libft.h new file mode 100644 index 0000000..df71a96 --- /dev/null +++ b/libft.h @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dgaillet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/11/05 09:49:43 by dgaillet #+# #+# */ +/* Updated: 2025/11/05 10:55:45 by dgaillet ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_H +# define LIBFT_H + +# include + +int ft_isalpha(int c); +int ft_isdigit(int c); +int ft_isalnum(int c); +int ft_isascii(int c); + +#endif