if (pa->name && *pa->name)
fprintf(f, ", name=\"%s\"", pa->name);
if (pa->attrs)
- fprintf(f, ", attrs=%s", pa->attrs);
+ fprintf(f, ", attrs=\"%s\"", pa->attrs);
if (pa->boot)
fprintf(f, ", bootable");
fputc('\n', f);
static int next_string(char **s, char **str)
{
- char *end = NULL;
+ char *xend = NULL, *end = NULL;
assert(str);
assert(s);
if (!**s)
return -1;
- end = strchr(*s, ',');
- if (end) {
- *str = strndup(*s, end - *s);
- *s = end;
+ if (**s == '"') {
+ ++(*s);
+ xend = strchr(*s, '"');
+ if (!xend)
+ return -EINVAL;
+ end = strchr(xend, ',');
+ } else
+ xend = end = strchr(*s, ',');
+
+ if (xend) {
+ *str = strndup(*s, xend - *s);
+ *s = end ? end : xend + 1;
} else {
*str = strdup(*s);
while (**s) (*s)++;
if (!*str)
return -ENOMEM;
- ltrim_whitespace((unsigned char *) *str);
+ if (xend == end)
+ ltrim_whitespace((unsigned char *) *str);
if (!**str) {
free(*str);
*str = NULL;
if (rc)
break;
- } else if (!strncasecmp(p, "type=", 5)) {
+ } else if (!strncasecmp(p, "type=", 5) ||
+ !strncasecmp(p, "Id=", 3)) { /* backward compatiility */
char *type;
p += 5;