projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4ad13e5
)
A patch from Vladimir to simplify chomp()
author
Eric Andersen
<andersen@codepoet.org>
Mon, 7 May 2001 23:02:39 +0000
(23:02 -0000)
committer
Eric Andersen
<andersen@codepoet.org>
Mon, 7 May 2001 23:02:39 +0000
(23:02 -0000)
libbb/chomp.c
patch
|
blob
|
history
diff --git
a/libbb/chomp.c
b/libbb/chomp.c
index d2f6d5e6ffd95068b94ff480f2658371546a605b..e62cb4005663f5a0393d2af0792eab4ace409115 100644
(file)
--- 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;
}