From 2a025ae454c361fb03aadf88e8a2f678b80b38e6 Mon Sep 17 00:00:00 2001 From: Dmitry Fleytman Date: Mon, 9 Jul 2012 08:50:43 +0200 Subject: cutils: add strpadcpy() Signed-off-by: Yan Vugenfirer Signed-off-by: Dmitry Fleytman Signed-off-by: Paolo Bonzini --- cutils.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cutils.c') diff --git a/cutils.c b/cutils.c index e2bc1b8..9d4c570 100644 --- a/cutils.c +++ b/cutils.c @@ -28,6 +28,13 @@ #include "qemu_socket.h" #include "iov.h" +void strpadcpy(char *buf, int buf_size, const char *str, char pad) +{ + int len = qemu_strnlen(str, buf_size); + memcpy(buf, str, len); + memset(buf + len, pad, buf_size - len); +} + void pstrcpy(char *buf, int buf_size, const char *str) { int c; -- cgit v1.1