Skip to content

Commit

Permalink
libft finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatih Cil committed Feb 10, 2022
1 parent ad61854 commit 64ad48f
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 20 deletions.
Binary file removed libft/.DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion libft/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ clean:
fclean: clean
rm -f $(NAME)

re: fclean all
re: fclean all

.PHONY: all bonus clean fclean re
Binary file removed libft/en.subject.pdf
Binary file not shown.
3 changes: 1 addition & 2 deletions libft/ft_lstadd_back.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: fcil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/01 15:51:38 by fcil #+# #+# */
/* Updated: 2022/02/02 16:29:59 by fcil ### ########.fr */
/* Updated: 2022/02/06 19:27:30 by fcil ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -24,7 +24,6 @@ void ft_lstadd_back(t_list **lst, t_list *new)
while (ptr->next != NULL)
ptr = ptr->next;
ptr->next = new;
new->next = NULL;
}
}

Expand Down
5 changes: 1 addition & 4 deletions libft/ft_lstmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
/* By: fcil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/01 15:58:57 by fcil #+# #+# */
/* Updated: 2022/02/05 13:06:29 by fcil ### ########.fr */
/* Updated: 2022/02/04 10:30:43 by fcil ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include <unistd.h>
#include <string.h>
#include <stdio.h>

t_list *ft_lstmap(t_list *lst, void *(*f)(void*), void (*del)(void *))
{
Expand Down
2 changes: 1 addition & 1 deletion libft/ft_lstnew.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: fcil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/01 15:29:57 by fcil #+# #+# */
/* Updated: 2022/02/05 13:10:16 by fcil ### ########.fr */
/* Updated: 2022/02/02 16:27:14 by fcil ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion libft/ft_memmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: fcil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/12 15:18:13 by fcil #+# #+# */
/* Updated: 2022/02/05 12:25:47 by fcil ### ########.fr */
/* Updated: 2022/02/04 18:40:42 by fcil ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
33 changes: 22 additions & 11 deletions libft/ft_substr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,37 @@
/* By: fcil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/21 19:33:57 by fcil #+# #+# */
/* Updated: 2022/02/02 14:13:45 by fcil ### ########.fr */
/* Updated: 2022/02/06 19:32:06 by fcil ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

char *ft_substr(char const *s, unsigned int start, size_t len)
{
char *new_str;
size_t i;
size_t j;
char *final;

new_str = (char *)malloc(len + 1);
if (!s || !new_str)
return (0);
i = start;
j = 0;
while (i < ft_strlen(s) && j < len)
new_str[j++] = s[i++];
new_str[j] = '\0';
return (new_str);
if (s)
{
if (start >= ft_strlen(s) || len == 0 || ft_strlen(s) == 0)
return (ft_strdup(""));
i = 0;
while (i < len && s[i + start] != '\0')
i++;
final = (char *) malloc((sizeof(char) * i) + 1);
if (!(final))
return (NULL);
j = 0;
while (j < i)
{
final[j] = s[start + j];
j++;
}
final[j] = '\0';
return (final);
}
return (NULL);
}
//start len arasi bir string olusturur, ve bu stringi return eder.
Binary file removed libft/tr.subject.pdf
Binary file not shown.

0 comments on commit 64ad48f

Please sign in to comment.