mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +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 <string.h>
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
|
|
||||||
void chomp(char *s)
|
void chomp(char *s)
|
||||||
{
|
{
|
||||||
if (!(s && *s)) return;
|
char *lc = last_char_is(s, '\n');
|
||||||
while (*s && (*s != '\n')) s++;
|
|
||||||
*s = 0;
|
if(lc)
|
||||||
|
*lc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user