aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/strpcpy.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-03-12 21:23:02 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-03-12 21:23:02 -0700
commit1db28c0e4281f93445d3ded6ed518edefadd2803 (patch)
tree828a2af3c70ad8bb792e0c06a23a9f2bbf519b4b /com32/lib/strpcpy.c
parentd617310bda3b892fb8626151891748c1ee98106d (diff)
downloadsyslinux-elf-1db28c0e4281f93445d3ded6ed518edefadd2803.tar.gz
syslinux-elf-1db28c0e4281f93445d3ded6ed518edefadd2803.tar.xz
syslinux-elf-1db28c0e4281f93445d3ded6ed518edefadd2803.zip
libcom32: add strpcpy()
Add strpcpy() -- by analogy with mempcpy(), a strcpy() which returns a pointer to the end of the string (specifically, to the final null.)
Diffstat (limited to 'com32/lib/strpcpy.c')
-rw-r--r--com32/lib/strpcpy.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/com32/lib/strpcpy.c b/com32/lib/strpcpy.c
new file mode 100644
index 00000000..e181e78f
--- /dev/null
+++ b/com32/lib/strpcpy.c
@@ -0,0 +1,20 @@
+/*
+ * strpcpy.c
+ *
+ * strpcpy() - strcpy() which returns a pointer to the final null
+ */
+
+#include <string.h>
+
+char *strpcpy(char *dst, const char *src)
+{
+ char *q = dst;
+ const char *p = src;
+ char ch;
+
+ do {
+ *q++ = ch = *p++;
+ } while ( ch );
+
+ return q-1;
+}