norm: splitted functions in main into appropriate file
Moved lstdelenvelem & env2lst to ms_env.c Normed out files
This commit is contained in:
28
libft/srcs/ft_strrnchr.c
Normal file
28
libft/srcs/ft_strrnchr.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strrnchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2018/05/16 12:05:03 by tmaze #+# #+# */
|
||||
/* Updated: 2018/05/16 12:32:26 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_strrnchr(const char *s, int c, int n)
|
||||
{
|
||||
int s_len;
|
||||
char *tmp;
|
||||
|
||||
s_len = ft_strlen(s);
|
||||
tmp = (char*)s;
|
||||
n = (s_len < n) ? s_len : n;
|
||||
s_len = s_len - n;
|
||||
while (n >= 0)
|
||||
if (tmp[s_len + n--] == c)
|
||||
return (&tmp[s_len + n + 1]);
|
||||
return (NULL);
|
||||
}
|
Reference in New Issue
Block a user