Compare commits
No commits in common. "d0783882b69e2d7fe113aa148fc2c160794a35a5" and "15fde9a8563ff01e2e26e283d43b34bd788aa956" have entirely different histories.
d0783882b6
...
15fde9a856
4
Makefile
4
Makefile
@ -6,13 +6,13 @@
|
|||||||
# By: djonker <marvin@codam.nl> +#+ #
|
# By: djonker <marvin@codam.nl> +#+ #
|
||||||
# +#+ #
|
# +#+ #
|
||||||
# Created: 2020/12/19 06:09:46 by djonker #+# #+# #
|
# Created: 2020/12/19 06:09:46 by djonker #+# #+# #
|
||||||
# Updated: 2023/03/07 05:39:51 by houtworm \___)=(___/ #
|
# Updated: 2023/03/01 23:56:45 by djonker \___)=(___/ #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
NAME =push_swap
|
NAME =push_swap
|
||||||
CC =cc
|
CC =cc
|
||||||
CFLAGS =-Wall -Werror -Wextra #-g -fsanitize=address
|
CFLAGS =-Wall -Werror -Wextra -g -fsanitize=address
|
||||||
RM =rm -f
|
RM =rm -f
|
||||||
PSSRC =src/push_swap.c
|
PSSRC =src/push_swap.c
|
||||||
PSOBJ =obj/push_swap.o
|
PSOBJ =obj/push_swap.o
|
||||||
|
60
Readme.md
60
Readme.md
@ -1,55 +1,7 @@
|
|||||||
# Push Swap
|
Todo
|
||||||
Push Swap is a 2 stack sorting algoritm, The goal is to sort the input in as few moves as possible\
|
Improve 5 number algorhythm
|
||||||
I wrote my own algoritm which is a combination of quick sort and bubble sort as radix is very bad with only 2 stacks\
|
|
||||||
The following is a list of the moves we are allowed to make
|
|
||||||
|
|
||||||
| Move | Description |
|
Tester
|
||||||
| -- | ------ |
|
catch fsanitize signals
|
||||||
| pa | Pushes the top number from stack B to stack A |
|
create line that replaces -Wextra with "-g -fsanitize=address"
|
||||||
| pb | Pushes the top number from stack A to stack B |
|
check for -Wall -Werror -Wextra
|
||||||
| sa | Swaps the top 2 numbers in stack A |
|
|
||||||
| sb | Swaps the top 2 numbers in stack B |
|
|
||||||
| ss | Swaps the top 2 numbers in stack A and in Stack B |
|
|
||||||
| ra | Rotates Stack A moves all items forward so the last item becomes the first |
|
|
||||||
| rb | Rotates Stack B moves all items forward so the last item becomes the first |
|
|
||||||
| rr | Rotates Both stacks moves all items forward, so the last item becomes the first |
|
|
||||||
| rra | Reverse Rotates Stack A moves all items backwards, so the first item becomes the last |
|
|
||||||
| rrb | Reverse Rotates Stack B moves all items backwards, so the first item becomes the last |
|
|
||||||
| rrr | Reverse Rotates Both stacks moves all items backwards, so the first item becomes the last |
|
|
||||||
|
|
||||||
---
|
|
||||||
## Improvements
|
|
||||||
#### Improve 5 numbers algoritm
|
|
||||||
simply hardcode all possibilities with 5 numbers or less
|
|
||||||
#### Improve more than 30 algoritm
|
|
||||||
Gotta figure this out to always stay under the goals
|
|
||||||
|
|
||||||
---
|
|
||||||
## Usage
|
|
||||||
#### Sorter
|
|
||||||
1. Simply clone or download the repository
|
|
||||||
2. Run `make` in the cloned directory
|
|
||||||
3. Start the program with `./push_swap [numbers seperated by space]`
|
|
||||||
4. It will return the list of moves to sort the stack
|
|
||||||
#### Checker
|
|
||||||
1. Simply clone or download the repository
|
|
||||||
2. Run `make bonus` in the cloned directory
|
|
||||||
3. Start the program with `./checker [numbers seperated by space]`
|
|
||||||
4. You will have to input moves seperated by a return and when you are done press CTRL + D
|
|
||||||
5. It will return a OK or a KO.
|
|
||||||
#### Both
|
|
||||||
1. You can also run both programs with `./push_swap [numbers] | ./checker [same numbers]`
|
|
||||||
|
|
||||||
---
|
|
||||||
## Tester
|
|
||||||
#### Todo
|
|
||||||
- test "-" as argument
|
|
||||||
- check for -Wall -Werror -Wextra
|
|
||||||
|
|
||||||
#### Usage
|
|
||||||
1. Download test.sh to your push swap directory
|
|
||||||
2. Make the file executable `chmod +x test.sh`
|
|
||||||
3. Run `./test.sh` to start the test
|
|
||||||
|
|
||||||
---
|
|
||||||
[This project is part of the studies at 42](https://42.fr/en/homepage/)
|
|
||||||
|
8
getnextline/.gitignore
vendored
8
getnextline/.gitignore
vendored
@ -1,8 +0,0 @@
|
|||||||
*.pdf
|
|
||||||
*.o
|
|
||||||
*.a
|
|
||||||
LICENSE
|
|
||||||
obj
|
|
||||||
tests/tmp
|
|
||||||
.git
|
|
||||||
.ccls-cache
|
|
@ -1,12 +1,12 @@
|
|||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
# #
|
# #
|
||||||
# .--. _ #
|
# .--. _ #
|
||||||
# Makefile |o_o || | #
|
# Makefile :+: :+: :+: #
|
||||||
# |:_/ || |_ _ ___ __ #
|
# |:_/ || |_ _ ___ __ #
|
||||||
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
|
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
|
||||||
# (| | )|_| |_| |> < #
|
# (| | )|_| |_| |> < #
|
||||||
# Created: 2021/05/27 01:24:02 by djonker /'\_ _/`\__|\__,_/_/\_\ #
|
# Created: 2021/05/27 01:24:02 by djonker /'\_ _/`\__|\__,_/_/\_\ #
|
||||||
# Updated: 2023/02/20 20:37:06 by houtworm \___)=(___/ #
|
# Updated: 2023/02/07 00:57:52 by houtworm ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
@ -16,13 +16,18 @@ FC =-Wall -Werror -Wextra
|
|||||||
RM = rm -f
|
RM = rm -f
|
||||||
SRC = src/get_next_line.c\
|
SRC = src/get_next_line.c\
|
||||||
src/get_next_line_utils.c
|
src/get_next_line_utils.c
|
||||||
|
BSRC = src/get_next_line_bonus.c\
|
||||||
|
src/get_next_line_utils_bonus.c
|
||||||
OBJ =$(SRC:src/%.c=obj/%.o)
|
OBJ =$(SRC:src/%.c=obj/%.o)
|
||||||
|
BOBJ =$(BSRC:src/%.c=obj/%.o)
|
||||||
FAR = ar -crs
|
FAR = ar -crs
|
||||||
|
B1 = -D BUFFER_SIZE=1
|
||||||
|
B2 = -D BUFFER_SIZE=8
|
||||||
|
B3 = -D BUFFER_SIZE=500
|
||||||
|
B4 = -D BUFFER_SIZE=1000000
|
||||||
|
|
||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
bonus: $(NAME)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(RM) -r obj
|
@$(RM) -r obj
|
||||||
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
|
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
|
||||||
@ -34,7 +39,7 @@ fclean: clean
|
|||||||
re: fclean all
|
re: fclean all
|
||||||
|
|
||||||
$(OBJ): $(SRC)
|
$(OBJ): $(SRC)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p obj
|
||||||
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
||||||
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
||||||
|
|
||||||
@ -42,3 +47,14 @@ $(NAME): $(OBJ)
|
|||||||
@printf "\e[1;36mCompiling get next line\e[0;00m\n"
|
@printf "\e[1;36mCompiling get next line\e[0;00m\n"
|
||||||
@$(FAR) $(NAME) $^ > /dev/null 2>&1
|
@$(FAR) $(NAME) $^ > /dev/null 2>&1
|
||||||
@printf "\e[1;32mDone\e[0;00m\n"
|
@printf "\e[1;32mDone\e[0;00m\n"
|
||||||
|
|
||||||
|
$(BOBJ): $(BSRC)
|
||||||
|
@mkdir -p obj
|
||||||
|
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
||||||
|
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
||||||
|
|
||||||
|
bonus: $(BOBJ)
|
||||||
|
@printf "\e[1;36mCompiling get next line\e[0;00m\n"
|
||||||
|
@$(FAR) $(NAME) $^ > /dev/null 2>&1
|
||||||
|
@printf "\e[1;32mDone\e[0;00m\n"
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* get_next_line.h |o_o || | */
|
/* get_next_line.h :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/12/19 06:09:11 by djonker #+# #+# */
|
/* Created: 2020/12/19 06:09:11 by djonker #+# #+# */
|
||||||
/* Updated: 2021/05/27 03:41:54 by djonker \___)=(___/ */
|
/* Updated: 2023/02/08 22:16:50 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -33,10 +33,10 @@ int findnewline(struct s_gnl *strct);
|
|||||||
int newline(struct s_gnl *strct, char **line);
|
int newline(struct s_gnl *strct, char **line);
|
||||||
int blimit(int l, struct s_gnl *strct, char **line, char *t);;
|
int blimit(int l, struct s_gnl *strct, char **line, char *t);;
|
||||||
int nonewline(int l, struct s_gnl *strct, char **line);
|
int nonewline(int l, struct s_gnl *strct, char **line);
|
||||||
char *gnl_substr(char const *s, unsigned int start, size_t len);
|
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||||
void *gnl_memcpy(void *dst, const void *src, size_t n);
|
void *ft_memcpy(void *dst, const void *src, size_t n);
|
||||||
size_t gnl_strlen(char *str);
|
size_t ft_strlen(const char *str);
|
||||||
void gnl_bzero(void *s, size_t n);
|
void ft_bzero(void *s, size_t n);
|
||||||
char *gnl_strjoin(char const *s1, char const *s2);
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
38
getnextline/get_next_line_bonus.h
Normal file
38
getnextline/get_next_line_bonus.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* :::::::: */
|
||||||
|
/* get_next_line_bonus.h |o_o || | */
|
||||||
|
/* +:+ */
|
||||||
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
|
/* +#+ */
|
||||||
|
/* Created: 2020/12/19 06:09:11 by djonker #+# #+# */
|
||||||
|
/* Updated: 2021/05/27 03:17:28 by djonker \___)=(___/ */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef GET_NEXT_LINE_BONUS_H
|
||||||
|
# define GET_NEXT_LINE_BONUS_H
|
||||||
|
|
||||||
|
# include "get_next_line_bonus.h"
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <fcntl.h>
|
||||||
|
|
||||||
|
# ifndef BUFFER_SIZE
|
||||||
|
# define BUFFER_SIZE 300
|
||||||
|
# endif
|
||||||
|
|
||||||
|
struct s_gnl
|
||||||
|
{
|
||||||
|
char b[BUFFER_SIZE + 1];
|
||||||
|
int fd;
|
||||||
|
};
|
||||||
|
|
||||||
|
int get_next_line(int fd, char **line);
|
||||||
|
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||||
|
void *ft_memcpy(void *dst, const void *src, size_t n);
|
||||||
|
size_t ft_strlen(char *str);
|
||||||
|
void ft_bzero(void *s, size_t n);
|
||||||
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
|
|
||||||
|
#endif
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* get_next_line.c |o_o || | */
|
/* get_next_line.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2021/03/15 22:51:05 by djonker #+# #+# */
|
/* Created: 2021/03/15 22:51:05 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/20 20:32:05 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:54:08 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -32,17 +32,17 @@ int newline(struct s_gnl *strct, char **line)
|
|||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
l = findnewline(strct);
|
l = findnewline(strct);
|
||||||
line[0] = gnl_substr((const char *)strct->b, 0, l - 1);
|
line[0] = ft_substr((const char *)strct->b, 0, l - 1);
|
||||||
if (line[0] == NULL)
|
if (line[0] == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
t = gnl_substr((const char *)strct->b, l, BUFFER_SIZE - l);
|
t = ft_substr((const char *)strct->b, l, BUFFER_SIZE - l);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
{
|
{
|
||||||
free(line[0]);
|
free(line[0]);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
gnl_memcpy(strct->b, t, gnl_strlen(t));
|
ft_memcpy(strct->b, t, ft_strlen(t));
|
||||||
gnl_bzero(&strct->b[gnl_strlen(t)], BUFFER_SIZE - gnl_strlen(t));
|
ft_bzero(&strct->b[ft_strlen(t)], BUFFER_SIZE - ft_strlen(t));
|
||||||
free(t);
|
free(t);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ int blimit(int l, struct s_gnl *strct, char **line, char *t)
|
|||||||
if (l == 1 || l == 0)
|
if (l == 1 || l == 0)
|
||||||
{
|
{
|
||||||
f = line[0];
|
f = line[0];
|
||||||
line[0] = gnl_strjoin(t, line[0]);
|
line[0] = ft_strjoin(t, line[0]);
|
||||||
free (f);
|
free (f);
|
||||||
}
|
}
|
||||||
free(t);
|
free(t);
|
||||||
@ -68,8 +68,8 @@ int nonewline(int l, struct s_gnl *strct, char **line)
|
|||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
t = gnl_substr((const char *)strct->b, 0, gnl_strlen(strct->b));
|
t = ft_substr((const char *)strct->b, 0, ft_strlen(strct->b));
|
||||||
gnl_bzero(&strct->b[0], BUFFER_SIZE);
|
ft_bzero(&strct->b[0], BUFFER_SIZE);
|
||||||
l = read(strct->fd, strct->b, BUFFER_SIZE);
|
l = read(strct->fd, strct->b, BUFFER_SIZE);
|
||||||
if (l == -1 || t == NULL)
|
if (l == -1 || t == NULL)
|
||||||
{
|
{
|
||||||
@ -78,8 +78,8 @@ int nonewline(int l, struct s_gnl *strct, char **line)
|
|||||||
}
|
}
|
||||||
if (l == BUFFER_SIZE || findnewline(strct) > -1)
|
if (l == BUFFER_SIZE || findnewline(strct) > -1)
|
||||||
return (blimit(l, strct, line, t));
|
return (blimit(l, strct, line, t));
|
||||||
line[0] = gnl_strjoin(t, strct->b);
|
line[0] = ft_strjoin(t, strct->b);
|
||||||
gnl_bzero(&strct->b, BUFFER_SIZE);
|
ft_bzero(&strct->b, BUFFER_SIZE);
|
||||||
free(t);
|
free(t);
|
||||||
if (line[0] == NULL)
|
if (line[0] == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
114
getnextline/src/get_next_line_bonus.c
Normal file
114
getnextline/src/get_next_line_bonus.c
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* :::::::: */
|
||||||
|
/* get_next_line_bonus.c :+: :+: :+: */
|
||||||
|
/* +:+ */
|
||||||
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
|
/* +#+ */
|
||||||
|
/* Created: 2021/03/15 22:51:05 by djonker #+# #+# */
|
||||||
|
/* Updated: 2023/02/07 00:54:07 by houtworm ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "../get_next_line_bonus.h"
|
||||||
|
|
||||||
|
int findnewline(struct s_gnl *strct)
|
||||||
|
{
|
||||||
|
int l;
|
||||||
|
|
||||||
|
l = 0;
|
||||||
|
while (strct->b[l] != '\0')
|
||||||
|
{
|
||||||
|
if (strct->b[l] == '\n')
|
||||||
|
return (l + 1);
|
||||||
|
l++;
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int newline(struct s_gnl *strct, char **line)
|
||||||
|
{
|
||||||
|
int l;
|
||||||
|
char *t;
|
||||||
|
|
||||||
|
l = findnewline(strct);
|
||||||
|
line[0] = ft_substr((const char *)strct->b, 0, l - 1);
|
||||||
|
if (line[0] == NULL)
|
||||||
|
return (-1);
|
||||||
|
t = ft_substr((const char *)strct->b, l, BUFFER_SIZE - l);
|
||||||
|
if (t == NULL)
|
||||||
|
{
|
||||||
|
free(line[0]);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
ft_memcpy(strct->b, t, ft_strlen(t));
|
||||||
|
ft_bzero(&strct->b[ft_strlen(t)], BUFFER_SIZE - ft_strlen(t));
|
||||||
|
free(t);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int blimit(int l, struct s_gnl *strct, char **line, char *t)
|
||||||
|
{
|
||||||
|
char *f;
|
||||||
|
|
||||||
|
l = get_next_line(strct->fd, line);
|
||||||
|
if (l == 1 || l == 0)
|
||||||
|
{
|
||||||
|
f = line[0];
|
||||||
|
line[0] = ft_strjoin(t, line[0]);
|
||||||
|
free (f);
|
||||||
|
}
|
||||||
|
free(t);
|
||||||
|
if (line[0] == NULL)
|
||||||
|
return (-1);
|
||||||
|
return (l);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nonewline(int l, struct s_gnl *strct, char **line)
|
||||||
|
{
|
||||||
|
char *t;
|
||||||
|
|
||||||
|
t = ft_substr((const char *)strct->b, 0, ft_strlen(strct->b));
|
||||||
|
ft_bzero(&strct->b[0], BUFFER_SIZE);
|
||||||
|
l = read(strct->fd, strct->b, BUFFER_SIZE);
|
||||||
|
if (l == -1 || t == NULL)
|
||||||
|
{
|
||||||
|
line[0] = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (l == BUFFER_SIZE || findnewline(strct) > -1)
|
||||||
|
return (blimit(l, strct, line, t));
|
||||||
|
line[0] = ft_strjoin(t, strct->b);
|
||||||
|
ft_bzero(&strct->b, BUFFER_SIZE);
|
||||||
|
free(t);
|
||||||
|
if (line[0] == NULL)
|
||||||
|
return (-1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_next_line(int fd, char **line)
|
||||||
|
{
|
||||||
|
static struct s_gnl strct[256];
|
||||||
|
int l;
|
||||||
|
|
||||||
|
l = 0;
|
||||||
|
if (!line)
|
||||||
|
return (-1);
|
||||||
|
if (fd < 0 || BUFFER_SIZE <= 0)
|
||||||
|
{
|
||||||
|
line[0] = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
strct[fd].b[BUFFER_SIZE] = '\0';
|
||||||
|
strct[fd].fd = fd;
|
||||||
|
if (strct[fd].b[0] == '\0')
|
||||||
|
l = read(strct[fd].fd, strct[fd].b, BUFFER_SIZE);
|
||||||
|
if (l == -1)
|
||||||
|
{
|
||||||
|
line[0] = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (findnewline(&strct[fd]) > -1)
|
||||||
|
return (newline(&strct[fd], line));
|
||||||
|
return (nonewline(l, &strct[fd], line));
|
||||||
|
}
|
@ -6,13 +6,13 @@
|
|||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2021/04/05 07:45:24 by djonker #+# #+# */
|
/* Created: 2021/04/05 07:45:24 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/07 00:54:10 by houtworm ### ########.fr */
|
/* Updated: 2023/02/08 22:18:26 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../get_next_line.h"
|
#include "../get_next_line.h"
|
||||||
|
|
||||||
size_t gnl_strlen(char *str)
|
size_t ft_strlen(const char *str)
|
||||||
{
|
{
|
||||||
size_t a;
|
size_t a;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ size_t gnl_strlen(char *str)
|
|||||||
return (a);
|
return (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnl_bzero(void *s, size_t n)
|
void ft_bzero(void *s, size_t n)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ void gnl_bzero(void *s, size_t n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *gnl_memcpy(void *dst, const void *src, size_t n)
|
void *ft_memcpy(void *dst, const void *src, size_t n)
|
||||||
{
|
{
|
||||||
char *d;
|
char *d;
|
||||||
const char *s;
|
const char *s;
|
||||||
@ -55,7 +55,7 @@ void *gnl_memcpy(void *dst, const void *src, size_t n)
|
|||||||
return (dst);
|
return (dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *gnl_strjoin(char const *s1, char const *s2)
|
char *ft_strjoin(char const *s1, char const *s2)
|
||||||
{
|
{
|
||||||
int c1;
|
int c1;
|
||||||
int c2;
|
int c2;
|
||||||
@ -65,8 +65,8 @@ char *gnl_strjoin(char const *s1, char const *s2)
|
|||||||
|
|
||||||
c1 = 0;
|
c1 = 0;
|
||||||
c2 = 0;
|
c2 = 0;
|
||||||
l1 = gnl_strlen((char *)s1);
|
l1 = ft_strlen((char *)s1);
|
||||||
l2 = gnl_strlen((char *)s2);
|
l2 = ft_strlen((char *)s2);
|
||||||
r = malloc(l1 + l2 + 1);
|
r = malloc(l1 + l2 + 1);
|
||||||
if (r == NULL)
|
if (r == NULL)
|
||||||
return (r);
|
return (r);
|
||||||
@ -84,7 +84,7 @@ char *gnl_strjoin(char const *s1, char const *s2)
|
|||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *gnl_substr(char const *s, unsigned int start, size_t len)
|
char *ft_substr(char const *s, unsigned int start, size_t len)
|
||||||
{
|
{
|
||||||
char *r;
|
char *r;
|
||||||
long unsigned int i;
|
long unsigned int i;
|
||||||
|
103
getnextline/src/get_next_line_utils_bonus.c
Normal file
103
getnextline/src/get_next_line_utils_bonus.c
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* :::::::: */
|
||||||
|
/* get_next_line_utils_bonus.c :+: :+: :+: */
|
||||||
|
/* +:+ */
|
||||||
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
|
/* +#+ */
|
||||||
|
/* Created: 2021/04/05 07:45:24 by djonker #+# #+# */
|
||||||
|
/* Updated: 2023/02/07 00:54:09 by houtworm ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "../get_next_line.h"
|
||||||
|
|
||||||
|
size_t ft_strlen(char *str)
|
||||||
|
{
|
||||||
|
size_t a;
|
||||||
|
|
||||||
|
a = 0;
|
||||||
|
while (*str)
|
||||||
|
{
|
||||||
|
a++;
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
return (a);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ft_bzero(void *s, size_t n)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
p = s;
|
||||||
|
while (n)
|
||||||
|
{
|
||||||
|
*p = '\0';
|
||||||
|
p++;
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void *ft_memcpy(void *dst, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
char *d;
|
||||||
|
const char *s;
|
||||||
|
long unsigned int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
d = dst;
|
||||||
|
s = src;
|
||||||
|
while (n > i)
|
||||||
|
{
|
||||||
|
d[i] = s[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_strjoin(char const *s1, char const *s2)
|
||||||
|
{
|
||||||
|
int c1;
|
||||||
|
int c2;
|
||||||
|
int l1;
|
||||||
|
int l2;
|
||||||
|
char *r;
|
||||||
|
|
||||||
|
c1 = 0;
|
||||||
|
c2 = 0;
|
||||||
|
l1 = ft_strlen((char *)s1);
|
||||||
|
l2 = ft_strlen((char *)s2);
|
||||||
|
r = malloc(l1 + l2 + 1);
|
||||||
|
if (r == NULL)
|
||||||
|
return (r);
|
||||||
|
while (c1 < l1)
|
||||||
|
{
|
||||||
|
r[c1] = s1[c1];
|
||||||
|
c1++;
|
||||||
|
}
|
||||||
|
while (c2 < l2)
|
||||||
|
{
|
||||||
|
r[c1 + c2] = s2[c2];
|
||||||
|
c2++;
|
||||||
|
}
|
||||||
|
r[c1 + c2] = '\0';
|
||||||
|
return (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_substr(char const *s, unsigned int start, size_t len)
|
||||||
|
{
|
||||||
|
char *r;
|
||||||
|
long unsigned int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
r = malloc(len + 1);
|
||||||
|
if (r == NULL)
|
||||||
|
return (NULL);
|
||||||
|
while (len > i)
|
||||||
|
{
|
||||||
|
r[i] = s[i + start];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
r[i] = '\0';
|
||||||
|
return (r);
|
||||||
|
}
|
@ -1,398 +0,0 @@
|
|||||||
# **************************************************************************** #
|
|
||||||
# #
|
|
||||||
# .--. _ #
|
|
||||||
# test.sh |o_o || | #
|
|
||||||
# |:_/ || |_ _ ___ __ #
|
|
||||||
# By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / #
|
|
||||||
# (| | )|_| |_| |> < #
|
|
||||||
# Created: 2023/02/20 12:46:46 by houtworm /'\_ _/`\__|\__,_/_/\_\ #
|
|
||||||
# Updated: 2023/03/06 09:04:17 by houtworm \___)=(___/ #
|
|
||||||
# #
|
|
||||||
# **************************************************************************** #
|
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Vars and Init
|
|
||||||
|
|
||||||
PNAME=get_next_line.a
|
|
||||||
SLEEP=1
|
|
||||||
FAULTS=0
|
|
||||||
VALGRIND=0
|
|
||||||
which valgrind > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
VALGRIND=1
|
|
||||||
else
|
|
||||||
printf "\n\e[1;31mInstall Valgrind for extra Memory Checking\e[0;00m\n"
|
|
||||||
fi
|
|
||||||
HEADLOC=$(find ./ -name '*line.h' | grep -v tests)
|
|
||||||
mkdir -p tests/tmp
|
|
||||||
cp $HEADLOC tests/tmp/get_next_line.h
|
|
||||||
if [ $1 == "old" ]
|
|
||||||
then
|
|
||||||
SRCPATH="tests/src/old/"
|
|
||||||
FILPATH="tests/files/old/"
|
|
||||||
elif [ $1 == "new" ]
|
|
||||||
then
|
|
||||||
SRCPATH="tests/src/new/"
|
|
||||||
FILPATH="tests/files/new/"
|
|
||||||
else
|
|
||||||
printf "\e[1;31mPlease run the tester as follows\n./test.sh [VERSION] [SLEEPTIME]\nold returns an int while new returns the line\nexamples:\n./test.sh old\n./test.sh new\n./test.sh old 5\e[0;00m\n"
|
|
||||||
rm -rf tests/tmp
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ $2 ]
|
|
||||||
then
|
|
||||||
SLEEP=$2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
|
|
||||||
getnextline()
|
|
||||||
{
|
|
||||||
gcc -D BUFFER_SIZE=$1 -o tests/tmp/binary ${SRCPATH}$2 get_next_line.a
|
|
||||||
./tests/tmp/binary > tests/tmp/output
|
|
||||||
diff ${FILPATH}$3 tests/tmp/output > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;32mOutput OK\e[0;00m\n"
|
|
||||||
else
|
|
||||||
printf "\e[1;31mOutput is wrong\e[0;00m\n"
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
fi
|
|
||||||
gcc -g -fsanitize=address -D BUFFER_SIZE=$1 -o tests/tmp/binary ${SRCPATH}$2 get_next_line.a
|
|
||||||
./tests/tmp/binary > tests/tmp/output 2>tests/tmp/memorycheck
|
|
||||||
diff ${FILPATH}$3 tests/tmp/output > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
cat tests/tmp/memorycheck | grep "leaked" > /dev/null
|
|
||||||
if [ $? -eq 1 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;32mNo Leaks Fsanitize\e[0;00m\n"
|
|
||||||
else
|
|
||||||
printf "\n\e[1;31mKO found Leaks \e[0;00m\n"
|
|
||||||
cat tests/tmp/memorycheck
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf "\e[1;31mKO with fsanitize\e[0;00m\n"
|
|
||||||
cat tests/tmp/memorycheck
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
fi
|
|
||||||
if [ $VALGRIND -eq 1 ]
|
|
||||||
then
|
|
||||||
gcc -o tests/tmp/binary ${SRCPATH}$2 get_next_line.a 2> /dev/null
|
|
||||||
valgrind --leak-check=full ./tests/tmp/binary 2> tests/tmp/memorycheck > /dev/null
|
|
||||||
cat tests/tmp/memorycheck | grep indirectly | grep "[123456789] bytes" > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\n\e[1;31mLeaks Valgrind $1 $2\e[0;00m\n"
|
|
||||||
cat tests/tmp/memorycheck
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
CURFUNERR=1
|
|
||||||
else
|
|
||||||
printf "\e[1;32mNo Leaks Valgrind\e[0;00m\n"
|
|
||||||
fi
|
|
||||||
cat tests/tmp/memorycheck | grep definitely | grep "[123456789] bytes" > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\n\e[1;31mLeaks Valgrind $1 $2\e[0;00m\n"
|
|
||||||
cat tests/tmp/memorycheck
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
CURFUNERR=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
checkfile()
|
|
||||||
{
|
|
||||||
ls $1 2> /dev/null | grep $1 > /dev/null
|
|
||||||
if [ $? -ne $2 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;31mMakefile does not create $1\e[0;00m\n"
|
|
||||||
rm -rf tests/tmp
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
searchobj()
|
|
||||||
{
|
|
||||||
FILES=$(find ./ -name '*.o' | wc -l)
|
|
||||||
if [ $1 -eq 0 ]
|
|
||||||
then
|
|
||||||
if [ $FILES -ne 0 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;31mObject files found after clean\e[0;00m\n"
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ $1 -eq 1 ]
|
|
||||||
then
|
|
||||||
if [ $FILES -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;31mObject files not found after make\e[0;00m\n"
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
checkrule()
|
|
||||||
{
|
|
||||||
make $1 > /dev/null 2>&1
|
|
||||||
if [ $? -eq 2 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;31mMissing rule $1\e[0;00m\n"
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
relinkcheck()
|
|
||||||
{
|
|
||||||
make $1 2>&1 | grep -v Nothing > tests/tmp/relink && cat tests/tmp/relink | grep -v directory > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\n\e[1;31mMakefile relinks\e\n[0;00m"
|
|
||||||
cat tests/tmp/relink
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
else
|
|
||||||
printf "\e[1;32mMakefile OK\n\e[0;00m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
|
|
||||||
# Test 1
|
|
||||||
printf "\e[1;36mTest 1 Checking all source with Norminette\e[0;00m\n"
|
|
||||||
norminette $(find ./ -name '*.[ch]' | grep -v ./tests/) > tests/tmp/norm
|
|
||||||
if [ $? -eq 1 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;31mYour shit is not norm!\e[0;00m\n"
|
|
||||||
cat tests/tmp/norm
|
|
||||||
FAULTS=$(($FAULTS+1))
|
|
||||||
else
|
|
||||||
printf "\e[1;32mNorminette OK\e[0;00m\n"
|
|
||||||
fi
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 2
|
|
||||||
printf "\e[1;36mTest 2 Checking all mandatory rules Makefile\e[0;00m\n"
|
|
||||||
checkrule all
|
|
||||||
checkfile $PNAME 0
|
|
||||||
searchobj 1
|
|
||||||
checkrule clean
|
|
||||||
searchobj 0
|
|
||||||
checkfile $PNAME 0
|
|
||||||
checkrule $PNAME
|
|
||||||
searchobj 1
|
|
||||||
checkfile $PNAME 0
|
|
||||||
checkrule fclean
|
|
||||||
searchobj 0
|
|
||||||
checkfile $PNAME 1
|
|
||||||
checkrule re
|
|
||||||
searchobj 1
|
|
||||||
checkfile $PNAME 0
|
|
||||||
if [ $FAULTS -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;32mMakefile rules OK\e[0;00m\n"
|
|
||||||
fi
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 3
|
|
||||||
printf "\e[1;36mTest 3 Checking if Makefile relinks\e[0;00m\n"
|
|
||||||
relinkcheck
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 4
|
|
||||||
printf "\e[1;36mTest 4 Basic test with Buffer size 0\e[0;00m\n"
|
|
||||||
getnextline 0 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 5
|
|
||||||
printf "\e[1;36mTest 5 Basic test with Buffer size 1\e[0;00m\n"
|
|
||||||
getnextline 1 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 6
|
|
||||||
printf "\e[1;36mTest 6 Basic test with Buffer size 2\e[0;00m\n"
|
|
||||||
getnextline 2 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 7
|
|
||||||
printf "\e[1;36mTest 7 Basic test with Buffer size 3\e[0;00m\n"
|
|
||||||
getnextline 3 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 8
|
|
||||||
printf "\e[1;36mTest 8 Basic test with Buffer size 4\e[0;00m\n"
|
|
||||||
getnextline 4 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 9
|
|
||||||
printf "\e[1;36mTest 9 Basic test with Buffer size 5\e[0;00m\n"
|
|
||||||
getnextline 5 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 10
|
|
||||||
printf "\e[1;36mTest 10 Basic test with Buffer size 6\e[0;00m\n"
|
|
||||||
getnextline 6 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 11
|
|
||||||
printf "\e[1;36mTest 11 Basic test with Buffer size 7\e[0;00m\n"
|
|
||||||
getnextline 7 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 12
|
|
||||||
printf "\e[1;36mTest 12 Basic test with Buffer size 8\e[0;00m\n"
|
|
||||||
getnextline 8 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 13
|
|
||||||
printf "\e[1;36mTest 13 Basic test with Buffer size 9\e[0;00m\n"
|
|
||||||
getnextline 9 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 14
|
|
||||||
printf "\e[1;36mTest 14 Basic test with Buffer size 10\e[0;00m\n"
|
|
||||||
getnextline 10 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 15
|
|
||||||
printf "\e[1;36mTest 15 Basic test with Buffer size 100\e[0;00m\n"
|
|
||||||
getnextline 100 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 16
|
|
||||||
printf "\e[1;36mTest 16 Basic test with Buffer size 1000\e[0;00m\n"
|
|
||||||
getnextline 1000 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 17
|
|
||||||
printf "\e[1;36mTest 17 Basic test with Buffer size 10000\e[0;00m\n"
|
|
||||||
getnextline 10000 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 18
|
|
||||||
printf "\e[1;36mTest 18 Basic test with Buffer size 100000\e[0;00m\n"
|
|
||||||
getnextline 100000 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 19
|
|
||||||
printf "\e[1;36mTest 19 Basic test with Buffer size 1000000\e[0;00m\n"
|
|
||||||
getnextline 1000000 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 20
|
|
||||||
printf "\e[1;36mTest 20 Basic test with Buffer size 10000000\e[0;00m\n"
|
|
||||||
getnextline 10000000 maina.c basic
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 21
|
|
||||||
printf "\e[1;36mTest 21 300.000 character line with buffer size 1\e[0;00m\n"
|
|
||||||
getnextline 1 mainb.c extreme1
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 22
|
|
||||||
printf "\e[1;36mTest 22 300.000 character line with buffer size 100.000\e[0;00m\n"
|
|
||||||
getnextline 100000 mainb.c extreme1
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 23
|
|
||||||
printf "\e[1;36mTest 23 300.000 empty lines with buffer size 1\e[0;00m\n"
|
|
||||||
getnextline 1 mainc.c extreme2
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 24
|
|
||||||
printf "\e[1;36mTest 24 300.000 empty lines with buffer size 100.000\e[0;00m\n"
|
|
||||||
getnextline 100000 mainc.c extreme2
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 25
|
|
||||||
printf "\e[1;36mTest 25 All unicode characters with buffer size 1\e[0;00m\n"
|
|
||||||
getnextline 1 maine.c unicode
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 26
|
|
||||||
printf "\e[1;36mTest 26 All unicode characters with buffer size 100.000\e[0;00m\n"
|
|
||||||
getnextline 100000 maine.c unicode
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 27
|
|
||||||
printf "\e[1;36mTest 27 Reading from stdin buffer size 1\e[0;00m\n"
|
|
||||||
printf "Please type Hello, Press Enter and hit CTRL+D with every empty line\n"
|
|
||||||
getnextline 1 mainf.c hello
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 28
|
|
||||||
printf "\e[1;36mTest 28 Reading from stdin buffer size 100.000\e[0;00m\n"
|
|
||||||
printf "Please type Hello, Press Enter and hit CTRL+D with every empty line\n"
|
|
||||||
getnextline 100000 mainf.c hello
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 29
|
|
||||||
find ./ -name '*bonus.h' | grep bonus > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
HEADLOC=$(find ./ -name '*bonus.h')
|
|
||||||
cp $HEADLOC tests/tmp/get_next_line.h
|
|
||||||
fi
|
|
||||||
printf "\e[1;36mTest 29 Checking if Makefile bonus rule exists\e[0;00m\n"
|
|
||||||
make fclean > /dev/null
|
|
||||||
make bonus >/dev/null 2>&1
|
|
||||||
if [ $? -eq 2 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;31mNo bonus? I am a little dissapointed...\e[0;00m\n"
|
|
||||||
if [ $FAULTS -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;35mBut we got no errors, Congratulations\e[0;00m\n"
|
|
||||||
make fclean > /dev/null
|
|
||||||
rm -rf tests/tmp
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
printf "\e[1;31mAnd we got $FAULTS errors\nSo that's a bummer\e[0;00m\n"
|
|
||||||
make fclean > /dev/null
|
|
||||||
rm -rf tests/tmp
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
printf "\e[1;32mbonus rule OK\e[0;00m\n"
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 30
|
|
||||||
printf "\e[1;36mTest 30 Checking if Makefile relinks for bonus\e[0;00m\n"
|
|
||||||
relinkcheck bonus
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 31
|
|
||||||
printf "\e[1;36mTest 31 Reading from 2 files at once buffer size 1\e[0;00m\n"
|
|
||||||
getnextline 1 maind.c resd
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 32
|
|
||||||
printf "\e[1;36mTest 32 Reading from 2 files at once buffer size 100.000\e[0;00m\n"
|
|
||||||
getnextline 100000 maind.c resd
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 33
|
|
||||||
printf "\e[1;36mTest 33 Reading from 5 files at once buffer size 1\e[0;00m\n"
|
|
||||||
getnextline 1 maing.c resg
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Test 34
|
|
||||||
printf "\e[1;36mTest 34 Reading from 5 files at once buffer size 100.000\e[0;00m\n"
|
|
||||||
getnextline 100000 maing.c resg
|
|
||||||
sleep $SLEEP
|
|
||||||
|
|
||||||
# Conclusion
|
|
||||||
if [ $FAULTS -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "\e[1;35mwe got no errors, Congratulations\e[0;00m\n"
|
|
||||||
else
|
|
||||||
printf "\e[1;31mwe got $FAULTS errors\nSo that's a bummer\e[0;00m\n"
|
|
||||||
make fclean > /dev/null
|
|
||||||
rm -rf tests/tmp
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
make fclean > /dev/null
|
|
||||||
rm -rf tests/tmp
|
|
||||||
exit 0
|
|
@ -1,9 +0,0 @@
|
|||||||
1 character on a line
|
|
||||||
1
|
|
||||||
1
|
|
||||||
empty line
|
|
||||||
|
|
||||||
|
|
||||||
3000 characters on a line
|
|
||||||
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
@ -1,10 +0,0 @@
|
|||||||
line 1
|
|
||||||
line 3
|
|
||||||
line 5
|
|
||||||
line 7
|
|
||||||
line 9
|
|
||||||
line 11
|
|
||||||
line 13
|
|
||||||
line 15
|
|
||||||
line 17
|
|
||||||
line 19
|
|
@ -1,10 +0,0 @@
|
|||||||
line 2
|
|
||||||
line 4
|
|
||||||
line 6
|
|
||||||
line 8
|
|
||||||
line 10
|
|
||||||
line 12
|
|
||||||
line 14
|
|
||||||
line 16
|
|
||||||
line 18
|
|
||||||
line 20
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
|||||||
Hello
|
|
@ -1,20 +0,0 @@
|
|||||||
line 1
|
|
||||||
line 2
|
|
||||||
line 3
|
|
||||||
line 4
|
|
||||||
line 5
|
|
||||||
line 6
|
|
||||||
line 7
|
|
||||||
line 8
|
|
||||||
line 9
|
|
||||||
line 10
|
|
||||||
line 11
|
|
||||||
line 12
|
|
||||||
line 13
|
|
||||||
line 14
|
|
||||||
line 15
|
|
||||||
line 16
|
|
||||||
line 17
|
|
||||||
line 18
|
|
||||||
line 19
|
|
||||||
line 20
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
|||||||
<<1>>1 character on a line
|
|
||||||
<<1>>1
|
|
||||||
<<1>>1
|
|
||||||
<<1>>empty line
|
|
||||||
<<1>>
|
|
||||||
<<1>>
|
|
||||||
<<1>>3000 characters on a line
|
|
||||||
<<1>>123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
<<1>>123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
<<0>>
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,2 +0,0 @@
|
|||||||
<<1>>Hello
|
|
||||||
<<0>>
|
|
@ -1,22 +0,0 @@
|
|||||||
<<1>>line 1
|
|
||||||
<<1>>line 2
|
|
||||||
<<1>>line 3
|
|
||||||
<<1>>line 4
|
|
||||||
<<1>>line 5
|
|
||||||
<<1>>line 6
|
|
||||||
<<1>>line 7
|
|
||||||
<<1>>line 8
|
|
||||||
<<1>>line 9
|
|
||||||
<<1>>line 10
|
|
||||||
<<1>>line 11
|
|
||||||
<<1>>line 12
|
|
||||||
<<1>>line 13
|
|
||||||
<<1>>line 14
|
|
||||||
<<1>>line 15
|
|
||||||
<<1>>line 16
|
|
||||||
<<1>>line 17
|
|
||||||
<<1>>line 18
|
|
||||||
<<1>>line 19
|
|
||||||
<<1>>line 20
|
|
||||||
<<0>>
|
|
||||||
<<0>>
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,30 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maina.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:36:49 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
line = "\n";
|
|
||||||
fd1 = open("tests/files/new/basic", O_RDONLY);
|
|
||||||
while (line)
|
|
||||||
{
|
|
||||||
line = get_next_line(fd1);
|
|
||||||
printf("%s\n", line);
|
|
||||||
free (line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* mainb.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:36:03 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
line = "\n";
|
|
||||||
fd1 = open("tests/files/new/extreme1", O_RDONLY);
|
|
||||||
while (line)
|
|
||||||
{
|
|
||||||
line = get_next_line(fd1);
|
|
||||||
printf("%s\n", line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* mainc.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:35:58 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
line = "\n";
|
|
||||||
fd1 = open("tests/files/new/extreme2", O_RDONLY);
|
|
||||||
while (line)
|
|
||||||
{
|
|
||||||
line = get_next_line(fd1);
|
|
||||||
printf("%s\n", line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maind.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:35:54 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
int fd2;
|
|
||||||
char *line1;
|
|
||||||
char *line2;
|
|
||||||
|
|
||||||
line1 = "\n";
|
|
||||||
line2 = "\n";
|
|
||||||
fd1 = open("tests/files/new/compare1", O_RDONLY);
|
|
||||||
fd2 = open("tests/files/new/compare2", O_RDONLY);
|
|
||||||
while (line1 || line2)
|
|
||||||
{
|
|
||||||
if (line1)
|
|
||||||
{
|
|
||||||
line1 = get_next_line(fd1);
|
|
||||||
printf("%s\n", line1);
|
|
||||||
free(line1);
|
|
||||||
}
|
|
||||||
if (line2)
|
|
||||||
{
|
|
||||||
line2 = get_next_line(fd2);
|
|
||||||
printf("%s\n", line2);
|
|
||||||
free(line2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maine.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/23 15:00:31 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
line = "\n";
|
|
||||||
fd1 = open("tests/files/new/unicode", O_RDONLY);
|
|
||||||
while (line)
|
|
||||||
{
|
|
||||||
line = get_next_line(fd1);
|
|
||||||
printf("%s\n", line);
|
|
||||||
free (line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* mainf.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:35:34 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
line = "\n";
|
|
||||||
fd1 = 0;
|
|
||||||
while (line)
|
|
||||||
{
|
|
||||||
line = get_next_line(fd1);
|
|
||||||
printf("%s\n", line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maing.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/01 01:41:42 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
char *printline(char *line, int fd)
|
|
||||||
{
|
|
||||||
line = get_next_line(fd);
|
|
||||||
printf("%s\n", line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int *fd[6];
|
|
||||||
char *line[5];
|
|
||||||
|
|
||||||
fd[5] = 5;
|
|
||||||
while (--fd[5] >= 0)
|
|
||||||
*line[fd5] = "\n";
|
|
||||||
fd[0] = open("tests/files/new/compare1", O_RDONLY);
|
|
||||||
fd[1] = open("tests/files/new/basic", O_RDONLY);
|
|
||||||
fd[2] = open("tests/files/new/extreme1", O_RDONLY);
|
|
||||||
fd[3] = open("tests/files/new/compare2", O_RDONLY);
|
|
||||||
fd[4] = open("tests/files/new/extreme2", O_RDONLY);
|
|
||||||
while (line[0] || line[1] || line[2] || line[3] || line[4])
|
|
||||||
{
|
|
||||||
if (line[0])
|
|
||||||
line[0] = printline(line[0], fd[0]);
|
|
||||||
if (line[1])
|
|
||||||
line[1] = printline(line[1], fd[1]);
|
|
||||||
if (line[2])
|
|
||||||
line[2] = printline(line[2], fd[2]);
|
|
||||||
if (line[3])
|
|
||||||
line[3] = printline(line[3], fd[3]);
|
|
||||||
if (line[4])
|
|
||||||
line[4] = printline(line[4], fd[4]);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maina.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:42:59 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
int r1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
r1 = 1;
|
|
||||||
fd1 = open("tests/files/new/basic", O_RDONLY);
|
|
||||||
while (r1 > 0)
|
|
||||||
{
|
|
||||||
r1 = get_next_line(fd1, &line);
|
|
||||||
printf("<<%d>>%s\n", r1, line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* mainb.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:43:10 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
int r1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
r1 = 1;
|
|
||||||
fd1 = open("tests/files/new/extreme1", O_RDONLY);
|
|
||||||
while (r1 > 0)
|
|
||||||
{
|
|
||||||
r1 = get_next_line(fd1, &line);
|
|
||||||
printf("<<%d>>%s\n", r1, line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* mainc.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:43:21 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
int r1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
r1 = 1;
|
|
||||||
fd1 = open("tests/files/new/extreme2", O_RDONLY);
|
|
||||||
while (r1 > 0)
|
|
||||||
{
|
|
||||||
r1 = get_next_line(fd1, &line);
|
|
||||||
printf("<<%d>>%s\n", r1, line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maind.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/01 01:24:29 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd[2];
|
|
||||||
int r[2];
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
r[0] = 1;
|
|
||||||
r[1] = 1;
|
|
||||||
fd[0] = open("tests/files/new/compare1", O_RDONLY);
|
|
||||||
fd[1] = open("tests/files/new/compare2", O_RDONLY);
|
|
||||||
while (r[0] > 0 || r[1] > 0)
|
|
||||||
{
|
|
||||||
if (r[0] > 0)
|
|
||||||
{
|
|
||||||
r[0] = get_next_line(fd[0], &line);
|
|
||||||
printf("<<%d>>%s\n", r[0], line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
if (r[1] > 0)
|
|
||||||
{
|
|
||||||
r[1] = get_next_line(fd[1], &line);
|
|
||||||
printf("<<%d>>%s\n", r[1], line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maine.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/23 15:00:34 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
int r1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
r1 = 1;
|
|
||||||
fd1 = open("tests/files/new/unicode", O_RDONLY);
|
|
||||||
while (r1 > 0)
|
|
||||||
{
|
|
||||||
r1 = get_next_line(fd1, &line);
|
|
||||||
printf("<<%d>>%s\n", r1, line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* mainf.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/21 00:44:00 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd1;
|
|
||||||
int r1;
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
r1 = 1;
|
|
||||||
fd1 = 0;
|
|
||||||
while (r1 > 0)
|
|
||||||
{
|
|
||||||
r1 = get_next_line(fd1, &line);
|
|
||||||
printf("<<%d>>%s\n", r1, line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* maing.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2021/02/15 03:43:05 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/01 01:39:22 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/get_next_line.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int printline(int fd, char *line)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
|
|
||||||
r = get_next_line(fd, &line);
|
|
||||||
printf("<<%d>>%s\n", r, line);
|
|
||||||
free(line);
|
|
||||||
return (r);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int fd[6];
|
|
||||||
int r[5];
|
|
||||||
char *line;
|
|
||||||
|
|
||||||
fd[5] = 5;
|
|
||||||
while (--fd[5] >= 0)
|
|
||||||
r[fd[5]] = 2;
|
|
||||||
fd[0] = open("tests/files/new/compare1", O_RDONLY);
|
|
||||||
fd[1] = open("tests/files/new/basic", O_RDONLY);
|
|
||||||
fd[2] = open("tests/files/new/extreme1", O_RDONLY);
|
|
||||||
fd[3] = open("tests/files/new/compare2", O_RDONLY);
|
|
||||||
fd[4] = open("tests/files/new/extreme2", O_RDONLY);
|
|
||||||
while (r[0] > 0 || r[1] > 0 || r[2] > 0 || r[3] > 0 || r[4] > 0)
|
|
||||||
{
|
|
||||||
fd[5] = 0;
|
|
||||||
while (fd[5] < 5)
|
|
||||||
{
|
|
||||||
if (r[fd[5]] > 0)
|
|
||||||
r[fd[5]] = printline(fd[fd[5]], line);
|
|
||||||
fd[5]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
8
libft/.gitignore
vendored
8
libft/.gitignore
vendored
@ -1,8 +0,0 @@
|
|||||||
*.pdf
|
|
||||||
*.o
|
|
||||||
*.a
|
|
||||||
LICENSE
|
|
||||||
obj
|
|
||||||
tests/tmp
|
|
||||||
.git
|
|
||||||
.ccls-cache
|
|
@ -6,13 +6,13 @@
|
|||||||
# By: djonker <marvin@codam.nl> +#+ #
|
# By: djonker <marvin@codam.nl> +#+ #
|
||||||
# +#+ #
|
# +#+ #
|
||||||
# Created: 2020/10/27 15:02:02 by djonker #+# #+# #
|
# Created: 2020/10/27 15:02:02 by djonker #+# #+# #
|
||||||
# Updated: 2023/02/23 15:40:38 by houtworm \___)=(___/ #
|
# Updated: 2023/02/17 02:39:13 by houtworm \___)=(___/ #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
NAME =libft.a
|
NAME =libft.a
|
||||||
CC =gcc
|
CC =gcc
|
||||||
FC =-Wall -Werror -Wextra -fsanitize=address
|
FC =-Wall -Werror -Wextra# -fsanitize=address
|
||||||
FAR =ar -rs
|
FAR =ar -rs
|
||||||
RM =rm -f
|
RM =rm -f
|
||||||
SRC =src/ft_atoi.c \
|
SRC =src/ft_atoi.c \
|
||||||
@ -172,7 +172,7 @@ fclean: clean
|
|||||||
re: fclean all
|
re: fclean all
|
||||||
|
|
||||||
$(COBJ): $(CSRC)
|
$(COBJ): $(CSRC)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p obj
|
||||||
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
||||||
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
# Functions
|
|
||||||
## striteri
|
|
||||||
void ft_striteri(char *s, void (*f)(unsigned int, char*));
|
|
||||||
|
|
||||||
# Tester
|
|
||||||
## general
|
|
||||||
check for -Wall -Werror -Wextra
|
|
||||||
Think of more edge cases for all functions
|
|
||||||
## add tests extra
|
|
||||||
check if function exists in .h and run the tests for that fucntion
|
|
@ -6,13 +6,13 @@
|
|||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/11 16:02:53 by djonker #+# #+# */
|
/* Created: 2020/11/11 16:02:53 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/05 20:30:31 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/17 02:56:08 by houtworm \___)=(___/ */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef LIBFT_H
|
#ifndef LIBFT_H
|
||||||
# define LIBFT_H
|
# define LIBFT_H
|
||||||
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
@ -47,6 +47,7 @@ int ft_toupper(int c);
|
|||||||
int ft_tolower(int c);
|
int ft_tolower(int c);
|
||||||
void *ft_calloc(size_t count, size_t size);
|
void *ft_calloc(size_t count, size_t size);
|
||||||
char *ft_strdup(const char *s);
|
char *ft_strdup(const char *s);
|
||||||
|
|
||||||
char *ft_substr(char const *s, unsigned int start, size_t len);
|
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||||
char *ft_strjoin(char const *s1, char const *s2);
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
char *ft_strtrim(char const *s1, char const *set);
|
char *ft_strtrim(char const *s1, char const *set);
|
||||||
@ -113,6 +114,8 @@ long long ft_atol(char *str);
|
|||||||
unsigned long long ft_atou(char *str);
|
unsigned long long ft_atou(char *str);
|
||||||
double ft_atof(char *str);
|
double ft_atof(char *str);
|
||||||
long double ft_atodec(char *str);
|
long double ft_atodec(char *str);
|
||||||
|
char *ft_itoa(int n);
|
||||||
|
char *ft_itoa(int n);
|
||||||
int ft_itob(int d);
|
int ft_itob(int d);
|
||||||
char *ft_itoba(unsigned long long d, size_t e);
|
char *ft_itoba(unsigned long long d, size_t e);
|
||||||
int ft_btoi(int i, int e);
|
int ft_btoi(int i, int e);
|
||||||
@ -158,6 +161,7 @@ char *ft_lftoa(long double n);
|
|||||||
int ft_ldeclen(long double n);
|
int ft_ldeclen(long double n);
|
||||||
int ft_islneg(long long n);
|
int ft_islneg(long long n);
|
||||||
char *ft_dtoa(long double n);
|
char *ft_dtoa(long double n);
|
||||||
|
int ft_cntarg(char **argv);
|
||||||
int ft_isallbyte(char *str, char byte);
|
int ft_isallbyte(char *str, char byte);
|
||||||
char *ft_getpwd(char **envp, int slash);
|
char *ft_getpwd(char **envp, int slash);
|
||||||
|
|
||||||
|
@ -21,13 +21,14 @@ int ft_atoi(char *str)
|
|||||||
r = 0;
|
r = 0;
|
||||||
c = 0;
|
c = 0;
|
||||||
n = 1;
|
n = 1;
|
||||||
if (str == NULL)
|
|
||||||
return (0);
|
|
||||||
while ((str[c] == 32) || (str[c] > 8 && str[c] < 14))
|
while ((str[c] == 32) || (str[c] > 8 && str[c] < 14))
|
||||||
c++;
|
c++;
|
||||||
if (str[c] == '-' || str[c] == '+')
|
if (str[c] == '-' || str[c] == '+')
|
||||||
if (str[c++] == '-')
|
{
|
||||||
|
if (str[c] == '-')
|
||||||
n = -1;
|
n = -1;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
while (str[c] >= '0' && str[c] <= '9')
|
while (str[c] >= '0' && str[c] <= '9')
|
||||||
{
|
{
|
||||||
r = 10 * r + (str[c] - '0');
|
r = 10 * r + (str[c] - '0');
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_atou.c |o_o || | */
|
/* ft_atou.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 19:08:11 by djonker #+# #+# */
|
/* Created: 2020/11/01 19:08:11 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/05 21:13:18 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:36:46 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -26,6 +26,5 @@ unsigned long long ft_atou(char *str)
|
|||||||
r = 10 * r + (str[c] - '0');
|
r = 10 * r + (str[c] - '0');
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
free (str);
|
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_bzero.c |o_o || | */
|
/* ft_bzero.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 08:35:25 by djonker #+# #+# */
|
/* Created: 2020/11/01 08:35:25 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/22 02:01:25 by djonker \___)=(___/ */
|
/* Updated: 2023/02/07 00:36:47 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -16,8 +16,6 @@ void ft_bzero(void *s, size_t n)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (!s || n <= 0)
|
|
||||||
return ;
|
|
||||||
p = s;
|
p = s;
|
||||||
while (n)
|
while (n)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_calloc.c |o_o || | */
|
/* ft_calloc.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 21:20:32 by djonker #+# #+# */
|
/* Created: 2020/11/01 21:20:32 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/25 16:18:01 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:36:47 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
|
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/07 00:38:26 by houtworm #+# #+# */
|
/* Created: 2023/02/07 00:38:26 by houtworm #+# #+# */
|
||||||
/* Updated: 2023/02/21 01:43:17 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/15 02:38:53 by djonker \___)=(___/ */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_frearr.c :+: :+: :+: */
|
/* ft_frearr.c |o_o || | */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/12/11 21:54:13 by djonker #+# #+# */
|
/* Created: 2020/12/11 21:54:13 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/07 00:39:42 by houtworm ### ########.fr */
|
/* Updated: 2023/02/19 19:37:54 by djonker \___)=(___/ */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
|
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
|
||||||
/* (| | )|_| |_| |> < */
|
/* (| | )|_| |_| |> < */
|
||||||
/* Created: 2023/02/17 02:40:22 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
|
/* Created: 2023/02/17 02:40:22 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
|
||||||
/* Updated: 2023/02/17 02:55:28 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/17 02:54:29 by houtworm \___)=(___/ */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* .--. _ */
|
/* ::: :::::::: */
|
||||||
/* ft_isallbyte.c |o_o || | */
|
/* ft_isallbyte.c :+: :+: :+: */
|
||||||
/* |:_/ || |_ _ ___ __ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
|
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
|
||||||
/* (| | )|_| |_| |> < */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/21 01:43:42 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
|
/* Created: 2023/02/15 17:08:40 by houtworm #+# #+# */
|
||||||
/* Updated: 2023/02/21 01:43:44 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/15 17:08:45 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_itob.c |o_o || | */
|
/* ft_itob.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2021/01/04 04:42:54 by djonker #+# #+# */
|
/* Created: 2021/01/04 04:42:54 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/07 05:07:51 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:06 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -28,6 +28,5 @@ int ft_itob(int d)
|
|||||||
s[i] = '\0';
|
s[i] = '\0';
|
||||||
r = ft_revstr(s);
|
r = ft_revstr(s);
|
||||||
i = ft_atoi(r);
|
i = ft_atoi(r);
|
||||||
free(r);
|
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_itoh.c |o_o || | */
|
/* ft_itoh.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
|
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/05 20:33:06 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:09 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_itozh.c |o_o || | */
|
/* ft_itozh.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
|
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/07 05:15:26 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:26 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_lstadd_back.c |o_o || | */
|
/* ft_lstadd_back.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 18:48:54 by djonker #+# #+# */
|
/* Created: 2020/11/13 18:48:54 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 19:09:28 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ void ft_lstadd_back(t_list **lst, t_list *new)
|
|||||||
{
|
{
|
||||||
t_list *l;
|
t_list *l;
|
||||||
|
|
||||||
if (lst && new)
|
if (lst)
|
||||||
{
|
{
|
||||||
if (*lst)
|
if (*lst)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_lstadd_front.c |o_o || | */
|
/* ft_lstadd_front.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 04:38:37 by djonker #+# #+# */
|
/* Created: 2020/11/13 04:38:37 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 16:12:15 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
void ft_lstadd_front(t_list **lst, t_list *new)
|
void ft_lstadd_front(t_list **lst, t_list *new)
|
||||||
{
|
{
|
||||||
if (lst && new)
|
if (lst)
|
||||||
{
|
{
|
||||||
if (*lst)
|
if (*lst)
|
||||||
new->next = *lst;
|
new->next = *lst;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_lstclear.c |o_o || | */
|
/* ft_lstclear.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 19:12:41 by djonker #+# #+# */
|
/* Created: 2020/11/13 19:12:41 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/04 01:50:59 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -15,15 +15,25 @@
|
|||||||
void ft_lstclear(t_list **lst, void (*del)(void*))
|
void ft_lstclear(t_list **lst, void (*del)(void*))
|
||||||
{
|
{
|
||||||
t_list *t;
|
t_list *t;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
t = NULL;
|
t = NULL;
|
||||||
if (lst)
|
if (!del)
|
||||||
{
|
{
|
||||||
while (*lst)
|
while (t->next != NULL)
|
||||||
|
{
|
||||||
|
free(lst[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
free(t);
|
||||||
|
}
|
||||||
|
if (!del || !lst || !*lst)
|
||||||
|
return ;
|
||||||
|
while (lst && *lst)
|
||||||
{
|
{
|
||||||
t = (*lst)->next;
|
t = (*lst)->next;
|
||||||
ft_lstdelone(*lst, del);
|
ft_lstdelone(*lst, del);
|
||||||
*lst = t;
|
*lst = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_lstiter.c |o_o || | */
|
/* ft_lstiter.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 19:15:47 by djonker #+# #+# */
|
/* Created: 2020/11/13 19:15:47 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/04 15:30:35 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:34 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
void ft_lstiter(t_list *lst, void (*f)(void *))
|
void ft_lstiter(t_list *lst, void (*f)(void *))
|
||||||
{
|
{
|
||||||
if (!f || lst == NULL)
|
if (!f)
|
||||||
return ;
|
return ;
|
||||||
while (lst)
|
while (lst)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_lstlast.c |o_o || | */
|
/* ft_lstlast.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 18:45:02 by djonker #+# #+# */
|
/* Created: 2020/11/13 18:45:02 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 18:08:43 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:34 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_lstmap.c |o_o || | */
|
/* ft_lstmap.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 19:30:13 by djonker #+# #+# */
|
/* Created: 2020/11/13 19:30:13 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/04 16:07:56 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:34 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *))
|
|||||||
|
|
||||||
r = NULL;
|
r = NULL;
|
||||||
t = NULL;
|
t = NULL;
|
||||||
while (lst && f)
|
while (lst)
|
||||||
{
|
{
|
||||||
if (f(lst->content))
|
if (f(lst->content))
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_lstsize.c |o_o || | */
|
/* ft_lstsize.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 18:27:52 by djonker #+# #+# */
|
/* Created: 2020/11/13 18:27:52 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 17:20:28 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:35 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 08:38:54 by djonker #+# #+# */
|
/* Created: 2020/11/01 08:38:54 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/24 20:52:37 by houtworm ### ########.fr */
|
/* Updated: 2023/02/07 00:40:38 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,10 +18,6 @@ void *ft_memccpy(void *dst, const void *src, int c, size_t n)
|
|||||||
unsigned const char *s;
|
unsigned const char *s;
|
||||||
unsigned char u;
|
unsigned char u;
|
||||||
|
|
||||||
if (!dst || !src)
|
|
||||||
return (NULL);
|
|
||||||
if (u > ft_strlen(dst))
|
|
||||||
u = ft_strlen(dst);
|
|
||||||
d = dst;
|
d = dst;
|
||||||
s = src;
|
s = src;
|
||||||
u = c;
|
u = c;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_memchr.c |o_o || | */
|
/* ft_memchr.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 08:35:56 by djonker #+# #+# */
|
/* Created: 2020/11/01 08:35:56 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/27 05:12:02 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -17,8 +17,6 @@ void *ft_memchr(const void *s, int c, size_t n)
|
|||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
unsigned char t;
|
unsigned char t;
|
||||||
|
|
||||||
if (!s)
|
|
||||||
return (NULL);
|
|
||||||
t = (unsigned char)c;
|
t = (unsigned char)c;
|
||||||
p = (unsigned char *)s;
|
p = (unsigned char *)s;
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_memcmp.c |o_o || | */
|
/* ft_memcmp.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 08:41:32 by djonker #+# #+# */
|
/* Created: 2020/11/01 08:41:32 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/28 15:22:59 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -17,10 +17,6 @@ int ft_memcmp(const void *s1, const void *s2, size_t n)
|
|||||||
const unsigned char *p1;
|
const unsigned char *p1;
|
||||||
const unsigned char *p2;
|
const unsigned char *p2;
|
||||||
|
|
||||||
if (!s1 && !s2)
|
|
||||||
return (0);
|
|
||||||
if (!s1 || !s2)
|
|
||||||
return (1);
|
|
||||||
p1 = s1;
|
p1 = s1;
|
||||||
p2 = s2;
|
p2 = s2;
|
||||||
while (n)
|
while (n)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_memcpy.c |o_o || | */
|
/* ft_memcpy.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/11 16:13:52 by djonker #+# #+# */
|
/* Created: 2020/11/11 16:13:52 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/01 18:06:11 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,20 +18,16 @@ void *ft_memcpy(void *dst, const void *src, size_t n)
|
|||||||
const char *s;
|
const char *s;
|
||||||
long unsigned int i;
|
long unsigned int i;
|
||||||
|
|
||||||
if (!dst)
|
|
||||||
return (dst);
|
|
||||||
d = dst;
|
|
||||||
if (!src)
|
|
||||||
{
|
|
||||||
*d = '\0';
|
|
||||||
return (dst);
|
|
||||||
}
|
|
||||||
s = src;
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
d = dst;
|
||||||
|
s = src;
|
||||||
|
if (dst != NULL || src != NULL)
|
||||||
|
{
|
||||||
while (n > i)
|
while (n > i)
|
||||||
{
|
{
|
||||||
d[i] = s[i];
|
d[i] = s[i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (dst);
|
return (dst);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_memmove.c |o_o || | */
|
/* ft_memmove.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 08:45:04 by djonker #+# #+# */
|
/* Created: 2020/11/01 08:45:04 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 12:19:05 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ void *ft_memmove(void *dst, const void *src, size_t len)
|
|||||||
const char *s;
|
const char *s;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dst == NULL || src == NULL)
|
if (dst == NULL && src == NULL)
|
||||||
return ((void *)dst);
|
return ((void *)dst);
|
||||||
i = 0;
|
i = 0;
|
||||||
d = dst;
|
d = dst;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_memset.c |o_o || | */
|
/* ft_memset.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 08:42:45 by djonker #+# #+# */
|
/* Created: 2020/11/01 08:42:45 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/28 20:13:47 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -16,8 +16,6 @@ void *ft_memset(void *s, int c, size_t n)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (!s)
|
|
||||||
return (s);
|
|
||||||
p = s;
|
p = s;
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_putendl.c |o_o || | */
|
/* ft_putendl.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/13 04:00:47 by djonker #+# #+# */
|
/* Created: 2020/11/13 04:00:47 by djonker #+# #+# */
|
||||||
/* Updated: 2023/02/23 20:14:17 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:43 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_revstr.c |o_o || | */
|
/* ft_revstr.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2021/01/18 11:54:50 by djonker #+# #+# */
|
/* Created: 2021/01/18 11:54:50 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/05 20:39:52 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:48 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,11 +14,10 @@
|
|||||||
|
|
||||||
char *ft_revstr(char *s)
|
char *ft_revstr(char *s)
|
||||||
{
|
{
|
||||||
char *r;
|
char r[1000];
|
||||||
int is;
|
int is;
|
||||||
int ir;
|
int ir;
|
||||||
|
|
||||||
r = ft_calloc(8 * (ft_strlen(s) + 1), 1);
|
|
||||||
is = ft_strlen(s) - 1;
|
is = ft_strlen(s) - 1;
|
||||||
ir = 0;
|
ir = 0;
|
||||||
while (is >= 0)
|
while (is >= 0)
|
||||||
@ -29,5 +28,5 @@ char *ft_revstr(char *s)
|
|||||||
}
|
}
|
||||||
r[ir] = '\0';
|
r[ir] = '\0';
|
||||||
s = r;
|
s = r;
|
||||||
return (r);
|
return (s);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* .--. _ */
|
/* .--. _ */
|
||||||
/* ft_strchr.c |o_o || | */
|
/* ft_strchr.c :+: :+: :+: */
|
||||||
/* |:_/ || |_ _ ___ __ */
|
/* |:_/ || |_ _ ___ __ */
|
||||||
/* By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / */
|
/* By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / */
|
||||||
/* (| | )|_| |_| |> < */
|
/* (| | )|_| |_| |> < */
|
||||||
/* Created: 2022/11/22 13:34:05 by djonker /'\_ _/`\__|\__,_/_/\_\ */
|
/* Created: 2022/11/22 13:34:05 by djonker /'\_ _/`\__|\__,_/_/\_\ */
|
||||||
/* Updated: 2023/03/01 06:08:13 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:50 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
char *ft_strchr(const char *s, int c)
|
char *ft_strchr(const char *s, int c)
|
||||||
{
|
{
|
||||||
if (!s)
|
|
||||||
return (0);
|
|
||||||
while (*s)
|
while (*s)
|
||||||
{
|
{
|
||||||
if (c == *s)
|
if (c == *s)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_strjoin.c |o_o || | */
|
/* ft_strjoin.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/11 16:17:34 by djonker #+# #+# */
|
/* Created: 2020/11/11 16:17:34 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 13:40:55 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:50 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,10 +18,8 @@ char *ft_strjoin(char const *s1, char const *s2)
|
|||||||
int c2;
|
int c2;
|
||||||
char *r;
|
char *r;
|
||||||
|
|
||||||
c1 = -1;
|
c1 = 0;
|
||||||
c2 = -1;
|
c2 = 0;
|
||||||
if (s1 == NULL && s2 == NULL)
|
|
||||||
return (NULL);
|
|
||||||
if (s1 == NULL)
|
if (s1 == NULL)
|
||||||
return (ft_malstr((char *)s2, '\0'));
|
return (ft_malstr((char *)s2, '\0'));
|
||||||
if (s2 == NULL)
|
if (s2 == NULL)
|
||||||
@ -29,10 +27,16 @@ char *ft_strjoin(char const *s1, char const *s2)
|
|||||||
r = ft_calloc(ft_strlen((char *)s1) + ft_strlen((char *)s2) + 1, 1);
|
r = ft_calloc(ft_strlen((char *)s1) + ft_strlen((char *)s2) + 1, 1);
|
||||||
if (r == NULL)
|
if (r == NULL)
|
||||||
return (r);
|
return (r);
|
||||||
while (++c1 < (int)ft_strlen((char *)s1))
|
while (c1 < (int)ft_strlen((char *)s1))
|
||||||
|
{
|
||||||
r[c1] = s1[c1];
|
r[c1] = s1[c1];
|
||||||
while (++c2 < (int)ft_strlen((char *)s2))
|
c1++;
|
||||||
|
}
|
||||||
|
while (c2 < (int)ft_strlen((char *)s2))
|
||||||
|
{
|
||||||
r[c1 + c2] = s2[c2];
|
r[c1 + c2] = s2[c2];
|
||||||
|
c2++;
|
||||||
|
}
|
||||||
r[c1 + c2] = '\0';
|
r[c1 + c2] = '\0';
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_strlcat.c |o_o || | */
|
/* ft_strlcat.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 09:55:53 by djonker #+# #+# */
|
/* Created: 2020/11/01 09:55:53 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 13:56:46 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:40:51 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -23,8 +23,6 @@ size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
|
|||||||
sl = 0;
|
sl = 0;
|
||||||
if (dstsize == 0)
|
if (dstsize == 0)
|
||||||
return (r);
|
return (r);
|
||||||
if (!src)
|
|
||||||
return (dl);
|
|
||||||
if (dstsize < dl)
|
if (dstsize < dl)
|
||||||
r = r + dstsize;
|
r = r + dstsize;
|
||||||
else
|
else
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_strncmp.c |o_o || | */
|
/* ft_strncmp.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/01 19:09:01 by djonker #+# #+# */
|
/* Created: 2020/11/01 19:09:01 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 14:28:11 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:41:12 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
||||||
{
|
{
|
||||||
if (s1 == NULL && s2 == NULL)
|
|
||||||
return (0);
|
|
||||||
if (s1 == NULL || s2 == NULL)
|
|
||||||
return (1);
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return (0);
|
return (0);
|
||||||
while (n)
|
while (n)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_strnstr.c |o_o || | */
|
/* ft_strnstr.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/11 16:14:33 by djonker #+# #+# */
|
/* Created: 2020/11/11 16:14:33 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 14:31:13 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:41:13 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -17,8 +17,6 @@ char *ft_strnstr(const char *h, const char *n, size_t len)
|
|||||||
long unsigned int ih;
|
long unsigned int ih;
|
||||||
int in;
|
int in;
|
||||||
|
|
||||||
if (h == NULL || n == NULL)
|
|
||||||
return (NULL);
|
|
||||||
ih = 0;
|
ih = 0;
|
||||||
if (!*n)
|
if (!*n)
|
||||||
return ((char *)&h[ih]);
|
return ((char *)&h[ih]);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_strrchr.c |o_o || | */
|
/* ft_strrchr.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2020/11/11 16:14:50 by djonker #+# #+# */
|
/* Created: 2020/11/11 16:14:50 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/03 14:52:43 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:41:13 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -16,13 +16,13 @@ char *ft_strrchr(const char *s, int c)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (!s)
|
p = (char *) 0;
|
||||||
return (NULL);
|
while (1)
|
||||||
p = NULL;
|
|
||||||
while (*s != '\0')
|
|
||||||
{
|
{
|
||||||
if (*s == c)
|
if (*s == c)
|
||||||
p = (char *)s;
|
p = (char *)s;
|
||||||
|
if (*s == 0)
|
||||||
|
break ;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
return (p);
|
return (p);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* :::::::: */
|
||||||
/* ft_strupp.c |o_o || | */
|
/* ft_strupp.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ */
|
||||||
/* By: djonker <marvin@codam.nl> +#+ */
|
/* By: djonker <marvin@codam.nl> +#+ */
|
||||||
/* +#+ */
|
/* +#+ */
|
||||||
/* Created: 2021/01/31 05:49:38 by djonker #+# #+# */
|
/* Created: 2021/01/31 05:49:38 by djonker #+# #+# */
|
||||||
/* Updated: 2023/03/05 20:46:08 by houtworm \___)=(___/ */
|
/* Updated: 2023/02/07 00:41:13 by houtworm ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
char *ft_strupp(char *s)
|
char *ft_strupp(char *s)
|
||||||
{
|
{
|
||||||
char *r;
|
char r[5000];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
r = ft_calloc(8 * (ft_strlen(s) + 1), 1);
|
|
||||||
while (s[i])
|
while (s[i])
|
||||||
{
|
{
|
||||||
r[i] = ft_toupper(s[i]);
|
r[i] = ft_toupper(s[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
free(s);
|
r[i] = '\0';
|
||||||
return (r);
|
s = r;
|
||||||
|
return (s);
|
||||||
}
|
}
|
||||||
|
1132
libft/test.sh
1132
libft/test.sh
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test1.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/27 01:03:32 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[2];
|
|
||||||
char *str[2];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_back(list, element[1]);
|
|
||||||
r = 0;
|
|
||||||
if (strncmp(element[0]->next->content, "Hallo2", 6))
|
|
||||||
r = 1;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test2.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 18:52:35 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[3];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_back(list, element[1]);
|
|
||||||
ft_lstadd_back(list, element[2]);
|
|
||||||
r = 0;
|
|
||||||
if (strncmp(element[0]->next->content, "Hallo2", 6))
|
|
||||||
r = 1;
|
|
||||||
if (strncmp(element[1]->next->content, "Hallo3", 6))
|
|
||||||
r = 1;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test3.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 02:09:08 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[3];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_back(list, element[1]);
|
|
||||||
ft_lstdelone(element[1], &free);
|
|
||||||
ft_lstadd_back(list, element[2]);
|
|
||||||
r = 0;
|
|
||||||
if (strncmp((*list)->next->next->content, "Hallo3", 6))
|
|
||||||
r = 1;
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test4.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 01:11:14 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[2];
|
|
||||||
char *str[2];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = NULL;
|
|
||||||
ft_lstadd_back(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
if (list)
|
|
||||||
r = 1;
|
|
||||||
free (str[0]);
|
|
||||||
free (element[0]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test5.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 19:04:41 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[1];
|
|
||||||
char *str[1];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_back(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
if (element[0]->next)
|
|
||||||
r = 1;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test1.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/27 01:03:39 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[2];
|
|
||||||
char *str[2];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
list = &element[1];
|
|
||||||
ft_lstadd_front(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
if (strncmp(element[0]->next->content, "Hallo2", 6))
|
|
||||||
r = 1;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test2.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 15:48:12 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[3];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
list = &element[2];
|
|
||||||
ft_lstadd_front(list, element[1]);
|
|
||||||
ft_lstadd_front(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
if (strncmp((*list)->next->content, "Hallo2", 6))
|
|
||||||
r = 1;
|
|
||||||
if (strncmp((*list)->next->next->content, "Hallo3", 6))
|
|
||||||
r = 1;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test3.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 18:35:12 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[3];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
list = &element[2];
|
|
||||||
ft_lstadd_front(list, element[1]);
|
|
||||||
list = &element[2];
|
|
||||||
ft_lstadd_front(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
if (strncmp((*list)->next->content, "Hallo2", 6))
|
|
||||||
r = 1;
|
|
||||||
if (strncmp((*list)->next->next->content, "Hallo3", 6))
|
|
||||||
r = 1;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test4.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 18:56:02 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[1];
|
|
||||||
char *str[1];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = NULL;
|
|
||||||
ft_lstadd_front(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
if (list)
|
|
||||||
r = 1;
|
|
||||||
free(str[0]);
|
|
||||||
free(element[0]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test5.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 16:05:17 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[1];
|
|
||||||
char *str[1];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_front(list, NULL);
|
|
||||||
r = 0;
|
|
||||||
if (element[0]->next)
|
|
||||||
r = 1;
|
|
||||||
free(str[0]);
|
|
||||||
free(element[0]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test1.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 02:09:57 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[2];
|
|
||||||
char *str[2];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = &element[0];
|
|
||||||
r = 0;
|
|
||||||
ft_lstclear(list, NULL);
|
|
||||||
if (*list != NULL)
|
|
||||||
r = 1;
|
|
||||||
free(str[0]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test2.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 17:52:32 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[2];
|
|
||||||
char *str[2];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
list = &element[1];
|
|
||||||
ft_lstadd_front(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
ft_lstclear(list, NULL);
|
|
||||||
if (*list != NULL)
|
|
||||||
r = 1;
|
|
||||||
free(str[0]);
|
|
||||||
free(str[1]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test3.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 01:40:00 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[3];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
list = &element[2];
|
|
||||||
ft_lstadd_front(list, element[1]);
|
|
||||||
ft_lstadd_front(list, element[0]);
|
|
||||||
ft_lstdelone(element[1], NULL);
|
|
||||||
r = 0;
|
|
||||||
ft_lstclear(list, NULL);
|
|
||||||
if (*list != NULL)
|
|
||||||
r = 1;
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test1.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/02/27 05:14:21 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[2];
|
|
||||||
char *str[2];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
list = &element[1];
|
|
||||||
ft_lstadd_front(list, element[0]);
|
|
||||||
r = 0;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
if (*list != NULL)
|
|
||||||
r = 1;
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test5.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 01:58:06 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
|
|
||||||
list = NULL;
|
|
||||||
r = 0;
|
|
||||||
ft_lstclear(list, &free);
|
|
||||||
if (list != NULL)
|
|
||||||
r = 1;
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test1.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 02:09:32 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int compare(void *a, void *b)
|
|
||||||
{
|
|
||||||
if (a == NULL && b == NULL)
|
|
||||||
return (1);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[4];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
element[3] = NULL;
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_back(list, element[1]);
|
|
||||||
ft_lstadd_back(list, element[2]);
|
|
||||||
r = 0;
|
|
||||||
ft_lstdelone(element[2], NULL);
|
|
||||||
r = compare(element[2], element[3]);
|
|
||||||
free (str[0]);
|
|
||||||
free (str[1]);
|
|
||||||
free (str[2]);
|
|
||||||
free (element[0]);
|
|
||||||
free (element[1]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test2.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 00:07:41 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int compare(void *a, void *b)
|
|
||||||
{
|
|
||||||
if (a == NULL && b == NULL)
|
|
||||||
return (1);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[4];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
element[3] = NULL;
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_back(list, element[1]);
|
|
||||||
ft_lstadd_back(list, element[2]);
|
|
||||||
r = 0;
|
|
||||||
ft_lstdelone(element[0], NULL);
|
|
||||||
r = compare(element[0], element[3]);
|
|
||||||
free (str[0]);
|
|
||||||
free (str[1]);
|
|
||||||
free (str[2]);
|
|
||||||
free (element[1]);
|
|
||||||
free (element[2]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test3.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 00:10:48 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int compare(void *a, void *b)
|
|
||||||
{
|
|
||||||
if (a == NULL && b == NULL)
|
|
||||||
return (1);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[4];
|
|
||||||
char *str[3];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
str[1] = strdup("Hallo2");
|
|
||||||
str[2] = strdup("Hallo3");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
element[1] = ft_lstnew(str[1]);
|
|
||||||
element[2] = ft_lstnew(str[2]);
|
|
||||||
element[3] = NULL;
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstadd_back(list, element[1]);
|
|
||||||
ft_lstadd_back(list, element[2]);
|
|
||||||
r = 0;
|
|
||||||
r = compare(element[1], element[3]);
|
|
||||||
ft_lstdelone((*list)->next, NULL);
|
|
||||||
free (str[0]);
|
|
||||||
free (str[1]);
|
|
||||||
free (str[2]);
|
|
||||||
free (element[0]);
|
|
||||||
free (element[2]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test4.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 19:40:55 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[1];
|
|
||||||
char *str[1];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = &element[0];
|
|
||||||
r = 0;
|
|
||||||
ft_lstdelone(element[0], NULL);
|
|
||||||
free(str[0]);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test5.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/03 19:39:44 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[1];
|
|
||||||
char *str[1];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = &element[0];
|
|
||||||
r = 0;
|
|
||||||
ft_lstdelone(element[0], &free);
|
|
||||||
return (r);
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* :::::::: */
|
|
||||||
/* test1.c |o_o || | */
|
|
||||||
/* +:+ */
|
|
||||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
|
||||||
/* +#+ */
|
|
||||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
|
||||||
/* Updated: 2023/03/04 17:52:52 by houtworm \___)=(___/ */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../../tmp/libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
void func(void *content)
|
|
||||||
{
|
|
||||||
memset(content, 'a', 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
t_list **list;
|
|
||||||
t_list *element[1];
|
|
||||||
char *str[1];
|
|
||||||
|
|
||||||
str[0] = strdup("Hallo1");
|
|
||||||
element[0] = ft_lstnew(str[0]);
|
|
||||||
list = &element[0];
|
|
||||||
ft_lstiter(*list, &func);
|
|
||||||
r = 0;
|
|
||||||
if (strncmp(str[0], "aaalo1", 6))
|
|
||||||
r = 1;
|
|
||||||
free(str[0]);
|
|
||||||
free(*list);
|
|
||||||
return (r);
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user