255 fprintf(stderr, "sync_get_resource failed for resource: %s\n", res->path); |
255 fprintf(stderr, "sync_get_resource failed for resource: %s\n", res->path); |
256 sync_error++; |
256 sync_error++; |
257 } |
257 } |
258 |
258 |
259 // add every resource from the server to svrres |
259 // add every resource from the server to svrres |
260 // then db-resources only contains resources which are not on the |
260 // then db-resources contains only resources which are not on the |
261 // server |
261 // server |
262 LocalResource *local = ucx_map_cstr_get(db->resources, res->path); |
262 LocalResource *local = ucx_map_cstr_get(db->resources, res->path); |
263 ucx_map_cstr_put(svrres, res->path, local); |
263 ucx_map_cstr_put(svrres, res->path, local); |
264 ucx_map_cstr_remove(db->resources, res->path); |
264 ucx_map_cstr_remove(db->resources, res->path); |
265 |
265 |
1231 if(!path) { |
1231 if(!path) { |
1232 fprintf(stderr, "Abort\n"); |
1232 fprintf(stderr, "Abort\n"); |
1233 return -1; |
1233 return -1; |
1234 } |
1234 } |
1235 |
1235 |
1236 printf("Enter webdav repository name.\n"); |
1236 printf("Specify webdav repository.\n"); |
|
1237 UcxList *repos = get_repositories(); |
|
1238 int i = 0; |
|
1239 UCX_FOREACH(elm, repos) { |
|
1240 Repository *r = elm->data; |
|
1241 printf("%d) %s\n", i, r->name); |
|
1242 i++; |
|
1243 } |
1237 char *repository = assistant_getcfg("repository"); |
1244 char *repository = assistant_getcfg("repository"); |
|
1245 char *reponame = NULL; |
1238 if(!repository) { |
1246 if(!repository) { |
1239 fprintf(stderr, "Abort\n"); |
1247 fprintf(stderr, "Abort\n"); |
1240 return -1; |
1248 return -1; |
1241 } |
1249 } |
1242 if(!get_repository(sstr(repository))) { |
1250 int64_t reponum = 0; |
1243 fprintf(stderr, "Repository %s doesn't exist.\nAbort\n", repository); |
1251 if(util_strtoint(repository, &reponum)) { |
1244 return -1; |
1252 if(reponum < 0) { |
|
1253 fprintf(stderr, "Wrong input.\nAbort\n"); |
|
1254 return -1; |
|
1255 } |
|
1256 UcxList *elm = ucx_list_get(repos, reponum); |
|
1257 if(elm) { |
|
1258 Repository *r = elm->data; |
|
1259 reponame = r->name; |
|
1260 } else { |
|
1261 fprintf(stderr, "Wrong input.\nAbort\n"); |
|
1262 return -1; |
|
1263 } |
|
1264 } else { |
|
1265 if(get_repository(sstr(repository))) { |
|
1266 reponame = repository; |
|
1267 } else { |
|
1268 fprintf(stderr, "Repository %s doesn't exist.\nAbort\n", repository); |
|
1269 return -1; |
|
1270 } |
1245 } |
1271 } |
1246 |
1272 |
1247 printf("Enter collection relative to the repository base url.\n"); |
1273 printf("Enter collection relative to the repository base url.\n"); |
1248 char *collection = assistant_getdefcfg("collection", "/"); |
1274 char *collection = assistant_getdefcfg("collection", "/"); |
1249 |
1275 |