Showing preview only (318K chars total). Download the full file or copy to clipboard to get everything.
Repository: ChuOkupai/piscine42
Branch: main
Commit: cc5e12c07768
Files: 250
Total size: 266.3 KB
Directory structure:
gitextract_uqh3g1tv/
├── .gitignore
├── README.md
├── bsq/
│ ├── Makefile
│ ├── auteur
│ ├── gen.pl
│ ├── includes/
│ │ └── ft.h
│ └── srcs/
│ ├── ft_file_load.c
│ ├── ft_find_biggest_square.c
│ ├── ft_is_valid.c
│ └── main.c
├── c00/
│ ├── ex00/
│ │ └── ft_putchar.c
│ ├── ex01/
│ │ └── ft_print_alphabet.c
│ ├── ex02/
│ │ └── ft_print_reverse_alphabet.c
│ ├── ex03/
│ │ └── ft_print_numbers.c
│ ├── ex04/
│ │ └── ft_is_negative.c
│ ├── ex05/
│ │ └── ft_print_comb.c
│ ├── ex06/
│ │ └── ft_print_comb2.c
│ ├── ex07/
│ │ └── ft_putnbr.c
│ └── ex08/
│ └── ft_print_combn.c
├── c01/
│ ├── ex00/
│ │ └── ft_ft.c
│ ├── ex01/
│ │ └── ft_ultimate_ft.c
│ ├── ex02/
│ │ └── ft_swap.c
│ ├── ex03/
│ │ └── ft_div_mod.c
│ ├── ex04/
│ │ └── ft_ultimate_div_mod.c
│ ├── ex05/
│ │ └── ft_putstr.c
│ ├── ex06/
│ │ └── ft_strlen.c
│ ├── ex07/
│ │ └── ft_rev_int_tab.c
│ └── ex08/
│ └── ft_sort_int_tab.c
├── c02/
│ ├── ex00/
│ │ └── ft_strcpy.c
│ ├── ex01/
│ │ └── ft_strncpy.c
│ ├── ex02/
│ │ └── ft_str_is_alpha.c
│ ├── ex03/
│ │ └── ft_str_is_numeric.c
│ ├── ex04/
│ │ └── ft_str_is_lowercase.c
│ ├── ex05/
│ │ └── ft_str_is_uppercase.c
│ ├── ex06/
│ │ └── ft_str_is_printable.c
│ ├── ex07/
│ │ └── ft_strupcase.c
│ ├── ex08/
│ │ └── ft_strlowcase.c
│ ├── ex09/
│ │ └── ft_strcapitalize.c
│ ├── ex10/
│ │ └── ft_strlcpy.c
│ ├── ex11/
│ │ └── ft_putstr_non_printable.c
│ └── ex12/
│ └── ft_print_memory.c
├── c03/
│ ├── ex00/
│ │ └── ft_strcmp.c
│ ├── ex01/
│ │ └── ft_strncmp.c
│ ├── ex02/
│ │ └── ft_strcat.c
│ ├── ex03/
│ │ └── ft_strncat.c
│ ├── ex04/
│ │ └── ft_strstr.c
│ └── ex05/
│ └── ft_strlcat.c
├── c04/
│ ├── ex00/
│ │ └── ft_strlen.c
│ ├── ex01/
│ │ └── ft_putstr.c
│ ├── ex02/
│ │ └── ft_putnbr.c
│ ├── ex03/
│ │ └── ft_atoi.c
│ ├── ex04/
│ │ └── ft_putnbr_base.c
│ └── ex05/
│ └── ft_atoi_base.c
├── c05/
│ ├── ex00/
│ │ └── ft_iterative_factorial.c
│ ├── ex01/
│ │ └── ft_recursive_factorial.c
│ ├── ex02/
│ │ └── ft_iterative_power.c
│ ├── ex03/
│ │ └── ft_recursive_power.c
│ ├── ex04/
│ │ └── ft_fibonacci.c
│ ├── ex05/
│ │ └── ft_sqrt.c
│ ├── ex06/
│ │ └── ft_is_prime.c
│ ├── ex07/
│ │ └── ft_find_next_prime.c
│ └── ex08/
│ └── ft_ten_queens_puzzle.c
├── c06/
│ ├── ex00/
│ │ └── ft_print_program_name.c
│ ├── ex01/
│ │ └── ft_print_params.c
│ ├── ex02/
│ │ └── ft_rev_params.c
│ └── ex03/
│ └── ft_sort_params.c
├── c07/
│ ├── ex00/
│ │ └── ft_strdup.c
│ ├── ex01/
│ │ └── ft_range.c
│ ├── ex02/
│ │ └── ft_ultimate_range.c
│ ├── ex03/
│ │ └── ft_strjoin.c
│ ├── ex04/
│ │ ├── ft_convert_base.c
│ │ └── ft_convert_base2.c
│ └── ex05/
│ └── ft_split.c
├── c08/
│ ├── ex00/
│ │ └── ft.h
│ ├── ex01/
│ │ └── ft_boolean.h
│ ├── ex02/
│ │ └── ft_abs.h
│ ├── ex03/
│ │ └── ft_point.h
│ ├── ex04/
│ │ └── ft_strs_to_tab.c
│ └── ex05/
│ └── ft_show_tab.c
├── c09/
│ ├── ex00/
│ │ ├── ft_putchar.c
│ │ ├── ft_putstr.c
│ │ ├── ft_strcmp.c
│ │ ├── ft_strlen.c
│ │ ├── ft_swap.c
│ │ └── libft_creator.sh
│ ├── ex01/
│ │ └── Makefile
│ └── ex02/
│ └── ft_split.c
├── c10/
│ ├── ex00/
│ │ ├── Makefile
│ │ ├── ft.h
│ │ ├── ft_display_file.c
│ │ ├── ft_putstr_fd.c
│ │ ├── ft_strlen.c
│ │ └── main.c
│ ├── ex01/
│ │ ├── Makefile
│ │ ├── ft.h
│ │ ├── ft_display_file.c
│ │ ├── ft_putchar_fd.c
│ │ ├── ft_puterr.c
│ │ ├── ft_putstr_fd.c
│ │ ├── ft_strcmp.c
│ │ ├── ft_strlen.c
│ │ └── main.c
│ └── ex02/
│ ├── Makefile
│ ├── ft.h
│ ├── ft_atoi.c
│ ├── ft_putchar_fd.c
│ ├── ft_puterr.c
│ ├── ft_putstr_fd.c
│ ├── ft_strcmp.c
│ ├── ft_strlen.c
│ ├── ft_strncpy.c
│ ├── ft_tail.c
│ └── main.c
├── c11/
│ ├── ex00/
│ │ └── ft_foreach.c
│ ├── ex01/
│ │ └── ft_map.c
│ ├── ex02/
│ │ └── ft_any.c
│ ├── ex03/
│ │ └── ft_count_if.c
│ ├── ex04/
│ │ └── ft_is_sort.c
│ ├── ex05/
│ │ ├── Makefile
│ │ ├── ft.h
│ │ ├── ft_atoi.c
│ │ ├── ft_op.c
│ │ ├── ft_putchar.c
│ │ ├── ft_putnbr.c
│ │ ├── ft_putstr.c
│ │ ├── ft_strlen.c
│ │ └── main.c
│ ├── ex06/
│ │ └── ft_sort_string_tab.c
│ └── ex07/
│ └── ft_advanced_sort_string_tab.c
├── c12/
│ ├── Makefile
│ ├── ex00/
│ │ ├── ft_create_elem.c
│ │ └── ft_list.h
│ ├── ex01/
│ │ ├── ft_list.h
│ │ └── ft_list_push_front.c
│ ├── ex02/
│ │ ├── ft_list.h
│ │ └── ft_list_size.c
│ ├── ex03/
│ │ ├── ft_list.h
│ │ └── ft_list_last.c
│ ├── ex04/
│ │ ├── ft_list.h
│ │ └── ft_list_push_back.c
│ ├── ex05/
│ │ ├── ft_list.h
│ │ └── ft_list_push_strs.c
│ ├── ex06/
│ │ ├── ft_list.h
│ │ └── ft_list_clear.c
│ ├── ex07/
│ │ ├── ft_list.h
│ │ └── ft_list_at.c
│ ├── ex08/
│ │ └── ft_list_reverse.c
│ ├── ex09/
│ │ ├── ft_list.h
│ │ └── ft_list_foreach.c
│ ├── ex10/
│ │ ├── ft_list.h
│ │ └── ft_list_foreach_if.c
│ ├── ex11/
│ │ ├── ft_list.h
│ │ └── ft_list_find.c
│ ├── ex12/
│ │ ├── ft_list.h
│ │ └── ft_list_remove_if.c
│ ├── ex13/
│ │ ├── ft_list.h
│ │ └── ft_list_merge.c
│ ├── ex14/
│ │ ├── ft_list.h
│ │ └── ft_list_sort.c
│ ├── ex15/
│ │ ├── ft_list.h
│ │ └── ft_list_reverse_fun.c
│ ├── ex16/
│ │ ├── ft_list.h
│ │ └── ft_sorted_list_insert.c
│ ├── ex17/
│ │ ├── ft_list.h
│ │ └── ft_sorted_list_merge.c
│ ├── ft_list.h
│ └── main.c
├── c13/
│ ├── Makefile
│ ├── ex00/
│ │ ├── btree_create_node.c
│ │ └── ft_btree.h
│ ├── ex01/
│ │ ├── btree_apply_prefix.c
│ │ └── ft_btree.h
│ ├── ex02/
│ │ ├── btree_apply_infix.c
│ │ └── ft_btree.h
│ ├── ex03/
│ │ ├── btree_apply_suffix.c
│ │ └── ft_btree.h
│ ├── ex04/
│ │ ├── btree_insert_data.c
│ │ └── ft_btree.h
│ ├── ex05/
│ │ ├── btree_search_item.c
│ │ └── ft_btree.h
│ ├── ex06/
│ │ ├── btree_level_count.c
│ │ └── ft_btree.h
│ ├── ex07/
│ │ ├── btree_apply_by_level.c
│ │ └── ft_btree.h
│ ├── ft_btree.h
│ └── main.c
├── other/
│ ├── binary.c
│ ├── mkdirs.sh
│ └── sorting.c
├── rush00/
│ └── ex00/
│ ├── ft_putchar.c
│ ├── main.c
│ ├── rush00.c
│ ├── rush01.c
│ ├── rush02.c
│ ├── rush03.c
│ └── rush04.c
├── rush01/
│ └── ex00/
│ ├── ft_backtrack.c
│ ├── ft_check.c
│ ├── ft_destroy_tab.c
│ ├── ft_get_size.c
│ ├── ft_init_tab.c
│ ├── ft_print_tab.c
│ ├── ft_putchar.c
│ ├── ft_putstr.c
│ ├── ft_rush.h
│ └── main.c
├── rush02/
│ └── ex00/
│ ├── Makefile
│ ├── includes/
│ │ ├── ft.h
│ │ ├── ft_dict.h
│ │ └── ft_list.h
│ ├── numbers.dict
│ ├── srcs/
│ │ ├── ft/
│ │ │ ├── ft_atol.c
│ │ │ ├── ft_check_args.c
│ │ │ ├── ft_file_load.c
│ │ │ ├── ft_is_valid.c
│ │ │ ├── ft_isdigit.c
│ │ │ ├── ft_isprint.c
│ │ │ ├── ft_isspace.c
│ │ │ ├── ft_putchar.c
│ │ │ ├── ft_putstr.c
│ │ │ ├── ft_strlen.c
│ │ │ └── ft_strncpy.c
│ │ ├── ft_dict/
│ │ │ ├── ft_dict_clear.c
│ │ │ ├── ft_dict_cmp.c
│ │ │ ├── ft_dict_create.c
│ │ │ ├── ft_dict_create_elem.c
│ │ │ ├── ft_dict_in.c
│ │ │ └── ft_print.c
│ │ ├── ft_list/
│ │ │ ├── ft_create_elem.c
│ │ │ ├── ft_list_clear.c
│ │ │ ├── ft_list_find.c
│ │ │ └── ft_sorted_list_insert.c
│ │ └── main.c
│ └── test.sh
├── shell00/
│ ├── ex00/
│ │ └── z
│ ├── ex03/
│ │ └── klist.txt
│ ├── ex04/
│ │ └── midLS
│ ├── ex05/
│ │ └── git_commit.sh
│ ├── ex06/
│ │ └── git_ignore.sh
│ ├── ex07/
│ │ └── b
│ ├── ex08/
│ │ └── clean
│ └── ex09/
│ └── ft_magic
└── shell01/
├── ex01/
│ └── print_groups.sh
├── ex02/
│ └── find_sh.sh
├── ex03/
│ └── count_files.sh
├── ex04/
│ └── MAC.sh
├── ex05/
│ └── "\?$*'MaRViN'*$?\"
├── ex06/
│ └── skip.sh
├── ex07/
│ └── r_dwssap.sh
└── ex08/
└── add_chelou.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
================================================
FILE: README.md
================================================
# Piscine 42 - Juillet 2019
Toutes les journées sont terminées, il manque un exercice sur le jour 10 de C
Le rush02 est broken, RIP :skull:
Certaines fonctions ne sont pas optimisées, notamment ft_strstr, mais elles fonctionnent :man_shrugging:
Check [vimcake](https://github.com/ChuOkupai/vimcake) pour une config vim simple et efficace pour débuter !
Ce code n'est pas sous licence, le copier n'est cependant pas le meilleur moyen de progresser, à bon entendeur.

================================================
FILE: bsq/Makefile
================================================
SRCS = ft_find_biggest_square.c \
ft_is_valid.c \
ft_file_load.c \
main.c
OBJS = $(addprefix srcs/, ${SRCS:.c=.o})
SRC_HEADERS = ft.h
HEADERS := $(addprefix includes/, ${SRC_HEADERS})
NAME = bsq
CFLAGS = -Wall -Wextra -Werror -Ofast
all: ${NAME}
${NAME}: ${OBJS} ${HEADERS}
gcc ${CFLAGS} ${OBJS} -o $@
.c.o: ${HEADERS}
gcc ${CFLAGS} -I./includes -c $< -o ${<:.c=.o}
clean:
rm -f ${OBJS}
fclean: clean
rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re
================================================
FILE: bsq/auteur
================================================
asoursou:gdinet
================================================
FILE: bsq/gen.pl
================================================
#!/usr/bin/perl
use warnings;
use strict;
die "program x y density" unless (scalar(@ARGV) == 3);
my ($x, $y, $density) = @ARGV;print "$y.ox\n";
for (my $i = 0; $i < $y; $i++)
{
for (my $j = 0; $j < $x; $j++)
{
if (int(rand($y) * 2) < $density)
{
print "o";
}
else
{
print ".";
}
}
print "\n";
}
================================================
FILE: bsq/includes/ft.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/23 04:52:47 by asoursou #+# #+# */
/* Updated: 2019/07/24 21:03:04 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_H
# define FT_H
# define MAX_LINES 12000
# define BUFFER_SIZE 5800000
# define MIN(A, B) ((A < B) ? A : B)
typedef struct s_point
{
int x;
int y;
} t_point;
typedef struct s_map
{
char *content;
char *matrix;
char empty;
char full;
char obstacle;
t_point size;
} t_map;
typedef struct s_square
{
t_point coords;
int size;
} t_square;
char *ft_file_load(char *path);
int ft_is_valid(t_map *m);
void ft_find_biggest_square(t_map *m, t_square *s);
#endif
================================================
FILE: bsq/srcs/ft_file_load.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_file_load.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gdinet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/23 09:14:34 by gdinet #+# #+# */
/* Updated: 2019/07/24 17:26:28 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include "ft.h"
char *ft_bufcpy(char *dest, char *src, int n)
{
char *d;
d = dest;
while (n--)
*d++ = *src++;
return (dest);
}
char *ft_file_read(int fd)
{
char buf[BUFFER_SIZE];
char *content;
char *tmp;
int len;
int size;
if (!(content = malloc(sizeof(char))))
return (NULL);
*content = '\0';
size = 0;
while ((len = read(fd, buf, BUFFER_SIZE)) > 0)
{
if (!(tmp = malloc((size + len + 1) * sizeof(char))))
break ;
tmp = ft_bufcpy(tmp, content, size);
free(content);
ft_bufcpy(tmp + size, buf, len);
content = tmp;
size += len;
content[size] = '\0';
}
if (len)
free(content);
return ((len) ? NULL : content);
}
char *ft_file_load(char *path)
{
char *content;
int fd;
fd = (path) ? open(path, O_RDONLY) : STDIN_FILENO;
if (fd < 0)
return (NULL);
content = ft_file_read(fd);
if (fd != STDIN_FILENO)
close(fd);
return (content);
}
================================================
FILE: bsq/srcs/ft_find_biggest_square.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_find_biggest_square.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/23 09:30:32 by asoursou #+# #+# */
/* Updated: 2019/07/24 21:00:55 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft.h"
void ft_compute(t_map *m, t_square *s, int *t, t_point p)
{
int tmp;
int u;
u = 0;
p.y = 0;
while (++p.y <= m->size.y)
{
p.x = 0;
while (++p.x <= m->size.x)
{
tmp = t[p.x];
if (m->matrix[p.x - 1 + (p.y - 1) * (1 + m->size.x)] == m->empty)
{
t[p.x] = MIN(MIN(u, t[p.x - 1]), t[p.x]) + 1;
if (s->size < t[p.x])
{
s->coords = p;
s->size = t[p.x];
}
}
else
t[p.x] = 0;
u = tmp;
}
}
}
void ft_find_biggest_square(t_map *m, t_square *s)
{
t_point p;
int tab[m->size.x + 1];
s->size = 0;
p.x = 0;
while (p.x <= m->size.x)
tab[p.x++] = 0;
ft_compute(m, s, tab, p);
p.y = s->coords.y;
s->coords.y -= s->size;
s->coords.x -= s->size;
while (p.y > s->coords.y)
{
p.y--;
p.x = s->coords.x + s->size;
while (p.x > s->coords.x)
{
p.x--;
m->matrix[p.x + p.y * (1 + m->size.x)] = m->full;
}
}
}
================================================
FILE: bsq/srcs/ft_is_valid.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_valid.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/24 09:25:05 by asoursou #+# #+# */
/* Updated: 2019/07/24 18:20:54 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <limits.h>
#include "ft.h"
int ft_atoui(char *str, int *length)
{
long res;
int i;
res = 0;
*length = 0;
while (str[*length] >= '0' && str[*length] <= '9')
(*length)++;
i = 0;
while (str[*length + i] && str[*length + i] != '\n')
i++;
if (i > 3)
return (0);
*length -= 3 - i;
i = 0;
while (i < *length)
{
res = res * 10 + str[i++] - '0';
if (res > INT_MAX)
{
res = 0;
break ;
}
}
return ((res > 16000) ? 0 : res);
}
int ft_check_line(t_map *m)
{
char *s;
t_point p;
s = m->matrix;
p.x = -1;
while (s[++p.x] != '\n')
if (!s[p.x] || s[p.x] == m->full
|| (s[p.x] != m->empty && s[p.x] != m->obstacle))
return (0);
m->size.x = p.x;
p.y = 1;
while (m->size.x == p.x++ && *(s += p.x))
{
p.x = -1;
while (s[++p.x] != '\n')
if (!s[p.x] || s[p.x] == m->full || (s[p.x] != m->empty
&& s[p.x] != m->obstacle))
return (0);
p.y++;
}
return (p.y == m->size.y);
}
int ft_is_valid(t_map *m)
{
int i;
if ((m->size.y = ft_atoui(m->content, &i)) <= 0)
return (0);
if (m->content[i] != '\0' && m->content[i] != '\n')
m->empty = m->content[i++];
else
return (0);
if (m->content[i] != '\0' && m->content[i] != '\n')
m->obstacle = m->content[i++];
else
return (0);
if (m->content[i] != '\0' && m->content[i] != '\n')
m->full = m->content[i++];
else
return (0);
if (m->content[i] != '\n' || m->empty == m->full || m->empty == m->obstacle
|| m->full == m->obstacle)
return (0);
m->matrix = m->content + i + 1;
return (ft_check_line(m));
}
================================================
FILE: bsq/srcs/main.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:32:28 by asoursou #+# #+# */
/* Updated: 2019/07/24 18:15:04 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include <unistd.h>
#include "ft.h"
static void ft_bsq(char *path)
{
t_map map;
t_square square;
int y;
if (!(map.content = ft_file_load(path))
|| !ft_is_valid(&map))
write(STDERR_FILENO, "map error\n", 10);
else
{
ft_find_biggest_square(&map, &square);
map.size.x++;
y = 0;
while (y < map.size.y)
write(STDOUT_FILENO, map.matrix + map.size.x * y++, map.size.x);
}
free(map.content);
}
int main(int argc, char **argv)
{
char c;
int i;
if (argc < 2)
{
ft_bsq(NULL);
return (0);
}
c = '\n';
i = 0;
while (++i < argc)
{
if (i > 1)
write(STDOUT_FILENO, &c, 1);
ft_bsq(argv[i]);
}
return (0);
}
================================================
FILE: c00/ex00/ft_putchar.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:19:29 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:28:36 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
================================================
FILE: c00/ex01/ft_print_alphabet.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:26:51 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:30:59 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void)
{
write(1, "abcdefghijklmnopqrstuvwxyz", 26);
}
================================================
FILE: c00/ex02/ft_print_reverse_alphabet.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:45:28 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:30:59 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_reverse_alphabet(void)
{
write(1, "zyxwvutsrqponmlkjihgfedcba", 26);
}
================================================
FILE: c00/ex03/ft_print_numbers.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:44:10 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:32:39 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_numbers(void)
{
write(1, "0123456789", 10);
}
================================================
FILE: c00/ex04/ft_is_negative.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_negative.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:47:18 by asoursou #+# #+# */
/* Updated: 2019/07/02 21:52:13 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_is_negative(int n)
{
ft_putchar((n < 0) ? 'N' : 'P');
}
================================================
FILE: c00/ex05/ft_print_comb.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:56:52 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:36:25 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_comb(void)
{
char t[5];
*t = '0';
t[1] = '1';
t[2] = '2';
t[3] = ',';
t[4] = ' ';
while (*t < '8')
{
write(1, t, (*t != '7') ? 5 : 3);
if (++t[2] > '9')
{
if (++t[1] > '8')
t[1] = ++(*t) + 1;
t[2] = t[1] + 1;
}
}
}
================================================
FILE: c00/ex06/ft_print_comb2.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/02 12:29:57 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:43:21 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_print_comb2(void)
{
char a;
char b;
a = 0;
b = 1;
while (a < 99)
{
ft_putchar(a / 10 + '0');
ft_putchar(a % 10 + '0');
ft_putchar(' ');
ft_putchar(b / 10 + '0');
ft_putchar(b % 10 + '0');
if (a < 98)
write(1, ", ", 2);
if (++b > 99)
b = ++a + 1;
}
}
================================================
FILE: c00/ex07/ft_putnbr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/02 13:02:20 by asoursou #+# #+# */
/* Updated: 2019/07/02 16:38:06 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putnbr(int nb)
{
unsigned int n;
if (nb < 0)
{
ft_putchar('-');
n = -nb;
}
else
n = nb;
if (n > 9)
{
ft_putnbr(n / 10);
n %= 10;
}
ft_putchar(n + '0');
}
================================================
FILE: c00/ex08/ft_print_combn.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_combn.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/02 17:39:52 by asoursou #+# #+# */
/* Updated: 2019/07/02 21:49:26 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_combn(int n)
{
char t[11];
int i;
if (n < 1 || n > 9)
return ;
*t = '0';
i = 0;
while (++i < n)
t[i] = t[i - 1] + 1;
t[n] = ',';
t[n + 1] = ' ';
while (*t <= 58 - n)
{
write(1, t, n + ((*t != 58 - n) ? 2 : 0));
i = n;
while (i--)
if (++t[i] <= 58 - n + i)
break ;
while (++i > 0 && i < n)
t[i] = t[i - 1] + 1;
}
}
================================================
FILE: c01/ex00/ft_ft.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ft.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 02:49:17 by asoursou #+# #+# */
/* Updated: 2019/07/03 02:50:02 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ft(int *nbr)
{
*nbr = 42;
}
================================================
FILE: c01/ex01/ft_ultimate_ft.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_ft.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 02:50:59 by asoursou #+# #+# */
/* Updated: 2019/07/03 02:52:17 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ultimate_ft(int *********nbr)
{
*********nbr = 42;
}
================================================
FILE: c01/ex02/ft_swap.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 02:53:08 by asoursou #+# #+# */
/* Updated: 2019/07/03 02:54:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int c;
c = *a;
*a = *b;
*b = c;
}
================================================
FILE: c01/ex03/ft_div_mod.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_div_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 02:54:28 by asoursou #+# #+# */
/* Updated: 2019/07/03 02:56:30 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_div_mod(int a, int b, int *div, int *mod)
{
*div = a / b;
*mod = a % b;
}
================================================
FILE: c01/ex04/ft_ultimate_div_mod.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_div_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 02:57:55 by asoursou #+# #+# */
/* Updated: 2019/07/03 15:19:00 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ultimate_div_mod(int *a, int *b)
{
int c;
c = *a;
*a /= *b;
*b = c % *b;
}
================================================
FILE: c01/ex05/ft_putstr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:00:11 by asoursou #+# #+# */
/* Updated: 2019/07/03 03:10:15 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
void ft_putstr(char *str)
{
write(1, str, ft_strlen(str));
}
================================================
FILE: c01/ex06/ft_strlen.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:11:19 by asoursou #+# #+# */
/* Updated: 2019/07/03 15:18:43 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
================================================
FILE: c01/ex07/ft_rev_int_tab.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:13:10 by asoursou #+# #+# */
/* Updated: 2019/07/03 03:26:16 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int c;
c = *a;
*a = *b;
*b = c;
}
void ft_rev_int_tab(int *tab, int size)
{
int left;
if (size < 2)
return ;
left = 0;
while (left < --size)
ft_swap(&tab[left++], &tab[size]);
}
================================================
FILE: c01/ex08/ft_sort_int_tab.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:27:57 by asoursou #+# #+# */
/* Updated: 2019/07/03 04:33:21 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int c;
c = *a;
*a = *b;
*b = c;
}
void ft_sort_int_tab(int *tab, int size)
{
int pivot;
int i;
int j;
if (size < 2)
return ;
pivot = tab[--size];
i = 0;
j = -1;
while (++j < size)
if (tab[j] < pivot)
ft_swap(&tab[i++], &tab[j]);
if (tab[i] > tab[size])
ft_swap(&tab[i], &tab[size]);
ft_sort_int_tab(tab, i);
ft_sort_int_tab(tab + i + 1, size - i);
}
================================================
FILE: c02/ex00/ft_strcpy.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 04:58:09 by asoursou #+# #+# */
/* Updated: 2019/07/03 05:01:42 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
int i;
i = -1;
while (src[++i])
dest[i] = src[i];
dest[i] = '\0';
return (dest);
}
================================================
FILE: c02/ex01/ft_strncpy.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 22:19:44 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:19:46 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = -1;
while (++i < n && src[i])
dest[i] = src[i];
while (i < n)
dest[i++] = '\0';
return (dest);
}
================================================
FILE: c02/ex02/ft_str_is_alpha.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 13:56:21 by asoursou #+# #+# */
/* Updated: 2019/07/03 16:28:24 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
while (*str)
{
if (!((*str >= 'A' && *str <= 'Z') || (*str >= 'a' && *str <= 'z')))
return (0);
str++;
}
return (1);
}
================================================
FILE: c02/ex03/ft_str_is_numeric.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 16:26:20 by asoursou #+# #+# */
/* Updated: 2019/07/03 17:44:41 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
while (*str)
{
if (*str < '0' || *str > '9')
return (0);
str++;
}
return (1);
}
================================================
FILE: c02/ex04/ft_str_is_lowercase.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 16:27:44 by asoursou #+# #+# */
/* Updated: 2019/07/03 19:48:48 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
while (*str)
{
if (*str < 'a' || *str > 'z')
return (0);
str++;
}
return (1);
}
================================================
FILE: c02/ex05/ft_str_is_uppercase.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 17:48:28 by asoursou #+# #+# */
/* Updated: 2019/07/03 19:35:10 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
while (*str)
{
if (*str < 'A' || *str > 'Z')
return (0);
str++;
}
return (1);
}
================================================
FILE: c02/ex06/ft_str_is_printable.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 18:31:22 by asoursou #+# #+# */
/* Updated: 2019/07/03 18:42:20 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
while (*str)
{
if (*str < ' ' || *str == 127)
return (0);
str++;
}
return (1);
}
================================================
FILE: c02/ex07/ft_strupcase.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 18:58:53 by asoursou #+# #+# */
/* Updated: 2019/07/03 19:39:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
char *s;
s = str;
while (*s)
{
if (*s >= 'a' && *s <= 'z')
*s -= 32;
s++;
}
return (str);
}
================================================
FILE: c02/ex08/ft_strlowcase.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 19:39:28 by asoursou #+# #+# */
/* Updated: 2019/07/03 19:42:10 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
char *s;
s = str;
while (*s)
{
if (*s >= 'A' && *s <= 'Z')
*s += 32;
s++;
}
return (str);
}
================================================
FILE: c02/ex09/ft_strcapitalize.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 19:42:24 by asoursou #+# #+# */
/* Updated: 2019/07/05 04:12:21 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_isdigit(char c)
{
return (c >= '0' && c <= '9');
}
int ft_islower(char c)
{
return (c >= 'a' && c <= 'z');
}
int ft_isupper(char c)
{
return (c >= 'A' && c <= 'Z');
}
char *ft_strcapitalize(char *str)
{
char *s;
s = str;
while (*s)
{
if (ft_isdigit(*s) || ft_islower(*s) || ft_isupper(*s))
{
if (ft_isdigit(*s))
while (ft_isdigit(s[1]))
s++;
else if (ft_islower(*s))
*s -= 32;
while (ft_islower(*(++s)) || ft_isupper(*s))
if (ft_isupper(*s))
*s += 32;
}
else
s++;
}
return (str);
}
================================================
FILE: c02/ex10/ft_strlcpy.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 21:11:14 by asoursou #+# #+# */
/* Updated: 2019/07/05 07:02:17 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
{
unsigned int i;
unsigned int j;
i = ft_strlen(src);
if (i + 1 < size)
{
j = -1;
while (++j < i + 1)
dest[j] = src[j];
}
else if (size)
{
j = -1;
while (++j < size - 1)
dest[j] = src[j];
dest[j] = '\0';
}
return (i);
}
================================================
FILE: c02/ex11/ft_putstr_non_printable.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_non_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 22:18:10 by asoursou #+# #+# */
/* Updated: 2019/07/05 15:05:11 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_puthex(unsigned char c)
{
char *base;
base = "0123456789abcdef";
ft_putchar(base[c / 16]);
ft_putchar(base[c % 16]);
}
void ft_putstr_non_printable(char *str)
{
while (*str)
{
if (*str < ' ' || *str == 127)
{
ft_putchar('\\');
ft_puthex(*str);
}
else
ft_putchar(*str);
str++;
}
}
================================================
FILE: c02/ex12/ft_print_memory.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_memory.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 23:22:04 by asoursou #+# #+# */
/* Updated: 2019/07/05 16:39:37 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_puthex(unsigned char c)
{
char *base;
base = "0123456789abcdef";
ft_putchar(base[c / 16]);
ft_putchar(base[c % 16]);
}
void ft_print_data(char *s, unsigned int size)
{
unsigned int i;
i = -1;
while (++i < size)
{
if (!(i % 2))
ft_putchar(' ');
ft_puthex(s[i]);
}
while (i < 16)
write(1, " ", (i++ % 2) ? 2 : 3);
ft_putchar(' ');
i = -1;
while (++i < size)
ft_putchar((s[i] < ' ' || s[i] == 127) ? '.' : s[i]);
}
void *ft_print_memory(void *addr, unsigned int size)
{
unsigned int i;
int j;
i = 0;
while (i < size)
{
ft_putchar('0');
j = 56;
while ((j -= 8) >= 0)
ft_puthex((unsigned long int)(addr + i) >> j & 0xff);
ft_putchar(':');
ft_print_data(addr + i, (size - i < 16) ? size - i : 16);
ft_putchar('\n');
i += 16;
}
return (addr);
}
================================================
FILE: c03/ex00/ft_strcmp.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 01:25:21 by asoursou #+# #+# */
/* Updated: 2019/07/04 01:37:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s1 == *s2)
{
s1++;
s2++;
}
return (*s1 - *s2);
}
================================================
FILE: c03/ex01/ft_strncmp.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 01:48:20 by asoursou #+# #+# */
/* Updated: 2019/07/04 01:48:22 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strncmp(char *s1, char *s2, unsigned int n)
{
while (n && *s1 && *s1 == *s2)
{
s1++;
s2++;
n--;
}
return ((n) ? *s1 - *s2 : 0);
}
================================================
FILE: c03/ex02/ft_strcat.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 01:48:44 by asoursou #+# #+# */
/* Updated: 2019/07/04 01:55:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcat(char *dest, char *src)
{
char *d;
d = dest;
while (*d)
d++;
while (*src)
*d++ = *src++;
*d = '\0';
return (dest);
}
================================================
FILE: c03/ex03/ft_strncat.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 18:34:45 by asoursou #+# #+# */
/* Updated: 2019/07/04 18:45:10 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncat(char *dest, char *src, unsigned int nb)
{
char *d;
d = dest;
while (*d)
d++;
while (nb-- && *src)
*d++ = *src++;
*d = '\0';
return (dest);
}
================================================
FILE: c03/ex04/ft_strstr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 18:45:38 by asoursou #+# #+# */
/* Updated: 2019/07/05 06:32:38 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strstr(char *str, char *to_find)
{
int i;
if (!*to_find)
return (str);
while (*str)
{
if (*str == *to_find)
{
i = 1;
while (to_find[i] && str[i] == to_find[i])
i++;
if (!to_find[i])
return (str);
}
str++;
}
return (0);
}
================================================
FILE: c03/ex05/ft_strlcat.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 21:49:16 by asoursou #+# #+# */
/* Updated: 2019/07/05 06:31:28 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
unsigned int ft_strlcat(char *dest, char *src, unsigned int size)
{
unsigned int i;
unsigned int j;
i = -1;
while (++i < size && *dest)
dest++;
if (i == size)
return (i + (unsigned int)ft_strlen(src));
j = -1;
while (src[++j])
if (j < size - i - 1)
*dest++ = src[j];
*dest = '\0';
return (i + j);
}
================================================
FILE: c04/ex00/ft_strlen.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:11:19 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:30:25 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
================================================
FILE: c04/ex01/ft_putstr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:00:11 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:40:51 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
void ft_putstr(char *str)
{
write(1, str, ft_strlen(str));
}
================================================
FILE: c04/ex02/ft_putnbr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/02 13:02:20 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:40:51 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putnbr(int nb)
{
unsigned int n;
if (nb < 0)
{
ft_putchar('-');
n = -nb;
}
else
n = nb;
if (n > 9)
{
ft_putnbr(n / 10);
n %= 10;
}
ft_putchar(n + '0');
}
================================================
FILE: c04/ex03/ft_atoi.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/06 06:20:50 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:35:23 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_atoi(char *str)
{
int n;
int negative;
while ((*str >= 9 && *str <= 13) || *str == ' ')
str++;
negative = 0;
while (*str == '-' || *str == '+')
if (*str++ == '-')
negative = 1 - negative;
n = 0;
while (*str >= '0' && *str <= '9')
n = n * 10 + *str++ - '0';
if (negative)
n *= -1;
return (n);
}
================================================
FILE: c04/ex04/ft_putnbr_base.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_base.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/06 06:45:07 by asoursou #+# #+# */
/* Updated: 2019/07/07 06:18:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
int ft_in_base(char c, char *base)
{
while (*base)
if (c == *base++)
return (1);
return (0);
}
void ft_print(unsigned int n, char *base, unsigned int size)
{
if (n > size - 1)
{
ft_print(n / size, base, size);
n %= size;
}
ft_putchar(base[n]);
}
void ft_putnbr_base(int nbr, char *base)
{
int size;
size = -1;
while (base[++size])
if (base[size] == '+' || base[size] == '-' || base[size] == ' '
|| ft_in_base(base[size], base + size + 1)
|| (base[size] >= 9 && base[size] <= 13))
return ;
if (size < 2)
return ;
if (nbr < 0)
{
ft_putchar('-');
ft_print(-nbr, base, size);
}
else
ft_print(nbr, base, size);
}
================================================
FILE: c04/ex05/ft_atoi_base.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi_base.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/06 20:27:50 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:41:48 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_in_base(char c, char *base)
{
int i;
i = -1;
while (base[++i])
if (c == base[i])
return (i);
return (-1);
}
int ft_baselen(char *base)
{
int size;
size = -1;
while (base[++size])
if (base[size] == '+' || base[size] == '-' || base[size] == ' '
|| ft_in_base(base[size], base + size + 1) >= 0
|| (base[size] >= 9 && base[size] <= 13))
return (0);
return (size);
}
int ft_atoi_base(char *str, char *base)
{
int i;
int n;
int negative;
int size;
if ((size = ft_baselen(base)) < 2)
return (0);
while ((*str >= 9 && *str <= 13) || *str == ' ')
str++;
negative = 0;
while (*str == '-' || *str == '+')
if (*str++ == '-')
negative = 1 - negative;
n = 0;
while ((i = ft_in_base(*str, base)) >= 0)
{
n = n * size + i;
str++;
}
if (negative)
n *= -1;
return (n);
}
================================================
FILE: c05/ex00/ft_iterative_factorial.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_iterative_factorial.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/07 08:16:02 by asoursou #+# #+# */
/* Updated: 2019/07/08 04:31:35 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_iterative_factorial(int nb)
{
int n;
if (nb < 1)
return (!nb);
n = 1;
while (nb)
n *= nb--;
return (n);
}
================================================
FILE: c05/ex01/ft_recursive_factorial.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_recursive_factorial.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/07 08:22:08 by asoursou #+# #+# */
/* Updated: 2019/07/08 04:35:45 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_recursive_factorial(int nb)
{
if (nb < 1)
return (!nb);
return (nb * ft_recursive_factorial(nb - 1));
}
================================================
FILE: c05/ex02/ft_iterative_power.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_iterative_power.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/07 08:25:43 by asoursou #+# #+# */
/* Updated: 2019/07/08 07:01:52 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_iterative_power(int nb, int power)
{
int n;
if (power < 1)
return (!power);
n = nb;
while (--power)
n *= nb;
return (n);
}
================================================
FILE: c05/ex03/ft_recursive_power.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_recursive_power.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/07 08:31:46 by asoursou #+# #+# */
/* Updated: 2019/07/08 05:46:12 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_recursive_power(int nb, int power)
{
if (power < 1)
return (!power);
return (nb * ft_recursive_power(nb, power - 1));
}
================================================
FILE: c05/ex04/ft_fibonacci.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fibonacci.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/07 09:02:55 by asoursou #+# #+# */
/* Updated: 2019/07/08 05:51:00 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_fibonacci(int index)
{
if (index < 0)
return (-1);
if (index < 2)
return (index);
return (ft_fibonacci(index - 1) + ft_fibonacci(index - 2));
}
================================================
FILE: c05/ex05/ft_sqrt.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sqrt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/07 09:06:22 by asoursou #+# #+# */
/* Updated: 2019/07/08 09:16:16 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_sqrt(int nb)
{
unsigned int i;
if (nb < 1)
return (0);
i = 1;
while (i * i < (unsigned int)nb)
i++;
return ((i * i == (unsigned int)nb) ? i : 0);
}
================================================
FILE: c05/ex06/ft_is_prime.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_prime.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/07 09:35:19 by asoursou #+# #+# */
/* Updated: 2019/07/08 09:29:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_prime(int nb)
{
unsigned int i;
if (nb < 3 || !(nb % 2))
return (nb == 2);
i = 3;
while (i * i <= (unsigned int)nb)
{
if (!(nb % i))
return (0);
i += 2;
}
return (1);
}
================================================
FILE: c05/ex07/ft_find_next_prime.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_find_next_prime.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 03:52:29 by asoursou #+# #+# */
/* Updated: 2019/07/08 09:22:50 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_find_next_prime(int nb)
{
unsigned int i;
if (nb < 3)
return (2);
if (!(nb % 2))
nb++;
i = 3;
while (i * i <= (unsigned int)nb)
{
if (!(nb % i))
{
nb += 2;
i = 1;
}
i += 2;
}
return (nb);
}
================================================
FILE: c05/ex08/ft_ten_queens_puzzle.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ten_queens_puzzle.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/25 12:22:47 by asoursou #+# #+# */
/* Updated: 2019/07/25 13:30:01 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
int ft_abs(int n)
{
return (n < 0) ? -n : n;
}
void ft_solve(char *tab, int x, int *max)
{
int i;
int j;
if (x == 10)
{
x = 0;
while (x < 10)
ft_putchar(tab[x++] + '0');
ft_putchar('\n');
(*max)++;
return ;
}
i = -1;
while (++i < 10)
{
j = 0;
while (j < x && i != tab[j] && ft_abs(tab[j] - i) != x - j)
j++;
if (j >= x)
{
tab[x] = i;
ft_solve(tab, x + 1, max);
}
}
}
int ft_ten_queens_puzzle(void)
{
char tab[10];
int max;
max = 0;
ft_solve(tab, 0, &max);
return (max);
}
================================================
FILE: c06/ex00/ft_print_program_name.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_program_name.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/09 03:20:37 by asoursou #+# #+# */
/* Updated: 2019/07/09 03:20:43 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putstr(char *str)
{
while (*str)
ft_putchar(*str++);
}
int main(int argc, char **argv)
{
if (argc)
{
ft_putstr(argv[0]);
ft_putchar('\n');
}
return (0);
}
================================================
FILE: c06/ex01/ft_print_params.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 07:56:58 by asoursou #+# #+# */
/* Updated: 2019/07/08 23:45:06 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putstr(char *str)
{
while (*str)
ft_putchar(*str++);
}
int main(int argc, char **argv)
{
int i;
i = 1;
while (i < argc)
{
ft_putstr(argv[i++]);
ft_putchar('\n');
}
return (0);
}
================================================
FILE: c06/ex02/ft_rev_params.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 21:52:57 by asoursou #+# #+# */
/* Updated: 2019/07/08 23:45:00 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putstr(char *str)
{
while (*str)
ft_putchar(*str++);
}
int main(int argc, char **argv)
{
while (argc > 1)
{
ft_putstr(argv[--argc]);
ft_putchar('\n');
}
return (0);
}
================================================
FILE: c06/ex03/ft_sort_params.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 21:58:42 by asoursou #+# #+# */
/* Updated: 2019/07/09 00:09:19 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s1 == *s2)
{
s1++;
s2++;
}
return (*s1 - *s2);
}
void ft_strswap(char **a, char **b)
{
char *c;
c = *a;
*a = *b;
*b = c;
}
void ft_sort_str_tab(char **tab, int size)
{
char *pivot;
int i;
int j;
if (size < 2)
return ;
pivot = tab[--size];
i = 0;
j = -1;
while (++j < size)
if (ft_strcmp(tab[j], pivot) < 0)
ft_strswap(&tab[i++], &tab[j]);
if (ft_strcmp(tab[i], tab[size]) > 0)
ft_strswap(&tab[i], &tab[size]);
ft_sort_str_tab(tab, i);
ft_sort_str_tab(tab + i + 1, size - i);
}
int main(int argc, char **argv)
{
int i;
ft_sort_str_tab(argv + 1, argc - 1);
i = 0;
while (++i < argc)
{
while (*argv[i])
ft_putchar(*argv[i]++);
ft_putchar('\n');
}
return (0);
}
================================================
FILE: c07/ex00/ft_strdup.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/09 02:30:44 by asoursou #+# #+# */
/* Updated: 2019/07/09 21:35:58 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
char *ft_strcpy(char *dest, char *src)
{
int i;
i = -1;
while (src[++i])
dest[i] = src[i];
dest[i] = '\0';
return (dest);
}
char *ft_strdup(char *src)
{
char *dest;
dest = malloc((ft_strlen(src) + 1) * sizeof(char));
if (!dest)
return (NULL);
return (ft_strcpy(dest, src));
}
================================================
FILE: c07/ex01/ft_range.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_range.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/09 03:30:38 by asoursou #+# #+# */
/* Updated: 2019/07/09 21:36:52 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int *ft_range(int min, int max)
{
int *t;
int i;
if (min >= max)
return (NULL);
max -= min;
t = malloc(max * sizeof(int));
if (!t)
return (NULL);
i = -1;
while (++i < max)
t[i] = min + i;
return (t);
}
================================================
FILE: c07/ex02/ft_ultimate_range.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_range.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/09 03:57:58 by asoursou #+# #+# */
/* Updated: 2019/07/10 05:14:42 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_ultimate_range(int **range, int min, int max)
{
int i;
if (min >= max)
{
*range = NULL;
return (0);
}
max -= min;
*range = malloc(max * sizeof(int));
if (!*range)
return (-1);
i = -1;
while (++i < max)
(*range)[i] = min + i;
return (max);
}
================================================
FILE: c07/ex03/ft_strjoin.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/09 21:35:31 by asoursou #+# #+# */
/* Updated: 2019/07/10 06:01:55 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
char *ft_strcpy(char *dest, char *src)
{
int i;
i = -1;
while (src[++i])
dest[i] = src[i];
dest[i] = '\0';
return (dest);
}
char *ft_strjoin(int size, char **strs, char *sep)
{
char *dest;
int i;
int j;
i = 0;
j = 0;
while (i < size)
j += ft_strlen(strs[i++]);
if (size > 0)
j += (size - 1) * ft_strlen(sep);
dest = malloc((j + 1) * sizeof(char));
if (!dest)
return (NULL);
i = 0;
j = 0;
while (i < size)
{
ft_strcpy(dest + j, strs[i]);
j += ft_strlen(strs[i]);
if (++i < size)
j += dest + j + ft_strlen(sep) - ft_strcpy(dest + j, sep);
}
dest[j] = '\0';
return (dest);
}
================================================
FILE: c07/ex04/ft_convert_base.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_convert_base.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/10 05:20:33 by asoursou #+# #+# */
/* Updated: 2019/07/11 02:13:52 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_in_base(char c, char *base)
{
int i;
i = -1;
while (base[++i])
if (c == base[i])
return (i);
return (-1);
}
int ft_checkbase(char *base)
{
int i;
i = -1;
while (base[++i])
if (base[i] == '+' || base[i] == '-' || base[i] == ' '
|| ft_in_base(base[i], base + i + 1) >= 0
|| (base[i] >= 9 && base[i] <= 13))
return (0);
return ((i < 2) ? 0 : i);
}
int ft_atoi_base(char *str, char *base, int size)
{
int i;
int n;
int negative;
while ((*str >= 9 && *str <= 13) || *str == ' ')
str++;
negative = 0;
while (*str == '-' || *str == '+')
if (*str++ == '-')
negative = 1 - negative;
n = 0;
while ((i = ft_in_base(*str++, base)) >= 0)
n = n * size + i;
if (negative)
n *= -1;
return (n);
}
int ft_nbrlen(unsigned int n, unsigned int base_size)
{
if (n < base_size)
return (1);
return (1 + ft_nbrlen(n / base_size, base_size));
}
char *ft_convert_base(char *nbr, char *base_from, char *base_to)
{
char *dest;
unsigned int nb;
int size;
int i;
int n;
n = ft_checkbase(base_from);
if (!(n && (size = ft_checkbase(base_to))))
return (NULL);
n = ft_atoi_base(nbr, base_from, n);
nb = (n < 0) ? -n : n;
i = ft_nbrlen(nb, size) + ((n < 0) ? 1 : 0);
if (!(dest = malloc((i + 1) * sizeof(char))))
return (NULL);
dest[i] = '\0';
while (i--)
{
dest[i] = base_to[nb % size];
nb /= size;
}
if (n < 0)
dest[0] = '-';
return (dest);
}
================================================
FILE: c07/ex04/ft_convert_base2.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_convert_base2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/10 06:20:53 by asoursou #+# #+# */
/* Updated: 2019/07/10 09:56:54 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_useless(void)
{
return ;
}
================================================
FILE: c07/ex05/ft_split.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/10 05:33:05 by asoursou #+# #+# */
/* Updated: 2019/07/12 10:41:51 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_is_separator(char *str, char *charset)
{
while (*charset)
if (*str == *charset++)
return (1);
return (0);
}
int ft_wordlen(char *str, char *charset)
{
int i;
i = 0;
while (str[i] && !ft_is_separator(str + i, charset))
i++;
return (i);
}
int ft_wordcount(char *str, char *charset)
{
int i;
int w;
w = 0;
while (*str)
{
while (*str && ft_is_separator(str, charset))
str++;
i = ft_wordlen(str, charset);
str += i;
if (i)
w++;
}
return (w);
}
char *ft_wordcpy(char *src, int n)
{
char *dest;
if (!(dest = malloc((n + 1) * sizeof(char))))
return (NULL);
dest[n] = '\0';
while (n--)
dest[n] = src[n];
return (dest);
}
char **ft_split(char *str, char *charset)
{
char **t;
int size;
int i;
int n;
size = ft_wordcount(str, charset);
if (!(t = malloc((size + 1) * sizeof(char*))))
return (NULL);
i = -1;
while (++i < size)
{
while (*str && ft_is_separator(str, charset))
str++;
n = ft_wordlen(str, charset);
if (!(t[i] = ft_wordcpy(str, n)))
return (NULL);
str += n;
}
t[size] = 0;
return (t);
}
================================================
FILE: c08/ex00/ft.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/11 08:21:45 by asoursou #+# #+# */
/* Updated: 2019/07/11 10:24:47 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_H
# define FT_H
void ft_putchar(char c);
void ft_swap(int *a, int *b);
void ft_putstr(char *str);
int ft_strlen(char *str);
int ft_strcmp(char *s1, char *s2);
#endif
================================================
FILE: c08/ex01/ft_boolean.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_boolean.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/11 10:31:29 by asoursou #+# #+# */
/* Updated: 2019/07/11 11:23:59 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_BOOLEAN_H
# define FT_BOOLEAN_H
# include <unistd.h>
typedef char t_bool;
# define FALSE 0
# define TRUE 1
# define SUCCESS 0
# define EVEN_MSG "I have an even number of arguments.\n"
# define ODD_MSG "I have an odd number of arguments.\n"
# define EVEN(X) ((X % 2) ? 0 : 1)
#endif
================================================
FILE: c08/ex02/ft_abs.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_abs.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/11 11:12:59 by asoursou #+# #+# */
/* Updated: 2019/07/11 11:15:09 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_ABS_H
# define FT_ABS_H
# define ABS(Value) ((Value < 0) ? -Value : Value)
#endif
================================================
FILE: c08/ex03/ft_point.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_point.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/11 11:16:08 by asoursou #+# #+# */
/* Updated: 2019/07/11 16:05:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_POINT_H
# define FT_POINT_H
typedef struct s_point
{
int x;
int y;
} t_point;
#endif
================================================
FILE: c08/ex04/ft_strs_to_tab.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strs_to_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/11 11:52:29 by asoursou #+# #+# */
/* Updated: 2019/07/12 11:12:38 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "ft_stock_str.h"
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
char *ft_strdup(char *src)
{
char *dest;
int i;
dest = malloc((ft_strlen(src) + 1) * sizeof(char));
if (!dest)
return (NULL);
i = -1;
while (src[++i])
dest[i] = src[i];
dest[i] = '\0';
return (dest);
}
struct s_stock_str *ft_strs_to_tab(int ac, char **av)
{
t_stock_str *t;
int i;
if (ac < 0)
ac = 0;
if (!(t = malloc((ac + 1) * sizeof(t_stock_str))))
return (NULL);
i = -1;
while (++i < ac)
{
t[i].size = ft_strlen(av[i]);
t[i].str = av[i];
t[i].copy = ft_strdup(av[i]);
}
t[i].str = 0;
return (t);
}
================================================
FILE: c08/ex05/ft_show_tab.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_show_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/11 15:24:50 by asoursou #+# #+# */
/* Updated: 2019/07/11 15:46:18 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft_stock_str.h"
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_puts(char *str)
{
while (*str)
ft_putchar(*str++);
ft_putchar('\n');
}
void ft_putnbr(int nb)
{
unsigned int n;
if (nb < 0)
{
ft_putchar('-');
n = -nb;
}
else
n = nb;
if (n > 9)
{
ft_putnbr(n / 10);
n %= 10;
}
ft_putchar(n + '0');
}
void ft_show_tab(struct s_stock_str *par)
{
if (!par)
return ;
while (par->str)
{
ft_puts(par->str);
ft_putnbr(par->size);
ft_putchar('\n');
ft_puts(par->copy);
par++;
}
}
================================================
FILE: c09/ex00/ft_putchar.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:19:29 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:28:36 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
================================================
FILE: c09/ex00/ft_putstr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:00:11 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:40:51 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
void ft_putstr(char *str)
{
write(1, str, ft_strlen(str));
}
================================================
FILE: c09/ex00/ft_strcmp.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 01:25:21 by asoursou #+# #+# */
/* Updated: 2019/07/04 01:37:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s1 == *s2)
{
s1++;
s2++;
}
return (*s1 - *s2);
}
================================================
FILE: c09/ex00/ft_strlen.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:11:19 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:30:25 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
================================================
FILE: c09/ex00/ft_swap.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 02:53:08 by asoursou #+# #+# */
/* Updated: 2019/07/03 02:54:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int c;
c = *a;
*a = *b;
*b = c;
}
================================================
FILE: c09/ex00/libft_creator.sh
================================================
#!/bin/sh
gcc -Wall -Wextra -Werror -c *.c
ar -rcs libft.a *.o
================================================
FILE: c09/ex01/Makefile
================================================
SRCS = ft_putchar.c ft_swap.c ft_putstr.c ft_strlen.c ft_strcmp.c
OBJS = $(addprefix srcs/, ${SRCS:.c=.o})
NAME = libft.a
.c.o:
gcc -Wall -Wextra -Werror -c -I./includes $< -o ${<:.c=.o}
${NAME}: ${OBJS}
ar -rcs $@ $^
all: ${NAME}
clean:
rm -f ${OBJS}
fclean: clean
rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re
================================================
FILE: c09/ex02/ft_split.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/10 05:33:05 by asoursou #+# #+# */
/* Updated: 2019/07/12 10:41:51 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_is_separator(char *str, char *charset)
{
while (*charset)
if (*str == *charset++)
return (1);
return (0);
}
int ft_wordlen(char *str, char *charset)
{
int i;
i = 0;
while (str[i] && !ft_is_separator(str + i, charset))
i++;
return (i);
}
int ft_wordcount(char *str, char *charset)
{
int i;
int w;
w = 0;
while (*str)
{
while (*str && ft_is_separator(str, charset))
str++;
i = ft_wordlen(str, charset);
str += i;
if (i)
w++;
}
return (w);
}
char *ft_wordcpy(char *src, int n)
{
char *dest;
if (!(dest = malloc((n + 1) * sizeof(char))))
return (NULL);
dest[n] = '\0';
while (n--)
dest[n] = src[n];
return (dest);
}
char **ft_split(char *str, char *charset)
{
char **t;
int size;
int i;
int n;
size = ft_wordcount(str, charset);
if (!(t = malloc((size + 1) * sizeof(char*))))
return (NULL);
i = -1;
while (++i < size)
{
while (*str && ft_is_separator(str, charset))
str++;
n = ft_wordlen(str, charset);
if (!(t[i] = ft_wordcpy(str, n)))
return (NULL);
str += n;
}
t[size] = 0;
return (t);
}
================================================
FILE: c10/ex00/Makefile
================================================
SRCS = ft_display_file.c \
ft_putstr_fd.c \
ft_strlen.c \
main.c
OBJS = ${SRCS:.c=.o}
NAME = ft_display_file
CFLAGS = -Wall -Wextra -Werror
all: ${NAME}
${NAME}: ${OBJS}
gcc ${CFLAGS} $^ -o $@
.c.o:
gcc ${CFLAGS} -c $< -o ${<:.c=.o}
clean:
rm -f ${OBJS}
fclean: clean
rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re
================================================
FILE: c10/ex00/ft.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 22:32:41 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:33:37 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_H
# define FT_H
int ft_display_file(char *path);
void ft_putstr_fd(char *str, int fd);
int ft_strlen(char *str);
#endif
================================================
FILE: c10/ex00/ft_display_file.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_display_file.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/14 22:17:46 by asoursou #+# #+# */
/* Updated: 2019/07/15 16:45:01 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <fcntl.h>
#include <unistd.h>
int ft_display_file(char *path)
{
char buf[2048];
int fd;
int len;
if ((fd = open(path, O_RDONLY)) < 0)
return (-1);
while ((len = read(fd, buf, 2048)) > 0)
write(1, buf, len);
close(fd);
return ((len) ? -1 : 0);
}
================================================
FILE: c10/ex00/ft_putstr_fd.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:42:27 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:34:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
void ft_putstr_fd(char *str, int fd)
{
write(fd, str, ft_strlen(str));
}
================================================
FILE: c10/ex00/ft_strlen.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:11:19 by asoursou #+# #+# */
/* Updated: 2019/07/03 15:18:43 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
================================================
FILE: c10/ex00/main.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:32:28 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:34:16 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
int main(int argc, char **argv)
{
if (argc < 2)
ft_putstr_fd("File name missing.\n", STDERR_FILENO);
else if (argc > 2)
ft_putstr_fd("Too many arguments.\n", STDERR_FILENO);
else if (ft_display_file(argv[1]) < 0)
ft_putstr_fd("Cannot read file.\n", STDERR_FILENO);
return (0);
}
================================================
FILE: c10/ex01/Makefile
================================================
SRCS = ft_display_file.c \
ft_putchar_fd.c \
ft_puterr.c \
ft_putstr_fd.c \
ft_strcmp.c \
ft_strlen.c \
main.c
OBJS = ${SRCS:.c=.o}
NAME = ft_cat
CFLAGS = -Wall -Wextra -Werror
all: ${NAME}
${NAME}: ${OBJS}
gcc ${CFLAGS} $^ -o $@
.c.o:
gcc ${CFLAGS} -c $< -o ${<:.c=.o}
clean:
rm -f ${OBJS}
fclean: clean
rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re
================================================
FILE: c10/ex01/ft.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 22:32:41 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:44:10 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_H
# define FT_H
int ft_display_file(char *path);
void ft_putchar_fd(char c, int fd);
void ft_puterr(char *bin, char *path, char *error);
void ft_putstr_fd(char *str, int fd);
int ft_strcmp(char *s1, char *s2);
int ft_strlen(char *str);
#endif
================================================
FILE: c10/ex01/ft_display_file.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_display_file.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/14 22:17:46 by asoursou #+# #+# */
/* Updated: 2019/07/16 17:41:42 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <fcntl.h>
#include <unistd.h>
int ft_display_file(char *path)
{
char buf[2048];
int fd;
int len;
fd = (path) ? open(path, O_RDONLY) : STDIN_FILENO;
if (fd < 0)
return (-1);
while ((len = read(fd, buf, 2048)) > 0)
write(1, buf, len);
if (fd != STDIN_FILENO)
close(fd);
return ((len) ? -1 : 0);
}
================================================
FILE: c10/ex01/ft_putchar_fd.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/15 16:10:45 by asoursou #+# #+# */
/* Updated: 2019/07/15 16:12:44 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar_fd(char c, int fd)
{
write(fd, &c, 1);
}
================================================
FILE: c10/ex01/ft_puterr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_puterr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 17:15:38 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:43:18 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
void ft_puterr(char *bin, char *path, char *error)
{
ft_putstr_fd(bin, STDERR_FILENO);
ft_putstr_fd(": ", STDERR_FILENO);
ft_putstr_fd(path, STDERR_FILENO);
ft_putstr_fd(": ", STDERR_FILENO);
ft_putstr_fd(error, STDERR_FILENO);
ft_putchar_fd('\n', STDERR_FILENO);
}
================================================
FILE: c10/ex01/ft_putstr_fd.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:42:27 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:43:32 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
void ft_putstr_fd(char *str, int fd)
{
write(fd, str, ft_strlen(str));
}
================================================
FILE: c10/ex01/ft_strcmp.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 01:25:21 by asoursou #+# #+# */
/* Updated: 2019/07/04 01:37:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s1 == *s2)
{
s1++;
s2++;
}
return (*s1 - *s2);
}
================================================
FILE: c10/ex01/ft_strlen.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:11:19 by asoursou #+# #+# */
/* Updated: 2019/07/03 15:18:43 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
================================================
FILE: c10/ex01/main.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:32:28 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:43:14 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <errno.h>
#include <libgen.h>
#include <string.h>
#include "ft.h"
int main(int argc, char **argv)
{
char *bin;
int i;
bin = basename(argv[0]);
if (argc < 2 && ft_display_file(NULL) < 0)
ft_puterr(bin, NULL, strerror(errno));
i = 0;
while (++i < argc)
{
if (!ft_strcmp(argv[i], "-"))
argv[i] = NULL;
if (ft_display_file(argv[i]) < 0)
ft_puterr(bin, argv[i], strerror(errno));
}
return (0);
}
================================================
FILE: c10/ex02/Makefile
================================================
SRCS = ft_atoi.c \
ft_putchar_fd.c \
ft_puterr.c \
ft_putstr_fd.c \
ft_strcmp.c \
ft_strlen.c \
ft_strncpy.c \
ft_tail.c \
main.c
OBJS = ${SRCS:.c=.o}
NAME = ft_tail
CFLAGS = -Wall -Wextra -Werror
all: ${NAME}
${NAME}: ${OBJS}
gcc ${CFLAGS} $^ -o $@
.c.o:
gcc ${CFLAGS} -c $< -o ${<:.c=.o}
clean:
rm -f ${OBJS}
fclean: clean
rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re
================================================
FILE: c10/ex02/ft.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 22:32:41 by asoursou #+# #+# */
/* Updated: 2019/07/16 23:18:51 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_H
# define FT_H
int ft_atoi(char *str);
int ft_display_file(char *path);
void ft_putchar_fd(char c, int fd);
void ft_puterr(char *bin, char *path, char *error);
void ft_putstr_fd(char *str, int fd);
int ft_strcmp(char *s1, char *s2);
int ft_strlen(char *str);
char *ft_strncpy(char *dest, char *src, unsigned int n);
int ft_tail(char *path, unsigned int n, int count, int print_path);
#endif
================================================
FILE: c10/ex02/ft_atoi.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/06 06:20:50 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:35:23 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_atoi(char *str)
{
int n;
int negative;
while ((*str >= 9 && *str <= 13) || *str == ' ')
str++;
negative = 0;
while (*str == '-' || *str == '+')
if (*str++ == '-')
negative = 1 - negative;
n = 0;
while (*str >= '0' && *str <= '9')
n = n * 10 + *str++ - '0';
if (negative)
n *= -1;
return (n);
}
================================================
FILE: c10/ex02/ft_putchar_fd.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/15 16:10:45 by asoursou #+# #+# */
/* Updated: 2019/07/15 16:12:44 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar_fd(char c, int fd)
{
write(fd, &c, 1);
}
================================================
FILE: c10/ex02/ft_puterr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_puterr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 17:15:38 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:48:17 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
void ft_puterr(char *bin, char *path, char *error)
{
ft_putstr_fd(bin, STDERR_FILENO);
ft_putstr_fd(": ", STDERR_FILENO);
ft_putstr_fd(path, STDERR_FILENO);
ft_putstr_fd(": ", STDERR_FILENO);
ft_putstr_fd(error, STDERR_FILENO);
ft_putchar_fd('\n', STDERR_FILENO);
}
================================================
FILE: c10/ex02/ft_putstr_fd.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:42:27 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:56:00 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
void ft_putstr_fd(char *str, int fd)
{
write(fd, str, ft_strlen(str));
}
================================================
FILE: c10/ex02/ft_strcmp.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/04 01:25:21 by asoursou #+# #+# */
/* Updated: 2019/07/04 01:37:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s1 == *s2)
{
s1++;
s2++;
}
return (*s1 - *s2);
}
================================================
FILE: c10/ex02/ft_strlen.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:11:19 by asoursou #+# #+# */
/* Updated: 2019/07/03 15:18:43 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
================================================
FILE: c10/ex02/ft_strncpy.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 22:19:59 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:20:01 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = -1;
while (++i < n && src[i])
dest[i] = src[i];
while (i < n)
dest[i++] = '\0';
return (dest);
}
================================================
FILE: c10/ex02/ft_tail.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_tail.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/15 16:51:18 by asoursou #+# #+# */
/* Updated: 2019/07/16 23:47:01 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include "ft.h"
char *ft_load_file(int fd, unsigned int *size)
{
char buf[2048];
char *content;
char *tmp;
int len;
if (!(content = malloc(sizeof(char))))
return (NULL);
*content = '\0';
*size = 0;
while ((len = read(fd, buf, 2048)) > 0)
{
if (!(tmp = malloc((*size + len) * sizeof(char))))
break ;
tmp = ft_strncpy(tmp, content, *size);
free(content);
ft_strncpy(tmp + *size, buf, len);
content = tmp;
*size += len;
content[*size] = '\0';
}
if (len)
free(content);
return ((len) ? NULL : content);
}
int ft_tail(char *path, unsigned int n, int count, int print_path)
{
char *content;
int fd;
unsigned int size;
fd = (path) ? open(path, O_RDONLY) : STDIN_FILENO;
if (fd < 0)
return (-1);
content = ft_load_file(fd, &size);
if (fd != STDIN_FILENO)
close(fd);
if (!content)
return (-1);
if (print_path)
{
if (count)
ft_putchar_fd('\n', 1);
ft_putstr_fd("==> ", 1);
ft_putstr_fd(path, 1);
ft_putstr_fd(" <==\n", 1);
}
if (n > size)
n = size;
ft_putstr_fd(content + size - n, 1);
free(content);
return (0);
}
================================================
FILE: c10/ex02/main.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/12 15:32:28 by asoursou #+# #+# */
/* Updated: 2019/07/16 22:55:02 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <errno.h>
#include <libgen.h>
#include <string.h>
#include "ft.h"
int main(int argc, char **argv)
{
char *bin;
int i;
int count;
unsigned int n;
if (argc < 3 || ft_strcmp(argv[1], "-c"))
return (0);
bin = basename(argv[0]);
i = ft_atoi(argv[2]);
n = (i < 0) ? -i : i;
if (argc < 4 && ft_tail(NULL, n, 0, 0) < 0)
ft_puterr(bin, NULL, strerror(errno));
i = 2;
count = 0;
while (++i < argc)
{
if (ft_tail(argv[i], n, count, argc > 4) < 0)
ft_puterr(bin, argv[i], strerror(errno));
else
count++;
}
return (0);
}
================================================
FILE: c11/ex00/ft_foreach.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_foreach.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 21:06:37 by asoursou #+# #+# */
/* Updated: 2019/07/16 21:20:17 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_foreach(int *tab, int length, void (*f)(int))
{
int i;
i = 0;
while (i < length)
f(tab[i++]);
}
================================================
FILE: c11/ex01/ft_map.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 21:17:48 by asoursou #+# #+# */
/* Updated: 2019/07/16 21:28:26 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int *ft_map(int *tab, int length, int (*f)(int))
{
int *ret;
int i;
if (length < 1 || !(ret = malloc(length * sizeof(int))))
return (NULL);
i = -1;
while (++i < length)
ret[i] = f(tab[i]);
return (ret);
}
================================================
FILE: c11/ex02/ft_any.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_any.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/16 21:29:30 by asoursou #+# #+# */
/* Updated: 2019/07/17 01:42:50 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_any(char **tab, int (*f)(char*))
{
int i;
i = 0;
while (tab[i])
if (f(tab[i++]))
return (1);
return (0);
}
================================================
FILE: c11/ex03/ft_count_if.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_count_if.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 01:43:23 by asoursou #+# #+# */
/* Updated: 2019/07/17 03:40:08 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_count_if(char **tab, int length, int (*f)(char*))
{
int i;
int n;
i = 0;
n = 0;
while (i < length)
if (f(tab[i++]))
n++;
return (n);
}
================================================
FILE: c11/ex04/ft_is_sort.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_sort.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 03:41:29 by asoursou #+# #+# */
/* Updated: 2019/07/18 00:10:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_sort(int *tab, int length, int (*f)(int, int))
{
int i;
int r;
int r2;
i = 1;
while (i < length && !(r = f(tab[i - 1], tab[i])))
i++;
while (i < length)
{
r2 = f(tab[i - 1], tab[i]);
if ((r < 0 && r2 > 0) || (r > 0 && r2 < 0))
return (0);
i++;
}
return (1);
}
================================================
FILE: c11/ex05/Makefile
================================================
SRCS = ft_atoi.c \
ft_op.c \
ft_putchar.c \
ft_putnbr.c \
ft_putstr.c \
ft_strlen.c \
main.c
OBJS = ${SRCS:.c=.o}
NAME = do-op
CFLAGS = -Wall -Wextra -Werror
all: ${NAME}
${NAME}: ${OBJS}
gcc ${CFLAGS} $^ -o $@
.c.o:
gcc ${CFLAGS} -c $< -o ${<:.c=.o}
clean:
rm -f ${OBJS}
fclean: clean
rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re
================================================
FILE: c11/ex05/ft.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 04:21:58 by asoursou #+# #+# */
/* Updated: 2019/07/17 14:42:52 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_H
# define FT_H
typedef enum e_op
{
op_sum,
op_sub,
op_div,
op_mul,
op_mod,
op_null,
} t_op;
void ft_sum(int a, int b);
void ft_sub(int a, int b);
void ft_div(int a, int b);
void ft_mul(int a, int b);
void ft_mod(int a, int b);
int ft_atoi(char *str);
void ft_putchar(char c);
void ft_putnbr(int nb);
void ft_putstr(char *str);
int ft_strlen(char *str);
#endif
================================================
FILE: c11/ex05/ft_atoi.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/06 06:20:50 by asoursou #+# #+# */
/* Updated: 2019/07/07 02:35:23 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_atoi(char *str)
{
int n;
int negative;
while ((*str >= 9 && *str <= 13) || *str == ' ')
str++;
negative = 0;
while (*str == '-' || *str == '+')
if (*str++ == '-')
negative = 1 - negative;
n = 0;
while (*str >= '0' && *str <= '9')
n = n * 10 + *str++ - '0';
if (negative)
n *= -1;
return (n);
}
================================================
FILE: c11/ex05/ft_op.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_do-op.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 05:08:56 by asoursou #+# #+# */
/* Updated: 2019/07/17 14:41:39 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft.h"
void ft_sum(int a, int b)
{
ft_putnbr(a + b);
}
void ft_sub(int a, int b)
{
ft_putnbr(a - b);
}
void ft_div(int a, int b)
{
if (b)
ft_putnbr(a / b);
else
ft_putstr("Stop : division by zero");
}
void ft_mul(int a, int b)
{
ft_putnbr(a * b);
}
void ft_mod(int a, int b)
{
if (b)
ft_putnbr(a % b);
else
ft_putstr("Stop : modulo by zero");
}
================================================
FILE: c11/ex05/ft_putchar.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/01 17:19:29 by asoursou #+# #+# */
/* Updated: 2019/07/02 17:28:36 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
================================================
FILE: c11/ex05/ft_putnbr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/02 13:02:20 by asoursou #+# #+# */
/* Updated: 2019/07/17 13:41:50 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
void ft_putnbr(int nb)
{
unsigned int n;
if (nb < 0)
{
ft_putchar('-');
n = -nb;
}
else
n = nb;
if (n > 9)
{
ft_putnbr(n / 10);
n %= 10;
}
ft_putchar(n + '0');
}
================================================
FILE: c11/ex05/ft_putstr.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:00:11 by asoursou #+# #+# */
/* Updated: 2019/07/17 05:37:21 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "ft.h"
void ft_putstr(char *str)
{
write(1, str, ft_strlen(str));
}
================================================
FILE: c11/ex05/ft_strlen.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/03 03:11:19 by asoursou #+# #+# */
/* Updated: 2019/07/03 15:18:43 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int n;
n = 0;
while (str[n])
n++;
return (n);
}
================================================
FILE: c11/ex05/main.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 15:25:06 by asoursou #+# #+# */
/* Updated: 2019/07/17 15:25:16 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft.h"
t_op ft_get_index(char *str)
{
if (!*str || str[1])
return (op_null);
if (*str == '+')
return (op_sum);
if (*str == '-')
return (op_sub);
if (*str == '/')
return (op_div);
if (*str == '*')
return (op_mul);
if (*str == '%')
return (op_mod);
return (op_null);
}
int main(int argc, char **argv)
{
void (*do_op[5])(int, int);
t_op op;
do_op[op_sum] = &ft_sum;
do_op[op_sub] = &ft_sub;
do_op[op_div] = &ft_div;
do_op[op_mul] = &ft_mul;
do_op[op_mod] = &ft_mod;
if (argc == 4)
{
op = ft_get_index(argv[2]);
if (op == op_null)
ft_putnbr(0);
else
do_op[op](ft_atoi(argv[1]), ft_atoi(argv[3]));
ft_putchar('\n');
}
return (0);
}
================================================
FILE: c11/ex06/ft_sort_string_tab.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_string_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 14:54:30 by asoursou #+# #+# */
/* Updated: 2019/07/17 15:12:29 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s1 == *s2)
{
s1++;
s2++;
}
return (*s1 - *s2);
}
void ft_strswap(char **a, char **b)
{
char *c;
c = *a;
*a = *b;
*b = c;
}
void ft_sort_str_tab(char **tab, int size)
{
char *pivot;
int i;
int j;
if (size < 2)
return ;
pivot = tab[--size];
i = 0;
j = -1;
while (++j < size)
if (ft_strcmp(tab[j], pivot) < 0)
ft_strswap(&tab[i++], &tab[j]);
if (ft_strcmp(tab[i], tab[size]) > 0)
ft_strswap(&tab[i], &tab[size]);
ft_sort_str_tab(tab, i);
ft_sort_str_tab(tab + i + 1, size - i);
}
void ft_sort_string_tab(char **tab)
{
int n;
n = 0;
while (tab[n])
n++;
ft_sort_str_tab(tab, n);
}
================================================
FILE: c11/ex07/ft_advanced_sort_string_tab.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_advanced_sort_string_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 15:09:08 by asoursou #+# #+# */
/* Updated: 2019/07/18 01:06:40 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
void ft_strswap(char **a, char **b)
{
char *c;
c = *a;
*a = *b;
*b = c;
}
void ft_advanced_sort_string_tab(char **tab, int (*cmp)(char *, char *))
{
int size;
int i;
size = 0;
while (tab[size])
size++;
while (--size >= 0)
{
i = 0;
while (++i <= size)
if (cmp(tab[i - 1], tab[i]) > 0)
ft_strswap(&tab[i - 1], &tab[i]);
}
}
================================================
FILE: c12/Makefile
================================================
SRCS = ex00/ft_create_elem.c \
ex01/ft_list_push_front.c \
ex02/ft_list_size.c \
ex03/ft_list_last.c \
ex04/ft_list_push_back.c \
ex05/ft_list_push_strs.c \
ex06/ft_list_clear.c \
ex07/ft_list_at.c \
ex08/ft_list_reverse.c \
ex09/ft_list_foreach.c \
ex10/ft_list_foreach_if.c \
ex11/ft_list_find.c \
ex12/ft_list_remove_if.c \
ex13/ft_list_merge.c \
ex14/ft_list_sort.c \
ex15/ft_list_reverse_fun.c \
ex16/ft_sorted_list_insert.c \
ex17/ft_sorted_list_merge.c \
main.c
OBJS = ${SRCS:.c=.o}
NAME = a.out
CFLAGS = -Wall -Wextra -Werror
all: ${NAME}
${NAME}: ${OBJS}
gcc ${CFLAGS} $^ -o $@
.c.o:
gcc ${CFLAGS} -I. -c $< -o ${<:.c=.o}
clean:
rm -f ${OBJS}
fclean: clean
rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re
================================================
FILE: c12/ex00/ft_create_elem.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_create_elem.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 01:38:16 by asoursou #+# #+# */
/* Updated: 2019/07/18 02:17:18 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "ft_list.h"
t_list *ft_create_elem(void *data)
{
t_list *l;
if (!(l = malloc(sizeof(t_list))))
return (NULL);
l->next = NULL;
l->data = data;
return (l);
}
================================================
FILE: c12/ex00/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex01/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex01/ft_list_push_front.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_push_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 04:53:41 by asoursou #+# #+# */
/* Updated: 2019/07/18 18:44:21 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
void ft_list_push_front(t_list **begin_list, void *data)
{
t_list *e;
if ((e = ft_create_elem(data)))
{
if (*begin_list)
e->next = *begin_list;
*begin_list = e;
}
}
================================================
FILE: c12/ex02/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex02/ft_list_size.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_size.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 19:33:22 by asoursou #+# #+# */
/* Updated: 2019/07/19 02:53:06 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
int ft_list_size(t_list *begin_list)
{
return ((begin_list) ? 1 + ft_list_size(begin_list->next) : 0);
}
================================================
FILE: c12/ex03/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex03/ft_list_last.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_last.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 19:47:55 by asoursou #+# #+# */
/* Updated: 2019/07/19 02:55:35 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
t_list *ft_list_last(t_list *begin_list)
{
if (!begin_list || !begin_list->next)
return (begin_list);
return (ft_list_last(begin_list->next));
}
================================================
FILE: c12/ex04/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex04/ft_list_push_back.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_push_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 20:41:20 by asoursou #+# #+# */
/* Updated: 2019/07/18 20:44:26 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
void ft_list_push_back(t_list **begin_list, void *data)
{
if (!*begin_list)
*begin_list = ft_create_elem(data);
else if ((*begin_list)->next)
ft_list_push_back(&(*begin_list)->next, data);
else
(*begin_list)->next = ft_create_elem(data);
}
================================================
FILE: c12/ex05/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex05/ft_list_push_strs.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_push_strs.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 20:42:07 by asoursou #+# #+# */
/* Updated: 2019/07/19 02:51:11 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "ft_list.h"
t_list *ft_list_push_strs(int size, char **strs)
{
t_list *begin;
t_list *e;
int i;
begin = NULL;
i = -1;
while (++i < size && (e = ft_create_elem(strs[i])))
{
e->next = begin;
begin = e;
}
return (begin);
}
================================================
FILE: c12/ex06/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex06/ft_list_clear.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_clear.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 18:15:02 by asoursou #+# #+# */
/* Updated: 2019/07/19 02:52:16 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "ft_list.h"
void ft_list_clear(t_list *begin_list, void (*free_fct)(void *))
{
if (!begin_list)
return ;
ft_list_clear(begin_list->next, free_fct);
if (free_fct)
free_fct(begin_list->data);
free(begin_list);
}
================================================
FILE: c12/ex07/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex07/ft_list_at.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_at.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/19 00:30:41 by asoursou #+# #+# */
/* Updated: 2019/07/19 00:45:34 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
t_list *ft_list_at(t_list *begin_list, unsigned int nbr)
{
if (!begin_list || !nbr)
return (begin_list);
return (ft_list_at(begin_list->next, nbr - 1));
}
================================================
FILE: c12/ex08/ft_list_reverse.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_reverse.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/19 00:52:44 by asoursou #+# #+# */
/* Updated: 2019/07/20 03:13:57 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "ft_list.h"
void ft_list_reverse(t_list **begin_list)
{
t_list *prev;
t_list *next;
prev = NULL;
while (*begin_list)
{
next = (*begin_list)->next;
(*begin_list)->next = prev;
prev = *begin_list;
*begin_list = next;
}
*begin_list = prev;
}
================================================
FILE: c12/ex09/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex09/ft_list_foreach.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_foreach.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/18 19:02:55 by asoursou #+# #+# */
/* Updated: 2019/07/18 19:06:35 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
void ft_list_foreach(t_list *begin_list, void (*f)(void *))
{
if (!begin_list)
return ;
f(begin_list->data);
ft_list_foreach(begin_list->next, f);
}
================================================
FILE: c12/ex10/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex10/ft_list_foreach_if.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_foreach_if.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/19 02:26:37 by asoursou #+# #+# */
/* Updated: 2019/07/19 02:42:30 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
void ft_list_foreach_if(t_list *begin_list, void (*f)(void *),
void *data_ref, int (*cmp)())
{
if (!begin_list)
return ;
if (!cmp(begin_list->data, data_ref))
f(begin_list->data);
ft_list_foreach_if(begin_list->next, f, data_ref, cmp);
}
================================================
FILE: c12/ex11/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex11/ft_list_find.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_find.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/19 02:44:24 by asoursou #+# #+# */
/* Updated: 2019/07/19 03:03:00 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
t_list *ft_list_find(t_list *begin_list, void *data_ref, int (*cmp)())
{
if (!begin_list || !cmp(begin_list->data, data_ref))
return (begin_list);
return (ft_list_find(begin_list->next, data_ref, cmp));
}
================================================
FILE: c12/ex12/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex12/ft_list_remove_if.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_remove_if.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/19 03:08:37 by asoursou #+# #+# */
/* Updated: 2019/07/20 03:02:35 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "ft_list.h"
void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)(),
void (*free_fct)(void *))
{
t_list *prev;
t_list *l;
prev = NULL;
l = *begin_list;
while (l)
if (!cmp(l->data, data_ref))
{
if (prev)
prev->next = l->next;
else
*begin_list = l->next;
if (free_fct)
free_fct(l->data);
free(l);
l = (prev) ? prev->next : *begin_list;
}
else
{
prev = l;
l = l->next;
}
}
================================================
FILE: c12/ex13/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex13/ft_list_merge.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_merge.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/19 04:09:39 by asoursou #+# #+# */
/* Updated: 2019/07/19 05:03:46 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
void ft_list_merge(t_list **begin_list1, t_list *begin_list2)
{
if (!*begin_list1)
*begin_list1 = begin_list2;
else if ((*begin_list1)->next)
ft_list_merge(&(*begin_list1)->next, begin_list2);
else
(*begin_list1)->next = begin_list2;
}
================================================
FILE: c12/ex14/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex14/ft_list_sort.c
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_sort.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/19 04:32:07 by asoursou #+# #+# */
/* Updated: 2019/07/19 07:02:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "ft_list.h"
t_list *ft_merge(t_list *l1, t_list *l2, int (*cmp)())
{
if (!l1)
return (l2);
if (!l2)
return (l1);
if (cmp(l1->data, l2->data) > 0)
{
l2->next = ft_merge(l1, l2->next, cmp);
return (l2);
}
l1->next = ft_merge(l1->next, l2, cmp);
return (l1);
}
void ft_list_sort(t_list **begin_list, int (*cmp)())
{
t_list *prev;
t_list *next;
if (!*begin_list || !(*begin_list)->next)
return ;
prev = *begin_list;
next = prev->next;
while (next && (next = next->next))
{
prev = prev->next;
next = next->next;
}
next = prev->next;
prev->next = NULL;
ft_list_sort(&(*begin_list), cmp);
ft_list_sort(&next, cmp);
*begin_list = ft_merge(*begin_list, next, cmp);
}
================================================
FILE: c12/ex15/ft_list.h
================================================
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoursou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/17 18:47:15 by asoursou #+# #+# */
/* Updated: 2019/07/18 04:51:31 by asoursou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIST_H
# define FT_LIST_H
typedef struct s_list
{
struct s_list *next;
void *data;
} t_list;
t_list *ft_create_elem(void *data);
#endif
================================================
FILE: c12/ex15/ft_list_reverse_fun.c
================================================
/* ************************************************************************** */
/* */
/*
gitextract_uqh3g1tv/
├── .gitignore
├── README.md
├── bsq/
│ ├── Makefile
│ ├── auteur
│ ├── gen.pl
│ ├── includes/
│ │ └── ft.h
│ └── srcs/
│ ├── ft_file_load.c
│ ├── ft_find_biggest_square.c
│ ├── ft_is_valid.c
│ └── main.c
├── c00/
│ ├── ex00/
│ │ └── ft_putchar.c
│ ├── ex01/
│ │ └── ft_print_alphabet.c
│ ├── ex02/
│ │ └── ft_print_reverse_alphabet.c
│ ├── ex03/
│ │ └── ft_print_numbers.c
│ ├── ex04/
│ │ └── ft_is_negative.c
│ ├── ex05/
│ │ └── ft_print_comb.c
│ ├── ex06/
│ │ └── ft_print_comb2.c
│ ├── ex07/
│ │ └── ft_putnbr.c
│ └── ex08/
│ └── ft_print_combn.c
├── c01/
│ ├── ex00/
│ │ └── ft_ft.c
│ ├── ex01/
│ │ └── ft_ultimate_ft.c
│ ├── ex02/
│ │ └── ft_swap.c
│ ├── ex03/
│ │ └── ft_div_mod.c
│ ├── ex04/
│ │ └── ft_ultimate_div_mod.c
│ ├── ex05/
│ │ └── ft_putstr.c
│ ├── ex06/
│ │ └── ft_strlen.c
│ ├── ex07/
│ │ └── ft_rev_int_tab.c
│ └── ex08/
│ └── ft_sort_int_tab.c
├── c02/
│ ├── ex00/
│ │ └── ft_strcpy.c
│ ├── ex01/
│ │ └── ft_strncpy.c
│ ├── ex02/
│ │ └── ft_str_is_alpha.c
│ ├── ex03/
│ │ └── ft_str_is_numeric.c
│ ├── ex04/
│ │ └── ft_str_is_lowercase.c
│ ├── ex05/
│ │ └── ft_str_is_uppercase.c
│ ├── ex06/
│ │ └── ft_str_is_printable.c
│ ├── ex07/
│ │ └── ft_strupcase.c
│ ├── ex08/
│ │ └── ft_strlowcase.c
│ ├── ex09/
│ │ └── ft_strcapitalize.c
│ ├── ex10/
│ │ └── ft_strlcpy.c
│ ├── ex11/
│ │ └── ft_putstr_non_printable.c
│ └── ex12/
│ └── ft_print_memory.c
├── c03/
│ ├── ex00/
│ │ └── ft_strcmp.c
│ ├── ex01/
│ │ └── ft_strncmp.c
│ ├── ex02/
│ │ └── ft_strcat.c
│ ├── ex03/
│ │ └── ft_strncat.c
│ ├── ex04/
│ │ └── ft_strstr.c
│ └── ex05/
│ └── ft_strlcat.c
├── c04/
│ ├── ex00/
│ │ └── ft_strlen.c
│ ├── ex01/
│ │ └── ft_putstr.c
│ ├── ex02/
│ │ └── ft_putnbr.c
│ ├── ex03/
│ │ └── ft_atoi.c
│ ├── ex04/
│ │ └── ft_putnbr_base.c
│ └── ex05/
│ └── ft_atoi_base.c
├── c05/
│ ├── ex00/
│ │ └── ft_iterative_factorial.c
│ ├── ex01/
│ │ └── ft_recursive_factorial.c
│ ├── ex02/
│ │ └── ft_iterative_power.c
│ ├── ex03/
│ │ └── ft_recursive_power.c
│ ├── ex04/
│ │ └── ft_fibonacci.c
│ ├── ex05/
│ │ └── ft_sqrt.c
│ ├── ex06/
│ │ └── ft_is_prime.c
│ ├── ex07/
│ │ └── ft_find_next_prime.c
│ └── ex08/
│ └── ft_ten_queens_puzzle.c
├── c06/
│ ├── ex00/
│ │ └── ft_print_program_name.c
│ ├── ex01/
│ │ └── ft_print_params.c
│ ├── ex02/
│ │ └── ft_rev_params.c
│ └── ex03/
│ └── ft_sort_params.c
├── c07/
│ ├── ex00/
│ │ └── ft_strdup.c
│ ├── ex01/
│ │ └── ft_range.c
│ ├── ex02/
│ │ └── ft_ultimate_range.c
│ ├── ex03/
│ │ └── ft_strjoin.c
│ ├── ex04/
│ │ ├── ft_convert_base.c
│ │ └── ft_convert_base2.c
│ └── ex05/
│ └── ft_split.c
├── c08/
│ ├── ex00/
│ │ └── ft.h
│ ├── ex01/
│ │ └── ft_boolean.h
│ ├── ex02/
│ │ └── ft_abs.h
│ ├── ex03/
│ │ └── ft_point.h
│ ├── ex04/
│ │ └── ft_strs_to_tab.c
│ └── ex05/
│ └── ft_show_tab.c
├── c09/
│ ├── ex00/
│ │ ├── ft_putchar.c
│ │ ├── ft_putstr.c
│ │ ├── ft_strcmp.c
│ │ ├── ft_strlen.c
│ │ ├── ft_swap.c
│ │ └── libft_creator.sh
│ ├── ex01/
│ │ └── Makefile
│ └── ex02/
│ └── ft_split.c
├── c10/
│ ├── ex00/
│ │ ├── Makefile
│ │ ├── ft.h
│ │ ├── ft_display_file.c
│ │ ├── ft_putstr_fd.c
│ │ ├── ft_strlen.c
│ │ └── main.c
│ ├── ex01/
│ │ ├── Makefile
│ │ ├── ft.h
│ │ ├── ft_display_file.c
│ │ ├── ft_putchar_fd.c
│ │ ├── ft_puterr.c
│ │ ├── ft_putstr_fd.c
│ │ ├── ft_strcmp.c
│ │ ├── ft_strlen.c
│ │ └── main.c
│ └── ex02/
│ ├── Makefile
│ ├── ft.h
│ ├── ft_atoi.c
│ ├── ft_putchar_fd.c
│ ├── ft_puterr.c
│ ├── ft_putstr_fd.c
│ ├── ft_strcmp.c
│ ├── ft_strlen.c
│ ├── ft_strncpy.c
│ ├── ft_tail.c
│ └── main.c
├── c11/
│ ├── ex00/
│ │ └── ft_foreach.c
│ ├── ex01/
│ │ └── ft_map.c
│ ├── ex02/
│ │ └── ft_any.c
│ ├── ex03/
│ │ └── ft_count_if.c
│ ├── ex04/
│ │ └── ft_is_sort.c
│ ├── ex05/
│ │ ├── Makefile
│ │ ├── ft.h
│ │ ├── ft_atoi.c
│ │ ├── ft_op.c
│ │ ├── ft_putchar.c
│ │ ├── ft_putnbr.c
│ │ ├── ft_putstr.c
│ │ ├── ft_strlen.c
│ │ └── main.c
│ ├── ex06/
│ │ └── ft_sort_string_tab.c
│ └── ex07/
│ └── ft_advanced_sort_string_tab.c
├── c12/
│ ├── Makefile
│ ├── ex00/
│ │ ├── ft_create_elem.c
│ │ └── ft_list.h
│ ├── ex01/
│ │ ├── ft_list.h
│ │ └── ft_list_push_front.c
│ ├── ex02/
│ │ ├── ft_list.h
│ │ └── ft_list_size.c
│ ├── ex03/
│ │ ├── ft_list.h
│ │ └── ft_list_last.c
│ ├── ex04/
│ │ ├── ft_list.h
│ │ └── ft_list_push_back.c
│ ├── ex05/
│ │ ├── ft_list.h
│ │ └── ft_list_push_strs.c
│ ├── ex06/
│ │ ├── ft_list.h
│ │ └── ft_list_clear.c
│ ├── ex07/
│ │ ├── ft_list.h
│ │ └── ft_list_at.c
│ ├── ex08/
│ │ └── ft_list_reverse.c
│ ├── ex09/
│ │ ├── ft_list.h
│ │ └── ft_list_foreach.c
│ ├── ex10/
│ │ ├── ft_list.h
│ │ └── ft_list_foreach_if.c
│ ├── ex11/
│ │ ├── ft_list.h
│ │ └── ft_list_find.c
│ ├── ex12/
│ │ ├── ft_list.h
│ │ └── ft_list_remove_if.c
│ ├── ex13/
│ │ ├── ft_list.h
│ │ └── ft_list_merge.c
│ ├── ex14/
│ │ ├── ft_list.h
│ │ └── ft_list_sort.c
│ ├── ex15/
│ │ ├── ft_list.h
│ │ └── ft_list_reverse_fun.c
│ ├── ex16/
│ │ ├── ft_list.h
│ │ └── ft_sorted_list_insert.c
│ ├── ex17/
│ │ ├── ft_list.h
│ │ └── ft_sorted_list_merge.c
│ ├── ft_list.h
│ └── main.c
├── c13/
│ ├── Makefile
│ ├── ex00/
│ │ ├── btree_create_node.c
│ │ └── ft_btree.h
│ ├── ex01/
│ │ ├── btree_apply_prefix.c
│ │ └── ft_btree.h
│ ├── ex02/
│ │ ├── btree_apply_infix.c
│ │ └── ft_btree.h
│ ├── ex03/
│ │ ├── btree_apply_suffix.c
│ │ └── ft_btree.h
│ ├── ex04/
│ │ ├── btree_insert_data.c
│ │ └── ft_btree.h
│ ├── ex05/
│ │ ├── btree_search_item.c
│ │ └── ft_btree.h
│ ├── ex06/
│ │ ├── btree_level_count.c
│ │ └── ft_btree.h
│ ├── ex07/
│ │ ├── btree_apply_by_level.c
│ │ └── ft_btree.h
│ ├── ft_btree.h
│ └── main.c
├── other/
│ ├── binary.c
│ ├── mkdirs.sh
│ └── sorting.c
├── rush00/
│ └── ex00/
│ ├── ft_putchar.c
│ ├── main.c
│ ├── rush00.c
│ ├── rush01.c
│ ├── rush02.c
│ ├── rush03.c
│ └── rush04.c
├── rush01/
│ └── ex00/
│ ├── ft_backtrack.c
│ ├── ft_check.c
│ ├── ft_destroy_tab.c
│ ├── ft_get_size.c
│ ├── ft_init_tab.c
│ ├── ft_print_tab.c
│ ├── ft_putchar.c
│ ├── ft_putstr.c
│ ├── ft_rush.h
│ └── main.c
├── rush02/
│ └── ex00/
│ ├── Makefile
│ ├── includes/
│ │ ├── ft.h
│ │ ├── ft_dict.h
│ │ └── ft_list.h
│ ├── numbers.dict
│ ├── srcs/
│ │ ├── ft/
│ │ │ ├── ft_atol.c
│ │ │ ├── ft_check_args.c
│ │ │ ├── ft_file_load.c
│ │ │ ├── ft_is_valid.c
│ │ │ ├── ft_isdigit.c
│ │ │ ├── ft_isprint.c
│ │ │ ├── ft_isspace.c
│ │ │ ├── ft_putchar.c
│ │ │ ├── ft_putstr.c
│ │ │ ├── ft_strlen.c
│ │ │ └── ft_strncpy.c
│ │ ├── ft_dict/
│ │ │ ├── ft_dict_clear.c
│ │ │ ├── ft_dict_cmp.c
│ │ │ ├── ft_dict_create.c
│ │ │ ├── ft_dict_create_elem.c
│ │ │ ├── ft_dict_in.c
│ │ │ └── ft_print.c
│ │ ├── ft_list/
│ │ │ ├── ft_create_elem.c
│ │ │ ├── ft_list_clear.c
│ │ │ ├── ft_list_find.c
│ │ │ └── ft_sorted_list_insert.c
│ │ └── main.c
│ └── test.sh
├── shell00/
│ ├── ex00/
│ │ └── z
│ ├── ex03/
│ │ └── klist.txt
│ ├── ex04/
│ │ └── midLS
│ ├── ex05/
│ │ └── git_commit.sh
│ ├── ex06/
│ │ └── git_ignore.sh
│ ├── ex07/
│ │ └── b
│ ├── ex08/
│ │ └── clean
│ └── ex09/
│ └── ft_magic
└── shell01/
├── ex01/
│ └── print_groups.sh
├── ex02/
│ └── find_sh.sh
├── ex03/
│ └── count_files.sh
├── ex04/
│ └── MAC.sh
├── ex05/
│ └── "\?$*'MaRViN'*$?\"
├── ex06/
│ └── skip.sh
├── ex07/
│ └── r_dwssap.sh
└── ex08/
└── add_chelou.sh
SYMBOL INDEX (294 symbols across 195 files) FILE: bsq/includes/ft.h type t_point (line 20) | typedef struct s_point type t_map (line 26) | typedef struct s_map type t_square (line 36) | typedef struct s_square FILE: bsq/srcs/ft_find_biggest_square.c function ft_compute (line 15) | void ft_compute(t_map *m, t_square *s, int *t, t_point p) function ft_find_biggest_square (line 44) | void ft_find_biggest_square(t_map *m, t_square *s) FILE: bsq/srcs/ft_is_valid.c function ft_atoui (line 16) | int ft_atoui(char *str, int *length) function ft_check_line (line 44) | int ft_check_line(t_map *m) function ft_is_valid (line 69) | int ft_is_valid(t_map *m) FILE: bsq/srcs/main.c function ft_bsq (line 17) | static void ft_bsq(char *path) function main (line 37) | int main(int argc, char **argv) FILE: c00/ex00/ft_putchar.c function ft_putchar (line 15) | void ft_putchar(char c) FILE: c00/ex01/ft_print_alphabet.c function ft_print_alphabet (line 15) | void ft_print_alphabet(void) FILE: c00/ex02/ft_print_reverse_alphabet.c function ft_print_reverse_alphabet (line 15) | void ft_print_reverse_alphabet(void) FILE: c00/ex03/ft_print_numbers.c function ft_print_numbers (line 15) | void ft_print_numbers(void) FILE: c00/ex04/ft_is_negative.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_is_negative (line 20) | void ft_is_negative(int n) FILE: c00/ex05/ft_print_comb.c function ft_print_comb (line 15) | void ft_print_comb(void) FILE: c00/ex06/ft_print_comb2.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_print_comb2 (line 20) | void ft_print_comb2(void) FILE: c00/ex07/ft_putnbr.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_putnbr (line 20) | void ft_putnbr(int nb) FILE: c00/ex08/ft_print_combn.c function ft_print_combn (line 15) | void ft_print_combn(int n) FILE: c01/ex00/ft_ft.c function ft_ft (line 13) | void ft_ft(int *nbr) FILE: c01/ex01/ft_ultimate_ft.c function ft_ultimate_ft (line 13) | void ft_ultimate_ft(int *********nbr) FILE: c01/ex02/ft_swap.c function ft_swap (line 13) | void ft_swap(int *a, int *b) FILE: c01/ex03/ft_div_mod.c function ft_div_mod (line 13) | void ft_div_mod(int a, int b, int *div, int *mod) FILE: c01/ex04/ft_ultimate_div_mod.c function ft_ultimate_div_mod (line 13) | void ft_ultimate_div_mod(int *a, int *b) FILE: c01/ex05/ft_putstr.c function ft_strlen (line 15) | int ft_strlen(char *str) function ft_putstr (line 25) | void ft_putstr(char *str) FILE: c01/ex06/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: c01/ex07/ft_rev_int_tab.c function ft_swap (line 13) | void ft_swap(int *a, int *b) function ft_rev_int_tab (line 22) | void ft_rev_int_tab(int *tab, int size) FILE: c01/ex08/ft_sort_int_tab.c function ft_swap (line 13) | void ft_swap(int *a, int *b) function ft_sort_int_tab (line 22) | void ft_sort_int_tab(int *tab, int size) FILE: c02/ex02/ft_str_is_alpha.c function ft_str_is_alpha (line 13) | int ft_str_is_alpha(char *str) FILE: c02/ex03/ft_str_is_numeric.c function ft_str_is_numeric (line 13) | int ft_str_is_numeric(char *str) FILE: c02/ex04/ft_str_is_lowercase.c function ft_str_is_lowercase (line 13) | int ft_str_is_lowercase(char *str) FILE: c02/ex05/ft_str_is_uppercase.c function ft_str_is_uppercase (line 13) | int ft_str_is_uppercase(char *str) FILE: c02/ex06/ft_str_is_printable.c function ft_str_is_printable (line 13) | int ft_str_is_printable(char *str) FILE: c02/ex09/ft_strcapitalize.c function ft_isdigit (line 13) | int ft_isdigit(char c) function ft_islower (line 18) | int ft_islower(char c) function ft_isupper (line 23) | int ft_isupper(char c) FILE: c02/ex10/ft_strlcpy.c function ft_strlen (line 13) | int ft_strlen(char *str) function ft_strlcpy (line 23) | unsigned int ft_strlcpy(char *dest, char *src, unsigned int size) FILE: c02/ex11/ft_putstr_non_printable.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_puthex (line 20) | void ft_puthex(unsigned char c) function ft_putstr_non_printable (line 29) | void ft_putstr_non_printable(char *str) FILE: c02/ex12/ft_print_memory.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_puthex (line 20) | void ft_puthex(unsigned char c) function ft_print_data (line 29) | void ft_print_data(char *s, unsigned int size) FILE: c03/ex00/ft_strcmp.c function ft_strcmp (line 13) | int ft_strcmp(char *s1, char *s2) FILE: c03/ex01/ft_strncmp.c function ft_strncmp (line 13) | int ft_strncmp(char *s1, char *s2, unsigned int n) FILE: c03/ex05/ft_strlcat.c function ft_strlen (line 13) | int ft_strlen(char *str) function ft_strlcat (line 23) | unsigned int ft_strlcat(char *dest, char *src, unsigned int size) FILE: c04/ex00/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: c04/ex01/ft_putstr.c function ft_strlen (line 15) | int ft_strlen(char *str) function ft_putstr (line 25) | void ft_putstr(char *str) FILE: c04/ex02/ft_putnbr.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_putnbr (line 20) | void ft_putnbr(int nb) FILE: c04/ex03/ft_atoi.c function ft_atoi (line 13) | int ft_atoi(char *str) FILE: c04/ex04/ft_putnbr_base.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_in_base (line 20) | int ft_in_base(char c, char *base) function ft_print (line 28) | void ft_print(unsigned int n, char *base, unsigned int size) function ft_putnbr_base (line 38) | void ft_putnbr_base(int nbr, char *base) FILE: c04/ex05/ft_atoi_base.c function ft_in_base (line 13) | int ft_in_base(char c, char *base) function ft_baselen (line 24) | int ft_baselen(char *base) function ft_atoi_base (line 37) | int ft_atoi_base(char *str, char *base) FILE: c05/ex00/ft_iterative_factorial.c function ft_iterative_factorial (line 13) | int ft_iterative_factorial(int nb) FILE: c05/ex01/ft_recursive_factorial.c function ft_recursive_factorial (line 13) | int ft_recursive_factorial(int nb) FILE: c05/ex02/ft_iterative_power.c function ft_iterative_power (line 13) | int ft_iterative_power(int nb, int power) FILE: c05/ex03/ft_recursive_power.c function ft_recursive_power (line 13) | int ft_recursive_power(int nb, int power) FILE: c05/ex04/ft_fibonacci.c function ft_fibonacci (line 13) | int ft_fibonacci(int index) FILE: c05/ex05/ft_sqrt.c function ft_sqrt (line 13) | int ft_sqrt(int nb) FILE: c05/ex06/ft_is_prime.c function ft_is_prime (line 13) | int ft_is_prime(int nb) FILE: c05/ex07/ft_find_next_prime.c function ft_find_next_prime (line 13) | int ft_find_next_prime(int nb) FILE: c05/ex08/ft_ten_queens_puzzle.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_abs (line 20) | int ft_abs(int n) function ft_solve (line 25) | void ft_solve(char *tab, int x, int *max) function ft_ten_queens_puzzle (line 53) | int ft_ten_queens_puzzle(void) FILE: c06/ex00/ft_print_program_name.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_putstr (line 20) | void ft_putstr(char *str) function main (line 26) | int main(int argc, char **argv) FILE: c06/ex01/ft_print_params.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_putstr (line 20) | void ft_putstr(char *str) function main (line 26) | int main(int argc, char **argv) FILE: c06/ex02/ft_rev_params.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_putstr (line 20) | void ft_putstr(char *str) function main (line 26) | int main(int argc, char **argv) FILE: c06/ex03/ft_sort_params.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_strcmp (line 20) | int ft_strcmp(char *s1, char *s2) function ft_strswap (line 30) | void ft_strswap(char **a, char **b) function ft_sort_str_tab (line 39) | void ft_sort_str_tab(char **tab, int size) function main (line 59) | int main(int argc, char **argv) FILE: c07/ex00/ft_strdup.c function ft_strlen (line 15) | int ft_strlen(char *str) FILE: c07/ex02/ft_ultimate_range.c function ft_ultimate_range (line 15) | int ft_ultimate_range(int **range, int min, int max) FILE: c07/ex03/ft_strjoin.c function ft_strlen (line 15) | int ft_strlen(char *str) FILE: c07/ex04/ft_convert_base.c function ft_in_base (line 15) | int ft_in_base(char c, char *base) function ft_checkbase (line 26) | int ft_checkbase(char *base) function ft_atoi_base (line 39) | int ft_atoi_base(char *str, char *base, int size) function ft_nbrlen (line 59) | int ft_nbrlen(unsigned int n, unsigned int base_size) FILE: c07/ex04/ft_convert_base2.c function ft_useless (line 13) | void ft_useless(void) FILE: c07/ex05/ft_split.c function ft_is_separator (line 15) | int ft_is_separator(char *str, char *charset) function ft_wordlen (line 23) | int ft_wordlen(char *str, char *charset) function ft_wordcount (line 33) | int ft_wordcount(char *str, char *charset) FILE: c08/ex01/ft_boolean.h type t_bool (line 18) | typedef char t_bool; FILE: c08/ex03/ft_point.h type t_point (line 16) | typedef struct s_point FILE: c08/ex04/ft_strs_to_tab.c function ft_strlen (line 16) | int ft_strlen(char *str) type s_stock_str (line 41) | struct s_stock_str FILE: c08/ex05/ft_show_tab.c function ft_putchar (line 16) | void ft_putchar(char c) function ft_puts (line 21) | void ft_puts(char *str) function ft_putnbr (line 28) | void ft_putnbr(int nb) function ft_show_tab (line 47) | void ft_show_tab(struct s_stock_str *par) FILE: c09/ex00/ft_putchar.c function ft_putchar (line 15) | void ft_putchar(char c) FILE: c09/ex00/ft_putstr.c function ft_strlen (line 15) | int ft_strlen(char *str) function ft_putstr (line 25) | void ft_putstr(char *str) FILE: c09/ex00/ft_strcmp.c function ft_strcmp (line 13) | int ft_strcmp(char *s1, char *s2) FILE: c09/ex00/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: c09/ex00/ft_swap.c function ft_swap (line 13) | void ft_swap(int *a, int *b) FILE: c09/ex02/ft_split.c function ft_is_separator (line 15) | int ft_is_separator(char *str, char *charset) function ft_wordlen (line 23) | int ft_wordlen(char *str, char *charset) function ft_wordcount (line 33) | int ft_wordcount(char *str, char *charset) FILE: c10/ex00/ft_display_file.c function ft_display_file (line 16) | int ft_display_file(char *path) FILE: c10/ex00/ft_putstr_fd.c function ft_putstr_fd (line 16) | void ft_putstr_fd(char *str, int fd) FILE: c10/ex00/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: c10/ex00/main.c function main (line 16) | int main(int argc, char **argv) FILE: c10/ex01/ft_display_file.c function ft_display_file (line 16) | int ft_display_file(char *path) FILE: c10/ex01/ft_putchar_fd.c function ft_putchar_fd (line 15) | void ft_putchar_fd(char c, int fd) FILE: c10/ex01/ft_puterr.c function ft_puterr (line 16) | void ft_puterr(char *bin, char *path, char *error) FILE: c10/ex01/ft_putstr_fd.c function ft_putstr_fd (line 16) | void ft_putstr_fd(char *str, int fd) FILE: c10/ex01/ft_strcmp.c function ft_strcmp (line 13) | int ft_strcmp(char *s1, char *s2) FILE: c10/ex01/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: c10/ex01/main.c function main (line 18) | int main(int argc, char **argv) FILE: c10/ex02/ft_atoi.c function ft_atoi (line 13) | int ft_atoi(char *str) FILE: c10/ex02/ft_putchar_fd.c function ft_putchar_fd (line 15) | void ft_putchar_fd(char c, int fd) FILE: c10/ex02/ft_puterr.c function ft_puterr (line 16) | void ft_puterr(char *bin, char *path, char *error) FILE: c10/ex02/ft_putstr_fd.c function ft_putstr_fd (line 16) | void ft_putstr_fd(char *str, int fd) FILE: c10/ex02/ft_strcmp.c function ft_strcmp (line 13) | int ft_strcmp(char *s1, char *s2) FILE: c10/ex02/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: c10/ex02/ft_tail.c function ft_tail (line 45) | int ft_tail(char *path, unsigned int n, int count, int print_path) FILE: c10/ex02/main.c function main (line 18) | int main(int argc, char **argv) FILE: c11/ex00/ft_foreach.c function ft_foreach (line 13) | void ft_foreach(int *tab, int length, void (*f)(int)) FILE: c11/ex02/ft_any.c function ft_any (line 13) | int ft_any(char **tab, int (*f)(char*)) FILE: c11/ex03/ft_count_if.c function ft_count_if (line 13) | int ft_count_if(char **tab, int length, int (*f)(char*)) FILE: c11/ex04/ft_is_sort.c function ft_is_sort (line 13) | int ft_is_sort(int *tab, int length, int (*f)(int, int)) FILE: c11/ex05/ft.h type t_op (line 16) | typedef enum e_op FILE: c11/ex05/ft_atoi.c function ft_atoi (line 13) | int ft_atoi(char *str) FILE: c11/ex05/ft_op.c function ft_sum (line 15) | void ft_sum(int a, int b) function ft_sub (line 20) | void ft_sub(int a, int b) function ft_div (line 25) | void ft_div(int a, int b) function ft_mul (line 33) | void ft_mul(int a, int b) function ft_mod (line 38) | void ft_mod(int a, int b) FILE: c11/ex05/ft_putchar.c function ft_putchar (line 15) | void ft_putchar(char c) FILE: c11/ex05/ft_putnbr.c function ft_putnbr (line 16) | void ft_putnbr(int nb) FILE: c11/ex05/ft_putstr.c function ft_putstr (line 16) | void ft_putstr(char *str) FILE: c11/ex05/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: c11/ex05/main.c function t_op (line 15) | t_op ft_get_index(char *str) function main (line 32) | int main(int argc, char **argv) FILE: c11/ex06/ft_sort_string_tab.c function ft_strcmp (line 13) | int ft_strcmp(char *s1, char *s2) function ft_strswap (line 23) | void ft_strswap(char **a, char **b) function ft_sort_str_tab (line 32) | void ft_sort_str_tab(char **tab, int size) function ft_sort_string_tab (line 52) | void ft_sort_string_tab(char **tab) FILE: c11/ex07/ft_advanced_sort_string_tab.c function ft_strswap (line 13) | void ft_strswap(char **a, char **b) function ft_advanced_sort_string_tab (line 22) | void ft_advanced_sort_string_tab(char **tab, int (*cmp)(char *, char *)) FILE: c12/ex00/ft_create_elem.c function t_list (line 16) | t_list *ft_create_elem(void *data) FILE: c12/ex00/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex01/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex01/ft_list_push_front.c function ft_list_push_front (line 15) | void ft_list_push_front(t_list **begin_list, void *data) FILE: c12/ex02/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex02/ft_list_size.c function ft_list_size (line 15) | int ft_list_size(t_list *begin_list) FILE: c12/ex03/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex03/ft_list_last.c function t_list (line 15) | t_list *ft_list_last(t_list *begin_list) FILE: c12/ex04/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex04/ft_list_push_back.c function ft_list_push_back (line 15) | void ft_list_push_back(t_list **begin_list, void *data) FILE: c12/ex05/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex05/ft_list_push_strs.c function t_list (line 16) | t_list *ft_list_push_strs(int size, char **strs) FILE: c12/ex06/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex06/ft_list_clear.c function ft_list_clear (line 16) | void ft_list_clear(t_list *begin_list, void (*free_fct)(void *)) FILE: c12/ex07/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex07/ft_list_at.c function t_list (line 15) | t_list *ft_list_at(t_list *begin_list, unsigned int nbr) FILE: c12/ex08/ft_list_reverse.c function ft_list_reverse (line 16) | void ft_list_reverse(t_list **begin_list) FILE: c12/ex09/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex09/ft_list_foreach.c function ft_list_foreach (line 15) | void ft_list_foreach(t_list *begin_list, void (*f)(void *)) FILE: c12/ex10/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex10/ft_list_foreach_if.c function ft_list_foreach_if (line 15) | void ft_list_foreach_if(t_list *begin_list, void (*f)(void *), FILE: c12/ex11/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex11/ft_list_find.c function t_list (line 15) | t_list *ft_list_find(t_list *begin_list, void *data_ref, int (*cmp)()) FILE: c12/ex12/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex12/ft_list_remove_if.c function ft_list_remove_if (line 16) | void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)(), FILE: c12/ex13/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex13/ft_list_merge.c function ft_list_merge (line 15) | void ft_list_merge(t_list **begin_list1, t_list *begin_list2) FILE: c12/ex14/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex14/ft_list_sort.c function t_list (line 16) | t_list *ft_merge(t_list *l1, t_list *l2, int (*cmp)()) function ft_list_sort (line 31) | void ft_list_sort(t_list **begin_list, int (*cmp)()) FILE: c12/ex15/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex15/ft_list_reverse_fun.c function ft_list_size (line 16) | static int ft_list_size(t_list *begin_list) function t_list (line 21) | static t_list *ft_list_at(t_list *begin_list, unsigned int nbr) function ft_list_reverse_fun (line 28) | void ft_list_reverse_fun(t_list *begin_list) FILE: c12/ex16/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex16/ft_sorted_list_insert.c function ft_sorted_list_insert (line 15) | void ft_sorted_list_insert(t_list **begin_list, void *data, int (*cmp)()) FILE: c12/ex17/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/ex17/ft_sorted_list_merge.c function ft_sorted_list_insert_elem (line 15) | void ft_sorted_list_insert_elem(t_list **l, t_list *elem, function ft_sorted_list_merge (line 27) | void ft_sorted_list_merge(t_list **begin_list1, t_list *begin_list2, FILE: c12/ft_list.h type t_list (line 16) | typedef struct s_list FILE: c12/main.c function ft_list_print (line 18) | void ft_list_print(t_list *l) function t_list (line 29) | t_list *ft_list_create(void) function main (line 40) | int main(int argc, char **argv) FILE: c13/ex00/btree_create_node.c function t_btree (line 16) | t_btree *btree_create_node(void *item) FILE: c13/ex00/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ex01/btree_apply_prefix.c function btree_apply_prefix (line 15) | void btree_apply_prefix(t_btree *root, void (*applyf)(void *)) FILE: c13/ex01/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ex02/btree_apply_infix.c function btree_apply_infix (line 15) | void btree_apply_infix(t_btree *root, void (*applyf)(void *)) FILE: c13/ex02/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ex03/btree_apply_suffix.c function btree_apply_suffix (line 15) | void btree_apply_suffix(t_btree *root, void (*applyf)(void *)) FILE: c13/ex03/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ex04/btree_insert_data.c function btree_insert_data (line 15) | void btree_insert_data(t_btree **root, void *item, FILE: c13/ex04/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ex05/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ex06/btree_level_count.c function btree_level_count (line 15) | int btree_level_count(t_btree *root) FILE: c13/ex06/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ex07/btree_apply_by_level.c function btree_level_count (line 16) | static int btree_level_count(t_btree *root) function btree_process_level (line 28) | void btree_process_level(t_btree *root, int *t, int level, function btree_apply_by_level (line 45) | void btree_apply_by_level(t_btree *root, void (*applyf)(void *item, FILE: c13/ex07/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/ft_btree.h type t_btree (line 16) | typedef struct s_btree FILE: c13/main.c function btree_clear (line 18) | void btree_clear(t_btree *root) function btree_print (line 27) | void btree_print(t_btree *node, unsigned int deep) function btree_ultimate_print (line 45) | void btree_ultimate_print(void *item, int level, int is_first_elem) function ft_fakestrcmp (line 50) | int ft_fakestrcmp(void *s1, void *s2) function main (line 55) | int main(int argc, char **argv) FILE: other/binary.c function ft_putchar (line 15) | void ft_putchar(char c) function ft_puthex (line 21) | void ft_puthex(unsigned char c) function main (line 32) | int main(void) FILE: other/sorting.c function ft_is_sorted (line 17) | int ft_is_sorted(int *tab, int size) function ft_swap (line 25) | void ft_swap(int *a, int *b) function ft_sort_int_tab (line 34) | void ft_sort_int_tab(int *tab, int size) function ft_bubble_sort (line 54) | void ft_bubble_sort(int *tab, int size) function benchmark (line 64) | void benchmark(char *name, int n, void(*sorting)(int *, int)) function main (line 80) | int main(int argc, char **argv) FILE: rush00/ex00/ft_putchar.c function ft_putchar (line 15) | void ft_putchar(char c) FILE: rush00/ex00/main.c function ft_atoi (line 15) | int ft_atoi(char *str) function main (line 34) | int main(int argc, char **argv) FILE: rush00/ex00/rush00.c function ft_print_line (line 15) | void ft_print_line(char left, char middle, char right, int size) function rush (line 25) | void rush(int x, int y) FILE: rush00/ex00/rush01.c function ft_print_line (line 15) | void ft_print_line(char left, char middle, char right, int size) function rush (line 25) | void rush(int x, int y) FILE: rush00/ex00/rush02.c function ft_print_line (line 15) | void ft_print_line(char left, char middle, char right, int size) function rush (line 25) | void rush(int x, int y) FILE: rush00/ex00/rush03.c function ft_print_line (line 15) | void ft_print_line(char left, char middle, char right, int size) function rush (line 25) | void rush(int x, int y) FILE: rush00/ex00/rush04.c function ft_print_line (line 15) | void ft_print_line(char left, char middle, char right, int size) function rush (line 25) | void rush(int x, int y) FILE: rush01/ex00/ft_backtrack.c function ft_is_valid_value (line 15) | int ft_is_valid_value(char **tab, int x, int y, int size) function ft_backtrack (line 26) | int ft_backtrack(char **tab, int n, int size) function ft_solve (line 51) | int ft_solve(char **tab, int size) FILE: rush01/ex00/ft_check.c function ft_height_col (line 13) | int ft_height_col(char **tab, int x, int delta, int size) function ft_height_row (line 38) | int ft_height_row(char **tab, int y, int delta, int size) function ft_is_duplicate (line 61) | int ft_is_duplicate(char **tab, int x, int y, int size) FILE: rush01/ex00/ft_destroy_tab.c function ft_destroy_tab (line 16) | void ft_destroy_tab(char **tab, int size) FILE: rush01/ex00/ft_get_size.c function ft_is_valid (line 13) | int ft_is_valid(char *str, int size) function ft_get_size (line 29) | int ft_get_size(char *str) FILE: rush01/ex00/ft_print_tab.c function ft_print_tab (line 15) | void ft_print_tab(char **tab, int size) FILE: rush01/ex00/ft_putchar.c function ft_putchar (line 15) | void ft_putchar(char c) FILE: rush01/ex00/ft_putstr.c function ft_putstr (line 15) | void ft_putstr(char *str) FILE: rush01/ex00/main.c function ft_error_message (line 15) | void ft_error_message(void) function main (line 20) | int main(int argc, char **argv) FILE: rush02/ex00/includes/ft_dict.h type t_data (line 18) | typedef struct s_data FILE: rush02/ex00/includes/ft_list.h type t_list (line 16) | typedef struct s_list FILE: rush02/ex00/srcs/ft/ft_atol.c function ft_atol (line 13) | long ft_atol(char *str) FILE: rush02/ex00/srcs/ft/ft_check_args.c function ft_check_args (line 15) | void ft_check_args(int argc, char **argv, char **path, char **value) FILE: rush02/ex00/srcs/ft/ft_is_valid.c function ft_is_valid (line 13) | int ft_is_valid(char *value) FILE: rush02/ex00/srcs/ft/ft_isdigit.c function ft_isdigit (line 13) | int ft_isdigit(char c) FILE: rush02/ex00/srcs/ft/ft_isprint.c function ft_isprint (line 13) | int ft_isprint(char c) FILE: rush02/ex00/srcs/ft/ft_isspace.c function ft_isspace (line 13) | int ft_isspace(char c) FILE: rush02/ex00/srcs/ft/ft_putchar.c function ft_putchar (line 15) | void ft_putchar(char c) FILE: rush02/ex00/srcs/ft/ft_putstr.c function ft_putstr (line 16) | void ft_putstr(char *str) FILE: rush02/ex00/srcs/ft/ft_strlen.c function ft_strlen (line 13) | int ft_strlen(char *str) FILE: rush02/ex00/srcs/ft_dict/ft_dict_clear.c function ft_dict_clear (line 16) | void ft_dict_clear(t_data *d) FILE: rush02/ex00/srcs/ft_dict/ft_dict_cmp.c function ft_dict_cmp (line 15) | int ft_dict_cmp(t_data *d1, t_data *d2) FILE: rush02/ex00/srcs/ft_dict/ft_dict_create.c function t_list (line 17) | t_list *ft_dicterr(t_list *l) function ft_is_valid_line (line 24) | int ft_is_valid_line(char *s, unsigned long *value, char **name) function t_list (line 53) | t_list *ft_dict_check(t_list *dict) function t_list (line 68) | t_list *ft_dict_create(char *content) FILE: rush02/ex00/srcs/ft_dict/ft_dict_create_elem.c function ft_dict_wordlen (line 17) | int ft_dict_wordlen(char *s) function t_data (line 29) | t_data *ft_dict_create_elem(unsigned long value, char *name) FILE: rush02/ex00/srcs/ft_dict/ft_dict_in.c function t_data (line 16) | t_data *ft_dict_in(t_list *dict, unsigned long value) FILE: rush02/ex00/srcs/ft_dict/ft_print.c function ft_putvalue (line 16) | void ft_putvalue(t_list *dict, unsigned long n, int count) function ft_special (line 23) | int ft_special(t_list *dict, unsigned long n, int count) function ft_print_digits (line 37) | int ft_print_digits(t_list *dict, unsigned long n, int count) function ft_print (line 58) | void ft_print(t_list *dict, char *value) FILE: rush02/ex00/srcs/ft_list/ft_create_elem.c function t_list (line 16) | t_list *ft_create_elem(void *data) FILE: rush02/ex00/srcs/ft_list/ft_list_clear.c function ft_list_clear (line 16) | void ft_list_clear(t_list *begin_list, void (*free_fct)()) FILE: rush02/ex00/srcs/ft_list/ft_list_find.c function t_list (line 15) | t_list *ft_list_find(t_list *begin_list, void *data_ref, int (*cmp)()) FILE: rush02/ex00/srcs/ft_list/ft_sorted_list_insert.c function ft_sorted_list_insert (line 15) | void ft_sorted_list_insert(t_list **begin_list, void *data, int (*cmp)()) FILE: rush02/ex00/srcs/main.c function main (line 17) | int main(int argc, char **argv)
Condensed preview — 250 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (299K chars).
[
{
"path": ".gitignore",
"chars": 430,
"preview": "# Prerequisites\n*.d\n\n# Object files\n*.o\n*.ko\n*.obj\n*.elf\n\n# Linker output\n*.ilk\n*.map\n*.exp\n\n# Precompiled Headers\n*.gch"
},
{
"path": "README.md",
"chars": 519,
"preview": "# Piscine 42 - Juillet 2019\n\nToutes les journées sont terminées, il manque un exercice sur le jour 10 de C\n\nLe rush02 es"
},
{
"path": "bsq/Makefile",
"chars": 507,
"preview": "SRCS\t\t= ft_find_biggest_square.c \\\n\t\t\t ft_is_valid.c \\\n\t\t\t ft_file_load.c \\\n\t\t\t main.c\n\nOBJS\t\t= $(addprefix srcs/, ${"
},
{
"path": "bsq/auteur",
"chars": 16,
"preview": "asoursou:gdinet\n"
},
{
"path": "bsq/gen.pl",
"chars": 317,
"preview": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\ndie \"program x y density\" unless (scalar(@ARGV) == 3);\nmy ($x, $y, $density) "
},
{
"path": "bsq/includes/ft.h",
"chars": 1392,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "bsq/srcs/ft_file_load.c",
"chars": 1840,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "bsq/srcs/ft_find_biggest_square.c",
"chars": 1785,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "bsq/srcs/ft_is_valid.c",
"chars": 2423,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "bsq/srcs/main.c",
"chars": 1557,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex00/ft_putchar.c",
"chars": 959,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex01/ft_print_alphabet.c",
"chars": 991,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex02/ft_print_reverse_alphabet.c",
"chars": 999,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex03/ft_print_numbers.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex04/ft_is_negative.c",
"chars": 1025,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex05/ft_print_comb.c",
"chars": 1170,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex06/ft_print_comb2.c",
"chars": 1246,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex07/ft_putnbr.c",
"chars": 1142,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c00/ex08/ft_print_combn.c",
"chars": 1276,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex00/ft_ft.c",
"chars": 929,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex01/ft_ultimate_ft.c",
"chars": 954,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex02/ft_swap.c",
"chars": 962,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex03/ft_div_mod.c",
"chars": 976,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex04/ft_ultimate_div_mod.c",
"chars": 980,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex05/ft_putstr.c",
"chars": 1059,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex06/ft_strlen.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex07/ft_rev_int_tab.c",
"chars": 1116,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c01/ex08/ft_sort_int_tab.c",
"chars": 1300,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex00/ft_strcpy.c",
"chars": 1024,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex01/ft_strncpy.c",
"chars": 1077,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex02/ft_str_is_alpha.c",
"chars": 1055,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex03/ft_str_is_numeric.c",
"chars": 1018,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex04/ft_str_is_lowercase.c",
"chars": 1020,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex05/ft_str_is_uppercase.c",
"chars": 1020,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex06/ft_str_is_printable.c",
"chars": 1021,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex07/ft_strupcase.c",
"chars": 1030,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex08/ft_strlowcase.c",
"chars": 1031,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex09/ft_strcapitalize.c",
"chars": 1439,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex10/ft_strlcpy.c",
"chars": 1291,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex11/ft_putstr_non_printable.c",
"chars": 1276,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c02/ex12/ft_print_memory.c",
"chars": 1764,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c03/ex00/ft_strcmp.c",
"chars": 1000,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c03/ex01/ft_strncmp.c",
"chars": 1039,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c03/ex02/ft_strcat.c",
"chars": 1035,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c03/ex03/ft_strncat.c",
"chars": 1061,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c03/ex04/ft_strstr.c",
"chars": 1156,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c03/ex05/ft_strlcat.c",
"chars": 1296,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c04/ex00/ft_strlen.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c04/ex01/ft_putstr.c",
"chars": 1059,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c04/ex02/ft_putnbr.c",
"chars": 1142,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c04/ex03/ft_atoi.c",
"chars": 1214,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c04/ex04/ft_putnbr_base.c",
"chars": 1614,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c04/ex05/ft_atoi_base.c",
"chars": 1713,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex00/ft_iterative_factorial.c",
"chars": 1015,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex01/ft_recursive_factorial.c",
"chars": 1007,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex02/ft_iterative_power.c",
"chars": 1032,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex03/ft_recursive_power.c",
"chars": 1023,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex04/ft_fibonacci.c",
"chars": 1050,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex05/ft_sqrt.c",
"chars": 1057,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex06/ft_is_prime.c",
"chars": 1088,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex07/ft_find_next_prime.c",
"chars": 1116,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c05/ex08/ft_ten_queens_puzzle.c",
"chars": 1486,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c06/ex00/ft_print_program_name.c",
"chars": 1136,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c06/ex01/ft_print_params.c",
"chars": 1162,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c06/ex02/ft_rev_params.c",
"chars": 1148,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c06/ex03/ft_sort_params.c",
"chars": 1725,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c07/ex00/ft_strdup.c",
"chars": 1289,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c07/ex01/ft_range.c",
"chars": 1131,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c07/ex02/ft_ultimate_range.c",
"chars": 1180,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c07/ex03/ft_strjoin.c",
"chars": 1612,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c07/ex04/ft_convert_base.c",
"chars": 2329,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c07/ex04/ft_convert_base2.c",
"chars": 928,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c07/ex05/ft_split.c",
"chars": 1992,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c08/ex00/ft.h",
"chars": 1073,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c08/ex01/ft_boolean.h",
"chars": 1190,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c08/ex02/ft_abs.h",
"chars": 987,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c08/ex03/ft_point.h",
"chars": 995,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c08/ex04/ft_strs_to_tab.c",
"chars": 1569,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c08/ex05/ft_show_tab.c",
"chars": 1441,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c09/ex00/ft_putchar.c",
"chars": 959,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c09/ex00/ft_putstr.c",
"chars": 1059,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c09/ex00/ft_strcmp.c",
"chars": 1000,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c09/ex00/ft_strlen.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c09/ex00/ft_swap.c",
"chars": 962,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c09/ex00/libft_creator.sh",
"chars": 63,
"preview": "#!/bin/sh\ngcc -Wall -Wextra -Werror -c *.c\nar -rcs libft.a *.o\n"
},
{
"path": "c09/ex01/Makefile",
"chars": 352,
"preview": "SRCS\t\t= ft_putchar.c ft_swap.c ft_putstr.c ft_strlen.c ft_strcmp.c\n\nOBJS\t\t= $(addprefix srcs/, ${SRCS:.c=.o})\n\nNAME\t\t= l"
},
{
"path": "c09/ex02/ft_split.c",
"chars": 1992,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex00/Makefile",
"chars": 371,
"preview": "SRCS\t\t= ft_display_file.c \\\n\t\t\t ft_putstr_fd.c \\\n\t\t\t ft_strlen.c \\\n\t\t\t main.c\n\nOBJS\t\t= ${SRCS:.c=.o}\n\nNAME\t\t= ft_disp"
},
{
"path": "c10/ex00/ft.h",
"chars": 1029,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex00/ft_display_file.c",
"chars": 1161,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex00/ft_putstr_fd.c",
"chars": 1003,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex00/ft_strlen.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex00/main.c",
"chars": 1219,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/Makefile",
"chars": 423,
"preview": "SRCS\t\t= ft_display_file.c \\\n\t\t\t ft_putchar_fd.c \\\n\t\t\t ft_puterr.c \\\n\t\t\t ft_putstr_fd.c \\\n\t\t\t ft_strcmp.c \\\n\t\t\t ft_s"
},
{
"path": "c10/ex01/ft.h",
"chars": 1156,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/ft_display_file.c",
"chars": 1214,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/ft_putchar_fd.c",
"chars": 971,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/ft_puterr.c",
"chars": 1201,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/ft_putstr_fd.c",
"chars": 1003,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/ft_strcmp.c",
"chars": 1000,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/ft_strlen.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex01/main.c",
"chars": 1317,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/Makefile",
"chars": 453,
"preview": "SRCS\t\t= ft_atoi.c \\\n\t\t\t ft_putchar_fd.c \\\n\t\t\t ft_puterr.c \\\n\t\t\t ft_putstr_fd.c \\\n\t\t\t ft_strcmp.c \\\n\t\t\t ft_strlen.c "
},
{
"path": "c10/ex02/ft.h",
"chars": 1310,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_atoi.c",
"chars": 1214,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_putchar_fd.c",
"chars": 971,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_puterr.c",
"chars": 1201,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_putstr_fd.c",
"chars": 1003,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_strcmp.c",
"chars": 1000,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_strlen.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_strncpy.c",
"chars": 1077,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/ft_tail.c",
"chars": 2034,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c10/ex02/main.c",
"chars": 1449,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex00/ft_foreach.c",
"chars": 1002,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex01/ft_map.c",
"chars": 1129,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex02/ft_any.c",
"chars": 1016,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex03/ft_count_if.c",
"chars": 1046,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex04/ft_is_sort.c",
"chars": 1183,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/Makefile",
"chars": 404,
"preview": "SRCS\t\t= ft_atoi.c \\\n\t\t\t ft_op.c \\\n\t\t\t ft_putchar.c \\\n\t\t\t ft_putnbr.c \\\n\t\t\t ft_putstr.c \\\n\t\t\t ft_strlen.c \\\n\t\t\t mai"
},
{
"path": "c11/ex05/ft.h",
"chars": 1287,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/ft_atoi.c",
"chars": 1214,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/ft_op.c",
"chars": 1266,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/ft_putchar.c",
"chars": 959,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/ft_putnbr.c",
"chars": 1111,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/ft_putstr.c",
"chars": 991,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/ft_strlen.c",
"chars": 974,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex05/main.c",
"chars": 1576,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex06/ft_sort_string_tab.c",
"chars": 1566,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c11/ex07/ft_advanced_sort_string_tab.c",
"chars": 1241,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/Makefile",
"chars": 844,
"preview": "SRCS\t\t= ex00/ft_create_elem.c \\\n\t\t\t ex01/ft_list_push_front.c \\\n\t\t\t ex02/ft_list_size.c \\\n\t\t\t ex03/ft_list_last.c \\\n\t"
},
{
"path": "c12/ex00/ft_create_elem.c",
"chars": 1086,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex00/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex01/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex01/ft_list_push_front.c",
"chars": 1091,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex02/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex02/ft_list_size.c",
"chars": 1020,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex03/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex03/ft_list_last.c",
"chars": 1063,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex04/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex04/ft_list_push_back.c",
"chars": 1163,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex05/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex05/ft_list_push_strs.c",
"chars": 1157,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex06/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex06/ft_list_clear.c",
"chars": 1140,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex07/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex07/ft_list_at.c",
"chars": 1073,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex08/ft_list_reverse.c",
"chars": 1177,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex09/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex09/ft_list_foreach.c",
"chars": 1068,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex10/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex10/ft_list_foreach_if.c",
"chars": 1161,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex11/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex11/ft_list_find.c",
"chars": 1123,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex12/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex12/ft_list_remove_if.c",
"chars": 1362,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex13/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex13/ft_list_merge.c",
"chars": 1159,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex14/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex14/ft_list_sort.c",
"chars": 1616,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex15/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex15/ft_list_reverse_fun.c",
"chars": 1571,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex16/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex16/ft_sorted_list_insert.c",
"chars": 1224,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex17/ft_list.h",
"chars": 1054,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ex17/ft_sorted_list_merge.c",
"chars": 1376,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/ft_list.h",
"chars": 2210,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c12/main.c",
"chars": 2042,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/Makefile",
"chars": 560,
"preview": "SRCS\t\t= ex00/btree_create_node.c \\\n\t\t\t ex01/btree_apply_prefix.c \\\n\t\t\t ex02/btree_apply_infix.c \\\n\t\t\t ex03/btree_appl"
},
{
"path": "c13/ex00/btree_create_node.c",
"chars": 1102,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex00/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex01/btree_apply_prefix.c",
"chars": 1109,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex01/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex02/btree_apply_infix.c",
"chars": 1106,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex02/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex03/btree_apply_suffix.c",
"chars": 1109,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex03/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex04/btree_insert_data.c",
"chars": 1195,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex04/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex05/btree_search_item.c",
"chars": 1261,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex05/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex06/btree_level_count.c",
"chars": 1133,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex06/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex07/btree_apply_by_level.c",
"chars": 1823,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ex07/ft_btree.h",
"chars": 1087,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/ft_btree.h",
"chars": 1638,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "c13/main.c",
"chars": 1983,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "other/binary.c",
"chars": 1495,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "other/mkdirs.sh",
"chars": 212,
"preview": "#!/bin/bash\n\nif [ \"$#\" != \"1\" ]; then\n\techo \"error: Invalid argument\"\n\texit\nfi\n\nn=$1 \nwhile [ \"$n\" -ge \"0\" ]; do\n\tif [ \""
},
{
"path": "other/sorting.c",
"chars": 2247,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush00/ex00/ft_putchar.c",
"chars": 959,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush00/ex00/main.c",
"chars": 1352,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush00/ex00/rush00.c",
"chars": 1299,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush00/ex00/rush01.c",
"chars": 1301,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush00/ex00/rush02.c",
"chars": 1299,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush00/ex00/rush03.c",
"chars": 1299,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush00/ex00/rush04.c",
"chars": 1299,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush01/ex00/ft_backtrack.c",
"chars": 1881,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush01/ex00/ft_check.c",
"chars": 1950,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush01/ex00/ft_destroy_tab.c",
"chars": 1027,
"preview": "/* ************************************************************************** */\n/* "
},
{
"path": "rush01/ex00/ft_get_size.c",
"chars": 1358,
"preview": "/* ************************************************************************** */\n/* "
}
]
// ... and 50 more files (download for full content)
About this extraction
This page contains the full source code of the ChuOkupai/piscine42 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 250 files (266.3 KB), approximately 62.6k tokens, and a symbol index with 294 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.