summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorEric Andersen2001-05-07 23:02:39 +0000
committerEric Andersen2001-05-07 23:02:39 +0000
commitf3f9f3efa725f487e336662289a5d78de9ef38e9 (patch)
tree973648cdaddfdc003a345f46dd497a406d4a8776 /libbb
parent4ad13e5d957ae85b3a6a61fce7b58a661adb2b1c (diff)
downloadbusybox-f3f9f3efa725f487e336662289a5d78de9ef38e9.zip
busybox-f3f9f3efa725f487e336662289a5d78de9ef38e9.tar.gz
A patch from Vladimir to simplify chomp()
Diffstat (limited to 'libbb')
-rw-r--r--libbb/chomp.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/libbb/chomp.c b/libbb/chomp.c
index d2f6d5e..e62cb40 100644
--- a/libbb/chomp.c
+++ b/libbb/chomp.c
@@ -32,13 +32,10 @@
void chomp(char *s)
{
- size_t len = strlen(s);
-
- if (len == 0)
- return;
-
- if (s[len-1] == '\n')
- s[len-1] = '\0';
+ char *lc = (char *)last_char_is(s, '\n');
+
+ if(lc)
+ *lc = 0;
}