$(error "No libical support. Cannot continue");
endif
-CFLAGS := $(OPT_FLAGS) $(XML2_CFLAGS)
+GLIB_CFLAGS += $(shell pkg-config glib-2.0 --cflags)
+GLIB_LDFLAGS += $(shell pkg-config glib-2.0 --libs)
+ifeq ($(GLIB_LDFLAGS),)
+$(error "No glib support. Cannot continue");
+endif
+
+
+CFLAGS := $(OPT_FLAGS) $(XML2_CFLAGS) $(GLIB_CFLAGS)
CFLAGS_ews_autodiscover.o := $(SOUP_CFLAGS)
CFLAGS_ews2ical.o := $(ICAL_CFLAGS)
%.o: %.c
$(CC) -c -o $@ $(CFLAGS) $(CFLAGS_$@) $< -MD -MF .$@.dep
-all: ews_autodiscover ews2ical
+PROGS := ews_autodiscover ews2ical
+
+all: $(PROGS)
+
+clean:
+ rm -f $(PROGS) *.o .*.o.dep
ews2ical: ews2ical.o
- $(CC) -o $@ $< $(LDFLAGS) $(XML2_LDFLAGS) $(ICAL_LDFLAGS)
+ $(CC) -o $@ $< $(LDFLAGS) $(XML2_LDFLAGS) $(ICAL_LDFLAGS) $(GLIB_LDFLAGS)
ews_autodiscover: ews_autodiscover.o
- $(CC) -o $@ $< $(LDFLAGS) $(XML2_LDFLAGS) $(SOUP_LDFLAGS)
+ $(CC) -o $@ $< $(LDFLAGS) $(XML2_LDFLAGS) $(SOUP_LDFLAGS) $(GLIB_LDFLAGS)
-#define _GNU_SOURCE /* for asprintf */
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libical/icaltime.h>
#include <libical/icalduration.h>
#include <libical/icaltimezone.h>
+
+#include <glib.h>
+#include <glib/gprintf.h>
+
FILE *calfile;
int process_relativeyearlyrecurrence(xmlNode *xml_node, struct icalrecurrencetype *ical_recur);
if (process_mailbox(xml_node, &name, &email))
return -1;
- asprintf(&mailtoname, "mailto:%s", email);
+ mailtoname = g_strdup_printf("mailto:%s", email);
prop = icalproperty_new_organizer(mailtoname);
free(mailtoname);
if (process_mailbox(xml_node, &name, &email))
return -1;
- asprintf(&mailtoname, "mailto:%s", email);
+ mailtoname = g_strdup_printf("mailto:%s", email);
prop = icalproperty_new_attendee(mailtoname);
free(mailtoname);
do {
space = strchr(days, ' ');
if (space)
- day = strndup(days, space - days);
+ day = g_strndup(days, space - days);
else
day = days;
-#define _GNU_SOURCE
-
#include <libsoup/soup.h>
#include <stdio.h>
#include <stdlib.h>
g_thread_init (NULL);
g_type_init ();
- asprintf(&url, "https://autodiscover.%s/autodiscover/autodiscover.xml", domain);
+ url = g_strdup_printf("https://autodiscover.%s/autodiscover/autodiscover.xml", domain);
sess = soup_session_sync_new_with_options(SOUP_SESSION_USE_NTLM, TRUE, NULL);
g_signal_connect (sess, "authenticate",