summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/string.h6
-rw-r--r--src/lib/string.C10
2 files changed, 14 insertions, 2 deletions
diff --git a/src/include/string.h b/src/include/string.h
index 28ef3ab30..589507c06 100755
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2010,2014 */
+/* Contributors Listed Below - COPYRIGHT 2010,2014 */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -48,6 +50,8 @@ extern "C"
char* strchr(const char* s, int c) __attribute__((pure));
+ char* strdup(const char* s);
+
#ifdef __cplusplus
};
#endif
diff --git a/src/lib/string.C b/src/lib/string.C
index 7a4d1df6f..9acc418e7 100644
--- a/src/lib/string.C
+++ b/src/lib/string.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -21,6 +23,7 @@
/* */
/* IBM_PROLOG_END_TAG */
#include <string.h>
+#include <stdlib.h>
extern "C" void *memset(void *vdest, int ch, size_t len)
{
@@ -281,3 +284,8 @@ extern "C" char* strchr(const char* s, int c)
if (*s == c) return (char*)s;
return NULL;
}
+
+char* strdup(const char* s)
+{
+ return strcpy(static_cast<char*>(malloc(strlen(s)+1)), s);
+}
OpenPOWER on IntegriCloud