aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 19d28d2b..dc2de121 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -283,6 +283,14 @@ int stridx(char *haystack, char needle)
return off-haystack;
}
+int unescape(char c)
+{
+ char *from = "\\abefnrtv", *to = "\\\a\b\033\f\n\r\t\v";
+ int idx = stridx(from, c);
+
+ return (idx == -1) ? 0 : to[idx];
+}
+
// If *a starts with b, advance *a past it and return 1, else return 0;
int strstart(char **a, char *b)
{