{"id":28403141,"url":"https://github.com/maiadegraaf/libft","last_synced_at":"2025-08-17T01:32:57.233Z","repository":{"id":161441237,"uuid":"542079728","full_name":"maiadegraaf/libft","owner":"maiadegraaf","description":"My own C library including get_next_line and ft_printf","archived":false,"fork":false,"pushed_at":"2022-10-04T16:03:48.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-26T17:50:03.533Z","etag":null,"topics":["42born2code","c","codam-ft-printf","codam-get-next-line","codam-libft","ft-printf","get-next-line","libft"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maiadegraaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-27T12:44:00.000Z","updated_at":"2022-10-03T16:28:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"eb412f58-c6ca-4f79-ad6c-cf256998407e","html_url":"https://github.com/maiadegraaf/libft","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maiadegraaf/libft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maiadegraaf%2Flibft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maiadegraaf%2Flibft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maiadegraaf%2Flibft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maiadegraaf%2Flibft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maiadegraaf","download_url":"https://codeload.github.com/maiadegraaf/libft/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maiadegraaf%2Flibft/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270796220,"owners_count":24647319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42born2code","c","codam-ft-printf","codam-get-next-line","codam-libft","ft-printf","get-next-line","libft"],"created_at":"2025-06-01T17:08:15.323Z","updated_at":"2025-08-17T01:32:57.212Z","avatar_url":"https://github.com/maiadegraaf.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libft\n\nThis assignment was to make my own C library containing both my own versions of existing functions, and new functions.  I also completed the bonus portion of this assignment. I've used these functions in all other C projects I've made since.  I've also included [get_next_line](#get_next_line) and [ft_printf](#ft_printf) in this repository as I use them as part of Libft. As such the libft.a file also includes get_next_line and ft_printf.\n\n### Table of contents:\n- [List of Functions](#list-of-functions)\n\t- [Libc Functions](#libc-functions)\n\t- [Additional Functions](#additional-functions)\n\t- [Bonus Functions](#bonus-functions)\n- [get_next_line](#get_next_line)\n- [ft_printf](#ft_printf)\n- [Installation guide](#installation)\n\n## List of Functions:\n### Libc Functions:\nThese functions have the same prototypes and implement the same behaviours as the originals.\n| Function | Description |\n| :------ | --------- |\n| [``ft_atoi``](ft_atoi.c) | Reads a String, and saves the string into an integer |\n| [``ft_bzero``](ft_bzero.c) | Writes ``n`` zeroes to the string ``s`` |\n| [``ft_calloc``](ft_calloc.c) | Reserves ``x`` blocks of ``y`` bits of memory |\n| [``ft_isalnum``](ft_isalnum.c) | Returns ``1`` if the input is a number or a letter in the ``ASCII`` table |\n| [``ft_isalpha``](ft_isalpha.c) | Returns ``1`` if the input is a letter in the ``ASCII`` table |\n| [``ft_isascii``](ft_isascii.c) | Returns whether or not a value belongs to the ``ASCII`` table |\n| [``ft_isdigit``](ft_isdigit.c) | Returns ``1`` if the input is a number in the ``ASCII`` table |\n| [``ft_isprint``](ft_isprint.c) | Returns whether a character is printable |\n| [``ft_itoa``](ft_itoa.c) | Saves the given number as a string (char array) |\n| [``ft_memcpy``](ft_memcpy.c) | Copies from one memory point to another, until the specified character is copied or until ``n`` bytes are copied |\n| [``ft_memchr``](ft_memchr.c) | Looks for a matching character inside a part of the memory |\n| [``ft_memcmp``](ft_memcmp.c) | Compares two parts of memory, returning ``0`` if they're the same, or else a nonzero value |\n| [``ft_memcpy``](ft_memcpy.c) | Copies from one part of memory to another, ignoring possible overlaps |\n| [``ft_memmove``](ft_memmove.c) | Copies from one part of memory to another, preventing possible overlaps |\n| [``ft_memset``](ft_memset.c) | Assigns a character ``n`` times to a part of the memory |\n| [``ft_putchar_fd``](ft_putchar_fd.c) | Prints a character to the given file descriptor |\n| [``ft_putendl_fd``](ft_putendl_fd.c) | Prints a string followed by a new line ``\\n`` to a given file descriptor |\n| [``ft_putnbr_fd``](ft_putnbr_fd.c) | Prints number to the given file descriptor |\n| [``ft_putstr_fd``](ft_putstr_fd.c) | Prints string to the given file descriptor |\n| [``ft_split``](ft_split.c) | Splits a string according to a given separator character |\n| [``ft_strchr``](ft_strchr.c) | Looks for a specific character inside a given string |\n| [``ft_strdup``](ft_strdup.c) | Saves enoug space and duplicates a string |\n| [``ft_strjoin``](ft_strjoin.c) | Concatenates two strings allocating enough space first |\n| [``ft_strlcat``](ft_strlcat.c) | Concatenates two strings ensuring it ends with ``\\0`` |\n| [``ft_strlcpy``](ft_strlcpy.c) | Copies ``n - 1`` bytes from a source string to a destination string |\n| [``ft_strlen``](ft_strlen.c) | Returns length of a string |\n| [``ft_strmapi``](ft_strmapi.c) | Applies a function (mapping) to every element in a string |\n| [``ft_strncmp``](ft_strncmp.c) | Compares two strings up to the n-th character |\n| [``ft_strnstr``](ft_strnstr.c) | Tries to find a substring (``needle``) in a second string (``haystack``) before the n-th char is reached |\n| [``ft_strrchr``](ft_strrchr.c) | Looks for a given character in a string, reading it from back to front |\n| [``ft_strtrim``](ft_strtrim.c) | Removes occurrences of characters in a string from the start and end of another one |\n| [``ft_substr``](ft_substr.c) | Copies from the n-th char of a string |\n| [``ft_tolower``](ft_tolower.c) | Makes every uppercase character in a string lowercase |\n| [``ft_toupper``](ft_toupper.c) | Makes every lowercase character in a string uppercase |\n\n\n### Additional Functions\n\n| Funtion Name | Function Prototype | Description |\n|----------|----------|-------------|\n|[```ft_substr```](ft_substr.c)|```char *ft_substr(char const *s, unsigned int start, size_t len);``` | Allocates (with malloc(3)) and returns a substring from the string ’s’. The substring begins at index ’start’ and is of maximum size ’len’. |\n|[```ft_strjoin```](ft_strjoin.c)|```char *ft_strjoin(char const *s1, char const *s2);```|Allocates (with malloc(3)) and returns a new string, which is the result of the concatenation of ’s1’ and ’s2’.|\n|[```ft_strtrim```](ft_strtrim.c)|```char *ft_strtrim(char const *s1, char const *set);```|Allocates (with malloc(3)) and returns a copy of ’s1’ with the characters specified in ’set’ removed from the beginning and the end of the string.|\n|[```ft_split```](ft_split.c)|```char **ft_split(char const *s, char c);```|Allocates (with malloc(3)) and returns a string representing the integer received as an argument.|\n|[```ft_strmapi```](ft_strmapi.c)|```char *ft_strmapi(char const *s, char (*f)(unsigned int, char));```|Applies the function ’f’ to each character of the string ’s’, and passing its index as first argument to create a new string (with malloc(3)) resulting from successive applications of ’f’.|\n|[```ft_striteri```](ft_striteri.c)|```void ft_striteri(char *s, void (*f)(unsigned int, char*));```|Applies the function ’f’ on each character of the string passed as argument, passing its index as first argument.|\n|[```ft_putchar_fd```](ft_putchar_fd.c)|```void ft_putchar_fd(char c, int fd);```|Outputs the character ’c’ to the given file descriptor.|\n|[```ft_putstr_fd```](ft_putstr_fd.c)|```void ft_putstr_fd(char *s, int fd);```|Outputs the string ’s’ to the given file descriptor.|\n|[```ft_putendl_fd```](ft_putendl_fd.c)|```void ft_putendl_fd(char *s, int fd);```|Outputs the string ’s’ to the given file descriptor followed by a newline.|\n|[```ft_putnbr_fd```](ft_putnbr_fd.c)|```void ft_putnbr_fd(int n, int fd);```|Outputs the integer ’n’ to the given file descriptor.|\n\n### Bonus functions:\nThe following functions are used in relation to a linked list with the following struct:\n```C\ntypedef struct s_list\n{\nvoid *content;\nstruct s_list *next;\n} t_list;\n```\n\n| Funtion Name | Function Prototype | Description |\n|----------|----------|-------------|\n|[```ft_lstnew```](ft_lstnew.c)|```t_list *ft_lstnew(void *content);```|Allocates (with malloc(3)) and returns a new node. The member variable ’content’ is initialized with the value of the parameter ’content’. The variable ’next’ is initialized to NULL.|\n|[```ft_lstadd_front```](ft_lstadd_front.c)|```void ft_lstadd_front(t_list **lst, t_list *new);```|Adds the node ’new’ at the beginning of the list.|\n|[```ft_lstsize```](ft_lstsize.c)|```int ft_lstsize(t_list *lst);```|Counts the number of nodes in a list.|\n|[```ft_lstlast```](ft_lstlast.c)|```t_list *ft_lstlast(t_list *lst);```|Returns the last node of the list.|\n|[```ft_lstadd_back```](ft_lstadd_back.c)|```void ft_lstadd_back(t_list **lst, t_list *new);```|Adds the node ’new’ at the end of the list.|\n|[```ft_lstdelone```](ft_lstdelone.c)|```void ft_lstdelone(t_list *lst, void (*del)(void *));```|Takes as a parameter a node and frees the memory of the node’s content using the function ’del’ given as a parameter and free the node. The memory of ’next’ must not be freed.|\n|[```ft_lstclear```](ft_lstclear.c)|```void ft_lstclear(t_list **lst, void (*del)(void *));```|Deletes and frees the given node and every successor of that node, using the function ’del’ and free(3).|\n|[```ft_lstmap```](ft_lstmap.c)|```t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *));```|Iterates the list ’lst’ and applies the function ’f’ on the content of each node. Creates a new list resulting of the successive applications of the function ’f’. The ’del’ function is used to delete the content of a node if needed.|\n\n## [```get_next_line```](get_next_line):\nThis function returns a line read from a file descriptor.  It was also the first time I worked with static variables.  The biggest challenge of this project was making sure I didn't have any leaks.\n\n```char *get_next_line(int fd);```\n\n## [```ft_printf```](ft_printf)\n\nThis project was to make my own ```printf``` function.  It had to implement the following conversions: ```cspdiuxX%```.\n\n```int ft_printf(const char *, ...);```\n\n## Installation:\n\nClone the repository\n``` \ngit clone https://github.com/maiadegraaf/libft.git\ncd libft\nmake\n```\n### Usage:\n\nThe makefile compiles all files. It then generates the output file libft.a. Here are some of the commands you can try:\n- Compile the libft.a file:\n  - ```make all```\n- Compile all bonus files as well as mandatory ones:\n  - ```make bonus```\n  \n### How to add  libft to your makefile:\n\n```Make\n# path to libft:\nLIBFT\t=\tlibft/libft.a\n# compile libft:\n$(LIBFT):\n\t@$(MAKE) -C libft\n# include libft when compiling your project eg:\n$(NAME): $(LIBFT) $(OBJS) $(HEADERS)\n\t@$(CC) $(FLAGS) $(LIBFT )$(OBJS) $(NAME)\n\t@echo \"Success\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaiadegraaf%2Flibft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaiadegraaf%2Flibft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaiadegraaf%2Flibft/lists"}