index: read until the first newline or CR or TAB - stagit-gopher - A git gopher… | |
git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2h… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit 203a8500a5017ff2bfb77ccdbd33938c1ad4fea1 | |
parent 45274ebb4ba07c9771c279aae51259040d94d0ab | |
Author: Hiltjo Posthuma <[email protected]> | |
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(-) | |
--- | |
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")] = … | |
+ else | |
description[0] = '\0'; | |
fclose(fp); | |
} |