summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-08-11 18:08:45 +0000
committerFrederic Culot <calcurse@culot.org>2008-08-11 18:08:45 +0000
commitd84bb63e9313500b16e9d08a7961174149e953fb (patch)
treeb51ef97cc29a95e329898d606c9b13458426ffbf
parent1674800d5fb26decfa74cb7a1d94e2154b7c27a6 (diff)
downloadcalcurse-d84bb63e9313500b16e9d08a7961174149e953fb.zip
Optional 'format' option added to '-x' flag, help updated
-rwxr-xr-xChangeLog14
-rwxr-xr-xdoc/manual_de.html30
-rwxr-xr-xdoc/manual_en.html23
-rwxr-xr-xdoc/manual_es.html29
-rwxr-xr-xdoc/manual_fr.html26
-rwxr-xr-xdoc/manual_it.html32
-rwxr-xr-xdoc/manual_nl.html31
-rwxr-xr-xsrc/args.c41
-rwxr-xr-xsrc/calcurse.123
-rwxr-xr-xsrc/help.c10
-rwxr-xr-xsrc/io.c25
-rwxr-xr-xsrc/utils.c42
-rwxr-xr-xsrc/utils.h4
13 files changed, 217 insertions, 113 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f08ee3..564f1ff 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-08-11 Frederic Culot <frederic@culot.org>
+
+ * src/utils.c (date_sec2ical_*): functions replaced by
+ date_sec2date_fmt()
+
+ * src/args.c (parse_args, usage, help_arg): option added to '-x'
+ flag to choose export format
+
+ * src/help.c (help_screen): help text updated with pcal export
+
+ * src/calcurse.1: manpage updated
+
+ * doc/manual_*.html: manuals updated
+
2008-08-10 Frederic Culot <frederic@culot.org>
* src/calcurse.c: new menu added presenting export format
diff --git a/doc/manual_de.html b/doc/manual_de.html
index 1618828..2c56961 100755
--- a/doc/manual_de.html
+++ b/doc/manual_de.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
/*
- * $calcurse: manual_de.html,v 1.18 2008/08/08 14:22:19 culot Exp $
+ * $calcurse: manual_de.html,v 1.19 2008/08/11 18:08:45 culot Exp $
*
* Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot
@@ -112,6 +112,7 @@ well as the way one can contribute to <code>calcurse</code> development.
<li><a href="#links_homepage">9.1 <code>calcurse</code> Internetseite</a></li>
<li><a href="#links_list">9.2 <code>calcurse</code> Ank&uuml;ndigungsliste</a></li>
<li><a href="#links_rss">9.3 <code>calcurse</code> RSS</a></li>
+ <li><a href="#links_others"><div class="todo">9.4 Other links</div></a></li>
</ul></li>
<li><a href="#thanks">10. Danksagungen</a></li>
</ul>
@@ -332,13 +333,18 @@ Es werden sowohl kurze als auch lange Optionsangaben unterst&uuml;tzt.</p>
<dt><code>-v, --version</code></dt>
<dd>Gibt die aktuelle Version von Calcurse aus.
</dd>
- <dt><code>-x, --export</code></dt>
- <dd>Exportiert Benutzerdaten in das iCalendar-Format. Ereignisse,
- Termine und Aufgaben werden konvertiert und nach stdout
- ausgegeben.
+ <dt><code>-x[format], --export[=format]</code></dt>
+ <dd><div class="todo">
+ Export user data to specified format. Events, appointments and
+ todos are converted and echoed to stdout.
+ Two possible formats are available: ical and pcal
+ (see section <a href="#links_others">Links</a> below).
+ If the optional argument <code>format</code> is not given,
+ ical format is selected by default.
+ </div>
<p class="rq"><span class="valorise">Beachte:</span>
leiten Sie die Ausgabe in eine Datei, etwa wie im folgenden Beispiel:
- <code>$ calcurse --export > my_data.ics</code></p>
+ <code>$ calcurse --export > my_data.dat</code></p>
</dd>
</dl>
@@ -970,6 +976,16 @@ Um sich in die Liste einzutragen, schicken Sie einfach eine E-Mail mit dem Betre
der RSS-Feed aktualisiert und enth&auml;lt eine Beschreibung der neu
hinzugekommenen Programmfunktionen.</p>
+<h2><div class="todo">9.4 Other links</div><a name="links_others"></a></h2>
+<div class="todo">
+<p>
+ You may want to look at the ical format specification (rfc2445) at:
+ <pre>http://tools.ietf.org/html/rfc2445</pre>
+<p>
+ The pcal project page can be found at:
+ <pre>http://pcal.sourceforge.net/</pre>
+</div>
+
<h1>10. Danksagungen<a name="thanks"></a></h1>
<p>
Folgenden Leuten m&ouml;chte ich gerne f&uuml;r Ihre Unterst&uuml;tzung danken, ohne
@@ -1011,7 +1027,7 @@ Benutzer, die mir Ihr Feedback mitgeteilt haben.</p>
Copyright (c) 2004-2008 Fr&eacute;d&eacute;ric Culot<br>
German translation by Michael Schulz
<code>&lt;bloodshower .at. web .dot. de&gt;</code>, and Chris.<br>
- Calcurse version 2.2 - Last change: August 8, 2008<br>
+ Calcurse version 2.2 - Last change: August 11, 2008<br>
</div>
</div>
diff --git a/doc/manual_en.html b/doc/manual_en.html
index 20b6159..8daaf36 100755
--- a/doc/manual_en.html
+++ b/doc/manual_en.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
/*
- * $calcurse: manual_en.html,v 1.18 2008/08/08 14:22:19 culot Exp $
+ * $calcurse: manual_en.html,v 1.19 2008/08/11 18:08:45 culot Exp $
*
* Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot
@@ -109,6 +109,7 @@ well as the way one can contribute to <code>calcurse</code> development.
<li><a href="#links_homepage">9.1 <code>calcurse</code> homepage</a></li>
<li><a href="#links_list">9.2 <code>calcurse</code> announce list</a></li>
<li><a href="#links_rss">9.3 <code>calcurse</code> RSS feed</a></li>
+ <li><a href="#links_others">9.4 Other links</a></li>
</ul></li>
<li><a href="#thanks">10. Thanks</a></li>
</ul>
@@ -336,14 +337,18 @@ All of the commands are documented within an online help system.
<dd>
Display <code>calcurse</code> version and exit.
</dd>
- <dt><code>-x, --export</code></dt>
+ <dt><code>-x[format], --export[=format]</code></dt>
<dd>
- Export user data to iCalendar format. Events, appointments and
+ Export user data to specified format. Events, appointments and
todos are converted and echoed to stdout.
+ Two possible formats are available: ical and pcal
+ (see section <a href="#links_others">Links</a> below).
+ If the optional argument <code>format</code> is not given,
+ ical format is selected by default.
<p class="rq"><span class="valorise">Note:</span>
redirect standard output to export data to a file,
by issuing a command such as:
- <code>$ calcurse --export &gt; my_data.ics</code></p>
+ <code>$ calcurse --export &gt; my_data.dat</code></p>
</dd>
</dl>
@@ -1005,6 +1010,14 @@ msgid ""
This RSS feed is updated each time a new version of calcurse is
available, describing newly added features.</p>
+<h2>9.4 Other links<a name="links_others"></a></h2>
+<p>
+ You may want to look at the ical format specification (rfc2445) at:
+ <pre>http://tools.ietf.org/html/rfc2445</pre>
+<p>
+ The pcal project page can be found at:
+ <pre>http://pcal.sourceforge.net/</pre>
+
<h1>10. Thanks<a name="thanks"></a></h1>
<p>
Its time now to thank other people without whom this program
@@ -1052,7 +1065,7 @@ msgid ""
<div class="footer">
Copyright (c) 2004-2008 Fr&eacute;d&eacute;ric Culot<br>
- Calcurse version 2.2 - Last change: August 8, 2008<br>
+ Calcurse version 2.2 - Last change: August 11, 2008<br>
</div>
</div>
diff --git a/doc/manual_es.html b/doc/manual_es.html
index 8acedb4..0b46ac5 100755
--- a/doc/manual_es.html
+++ b/doc/manual_es.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
/*
- * $calcurse: manual_es.html,v 1.15 2008/08/08 14:22:19 culot Exp $
+ * $calcurse: manual_es.html,v 1.16 2008/08/11 18:08:45 culot Exp $
*
* Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot
@@ -112,6 +112,7 @@ well as the way one can contribute to <code>calcurse</code> development.
<li><a href="#links_homepage">9.1 Pagina web de <code>calcurse</code></a></li>
<li><a href="#links_list">9.2 Lista de anuncios de <code>calcurse</code></a></li>
<li><a href="#links_rss">9.3 <code>calcurse</code> RSS feed</a></li>
+ <li><a href="#links_others"><div class="todo">9.4 Other links</div></a></li>
</ul></li>
<li><a href="#thanks">10. Gracias a ...</a></li>
</ul>
@@ -340,14 +341,20 @@ well as the way one can contribute to <code>calcurse</code> development.
<dd>
Muestra la versión de <code>calcurse</code> y sale.
</dd>
- <dt><code>-x, --export</code></dt>
+ <dt><code>-x[format], --export[=format]</code></dt>
<dd>
- Exporta los datos del usuario a un formato iCalendar. Citas, eventos y tareas pendientes son convertidos y
- mostrados en patalla.
+ <div class="todo">
+ Export user data to specified format. Events, appointments and
+ todos are converted and echoed to stdout.
+ Two possible formats are available: ical and pcal
+ (see section <a href="#links_others">Links</a> below).
+ If the optional argument <code>format</code> is not given,
+ ical format is selected by default.
+ </div>
<p class="rq"><span class="valorise">Nota:</span>
redirecciona la salida standard para exportar los datos a un archivo usando
un comando como este:
- <code>$ calcurse --export > my_data.ics</code></p>
+ <code>$ calcurse --export > my_data.dat</code></p>
</dd>
</dl>
@@ -985,6 +992,16 @@ msgid ""
Este RSS feed es actualizado cada vez que hay una nueva version de Calcurse disponible
describiendo las nuevas caracteristicas.</p>
+<h2><div class="todo">9.4 Other links</div><a name="links_others"></a></h2>
+<div class="todo">
+<p>
+ You may want to look at the ical format specification (rfc2445) at:
+ <pre>http://tools.ietf.org/html/rfc2445</pre>
+<p>
+ The pcal project page can be found at:
+ <pre>http://pcal.sourceforge.net/</pre>
+</div>
+
<h1>10. Gracias a ...<a name="thanks"></a></h1>
<p>
Es la hora de dar las gracias a personas sin las que este programa
@@ -1028,7 +1045,7 @@ msgid ""
Copyright (c) 2004-2008 Fr&eacute;d&eacute;ric Culot<br>
Traducido al Español por José López
<code>&lt;testinground .at. gmail .dot. com&gt;</code><br>
- Calcurse version 2.2 - Last change: August 8, 2008<br>
+ Calcurse version 2.2 - Last change: August 11, 2008<br>
</div>
</div>
diff --git a/doc/manual_fr.html b/doc/manual_fr.html
index ccfd5db..00d019a 100755
--- a/doc/manual_fr.html
+++ b/doc/manual_fr.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
/*
- * $calcurse: manual_fr.html,v 1.19 2008/08/08 14:22:19 culot Exp $
+ * $calcurse: manual_fr.html,v 1.20 2008/08/11 18:08:45 culot Exp $
*
* Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot
@@ -112,6 +112,7 @@ pour faire remonter les bogues et pour contribuer au développement de
<li><a href="#links_homepage">9.1 Site internet de <code>calcurse</code></a></li>
<li><a href="#links_list">9.2 Liste de diffusion de <code>calcurse</code></a></li>
<li><a href="#links_rss">9.3 Flux RSS</a></li>
+ <li><a href="#links_others">9.4 Autres liens</a></li>
</ul></li>
<li><a href="#thanks">10. Remerciements</a></li>
</ul>
@@ -373,16 +374,20 @@ disponibles.
<dd>
Affiche la version de <code>calcurse</code>, puis quitte.
</dd>
- <dt><code>-x, --export</code></dt>
+ <dt><code>-x[format], --export[=format]</code></dt>
<dd>
- Exporte les données utilisateur au format iCalendar. Les évènements,
+ Exporte les données utilisateur au format spécifié. Les évènements,
rendez-vous et tâches sont convertis et imprimés sur la sortie
- standard.
+ standard. Deux formats d'export différents sont disponibles :
+ le format ical et le format pcal (voir la section
+ <a href="#links_others">Liens</a> ci-dessous).
+ Si l'argument optionnel <code>format</code> n'est pas indiqué par
+ l'utilisateur, alors le format ical sera utilisé par défaut.
<p class="rq"><span class="valorise">Note:</span>
afin de sauvegarder les données exportées dans un fichier,
il est nécessaire de rediriger la sortie standard en utilisant une
commande comme celle-ci:
- <code>$ calcurse --export &gt; mon_fichier.ics</code></p>
+ <code>$ calcurse --export &gt; mon_fichier.dat</code></p>
</dd>
</dl>
@@ -1144,6 +1149,15 @@ msgid ""
<code>calcurse</code> est diffusée, et indique quelles sont les
modifications qui ont été apportées.</p>
+<h2>9.4 Autres liens<a name="links_others"></a></h2>
+<p>
+ La spécification du format ical (rfc2445) peut être trouvée à l'adresse
+ suivante :
+ <pre>http://tools.ietf.org/html/rfc2445</pre>
+<p>
+ La page du projet pcal se trouve quant à elle à l'adresse suivante :
+ <pre>http://pcal.sourceforge.net/</pre>
+
<h1>10. Remerciements<a name="thanks"></a></h1>
<p>
Je voudrais remercier ici toutes les personnes sans qui ce projet
@@ -1197,7 +1211,7 @@ msgid ""
<div class="footer">
Copyright (c) 2004-2008 Frédéric Culot<br>
- Calcurse version 2.2 - Dernière modification: 8 Aout 2008<br>
+ Calcurse version 2.2 - Dernière modification: 11 Aout 2008<br>
</div>
</div>
diff --git a/doc/manual_it.html b/doc/manual_it.html
index ad4e058..8ae2833 100755
--- a/doc/manual_it.html
+++ b/doc/manual_it.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
/*
- * $calcurse: manual_it.html,v 1.4 2008/08/08 14:22:19 culot Exp $
+ * $calcurse: manual_it.html,v 1.5 2008/08/11 18:08:45 culot Exp $
*
* Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot
@@ -114,6 +114,7 @@ partecipare allo sviluppo di calcurse.
<li><a href="#links_homepage">9.1 Homepage di <code>calcurse</code></a></li>
<li><a href="#links_list">9.2 Lista degli annunci di <code>calcurse</code></a></li>
<li><a href="#links_rss">9.3 Feed RSS di <code>calcurse</code></a></li>
+ <li><a href="#links_others"><div class="todo">9.4 Other links</div></a></li>
</ul></li>
<li><a href="#thanks">10. Ringraziamenti</a></li>
</ul>
@@ -375,16 +376,19 @@ caratteristiche<a name="overview_features"></a></h2>
<dd>
Stampa la versione di <code>calcurse</code> ed esce.
</dd>
- <dt><code>-x, --export</code></dt>
- <dd>
- Esporta tutti i dati nel formato di iCalendar; gli eventi, gli
- appuntamenti e le attività sono convertiti e stampati sullo
- standard output.
-
+ <dt><code>-x[format], --export[=format]</code></dt>
+ <dd><div class="todo">
+ Export user data to specified format. Events, appointments and
+ todos are converted and echoed to stdout.
+ Two possible formats are available: ical and pcal
+ (see section <a href="#links_others">Links</a> below).
+ If the optional argument <code>format</code> is not given,
+ ical format is selected by default.
+ </div>
<p class="rq"><span class="valorise">Nota:</span> è possibile
reindirizzare lo standard output per salvare i dati su un file
con un comando del tipo
- <code>$ calcurse --export &gt; my_data.ics</code></p>
+ <code>$ calcurse --export &gt; my_data.dat</code></p>
</dd>
</dl>
@@ -1182,6 +1186,16 @@ d'ambiente<a name="basics_invocation_environment"></a></h3>
versione con la descrizione delle funzionalità aggiunte.
</p>
+<h2><div class="todo">9.4 Other links</div><a name="links_others"></a></h2>
+<div class="todo">
+<p>
+ You may want to look at the ical format specification (rfc2445) at:
+ <pre>http://tools.ietf.org/html/rfc2445</pre>
+<p>
+ The pcal project page can be found at:
+ <pre>http://pcal.sourceforge.net/</pre>
+</div>
+
<h1>10. Ringraziamenti<a name="thanks"></a></h1>
<p>
&Egrave; giunto il momento per ringraziare le persone senza le quali
@@ -1273,7 +1287,7 @@ d'ambiente<a name="basics_invocation_environment"></a></h3>
<div class="footer">
Copyright (c) 2004-2008 Fr&eacute;d&eacute;ric Culot<br>
- Calcurse version 2.2 - Last change: August 8, 2008<br>
+ Calcurse version 2.2 - Last change: August 11, 2008<br>
</div>
</div>
diff --git a/doc/manual_nl.html b/doc/manual_nl.html
index 296dccd..d4ed79c 100755
--- a/doc/manual_nl.html
+++ b/doc/manual_nl.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//NL">
<!--
/*
- * $calcurse: manual_nl.html,v 1.10 2008/08/08 14:22:19 culot Exp $
+ * $calcurse: manual_nl.html,v 1.11 2008/08/11 18:08:45 culot Exp $
*
* Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot
@@ -110,6 +110,7 @@ besproken. Als laatste wordt zowel de procedure van het melden van fouten in
<li><a href="#links_homepage">9.1 <code>Calcurse</code> homepage</a></li>
<li><a href="#links_list">9.2 <code>Calcurse</code> nieuws lijst</a></li>
<li><a href="#links_rss">9.3 <code>Calcurse</code> RSS feed</a></li>
+ <li><a href="#links_others"><div class="todo">9.4 Other links</div></a></li>
</ul></li>
<li><a href="#thanks">10. Dankwoord</a></li>
</ul>
@@ -342,15 +343,19 @@ besproken. Als laatste wordt zowel de procedure van het melden van fouten in
Geeft het versienummer van <code>calcurse</code> weer en verlaat het
programma.
</dd>
- <dt><code>-x, --export</code></dt>
- <dd>
- Exporteert de data van de gebruiker naar het iCalender-formaat.
- Gebeurtenissen, afspraken en taken worden geconverteerd en naar stdout
- gezonden.
+ <dt><code>-x[format], --export[=format]</code></dt>
+ <dd><div class="todo">
+ Export user data to specified format. Events, appointments and
+ todos are converted and echoed to stdout.
+ Two possible formats are available: ical and pcal
+ (see section <a href="#links_others">Links</a> below).
+ If the optional argument <code>format</code> is not given,
+ ical format is selected by default.
+ </div>
<p class="rq"><span class="valorise">Noot:</span>
Om de data te exporteren naar een bestand, kan men de
standaard output omleiden met een commando zoals:
- <code>$ calcurse --export > my_data.ics</code></p>
+ <code>$ calcurse --export > my_data.dat</code></p>
</dd>
</dl>
@@ -998,6 +1003,16 @@ msgid ""
calcurse beschikbaar is, waarbij ook de nieuwe opties beschreven
worden. </p>
+<h2><div class="todo">9.4 Other links</div><a name="links_others"></a></h2>
+<div class="todo">
+<p>
+ You may want to look at the ical format specification (rfc2445) at:
+ <pre>http://tools.ietf.org/html/rfc2445</pre>
+<p>
+ The pcal project page can be found at:
+ <pre>http://pcal.sourceforge.net/</pre>
+</div>
+
<h1>10. Dankwoord<a name="thanks"></a></h1>
<p>
Het is tijd om de mensen te bedanken, zonder wie dit programma niet
@@ -1052,7 +1067,7 @@ msgid ""
<div class="footer">
Copyright (c) 2004-2008 Fr&eacute;d&eacute;ric Culot<br>
- Calcurse version 2.2 - Last change: August 8, 2008<br>
+ Calcurse version 2.2 - Last change: August 11, 2008<br>
</div>
</div>
diff --git a/src/args.c b/src/args.c
index 0b87aad..9e40d25 100755
--- a/src/args.c
+++ b/src/args.c
@@ -1,4 +1,4 @@
-/* $calcurse: args.c,v 1.36 2008/08/10 09:24:46 culot Exp $ */
+/* $calcurse: args.c,v 1.37 2008/08/11 18:08:45 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -48,7 +48,7 @@ static void
usage ()
{
char *arg_usage =
- _("Usage: calcurse [-h|-v] [-x] [-N] [-an] [-t[num]]\n"
+ _("Usage: calcurse [-h|-v] [-N] [-an] [-t[num]] [-x[format]]\n"
" [-d <date>|<num>] [-s[date]] [-r[range]]\n"
" [-c<file> | -D<dir>]\n");
fputs (arg_usage, stdout);
@@ -120,11 +120,14 @@ help_arg ()
" print todo list and exit. If the optional number [num] is given,\n"
"\tthen only todos having a priority equal to [num] will be returned.\n"
"\tnote: priority number must be between 1 (highest) and 9 (lowest).\n"
- "\n -x, --export\n"
- " export user data to iCalendar format. Events, appointments and\n"
+ "\n -x[format], --export[=format]\n"
+ " export user data to the specified format. Events, appointments and\n"
"\ttodos are converted and echoed to stdout.\n"
+ "\tTwo possible formats are available: 'ical' and 'pcal'.\n"
+ "\tIf the optional argument format is not given, ical format is\n"
+ "\tselected by default.\n"
"\tnote: redirect standard output to export data to a file,\n"
- "\tby issuing a command such as: calcurse --export > my_data.ics\n"
+ "\tby issuing a command such as: calcurse --export > calcurse.dat\n"
"\nFor more information, type '?' from within Calcurse, "
"or read the manpage.\n"
"Mail bug reports and suggestions to <calcurse@culot.org>.\n");
@@ -578,13 +581,13 @@ parse_args (int argc, char **argv, conf_t *conf)
int vflag = 0; /* -v: print version number */
int xflag = 0; /* -x: export data to iCalendar format */
- int tnum = 0;
+ int tnum = 0, xfmt = 0;
int non_interactive = 0, multiple_flag = 0, load_data = 0;
int no_file = 1;
char *ddate = "", *cfile = NULL, *range = NULL, *startday = NULL;
char *datadir = NULL;
- static char *optstr = "hvnNaxt::d:c:r:s:D:";
+ static char *optstr = "hvnNax::t::d:c:r:s:D:";
struct option longopts[] = {
{"appointment", no_argument, NULL, 'a'},
@@ -598,7 +601,7 @@ parse_args (int argc, char **argv, conf_t *conf)
{"startday", required_argument, NULL, 's'},
{"todo", optional_argument, NULL, 't'},
{"version", no_argument, NULL, 'v'},
- {"export", no_argument, NULL, 'x'},
+ {"export", optional_argument, NULL, 'x'},
{NULL, no_argument, NULL, 0}
};
@@ -675,6 +678,25 @@ parse_args (int argc, char **argv, conf_t *conf)
xflag = 1;
multiple_flag++;
load_data++;
+ if (optarg != NULL)
+ {
+ if (strcmp (optarg, "ical") == 0)
+ xfmt = IO_EXPORT_ICAL;
+ else if (strcmp (optarg, "pcal") == 0)
+ xfmt = IO_EXPORT_PCAL;
+ else
+ {
+ fputs (_("Argumet for '-x' should be either "
+ "'ical' or 'pcal'\n"), stderr);
+ usage ();
+ usage_try ();
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ xfmt = IO_EXPORT_ICAL;
+ }
break;
default:
usage ();
@@ -731,7 +753,8 @@ parse_args (int argc, char **argv, conf_t *conf)
{
notify_init_vars ();
custom_load_conf (conf, 0);
- io_export_data (IO_EXPORT_NONINTERACTIVE, IO_EXPORT_ICAL, conf);
+ io_load_todo ();
+ io_export_data (IO_EXPORT_NONINTERACTIVE, xfmt, conf);
non_interactive = 1;
return (non_interactive);
}
diff --git a/src/calcurse.1 b/src/calcurse.1
index 565dca6..00f1e2a 100755
--- a/src/calcurse.1
+++ b/src/calcurse.1
@@ -1,4 +1,4 @@
-.\" $calcurse: calcurse.1,v 1.9 2008/08/08 14:22:19 culot Exp $
+.\" $calcurse: calcurse.1,v 1.10 2008/08/11 18:08:45 culot Exp $
.\"
.\" Copyright (c) 2004-2008 Frederic Culot
.\"
@@ -23,7 +23,8 @@
Calcurse \- text-based organizer
.SH SYNOPSIS
.B "calcurse "
-[\fB-h\fP|\fB-v\fP] [\fB-x\fP] [\fB-N\fP] [\fB-an\fP] [\fB-t\fP[\fInum\fP]]
+[\fB-h\fP|\fB-v\fP] [\fB-N\fP] [\fB-an\fP] [\fB-t\fP[\fInum\fP]]
+[\fB-x\fP[\fIformat\fP]]
.br
[\fB-d\fP <\fIdate\fP>|<\fInum\fP>] [\fB-s\fP[\fIdate\fP]]
[\fB-r\fP[\fIrange\fP]]
@@ -110,14 +111,17 @@ then only todos having a priority equal to \fInum\fP will be returned.
\fB-v\fP, \fB--version\fP
Display calcurse version and exit.
.TP
-\fB-x\fP, \fB--export\fP
-Export user data to iCalendar format. Events, appointments and
-todos are converted and echoed to stdout.
+\fB-x\fP[format], \fB--export\fP[=format]
+Export user data to the specified format. Events, appointments and
+todos are converted and echoed to stdout. Two possible formats are
+available: \fIical\fP and \fIpcal\fP.
+If the optional argument format is not given, ical format is
+selected by default.
.br
\fINote:\fP redirect standard output to export data to a file,
by issuing a command such as:
.br
-.B $ calcurse --export > my_data.ics
+.B $ calcurse --export > calcurse.dat
.SH NOTES
Calcurse interface contains three different panels (calendar,
appointment list, and todo list) on which you can perform different
@@ -193,7 +197,12 @@ author, below.
.SH SEE ALSO
vi(1), less(1), ncurses(3), mkstemp(3)
.br
-Calcurse home page : http://culot.org/calcurse/
+The ical specification (rfc2445) can be found at:
+http://tools.ietf.org/html/rfc2445
+.br
+The pcal project page: http://pcal.sourceforge.net/
+.br
+Calcurse home page: http://culot.org/calcurse/
.br
Calcurse complete manual, translated in many languages and maintained in
html format, can be found in the doc/ directory of the source package,
diff --git a/src/help.c b/src/help.c
index 575c0c3..6223577 100755
--- a/src/help.c
+++ b/src/help.c
@@ -1,4 +1,4 @@
-/* $calcurse: help.c,v 1.27 2008/08/03 18:41:55 culot Exp $ */
+/* $calcurse: help.c,v 1.28 2008/08/11 18:08:45 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -301,10 +301,16 @@ help_screen (void)
hscr[HELP_EXPORT].title = _("Export:\n");
hscr[HELP_EXPORT].text =
- _("Pressing 'X' exports the Calcurse data to iCalendar format.\n\n"
+ _("Pressing 'X' leads to the export submenu, from which you can choose\n"
+ "between two different export formats: 'ical' and 'pcal'.\n"
+ "Choosing one of those formats lets you export the Calcurse data to\n"
+ "icalendar or pcal format.\n\n"
"You first need to specify the file to which the data will be exported.\n"
"By default, this file is:\n\n"
" ~/calcurse.ics\n\n"
+ "for an ical export, and:\n\n"
+ " ~/calcurse.txt\n\n"
+ "for a pcal export.\n"
"All of the calcurse data are exported, in the following order:\n"
"events, appointments, todos.\n");
diff --git a/src/io.c b/src/io.c
index 3ad64ea..7044060 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.31 2008/08/10 09:24:46 culot Exp $ */
+/* $calcurse: io.c,v 1.32 2008/08/11 18:08:45 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -40,6 +40,9 @@
#include "apoint.h"
#include "io.h"
+#define ICALDATEFMT "%Y%m%d"
+#define ICALDATETIMEFMT "%Y%m%dT%H%M%S"
+
typedef enum
{
PROGRESS_BAR_SAVE,
@@ -282,7 +285,7 @@ ical_export_recur_events (FILE *stream)
for (i = recur_elist; i != 0; i = i->next)
{
- date_sec2ical_date (i->day, ical_date);
+ date_sec2date_fmt (i->day, ICALDATEFMT, ical_date);
fprintf (stream, "BEGIN:VEVENT\n");
fprintf (stream, "DTSTART:%s\n", ical_date);
fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d",
@@ -290,7 +293,7 @@ ical_export_recur_events (FILE *stream)
if (i->rpt->until != 0)
{
- date_sec2ical_date (i->rpt->until, ical_date);
+ date_sec2date_fmt (i->rpt->until, ICALDATEFMT, ical_date);
fprintf (stream, ";UNTIL=%s\n", ical_date);
}
else
@@ -298,11 +301,11 @@ ical_export_recur_events (FILE *stream)
if (i->exc != NULL)
{
- date_sec2ical_date (i->exc->st, ical_date);
+ date_sec2date_fmt (i->exc->st, ICALDATEFMT, ical_date);
fprintf (stream, "EXDATE:%s", ical_date);
for (day = i->exc->next; day; day = day->next)
{
- date_sec2ical_date (day->st, ical_date);
+ date_sec2date_fmt (day->st, ICALDATEFMT, ical_date);
fprintf (stream, ",%s", ical_date);
}
fprintf (stream, "\n");
@@ -403,7 +406,7 @@ ical_export_events (FILE *stream)
for (i = eventlist; i != 0; i = i->next)
{
- date_sec2ical_date (i->day, ical_date);
+ date_sec2date_fmt (i->day, ICALDATEFMT, ical_date);
fprintf (stream, "BEGIN:VEVENT\n");
fprintf (stream, "DTSTART:%s\n", ical_date);
fprintf (stream, "SUMMARY:%s\n", i->mesg);
@@ -434,7 +437,7 @@ ical_export_recur_apoints (FILE *stream)
pthread_mutex_lock (&(recur_alist_p->mutex));
for (i = recur_alist_p->root; i != 0; i = i->next)
{
- date_sec2ical_datetime (i->start, ical_datetime);
+ date_sec2date_fmt (i->start, ICALDATETIMEFMT, ical_datetime);
fprintf (stream, "BEGIN:VEVENT\n");
fprintf (stream, "DTSTART:%s\n", ical_datetime);
fprintf (stream, "DURATION:P%ldS\n", i->dur);
@@ -443,7 +446,7 @@ ical_export_recur_apoints (FILE *stream)
if (i->rpt->until != 0)
{
- date_sec2ical_date (i->rpt->until + HOURINSEC, ical_date);
+ date_sec2date_fmt (i->rpt->until + HOURINSEC, ICALDATEFMT, ical_date);
fprintf (stream, ";UNTIL=%s\n", ical_date);
}
else
@@ -451,11 +454,11 @@ ical_export_recur_apoints (FILE *stream)
if (i->exc != NULL)
{
- date_sec2ical_date (i->exc->st, ical_date);
+ date_sec2date_fmt (i->exc->st, ICALDATEFMT, ical_date);
fprintf (stream, "EXDATE:%s", ical_date);
for (day = i->exc->next; day; day = day->next)
{
- date_sec2ical_date (day->st, ical_date);
+ date_sec2date_fmt (day->st, ICALDATEFMT, ical_date);
fprintf (stream, ",%s", ical_date);
}
fprintf (stream, "\n");
@@ -540,7 +543,7 @@ ical_export_apoints (FILE *stream)
pthread_mutex_lock (&(alist_p->mutex));
for (i = alist_p->root; i != 0; i = i->next)
{
- date_sec2ical_datetime (i->start, ical_datetime);
+ date_sec2date_fmt (i->start, ICALDATETIMEFMT, ical_datetime);
fprintf (stream, "BEGIN:VEVENT\n");
fprintf (stream, "DTSTART:%s\n", ical_datetime);
fprintf (stream, "DURATION:P%ldS\n", i->dur);
diff --git a/src/utils.c b/src/utils.c
index dadd52a..bbc8074 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.47 2008/08/10 09:24:46 culot Exp $ */
+/* $calcurse: utils.c,v 1.48 2008/08/11 18:08:45 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -556,45 +556,7 @@ date_sec2date_str (long sec, char *datefmt)
return (datestr);
}
-/*
- * Return a string containing an iCal date, given a date in
- * seconds. This is used to build all-day long iCal VEVENT
- * (calcurse event equivalent).
- */
-void
-date_sec2ical_date (long sec, char *ical_date)
-{
-#define DATELENGTH 9
-
- struct tm *lt;
- time_t t;
-
- t = sec;
- lt = localtime (&t);
- strftime (ical_date, DATELENGTH, "%Y%m%d", lt);
-}
-
-/*
- * Return a string containing an iCal date-time, given a date in
- * seconds. This is used to build iCal VEVENT (calcurse appointment equivalent).
- */
-void
-date_sec2ical_datetime (long sec, char *ical_datetime)
-{
-#define DATETIMELENGTH 16
-
- struct tm *lt;
- time_t t;
-
- t = sec;
- lt = localtime (&t);
- strftime (ical_datetime, DATETIMELENGTH, "%Y%m%dT%H%M%S", lt);
-}
-
-/*
- * At least a generic function to format date...
- * I promise I will learn how to code someday.
- */
+/* Generic function to format date. */
void
date_sec2date_fmt (long sec, const char *fmt, char *datef)
{
diff --git a/src/utils.h b/src/utils.h
index c457581..5e03bb2 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/* $calcurse: utils.h,v 1.31 2008/08/10 09:24:46 culot Exp $ */
+/* $calcurse: utils.h,v 1.32 2008/08/11 18:08:45 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -89,8 +89,6 @@ void status_bar (void);
long date2sec (date_t, unsigned, unsigned);
char *date_sec2hour_str (long);
char *date_sec2date_str (long, char *);
-void date_sec2ical_date (long, char *);
-void date_sec2ical_datetime (long, char *);
void date_sec2date_fmt (long, const char *, char *);
long date_sec_change (long, int, int);
long update_time_in_date (long, unsigned, unsigned);