tFix regression from 3d2081c, correctly handle '\n' ending lines (bis) - sacc - sacc(omys), simple console gopher client (mirror) HTML git clone https://git.parazyd.org/sacc DIR Log DIR Files DIR Refs DIR LICENSE --- DIR commit 1f25175ac21819a702f38edaf034a16825cd5c07 DIR parent 3399f31a720905a2ebd03191945307b9aafb0ad4 HTML Author: Quentin Rameau <quinq@fifth.space> Date: Fri, 24 Aug 2018 18:21:44 +0200 Fix regression from 3d2081c, correctly handle '\n' ending lines (bis) This is a followup to 43803be, the patch was not finished. Diffstat: M sacc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- DIR diff --git a/sacc.c b/sacc.c t@@ -298,13 +298,16 @@ displaytextitem(Item *item) static char * pickfield(char **raw, const char *sep) { - char *c, *f = *raw; + char c, *r, *f = *raw; - for (c = *raw; *c && !strchr(sep, *c); ++c) - ; + for (r = *raw; (c = *r) && !strchr(sep, c); ++r) { + if (c == '\n') + goto skipsep; + } - *c = '\0'; - *raw = c+1; + *r++ = '\0'; +skipsep: + *raw = r; return f; }