mirror of
https://github.com/sheumann/hush.git
synced 2024-08-27 18:29:23 +00:00
chomp should only remove the newline if it occurs at the end of the input.
This was caught by the test suite (in sed/sed-aic-commands). * libbb/chomp.c: Revert to revision 1.5.
This commit is contained in:
parent
d21735de2d
commit
0733e840bd
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user