aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-01-18 21:24:08 +0100
committerJohannes Löthberg <johannes@kyriasis.com>2015-01-19 00:17:52 +0100
commit81d3a025256f2634a51a226df28ae40fafb50de6 (patch)
tree40231b92b8220a4d0cf1deb0142ed168bdbddad9
parent275743751cc0ce2914ae1958926ff569dceea6c3 (diff)
downloadsds-81d3a025256f2634a51a226df28ae40fafb50de6.tar.xz
man: Add initial sdsnew(3) manpage
-rw-r--r--Makefile2
-rw-r--r--docs/sds.rst1
-rw-r--r--docs/sdsnew.rst34
3 files changed, 36 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 2582aa9..cf14213 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ CC = clang
SOURCES = src/twbctf.c src/sds.c
HEADERS = src/twbctf.h src/sds.h
-MANPAGES = docs/sds.3
+MANPAGES = docs/sds.3 docs/sdsnew.3
all: sds-test $(MANPAGES)
diff --git a/docs/sds.rst b/docs/sds.rst
index 7dd17d0..095906f 100644
--- a/docs/sds.rst
+++ b/docs/sds.rst
@@ -6,3 +6,4 @@ sds
Functions
---------
+:manpage:`sdsnew(3)`, :manpage:`sdsnewlen(3)`
diff --git a/docs/sdsnew.rst b/docs/sdsnew.rst
new file mode 100644
index 0000000..7217b2c
--- /dev/null
+++ b/docs/sdsnew.rst
@@ -0,0 +1,34 @@
+:orphan:
+
+sdsnew
+======
+
+Synopsis
+--------
+
+.. c:function:: #include <sds.h>
+
+.. c:function:: sds sdsnew(const char *init)
+ sds sdsnewlen(const void *init, size_t initlen)
+
+
+Description
+-----------
+
+The function :c:func:`sdsnew()` creates an SDS string from a C null terminated string.
+
+The function :c:func:`sdsnewlen()` is similar to :c:func:`sdsnew()` but
+instead of creating the string assuming that the input string is null
+terminated, it gets an additional length parameter. This way you can create a
+string from binary data.
+
+Return value
+------------
+
+Upon successful completion, these functions will allocate and return a new SDS
+string. If the allocation fails they will return :c:data:`NULL`.
+
+See also
+--------
+
+:manpage:`sds(3)`