aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util/test-recur.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/cal-util/test-recur.c')
-rw-r--r--calendar/cal-util/test-recur.c42
1 files changed, 2 insertions, 40 deletions
diff --git a/calendar/cal-util/test-recur.c b/calendar/cal-util/test-recur.c
index 5078a1db94..03f19b52bd 100644
--- a/calendar/cal-util/test-recur.c
+++ b/calendar/cal-util/test-recur.c
@@ -37,6 +37,7 @@
#include <string.h>
#include <gtk/gtkmain.h>
#include <cal-util/cal-recur.h>
+#include <cal-util/cal-util.h>
/* Since events can recur infinitely, we set a limit to the number of
@@ -44,10 +45,6 @@
#define MAX_OCCURRENCES 1000
static void usage (void);
-static icalcomponent* scan_ics_file (char *filename);
-static char* get_line (char *s,
- size_t size,
- void *data);
static void generate_occurrences (icalcomponent *comp);
static gboolean occurrence_cb (CalComponent *comp,
time_t instance_start,
@@ -69,7 +66,7 @@ main (int argc,
filename = argv[1];
- icalcomp = scan_ics_file (filename);
+ icalcomp = cal_util_parse_ics_file (filename);
if (icalcomp)
generate_occurrences (icalcomp);
@@ -85,41 +82,6 @@ usage (void)
}
-static icalcomponent*
-scan_ics_file (char *filename)
-{
- FILE *fp;
- icalcomponent *icalcomp;
- icalparser *parser;
-
- g_print ("Opening file: %s\n", filename);
- fp = fopen (filename, "r");
-
- if (!fp) {
- g_print ("Can't open file: %s\n", filename);
- return NULL;
- }
-
- parser = icalparser_new ();
- icalparser_set_gen_data (parser, fp);
-
- icalcomp = icalparser_parse (parser, get_line);
- icalparser_free (parser);
-
- return icalcomp;
-}
-
-
-/* Callback used from icalparser_parse() */
-static char *
-get_line (char *s,
- size_t size,
- void *data)
-{
- return fgets (s, size, (FILE*) data);
-}
-
-
/* This resolves any TZIDs in the components. The VTIMEZONEs must be in the
file we are reading. */
static icaltimezone*