| tAdd config.def.h and make summary length configurable - stagit - static git pa… | |
| git clone git://src.adamsgaard.dk/stagit | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit c3014aaaba1d98b8e54537cef6246add1ab62094 | |
| parent f33bca44bdd4f6758b9045c02ddbab9adc7b97c0 | |
| Author: FRIGN <[email protected]> | |
| Date: Mon, 14 Dec 2015 12:49:23 +0100 | |
| Add config.def.h and make summary length configurable | |
| Diffstat: | |
| M Makefile | 6 +++++- | |
| A config.def.h | 2 ++ | |
| M urmoms.c | 7 ++++--- | |
| 3 files changed, 11 insertions(+), 4 deletions(-) | |
| --- | |
| diff --git a/Makefile b/Makefile | |
| t@@ -33,7 +33,11 @@ dist: $(BIN) | |
| (cd release/${VERSION}; \ | |
| tar -czf ../../urmoms-${VERSION}.tar.gz .) | |
| -${OBJ}: config.mk ${HDR} | |
| +${OBJ}: config.h config.mk ${HDR} | |
| + | |
| +config.h: | |
| + @echo creating $@ from config.def.h | |
| + @cp config.def.h $@ | |
| urmoms: urmoms.o | |
| ${CC} -o $@ urmoms.o ${LDFLAGS} | |
| diff --git a/config.def.h b/config.def.h | |
| t@@ -0,0 +1,2 @@ | |
| +/* See LICENSE file for copyright and license details. */ | |
| +static const unsigned summarylen = 70; /* summary length in the log */ | |
| diff --git a/urmoms.c b/urmoms.c | |
| t@@ -10,6 +10,7 @@ | |
| #include <string.h> | |
| #include <unistd.h> | |
| +#include "config.h" | |
| #include "git2.h" | |
| struct commitinfo { | |
| t@@ -428,9 +429,9 @@ writelog(FILE *fp) | |
| fputs("</td><td>", fp); | |
| if (ci->summary) { | |
| fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, … | |
| - if ((len = strlen(ci->summary)) > 79) { | |
| - xmlencode(fp, ci->summary, 76); | |
| - fputs("...", fp); | |
| + if ((len = strlen(ci->summary)) > summarylen) { | |
| + xmlencode(fp, ci->summary, summarylen - 1); | |
| + fputs("…", fp); | |
| } else { | |
| xmlencode(fp, ci->summary, len); | |
| } |