aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index aa7b1c30..b3703052 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -342,11 +342,12 @@ char *strlower(char *s)
return try;
}
+// Remove trailing \n
char *chomp(char *s)
{
char *p = strrchr(s, '\n');
- if (p) *p = 0;
+ if (p && !p[1]) *p = 0;
return s;
}