search for: split_strdup

Displaying 1 result from an estimated 1 matches for "split_strdup".

2012 Jul 16
2
[PATCH V4] NEW API: add new api xfs_info
...+#include <string.h> +#include <unistd.h> + +#include "guestfs_protocol.h" +#include "daemon.h" +#include "c-ctype.h" +#include "actions.h" + +int +optgroup_xfs_available (void) +{ + return prog_exists ("mkfs.xfs"); +} + +static char * +split_strdup (char *string) +{ + char *end = string; + while (*end != ' ' && *end != ',') end++; + size_t len = end - string; + char *ret = malloc (len + 1); + if (!ret) { + reply_with_perror ("malloc"); + return NULL; + } + strncpy (ret, string, len); + ret[len]...