A patch from Vladimir to simplify chomp()

1_00_stable_10817
Eric Andersen 2001-05-07 23:02:39 +00:00
parent 4ad13e5d95
commit f3f9f3efa7
1 changed files with 4 additions and 7 deletions

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