*** empty log message ***

svn path=/trunk/; revision=4777
This commit is contained in:
Hartmut Birr 2003-05-27 19:49:14 +00:00
parent 3d7e102b13
commit fac54407bb
14 changed files with 0 additions and 234 deletions

View file

@ -1,9 +0,0 @@
#include <string.h>
void *
_memccpy (void *to, const void *from,int c,size_t count)
{
memcpy(to,from,count);
return memchr(to,c,count);
}

View file

@ -1,17 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
void *
memchr(const void *s, int c, size_t n)
{
if (n)
{
const char *p = s;
do {
if (*p++ == c)
return (void *)(p-1);
} while (--n != 0);
}
return 0;
}

View file

@ -1,17 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
int
memcmp(const void *s1, const void *s2, size_t n)
{
if (n != 0)
{
const unsigned char *p1 = s1, *p2 = s2;
do {
if (*p1++ != *p2++)
return (*--p1 - *--p2);
} while (--n != 0);
}
return 0;
}

View file

@ -1,16 +0,0 @@
#include <string.h>
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
void *
memcpy (void *to, const void *from, size_t count)
{
register char *f = (char *)from;
register char *t = (char *)to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
return to;
}

View file

@ -1,36 +0,0 @@
#include <string.h>
void * memmove(void *dest,const void *src,size_t count)
{
char *char_dest = (char *)dest;
char *char_src = (char *)src;
if ((char_dest <= char_src) || (char_dest >= (char_src+count)))
{
/* non-overlapping buffers */
while(count > 0)
{
*char_dest = *char_src;
char_dest++;
char_src++;
count--;
}
}
else
{
/* overlaping buffers */
char_dest = (char *)dest + count - 1;
char_src = (char *)src + count - 1;
while(count > 0)
{
*char_dest = *char_src;
char_dest--;
char_src--;
count--;
}
}
return dest;
}

View file

@ -1,13 +0,0 @@
#include <string.h>
void * memset(void *src,int val,size_t count)
{
char *char_src = (char *)src;
while(count>0) {
*char_src = val;
char_src++;
count--;
}
return src;
}

View file

@ -1,12 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
char *
strcat(char *s, const char *append)
{
char *save = s;
for (; *s; ++s);
while ((*s++ = *append++));
return save;
}

View file

@ -1,21 +0,0 @@
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
char *strchr(const char *s, int c);
char *strchr(const char *s, int c)
{
char cc = c;
while (*s)
{
if (*s == cc)
return (char *)s;
s++;
}
if (cc == 0)
return (char *)s;
return 0;
}

View file

@ -1,15 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
int
strcmp(const char *s1, const char *s2)
{
while (*s1 == *s2)
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return *(unsigned const char *)s1 - *(unsigned const char *)(s2);
}

View file

@ -1,10 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
char* strcpy(char *to, const char *from);
char* strcpy(char *to, const char *from)
{
char *save = to;
for (; (*to = *from); ++from, ++to);
return save;
}

View file

@ -1,14 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
size_t
strlen(const char *str)
{
const char *s;
if (str == 0)
return 0;
for (s = str; *s; ++s);
return s-str;
}

View file

@ -1,22 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
char *
strncat(char *dst, const char *src, size_t n)
{
if (n != 0)
{
char *d = dst;
const char *s = src;
while (*d != 0)
d++;
do {
if ((*d = *s++) == 0)
break;
d++;
} while (--n != 0);
*d = 0;
}
return dst;
}

View file

@ -1,18 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
int
strncmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
return 0;
do {
if (*s1 != *s2++)
return *(unsigned const char *)s1 - *(unsigned const char *)--s2;
if (*s1++ == 0)
break;
} while (--n != 0);
return 0;
}

View file

@ -1,14 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
size_t
strnlen(const char *str, size_t count)
{
const char *s;
if (str == 0)
return 0;
for (s = str; *s && count; ++s, count--);
return s-str;
}