summaryrefslogtreecommitdiffstats
path: root/libft/src/ft_strclen.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-04 14:28:35 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-04 14:28:35 +0200
commitd1ee0c0e55f75432da026f5e0e7cf15cee6918da (patch)
treef0ba3ebf5f6ba8d2ce093938f36602d64e7b43ff /libft/src/ft_strclen.c
parentUnset is fine (diff)
download42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.gz
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.bz2
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.xz
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.zst
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.zip
New libft function strclen, bug fix
Diffstat (limited to 'libft/src/ft_strclen.c')
-rw-r--r--libft/src/ft_strclen.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libft/src/ft_strclen.c b/libft/src/ft_strclen.c
new file mode 100644
index 0000000..fe88ca5
--- /dev/null
+++ b/libft/src/ft_strclen.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strclen.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:07:12 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:07:12 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <stddef.h>
+
+size_t
+ ft_strclen(const char *s, int c)
+{
+ const char *ptr;
+
+ ptr = s;
+ while (ptr != NULL && *ptr != '\0' && *ptr != c)
+ ptr++;
+ return (ptr - s);
+}