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:
d21735d
)
chomp should only remove the newline if it occurs at the end of the input.
author
Matt Kraai
<kraai@debian.org>
Wed, 2 Jan 2002 18:51:23 +0000
(18:51 -0000)
committer
Matt Kraai
<kraai@debian.org>
Wed, 2 Jan 2002 18:51:23 +0000
(18:51 -0000)
This was caught by the test suite (in sed/sed-aic-commands).
* libbb/chomp.c: Revert to revision 1.5.
libbb/chomp.c
patch
|
blob
|
history
diff --git
a/libbb/chomp.c
b/libbb/chomp.c
index e5a522f01df3665aa40217befb6e31bd87f38c98..94404a98d2df2e08cd9995cbed544c58abeff73f 100644
(file)
--- a/
libbb/chomp.c
+++ b/
libbb/chomp.c
@@
-25,11
+25,13
@@
#include <string.h>
#include "libbb.h"
+
void chomp(char *s)
{
- if (!(s && *s)) return;
- while (*s && (*s != '\n')) s++;
- *s = 0;
+ char *lc = last_char_is(s, '\n');
+
+ if(lc)
+ *lc = 0;
}