diff options
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r-- | src/libudev/libudev-util.c | 19 |
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, ...) { |