# HG changeset patch # User Olaf Wintermann # Date 1529828483 -7200 # Node ID ae4d89c3477c85b7a4ddbdfcd4da92ee2d01f816 # Parent f851ba530957542b6a326a95014be58b5d21217e fixes dav list return value diff -r f851ba530957 -r ae4d89c3477c dav/main.c --- a/dav/main.c Sun Jun 24 09:23:00 2018 +0200 +++ b/dav/main.c Sun Jun 24 10:21:23 2018 +0200 @@ -453,7 +453,7 @@ } int depth = cmd_getoption(a, "recursive") ? -1 : 1; - int ret = -1; + int ret = 0; DavResource *ls = dav_query( sn, date ? LIST_QUERY_ORDER_BY_DATE : LIST_QUERY_ORDER_BY_NAME, @@ -476,6 +476,7 @@ } } else { print_resource_error(sn, path); + ret = -1; } free(path); diff -r f851ba530957 -r ae4d89c3477c dav/scfg.c --- a/dav/scfg.c Sun Jun 24 09:23:00 2018 +0200 +++ b/dav/scfg.c Sun Jun 24 10:21:23 2018 +0200 @@ -123,7 +123,7 @@ return 1; } else { // get scope - xmlChar *scope = xmlGetNoNsProp(node, "scope"); + xmlChar *scope = xmlGetNoNsProp(node, BAD_CAST "scope"); if(scope) { if(xstreq(scope, "resource")) { @@ -201,9 +201,9 @@ } xmlAttr *attr = c->properties; - xmlChar *format = xmlGetNoNsProp(node, "format"); + xmlChar *format = xmlGetNoNsProp(node, BAD_CAST "format"); if(format) { - conf.local_format = str2tagformat(format); + conf.local_format = str2tagformat((char*)format); xmlFree(format); } } else if(xstreq(c->name, "detect-changes")) { diff -r f851ba530957 -r ae4d89c3477c dav/system.c --- a/dav/system.c Sun Jun 24 09:23:00 2018 +0200 +++ b/dav/system.c Sun Jun 24 10:21:23 2018 +0200 @@ -268,4 +268,4 @@ return ret; } -#endif \ No newline at end of file +#endif diff -r f851ba530957 -r ae4d89c3477c test/bin-test/test-dav-list.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/test-dav-list.sh Sun Jun 24 10:21:23 2018 +0200 @@ -0,0 +1,56 @@ +#!/bin/sh +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2018 Olaf Wintermann. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ -z "$DAV_BIN" ]; +then + echo "DAV_BIN variable not set" + exit 1 +fi + +# test + +dav list dav-test-repo > /dev/null +if [ $? -ne 0 ]; then + echo "dav list failed" + exit 2 +fi + +OUT=`dav list dav-test-repo/tests/ | wc -l` +if [ $OUT != 9 ]; then + echo "wrong number of output lines" + exit 2 +fi + +OUT=`dav list -lR dav-test-repo/tests/ | wc -l` +if [ $OUT != 19 ]; then + echo "wrong number of output linesin recursive mode" + exit 2 +fi + + diff -r f851ba530957 -r ae4d89c3477c test/bin-test/test-dav.sh --- a/test/bin-test/test-dav.sh Sun Jun 24 09:23:00 2018 +0200 +++ b/test/bin-test/test-dav.sh Sun Jun 24 10:21:23 2018 +0200 @@ -71,4 +71,6 @@ do_test "dav info" test-dav-info.sh do_test "dav mkcol" test-dav-mkcol.sh do_test "dav put" test-dav-put.sh +do_test "dav list" test-dav-list.sh +