提交 2a025ae4 编写于 作者: D Dmitry Fleytman 提交者: Paolo Bonzini

cutils: add strpadcpy()

Signed-off-by: NYan Vugenfirer <yan@ravellosystems.com>
Signed-off-by: NDmitry Fleytman <dmitry.fleytman@ravellosystems.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 03847837
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册