updated libft

This commit is contained in:
djonker 2023-10-26 18:06:04 +02:00
parent fec3be150c
commit 51ffcbb50f
639 changed files with 4055 additions and 3562 deletions

View File

@ -1,18 +1,18 @@
# **************************************************************************** #
# #
# :::::::: #
# Makefile |o_o || | #
# Makefile :+: :+: #
# +:+ #
# By: djonker <marvin@codam.nl> +#+ #
# +#+ #
# Created: 2020/10/27 15:02:02 by djonker #+# #+# #
# Updated: 2023/03/20 19:00:18 by houtworm \___)=(___/ #
# Updated: 2023/10/25 05:28:15 by djonker ######## odam.nl #
# #
# **************************************************************************** #
NAME =libft.a
CC =gcc
FC =-Wall -Werror -Wextra -fsanitize=address
FC =-Wall -Werror -Wextra# -g -fsanitize=address
FAR =ar -rs
RM =rm -f
SRC =src/ft_atoi.c \
@ -139,12 +139,25 @@ SRC =src/ft_atoi.c \
src/ft_ldeclen.c \
src/ft_isallbyte.c \
src/ft_getuser.c \
src/ft_gethome.c \
src/ft_getpwd.c \
src/ft_getos.c \
src/ft_gethost.c \
src/ft_vastrjoin.c \
src/ft_vafree.c \
src/ft_intrchr.c \
src/ft_system.c \
src/ft_getpaths.c \
src/ft_abspathcmd.c
src/ft_getenvval.c \
src/ft_seminit.c \
src/ft_semwait.c \
src/ft_semfree.c \
src/ft_gettimemsdate.c \
src/ft_mkdir.c \
src/ft_rmdir.c \
src/ft_abspathcmd.c \
src/ft_cppbzero.c \
src/ft_cpptostr.c
BSRC =src/ft_lstadd_back.c \
src/ft_lstadd_front.c \
src/ft_lstclear.c \

