A patch from Vladimir to simplify chomp()
This commit is contained in:
parent
4ad13e5d95
commit
f3f9f3efa7
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user