aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arclib/string.c27
-rw-r--r--arclib/string.h3
2 files changed, 29 insertions, 1 deletions
diff --git a/arclib/string.c b/arclib/string.c
index 6ff3cfb..1c424c0 100644
--- a/arclib/string.c
+++ b/arclib/string.c
@@ -2,11 +2,21 @@
* Copyright 1999, 2001 Silicon Graphics, Inc.
* Copyright 2001 Ralf Baechle
* 2001 Guido Guenther <agx@sgixcpu.org>
+ * 2008 Florian Lohoff <flo@rfc822.org>
*/
#include "string.h"
-
#include "stdlib.h"
+char *strcat(char *d, char *s) {
+ char *a;
+
+ for(a=d;*a;a++);
+ for(;*s;*a++=*s++);
+ *a=0x0;
+
+ return d;
+}
+
size_t strlen(const char *s)
{
size_t len = 0;
@@ -110,6 +120,21 @@ void *memcpy(void *s1, const void *s2, size_t n)
return s1;
}
+void *memmove(void *s1, const void *s2, size_t n)
+{
+ char *c1 = (char *) s1;
+ const char *c2 = (const char *) s2;
+
+ if (s1 < s2)
+ return memcpy(s1, s2, n);
+
+ c1+=n;
+ c2+=n;
+
+ while (n-- > 0)
+ *(--c1) = *(--c2);
+ return s1;
+}
void *memset(void *s, int c, size_t n)
{
diff --git a/arclib/string.h b/arclib/string.h
index 53bf111..04cf123 100644
--- a/arclib/string.h
+++ b/arclib/string.h
@@ -1,6 +1,7 @@
/*
* Copyright 1999 Silicon Graphics, Inc.
* 2001 Guido Guenther <agx@sigxcpu.org>
+ * 2008 Florian Lohoff <flo@rfc822.org>
*/
#ifndef _STRING_H_
#define _STRING_H_
@@ -9,6 +10,7 @@
extern size_t strlen(const char *s);
extern int strcmp(const char *s1,const char *s2);
+extern char *strcat(char *d, char *s);
extern int strncmp(const char *s1, const char *s2, size_t n);
extern char *strchr(const char *s, int c);
extern char *strcpy(char *s1, const char *s2);
@@ -16,6 +18,7 @@ extern char *strncpy(char *s1, const char *s2, size_t n);
extern char *strdup(const char *s1);
extern void *memcpy(void *s1, const void *s2, size_t n);
+extern void *memmove(void *s1, const void *s2, size_t n);
extern void *memset(void *s, int c, size_t n);
int memcmp(const void * cs,const void * ct,size_t count);
extern void __bzero(char *p, int len);