summaryrefslogtreecommitdiffstats
path: root/private/crt32/string/wcsncat.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/string/wcsncat.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/crt32/string/wcsncat.c')
-rw-r--r--private/crt32/string/wcsncat.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/private/crt32/string/wcsncat.c b/private/crt32/string/wcsncat.c
new file mode 100644
index 000000000..98b8e5ba4
--- /dev/null
+++ b/private/crt32/string/wcsncat.c
@@ -0,0 +1,61 @@
+/***
+*wcsncat.c - append n chars of string to new string
+*
+* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* defines wcsncat() - appends n characters of string onto
+* end of other string
+*
+*Revision History:
+* 09-09-91 ETC Created from strncat.c.
+* 04-07-92 KRS Updated and ripped out _INTL switches.
+*
+*******************************************************************************/
+
+#include <cruntime.h>
+#include <string.h>
+
+/***
+*wchar_t *wcsncat(front, back, count) - append count chars of back onto front
+*
+*Purpose:
+* Appends at most count characters of the string back onto the
+* end of front, and ALWAYS terminates with a null character.
+* If count is greater than the length of back, the length of back
+* is used instead. (Unlike wcsncpy, this routine does not pad out
+* to count characters).
+*
+*Entry:
+* wchar_t *front - string to append onto
+* wchar_t *back - string to append
+* size_t count - count of max characters to append
+*
+*Exit:
+* returns a pointer to string appended onto (front).
+*
+*Uses:
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+wchar_t * _CALLTYPE1 wcsncat (
+ wchar_t * front,
+ const wchar_t * back,
+ size_t count
+ )
+{
+ wchar_t *start = front;
+
+ while (*front++)
+ ;
+ front--;
+
+ while (count--)
+ if (!(*front++ = *back++))
+ return(start);
+
+ *front = L'\0';
+ return(start);
+}