A patch from Vladimir to simplify chomp()

This commit is contained in:
Eric Andersen 2001-05-07 23:02:39 +00:00
parent 4ad13e5d95
commit f3f9f3efa7

View File

@ -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;
}