summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-06-27 23:34:21 +0800
committerIru Cai <mytbk920423@gmail.com>2018-06-28 00:16:51 +0800
commitb0e376b6ba1891fcf749d22095c4f79a843a5d0f (patch)
tree5008f76cf09bbda7b979180997a8cb3e142f0899 /t
parente6d9edc048efb5b19d79bbe7871b2ff779d72311 (diff)
downloadmatrix-curl-b0e376b6ba1891fcf749d22095c4f79a843a5d0f.tar.xz
util.c: string builder
and rename util.{c,h} to curl_util
Diffstat (limited to 't')
-rw-r--r--t/t_build_string.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t_build_string.c b/t/t_build_string.c
new file mode 100644
index 0000000..f49cc2b
--- /dev/null
+++ b/t/t_build_string.c
@@ -0,0 +1,19 @@
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+char * alloc_build_string(const char *ss[]);
+
+int main()
+{
+ const char *greets[] = {"hello", " world", " all", NULL};
+ char *greet = alloc_build_string(greets);
+ char *greet2 = alloc_build_string((const char *[]){
+ "hello world", " all", NULL
+ });
+ printf("%d\n", strcmp(greet, "hello world all"));
+ printf("%d\n", strcmp(greet2, "hello world all"));
+ free(greet);
+ free(greet2);
+}
+