extern char *mangle(const char *s);
extern void unmangle_to_buffer(const char *s, char *buf, size_t len);
-extern char *unmangle(const char *s, const char **end);
+extern char *unmangle(const char *s, char **end);
static inline void unmangle_string(char *s)
{
*buf = '\0';
}
-static inline const char *skip_nonspaces(const char *s)
+static inline char *skip_nonspaces(const char *s)
{
while (*s && !(*s == ' ' || *s == '\t'))
s++;
- return s;
+ return (char *) s;
}
/*
* Returns mallocated buffer or NULL in case of error.
*/
-char *unmangle(const char *s, const char **end)
+char *unmangle(const char *s, char **end)
{
char *buf;
- const char *e;
+ char *e;
size_t sz;
if (!s)
return s;
}
-static char *
-skip_nonspaces(char *s) {
- while (*s && !is_space_or_tab(*s))
- s++;
- return s;
-}
-
/*
* fstat'ing the file and allocating a buffer holding all of it
* may be a bad idea: if the file is /proc/mounts, the stat
assert(!fs->target);
while (p && *p) {
+ char *end = NULL;
+
while (*p == ' ') p++;
if (!*p)
break;
if (!fs->source && !strncmp(p, "SRC=", 4)) {
- char *v = unmangle(p + 4, &p);
+ char *v = unmangle(p + 4, &end);
if (!v)
goto enomem;
if (strcmp(v, "none"))
__mnt_fs_set_source_ptr(fs, v);
} else if (!fs->target && !strncmp(p, "TARGET=", 7)) {
- fs->target = unmangle(p + 7, &p);
+ fs->target = unmangle(p + 7, &end);
if (!fs->target)
goto enomem;
} else if (!fs->root && !strncmp(p, "ROOT=", 5)) {
- fs->root = unmangle(p + 5, &p);
+ fs->root = unmangle(p + 5, &end);
if (!fs->root)
goto enomem;
} else if (!fs->bindsrc && !strncmp(p, "BINDSRC=", 8)) {
- fs->bindsrc = unmangle(p + 8, &p);
+ fs->bindsrc = unmangle(p + 8, &end);
if (!fs->bindsrc)
goto enomem;
} else if (!fs->optstr && !strncmp(p, "OPTS=", 5)) {
- fs->optstr = unmangle(p + 5, &p);
+ fs->optstr = unmangle(p + 5, &end);
if (!fs->optstr)
goto enomem;
} else {
/* unknown variable */
while (*p && *p != ' ') p++;
}
+ if (end)
+ p = end;
}
return 0;