Add config.def.h and make summary length configurable
3 files changed, 11 insertions(+), 4 deletions(-) | |||
---|---|---|---|
M | Makefile | +5 | -1 |
A | config.def.h | +2 | -0 |
M | urmoms.c | +4 | -3 |
1@@ -33,7 +33,11 @@ dist: $(BIN)
2 (cd release/${VERSION}; \
3 tar -czf ../../urmoms-${VERSION}.tar.gz .)
4
5-${OBJ}: config.mk ${HDR}
6+${OBJ}: config.h config.mk ${HDR}
7+
8+config.h:
9+ @echo creating $@ from config.def.h
10+ @cp config.def.h $@
11
12 urmoms: urmoms.o
13 ${CC} -o $@ urmoms.o ${LDFLAGS}
A · config.def.h
+2, -01@@ -0,0 +1,2 @@
2+/* See LICENSE file for copyright and license details. */
3+static const unsigned summarylen = 70; /* summary length in the log */
M · urmoms.c
+4, -3 1@@ -10,6 +10,7 @@
2 #include <string.h>
3 #include <unistd.h>
4
5+#include "config.h"
6 #include "git2.h"
7
8 struct commitinfo {
9@@ -428,9 +429,9 @@ writelog(FILE *fp)
10 fputs("</td><td>", fp);
11 if (ci->summary) {
12 fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, ci->oid);
13- if ((len = strlen(ci->summary)) > 79) {
14- xmlencode(fp, ci->summary, 76);
15- fputs("...", fp);
16+ if ((len = strlen(ci->summary)) > summarylen) {
17+ xmlencode(fp, ci->summary, summarylen - 1);
18+ fputs("…", fp);
19 } else {
20 xmlencode(fp, ci->summary, len);
21 }