summaryrefslogtreecommitdiff
path: root/string.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-06 13:41:02 +0000
committertron <tron@openttd.org>2005-02-06 13:41:02 +0000
commitb2ae5b197ef3c9753e044f98d7973829d4848dba (patch)
tree0aab391e034d9f14ce3c721ca9f25bfc6395c9fc /string.h
parent498ccae27af050c66dfa70e9017eb45cefaf99ae (diff)
downloadopenttd-b2ae5b197ef3c9753e044f98d7973829d4848dba.tar.xz
(svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
Diffstat (limited to 'string.h')
-rw-r--r--string.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/string.h b/string.h
new file mode 100644
index 000000000..a868a8774
--- /dev/null
+++ b/string.h
@@ -0,0 +1,24 @@
+#ifndef STRING_H
+#define STRING_H
+
+/*
+ * dst: destination buffer
+ * src: string to copy/concatenate
+ * size: size of the destination buffer
+ * usage: ttd_strlcpy(dst, src, lengthof(dst));
+ */
+void ttd_strlcat(char *dst, const char *src, size_t size);
+void ttd_strlcpy(char *dst, const char *src, size_t size);
+
+/*
+ * dst: destination buffer
+ * src: string to copy
+ * last: pointer to the last element in the dst array
+ * if NULL no boundary check is performed
+ * returns a pointer to the terminating \0 in the destination buffer
+ * usage: strecpy(dst, src, lastof(dst));
+ */
+char* strecat(char* dst, const char* src, const char* last);
+char* strecpy(char* dst, const char* src, const char* last);
+
+#endif