diff options
| author | joe <rbousset@42lyon.fr> | 2020-12-01 16:12:02 +0100 | 
|---|---|---|
| committer | joe <rbousset@42lyon.fr> | 2020-12-01 16:12:02 +0100 | 
| commit | 214eae8a55bde34ca412084bebdb378a696152cc (patch) | |
| tree | 70404f68b1b86035fe4835d8cf2da61dcefc5eba /libft | |
| parent | Not quite done (diff) | |
| download | 42-minishell-214eae8a55bde34ca412084bebdb378a696152cc.tar.gz 42-minishell-214eae8a55bde34ca412084bebdb378a696152cc.tar.bz2 42-minishell-214eae8a55bde34ca412084bebdb378a696152cc.tar.xz 42-minishell-214eae8a55bde34ca412084bebdb378a696152cc.tar.zst 42-minishell-214eae8a55bde34ca412084bebdb378a696152cc.zip | |
Bav
Diffstat (limited to '')
| -rw-r--r-- | libft/Makefile | 1 | ||||
| -rw-r--r-- | libft/include/libft.h | 2 | ||||
| -rw-r--r-- | libft/src/ft_substr_s.c | 18 | 
3 files changed, 21 insertions, 0 deletions
| diff --git a/libft/Makefile b/libft/Makefile index 5498983..4024b3e 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -48,6 +48,7 @@ SRCS_NAME	+= ft_calloc.c  SRCS_NAME	+= ft_nrealloc.c  SRCS_NAME	+= ft_strdup.c  SRCS_NAME	+= ft_substr.c +SRCS_NAME	+= ft_substr_s.c  SRCS_NAME	+= ft_strjoin.c  SRCS_NAME	+= ft_strtrim.c  SRCS_NAME	+= ft_split.c diff --git a/libft/include/libft.h b/libft/include/libft.h index def0a31..47992c0 100644 --- a/libft/include/libft.h +++ b/libft/include/libft.h @@ -91,6 +91,8 @@ void					ft_memdel(void **ptr);  void					ft_delwords(char **words);  void					ft_itoa_s(char str[], long n);  void					ft_uitoa_s(char str[], unsigned long n); +void					ft_substr_s(char str[], const char *s, +									unsigned int start, size_t len);  void					*ft_memset(void *b, int c, size_t len);  void					*ft_memcpy(void *dst, const void *src, size_t n);  void					*ft_memccpy(void *dst, const void *src, diff --git a/libft/src/ft_substr_s.c b/libft/src/ft_substr_s.c new file mode 100644 index 0000000..2bf4dd4 --- /dev/null +++ b/libft/src/ft_substr_s.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/*                                                                            */ +/*                                                        :::      ::::::::   */ +/*   ft_substr_s.c                                      :+:      :+:    :+:   */ +/*                                                    +:+ +:+         +:+     */ +/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */ +/*                                                +#+#+#+#+#+   +#+           */ +/*   Created: 2020/02/14 17:07:15 by rbousset          #+#    #+#             */ +/*   Updated: 2020/02/14 17:07:15 by rbousset         ###   ########lyon.fr   */ +/*                                                                            */ +/* ************************************************************************** */ + +#include <libft.h> + +void	ft_substr_s(char str[], const char *s, unsigned int start, size_t len) +{ +	ft_strlcpy(str, s + start, len + 1); +} | 
