aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c8
-rw-r--r--lib/lib.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index d9bea891..aa7b1c30 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -342,6 +342,14 @@ char *strlower(char *s)
return try;
}
+char *chomp(char *s)
+{
+ char *p = strrchr(s, '\n');
+
+ if (p) *p = 0;
+ return s;
+}
+
int unescape(char c)
{
char *from = "\\abefnrtv", *to = "\\\a\b\033\f\n\r\t\v";
diff --git a/lib/lib.h b/lib/lib.h
index dbb39f5b..ad59989a 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -168,6 +168,7 @@ long atolx(char *c);
long atolx_range(char *numstr, long low, long high);
int stridx(char *haystack, char needle);
char *strlower(char *s);
+char *chomp(char *s);
int unescape(char c);
int strstart(char **a, char *b);
off_t fdlength(int fd);