]> git.ipfire.org Git - thirdparty/util-linux.git/blob - include/mangle.h
Merge branch 'master' of https://github.com/breavyn/util-linux
[thirdparty/util-linux.git] / include / mangle.h
1 /*
2 * No copyright is claimed. This code is in the public domain; do with
3 * it what you wish.
4 */
5 #ifndef UTIL_LINUX_MANGLE_H
6 #define UTIL_LINUX_MANGLE_H
7
8 /*
9 * Functions for \oct encoding used in mtab/fstab/swaps/etc.
10 */
11
12 extern char *mangle(const char *s);
13
14 extern void unmangle_to_buffer(const char *s, char *buf, size_t len);
15 extern size_t unhexmangle_to_buffer(const char *s, char *buf, size_t len);
16
17 extern char *unmangle(const char *s, const char **end);
18
19 static inline void unmangle_string(char *s)
20 {
21 if (s)
22 unmangle_to_buffer(s, s, strlen(s) + 1);
23 }
24
25 static inline void unhexmangle_string(char *s)
26 {
27 if (s)
28 unhexmangle_to_buffer(s, s, strlen(s) + 1);
29 }
30
31 #endif /* UTIL_LINUX_MANGLE_H */
32