Skip to contentSkip to conversation

master - commands: some more dm wrappers

PATCH Zdenek Kabelac 1 participant 1 message Feb 17, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=00f299b93265ea2a9a930f26c68d887b8708da5a
Commit:        00f299b93265ea2a9a930f26c68d887b8708da5a
Parent:        238a79aac41fcba65e7ac9c75f05275ab5915de6
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Feb 17 13:36:57 2017 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Feb 17 13:36:57 2017 +0100

commands: some more dm wrappers

As man-generator is not liked with libdm as of now - some more wrappers.

---
 tools/command.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
tools/command.c +12 -0
index a4139f0..1abac20 100644
@@ -48,6 +48,18 @@ do { \
 #define dm_malloc malloc
 #define dm_free free
 #define dm_strdup strdup
+#define dm_snprintf snprintf
+
+static int dm_strncpy(char *dest, const char *src, size_t n)
+{
+	if (memccpy(dest, src, 0, n))
+		return 1;
+
+	if (n > 0)
+		dest[n - 1] = '\0';
+
+	return 0;
+}
 
 /* needed to include args.h */
 #define ARG_COUNTABLE 0x00000001