diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 8 | ||||
-rw-r--r-- | lib/lib.h | 1 |
2 files changed, 9 insertions, 0 deletions
@@ -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) { @@ -152,6 +152,7 @@ long atolx(char *c); long atolx_range(char *numstr, long low, long high); int numlen(long l); int stridx(char *haystack, char needle); +int unescape(char c); int strstart(char **a, char *b); off_t fdlength(int fd); void loopfiles_rw(char **argv, int flags, int permissions, int failok, |