diff options
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | configure.ac | 19 | ||||
-rw-r--r-- | doc/Makefile.am | 8 | ||||
-rw-r--r-- | po/calcurse.pot | 4 | ||||
-rw-r--r-- | po/de.po | 2 | ||||
-rw-r--r-- | po/en.po | 2 | ||||
-rw-r--r-- | po/es.po | 2 | ||||
-rw-r--r-- | po/fr.po | 172 | ||||
-rw-r--r-- | po/nl.po | 2 | ||||
-rw-r--r-- | po/ru.po | 2 | ||||
-rw-r--r-- | src/args.c | 12 | ||||
-rw-r--r-- | src/io.c | 181 |
13 files changed, 250 insertions, 170 deletions
diff --git a/Makefile.am b/Makefile.am index 9e17d2f..5dd1ed9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,11 @@ AUTOMAKE_OPTIONS= foreign ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = doc po src +SUBDIRS = po src + +if ENABLE_DOCS +SUBDIRS += doc +endif EXTRA_DIST = \ INSTALL \ @@ -1,3 +1,11 @@ +[08 Sep 2011] +Version 2.9.2: +- Bugfixes: + * Handle iCal line folding correctly. + + * Introduce a configure option to completely exclude the documentation + subdirectory from the build process ("--disable-docs"). + [03 Aug 2011] Version 2.9.1: - Bugfixes: diff --git a/configure.ac b/configure.ac index f736d9f..debd8b8 100644 --- a/configure.ac +++ b/configure.ac @@ -70,23 +70,34 @@ AC_CHECK_HEADERS([math.h], [ #------------------------------------------------------------------------------- # Check whether to build documentation #------------------------------------------------------------------------------- +AC_ARG_ENABLE(docs, + AS_HELP_STRING([--disable-docs], [skip documentation]), + [enabledocs=$enableval], [enabledocs=yes]) +if test x"$enabledocs" != x"yes"; then + enabledocs=no + AC_MSG_WARN([Skipping documentation!]) +fi +AC_MSG_CHECKING([whether to include documentation]) +AC_MSG_RESULT($enabledocs) +AM_CONDITIONAL(ENABLE_DOCS, test x"$enabledocs" = x"yes") + AC_ARG_WITH(asciidoc, AS_HELP_STRING([--with-asciidoc], - [Use asciidoc to regenerate documentation.]), + [use AsciiDoc to regenerate documentation]), [use_asciidoc=$withval], [use_asciidoc="auto"]) if test x"$use_asciidoc" = x"auto"; then AC_PATH_PROG([ASCIIDOC], [asciidoc]) if test -z "$ASCIIDOC"; then have_asciidoc=no - AC_MSG_WARN([AsciiDoc not found - documentation will be skipped!]) + AC_MSG_WARN([AsciiDoc not found - cannot rebuild documentation!]) else have_asciidoc=yes fi AC_PATH_PROG([A2X], [a2x]) if test -z "$A2X"; then have_a2x=no - AC_MSG_WARN([a2x not found - man pages will be skipped!]) + AC_MSG_WARN([a2x not found - cannot rebuild man pages!]) else have_a2x=yes fi @@ -101,7 +112,7 @@ elif test x"$use_asciidoc" = x"yes"; then fi have_asciidoc=yes elif test x"$use_asciidoc" = x"no"; then - AC_MSG_WARN(["--without-asciidoc" specified - documentation will be skipped!]) + AC_MSG_WARN([Will not rebuild documentation!]) have_asciidoc=no have_a2x=no fi diff --git a/doc/Makefile.am b/doc/Makefile.am index 287cddb..caa90d2 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -5,19 +5,19 @@ ASCIIDOC_ARGS = \ -n \ -a toc \ -a icons - -dist_doc_DATA = \ - manual.html endif if HAVE_A2X A2X_ARGS = \ -d manpage \ -f manpage +endif + +dist_doc_DATA = \ + manual.html dist_man_MANS = \ calcurse.1 -endif EXTRA_DIST = \ manual.txt \ diff --git a/po/calcurse.pot b/po/calcurse.pot index 8bf0cdd..5ef5d1b 100644 --- a/po/calcurse.pot +++ b/po/calcurse.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: calcurse 2.9.1\n" +"Project-Id-Version: calcurse 2.9.2\n" "Report-Msgid-Bugs-To: bugs@calcurse.org\n" -"POT-Creation-Date: 2011-07-31 02:54+0200\n" +"POT-Creation-Date: 2011-09-06 14:34+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" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: calcurse\n" "Report-Msgid-Bugs-To: bugs@calcurse.org\n" -"POT-Creation-Date: 2011-07-31 02:54+0200\n" +"POT-Creation-Date: 2011-09-06 14:34+0200\n" "PO-Revision-Date: 2011-05-11 14:00+0000\n" "Last-Translator: cryptocrack <transifex@cryptocrack.de>\n" "Language-Team: German (http://www.transifex.net/projects/p/calcurse/team/" @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: calcurse 1.4\n" "Report-Msgid-Bugs-To: bugs@calcurse.org\n" -"POT-Creation-Date: 2011-07-31 02:54+0200\n" +"POT-Creation-Date: 2011-09-06 14:34+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" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: calcurse\n" "Report-Msgid-Bugs-To: bugs@calcurse.org\n" -"POT-Creation-Date: 2011-07-31 02:54+0200\n" +"POT-Creation-Date: 2011-09-06 14:34+0200\n" "PO-Revision-Date: 2011-05-11 09:21+0000\n" "Last-Translator: cryptocrack <transifex@cryptocrack.de>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -2,13 +2,15 @@ # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # +# esaule <godrik@mandragor.org>, 2011. +# Lukas Fleischer <transifex@cryptocrack.de>, 2011. msgid "" msgstr "" "Project-Id-Version: calcurse\n" "Report-Msgid-Bugs-To: bugs@calcurse.org\n" -"POT-Creation-Date: 2011-07-31 02:54+0200\n" -"PO-Revision-Date: 2011-05-17 13:44+0000\n" -"Last-Translator: esaule <godrik@mandragor.org>\n" +"POT-Creation-Date: 2011-09-06 14:34+0200\n" +"PO-Revision-Date: 2011-09-04 21:35+0000\n" +"Last-Translator: lkppo <lkppo@free.fr>\n" "Language-Team: French (http://www.transifex.net/projects/p/calcurse/team/" "fr/)\n" "Language: fr\n" @@ -74,6 +76,10 @@ msgid "" "Copyright (c) 2004-2011 calcurse Development Team.\n" "This is free software; see the source for copying conditions.\n" msgstr "" +"\n" +"Copyright (c) 2004-2011 Équipe de développement de calcurse.\n" +"Ceci est un logiciel libre ; consultez le code source pour connaître les " +"conditions légales d'utilisation.\n" #, c-format msgid "Calcurse %s - text-based organizer\n" @@ -150,6 +156,81 @@ msgid "" "For more information, type '?' from within Calcurse, or read the manpage.\n" "Mail bug reports and suggestions to <misc@calcurse.org>.\n" msgstr "" +"\n" +"Divers:\n" +" -h, --help\n" +"\taffiche cette aide et quitte.\n" +"\n" +" -v, --version\n" +"\taffiche la version de calcurse et quitte.\n" +"\n" +" --status\n" +"\taffiche l'état des instances de calcurse en cours d'exécution.\n" +"\n" +"Fichiers:\n" +" -c <fichier>, --calendar <fichier>\n" +"\tindique le <fichier> de calendrier à utiliser (incompatible avec '-D').\n" +"\n" +" -D <dir>, --directory <dir>\n" +"\tindique le répertoire de données à utiliser (incompatible avec '-c').\n" +"\tSi non indiqué, le répertoire par défaut est ~/.calcurse\n" +"\n" +"Non-interactif:\n" +" -a, --appointment\n" +" \taffiche les évènements et les rendez-vous du jour et quitte.\n" +"\n" +" -d <date|nb>, --day <date|nb>\n" +"\taffiche les évènements et rendez-vous d'une <date> ou des <nb> prochains " +"jours et\n" +"\tquitte. Pour indiquer un jour de départ et une durée, utilisez les " +"options\n" +"\t'--startday' and '--range'.\n" +"\n" +" -i <fichier>, --import <fichier>\n" +"\timporte les données au format icalendar depuis un <fichier>. \n" +"\n" +" -n, --next\n" +"\taffiche le prochain rendez-vous à venir dans les 24 heures et quitte. " +"Donne aussi\n" +"\tle temps restant avant le rendez-vous suivant.\n" +" -N, --note\n" +"\tutilisée avec l'option '-a' ou '-t', affiche la note associée\n" +"\tà l'élément affiché s'il en a une.\n" +"\n" +" -r[nombre], --range[=nombre]\n" +"\taffiche les évènements et les rendez-vous sur [nombre] de jours\n" +"\tet quitte. Si [nombre] n'est pas précisé, on utilise une durée de 1 jour " +"par défaut.\n" +"\n" +" -s[date], --startday[=date]\n" +"\taffiche les évènements et rendez-vous d'une [date] et quitte.\n" +"\tSi la [date] n'est pas précisée, la date courante est utilisée.\n" +"\n" +" -S<regex>, --search=<regex>\n" +"\tRecherche les évènements, rendez-vous et tâches\n" +"\tdont la description correspond à l'expression régulière [regex].n\n" +" -t[priorite], --todo[=priorite]\n" +"\taffiche la liste des tâches et quitte. Si la valeur facultative [priorite] " +"est précisée,\n" +"\talors ne seront affichées que les tâches de ce niveau priorité.\n" +"\tLe niveau de priorité est compris entre 1 (plus important) et 9 (moins " +"important).\n" +"\tIl est également possible de spécifier '0' pour la priorité,\n" +"\tauquel cas seules les tâches terminées seront affichés.\n" +"\n" +" -x[format], --export[=format]\n" +"\texporte les données utilisateur au format spécifié. Évènements, rendez-" +"vous et \n" +"\ttâches sont convertis et envoyés sur la sortie standard (stdout).\n" +"\tDeux formats au choix : 'ical' et 'pcal'.\n" +"\tSi l'option facultative de format est omise, le format ical\n" +"\test sélectionné par défaut.\n" +"\tnote : pour rediriger la sortie de l'export vers un fichier,\n" +"\tutilisez une commande de la forme : calcurse --export > calcurse.dat\n" +"\n" +"Pour plus d'informations, tapez '?' dans Calcurse, ou lisez le manuel.\n" +"Envoyez par courriel vos rapports de bogue et vos suggestions à " +"<misc@calcurse.org>.\n" #, c-format msgid "" @@ -235,7 +316,7 @@ msgid "To do :" msgstr "Tâche :" msgid "ERROR setting first day of week" -msgstr "" +msgstr "ERREUR de paramètre sur le premier jour de la semaine" msgid "" "The day you entered is not valid (should be between 01/01/1902 and " @@ -278,7 +359,7 @@ msgid "Layout" msgstr "Ecran" msgid "Sidebar" -msgstr "" +msgstr "Barre latérale" msgid "Color" msgstr "Couleur" @@ -287,10 +368,10 @@ msgid "Notify" msgstr "Notifier" msgid "Keys" -msgstr "" +msgstr "Raccourcis" msgid "Select" -msgstr "" +msgstr "Sélectionner" msgid "Up" msgstr "Haut" @@ -479,19 +560,19 @@ msgid "undefined" msgstr "inconnue" msgid "Key info" -msgstr "" +msgstr "Informations" msgid "Add key" -msgstr "" +msgstr "Ajouter" msgid "Del key" -msgstr "" +msgstr "Supprimer" msgid "Prev Key" -msgstr "" +msgstr "Précédent" msgid "Next Key" -msgstr "" +msgstr "Suivant" #, c-format msgid "keys configuration" @@ -692,7 +773,7 @@ msgid "" msgstr "" msgid "Displacement keys\n" -msgstr "" +msgstr "Touches de déplacement\n" #, c-format msgid "" @@ -721,7 +802,7 @@ msgid "" msgstr "" msgid "View\n" -msgstr "" +msgstr "Afficher\n" #, c-format msgid "" @@ -772,7 +853,7 @@ msgid "" msgstr "" msgid "Delete\n" -msgstr "" +msgstr "Supprimer\n" #, c-format msgid "" @@ -1016,7 +1097,7 @@ msgid "" msgstr "" msgid "Generic keybindings\n" -msgstr "" +msgstr "Raccourcis clavier génériques\n" #, c-format msgid "" @@ -1093,6 +1174,8 @@ msgstr "Export..." msgid "Internal error while displaying progress bar" msgstr "" +"Une erreur interne s'est produite durant l'affichage de la barre de " +"progression" msgid "Choose the file used to export calcurse data:" msgstr "Choisissez le fichier dans lequel exporter les données :" @@ -1147,7 +1230,7 @@ msgid "The data files were successfully saved" msgstr "Les données ont été correctement enregistrées" msgid "syntax error in the item date" -msgstr "" +msgstr "Erreur de syntaxe sur la date" msgid "no event nor appointment found" msgstr "Aucun évènement ou rendez-vous trouvé" @@ -1159,7 +1242,7 @@ msgid "Failed to open todo file" msgstr "Problème d'ouverture du fichier des tâches" msgid "could not find any key file." -msgstr "" +msgstr "Impossible de trouver un fichier de raccourcis." msgid "" "\n" @@ -1167,23 +1250,29 @@ msgid "" "Please backup your keys file, remove it from directory, and launch calcurse " "again.\n" msgstr "" +"\n" +"Trop d'erreurs à la lecture du fichier de configuration !\n" +"Veuillez faire une sauvegarde votre fichier de raccourcis, et le supprimer " +"du répertoire, puis relancer calcurse.\n" msgid "Could not read key label" -msgstr "" +msgstr "Impossible de lire le libellé de la touche" msgid "Key label not recognized" msgstr "Touche non reconnue" #, c-format msgid "Error reading key: \"%s\"" -msgstr "" +msgstr "Erreur de lecture de la touche : \"%s\"" #, c-format msgid "\"%s\" assigned multiple times!" -msgstr "" +msgstr "\"%s\" est assignée plusieurs fois !" msgid "There were some errors when loading keys file, see log file ?" msgstr "" +"Des erreurs se sont produites lors du chargement du fichier de raccourcis. " +"Voulez-vous consulter le journal ?" msgid "Too many errors while reading keys file, aborting..." msgstr "Trop d'erreur durant la lecture du fichier de touche, annulation..." @@ -1254,7 +1343,7 @@ msgid "item has a negative duration." msgstr "L'élément a une durée négative." msgid "event date is not defined." -msgstr "" +msgstr "La date de l'évènement n'est pas définie." msgid "item could not be identified." msgstr "L'élément n'a pu être identifié." @@ -1312,6 +1401,8 @@ msgstr "Certains éléments n'ont pu être importés, voir le fichier de log ?" msgid "Warning: could not create temporary log file, Aborting..." msgstr "" +"Attention : création d'un fichier journal temporaire impossible, abandon en " +"cours..." msgid "Warning: could not open temporary log file, Aborting..." msgstr "Attention: impossible d'ouvrir le fichier de log, abandon..." @@ -1385,7 +1476,7 @@ msgid "notify-daemon_log = " msgstr "notify-daemon_log = " msgid "(Log activity when running in background)" -msgstr "" +msgstr "Enregistrer l'activité lors de l'exécution en arrière-plan" msgid "Enter the time format (see 'man 3 strftime' for possible formats) " msgstr "" @@ -1409,13 +1500,15 @@ msgid "unknown character" msgstr "caractère inconnu" msgid "date error in event" -msgstr "Date erroné pour le rendez-vous" +msgstr "Date erronée pour l'évènement" msgid "appointment not found" msgstr "rendez-vous inconnu" msgid "Enter the repetition type: (D)aily, (W)eekly, (M)onthly, (Y)early" -msgstr "Entrez le type: (D) journ., (W) hebdo., (M) mensuel, (Y) annuel" +msgstr "" +"Entrez le type de répétition : (D) quotidien, (W) hebdomadaire, (M) mensuel, " +"(Y) annuel" msgid "Enter the repetition frequence:" msgstr "Entrez la fréquence de répétition :" @@ -1426,19 +1519,20 @@ msgstr "Entrez la date de fin: [%s] ou '0' pour répéter indéfiniment" #, c-format msgid "Possible formats are [%s] or '0' for an endless repetition" -msgstr "Les formats autorisés sont [%s] ou '0' pour une répétition sans fin" +msgstr "" +"Les formats autorisés sont [%s] ou '0' pour une répétition indéfiniment" msgid "This item is already a repeated one." -msgstr "Cet élément est déjà recurrent." +msgstr "Cet élément est déjà récurrent." msgid "Sorry, the date you entered is older than the item start time." -msgstr "La date que vous avez entrée est antérieure à la date de l'élément!" +msgstr "La date que vous avez entrée est antérieure à la date de l'élément !" msgid "wrong item type" msgstr "type d'élément incorrect" msgid "syntax error in item date" -msgstr "erreur de syntaxe dans la data de l'élément" +msgstr "erreur de syntaxe dans la date de l'élément" #, c-format msgid "Could not remove calcurse lock file: %s\n" @@ -1465,7 +1559,7 @@ msgstr "Voulez-vous vraiment effacer cette tâche ?" msgid "This item has a note attached to it. Delete (t)odo or just its (n)ote ?" msgstr "" -"Une note est attachée à cette tâche. Effacer (t) la tâche ou (n) la note " +"Une note est attachée à cette tâche. Effacer la (t)âche ou la (n)ote " "seulement ?" msgid "[t/n] " @@ -1493,10 +1587,10 @@ msgid "Internal error: line too long" msgstr "Erreur interne : ligne trop longue" msgid "out of memory" -msgstr "plus de memoire" +msgstr "dépassement de mémoire" msgid "failure in mktime" -msgstr "faute dans mktime" +msgstr "erreur fatale dans mktime" msgid "error in mktime" msgstr "erreur dans mktime" @@ -1508,7 +1602,7 @@ msgid "could not convert string" msgstr "impossible de convertir la chaîne de caractères" msgid "out of range" -msgstr "en dehors de l'interval" +msgstr "en dehors de l'intervalle" msgid "yes" msgstr "oui" @@ -1517,14 +1611,14 @@ msgid "no" msgstr "non" msgid "option not defined" -msgstr "option non definie" +msgstr "option non définie" #, c-format msgid "temporary file \"%s\" could not be created" msgstr "le fichier temporaire \"%s\" n'a pas pu être crée" msgid "could not remove note" -msgstr "impossible de retirer la note" +msgstr "impossible de supprimer la note" #, c-format msgid "Error when closing file at %s" @@ -1633,13 +1727,13 @@ msgid "Config" msgstr "Config" msgid "Redraw" -msgstr "Retracer" +msgstr "Rafraîchir" msgid "Add Appt" msgstr "Ajt rdv" msgid "Add Todo" -msgstr "Ajt todo" +msgstr "Ajt tâche" msgid "+1 Day" msgstr "+1 Jour" @@ -1657,10 +1751,10 @@ msgid "Today" msgstr "Aujourd." msgid "Nxt View" -msgstr "Proch.Vue" +msgstr "Voir Suiv." msgid "Prv View" -msgstr "VuePrec." +msgstr "Voir Prec." msgid "beg Week" msgstr "deb Sem." @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: calcurse\n" "Report-Msgid-Bugs-To: bugs@calcurse.org\n" -"POT-Creation-Date: 2011-07-31 02:54+0200\n" +"POT-Creation-Date: 2011-09-06 14:34+0200\n" "PO-Revision-Date: 2011-05-11 09:21+0000\n" "Last-Translator: cryptocrack <transifex@cryptocrack.de>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: calcurse\n" "Report-Msgid-Bugs-To: bugs@calcurse.org\n" -"POT-Creation-Date: 2011-07-31 02:54+0200\n" +"POT-Creation-Date: 2011-09-06 14:34+0200\n" "PO-Revision-Date: 2011-05-23 18:06+0000\n" "Last-Translator: Rusdec <linux.kernel.it@gmail.com>\n" "Language-Team: Russian (http://www.transifex.net/projects/p/calcurse/team/" @@ -193,13 +193,19 @@ print_notefile (FILE *out, char *filename, int nbtab) { char path_to_notefile[BUFSIZ]; FILE *notefile; - char linestarter[BUFSIZ] = ""; + char linestarter[BUFSIZ]; char buffer[BUFSIZ]; int i; int printlinestarter = 1; - for (i = 0; i < nbtab; i++) - (void)snprintf(linestarter, BUFSIZ, "%s\t", linestarter); + if (nbtab < BUFSIZ) + { + for (i = 0; i < nbtab; i++) + linestarter[i] = '\t'; + linestarter[nbtab] = '\0'; + } + else + linestarter[0] = '\0'; (void)snprintf (path_to_notefile, BUFSIZ, "%s/%s", path_notes, filename); notefile = fopen (path_to_notefile, "r"); @@ -1813,7 +1813,7 @@ ical_store_apoint (char *mesg, char *note, long start, long dur, /* * Returns an allocated string representing the string given in argument once - * unformatted. See ical_unfold_content () below. + * unformatted. * * Note: * Even if the RFC2445 recommends not to have more than 75 octets on one line of @@ -1827,8 +1827,6 @@ ical_store_apoint (char *mesg, char *note, long start, long dur, static char * ical_unformat_line (char *line) { -#define LINE_FEED 0x0a -#define CARRIAGE_RETURN 0x0d char *p, uline[BUFSIZ]; int len; @@ -1840,10 +1838,6 @@ ical_unformat_line (char *line) { switch (*p) { - case LINE_FEED: - return mem_strdup (uline); - case CARRIAGE_RETURN: - break; case '\\': switch (*(p + 1)) { @@ -1871,106 +1865,69 @@ ical_unformat_line (char *line) break; } } -#undef LINE_FEED -#undef CARRIAGE_RETURN - return NULL; + + return mem_strdup (uline); } -/* - * 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) +static void +ical_readline_init (FILE *fdi, char *buf, char *lstore, unsigned *ln) { - char *content; - int c; + char *eol; - content = ical_unformat_line (line); - if (!content) - return NULL; + *buf = *lstore = '\0'; + fgets (lstore, BUFSIZ, fdi); + if ((eol = strchr(lstore, '\n')) != NULL) + *eol = '\0'; + (*ln)++; +} - for (;;) - { - c = getc (fd); - if (c == SPACE || c == TAB) - { - char buf[BUFSIZ]; +static int +ical_readline (FILE *fdi, char *buf, char *lstore, unsigned *ln) +{ + char *eol; - if (fgets (buf, BUFSIZ, fd) != NULL) - { - char *tmpline, *rline; - int newsize; + strncpy (buf, lstore, BUFSIZ); + (*ln)++; - (*lineno)++; - tmpline = ical_unformat_line (buf); - if (!tmpline) - { - mem_free (content); - return NULL; - } - newsize = strlen (content) + strlen (tmpline) + 1; - if ((rline = mem_realloc (content, newsize, 1)) == NULL) - { - mem_free (content); - mem_free (tmpline); - return NULL; - } - content = rline; - (void)strncat (content, tmpline, BUFSIZ); - mem_free (tmpline); - } - else - { - mem_free (content); - return NULL; - /* Could not get entire item description. */ - } - } - else - { - (void)ungetc (c, fd); - return content; - } + while (fgets (lstore, BUFSIZ, fdi) != NULL) + { + if ((eol = strchr(lstore, '\n')) != NULL) + *eol = '\0'; + if (*lstore != SPACE && *lstore != TAB) + break; + strncat (buf, lstore + 1, BUFSIZ); + (*ln)++; + } + + if (feof (fdi)) + { + *lstore = '\0'; + if (*buf == '\0') + return 0; } + + return 1; } static float -ical_chk_header (FILE *fd, unsigned *lineno) +ical_chk_header (FILE *fd, char *buf, char *lstore, unsigned *lineno) { const int HEADER_MALFORMED = -1; const struct string icalheader = STRING_BUILD ("BEGIN:VCALENDAR"); - char buf[BUFSIZ]; - - (void)fgets (buf, BUFSIZ, fd); - (*lineno)++; + float version; - if (buf == NULL) return HEADER_MALFORMED; + if (!ical_readline (fd, buf, lstore, lineno)) + return HEADER_MALFORMED; str_toupper (buf); if (strncmp (buf, icalheader.str, icalheader.len) != 0) return HEADER_MALFORMED; - const int AWAITED = 1; - float version = HEADER_MALFORMED; - int read; - - do + while (!sscanf (buf, "VERSION:%f", &version)) { - if (fgets (buf, BUFSIZ, fd) == NULL) - { - return HEADER_MALFORMED; - } - else - { - (*lineno)++; - read = sscanf (buf, "VERSION:%f", &version); - } + if (!ical_readline (fd, buf, lstore, lineno)) + return HEADER_MALFORMED; } - while (read != AWAITED); return version; } @@ -2354,14 +2311,13 @@ ical_read_exdate (llist_t *exc, FILE *log, char *exstr, unsigned *noskipped, /* 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) +ical_read_note (char *line, unsigned *noskipped, ical_vevent_e item_type, + const int itemline, FILE *log) { char *p, *notestr, *notename, fullnotename[BUFSIZ]; FILE *fdo; - if ((p = strchr (first_line, ':')) != NULL) + if ((p = strchr (line, ':')) != NULL) { notename = new_tempfile (path_notes, NOTESIZ); EXIT_IF (notename == NULL, @@ -2372,7 +2328,7 @@ ical_read_note (char *first_line, FILE *fdi, unsigned *noskipped, EXIT_IF (fdo == NULL, _("Warning: could not open %s, Aborting..."), fullnotename); p++; - notestr = ical_unfold_content (fdi, p, lineno); + notestr = ical_unformat_line (p); if (notestr == NULL) { ical_log (log, item_type, itemline, @@ -2407,14 +2363,14 @@ 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) +ical_read_summary (char *line) { char *p, *summary; - if ((p = strchr (first_line, ':')) != NULL) + if ((p = strchr (line, ':')) != NULL) { p++; - summary = ical_unfold_content (fdi, p, lineno); + summary = ical_unformat_line (p); return summary; } else @@ -2423,7 +2379,8 @@ ical_read_summary (char *first_line, FILE *fdi, unsigned *lineno) static void ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints, - unsigned *noskipped, unsigned *lineno) + unsigned *noskipped, char *buf, char *lstore, + unsigned *lineno) { const int ITEMLINE = *lineno; const struct string endevent = STRING_BUILD ("END:VEVENT"); @@ -2437,7 +2394,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints, const struct string endalarm = STRING_BUILD ("END:VALARM"); const struct string desc = STRING_BUILD ("DESCRIPTION"); ical_vevent_e vevent_type; - char *p, buf[BUFSIZ], buf_upper[BUFSIZ]; + char *p, buf_upper[BUFSIZ]; struct { llist_t exc; ical_rpt_t *rpt; @@ -2450,11 +2407,11 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints, vevent_type = UNDEFINED; bzero (&vevent, sizeof vevent); skip_alarm = 0; - while (fgets (buf, BUFSIZ, fdi) != NULL) + while (ical_readline (fdi, buf, lstore, lineno)) { - (*lineno)++; memcpy (buf_upper, buf, strlen (buf)); str_toupper (buf_upper); + if (skip_alarm) { /* Need to skip VALARM properties because some keywords could @@ -2584,7 +2541,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints, } else if (strncmp (buf_upper, summary.str, summary.len) == 0) { - vevent.mesg = ical_read_summary (buf, fdi, lineno); + vevent.mesg = ical_read_summary (buf); } else if (strncmp (buf_upper, alarm.str, alarm.len) == 0) { @@ -2593,8 +2550,8 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints, } else if (strncmp (buf_upper, desc.str, desc.len) == 0) { - vevent.note = ical_read_note (buf, fdi, noskipped, lineno, - ICAL_VEVENT, ITEMLINE, log); + vevent.note = ical_read_note (buf, noskipped, ICAL_VEVENT, + ITEMLINE, log); } } } @@ -2616,7 +2573,7 @@ cleanup: static void ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped, - unsigned *lineno) + char *buf, char *lstore, unsigned *lineno) { const struct string endtodo = STRING_BUILD ("END:VTODO"); const struct string summary = STRING_BUILD ("SUMMARY"); @@ -2625,7 +2582,7 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped, const struct string desc = STRING_BUILD ("DESCRIPTION"); const int LOWEST = 9; const int ITEMLINE = *lineno; - char buf[BUFSIZ], buf_upper[BUFSIZ]; + char buf_upper[BUFSIZ]; struct { char *mesg, *note; int has_priority, priority; @@ -2634,9 +2591,8 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped, bzero (&vtodo, sizeof vtodo); skip_alarm = 0; - while (fgets (buf, BUFSIZ, fdi) != NULL) + while (ical_readline (fdi, buf, lstore, lineno)) { - (*lineno)++; memcpy (buf_upper, buf, strlen (buf)); str_toupper (buf_upper); if (skip_alarm) @@ -2685,7 +2641,7 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped, } else if (strncmp (buf_upper, summary.str, summary.len) == 0) { - vtodo.mesg = ical_read_summary (buf, fdi, lineno); + vtodo.mesg = ical_read_summary (buf); } else if (strncmp (buf_upper, alarm.str, alarm.len) == 0) { @@ -2693,8 +2649,8 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped, } else if (strncmp (buf_upper, desc.str, desc.len) == 0) { - vtodo.note = ical_read_note (buf, fdi, noskipped, lineno, - ICAL_VTODO, ITEMLINE, log); + vtodo.note = ical_read_note (buf, noskipped, ICAL_VTODO, + ITEMLINE, log); } } } @@ -2759,7 +2715,7 @@ io_import_data (enum import_type type, struct conf *conf, char *stream_name) const struct string vtodo = STRING_BUILD ("BEGIN:VTODO"); char *proc_report = _("Import process report: %04d lines read "); char stats_str[4][BUFSIZ]; - char buf[BUFSIZ]; + char buf[BUFSIZ], lstore[BUFSIZ]; FILE *stream = NULL; struct io_file *log; float ical_version; @@ -2788,7 +2744,8 @@ io_import_data (enum import_type type, struct conf *conf, char *stream_name) return; bzero (&stats, sizeof stats); - ical_version = ical_chk_header (stream, &stats.lines); + ical_readline_init (stream, buf, lstore, &stats.lines); + ical_version = ical_chk_header (stream, buf, lstore, &stats.lines); RETURN_IF (ical_version < 0, _("Warning: ical header malformed or wrong version number. " "Aborting...")); @@ -2802,19 +2759,19 @@ io_import_data (enum import_type type, struct conf *conf, char *stream_name) } ical_log_init (log->fd, ical_version); - while (fgets (buf, BUFSIZ, stream) != NULL) + while (ical_readline (stream, buf, lstore, &stats.lines)) { stats.lines++; str_toupper (buf); if (strncmp (buf, vevent.str, vevent.len) == 0) { ical_read_event (stream, log->fd, &stats.events, &stats.apoints, - &stats.skipped, &stats.lines); + &stats.skipped, buf, lstore, &stats.lines); } else if (strncmp (buf, vtodo.str, vtodo.len) == 0) { ical_read_todo (stream, log->fd, &stats.todos, &stats.skipped, - &stats.lines); + buf, lstore, &stats.lines); } } if (stream != stdin) |