aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Lohoff <flo@rfc822.org>2008-10-04 12:08:33 +0000
committerGuido G√ľnther <agx@sigxcpu.org>2009-01-11 18:08:51 +0100
commit0b1d5fa90eabd98e3d69734ce1cdcef949d3fb30 (patch)
tree2f0eaa8b3e5277ac26f434061b84623d58227256
parent0bbdf7b302e508c78df545b9718c00b32f6b0094 (diff)
Add strcat and memmove for newer libext2fs
-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);