-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
2,842 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule libft
deleted from
103809
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
NAME = libft.a | ||
CC = gcc | ||
CFLAGS= -Wall -Wextra -Werror | ||
SOURCES = ft_atoi.c ft_bzero.c ft_calloc.c ft_isalnum.c ft_isalpha.c ft_isascii.c ft_isdigit.c ft_isprint.c ft_itoa.c ft_memchr.c ft_memcmp.c ft_memcpy.c ft_memmove.c ft_memset.c ft_putchar_fd.c ft_putendl_fd.c ft_putnbr_fd.c ft_putstr_fd.c ft_split.c ft_strchr.c ft_strdup.c ft_striteri.c ft_strjoin.c ft_strlcat.c ft_strlcpy.c ft_strlen.c ft_strmapi.c ft_strncmp.c ft_strnstr.c ft_strrchr.c ft_strtrim.c ft_substr.c ft_tolower.c ft_toupper.c | ||
OBJECTS = $(SOURCES:.c=.o) | ||
|
||
BONUS_SOURCES = ft_lstadd_back.c ft_lstadd_front.c ft_lstclear.c ft_lstdelone.c ft_lstiter.c ft_lstlast.c ft_lstmap.c ft_lstnew.c ft_lstsize.c | ||
BONUS_OBJECTS = $(BONUS_SOURCES:.c=.o) | ||
|
||
all: $(OBJECTS) | ||
|
||
%.o : %.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
ar -rcs $(NAME) $@ | ||
|
||
clean: | ||
rm -f $(OBJECTS) $(BONUS_OBJECTS) | ||
|
||
fclean: clean | ||
rm -f $(NAME) | ||
|
||
re: fclean all | ||
|
||
bonus: $(OBJECTS) $(BONUS_OBJECTS) | ||
ar -rc $(NAME) $(OBJECTS) $(BONUS_OBJECTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_atoi.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/24 21:55:40 by hcoskun42 #+# #+# */ | ||
/* Updated: 2023/07/08 16:18:52 by hcoskun ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int natural_atoi(const char *str) | ||
{ | ||
int res; | ||
|
||
res = 0; | ||
while (*str >= '0' && *str <= '9') | ||
{ | ||
res = res * 10 + *str - '0'; | ||
str++; | ||
} | ||
return (res); | ||
} | ||
|
||
int ft_atoi(const char *str) | ||
{ | ||
int sign; | ||
|
||
sign = 1; | ||
while (*str == ' ' || (*str >= 9 && *str <= 13)) | ||
str++; | ||
if (!*str) | ||
return (0); | ||
if (*str == '+' || *str == '-') | ||
{ | ||
if (*str == '-') | ||
sign *= -1; | ||
str++; | ||
} | ||
return (sign * natural_atoi(str)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_atoi.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/24 21:55:40 by hcoskun42 #+# #+# */ | ||
/* Updated: 2023/07/08 16:18:52 by hcoskun ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int natural_atoi(const char *str) | ||
{ | ||
int res; | ||
|
||
res = 0; | ||
while (*str >= '0' && *str <= '9') | ||
{ | ||
res = res * 10 + *str - '0'; | ||
str++; | ||
} | ||
return (res); | ||
} | ||
|
||
int ft_atoi(const char *str) | ||
{ | ||
int sign; | ||
|
||
sign = 1; | ||
while (*str == ' ' || (*str >= 9 && *str <= 13)) | ||
str++; | ||
if (!*str) | ||
return (0); | ||
if (*str == '+' || *str == '-') | ||
{ | ||
if (*str == '-') | ||
sign *= -1; | ||
str++; | ||
} | ||
return (sign * natural_atoi(str)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_bzero.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: hcoskun42 <hcoskun@student.42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/24 20:29:52 by hcoskun42 #+# #+# */ | ||
/* Updated: 2023/06/24 20:29:54 by hcoskun42 ### ########.tr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_bzero(void *s, size_t n) | ||
{ | ||
ft_memset(s, '\0', n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_bzero.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: hcoskun42 <hcoskun@student.42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/24 20:29:52 by hcoskun42 #+# #+# */ | ||
/* Updated: 2023/06/24 20:29:54 by hcoskun42 ### ########.tr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_bzero(void *s, size_t n) | ||
{ | ||
ft_memset(s, '\0', n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* pwd.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
<<<<<<< HEAD:builtin/pwd.c | ||
/* Created: 2024/03/02 13:41:06 by facetint #+# #+# */ | ||
/* Updated: 2024/03/03 13:17:22 by facetint ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "../includes/minishell.h" | ||
#include "../libft/libft.h" | ||
#include <stdio.h> | ||
======= | ||
/* Created: 2023/06/24 20:30:45 by hcoskun42 #+# #+# */ | ||
/* Updated: 2023/12/31 15:40:54 by hcoskun42 ### ########.tr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
>>>>>>> main:libft/ft_calloc.c | ||
#include "../memory-allocator/allocator.h" | ||
|
||
void builtin_pwd(t_command *cmd) | ||
{ | ||
<<<<<<< HEAD:builtin/pwd.c | ||
(void)cmd; | ||
char *path; | ||
|
||
path = safe_malloc(sizeof(char) * 4097); | ||
getcwd(path, 4097); | ||
printf("%s\n", path); | ||
safe_free(path); | ||
======= | ||
void *result; | ||
|
||
result = safe_malloc(count * size); | ||
if (result == NULL) | ||
return (NULL); | ||
ft_bzero(result, count * size); | ||
return (result); | ||
>>>>>>> main:libft/ft_calloc.c | ||
} |
Oops, something went wrong.