extern char *mangle(const char *s);
-extern void unmangle_to_buffer(char *s, char *buf, size_t len);
-extern char *unmangle(char *s);
+extern void unmangle_to_buffer(const char *s, char *buf, size_t len);
+extern char *unmangle(const char *s);
#endif /* UTIL_LINUX_MANGLE_H */
return ss;
}
-void unmangle_to_buffer(char *s, char *buf, size_t len)
+void unmangle_to_buffer(const char *s, char *buf, size_t len)
{
size_t sz = 0;
*buf = '\0';
}
-static inline char *skip_nonspaces(char *s)
+static inline const char *skip_nonspaces(const char *s)
{
while (*s && !(*s == ' ' || *s == '\t'))
s++;
/*
* Returns mallocated buffer or NULL in case of error.
*/
-char *unmangle(char *s)
+char *unmangle(const char *s)
{
- char *buf, *end;
+ char *buf;
+ const char *end;
size_t sz;
end = skip_nonspaces(s);
extern int mnt_get_library_version(const char **ver_string);
/* utils.c */
+extern char *mnt_mangle(const char *str);
+extern char *mnt_unmangle(const char *str);
extern int mnt_fstype_is_netfs(const char *type);
extern int mnt_fstype_is_pseudofs(const char *type);
extern int mnt_match_fstype(const char *type, const char *pattern);
mnt_lock_file;
mnt_lock_get_linkfile;
mnt_lock_get_lockfile;
+ mnt_mangle;
mnt_match_fstype;
mnt_match_options;
mnt_new_cache;
mnt_tab_set_parser_errcb;
mnt_tab_update_file;
mnt_unlock_file;
+ mnt_unmangle;
local:
*;
};
#include "strutils.h"
#include "pathnames.h"
#include "mountP.h"
+#include "mangle.h"
char *mnt_getenv_safe(const char *arg)
{
return !strncmp(s, sx, off);
}
+/**
+ * mnt_mangle:
+ * @str: string
+ *
+ * Encode @str to be compatible with fstab/mtab
+ *
+ * Returns: new allocated string or NULL in case of error.
+ */
+char *mnt_mangle(const char *str)
+{
+ return mangle(str);
+}
+
+/**
+ * mnt_unmangle:
+ * @str: string
+ *
+ * Decode @str from fstab/mtab
+ *
+ * Returns: new allocated string or NULL in case of error.
+ */
+char *mnt_unmangle(const char *str)
+{
+ return unmangle(str);
+}
+
/**
* mnt_fstype_is_pseudofs:
* @type: filesystem name