dav/main.c

changeset 235
0468df02e18f
parent 230
fdcbde1d7d65
child 236
6b4ce32d0c4e
equal deleted inserted replaced
234:33f373b28c8c 235:0468df02e18f
609 609
610 int depth = recursive ? -1 : 1; 610 int depth = recursive ? -1 : 1;
611 for(int i=0;i<2;i++) { 611 for(int i=0;i<2;i++) {
612 res = dav_query( 612 res = dav_query(
613 sn, 613 sn,
614 "select - from %s with depth = %d where lastmodified > %t", 614 "select - from %s with depth = %d where iscollection or lastmodified > %t",
615 path, 615 path,
616 depth, 616 depth,
617 t); 617 t);
618 if(!res && sn->error == DAV_UNAUTHORIZED) { 618 if(!res && sn->error == DAV_UNAUTHORIZED) {
619 if(request_auth(repo, sn, a)) { 619 if(request_auth(repo, sn, a)) {
626 if(!res) { 626 if(!res) {
627 print_resource_error(sn, path); 627 print_resource_error(sn, path);
628 return -1; 628 return -1;
629 } 629 }
630 if(!recursive && res->iscollection) { 630 if(!recursive && res->iscollection) {
631 char *res_url = util_concat_path(sn->base_url, path); 631 fprintf(stderr, "Resource %s is a collection.\n", res->path);
632 fprintf(stderr, "Resource %s is a collection.\n", res_url);
633 fprintf(stderr, "Use the -R option to download collections.\n"); 632 fprintf(stderr, "Use the -R option to download collections.\n");
634 free(res_url);
635 return -1; 633 return -1;
636 } 634 }
637 635
638 /* 636 /*
639 * determine the output file 637 * determine the output file
662 660
663 int get_resource(Repository *repo, DavResource *res, CmdArgs *a, char *out) { 661 int get_resource(Repository *repo, DavResource *res, CmdArgs *a, char *out) {
664 size_t outlen = strlen(out); 662 size_t outlen = strlen(out);
665 // print some status message in recursive mode 663 // print some status message in recursive mode
666 if(cmd_getoption(a, "recursive")) { 664 if(cmd_getoption(a, "recursive")) {
667 char *res_url = util_concat_path(res->session->base_url, res->path); 665 printf("get: %s\n", res->path);
668 printf("get: %s\n", res_url);
669 free(res_url);
670 } 666 }
671 667
672 if(res->iscollection) { 668 if(res->iscollection) {
673 // create directory 669 // create directory
674 if(outlen != 0) { 670 if(outlen != 0) {

mercurial