summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-11-02 13:26:08 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-11-02 16:34:43 -0500
commit856d226851b5fb24d919f3233ca5764ef75bed24 (patch)
tree4eca62b68bad51b4e0966a2f5ee39fa8e16b29af /src
parent022876203657ff7d370ea00e520b97432d1e8af5 (diff)
downloadblackbird-hostboot-856d226851b5fb24d919f3233ca5764ef75bed24.tar.gz
blackbird-hostboot-856d226851b5fb24d919f3233ca5764ef75bed24.zip
Add strchr function.
Change-Id: Ia9eeb1c4c6cb47409fbfdb0f267eb9943a83dad4 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/480 Tested-by: Jenkins Server Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/string.h4
-rw-r--r--src/lib/string.C11
2 files changed, 14 insertions, 1 deletions
diff --git a/src/include/string.h b/src/include/string.h
index aa7659349..1e1ce9113 100755
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -26,7 +26,7 @@
#include <stdint.h>
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
void *memset(void* s, int c, size_t n);
@@ -39,6 +39,8 @@ extern "C"
int strcmp(const char* s1, const char* s2);
size_t strlen(const char* s1);
+ char* strchr(const char* s, int c);
+
#ifdef __cplusplus
};
#endif
diff --git a/src/lib/string.C b/src/lib/string.C
index 5eca78439..fdfa06280 100644
--- a/src/lib/string.C
+++ b/src/lib/string.C
@@ -164,3 +164,14 @@ extern "C" size_t strlen(const char* a)
}
return length;
}
+
+extern "C" char* strchr(const char* s, int c)
+{
+ while((*s != '\0') && (*s != c))
+ {
+ s++;
+ }
+
+ if (*s == c) return (char*)s;
+ return NULL;
+}
OpenPOWER on IntegriCloud