dav/main.c

changeset 384
8bfde5687890
parent 383
bc215bdaf9bc
child 398
26fdeed98cd7
equal deleted inserted replaced
383:bc215bdaf9bc 384:8bfde5687890
179 "info [-pc] <url>", 179 "info [-pc] <url>",
180 "date [url]", 180 "date [url]",
181 NULL 181 NULL
182 }; 182 };
183 183
184 char* find_usage_str(char *cmd) { 184 char* find_usage_str(const char *cmd) {
185 sstr_t c = sstr(cmd); 185 // TODO: use scstr_t after UCX update
186 sstr_t c = sstr((char*)cmd);
186 for(int i=0;;i++) { 187 for(int i=0;;i++) {
187 char *str = cmdusageinfo[i]; 188 char *str = cmdusageinfo[i];
188 if(!str) { 189 if(!str) {
189 break; 190 break;
190 } 191 }
311 312
312 Repository *repo = get_repository(r); 313 Repository *repo = get_repository(r);
313 if(repo) { 314 if(repo) {
314 *path = sstrdup(p).ptr; 315 *path = sstrdup(p).ptr;
315 } else { 316 } else {
317 // TODO: who is responsible for freeing this repository?
318 // how can the callee know, if he has to call free()?
316 repo = calloc(1, sizeof(Repository)); 319 repo = calloc(1, sizeof(Repository));
317 repo->name = strdup(""); 320 repo->name = strdup("");
318 repo->decrypt_content = true; 321 repo->decrypt_content = true;
319 repo->verification = true; 322 repo->verification = true;
320 repo->authmethods = CURLAUTH_BASIC; 323 repo->authmethods = CURLAUTH_BASIC;
1653 return -1; 1656 return -1;
1654 } 1657 }
1655 1658
1656 char *url = a->argv[0]; 1659 char *url = a->argv[0];
1657 char *path = NULL; 1660 char *path = NULL;
1658 Repository *repo = url2repo(url, &path);
1659 DavSession *sn = connect_to_repo(url2repo(url, &path), a); 1661 DavSession *sn = connect_to_repo(url2repo(url, &path), a);
1660 ucx_mempool_reg_destr(sn->mp, path, free); 1662 ucx_mempool_reg_destr(sn->mp, path, free);
1661 if(set_session_config(sn, a)) { 1663 if(set_session_config(sn, a)) {
1662 return -1; 1664 return -1;
1663 } 1665 }

mercurial