The goal of this project is to re-code several functions from the Standard C library, along with additional supplementary functions, ensuring that they maintain the same behavior as the original ones.
C language |
Refactor certain functions from the Standard C library, ensuring that their behavior matches that of the original functions.
Function | Description |
isalpha | Check if it's an alphabetic character |
idigit | Check if it's digit |
isalnum | Check if it's an alphanumeric character |
isascii | Check if it's in the ASCII range |
isprint | Check if it's a printable character |
strlen | Calculate the lenght of a string |
memset | Fill the bytes of a block of memory with a constant value |
bzero | Fill the bytes of a block of memory with zero |
memcpy | Copy a memory block |
memmove | Move a memory block |
strlcpy | Copy a string |
strlcat | Concatenate two strings |
toupper | Convert a character to uppercase |
tolower | Convert a character to lowercase |
strchr | Search for the first appearence of a character in a string |
strrchr | Search for the last appearence of a character in a string |
strncmp | Compare two strings |
memchr | Search for a character in a block of memory |
memcmpp | Compare two blocks of memory |
strnstr | Search for a substring in a string |
atoi | Convert a string to an integer |
calloc | Allocate memory and fill its bytes to zero |
strdup | Duplicate a string |
Develop useful functions that are not present in the Standard C library.
Function | Description |
substr | Return a substring from a string |
strjoin | Concatenate two strings |
strtrim | Trim the beggining and the end of a string |
split | Split a string |
itoa | Convert a number into a string |
strmapi | Apply a function in every character of a string |
striteri | Apply a function in every character of a string |
putchar_fd | Write a character to a file |
putstr_fd | Write a string to a file |
putendl_fd | Write a string to a file, followed by a new line |
putnbr_fd | Write a number to a file |
Create functions specifically designed for manipulating lists.
Function | Description |
lstnew | Create a new node |
lstadd_front | Add a node in front of a list |
lstsize | Count the nodes in a list |
lstlast | Return the last node of a list |
lstadd_back | Add a node in the end of a list |
lstdelone | Free the content os a node in a list |
lstclear | Delete and free a list |
lstiter | Apply a function to every node of a list |
lstmap | Apply a function to every node of a list |
In order to utilize this "libft" library, you must initially clone the repository onto your local machine by employing a terminal:
- - $> git clone git@github.com:joaoneon/42_libft.git [folder]
Command | Description |
make all or make | compiles only the mandaory parts |
make bonus | compiles the bonus part |
make clean | deletes the object files created during compilation |
make fclean | executes the clean command and also deletes the libft.a |
make re | executes the fclean command followed by the all command |
make rebonus | executes the fclean command followed by the bonus command |
Incorporate the header file of the "libft" library to utilize its functionalities in your projects:
- #include "libft.h"
When compiling your projects that utilize the "libft" library, it is necessary to employ the appropriate flags:
- $> ... -L [path/to/libft.a] -I [path/to/libft.h]