20
libft.h
View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* libft.h |o_o || | */
/* libft.h :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/11 16:02:53 by djonker #+# #+# */
/* Updated: 2023/03/20 19:01:40 by houtworm \___)=(___/ */
/* Updated: 2023/10/25 07:05:24 by djonker ######## odam.nl */
/* */
/* ************************************************************************** */
@ -17,6 +17,7 @@
# include <stdlib.h>
# include <stdarg.h>
# include <fcntl.h>
# include <sys/stat.h>
# include <sys/wait.h>
typedef struct s_list
@ -163,10 +164,23 @@ char *ft_dtoa(long double n);
int ft_isallbyte(char *str, char byte);
char *ft_getpwd(char **envp, int slash);
char *ft_getuser(char **envp);
char *ft_gethome(char **envp);
char *ft_getos(void);
char *ft_gethost(void);
char *ft_vastrjoin(int n, ...);
void ft_vafree(int n, ...);
int ft_intrchr(const char *s, int c);
char *ft_system(char *command, char **envp);
char *ft_system(char *command, char **envp, char *file);
char **ft_getpaths(char **envp, int i);
char *ft_getenvval(char **envp, char *var);
char *ft_abspathcmd(char **paths, char *command);
void ft_cppbzero(char **cpp);
char *ft_cpptostr(char **cpp);
int ft_seminit(char *file, int number);
int ft_semwait(char *file);
int ft_semfree(char *file);
long long ft_gettimemsdate(char **envp, char *file);
int ft_mkdir(char *dirname, char **envp);
int ft_rmdir(char *dirname, char **envp);
#endif

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* .--. _ */
/* ft_abspathcmd.c |o_o || | */
/* |:_/ || |_ _ ___ __ */
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */
/* Created: 2023/03/20 16:39:22 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/03/20 18:58:08 by houtworm \___)=(___/ */
/* :::::::: */
/* ft_abspathcmd.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/03/20 16:39:22 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:55:36 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -18,6 +18,8 @@ char *ft_abspathcmd(char **paths, char *cmd)
int i;
i = 0;
if (!paths)
return (cmd);
if (cmd && ft_chrstr('/', cmd))
absolute = ft_strdup(cmd);
else

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_around.c :+: :+: :+: */
/* ft_around.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 07:26:00 by djonker #+# #+# */
/* Updated: 2023/02/07 00:42:07 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:37 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_arrlen.c :+: :+: :+: */
/* ft_arrlen.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/06 17:38:27 by djonker #+# #+# */
/* Updated: 2023/02/07 00:42:08 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:38 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_atodec.c :+: :+: :+: */
/* ft_atodec.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 05:48:34 by djonker #+# #+# */
/* Updated: 2023/02/07 00:42:08 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:41 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_atof.c :+: :+: :+: */
/* ft_atof.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 05:48:34 by djonker #+# #+# */
/* Updated: 2023/02/07 00:42:08 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:42 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* ft_atoi.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:08:11 by djonker #+# #+# */
/* Updated: 2023/02/07 00:42:09 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:42 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_atol.c :+: :+: :+: */
/* ft_atol.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:08:11 by djonker #+# #+# */
/* Updated: 2023/02/07 00:36:46 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:43 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_atou.c |o_o || | */
/* ft_atou.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:08:11 by djonker #+# #+# */
/* Updated: 2023/03/05 21:13:18 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:55:43 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_bitswap.c :+: :+: :+: */
/* ft_bitswap.c :+: :+: */
/* +:+ */
/* By: djonker <djonker@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2021/05/17 06:29:44 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:18 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:44 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_btoi.c :+: :+: :+: */
/* ft_btoi.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/18 13:44:56 by djonker #+# #+# */
/* Updated: 2023/02/07 00:36:46 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:44 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_bzero.c |o_o || | */
/* ft_bzero.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 08:35:25 by djonker #+# #+# */
/* Updated: 2023/02/22 02:01:25 by djonker \___)=(___/ */
/* Updated: 2023/10/18 16:55:45 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_calloc.c |o_o || | */
/* ft_calloc.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 21:20:32 by djonker #+# #+# */
/* Updated: 2023/02/25 16:18:01 by houtworm \___)=(___/ */
/* Updated: 2023/10/25 05:52:55 by djonker ######## odam.nl */
/* */
/* ************************************************************************** */
@ -25,7 +25,7 @@ void *ft_calloc(size_t count, size_t size)
}
p = malloc(count * size);
if (p == NULL)
return (0x0);
exit(1);
if (p)
{
t = p;

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_chrstr.c :+: :+: :+: */
/* ft_chrstr.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/15 02:30:48 by djonker #+# #+# */
/* Updated: 2023/02/07 00:36:47 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:55:46 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_cntarg.c |o_o || | */
/* +:+ +:+ +:+ */
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/07 00:38:26 by houtworm #+# #+# */
/* Updated: 2023/02/21 01:43:17 by houtworm \___)=(___/ */
/* :::::::: */
/* ft_cntarg.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/02/07 00:38:26 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:56:12 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* .--. _ */
/* ft_cntchr.c :+: :+: :+: */
/* |:_/ || |_ _ ___ __ */
/* By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */
/* Created: 2021/06/11 17:23:36 by djonker /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/02/07 00:38:41 by houtworm ### ########.fr */
/* :::::::: */
/* ft_cntchr.c :+: :+: */
/* +:+ */
/* By: djonker <djonker@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2021/06/11 17:23:36 by djonker #+# #+# */
/* Updated: 2023/10/18 16:56:12 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_cntwrd.c :+: :+: :+: */
/* ft_cntwrd.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/21 20:37:04 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:43 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:13 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_cntwrds.c :+: :+: :+: */
/* ft_cntwrds.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/21 20:37:04 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:44 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:13 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

25
src/ft_cppbzero.c Normal file
View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_cppbzero.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/09/18 12:17:56 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:56:14 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../libft.h"
void ft_cppbzero(char **cpp)
{
int i;
i = 0;
while (cpp[i])
{
ft_bzero(cpp[i], ft_strlen(cpp[i]));
i++;
}
}

36
src/ft_cpptostr.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_cpptostr.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/09/18 12:17:01 by houtworm #+# #+# */
/* Updated: 2023/10/19 00:19:29 by djonker ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../libft.h"
char *ft_cpptostr(char **cpp)
{
int i;
char *ret;
char *temp;
char *temp2;
i = 1;
if (cpp[0])
temp2 = ft_strdup(cpp[0]);
while (cpp[i])
{
temp = ft_strjoin(temp2, cpp[i]);
free(temp2);
temp2 = ft_strdup(temp);
free(temp);
i++;
}
ret = ft_strdup(temp2);
free(temp2);
return (ret);
}

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_ddtoi.c :+: :+: :+: */
/* ft_ddtoi.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 01:24:28 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:44 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:15 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_declen.c :+: :+: :+: */
/* ft_declen.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 04:29:09 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:45 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:15 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_dtoa.c :+: :+: :+: */
/* ft_dtoa.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 03:46:17 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:46 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:16 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_dtoh.c :+: :+: :+: */
/* ft_dtoh.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 02:22:34 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:47 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:16 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_factor.c :+: :+: :+: */
/* ft_factor.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/01 04:03:20 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:48 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:25 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_fczero.c :+: :+: :+: */
/* ft_fczero.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 04:29:09 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:49 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:25 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_flolen.c :+: :+: :+: */
/* ft_flolen.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 04:00:01 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:50 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:26 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_fnprim.c :+: :+: :+: */
/* ft_fnprim.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/01 04:42:24 by djonker #+# #+# */
/* Updated: 2023/02/07 00:38:50 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:26 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_frearr.c :+: :+: :+: */
/* ft_frearr.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/12/11 21:54:13 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:42 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:27 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_frenarr.c :+: :+: :+: */
/* ft_frenarr.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/12/11 21:54:13 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:47 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:27 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_fround.c :+: :+: :+: */
/* ft_fround.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 07:42:16 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:49 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:28 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_ftoa.c :+: :+: :+: */
/* ft_ftoa.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 03:46:17 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:49 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:28 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_ftoi.c :+: :+: :+: */
/* ft_ftoi.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 21:30:30 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:50 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:56:29 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

34
src/ft_getenvval.c Normal file
View File

@ -0,0 +1,34 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_getenvval.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/02/17 02:40:22 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:56:29 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../libft.h"
char *ft_getenvval(char **envp, char *var)
{
char *value;
int i;
char *temp;
temp = ft_strjoin(var, "=");
i = -1;
while (envp[++i])
if (ft_strncmp(envp[i], temp, ft_strlen(temp)) == 0)
break ;
if (!envp[i])
{
free(temp);
return (NULL);
}
value = ft_substr(envp[i], ft_strlen(temp), ft_strlen(envp[i]));
free(temp);
return (value);
}

28
src/ft_gethome.c Normal file
View File

@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_gethome.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/02/17 02:40:22 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:56:39 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../libft.h"
char *ft_gethome(char **envp)
{
char *home;
int i;
i = -1;
while (envp[++i])
if (ft_strncmp(envp[i], "HOME=", 5) == 0)
break ;
if (!envp[i])
return (NULL);
home = ft_substr(envp[i], 5, ft_strlen(envp[i]));
return (home);
}

27
src/ft_gethost.c Normal file
View File

@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_gethost.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/09 07:45:51 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:03 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../../minishell.h"
char *ft_gethost(void)
{
int fd;
char *line;
char *host;
fd = open("/etc/hostname", O_RDONLY);
get_next_line(fd, &line);
host = ft_strdup(line);
free(line);
close(fd);
return (host);
}

60
src/ft_getos.c Normal file
View File

@ -0,0 +1,60 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_getos.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/09 07:45:51 by houtworm #+# #+# */
/* Updated: 2023/10/19 00:22:24 by djonker ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../../minishell.h"
char *ft_getosfromline(char *line)
{
int ret;
char *os;
int i;
ret = 0;
i = 0;
while (line[i] != '\"')
i++;
i++;
os = ft_calloc(ft_strlen(line), 8);
while (line[i] != ' ' && line[i] != '\"')
{
os[ret] = line[i];
ret++;
i++;
}
os[ret] = '\0';
return (os);
}
char *ft_getos(void)
{
int fd;
char *line;
int ret;
char *os;
fd = open("/etc/os-release", O_RDONLY);
ret = 1;
while (ret > 0)
{
ret = get_next_line(fd, &line);
if (!ft_strncmp(line, "PRETTY_NAME:", 7))
{
os = ft_getosfromline(line);
free(line);
close(fd);
return (os);
}
free (line);
}
close(fd);
return (NULL);
}

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* .--. _ */
/* ft_getpaths.c |o_o || | */
/* |:_/ || |_ _ ___ __ */
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */
/* Created: 2023/03/20 16:39:22 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/03/20 18:57:24 by houtworm \___)=(___/ */
/* :::::::: */
/* ft_getpaths.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/03/20 16:39:22 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:06 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* .--. _ */
/* ft_getpwd.c |o_o || | */
/* |:_/ || |_ _ ___ __ */
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */
/* Created: 2023/02/17 02:40:22 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/02/17 02:55:28 by houtworm \___)=(___/ */
/* :::::::: */
/* ft_getpwd.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/02/17 02:40:22 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:07 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

24
src/ft_gettimemsdate.c Normal file
View File

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_gettimemsdate.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/17 20:10:03 by houtworm #+# #+# */
/* Updated: 2023/10/19 00:04:18 by djonker ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../libft.h"
long long ft_gettimemsdate(char **envp, char *file)
{
char *date;
long long currenttime;
date = ft_system("date +%s%3N", envp, file);
currenttime = ft_atol(date);
free(date);
return (currenttime);
}

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* .--. _ */
/* ft_getpwd.c |o_o || | */
/* |:_/ || |_ _ ___ __ */
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */
/* Created: 2023/02/17 02:40:22 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/02/17 02:55:28 by houtworm \___)=(___/ */
/* :::::::: */
/* ft_getuser.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/02/17 02:40:22 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:09 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_htod.c :+: :+: :+: */
/* ft_htod.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 03:18:45 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:51 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:10 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_htoi.c :+: :+: :+: */
/* ft_htoi.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 01:24:28 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:52 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:11 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_iftof.c :+: :+: :+: */
/* ft_iftof.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 22:27:51 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:52 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:12 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_intlen.c :+: :+: :+: */
/* ft_intlen.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 02:04:46 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:54 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:14 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_intrchr.c |o_o || | */
/* ft_intrchr.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/11 16:14:50 by djonker #+# #+# */
/* Updated: 2023/03/20 14:48:22 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:15 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* .--. _ */
/* ft_isallbyte.c |o_o || | */
/* |:_/ || |_ _ ___ __ */
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */
/* Created: 2023/02/21 01:43:42 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/02/21 01:43:44 by houtworm \___)=(___/ */
/* :::::::: */
/* ft_isallbyte.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/02/21 01:43:42 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:16 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -14,6 +14,8 @@
int ft_isallbyte(char *str, char byte)
{
if (!str)
return (1);
while (*str == byte)
str++;
if (!*str)

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isalnum.c :+: :+: :+: */
/* ft_isalnum.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/11 15:56:37 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:54 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:16 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isalpha.c :+: :+: :+: */
/* ft_isalpha.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:10:41 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:55 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:17 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isascii.c :+: :+: :+: */
/* ft_isascii.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:10:41 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:56 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:18 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isdigit.c :+: :+: :+: */
/* ft_isdigit.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:10:41 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:56 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:19 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_islneg.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/25 11:39:27 by houtworm #+# #+# */
/* Updated: 2023/02/07 00:39:57 by houtworm ### ########.fr */
/* :::::::: */
/* ft_islneg.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2022/12/25 11:39:27 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:20 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_islowc.c :+: :+: :+: */
/* ft_islowc.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/04/13 17:57:31 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:58 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:21 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isneg.c :+: :+: :+: */
/* ft_isneg.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 03:38:29 by djonker #+# #+# */
/* Updated: 2023/02/07 00:39:59 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:21 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isodigit.c :+: :+: :+: */
/* ft_isodigit.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/06 17:19:46 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:00 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:22 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isprim.c :+: :+: :+: */
/* ft_isprim.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/01 04:32:30 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:00 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:23 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isprint.c :+: :+: :+: */
/* ft_isprint.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 19:10:41 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:01 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:24 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isuppc.c :+: :+: :+: */
/* ft_isuppc.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* +#+ */
/* Created: 2021/04/13 17:57:31 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:02 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:25 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_isxdigit.c :+: :+: :+: */
/* ft_isxdigit.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/06 17:19:46 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:03 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:27 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itoa.c :+: :+: :+: */
/* ft_itoa.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/12 23:20:24 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:04 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:28 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itob.c |o_o || | */
/* ft_itob.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/04 04:42:54 by djonker #+# #+# */
/* Updated: 2023/03/07 05:07:51 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:33 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itoba.c :+: :+: :+: */
/* ft_itoba.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/04 04:42:54 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:05 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:29 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itodd.c :+: :+: :+: */
/* ft_itodd.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:07 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:34 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itof.c :+: :+: :+: */
/* ft_itof.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 22:18:50 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:07 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:35 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itoh.c |o_o || | */
/* ft_itoh.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
/* Updated: 2023/03/05 20:33:06 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:36 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itohx.c :+: :+: :+: */
/* ft_itohx.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:09 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:47 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itoo.c :+: :+: :+: */
/* ft_itoo.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/01 01:30:17 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:25 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:47 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itooa.c :+: :+: :+: */
/* ft_itooa.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/01 01:30:17 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:25 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:47 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_itozh.c |o_o || | */
/* ft_itozh.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
/* Updated: 2023/03/07 05:15:26 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:48 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ldeclen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/25 11:30:37 by houtworm #+# #+# */
/* Updated: 2023/02/07 00:40:29 by houtworm ### ########.fr */
/* :::::::: */
/* ft_ldeclen.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2022/12/25 11:30:37 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:48 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lftoa.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/25 11:38:35 by houtworm #+# #+# */
/* Updated: 2023/02/07 00:40:29 by houtworm ### ########.fr */
/* :::::::: */
/* ft_lftoa.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2022/12/25 11:38:35 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:49 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lftoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/25 11:30:20 by houtworm #+# #+# */
/* Updated: 2023/02/07 00:40:29 by houtworm ### ########.fr */
/* :::::::: */
/* ft_lftoi.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2022/12/25 11:30:20 by houtworm #+# #+# */
/* Updated: 2023/10/18 16:59:49 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lincpy.c :+: :+: :+: */
/* ft_lincpy.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/04 21:40:35 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:29 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:50 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_linlcpy.c :+: :+: :+: */
/* ft_linlcpy.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/04 21:40:35 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:50 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_linlen.c :+: :+: :+: */
/* ft_linlen.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/04 15:49:15 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:51 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstadd_back.c |o_o || | */
/* ft_lstadd_back.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 18:48:54 by djonker #+# #+# */
/* Updated: 2023/03/03 19:09:28 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:51 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstadd_front.c |o_o || | */
/* ft_lstadd_front.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 04:38:37 by djonker #+# #+# */
/* Updated: 2023/03/03 16:12:15 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:52 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstclear.c |o_o || | */
/* ft_lstclear.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 19:12:41 by djonker #+# #+# */
/* Updated: 2023/03/04 01:50:59 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:52 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstdelone.c :+: :+: :+: */
/* ft_lstdelone.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 19:06:46 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:31 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:52 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstiter.c |o_o || | */
/* ft_lstiter.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 19:15:47 by djonker #+# #+# */
/* Updated: 2023/03/04 15:30:35 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:53 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstlast.c |o_o || | */
/* ft_lstlast.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 18:45:02 by djonker #+# #+# */
/* Updated: 2023/03/03 18:08:43 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:53 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstmap.c |o_o || | */
/* ft_lstmap.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 19:30:13 by djonker #+# #+# */
/* Updated: 2023/03/04 16:07:56 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:54 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* ft_lstnew.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 04:38:37 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:35 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:54 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_lstsize.c |o_o || | */
/* ft_lstsize.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 18:27:52 by djonker #+# #+# */
/* Updated: 2023/03/03 17:20:28 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:55 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_ltoa.c :+: :+: :+: */
/* ft_ltoa.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/12 23:20:24 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:35 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:55 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_luilen.c :+: :+: :+: */
/* ft_luilen.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 02:04:46 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:35 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:56 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_malstr.c :+: :+: :+: */
/* ft_malstr.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/29 15:21:11 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:36 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:56 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_malstrs.c :+: :+: :+: */
/* ft_malstrs.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/29 15:21:11 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:36 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:57 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_max.c :+: :+: :+: */
/* ft_max.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/08 04:26:11 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:36 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:57 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* ft_memccpy.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 08:38:54 by djonker #+# #+# */
/* Updated: 2023/02/24 20:52:37 by houtworm ### ########.fr */
/* Updated: 2023/10/18 16:59:57 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memchr.c |o_o || | */
/* ft_memchr.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 08:35:56 by djonker #+# #+# */
/* Updated: 2023/02/27 05:12:02 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:58 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memcmp.c |o_o || | */
/* ft_memcmp.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 08:41:32 by djonker #+# #+# */
/* Updated: 2023/02/28 15:22:59 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:58 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memcpy.c |o_o || | */
/* ft_memcpy.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/11 16:13:52 by djonker #+# #+# */
/* Updated: 2023/03/01 18:06:11 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:59 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memmove.c |o_o || | */
/* ft_memmove.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 08:45:04 by djonker #+# #+# */
/* Updated: 2023/03/03 12:19:05 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 16:59:59 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_memset.c |o_o || | */
/* ft_memset.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/01 08:42:45 by djonker #+# #+# */
/* Updated: 2023/04/14 17:37:45 by houtworm \___)=(___/ */
/* Updated: 2023/10/18 17:00:00 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
@ -14,7 +14,7 @@
void *ft_memset(void *s, int c, size_t n)
{
char *p;
char *p;
if (!s)
return (s);

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_min.c :+: :+: :+: */
/* ft_min.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/08 04:26:11 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:40 by houtworm ### ########.fr */
/* Updated: 2023/10/18 17:00:00 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

42
src/ft_mkdir.c Normal file
View File

@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_mkdir.c :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/17 20:10:59 by houtworm #+# #+# */
/* Updated: 2023/10/18 17:00:01 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_mkdir(char *dirname, char **envp)
{
char **cmd;
char *command;
char **paths;
int pid;
int status;
paths = ft_getpaths(envp, 0);
if (!paths)
return (1);
command = ft_abspathcmd(paths, "mkdir");
cmd = ft_calloc(3, 8);
cmd[0] = ft_strdup("mkdir");
cmd[1] = ft_strdup(dirname);
cmd[2] = NULL;
pid = fork();
if (pid == 0)
{
execve(command, cmd, envp);
exit(1);
}
waitpid(pid, &status, 0);
free(command);
ft_frearr(paths);
ft_frearr(cmd);
return (WEXITSTATUS(status));
}

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_otoi.c :+: :+: :+: */
/* ft_otoi.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 16:54:01 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:40 by houtworm ### ########.fr */
/* Updated: 2023/10/18 17:00:01 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_power.c :+: :+: :+: */
/* ft_power.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/01/31 01:18:37 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:40 by houtworm ### ########.fr */
/* Updated: 2023/10/18 17:00:02 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */

Some files were not shown because too many files have changed in this diff Show More