aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-09-23 17:31:56 +0000
committerFrederic Culot <calcurse@culot.org>2008-09-23 17:31:56 +0000
commit9a97689c484f2b54a3d15bf59f74abc67b8b38b1 (patch)
treecd781c8e94ecf31b93bb42f4732d6cbdedc36671
parent6ce12bfedf635cf5315aa854bae76a0d509bb786 (diff)
downloadcalcurse-9a97689c484f2b54a3d15bf59f74abc67b8b38b1.tar.gz
calcurse-9a97689c484f2b54a3d15bf59f74abc67b8b38b1.zip
Some fixes after ical import tests. Translations updated.
-rwxr-xr-xChangeLog11
-rwxr-xr-xpo/calcurse.pot70
-rw-r--r--po/de.po75
-rw-r--r--po/en.po75
-rw-r--r--po/es.po75
-rwxr-xr-xpo/fr.po81
-rw-r--r--po/nl.po75
-rwxr-xr-xsrc/io.c315
-rwxr-xr-xsrc/utils.c9
-rwxr-xr-xsrc/utils.h3
10 files changed, 493 insertions, 296 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a3f92c..1306c39 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-23 Frederic Culot <frederic@culot.org>
+
+ * src/io.c: some fixes after ical import tests
+
+ * src/io.c (ical_unfold_content, ical_unformat_line): new
+ functions
+
+ * po/fr.po: translation updated
+
+ * src/utils.c (mem_free): new function
+
2008-09-21 Frederic Culot <frederic@culot.org>
* src/utils.c (status_bar): 'I' keybinding added to import data
diff --git a/po/calcurse.pot b/po/calcurse.pot
index 2d1b7d8..71d2a14 100755
--- a/po/calcurse.pot
+++ b/po/calcurse.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-09-21 09:35+0200\n"
+"POT-Creation-Date: 2008-09-23 19:21+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -977,11 +977,11 @@ msgstr ""
msgid "Choose the file used to export calcurse data:"
msgstr ""
-#: src/io.c:186 src/io.c:2114
+#: src/io.c:186 src/io.c:2260
msgid "The file cannot be accessed, please enter another file name."
msgstr ""
-#: src/io.c:187 src/io.c:2115 src/recur.c:676
+#: src/io.c:187 src/io.c:2261 src/recur.c:676
msgid "Press [ENTER] to continue."
msgstr ""
@@ -1082,120 +1082,124 @@ msgstr ""
msgid "ERROR in ical_log: unknown ical type"
msgstr ""
-#: src/io.c:1656
+#: src/io.c:1786
msgid "recurrence frequence not found."
msgstr ""
-#: src/io.c:1674
+#: src/io.c:1804
msgid "recurrence frequence not recognized."
msgstr ""
-#: src/io.c:1720
+#: src/io.c:1853
msgid "recurrence rule malformed."
msgstr ""
-#: src/io.c:1775
+#: src/io.c:1908
msgid "recurrence exception dates malformed."
msgstr ""
-#: src/io.c:1796 src/io.c:2196
+#: src/io.c:1927 src/io.c:2342
msgid ""
"Warning: could not create new note file to store description. Aborting...\n"
msgstr ""
-#: src/io.c:1800
+#: src/io.c:1931
#, c-format
msgid "Warning: could not open %s, Aborting..."
msgstr ""
-#: src/io.c:1817
+#: src/io.c:1938
msgid "could not get entire item description."
msgstr ""
-#: src/io.c:1834
+#: src/io.c:1951
msgid "description malformed."
msgstr ""
-#: src/io.c:1893
+#: src/io.c:2027
msgid "appointment has no start time."
msgstr ""
-#: src/io.c:1902
+#: src/io.c:2035
msgid "could not compute duration (no end time)."
msgstr ""
-#: src/io.c:1931
+#: src/io.c:2054
+msgid "item has a negative duration."
+msgstr ""
+
+#: src/io.c:2071
msgid "item could not be identified."
msgstr ""
-#: src/io.c:1939 src/io.c:2060
-msgid "item has no summary."
+#: src/io.c:2079 src/io.c:2203
+msgid "could not retrieve item summary."
msgstr ""
-#: src/io.c:1955
+#: src/io.c:2095
msgid "could not retrieve event start time."
msgstr ""
-#: src/io.c:1969
+#: src/io.c:2108
msgid "could not retrieve event end time."
msgstr ""
-#: src/io.c:1979
+#: src/io.c:2117
msgid "item duration malformed."
msgstr ""
-#: src/io.c:2012 src/io.c:2103
+#: src/io.c:2146 src/io.c:2243
msgid "The ical file seems to be malformed. The end of item was not found."
msgstr ""
-#: src/io.c:2079
+#: src/io.c:2222
msgid "item priority is not acceptable (must be between 1 and 9)."
msgstr ""
-#: src/io.c:2112
+#: src/io.c:2258
msgid "Enter the file name to import data from:"
msgstr ""
-#: src/io.c:2155
+#: src/io.c:2301
#, c-format
msgid "Import process report: %04d lines read "
msgstr ""
-#: src/io.c:2157
+#: src/io.c:2303
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped "
msgstr ""
-#: src/io.c:2159
+#: src/io.c:2305
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped ([ENTER] to continue)"
msgstr ""
-#: src/io.c:2168
+#: src/io.c:2314
msgid "FATAL ERROR in io_import_data: unknown import type"
msgstr ""
-#: src/io.c:2174
+#: src/io.c:2320
msgid "FATAL ERROR: the input file cannot be accessed, Aborting..."
msgstr ""
-#: src/io.c:2181
+#: src/io.c:2327
msgid "FATAL ERROR in io_import_data: wrong import mode"
msgstr ""
-#: src/io.c:2191
-msgid "Warning: ical header malformed, wrong version number. Aborting..."
+#: src/io.c:2337
+msgid "Warning: ical header malformed or wrong version number. Aborting..."
msgstr ""
-#: src/io.c:2201
+#: src/io.c:2347
msgid "Warning: could not open temporary log file, Aborting..."
msgstr ""
-#: src/io.c:2246
+#: src/io.c:2393
msgid "Some items could not be imported, see log file ?"
msgstr ""
-#: src/io.c:2280
+#: src/io.c:2427
msgid "Warning: could not erase temporary log file, Aborting..."
msgstr ""
diff --git a/po/de.po b/po/de.po
index d98bab7..ac9abf3 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,4 +1,4 @@
-# $calcurse: de.po,v 1.17 2008/09/21 14:08:59 culot Exp $
+# $calcurse: de.po,v 1.18 2008/09/23 17:31:56 culot Exp $
#
# German translations for calcurse package.
# Copyright (C) 2006-2007 Michael Schulz <bloodshower@web.de>
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: calcurse 1.9\n"
"Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-09-21 09:35+0200\n"
+"POT-Creation-Date: 2008-09-23 19:21+0200\n"
"PO-Revision-Date: 2007-09-02 18:06+0200\n"
"Last-Translator: Michael\n"
"Language-Team: Michael Schulz <bloodshower@freenet.de>\n"
@@ -1325,13 +1325,13 @@ msgstr "Exportiere..."
msgid "Choose the file used to export calcurse data:"
msgstr "Wählen Sie die Datei in die exportiert werden soll:"
-#: src/io.c:186 src/io.c:2114
+#: src/io.c:186 src/io.c:2260
msgid "The file cannot be accessed, please enter another file name."
msgstr ""
"Auf die Datei kann nicht zugegriffen werden, bitte einen anderen Dateinamen "
"eingeben."
-#: src/io.c:187 src/io.c:2115 src/recur.c:676
+#: src/io.c:187 src/io.c:2261 src/recur.c:676
msgid "Press [ENTER] to continue."
msgstr "[EINGABE] um fortzufahren."
@@ -1442,124 +1442,129 @@ msgstr ""
msgid "ERROR in ical_log: unknown ical type"
msgstr "SCHWERER FEHLER in day_popup_item: unbekannter Eintragstyp\n"
-#: src/io.c:1656
+#: src/io.c:1786
msgid "recurrence frequence not found."
msgstr ""
-#: src/io.c:1674
+#: src/io.c:1804
msgid "recurrence frequence not recognized."
msgstr ""
-#: src/io.c:1720
+#: src/io.c:1853
msgid "recurrence rule malformed."
msgstr ""
-#: src/io.c:1775
+#: src/io.c:1908
msgid "recurrence exception dates malformed."
msgstr ""
-#: src/io.c:1796 src/io.c:2196
+#: src/io.c:1927 src/io.c:2342
msgid ""
"Warning: could not create new note file to store description. Aborting...\n"
msgstr ""
-#: src/io.c:1800
+#: src/io.c:1931
#, c-format
msgid "Warning: could not open %s, Aborting..."
msgstr ""
-#: src/io.c:1817
+#: src/io.c:1938
#, fuzzy
msgid "could not get entire item description."
msgstr "Geben Sie eine neue Beschreibung ein:"
-#: src/io.c:1834
+#: src/io.c:1951
msgid "description malformed."
msgstr ""
-#: src/io.c:1893
+#: src/io.c:2027
msgid "appointment has no start time."
msgstr ""
-#: src/io.c:1902
+#: src/io.c:2035
msgid "could not compute duration (no end time)."
msgstr ""
-#: src/io.c:1931
-msgid "item could not be identified."
+#: src/io.c:2054
+msgid "item has a negative duration."
msgstr ""
-#: src/io.c:1939 src/io.c:2060
-msgid "item has no summary."
+#: src/io.c:2071
+msgid "item could not be identified."
msgstr ""
-#: src/io.c:1955
+#: src/io.c:2079 src/io.c:2203
+#, fuzzy
+msgid "could not retrieve item summary."
+msgstr "Geben Sie eine neue Beschreibung ein:"
+
+#: src/io.c:2095
msgid "could not retrieve event start time."
msgstr ""
-#: src/io.c:1969
+#: src/io.c:2108
msgid "could not retrieve event end time."
msgstr ""
-#: src/io.c:1979
+#: src/io.c:2117
msgid "item duration malformed."
msgstr ""
-#: src/io.c:2012 src/io.c:2103
+#: src/io.c:2146 src/io.c:2243
msgid "The ical file seems to be malformed. The end of item was not found."
msgstr ""
-#: src/io.c:2079
+#: src/io.c:2222
msgid "item priority is not acceptable (must be between 1 and 9)."
msgstr ""
-#: src/io.c:2112
+#: src/io.c:2258
#, fuzzy
msgid "Enter the file name to import data from:"
msgstr "Wählen Sie die Datei in die exportiert werden soll:"
-#: src/io.c:2155
+#: src/io.c:2301
#, c-format
msgid "Import process report: %04d lines read "
msgstr ""
-#: src/io.c:2157
+#: src/io.c:2303
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped "
msgstr ""
-#: src/io.c:2159
+#: src/io.c:2305
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped ([ENTER] to continue)"
msgstr ""
-#: src/io.c:2168
+#: src/io.c:2314
#, fuzzy
msgid "FATAL ERROR in io_import_data: unknown import type"
msgstr "SCHWERER FEHLER in io_export_data: falscher Exportiermoduns\n"
-#: src/io.c:2174
+#: src/io.c:2320
msgid "FATAL ERROR: the input file cannot be accessed, Aborting..."
msgstr ""
-#: src/io.c:2181
+#: src/io.c:2327
#, fuzzy
msgid "FATAL ERROR in io_import_data: wrong import mode"
msgstr "SCHWERER FEHLER in io_export_data: falscher Exportiermoduns\n"
-#: src/io.c:2191
-msgid "Warning: ical header malformed, wrong version number. Aborting..."
+#: src/io.c:2337
+msgid "Warning: ical header malformed or wrong version number. Aborting..."
msgstr ""
-#: src/io.c:2201
+#: src/io.c:2347
msgid "Warning: could not open temporary log file, Aborting..."
msgstr ""
-#: src/io.c:2246
+#: src/io.c:2393
msgid "Some items could not be imported, see log file ?"
msgstr ""
-#: src/io.c:2280
+#: src/io.c:2427
msgid "Warning: could not erase temporary log file, Aborting..."
msgstr ""
diff --git a/po/en.po b/po/en.po
index b3327ca..f150342 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1,4 +1,4 @@
-# $calcurse: en.po,v 1.12 2008/09/21 14:08:59 culot Exp $
+# $calcurse: en.po,v 1.13 2008/09/23 17:31:56 culot Exp $
#
# English/GB translation of calcurse.
# Copyright (C) 2006 Copyright (c) Frederic Culot <frederic@culot.org>
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: calcurse 1.4\n"
"Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-09-21 09:35+0200\n"
+"POT-Creation-Date: 2008-09-23 19:21+0200\n"
"PO-Revision-Date: 2006-07-03 00:05+0100\n"
"Last-Translator: Neil Williams <linux@codehelp.co.uk>\n"
"Language-Team: English/GB <en_GB@li.org>\n"
@@ -1178,11 +1178,11 @@ msgstr "aborting...\n"
msgid "Choose the file used to export calcurse data:"
msgstr ""
-#: src/io.c:186 src/io.c:2114
+#: src/io.c:186 src/io.c:2260
msgid "The file cannot be accessed, please enter another file name."
msgstr ""
-#: src/io.c:187 src/io.c:2115 src/recur.c:676
+#: src/io.c:187 src/io.c:2261 src/recur.c:676
#, fuzzy
msgid "Press [ENTER] to continue."
msgstr "Press [ENTER] to continue"
@@ -1295,123 +1295,128 @@ msgstr ""
msgid "ERROR in ical_log: unknown ical type"
msgstr "FATAL ERROR in todo_delete_bynum: no such todo\n"
-#: src/io.c:1656
+#: src/io.c:1786
msgid "recurrence frequence not found."
msgstr ""
-#: src/io.c:1674
+#: src/io.c:1804
msgid "recurrence frequence not recognized."
msgstr ""
-#: src/io.c:1720
+#: src/io.c:1853
msgid "recurrence rule malformed."
msgstr ""
-#: src/io.c:1775
+#: src/io.c:1908
msgid "recurrence exception dates malformed."
msgstr ""
-#: src/io.c:1796 src/io.c:2196
+#: src/io.c:1927 src/io.c:2342
msgid ""
"Warning: could not create new note file to store description. Aborting...\n"
msgstr ""
-#: src/io.c:1800
+#: src/io.c:1931
#, c-format
msgid "Warning: could not open %s, Aborting..."
msgstr ""
-#: src/io.c:1817
+#: src/io.c:1938
#, fuzzy
msgid "could not get entire item description."
msgstr "Enter description :"
-#: src/io.c:1834
+#: src/io.c:1951
msgid "description malformed."
msgstr ""
-#: src/io.c:1893
+#: src/io.c:2027
msgid "appointment has no start time."
msgstr ""
-#: src/io.c:1902
+#: src/io.c:2035
msgid "could not compute duration (no end time)."
msgstr ""
-#: src/io.c:1931
-msgid "item could not be identified."
+#: src/io.c:2054
+msgid "item has a negative duration."
msgstr ""
-#: src/io.c:1939 src/io.c:2060
-msgid "item has no summary."
+#: src/io.c:2071
+msgid "item could not be identified."
msgstr ""
-#: src/io.c:1955
+#: src/io.c:2079 src/io.c:2203
+#, fuzzy
+msgid "could not retrieve item summary."
+msgstr "Enter description :"
+
+#: src/io.c:2095
msgid "could not retrieve event start time."
msgstr ""
-#: src/io.c:1969
+#: src/io.c:2108
msgid "could not retrieve event end time."
msgstr ""
-#: src/io.c:1979
+#: src/io.c:2117
msgid "item duration malformed."
msgstr ""
-#: src/io.c:2012 src/io.c:2103
+#: src/io.c:2146 src/io.c:2243
msgid "The ical file seems to be malformed. The end of item was not found."
msgstr ""
-#: src/io.c:2079
+#: src/io.c:2222
msgid "item priority is not acceptable (must be between 1 and 9)."
msgstr ""
-#: src/io.c:2112
+#: src/io.c:2258
msgid "Enter the file name to import data from:"
msgstr ""
-#: src/io.c:2155
+#: src/io.c:2301
#, c-format
msgid "Import process report: %04d lines read "
msgstr ""
-#: src/io.c:2157
+#: src/io.c:2303
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped "
msgstr ""
-#: src/io.c:2159
+#: src/io.c:2305
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped ([ENTER] to continue)"
msgstr ""
-#: src/io.c:2168
+#: src/io.c:2314
#, fuzzy
msgid "FATAL ERROR in io_import_data: unknown import type"
msgstr "FATAL ERROR in todo_delete_bynum: no such todo\n"
-#: src/io.c:2174
+#: src/io.c:2320
msgid "FATAL ERROR: the input file cannot be accessed, Aborting..."
msgstr ""
-#: src/io.c:2181
+#: src/io.c:2327
#, fuzzy
msgid "FATAL ERROR in io_import_data: wrong import mode"
msgstr "FATAL ERROR in todo_delete_bynum: no such todo\n"
-#: src/io.c:2191
-msgid "Warning: ical header malformed, wrong version number. Aborting..."
+#: src/io.c:2337
+msgid "Warning: ical header malformed or wrong version number. Aborting..."
msgstr ""
-#: src/io.c:2201
+#: src/io.c:2347
msgid "Warning: could not open temporary log file, Aborting..."
msgstr ""
-#: src/io.c:2246
+#: src/io.c:2393
msgid "Some items could not be imported, see log file ?"
msgstr ""
-#: src/io.c:2280
+#: src/io.c:2427
msgid "Warning: could not erase temporary log file, Aborting..."
msgstr ""
diff --git a/po/es.po b/po/es.po
index 0100d1b..5fdf7c9 100644
--- a/po/es.po
+++ b/po/es.po
@@ -1,4 +1,4 @@
-# $calcurse: es.po,v 1.13 2008/09/21 14:08:59 culot Exp $
+# $calcurse: es.po,v 1.14 2008/09/23 17:31:56 culot Exp $
#
# Spanish translations for calcurse package.
# Copyright (c) Jose Lopez <testinground@gmail.com> 2006 Free Software Foundation, Inc.
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Calcurse 1.8\n"
"Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-09-21 09:35+0200\n"
+"POT-Creation-Date: 2008-09-23 19:21+0200\n"
"PO-Revision-Date: 2006-09-10 08:06+0200\n"
"Last-Translator: Jose Lopez <testinground@gmail.com>\n"
"Language-Team: Jose Lopez <testinground@gmail.com>\n"
@@ -1329,11 +1329,11 @@ msgstr "Exportando..."
msgid "Choose the file used to export calcurse data:"
msgstr "Elige el archivo que se usara para exportar los datos de Calcurse:"
-#: src/io.c:186 src/io.c:2114
+#: src/io.c:186 src/io.c:2260
msgid "The file cannot be accessed, please enter another file name."
msgstr "El archivo no es accesible, por favor elige otro nombre de archivo."
-#: src/io.c:187 src/io.c:2115 src/recur.c:676
+#: src/io.c:187 src/io.c:2261 src/recur.c:676
msgid "Press [ENTER] to continue."
msgstr "Pulsa [INTRO] para continuar."
@@ -1443,124 +1443,129 @@ msgstr ""
msgid "ERROR in ical_log: unknown ical type"
msgstr "ERROR FATAL en day_popup_item: no existe ese tipo\n"
-#: src/io.c:1656
+#: src/io.c:1786
msgid "recurrence frequence not found."
msgstr ""
-#: src/io.c:1674
+#: src/io.c:1804
msgid "recurrence frequence not recognized."
msgstr ""
-#: src/io.c:1720
+#: src/io.c:1853
msgid "recurrence rule malformed."
msgstr ""
-#: src/io.c:1775
+#: src/io.c:1908
msgid "recurrence exception dates malformed."
msgstr ""
-#: src/io.c:1796 src/io.c:2196
+#: src/io.c:1927 src/io.c:2342
msgid ""
"Warning: could not create new note file to store description. Aborting...\n"
msgstr ""
-#: src/io.c:1800
+#: src/io.c:1931
#, c-format
msgid "Warning: could not open %s, Aborting..."
msgstr ""
-#: src/io.c:1817
+#: src/io.c:1938
#, fuzzy
msgid "could not get entire item description."
msgstr "Introduce la descripcion del nuevo elemento:"
-#: src/io.c:1834
+#: src/io.c:1951
msgid "description malformed."
msgstr ""
-#: src/io.c:1893
+#: src/io.c:2027
msgid "appointment has no start time."
msgstr ""
-#: src/io.c:1902
+#: src/io.c:2035
msgid "could not compute duration (no end time)."
msgstr ""
-#: src/io.c:1931
-msgid "item could not be identified."
+#: src/io.c:2054
+msgid "item has a negative duration."
msgstr ""
-#: src/io.c:1939 src/io.c:2060
-msgid "item has no summary."
+#: src/io.c:2071
+msgid "item could not be identified."
msgstr ""
-#: src/io.c:1955
+#: src/io.c:2079 src/io.c:2203
+#, fuzzy
+msgid "could not retrieve item summary."
+msgstr "Introduce la descripcion del nuevo elemento:"
+
+#: src/io.c:2095
msgid "could not retrieve event start time."
msgstr ""
-#: src/io.c:1969
+#: src/io.c:2108
msgid "could not retrieve event end time."
msgstr ""
-#: src/io.c:1979
+#: src/io.c:2117
msgid "item duration malformed."
msgstr ""
-#: src/io.c:2012 src/io.c:2103
+#: src/io.c:2146 src/io.c:2243
msgid "The ical file seems to be malformed. The end of item was not found."
msgstr ""
-#: src/io.c:2079
+#: src/io.c:2222
msgid "item priority is not acceptable (must be between 1 and 9)."
msgstr ""
-#: src/io.c:2112
+#: src/io.c:2258
#, fuzzy
msgid "Enter the file name to import data from:"
msgstr "Elige el archivo que se usara para exportar los datos de Calcurse:"
-#: src/io.c:2155
+#: src/io.c:2301
#, c-format
msgid "Import process report: %04d lines read "
msgstr ""
-#: src/io.c:2157
+#: src/io.c:2303
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped "
msgstr ""
-#: src/io.c:2159
+#: src/io.c:2305
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped ([ENTER] to continue)"
msgstr ""
-#: src/io.c:2168
+#: src/io.c:2314
#, fuzzy
msgid "FATAL ERROR in io_import_data: unknown import type"
msgstr "ERROR FATAL en io_export_data: modo de exportacion erroneo\n"
-#: src/io.c:2174
+#: src/io.c:2320
msgid "FATAL ERROR: the input file cannot be accessed, Aborting..."
msgstr ""
-#: src/io.c:2181
+#: src/io.c:2327
#, fuzzy
msgid "FATAL ERROR in io_import_data: wrong import mode"
msgstr "ERROR FATAL en io_export_data: modo de exportacion erroneo\n"
-#: src/io.c:2191
-msgid "Warning: ical header malformed, wrong version number. Aborting..."
+#: src/io.c:2337
+msgid "Warning: ical header malformed or wrong version number. Aborting..."
msgstr ""
-#: src/io.c:2201
+#: src/io.c:2347
msgid "Warning: could not open temporary log file, Aborting..."
msgstr ""
-#: src/io.c:2246
+#: src/io.c:2393
msgid "Some items could not be imported, see log file ?"
msgstr ""
-#: src/io.c:2280
+#: src/io.c:2427
msgid "Warning: could not erase temporary log file, Aborting..."
msgstr ""
diff --git a/po/fr.po b/po/fr.po
index 54d33e2..7a80717 100755
--- a/po/fr.po
+++ b/po/fr.po
@@ -1,4 +1,4 @@
-# $calcurse: fr.po,v 1.23 2008/09/21 14:08:59 culot Exp $
+# $calcurse: fr.po,v 1.24 2008/09/23 17:31:56 culot Exp $
#
# French translations for calcurse package.
# Copyright (C) 2004-2008 Frederic Culot <frederic@culot.org>
@@ -9,8 +9,8 @@ msgid ""
msgstr ""
"Project-Id-Version: calcurse 2.1\n"
"Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-09-21 09:35+0200\n"
-"PO-Revision-Date: 2008-09-21 16:03+0200\n"
+"POT-Creation-Date: 2008-09-23 19:21+0200\n"
+"PO-Revision-Date: 2008-09-23 19:21+0200\n"
"Last-Translator: Frederic Culot <frederic@culot.org>\n"
"Language-Team: French <calcurse-i18n@culot.org>\n"
"MIME-Version: 1.0\n"
@@ -1412,11 +1412,11 @@ msgstr "Export..."
msgid "Choose the file used to export calcurse data:"
msgstr "Choisissez le fichier dans lequel exporter les données:"
-#: src/io.c:186 src/io.c:2114
+#: src/io.c:186 src/io.c:2260
msgid "The file cannot be accessed, please enter another file name."
msgstr "Le fichier ne peut être ouvert, veuillez entrer un nouveau nom."
-#: src/io.c:187 src/io.c:2115 src/recur.c:676
+#: src/io.c:187 src/io.c:2261 src/recur.c:676
msgid "Press [ENTER] to continue."
msgstr "Appuyez sur [ENTREE] pour continuer."
@@ -1522,125 +1522,129 @@ msgstr "Pcal"
msgid "ERROR in ical_log: unknown ical type"
msgstr "ERREUR FATALE dans ical_log: type ical inconnu"
-#: src/io.c:1656
+#: src/io.c:1786
msgid "recurrence frequence not found."
msgstr "la fréquence de répétition n'a pas été trouvée."
-#: src/io.c:1674
+#: src/io.c:1804
msgid "recurrence frequence not recognized."
msgstr "la fréquence de répétition est inconnue."
-#: src/io.c:1720
+#: src/io.c:1853
msgid "recurrence rule malformed."
msgstr "la règle de répétition est mal formée."
-#: src/io.c:1775
+#: src/io.c:1908
msgid "recurrence exception dates malformed."
msgstr "les dates à ne pas répéter sont mal formées."
-#: src/io.c:1796 src/io.c:2196
+#: src/io.c:1927 src/io.c:2342
msgid ""
"Warning: could not create new note file to store description. Aborting...\n"
msgstr ""
"Impossible de créer une nouvelle note pour enregistrer la déscription. "
"Abandon...\n"
-#: src/io.c:1800
+#: src/io.c:1931
#, c-format
msgid "Warning: could not open %s, Aborting..."
msgstr "Alerte: impossible d'ouvrir %s, abandon..."
-#: src/io.c:1817
+#: src/io.c:1938
msgid "could not get entire item description."
msgstr "impossible de trouver la description entière de l'élément."
-#: src/io.c:1834
+#: src/io.c:1951
msgid "description malformed."
msgstr "déscription mal formée."
-#: src/io.c:1893
+#: src/io.c:2027
msgid "appointment has no start time."
msgstr "le rendez-vous n'a pas de date de début."
-#: src/io.c:1902
+#: src/io.c:2035
msgid "could not compute duration (no end time)."
msgstr "impossible de calculer la durée (pas de date de fin)."
-#: src/io.c:1931
+#: src/io.c:2054
+msgid "item has a negative duration."
+msgstr "L'élément a une durée négative."
+
+#: src/io.c:2071
msgid "item could not be identified."
msgstr "L'élément n'a pu être identifié."
-#: src/io.c:1939 src/io.c:2060
-msgid "item has no summary."
-msgstr "L'élément n'a pas de résumé."
+#: src/io.c:2079 src/io.c:2203
+msgid "could not retrieve item summary."
+msgstr "impossible de récupérer le résumé de l'évènement."
-#: src/io.c:1955
+#: src/io.c:2095
msgid "could not retrieve event start time."
msgstr "impossible de récupérer l'heure de début de l'évènement."
-#: src/io.c:1969
+#: src/io.c:2108
msgid "could not retrieve event end time."
msgstr "impossible de récupérer l'heure de fin de l'évènement."
-#: src/io.c:1979
+#: src/io.c:2117
msgid "item duration malformed."
msgstr "la durée de l'élément est mal formée."
-#: src/io.c:2012 src/io.c:2103
+#: src/io.c:2146 src/io.c:2243
msgid "The ical file seems to be malformed. The end of item was not found."
msgstr ""
"Le fichier ical semble erroné. La fin de l'élément n'a pas été trouvée."
-#: src/io.c:2079
+#: src/io.c:2222
msgid "item priority is not acceptable (must be between 1 and 9)."
msgstr "La priorité de l'élément est erronée (devrait être entre 1 et 9)."
-#: src/io.c:2112
+#: src/io.c:2258
msgid "Enter the file name to import data from:"
msgstr "Entrez le nom du fichier depuis lequel importer les données:"
-#: src/io.c:2155
+#: src/io.c:2301
#, c-format
msgid "Import process report: %04d lines read "
msgstr "Rapport sur les données importées: %04d lignes lues "
-#: src/io.c:2157
+#: src/io.c:2303
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped "
msgstr "%d rdv / %d évnts / %d tâches / %d erronés "
-#: src/io.c:2159
+#: src/io.c:2305
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped ([ENTER] to continue)"
msgstr "%d rdv / %d évnts / %d tâches / %d erronés ([ENTREE] pour continuer)"
-#: src/io.c:2168
+#: src/io.c:2314
msgid "FATAL ERROR in io_import_data: unknown import type"
msgstr "ERREUR FATALE dans io_import_data: mauvais mode d'import"
-#: src/io.c:2174
+#: src/io.c:2320
msgid "FATAL ERROR: the input file cannot be accessed, Aborting..."
msgstr "ERREUR FATALE: le fichier d'entrée n'a pu être ouvert, abandon..."
-#: src/io.c:2181
+#: src/io.c:2327
msgid "FATAL ERROR in io_import_data: wrong import mode"
msgstr "ERREUR FATALE dans io_import_data: mauvais mode d'import"
-#: src/io.c:2191
-msgid "Warning: ical header malformed, wrong version number. Aborting..."
+#: src/io.c:2337
+msgid "Warning: ical header malformed or wrong version number. Aborting..."
msgstr ""
-"Attention: l'en-tête ical est mal formé, mauvais numéro de version. "
+"Attention: l'en-tête ical est mal formé ou le numéro de version est mauvais. "
"Abandon..."
-#: src/io.c:2201
+#: src/io.c:2347
msgid "Warning: could not open temporary log file, Aborting..."
msgstr "Attention: impossible d'ouvrir le fichier de log, abandon..."
-#: src/io.c:2246
+#: src/io.c:2393
msgid "Some items could not be imported, see log file ?"
msgstr "Certains éléments n'ont pu être importés, voir le fichier de log ?"
-#: src/io.c:2280
+#: src/io.c:2427
msgid "Warning: could not erase temporary log file, Aborting..."
msgstr "Attention: impossible d'effacer le fichier de log, abandon..."
@@ -2098,6 +2102,9 @@ msgstr "Tâches"
msgid "FATAL ERROR in wins_update: no window selected\n"
msgstr "ERREUR FATALE dans wins_update: aucune fenêtre sélectionnée\n"
+#~ msgid "item has no summary."
+#~ msgstr "L'élément n'a pas de résumé."
+
#~ msgid "CalCurse %s | help"
#~ msgstr "Calcurse %s | aide"
diff --git a/po/nl.po b/po/nl.po
index 5d8276a..4eb460c 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -1,4 +1,4 @@
-# $calcurse: nl.po,v 1.10 2008/09/21 14:08:59 culot Exp $
+# $calcurse: nl.po,v 1.11 2008/09/23 17:31:56 culot Exp $
#
# Dutch translations for calcurse package.
# Copyright (C) 2007-2008 Jeremy Roon <p.roon@chello.nl>
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: calcurse 2.1\n"
"Report-Msgid-Bugs-To: frederic@culot.org\n"
-"POT-Creation-Date: 2008-09-21 09:35+0200\n"
+"POT-Creation-Date: 2008-09-23 19:21+0200\n"
"PO-Revision-Date: 2008-05-03 21:35+0200\n"
"Last-Translator: Jeremy Roon\n"
"Language-Team: Jeremy Roon <p.roon@chello.nl>\n"
@@ -1312,11 +1312,11 @@ msgstr "Exporteren..."
msgid "Choose the file used to export calcurse data:"
msgstr "Kies het bestand om calcurse data naar te exporteren:"
-#: src/io.c:186 src/io.c:2114
+#: src/io.c:186 src/io.c:2260
msgid "The file cannot be accessed, please enter another file name."
msgstr "Het bestand is ontoegankelijk, kies een andere bestandsnaam."
-#: src/io.c:187 src/io.c:2115 src/recur.c:676
+#: src/io.c:187 src/io.c:2261 src/recur.c:676
msgid "Press [ENTER] to continue."
msgstr "[ENTER]-toets om door te gaan."
@@ -1423,125 +1423,130 @@ msgstr ""
msgid "ERROR in ical_log: unknown ical type"
msgstr "FATALE FOUT in day_popup_item: onbekend itemtype\n"
-#: src/io.c:1656
+#: src/io.c:1786
msgid "recurrence frequence not found."
msgstr ""
-#: src/io.c:1674
+#: src/io.c:1804
msgid "recurrence frequence not recognized."
msgstr ""
-#: src/io.c:1720
+#: src/io.c:1853
msgid "recurrence rule malformed."
msgstr ""
-#: src/io.c:1775
+#: src/io.c:1908
msgid "recurrence exception dates malformed."
msgstr ""
-#: src/io.c:1796 src/io.c:2196
+#: src/io.c:1927 src/io.c:2342
msgid ""
"Warning: could not create new note file to store description. Aborting...\n"
msgstr ""
-#: src/io.c:1800
+#: src/io.c:1931
#, c-format
msgid "Warning: could not open %s, Aborting..."
msgstr ""
-#: src/io.c:1817
+#: src/io.c:1938
#, fuzzy
msgid "could not get entire item description."
msgstr "Voer een nieuwe beschrijving in:"
-#: src/io.c:1834
+#: src/io.c:1951
msgid "description malformed."
msgstr ""
-#: src/io.c:1893
+#: src/io.c:2027
msgid "appointment has no start time."
msgstr ""
-#: src/io.c:1902
+#: src/io.c:2035
msgid "could not compute duration (no end time)."
msgstr ""
-#: src/io.c:1931
-msgid "item could not be identified."
+#: src/io.c:2054
+msgid "item has a negative duration."
msgstr ""
-#: src/io.c:1939 src/io.c:2060
-msgid "item has no summary."
+#: src/io.c:2071
+msgid "item could not be identified."
msgstr ""
-#: src/io.c:1955
+#: src/io.c:2079 src/io.c:2203
+#, fuzzy
+msgid "could not retrieve item summary."
+msgstr "Voer een nieuwe beschrijving in:"
+
+#: src/io.c:2095
msgid "could not retrieve event start time."
msgstr ""
-#: src/io.c:1969
+#: src/io.c:2108
msgid "could not retrieve event end time."
msgstr ""
-#: src/io.c:1979
+#: src/io.c:2117
msgid "item duration malformed."
msgstr ""
-#: src/io.c:2012 src/io.c:2103
+#: src/io.c:2146 src/io.c:2243
msgid "The ical file seems to be malformed. The end of item was not found."
msgstr ""
-#: src/io.c:2079
+#: src/io.c:2222
msgid "item priority is not acceptable (must be between 1 and 9)."
msgstr ""
-#: src/io.c:2112
+#: src/io.c:2258
#, fuzzy
msgid "Enter the file name to import data from:"
msgstr "Kies het bestand om calcurse data naar te exporteren:"
-#: src/io.c:2155
+#: src/io.c:2301
#, c-format
msgid "Import process report: %04d lines read "
msgstr ""
-#: src/io.c:2157
+#: src/io.c:2303
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped "
msgstr ""
-#: src/io.c:2159
+#: src/io.c:2305
#, c-format
msgid "%d apps / %d events / %d todos / %d skipped ([ENTER] to continue)"
msgstr ""
-#: src/io.c:2168
+#: src/io.c:2314
#, fuzzy
msgid "FATAL ERROR in io_import_data: unknown import type"
msgstr "FATALE FOUT in io_export_data: verkeerde export modus\n"
-#: src/io.c:2174
+#: src/io.c:2320
#, fuzzy
msgid "FATAL ERROR: the input file cannot be accessed, Aborting..."
msgstr "FATALE FOUT: tijdelijk bestand kan niet worden aangemaakt!"
-#: src/io.c:2181
+#: src/io.c:2327
#, fuzzy
msgid "FATAL ERROR in io_import_data: wrong import mode"
msgstr "FATALE FOUT in io_export_data: verkeerde export modus\n"
-#: src/io.c:2191
-msgid "Warning: ical header malformed, wrong version number. Aborting..."
+#: src/io.c:2337
+msgid "Warning: ical header malformed or wrong version number. Aborting..."
msgstr ""
-#: src/io.c:2201
+#: src/io.c:2347
msgid "Warning: could not open temporary log file, Aborting..."
msgstr ""
-#: src/io.c:2246
+#: src/io.c:2393
msgid "Some items could not be imported, see log file ?"
msgstr ""
-#: src/io.c:2280
+#: src/io.c:2427
msgid "Warning: could not erase temporary log file, Aborting..."
msgstr ""
diff --git a/src/io.c b/src/io.c
index 545d565..2fb334c 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.37 2008/09/21 08:06:43 culot Exp $ */
+/* $calcurse: io.c,v 1.38 2008/09/23 17:31:56 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -1369,6 +1369,8 @@ static void
ical_store_todo (int priority, char *mesg, char *note)
{
todo_add (mesg, priority, note);
+ mem_free (mesg);
+ mem_free (note);
}
static void
@@ -1381,14 +1383,14 @@ ical_store_event (char *mesg, char *note, long day, ical_rpt_t *rpt,
{
recur_event_new (mesg, note, day, EVENTID, rpt->type, rpt->freq,
rpt->until, exc);
- free (rpt);
+ mem_free (rpt);
}
else
{
event_new (mesg, note, day, EVENTID);
}
- if (note)
- free (note);
+ mem_free (mesg);
+ mem_free (note);
}
static void
@@ -1403,14 +1405,142 @@ ical_store_apoint (char *mesg, char *note, long start, long dur,
{
recur_apoint_new (mesg, note, start, dur, state, rpt->type, rpt->freq,
rpt->until, exc);
- free (rpt);
+ mem_free (rpt);
}
else
{
apoint_new (mesg, note, start, dur, state);
}
- if (note)
- free (note);
+ mem_free (mesg);
+ mem_free (note);
+}
+
+/*
+ * Returns an allocated string representing the string given in argument once
+ * unformatted. See ical_unfold_content () below.
+ *
+ * Note:
+ * Even if the RFC2445 recommends not to have more than 75 octets on one line of
+ * text, I prefer not to restrict the parsing to this size, thus I use a buffer
+ * of size BUFSIZ.
+ *
+ * Extract from RFC2445:
+ * Lines of text SHOULD NOT be longer than 75 octets, excluding the line
+ * break.
+ */
+static char *
+ical_unformat_line (char *line)
+{
+#define LINE_FEED 0x0a
+#define CARRIAGE_RETURN 0x0d
+ char *p, uline[BUFSIZ];
+ int len;
+
+ if (strlen (line) >= BUFSIZ)
+ return NULL;
+
+ bzero (uline, BUFSIZ);
+ for (len = 0, p = line; *p; p++)
+ {
+ switch (*p)
+ {
+ case LINE_FEED:
+ return strdup (uline);
+ case CARRIAGE_RETURN:
+ break;
+ case '\\':
+ switch (*(p + 1))
+ {
+ case 'n':
+ uline[len++] = '\n';
+ p++;
+ break;
+ case 't':
+ uline[len++] = '\t';
+ p++;
+ break;
+ case ';':
+ case ':':
+ case ',':
+ uline[len++] = *(p + 1);
+ p++;
+ break;
+ default:
+ uline[len++] = *p;
+ break;
+ }
+ break;
+ default:
+ uline[len++] = *p;
+ break;
+ }
+ }
+#undef LINE_FEED
+#undef CARRIAGE_RETURN
+ return NULL;
+}
+
+/*
+ * Extract from RFC2445:
+ *
+ * When parsing a content line, folded lines MUST first be
+ * unfolded [..] The content information associated with an iCalendar
+ * object is formatted using a syntax similar to that defined by [RFC 2425].
+ */
+static char *
+ical_unfold_content (FILE *fd, char *line, unsigned *lineno)
+{
+ const int CHAR_SPACE = 32, CHAR_TAB = 9;
+ char *content;
+ int c;
+
+ content = ical_unformat_line (line);
+ if (!content)
+ return NULL;
+
+ for (;;)
+ {
+ c = getc (fd);
+ if (c == CHAR_SPACE || c == CHAR_TAB)
+ {
+ char buf[BUFSIZ];
+
+ if (fgets (buf, BUFSIZ, fd) != NULL)
+ {
+ char *tmpline, *rline;
+ int newsize;
+
+ (*lineno)++;
+ tmpline = ical_unformat_line (buf);
+ if (!tmpline)
+ {
+ mem_free (content);
+ return NULL;
+ }
+ newsize = strlen (content) + strlen (tmpline) + 1;
+ if ((rline = realloc (content, newsize)) == NULL)
+ {
+ mem_free (content);
+ mem_free (tmpline);
+ return NULL;
+ }
+ content = rline;
+ strncat (content, tmpline, BUFSIZ);
+ mem_free (tmpline);
+ }
+ else
+ {
+ mem_free (content);
+ return NULL;
+ /* Could not get entire item description. */
+ }
+ }
+ else
+ {
+ ungetc (c, fd);
+ return content;
+ }
+ }
}
static float
@@ -1641,21 +1771,21 @@ ical_read_rrule (FILE *log, char *rrulestr, unsigned *noskipped,
const string_t yearly = STRING_BUILD ("YEARLY");
unsigned interval;
ical_rpt_t *rpt;
- char *p;
+ char *p, *q;
rpt = NULL;
if ((p = strchr (rrulestr, ':')) != NULL)
{
- char freqstr[BUFSIZ], untilstr[BUFSIZ];
+ char freqstr[BUFSIZ];
p++;
rpt = malloc (sizeof (ical_rpt_t));
- if (sscanf (p, "FREQ=%s;", freqstr) != 1)
+ if (sscanf (p, "FREQ=%s", freqstr) != 1)
{
ical_log (log, ICAL_VEVENT, itemline,
_("recurrence frequence not found."));
(*noskipped)++;
- free (rpt);
+ mem_free (rpt);
return NULL;
}
else
@@ -1673,7 +1803,7 @@ ical_read_rrule (FILE *log, char *rrulestr, unsigned *noskipped,
ical_log (log, ICAL_VEVENT, itemline,
_("recurrence frequence not recognized."));
(*noskipped)++;
- free (rpt);
+ mem_free (rpt);
return NULL;
}
}
@@ -1687,15 +1817,18 @@ ical_read_rrule (FILE *log, char *rrulestr, unsigned *noskipped,
range-bound the recurrence. The "DTSTART" property value, if
specified, counts as the first occurrence.
*/
- if (sscanf (p, "UNTIL=%s;", untilstr) == 1)
+ if ((q = strstr (p, "UNTIL")) != NULL)
{
- rpt->until = ical_datetime2long (untilstr, NULL);
+ char *untilstr;
+
+ untilstr = strchr (q, '=');
+ rpt->until = ical_datetime2long (++untilstr, NULL);
}
else
{
unsigned count;
- if (sscanf (p, "COUNT=%u;", &count) != 1)
+ if (sscanf (p, "COUNT=%u", &count) != 1)
{
rpt->until = 0;
/* endless repetition */
@@ -1705,7 +1838,7 @@ ical_read_rrule (FILE *log, char *rrulestr, unsigned *noskipped,
rpt->count = count;
}
}
- if (sscanf (p, "INTERVAL=%u;", &interval) == 1)
+ if (sscanf (p, "INTERVAL=%u", &interval) == 1)
{
rpt->freq = interval;
}
@@ -1778,17 +1911,15 @@ ical_read_exdate (FILE *log, char *exstr, unsigned *noskipped,
return exc;
}
+/* Return an allocated string containing the name of the newly created note. */
static char *
ical_read_note (char *first_line, FILE *fdi, unsigned *noskipped,
unsigned *lineno, ical_vevent_e item_type, const int itemline,
FILE *log)
{
- const int CHAR_SPACE = 32, CHAR_TAB = 9;
- char *p, *note, *notename, buf[BUFSIZ], fullnotename[BUFSIZ];
+ char *p, *notestr, *notename, fullnotename[BUFSIZ];
FILE *fdo;
- int c;
- note = NULL;
if ((p = strchr (first_line, ':')) != NULL)
{
notename = new_tempfile (path_notes, NOTESIZ);
@@ -1800,34 +1931,20 @@ ical_read_note (char *first_line, FILE *fdi, unsigned *noskipped,
EXIT_IF (fdo == NULL, _("Warning: could not open %s, Aborting..."),
fullnotename);
p++;
- fprintf (fdo, "%s", p);
- for (;;)
+ notestr = ical_unfold_content (fdi, p, lineno);
+ if (notestr == NULL)
{
- c = getc (fdi);
- if (c == CHAR_SPACE || c == CHAR_TAB)
- {
- if (fgets (buf, BUFSIZ, fdi) != NULL)
- {
- (*lineno)++;
- fprintf (fdo, "%s", buf);
- }
- else
- {
- ical_log (log, item_type, itemline,
- _("could not get entire item description."));
- fclose (fdo);
- erase_note (&notename, ERASE_FORCE);
- (*noskipped)++;
- return NULL;
- }
- }
- else
- {
- ungetc (c, fdi);
- fclose (fdo);
- return notename;
- }
+ ical_log (log, item_type, itemline,
+ _("could not get entire item description."));
+ fclose (fdo);
+ erase_note (&notename, ERASE_FORCE);
+ (*noskipped)++;
+ return NULL;
}
+ fprintf (fdo, "%s", notestr);
+ fclose (fdo);
+ mem_free (notestr);
+ return notename;
}
else
{
@@ -1837,6 +1954,23 @@ ical_read_note (char *first_line, FILE *fdi, unsigned *noskipped,
}
}
+/* Returns an allocated string containing the ical item summary. */
+static char *
+
+ical_read_summary (char *first_line, FILE *fdi, unsigned *lineno)
+{
+ char *p, *summary;
+
+ if ((p = strchr (first_line, ':')) != NULL)
+ {
+ p++;
+ summary = ical_unfold_content (fdi, p, lineno);
+ return summary;
+ }
+ else
+ return NULL;
+}
+
static void
ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
unsigned *noskipped, unsigned *lineno)
@@ -1858,9 +1992,9 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
struct {
days_t *exc;
ical_rpt_t *rpt;
- char mesg[BUFSIZ], *note;
+ char *mesg, *note;
long start, end, dur;
- int has_summary, has_alarm;
+ int has_alarm;
} vevent;
int skip_alarm;
@@ -1882,7 +2016,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
}
if (strncmp (buf_upper, endevent.str, endevent.len) == 0)
{
- if (vevent.has_summary)
+ if (vevent.mesg)
{
switch (vevent_type)
{
@@ -1891,8 +2025,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
{
ical_log (log, ICAL_VEVENT, ITEMLINE,
_("appointment has no start time."));
- (*noskipped)++;
- return;
+ goto cleanup;
}
if (vevent.dur == 0)
{
@@ -1901,8 +2034,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
ical_log (log, ICAL_VEVENT, ITEMLINE,
_("could not compute duration "
"(no end time)."));
- (*noskipped)++;
- return;
+ goto cleanup;
}
else if (vevent.start == vevent.end)
{
@@ -1914,7 +2046,15 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
return;
}
else
- vevent.dur = vevent.start - vevent.end;
+ {
+ vevent.dur = vevent.end - vevent.start;
+ if (vevent.dur < 0)
+ {
+ ical_log (log, ICAL_VEVENT, ITEMLINE,
+ _("item has a negative duration."));
+ goto cleanup;
+ }
+ }
}
ical_store_apoint (vevent.mesg, vevent.note, vevent.start,
vevent.dur, vevent.rpt, vevent.exc,
@@ -1929,15 +2069,15 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
case UNDEFINED:
ical_log (log, ICAL_VEVENT, ITEMLINE,
_("item could not be identified."));
- (*noskipped)++;
- return;
+ goto cleanup;
break;
}
}
else
{
- ical_log (log, ICAL_VEVENT, ITEMLINE, _("item has no summary."));
- (*noskipped)++;
+ ical_log (log, ICAL_VEVENT, ITEMLINE,
+ _("could not retrieve item summary."));
+ goto cleanup;
}
return;
}
@@ -1953,8 +2093,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
{
ical_log (log, ICAL_VEVENT, ITEMLINE,
_("could not retrieve event start time."));
- (*noskipped)++;
- return;
+ goto cleanup;
}
}
else if (strncmp (buf_upper, dtend.str, dtend.len) == 0)
@@ -1967,8 +2106,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
{
ical_log (log, ICAL_VEVENT, ITEMLINE,
_("could not retrieve event end time."));
- (*noskipped)++;
- return;
+ goto cleanup;
}
}
else if (strncmp (buf_upper, duration.str, duration.len) == 0)
@@ -1977,8 +2115,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
{
ical_log (log, ICAL_VEVENT, ITEMLINE,
_("item duration malformed."));
- (*noskipped)++;
- return;
+ goto cleanup;
}
}
else if (strncmp (buf_upper, rrule.str, rrule.len) == 0)
@@ -1991,10 +2128,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
}
else if (strncmp (buf_upper, summary.str, summary.len) == 0)
{
- const int sumlen = strlen (buf) - summary.len - 1;
- memcpy (vevent.mesg, buf + summary.len, sumlen);
- vevent.mesg[sumlen - 1] = '\0';
- vevent.has_summary = 1;
+ vevent.mesg = ical_read_summary (buf, fdi, lineno);
}
else if (strncmp (buf_upper, alarm.str, alarm.len) == 0)
{
@@ -2011,6 +2145,14 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
ical_log (log, ICAL_VEVENT, ITEMLINE,
_("The ical file seems to be malformed. "
"The end of item was not found."));
+
+cleanup:
+
+ mem_free (vevent.note);
+ mem_free (vevent.mesg);
+ mem_free (vevent.rpt);
+ mem_free (vevent.exc);
+ (*noskipped)++;
}
static void
@@ -2018,7 +2160,7 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
unsigned *lineno)
{
const string_t endtodo = STRING_BUILD ("END:VTODO");
- const string_t summary = STRING_BUILD ("SUMMARY:");
+ const string_t summary = STRING_BUILD ("SUMMARY");
const string_t alarm = STRING_BUILD ("BEGIN:VALARM");
const string_t endalarm = STRING_BUILD ("END:VALARM");
const string_t desc = STRING_BUILD ("DESCRIPTION");
@@ -2026,8 +2168,8 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
const int ITEMLINE = *lineno;
char buf[BUFSIZ], buf_upper[BUFSIZ];
struct {
- char mesg[BUFSIZ], *note;
- int has_priority, has_summary, priority;
+ char *mesg, *note;
+ int has_priority, priority;
} vtodo;
int skip_alarm;
@@ -2050,15 +2192,16 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
{
if (!vtodo.has_priority)
vtodo.priority = LOWEST;
- if (vtodo.has_summary)
+ if (vtodo.mesg)
{
ical_store_todo (vtodo.priority, vtodo.mesg, vtodo.note);
(*notodos)++;
}
else
{
- ical_log (log, ICAL_VTODO, ITEMLINE, _("item has no summary."));
- (*noskipped)++;
+ ical_log (log, ICAL_VTODO, ITEMLINE,
+ _("could not retrieve item summary."));
+ goto cleanup;
}
return;
}
@@ -2083,10 +2226,7 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
}
else if (strncmp (buf_upper, summary.str, summary.len) == 0)
{
- const int sumlen = strlen (buf) - summary.len - 1;
- memcpy (vtodo.mesg, buf + summary.len, sumlen);
- vtodo.mesg[sumlen - 1] = '\0';
- vtodo.has_summary = 1;
+ vtodo.mesg = ical_read_summary (buf, fdi, lineno);
}
else if (strncmp (buf_upper, alarm.str, alarm.len) == 0)
{
@@ -2102,6 +2242,12 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
ical_log (log, ICAL_VTODO, ITEMLINE,
_("The ical file seems to be malformed. "
"The end of item was not found."));
+
+cleanup:
+
+ mem_free (vtodo.note);
+ mem_free (vtodo.mesg);
+ (*noskipped)++;
}
static FILE *
@@ -2124,7 +2270,7 @@ get_import_stream (export_type_t type)
cancel = updatestring (win[STA].p, &stream_name, 0, 1);
if (cancel)
{
- free (stream_name);
+ mem_free (stream_name);
return NULL;
}
stream = fopen (stream_name, "r");
@@ -2134,7 +2280,7 @@ get_import_stream (export_type_t type)
wgetch (win[STA].p);
}
}
- free (stream_name);
+ mem_free (stream_name);
return stream;
}
@@ -2188,7 +2334,7 @@ io_import_data (io_mode_t mode, import_type_t type, conf_t *conf,
bzero (&stats, sizeof stats);
ical_version = ical_chk_header (stream, &stats.lines);
RETURN_IF (ical_version < 0,
- _("Warning: ical header malformed, wrong version number. "
+ _("Warning: ical header malformed or wrong version number. "
"Aborting..."));
logname = new_tempfile (logprefix, NOTESIZ);
@@ -2233,8 +2379,9 @@ io_import_data (io_mode_t mode, import_type_t type, conf_t *conf,
{
printf (proc_report, stats.lines);
printf ("\n");
- printf (lines_stats, stats.lines, stats.apoints, stats.events,
- stats.todos, stats.skipped);
+ printf (lines_stats, stats.apoints, stats.events, stats.todos,
+ stats.skipped);
+ printf ("\n");
}
/* User has the choice to look at the log file if some items could not be
@@ -2278,5 +2425,5 @@ io_import_data (io_mode_t mode, import_type_t type, conf_t *conf,
}
EXIT_IF (unlink (flogname) != 0,
_("Warning: could not erase temporary log file, Aborting..."));
- free (logname);
+ mem_free (logname);
}
diff --git a/src/utils.c b/src/utils.c
index 0c0a425..482edac 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.51 2008/09/21 08:06:43 culot Exp $ */
+/* $calcurse: utils.c,v 1.52 2008/09/23 17:31:57 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -999,3 +999,10 @@ str_toupper (char *s)
s[len] = toupper (s[len]);
return s;
}
+
+void
+mem_free (void *ptr)
+{
+ if (ptr)
+ free (ptr);
+}
diff --git a/src/utils.h b/src/utils.h
index 367262a..c6d483c 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/* $calcurse: utils.h,v 1.35 2008/09/21 08:06:43 culot Exp $ */
+/* $calcurse: utils.h,v 1.36 2008/09/23 17:31:57 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -154,5 +154,6 @@ char *new_tempfile (const char *, int);
void erase_note (char **, erase_flag_e);
int parse_date (char *, int, int *, int *, int *);
char *str_toupper (char *);
+void mem_free (void *ptr);
#endif /* CALCURSE_UTILS_H */