fix length after '\' getline string termination

This commit is contained in:
Hiltjo Posthuma
2016-02-25 21:42:36 +01:00
committed by sin
parent 58257275f0
commit e8eeb19fcd
5 changed files with 8 additions and 8 deletions

4
cut.c
View File

@@ -115,8 +115,8 @@ cut(FILE *fp, const char *fname)
Range *r;
while ((len = getline(&buf, &size, fp)) > 0) {
if (len && buf[len - 1] == '\n')
buf[len - 1] = '\0';
if (buf[len - 1] == '\n')
buf[--len] = '\0';
if (mode == 'f' && !utfutf(buf, delim)) {
if (!sflag)
puts(buf);