commit 203a8500a5017ff2bfb77ccdbd33938c1ad4fea1
parent 45274ebb4ba07c9771c279aae51259040d94d0ab
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:
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")] = '\0';
+ else
description[0] = '\0';
fclose(fp);
}