[PATCH 2/3] sort: ignore trailing newline while sorting

From: Jakob Kramer <jakob.kramer_AT_gmx.de>
Date: Tue, 6 May 2014 13:37:05 +0200

---
 sort.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sort.c b/sort.c
index 1d5f325..26d287d 100644
--- a/sort.c
+++ b/sort.c
_AT_@ -245,7 +245,8 @@ columns(char *line, const struct keydef *kd)
 		else
 			end = end_column(end);
 	} else {
-		end = line + strlen(line);
+		if((end = strchr(line, '\n')) == NULL)
+			end = strchr(line, '\0');
 	}
 
 	if((res = strndup(start, end - start)) == NULL)
-- 
1.8.5.1
--/NkBOFFp2J2Af1nK--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Tue May 06 2014 - 16:48:10 CEST