source: trunk/sys/dietlibc/memmem.c @ 21

Last change on this file since 21 was 1, checked in by alain, 8 years ago

First import

File size: 307 bytes
Line 
1#define _GNU_SOURCE 23
2#include <sys/types.h>
3#include <string.h>
4
5void *memmem(const void* haystack, size_t hl, const void* needle, size_t nl) {
6  int i;
7  if (nl>hl) return 0;
8  for (i=hl-nl+1; i; --i) {
9    if (!memcmp(haystack,needle,nl))
10      return (char*)haystack;
11    ++haystack;
12  }
13  return 0;
14}
Note: See TracBrowser for help on using the repository browser.