aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-08 13:12:43 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-08 13:14:08 +0200
commit936d5f139f0450ab1d6af96b5d91a776483e0455 (patch)
treebf5d34acf150c069aede591774a527f7fd58058a /src
parent82aa3e3f43b758fd0c22439288dc8d4e36515ae1 (diff)
downloadcalcurse-936d5f139f0450ab1d6af96b5d91a776483e0455.tar.gz
calcurse-936d5f139f0450ab1d6af96b5d91a776483e0455.zip
ical.c: Remove newlines from item summaries
Newline characters are not allowed in calcurse item descriptions. Replace any newlines in iCal summary lines with spaces. Fixes GitHub issue #6. Reported-by: Jonathan McCrohan <jmccrohan@gmail.com> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r--src/ical.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/ical.c b/src/ical.c
index 0aa5da7..d953b0e 100644
--- a/src/ical.c
+++ b/src/ical.c
@@ -843,13 +843,19 @@ static char *ical_read_summary(char *line)
{
char *p, *summary;
- if ((p = strchr(line, ':')) != NULL) {
- p++;
- summary = ical_unformat_line(p);
- return summary;
- } else {
+ p = strchr(line, ':');
+ if (!p)
return NULL;
- }
+
+ summary = ical_unformat_line(p + 1);
+ if (!summary)
+ return NULL;
+
+ /* Event summaries must not contain newlines. */
+ for (p = strchr(summary, '\n'); p; p = strchr(p, '\n'))
+ *p = ' ';
+
+ return summary;
}
static void