diff options
author | Dmitry Fleytman <dmitry.fleytman@ravellosystems.com> | 2012-07-09 08:50:43 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-07-26 17:44:08 +0200 |
commit | 2a025ae454c361fb03aadf88e8a2f678b80b38e6 (patch) | |
tree | 1ffb785e06e0d5281ea1b8c8222ae2174634335b /cutils.c | |
parent | 038478370d5c7ed8f66fc9523bf3f60b8800fe86 (diff) |
cutils: add strpadcpy()
Signed-off-by: Yan Vugenfirer <yan@ravellosystems.com>
Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cutils.c')
-rw-r--r-- | cutils.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; |