aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ngx_string.c')
-rw-r--r--src/core/ngx_string.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
new file mode 100644
index 000000000..9e32b56f5
--- /dev/null
+++ b/src/core/ngx_string.c
@@ -0,0 +1,21 @@
+
+#include <ngx_config.h>
+#include <ngx_string.h>
+
+
+char *ngx_cpystrn(char *dst, char *src, size_t n)
+{
+ if (n == 0)
+ return dst;
+
+ for (/* void */; --n; dst++, src++) {
+ *dst = *src;
+
+ if (*dst == '\0')
+ return dst;
+ }
+
+ *dst = '\0';
+
+ return dst;
+}