dav/main.c

changeset 182
ca07f14f7bfe
parent 181
a8f8cdbf85df
child 185
cd42cccee550
--- a/dav/main.c	Tue Jan 12 19:17:46 2016 +0100
+++ b/dav/main.c	Wed Jan 13 15:31:10 2016 +0100
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdbool.h>
 #include <errno.h>
 #include <unistd.h>
 #include <time.h>
@@ -170,6 +171,7 @@
     fprintf(stderr, "        -a         show all files\n");
     fprintf(stderr, "        -l         print resources in long list format\n");
     fprintf(stderr, "        -t         print content type\n");
+    fprintf(stderr, "        -O         override resources\n");
     fprintf(stderr, "        -n <uri>   specify namespace uri\n");
     fprintf(stderr, "        -v         verbose output\n");
     fprintf(stderr, "\n");
@@ -947,16 +949,19 @@
         return -1;
     }
     
+    DavBool override = cmd_getoption(a, "override") ? true : false;
+    
     if(repo1 == repo2) {
         DavResource *res = dav_resource_new(sn, path1);
-        int err = cp ? dav_copy(res, path2) : dav_move(res, path2);
+        int err = cp ? dav_copy_o(res, path2, override)
+                     : dav_move_o(res, path2, override);
         if(err) {
             print_resource_error(sn, res->path);
             fprintf(stderr, "Cannot %s resource.\n", cp ? "copy" : "move");
             return -1;
         }
     } else {
-        fprintf(stderr, "Copy or Move not supported for differend hosts.\n");
+        fprintf(stderr, "Copy or Move not supported for different hosts.\n");
         return -1;
     }
     

mercurial