Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'utils/dupstr.c')
-rw-r--r--utils/dupstr.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/dupstr.c b/utils/dupstr.c
new file mode 100644
index 00000000..fd79583f
--- /dev/null
+++ b/utils/dupstr.c
@@ -0,0 +1,19 @@
+/*
+ * Allocate a duplicate of an ordinary C NUL-terminated string.
+ */
+
+#include <string.h>
+
+#include "defs.h"
+#include "misc.h"
+
+char *dupstr(const char *s)
+{
+ char *p = NULL;
+ if (s) {
+ int len = strlen(s);
+ p = snewn(len + 1, char);
+ strcpy(p, s);
+ }
+ return p;
+}