mirror of https://github.com/xqemu/xqemu.git
qemu-io: Move qemu_strsep() to cutils.c
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
e681be7eca
commit
a38ed81147
21
cmd.c
21
cmd.c
|
@ -255,27 +255,6 @@ fetchline(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *qemu_strsep(char **input, const char *delim)
|
|
||||||
{
|
|
||||||
char *result = *input;
|
|
||||||
if (result != NULL) {
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
for (p = result; *p != '\0'; p++) {
|
|
||||||
if (strchr(delim, *p)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (*p == '\0') {
|
|
||||||
*input = NULL;
|
|
||||||
} else {
|
|
||||||
*p = '\0';
|
|
||||||
*input = p + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
char **breakline(char *input, int *count)
|
char **breakline(char *input, int *count)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
|
@ -174,6 +174,7 @@ char *pstrcat(char *buf, int buf_size, const char *s);
|
||||||
int strstart(const char *str, const char *val, const char **ptr);
|
int strstart(const char *str, const char *val, const char **ptr);
|
||||||
int stristart(const char *str, const char *val, const char **ptr);
|
int stristart(const char *str, const char *val, const char **ptr);
|
||||||
int qemu_strnlen(const char *s, int max_len);
|
int qemu_strnlen(const char *s, int max_len);
|
||||||
|
char *qemu_strsep(char **input, const char *delim);
|
||||||
time_t mktimegm(struct tm *tm);
|
time_t mktimegm(struct tm *tm);
|
||||||
int qemu_fls(int i);
|
int qemu_fls(int i);
|
||||||
int qemu_fdatasync(int fd);
|
int qemu_fdatasync(int fd);
|
||||||
|
|
|
@ -107,6 +107,27 @@ int qemu_strnlen(const char *s, int max_len)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *qemu_strsep(char **input, const char *delim)
|
||||||
|
{
|
||||||
|
char *result = *input;
|
||||||
|
if (result != NULL) {
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
for (p = result; *p != '\0'; p++) {
|
||||||
|
if (strchr(delim, *p)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*p == '\0') {
|
||||||
|
*input = NULL;
|
||||||
|
} else {
|
||||||
|
*p = '\0';
|
||||||
|
*input = p + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
time_t mktimegm(struct tm *tm)
|
time_t mktimegm(struct tm *tm)
|
||||||
{
|
{
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
Loading…
Reference in New Issue