aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-31 17:28:49 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-31 17:28:49 +0100
commitb77ef684b07bcd91c168b15f71611786dd5a3377 (patch)
tree43ddd56254da4940023638639053be74ecddbe69
parentd2d7ebbea19d55fb2a292ca766d95b197691b941 (diff)
downloadrpi-MMU-example-b77ef684b07bcd91c168b15f71611786dd5a3377.tar.gz
rpi-MMU-example-b77ef684b07bcd91c168b15f71611786dd5a3377.zip
add strcat
-rw-r--r--strings.c15
-rw-r--r--strings.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/strings.c b/strings.c
index b518388..c741938 100644
--- a/strings.c
+++ b/strings.c
@@ -106,3 +106,18 @@ void *memset(void *s, int c, size_t n)
return s;
}
+char *strcat(char *dst, const char *src)
+{
+ char *where_to_append;
+
+ for (where_to_append = dst; *where_to_append; where_to_append++);
+
+ size_t i;
+
+ for (i = 0; src[i]; i++)
+ ((char volatile*) where_to_append)[i] = src[i];
+
+ ((char volatile*) where_to_append)[i] = '\0';
+
+ return dst;
+}
diff --git a/strings.h b/strings.h
index 3c49b7e..aff0533 100644
--- a/strings.h
+++ b/strings.h
@@ -28,4 +28,6 @@ void memcpy(void *dst, void *src, size_t nbytes);
void *memset(void *s, int c, size_t n);
+char *strcat(char *dst, const char *src);
+
#endif // STRINGS_H