index: read until the first newline or CR or TAB - stagit-gopher - A git gopher frontend. (mirror)
HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit 203a8500a5017ff2bfb77ccdbd33938c1ad4fea1
DIR parent 45274ebb4ba07c9771c279aae51259040d94d0ab
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 25 Nov 2017 15:13:40 +0100
index: read until the first newline or CR or TAB
This makes sure the column is properly aligned also, because a newline is
ignored, but it is counted in utf8pad().
Diffstat:
M stagit-gopher-index.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
DIR diff --git a/stagit-gopher-index.c b/stagit-gopher-index.c
@@ -264,7 +264,9 @@ main(int argc, char *argv[])
}
description[0] = '\0';
if (fp) {
- if (!fgets(description, sizeof(description), fp))
+ if (fgets(description, sizeof(description), fp))
+ description[strcspn(description, "\t\r\n")] = '\0';
+ else
description[0] = '\0';
fclose(fp);
}