summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-util.c
diff options
context:
space:
mode:
authorIan Stakenvicius <axs@gentoo.org>2013-01-25 11:47:47 -0500
committerAnthony G. Basile <blueness@gentoo.org>2013-01-28 17:42:47 -0500
commite34b05dc4c5c8b48cbc0428b29344f7634b3b4a5 (patch)
tree6fa23a172bd969ba20c8c8e2c80121a7f20bad97 /src/libudev/libudev-util.c
parentab779c81460ce48e6b270977ef339b32d87c1f41 (diff)
Port new net_id capabilities from systemd-udev-197
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r--src/libudev/libudev-util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index d3bbd05927..0ca86c815d 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -334,6 +334,25 @@ size_t util_strpcpy(char **dest, size_t size, const char *src)
return size;
}
+size_t util_strpcpyf(char **dest, size_t size, const char *src, ...)
+{
+ va_list va;
+ int i;
+
+ va_start(va, src);
+ i = vsnprintf(*dest, size, src, va);
+ if (i < (int)size) {
+ *dest += i;
+ size -= i;
+ } else {
+ *dest += size;
+ size = 0;
+ }
+ va_end(va);
+ *dest[0] = '\0';
+ return size;
+}
+
/* concatenates list of strings, moves dest forward */
size_t util_strpcpyl(char **dest, size_t size, const char *src, ...)
{