adds option to dav get for downloading only the directory structure

Sun, 17 Sep 2017 17:56:02 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 17 Sep 2017 17:56:02 +0200
changeset 309
8a474d2ad209
parent 308
82275f589d8d
child 313
d721250984d0

adds option to dav get for downloading only the directory structure

this is an undocumented feature and may be replaced in the future

dav/main.c file | annotate | diff | comparison | revisions
dav/optparser.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Sun Sep 17 16:36:45 2017 +0200
+++ b/dav/main.c	Sun Sep 17 17:56:02 2017 +0200
@@ -705,12 +705,10 @@
 
 int get_resource(Repository *repo, DavResource *res, CmdArgs *a, char *out) {
     size_t outlen = strlen(out);
-    // print some status message in recursive mode
-    if(cmd_getoption(a, "recursive")) {
-        printf("get: %s\n", res->path);
-    }
     
     if(res->iscollection) {
+        printf("get: %s\n", res->path);
+        
         // create directory
         if(outlen != 0) {
             mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
@@ -735,6 +733,15 @@
         }
         
         return 0;
+    } else if(cmd_getoption(a, "structure")) {
+        // download only directory structure
+        // this is a hidden feature and will be replaced in the future
+        return 0;
+    }
+    
+    // print some status message in recursive mode
+    if(cmd_getoption(a, "recursive")) {
+        printf("get: %s\n", res->path);
     }
      
     FILE *fout = !strcmp(out, "-") ? stdout : fopen(out, "wb");
--- a/dav/optparser.c	Sun Sep 17 16:36:45 2017 +0200
+++ b/dav/optparser.c	Sun Sep 17 17:56:02 2017 +0200
@@ -123,6 +123,11 @@
                         ucx_map_cstr_put(a->options, "extended", NOARG);
                         break;
                     }
+                    case 'S': {
+                        // undocumented hidden feature
+                        ucx_map_cstr_put(a->options, "structure", NOARG);
+                        break;
+                    }
                     case 'o': {
                         if(!option) {
                             option = "output";

mercurial