mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-12-22 09:50:49 +01:00
file processing: remove trailing spaces from line
Such as a line feed left there by getline(). Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
417fa5b907
commit
134458b85a
1 changed files with 9 additions and 0 deletions
|
@ -40,6 +40,15 @@ retry:
|
|||
|
||||
if (ptr != f->line)
|
||||
memmove(f->line, ptr, strlen(ptr) + 1);
|
||||
|
||||
ptr = f->line + strlen(f->line);
|
||||
|
||||
while (ptr > f->line && isspace(ptr[-1]))
|
||||
--ptr;
|
||||
*ptr = '\0';
|
||||
|
||||
if (f->line[0] == '\0')
|
||||
goto retry;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue