summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorgary.li.wenchao.4 <[email protected]>2010-02-16 15:12:40 +0000
committergary.li.wenchao.4 <[email protected]>2010-02-16 15:12:40 +0000
commit71cbe22bb61845691d492a1123a6a3d30804df42 (patch)
tree1ddcae38135a5265579ef797facbab4ab8e356e1 /libc
parent6c82f5086f944f467f0a3ae86806fcbcc64d61ce (diff)
add strlcpy
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@413 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'libc')
-rw-r--r--libc/minilibc/string.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libc/minilibc/string.c b/libc/minilibc/string.c
index be35afe526..092fbfb7ad 100644
--- a/libc/minilibc/string.c
+++ b/libc/minilibc/string.c
@@ -10,6 +10,7 @@
* Change Logs:
* Date Author Notes
* 2008-08-14 Bernard the first version
+ * 2010-02-15 Gary Lee add strlcpy
*/
#include <rtthread.h>
@@ -23,6 +24,23 @@ char *strcpy(char *dest, const char *src)
return rt_strncpy(dest, src, rt_strlen(src) + 1);
}
+char *strncpy(char *dest, const char *src, rt_ubase_t n)
+{
+ return rt_strncpy(dest, src, n);
+}
+
+char *strlcpy(char *dest, const char *src, rt_ubase_t n)
+{
+ return rt_strlcpy(dest, src, n);
+}
+
+int strcmp (const char *s1, const char *s2)
+{
+ while (*s1 && *s1 == *s2)
+ s1++, s2++;
+ return (*s1 - *s2);
+}
+
int strcmp (const char *s1, const char *s2)
{
while (*s1 && *s1 == *s2)