dav/main.c

changeset 182
ca07f14f7bfe
parent 181
a8f8cdbf85df
child 185
cd42cccee550
equal deleted inserted replaced
181:a8f8cdbf85df 182:ca07f14f7bfe
27 */ 27 */
28 28
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <string.h> 31 #include <string.h>
32 #include <stdbool.h>
32 #include <errno.h> 33 #include <errno.h>
33 #include <unistd.h> 34 #include <unistd.h>
34 #include <time.h> 35 #include <time.h>
35 #include <sys/types.h> 36 #include <sys/types.h>
36 #include <ucx/string.h> 37 #include <ucx/string.h>
168 " -u <date> " 169 " -u <date> "
169 "Get resources which are modified since the specified date\n"); 170 "Get resources which are modified since the specified date\n");
170 fprintf(stderr, " -a show all files\n"); 171 fprintf(stderr, " -a show all files\n");
171 fprintf(stderr, " -l print resources in long list format\n"); 172 fprintf(stderr, " -l print resources in long list format\n");
172 fprintf(stderr, " -t print content type\n"); 173 fprintf(stderr, " -t print content type\n");
174 fprintf(stderr, " -O override resources\n");
173 fprintf(stderr, " -n <uri> specify namespace uri\n"); 175 fprintf(stderr, " -n <uri> specify namespace uri\n");
174 fprintf(stderr, " -v verbose output\n"); 176 fprintf(stderr, " -v verbose output\n");
175 fprintf(stderr, "\n"); 177 fprintf(stderr, "\n");
176 fprintf(stderr, 178 fprintf(stderr,
177 "Instead of an url you can pass a repository name " 179 "Instead of an url you can pass a repository name "
945 DavSession *sn = connect_to_repo(repo1); 947 DavSession *sn = connect_to_repo(repo1);
946 if(set_session_config(sn, a)) { 948 if(set_session_config(sn, a)) {
947 return -1; 949 return -1;
948 } 950 }
949 951
952 DavBool override = cmd_getoption(a, "override") ? true : false;
953
950 if(repo1 == repo2) { 954 if(repo1 == repo2) {
951 DavResource *res = dav_resource_new(sn, path1); 955 DavResource *res = dav_resource_new(sn, path1);
952 int err = cp ? dav_copy(res, path2) : dav_move(res, path2); 956 int err = cp ? dav_copy_o(res, path2, override)
957 : dav_move_o(res, path2, override);
953 if(err) { 958 if(err) {
954 print_resource_error(sn, res->path); 959 print_resource_error(sn, res->path);
955 fprintf(stderr, "Cannot %s resource.\n", cp ? "copy" : "move"); 960 fprintf(stderr, "Cannot %s resource.\n", cp ? "copy" : "move");
956 return -1; 961 return -1;
957 } 962 }
958 } else { 963 } else {
959 fprintf(stderr, "Copy or Move not supported for differend hosts.\n"); 964 fprintf(stderr, "Copy or Move not supported for different hosts.\n");
960 return -1; 965 return -1;
961 } 966 }
962 967
963 return 0; 968 return 0;
964 } 969 }

mercurial