aboutsummaryrefslogtreecommitdiff
path: root/ft_strnstr.c
diff options
context:
space:
mode:
authorCabergs Charles <cacharle@w-r4-p5.s19.be>2019-10-07 11:35:51 +0200
committerCabergs Charles <cacharle@w-r4-p5.s19.be>2019-10-07 11:35:51 +0200
commit10b4feb67c8af2b099dabd66f948b02e180bae0d (patch)
treee97d3d4701a79ac2087534dd350225e556127a76 /ft_strnstr.c
parent9a2b208985ac7d4644c718ada74770b98eeb4598 (diff)
downloadlibft-10b4feb67c8af2b099dabd66f948b02e180bae0d.tar.gz
libft-10b4feb67c8af2b099dabd66f948b02e180bae0d.tar.bz2
libft-10b4feb67c8af2b099dabd66f948b02e180bae0d.zip
Normed everything
Created a few dummy functions to resolve functions having more than 25 lines.
Diffstat (limited to 'ft_strnstr.c')
-rw-r--r--ft_strnstr.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/ft_strnstr.c b/ft_strnstr.c
index 4109f2d..5f4bb91 100644
--- a/ft_strnstr.c
+++ b/ft_strnstr.c
@@ -1,24 +1,34 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strnstr.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 10:25:13 by cacharle #+# #+# */
+/* Updated: 2019/10/07 10:26:11 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
#include <stdlib.h>
#include <string.h>
#include "libft.h"
-#include <stdio.h>
-char *ft_strnstr(const char *big, const char *little, size_t len)
+char *ft_strnstr(const char *big, const char *little, size_t len)
{
- size_t i;
- size_t j;
- size_t little_len;
+ size_t i;
+ size_t j;
+ size_t little_len;
- little_len = ft_strlen(little);
+ little_len = ft_strlen(little);
if (little_len == 0 || len == 0)
return ((char*)big);
- i = 0;
+ i = 0;
while (i < len && big[i])
{
j = 0;
while (i + j < len && little[j] && big[i + j])
{
- /* printf(" %lu", i + j); */
if (little[j] != big[i + j])
break ;
j++;