# HG changeset patch # User Mike Becker # Date 1702821781 -3600 # Node ID d7f5067a27ce6219c06d54f23160f3c6a1bc42bc # Parent edbb20b1438ddf5fcf025bc957e1bb099384029e remove list_repositories() config.c function in favor of a cmd_list_repositories() function in main.c diff -r edbb20b1438d -r d7f5067a27ce dav/config.c --- a/dav/config.c Sun Dec 17 14:25:34 2023 +0100 +++ b/dav/config.c Sun Dec 17 15:03:01 2023 +0100 @@ -228,16 +228,6 @@ return k; } -int list_repositories(void) { - if(!davconfig) { - return 1; - } - for(DavCfgRepository *repo=davconfig->repositories;repo;repo=repo->next) { - printf("%.*s\n", (int)repo->name.value.length, repo->name.value.ptr); - } - return 0; -} - static char* get_attr_content(xmlNode *node) { // TODO: remove code duplication (util_xml_get_text) while(node) { diff -r edbb20b1438d -r d7f5067a27ce dav/config.h --- a/dav/config.h Sun Dec 17 14:25:34 2023 +0100 +++ b/dav/config.h Sun Dec 17 15:03:01 2023 +0100 @@ -59,8 +59,6 @@ cxmutstr load_key_file(const char *filename); -int list_repositories(void); - PwdStore* get_pwdstore(void); int pwdstore_save(PwdStore *pwdstore); diff -r edbb20b1438d -r d7f5067a27ce dav/main.c --- a/dav/main.c Sun Dec 17 14:25:34 2023 +0100 +++ b/dav/main.c Sun Dec 17 15:03:01 2023 +0100 @@ -223,7 +223,7 @@ ret = cmd_remove_repository(args); } else if(!strcasecmp(cmd, "list-repositories") || !strcasecmp(cmd, "list-repos")) { - ret = list_repositories(); + ret = cmd_list_repositories(); } else if(!strcasecmp(cmd, "repository-url") || !strcasecmp(cmd, "repo-url")) { ret = cmd_repository_url(args); @@ -2502,6 +2502,17 @@ } } +int cmd_list_repositories(void) { + DavConfig *config = get_config(); + if(!config) { + return 1; + } + for(DavCfgRepository *repo=config->repositories;repo;repo=repo->next) { + printf("%.*s\n", (int)repo->name.value.length, repo->name.value.ptr); + } + return 0; +} + int cmd_repository_url(CmdArgs *args) { if(args->argc != 1) { fprintf(stderr, "Too few arguments\n"); diff -r edbb20b1438d -r d7f5067a27ce dav/main.h --- a/dav/main.h Sun Dec 17 14:25:34 2023 +0100 +++ b/dav/main.h Sun Dec 17 15:03:01 2023 +0100 @@ -128,6 +128,7 @@ int cmd_add_repository(CmdArgs *args); int cmd_remove_repository(CmdArgs *args); +int cmd_list_repositories(void); int cmd_repository_url(CmdArgs *args);