From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sum4s-0006hO-Lu for qemu-devel@nongnu.org; Fri, 27 Jul 2012 11:03:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sum4j-0007Il-4N for qemu-devel@nongnu.org; Fri, 27 Jul 2012 11:03:42 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:59010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sum4i-0007FU-Um for qemu-devel@nongnu.org; Fri, 27 Jul 2012 11:03:33 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so4974590pbb.4 for ; Fri, 27 Jul 2012 08:03:32 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 27 Jul 2012 17:02:34 +0200 Message-Id: <1343401379-19495-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1343401379-19495-1-git-send-email-pbonzini@redhat.com> References: <1343401379-19495-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 07/32] cutils: add strpadcpy() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Yan Vugenfirer , Dmitry Fleytman From: Dmitry Fleytman Signed-off-by: Yan Vugenfirer Signed-off-by: Dmitry Fleytman Signed-off-by: Paolo Bonzini --- cutils.c | 7 +++++++ qemu-common.h | 1 + 2 files changed, 8 insertions(+) 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; diff --git a/qemu-common.h b/qemu-common.h index 7c8dac8..d26ff39 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -138,6 +138,7 @@ int qemu_timedate_diff(struct tm *tm); /* cutils.c */ void pstrcpy(char *buf, int buf_size, const char *str); +void strpadcpy(char *buf, int buf_size, const char *str, char pad); char *pstrcat(char *buf, int buf_size, const char *s); int strstart(const char *str, const char *val, const char **ptr); int stristart(const char *str, const char *val, const char **ptr); -- 1.7.10.4