iindex: read until the first newline or CR or TAB - stagit-gemini - Stagit for gemini protocol Openbsd Err thinkerwim.openbsd.amsterdam 70 hgit clone git://thinkerwim.org/stagit-gemini.git URL:git://thinkerwim.org/stagit-gemini.git thinkerwim.org 70 1Log /git/stagit-gemini/log.gph thinkerwim.org 70 1Files /git/stagit-gemini/files.gph thinkerwim.org 70 1Refs /git/stagit-gemini/refs.gph thinkerwim.org 70 1README /git/stagit-gemini/file/README.gph thinkerwim.org 70 1LICENSE /git/stagit-gemini/file/LICENSE.gph thinkerwim.org 70 i--- Err thinkerwim.openbsd.amsterdam 70 1commit 203a8500a5017ff2bfb77ccdbd33938c1ad4fea1 /git/stagit-gemini/commit/203a8500a5017ff2bfb77ccdbd33938c1ad4fea1.gph thinkerwim.org 70 1parent 45274ebb4ba07c9771c279aae51259040d94d0ab /git/stagit-gemini/commit/45274ebb4ba07c9771c279aae51259040d94d0ab.gph thinkerwim.org 70 hAuthor: Hiltjo Posthuma URL:mailto:hiltjo@codemadness.org thinkerwim.org 70 iDate: Sat, 25 Nov 2017 15:13:40 +0100 Err thinkerwim.openbsd.amsterdam 70 i Err thinkerwim.openbsd.amsterdam 70 iindex: read until the first newline or CR or TAB Err thinkerwim.openbsd.amsterdam 70 i Err thinkerwim.openbsd.amsterdam 70 iThis makes sure the column is properly aligned also, because a newline is Err thinkerwim.openbsd.amsterdam 70 iignored, but it is counted in utf8pad(). Err thinkerwim.openbsd.amsterdam 70 i Err thinkerwim.openbsd.amsterdam 70 iDiffstat: Err thinkerwim.openbsd.amsterdam 70 i M stagit-gopher-index.c | 4 +++- Err thinkerwim.openbsd.amsterdam 70 i Err thinkerwim.openbsd.amsterdam 70 i1 file changed, 3 insertions(+), 1 deletion(-) Err thinkerwim.openbsd.amsterdam 70 i--- Err thinkerwim.openbsd.amsterdam 70 1diff --git a/stagit-gopher-index.c b/stagit-gopher-index.c /git/stagit-gemini/file/stagit-gopher-index.c.gph thinkerwim.org 70 i@@ -264,7 +264,9 @@ main(int argc, char *argv[]) Err thinkerwim.openbsd.amsterdam 70 i } Err thinkerwim.openbsd.amsterdam 70 i description[0] = '\0'; Err thinkerwim.openbsd.amsterdam 70 i if (fp) { Err thinkerwim.openbsd.amsterdam 70 i- if (!fgets(description, sizeof(description), fp)) Err thinkerwim.openbsd.amsterdam 70 i+ if (fgets(description, sizeof(description), fp)) Err thinkerwim.openbsd.amsterdam 70 i+ description[strcspn(description, "\t\r\n")] = '\0'; Err thinkerwim.openbsd.amsterdam 70 i+ else Err thinkerwim.openbsd.amsterdam 70 i description[0] = '\0'; Err thinkerwim.openbsd.amsterdam 70 i fclose(fp); Err thinkerwim.openbsd.amsterdam 70 i } Err thinkerwim.openbsd.amsterdam 70 .