diff options
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/.svn/all-wcprops | 23 | ||||
-rw-r--r-- | test/src/.svn/entries | 130 | ||||
-rw-r--r-- | test/src/.svn/text-base/Makefile.am.svn-base | 24 | ||||
-rw-r--r-- | test/src/.svn/text-base/Makefile.in.svn-base | 568 | ||||
-rw-r--r-- | test/src/.svn/text-base/caldav-test.c.svn-base | 383 | ||||
-rw-r--r-- | test/src/Makefile.am | 24 | ||||
-rw-r--r-- | test/src/Makefile.in | 568 | ||||
-rw-r--r-- | test/src/caldav-test.c | 383 |
8 files changed, 2103 insertions, 0 deletions
diff --git a/test/src/.svn/all-wcprops b/test/src/.svn/all-wcprops new file mode 100644 index 0000000..35dbbb1 --- /dev/null +++ b/test/src/.svn/all-wcprops @@ -0,0 +1,23 @@ +K 25 +svn:wc:ra_dav:version-url +V 45 +/svnroot/libcaldav/!svn/ver/42/trunk/test/src +END +Makefile.in +K 25 +svn:wc:ra_dav:version-url +V 57 +/svnroot/libcaldav/!svn/ver/42/trunk/test/src/Makefile.in +END +caldav-test.c +K 25 +svn:wc:ra_dav:version-url +V 59 +/svnroot/libcaldav/!svn/ver/40/trunk/test/src/caldav-test.c +END +Makefile.am +K 25 +svn:wc:ra_dav:version-url +V 57 +/svnroot/libcaldav/!svn/ver/30/trunk/test/src/Makefile.am +END diff --git a/test/src/.svn/entries b/test/src/.svn/entries new file mode 100644 index 0000000..d1fc176 --- /dev/null +++ b/test/src/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +42 +https://libcaldav.svn.sourceforge.net/svnroot/libcaldav/trunk/test/src +https://libcaldav.svn.sourceforge.net/svnroot/libcaldav + + + +2010-05-29T15:45:56.236020Z +42 +miras + + + + + + + + + + + + + + +6bb92309-7149-0410-b568-bc30dfd0a1d5 + +Makefile.in +file + + + + +2010-05-31T07:07:58.000000Z +5623db3c1b01fb5c13cd1e15ea763355 +2010-05-29T15:45:56.236020Z +42 +miras + + + + + + + + + + + + + + + + + + + + + +17789 + +caldav-test.c +file + + + + +2010-05-31T07:07:58.000000Z +438a9b64b6a8b95695cfdf79b94f33b1 +2010-05-23T21:46:08.944313Z +40 +miras + + + + + + + + + + + + + + + + + + + + + +10238 + +Makefile.am +file + + + + +2010-05-31T07:07:58.000000Z +edfdb9dbb873f21664df8048fa441106 +2010-04-04T20:17:57.156621Z +30 +miras + + + + + + + + + + + + + + + + + + + + + +372 + diff --git a/test/src/.svn/text-base/Makefile.am.svn-base b/test/src/.svn/text-base/Makefile.am.svn-base new file mode 100644 index 0000000..9ede9ce --- /dev/null +++ b/test/src/.svn/text-base/Makefile.am.svn-base @@ -0,0 +1,24 @@ +AUTOMAKE_OPTIONS = gnu + +if BUILD_CALDAV +INCLUDES = \ + @CURL_CFLAGS@ \ + @GLIB_CFLAGS@ \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src + +bin_PROGRAMS = caldav-test + +caldav_test_SOURCES = \ + caldav-test.c + +noinst_HEADERS = + +caldav_test_LDFLAGS = \ + -L$(top_builddir)/src + +caldav_test_LDADD = \ + @CURL_LIBS@ \ + @GLIB_LIBS@ \ + -lcaldav +endif diff --git a/test/src/.svn/text-base/Makefile.in.svn-base b/test/src/.svn/text-base/Makefile.in.svn-base new file mode 100644 index 0000000..12baa48 --- /dev/null +++ b/test/src/.svn/text-base/Makefile.in.svn-base @@ -0,0 +1,568 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@BUILD_CALDAV_TRUE@bin_PROGRAMS = caldav-test$(EXEEXT) +subdir = test/src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_doxygen.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am__caldav_test_SOURCES_DIST = caldav-test.c +@BUILD_CALDAV_TRUE@am_caldav_test_OBJECTS = caldav-test.$(OBJEXT) +caldav_test_OBJECTS = $(am_caldav_test_OBJECTS) +caldav_test_DEPENDENCIES = +caldav_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(caldav_test_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(caldav_test_SOURCES) +DIST_SOURCES = $(am__caldav_test_SOURCES_DIST) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBVERSION = @LIBVERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = gnu +@BUILD_CALDAV_TRUE@INCLUDES = \ +@BUILD_CALDAV_TRUE@ @CURL_CFLAGS@ \ +@BUILD_CALDAV_TRUE@ @GLIB_CFLAGS@ \ +@BUILD_CALDAV_TRUE@ -I$(top_srcdir) \ +@BUILD_CALDAV_TRUE@ -I$(top_srcdir)/src + +@BUILD_CALDAV_TRUE@caldav_test_SOURCES = \ +@BUILD_CALDAV_TRUE@ caldav-test.c + +@BUILD_CALDAV_TRUE@noinst_HEADERS = +@BUILD_CALDAV_TRUE@caldav_test_LDFLAGS = \ +@BUILD_CALDAV_TRUE@ -L$(top_builddir)/src + +@BUILD_CALDAV_TRUE@caldav_test_LDADD = \ +@BUILD_CALDAV_TRUE@ @CURL_LIBS@ \ +@BUILD_CALDAV_TRUE@ @GLIB_LIBS@ \ +@BUILD_CALDAV_TRUE@ -lcaldav + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu test/src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +caldav-test$(EXEEXT): $(caldav_test_OBJECTS) $(caldav_test_DEPENDENCIES) + @rm -f caldav-test$(EXEEXT) + $(caldav_test_LINK) $(caldav_test_OBJECTS) $(caldav_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/caldav-test.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/test/src/.svn/text-base/caldav-test.c.svn-base b/test/src/.svn/text-base/caldav-test.c.svn-base new file mode 100644 index 0000000..6e287ad --- /dev/null +++ b/test/src/.svn/text-base/caldav-test.c.svn-base @@ -0,0 +1,383 @@ +/* Copyright (c) 2008 Michael Rasmussen (mir@datanom.net) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "caldav.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <glib.h> +#include <sys/stat.h> +#include <string.h> +#include <time.h> + +gchar* make_url(gchar* uid, gchar* pwd, gchar* url) { + char* pos; + char* protocol = NULL; + char* uri = NULL; + char* newurl = NULL; + + if (!uid) + return g_strdup(url); + if ((pos = strstr(url, "//")) != NULL) { + uri = g_strdup(&(*(pos + 2))); + protocol = g_strndup(url, pos + 2 - url); + } + else { + protocol = g_strdup("http://"); + } + if (!pwd) + newurl = g_strdup_printf("%s%s@%s", protocol, uid, uri); + else + newurl = g_strdup_printf("%s%s:%s@%s", protocol, uid, pwd, uri); + g_free(uri); + g_free(protocol); + return newurl; +} + +#define BUFFER 1000 +gchar* read_stream(FILE* stream, gchar* mem) { + int len, fd; + char buf[BUFFER]; + struct stat sb; + + fd = fileno(stream); + fstat(fd, &sb); + while ((len = read(fd, &buf, sizeof(buf))) > 0) { + mem = (char *) realloc(mem, sizeof(buf) + 1); + strncat(mem, buf, sizeof(buf)); + } + mem[sb.st_size] = '\0'; + fclose(stream); + return mem; +} + +time_t make_time_t(const char* time_elem) { + struct tm datetime = {0,0,0,0,0,0,0,0,0,0,NULL}; + //struct tm* tmp; + gchar** elem; + time_t t; + + //t = time(NULL); + //tmp = localtime(&t); + elem = g_strsplit(time_elem, "/", 3); + if (g_strv_length(elem) == 3) { + datetime.tm_year = atoi(elem[0]) - 1900; + datetime.tm_mon = atoi(elem[1]) - 1; + datetime.tm_mday = atoi(elem[2]); + t = mktime(&datetime); + } + g_strfreev(elem); + return t; +} + +/* [yyyy/mm/dd[ hh/mm[/ss[/z]]] */ +time_t make_fbtime_t(const char* time_elem) { + struct tm datetime = {0,0,0,0,0,0,0,0,0,0,NULL}; + gboolean utc = FALSE; + gchar** elem; + gchar** dt; + time_t t; + guint length; + + dt = g_strsplit(time_elem, " ", 2); + length = g_strv_length(dt); + if (length > 1) { + elem = g_strsplit(dt[1], "/", 4); + length = g_strv_length(elem); + datetime.tm_hour = atoi(elem[0]); + datetime.tm_min = atoi(elem[1]); + if (length > 2) + datetime.tm_sec = atoi(elem[2]); + if (length > 3 && strcasecmp(elem[3], "z") == 0) + utc = TRUE; + g_strfreev(elem); + } + elem = g_strsplit(time_elem, "/", 3); + datetime.tm_year = atoi(elem[0]) - 1900; + datetime.tm_mon = atoi(elem[1]) - 1; + datetime.tm_mday = atoi(elem[2]); + g_strfreev(elem); + if (utc) { + t = mktime(&datetime); + struct tm* utc_time = gmtime(&t); + t = mktime(utc_time); + //g_free(utc_time); + } + else + t = mktime(&datetime); + return t; +} + +static const char* usage[] = { +"caldav-test is part of libcaldav for claws-mails " +"vcalendar plugin.\nCopyright (C) Michael Rasmussen, 2008.\n" +"This program is free software; you can redistribute it and/or modify\n" +"it under the terms of the GNU General Public License as published by\n" +"the Free Software Foundation; either version 3 of the License, or\n" +"(at your option) any later version.\n" +"\nusage:\n\tcaldav-test [Options] URL\n" +"\n\tOptions:\n\t\t-a\taction [is-caldav|add|delete|modify|get|get-all|displayname|options|freebusy]\n" +"\t\t-c\tprovide custom cacert (path to cert)\n" +"\t\t-d\tdebug (show request/response)\n" +"\t\t-e\tend [yyyy/mm/dd]. For FREEBUSY [yyyy/mm/dd[ hh/mm[/ss[/z]]]\n" +"\t\t-f\tfile. Alternative is to use IO redirection (<)\n" +"\t\t-p\tpassword\n" +"\t\t-s\tstart [yyyy/mm/dd]. For FREEBUSY [yyyy/mm/dd[ hh/mm[/ss[/z]]]\n" +"\t\t-u\tusername\n" +"\t\t-v\tdisable certificate verification\n" +"\t\t-h|-?\tusage\n" +}; + +int main(int argc, char **argv) { + int c; + CALDAV_ACTION ACTION = UNKNOWN; + gboolean debug = FALSE; + gboolean verify_ssl_certificate = TRUE; + FILE* stream = NULL; + gchar* username = NULL; + gchar* password = NULL; + gchar* url = NULL; + gchar* start = NULL; + gchar* end = NULL; + response* result; + CALDAV_RESPONSE res = UNKNOWN; + gchar* input = NULL; + char** options = NULL; + runtime_info* opt; + gchar* custom_cacert = NULL; + + opt = caldav_get_runtime_info(); + while ((c = getopt(argc, argv, "a:c:de:f:hp:s:u:v?")) != -1) { + switch (c) { + case 'h': + case '?': + fprintf(stdout, "%s", usage[0]); + return 0; + case 'a': + if (strcmp("add", optarg) == 0) { + ACTION = ADD; + } + else if (strcmp("delete", optarg) == 0) { + ACTION = DELETE; + } + else if (strcmp("modify", optarg) == 0) { + ACTION = MODIFY; + } + else if (strcmp("get", optarg) == 0) { + ACTION = GET; + } + else if (strcmp("get-all", optarg) == 0) { + ACTION = GETALL; + } + else if (strcmp("displayname", optarg) == 0) { + ACTION = GETCALNAME; + } + else if (strcmp("is-caldav", optarg) == 0) { + ACTION = ISCALDAV; + } + else if (strcmp("options", optarg) == 0) { + ACTION = OPTIONS; + } + else if (strcmp("freebusy", optarg) == 0) { + ACTION = FREEBUSY; + } + else { + fprintf(stderr, "Unknown action: %s\n", optarg); + fprintf(stderr, "%s", usage[0]); + return 1; + } + break; + case 'c': + custom_cacert = g_strdup(optarg); + break; + case 'd': + debug = TRUE; + break; + case 'e': + end = optarg; + break; + case 'f': + stream = fopen(optarg, "r"); + if (!stream) { + perror("File"); + caldav_free_runtime_info(&opt); + return 1; + } + case 'p': + password = optarg; + break; + case 's': + start = optarg; + break; + case 'u': + username = optarg; + break; + case 'v': + verify_ssl_certificate = FALSE; + break; + default: + return 1; + } + } + if (optind < argc - 1) { + fprintf(stderr, "Error: Only enter one URL\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + if (optind == argc) { + fprintf(stderr, "Error: Missing URL\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + if (ACTION == UNKNOWN) { + fprintf(stderr, "Error: Missing action\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + if (ACTION != GETALL && ACTION != GET && ACTION != GETCALNAME && + ACTION != ISCALDAV && ACTION != OPTIONS && ACTION != FREEBUSY) { + struct stat sb; + if (fstat(fileno(stdin), &sb) == -1) { + if (!stream) { + perror("stat"); + caldav_free_runtime_info(&opt); + return 1; + } + } + else { + if (stream && sb.st_size > 0) { + fprintf(stderr, "Error: Option -f is in use. Cannot redirect stdin\n"); + caldav_free_runtime_info(&opt); + return 1; + } + else + stream = (stream) ? stream : stdin; + } + input = read_stream(stream, input); + if (!input) { + fprintf(stderr, "Error: Could not read from file\n"); + caldav_free_runtime_info(&opt); + return 1; + } + } + if (ACTION == GET || ACTION == FREEBUSY) { + if (start == NULL || end == NULL) { + fprintf(stderr, "Error: Option '-a get' or '-a freebusy' requires option e and s\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + } + url = make_url(username, password, argv[optind]); + if (debug) { + opt->options->debug = 1; + opt->options->trace_ascii = 1; + } + opt->options->verify_ssl_certificate = verify_ssl_certificate; + opt->options->custom_cacert = g_strdup(custom_cacert); + g_free(custom_cacert); + result = caldav_get_response(); + switch (ACTION) { + case GETALL: res = caldav_getall_object(result, url, opt); break; + case GET: res = caldav_get_object( + result, make_time_t(start), make_time_t(end), url, opt); break; + case FREEBUSY: res = caldav_get_freebusy( + result, make_fbtime_t(start), make_fbtime_t(end), url, opt); break; + case ADD: res = caldav_add_object(input, url, opt); break; + case DELETE: res = caldav_delete_object(input, url, opt); break; + case MODIFY: res = caldav_modify_object(input, url, opt); break; + case GETCALNAME: res = caldav_get_displayname(result, url, opt); break; + case ISCALDAV: + res = caldav_enabled_resource(url, opt); + if (res) + res = OK; + else { + if (opt->error->code > 0) { + switch (opt->error->code) { + case 401: + case 403: res = FORBIDDEN; break; + case 409: res = CONFLICT; break; + case 423: res = LOCKED; break; + case 501: res = NOTIMPLEMENTED; break; + default: res = CONFLICT; break; + } + } + else + res = CONFLICT; + } + break; + case OPTIONS: + options = caldav_get_server_options(url, opt); + if (options) + res = OK; + else { + if (opt->error->code > 0) { + switch (opt->error->code) { + case 401: + case 403: res = FORBIDDEN; break; + case 409: res = CONFLICT; break; + case 423: res = LOCKED; break; + case 501: res = NOTIMPLEMENTED; break; + default: res = CONFLICT; break; + } + } + else + res = CONFLICT; + } + break; + default: break; + } + g_free(url); + g_free(input); + if (res != OK) { + fprintf(stderr, "Error\nCode: %ld\n%s\n", opt->error->code, opt->error->str); + caldav_free_runtime_info(&opt); + caldav_free_response(&result); + return 1; + } + if (result->msg && ACTION != OPTIONS) { + fprintf(stdout, "%s", result->msg); + gchar* endline = strrchr(result->msg, '\n'); + if (endline) { + if (strlen(endline) != 1) + fprintf(stdout, "\n"); + } + else + fprintf(stdout, "\n"); + } + else if (ACTION == OPTIONS) { + char** tmp = options; + while (*options) { + fprintf(stdout, "%s\n", *options++); + } + g_strfreev(tmp); + } + else if (ACTION == GET || ACTION == GETALL || ACTION == GETCALNAME || ACTION == FREEBUSY) { + fprintf(stdout, "empty collection\n"); + } + fprintf(stdout, "OK\n"); + caldav_free_response(&result); + caldav_free_runtime_info(&opt); + return 0; +} diff --git a/test/src/Makefile.am b/test/src/Makefile.am new file mode 100644 index 0000000..9ede9ce --- /dev/null +++ b/test/src/Makefile.am @@ -0,0 +1,24 @@ +AUTOMAKE_OPTIONS = gnu + +if BUILD_CALDAV +INCLUDES = \ + @CURL_CFLAGS@ \ + @GLIB_CFLAGS@ \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src + +bin_PROGRAMS = caldav-test + +caldav_test_SOURCES = \ + caldav-test.c + +noinst_HEADERS = + +caldav_test_LDFLAGS = \ + -L$(top_builddir)/src + +caldav_test_LDADD = \ + @CURL_LIBS@ \ + @GLIB_LIBS@ \ + -lcaldav +endif diff --git a/test/src/Makefile.in b/test/src/Makefile.in new file mode 100644 index 0000000..12baa48 --- /dev/null +++ b/test/src/Makefile.in @@ -0,0 +1,568 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@BUILD_CALDAV_TRUE@bin_PROGRAMS = caldav-test$(EXEEXT) +subdir = test/src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_doxygen.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am__caldav_test_SOURCES_DIST = caldav-test.c +@BUILD_CALDAV_TRUE@am_caldav_test_OBJECTS = caldav-test.$(OBJEXT) +caldav_test_OBJECTS = $(am_caldav_test_OBJECTS) +caldav_test_DEPENDENCIES = +caldav_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(caldav_test_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(caldav_test_SOURCES) +DIST_SOURCES = $(am__caldav_test_SOURCES_DIST) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBVERSION = @LIBVERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = gnu +@BUILD_CALDAV_TRUE@INCLUDES = \ +@BUILD_CALDAV_TRUE@ @CURL_CFLAGS@ \ +@BUILD_CALDAV_TRUE@ @GLIB_CFLAGS@ \ +@BUILD_CALDAV_TRUE@ -I$(top_srcdir) \ +@BUILD_CALDAV_TRUE@ -I$(top_srcdir)/src + +@BUILD_CALDAV_TRUE@caldav_test_SOURCES = \ +@BUILD_CALDAV_TRUE@ caldav-test.c + +@BUILD_CALDAV_TRUE@noinst_HEADERS = +@BUILD_CALDAV_TRUE@caldav_test_LDFLAGS = \ +@BUILD_CALDAV_TRUE@ -L$(top_builddir)/src + +@BUILD_CALDAV_TRUE@caldav_test_LDADD = \ +@BUILD_CALDAV_TRUE@ @CURL_LIBS@ \ +@BUILD_CALDAV_TRUE@ @GLIB_LIBS@ \ +@BUILD_CALDAV_TRUE@ -lcaldav + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu test/src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +caldav-test$(EXEEXT): $(caldav_test_OBJECTS) $(caldav_test_DEPENDENCIES) + @rm -f caldav-test$(EXEEXT) + $(caldav_test_LINK) $(caldav_test_OBJECTS) $(caldav_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/caldav-test.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/test/src/caldav-test.c b/test/src/caldav-test.c new file mode 100644 index 0000000..6e287ad --- /dev/null +++ b/test/src/caldav-test.c @@ -0,0 +1,383 @@ +/* Copyright (c) 2008 Michael Rasmussen (mir@datanom.net) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "caldav.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <glib.h> +#include <sys/stat.h> +#include <string.h> +#include <time.h> + +gchar* make_url(gchar* uid, gchar* pwd, gchar* url) { + char* pos; + char* protocol = NULL; + char* uri = NULL; + char* newurl = NULL; + + if (!uid) + return g_strdup(url); + if ((pos = strstr(url, "//")) != NULL) { + uri = g_strdup(&(*(pos + 2))); + protocol = g_strndup(url, pos + 2 - url); + } + else { + protocol = g_strdup("http://"); + } + if (!pwd) + newurl = g_strdup_printf("%s%s@%s", protocol, uid, uri); + else + newurl = g_strdup_printf("%s%s:%s@%s", protocol, uid, pwd, uri); + g_free(uri); + g_free(protocol); + return newurl; +} + +#define BUFFER 1000 +gchar* read_stream(FILE* stream, gchar* mem) { + int len, fd; + char buf[BUFFER]; + struct stat sb; + + fd = fileno(stream); + fstat(fd, &sb); + while ((len = read(fd, &buf, sizeof(buf))) > 0) { + mem = (char *) realloc(mem, sizeof(buf) + 1); + strncat(mem, buf, sizeof(buf)); + } + mem[sb.st_size] = '\0'; + fclose(stream); + return mem; +} + +time_t make_time_t(const char* time_elem) { + struct tm datetime = {0,0,0,0,0,0,0,0,0,0,NULL}; + //struct tm* tmp; + gchar** elem; + time_t t; + + //t = time(NULL); + //tmp = localtime(&t); + elem = g_strsplit(time_elem, "/", 3); + if (g_strv_length(elem) == 3) { + datetime.tm_year = atoi(elem[0]) - 1900; + datetime.tm_mon = atoi(elem[1]) - 1; + datetime.tm_mday = atoi(elem[2]); + t = mktime(&datetime); + } + g_strfreev(elem); + return t; +} + +/* [yyyy/mm/dd[ hh/mm[/ss[/z]]] */ +time_t make_fbtime_t(const char* time_elem) { + struct tm datetime = {0,0,0,0,0,0,0,0,0,0,NULL}; + gboolean utc = FALSE; + gchar** elem; + gchar** dt; + time_t t; + guint length; + + dt = g_strsplit(time_elem, " ", 2); + length = g_strv_length(dt); + if (length > 1) { + elem = g_strsplit(dt[1], "/", 4); + length = g_strv_length(elem); + datetime.tm_hour = atoi(elem[0]); + datetime.tm_min = atoi(elem[1]); + if (length > 2) + datetime.tm_sec = atoi(elem[2]); + if (length > 3 && strcasecmp(elem[3], "z") == 0) + utc = TRUE; + g_strfreev(elem); + } + elem = g_strsplit(time_elem, "/", 3); + datetime.tm_year = atoi(elem[0]) - 1900; + datetime.tm_mon = atoi(elem[1]) - 1; + datetime.tm_mday = atoi(elem[2]); + g_strfreev(elem); + if (utc) { + t = mktime(&datetime); + struct tm* utc_time = gmtime(&t); + t = mktime(utc_time); + //g_free(utc_time); + } + else + t = mktime(&datetime); + return t; +} + +static const char* usage[] = { +"caldav-test is part of libcaldav for claws-mails " +"vcalendar plugin.\nCopyright (C) Michael Rasmussen, 2008.\n" +"This program is free software; you can redistribute it and/or modify\n" +"it under the terms of the GNU General Public License as published by\n" +"the Free Software Foundation; either version 3 of the License, or\n" +"(at your option) any later version.\n" +"\nusage:\n\tcaldav-test [Options] URL\n" +"\n\tOptions:\n\t\t-a\taction [is-caldav|add|delete|modify|get|get-all|displayname|options|freebusy]\n" +"\t\t-c\tprovide custom cacert (path to cert)\n" +"\t\t-d\tdebug (show request/response)\n" +"\t\t-e\tend [yyyy/mm/dd]. For FREEBUSY [yyyy/mm/dd[ hh/mm[/ss[/z]]]\n" +"\t\t-f\tfile. Alternative is to use IO redirection (<)\n" +"\t\t-p\tpassword\n" +"\t\t-s\tstart [yyyy/mm/dd]. For FREEBUSY [yyyy/mm/dd[ hh/mm[/ss[/z]]]\n" +"\t\t-u\tusername\n" +"\t\t-v\tdisable certificate verification\n" +"\t\t-h|-?\tusage\n" +}; + +int main(int argc, char **argv) { + int c; + CALDAV_ACTION ACTION = UNKNOWN; + gboolean debug = FALSE; + gboolean verify_ssl_certificate = TRUE; + FILE* stream = NULL; + gchar* username = NULL; + gchar* password = NULL; + gchar* url = NULL; + gchar* start = NULL; + gchar* end = NULL; + response* result; + CALDAV_RESPONSE res = UNKNOWN; + gchar* input = NULL; + char** options = NULL; + runtime_info* opt; + gchar* custom_cacert = NULL; + + opt = caldav_get_runtime_info(); + while ((c = getopt(argc, argv, "a:c:de:f:hp:s:u:v?")) != -1) { + switch (c) { + case 'h': + case '?': + fprintf(stdout, "%s", usage[0]); + return 0; + case 'a': + if (strcmp("add", optarg) == 0) { + ACTION = ADD; + } + else if (strcmp("delete", optarg) == 0) { + ACTION = DELETE; + } + else if (strcmp("modify", optarg) == 0) { + ACTION = MODIFY; + } + else if (strcmp("get", optarg) == 0) { + ACTION = GET; + } + else if (strcmp("get-all", optarg) == 0) { + ACTION = GETALL; + } + else if (strcmp("displayname", optarg) == 0) { + ACTION = GETCALNAME; + } + else if (strcmp("is-caldav", optarg) == 0) { + ACTION = ISCALDAV; + } + else if (strcmp("options", optarg) == 0) { + ACTION = OPTIONS; + } + else if (strcmp("freebusy", optarg) == 0) { + ACTION = FREEBUSY; + } + else { + fprintf(stderr, "Unknown action: %s\n", optarg); + fprintf(stderr, "%s", usage[0]); + return 1; + } + break; + case 'c': + custom_cacert = g_strdup(optarg); + break; + case 'd': + debug = TRUE; + break; + case 'e': + end = optarg; + break; + case 'f': + stream = fopen(optarg, "r"); + if (!stream) { + perror("File"); + caldav_free_runtime_info(&opt); + return 1; + } + case 'p': + password = optarg; + break; + case 's': + start = optarg; + break; + case 'u': + username = optarg; + break; + case 'v': + verify_ssl_certificate = FALSE; + break; + default: + return 1; + } + } + if (optind < argc - 1) { + fprintf(stderr, "Error: Only enter one URL\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + if (optind == argc) { + fprintf(stderr, "Error: Missing URL\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + if (ACTION == UNKNOWN) { + fprintf(stderr, "Error: Missing action\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + if (ACTION != GETALL && ACTION != GET && ACTION != GETCALNAME && + ACTION != ISCALDAV && ACTION != OPTIONS && ACTION != FREEBUSY) { + struct stat sb; + if (fstat(fileno(stdin), &sb) == -1) { + if (!stream) { + perror("stat"); + caldav_free_runtime_info(&opt); + return 1; + } + } + else { + if (stream && sb.st_size > 0) { + fprintf(stderr, "Error: Option -f is in use. Cannot redirect stdin\n"); + caldav_free_runtime_info(&opt); + return 1; + } + else + stream = (stream) ? stream : stdin; + } + input = read_stream(stream, input); + if (!input) { + fprintf(stderr, "Error: Could not read from file\n"); + caldav_free_runtime_info(&opt); + return 1; + } + } + if (ACTION == GET || ACTION == FREEBUSY) { + if (start == NULL || end == NULL) { + fprintf(stderr, "Error: Option '-a get' or '-a freebusy' requires option e and s\n"); + fprintf(stderr, "%s", usage[0]); + caldav_free_runtime_info(&opt); + return 1; + } + } + url = make_url(username, password, argv[optind]); + if (debug) { + opt->options->debug = 1; + opt->options->trace_ascii = 1; + } + opt->options->verify_ssl_certificate = verify_ssl_certificate; + opt->options->custom_cacert = g_strdup(custom_cacert); + g_free(custom_cacert); + result = caldav_get_response(); + switch (ACTION) { + case GETALL: res = caldav_getall_object(result, url, opt); break; + case GET: res = caldav_get_object( + result, make_time_t(start), make_time_t(end), url, opt); break; + case FREEBUSY: res = caldav_get_freebusy( + result, make_fbtime_t(start), make_fbtime_t(end), url, opt); break; + case ADD: res = caldav_add_object(input, url, opt); break; + case DELETE: res = caldav_delete_object(input, url, opt); break; + case MODIFY: res = caldav_modify_object(input, url, opt); break; + case GETCALNAME: res = caldav_get_displayname(result, url, opt); break; + case ISCALDAV: + res = caldav_enabled_resource(url, opt); + if (res) + res = OK; + else { + if (opt->error->code > 0) { + switch (opt->error->code) { + case 401: + case 403: res = FORBIDDEN; break; + case 409: res = CONFLICT; break; + case 423: res = LOCKED; break; + case 501: res = NOTIMPLEMENTED; break; + default: res = CONFLICT; break; + } + } + else + res = CONFLICT; + } + break; + case OPTIONS: + options = caldav_get_server_options(url, opt); + if (options) + res = OK; + else { + if (opt->error->code > 0) { + switch (opt->error->code) { + case 401: + case 403: res = FORBIDDEN; break; + case 409: res = CONFLICT; break; + case 423: res = LOCKED; break; + case 501: res = NOTIMPLEMENTED; break; + default: res = CONFLICT; break; + } + } + else + res = CONFLICT; + } + break; + default: break; + } + g_free(url); + g_free(input); + if (res != OK) { + fprintf(stderr, "Error\nCode: %ld\n%s\n", opt->error->code, opt->error->str); + caldav_free_runtime_info(&opt); + caldav_free_response(&result); + return 1; + } + if (result->msg && ACTION != OPTIONS) { + fprintf(stdout, "%s", result->msg); + gchar* endline = strrchr(result->msg, '\n'); + if (endline) { + if (strlen(endline) != 1) + fprintf(stdout, "\n"); + } + else + fprintf(stdout, "\n"); + } + else if (ACTION == OPTIONS) { + char** tmp = options; + while (*options) { + fprintf(stdout, "%s\n", *options++); + } + g_strfreev(tmp); + } + else if (ACTION == GET || ACTION == GETALL || ACTION == GETCALNAME || ACTION == FREEBUSY) { + fprintf(stdout, "empty collection\n"); + } + fprintf(stdout, "OK\n"); + caldav_free_response(&result); + caldav_free_runtime_info(&opt); + return 0; +} |