From c1926f5ff52d2e10ac6eae39582a44183a5dc1e5 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 17 Aug 2011 10:00:45 +0200 Subject: [PATCH] Add help for "use" command as suggested by Thomas Mueller --- bacula/src/console/console.c | 3 ++- bacula/src/dird/ua_cmds.c | 2 +- bacula/src/dird/ua_dotcmds.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index bdefb0ce17..a5a56064b3 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2010 Free Software Foundation Europe e.V. + Copyright (C) 2000-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -610,6 +610,7 @@ static struct cpl_keywords_t cpl_keywords[] = { {"mark", ".ls" }, {"m", ".ls" }, {"unmark", ".lsmark" }, + {"catalog=", ".catalogs" }, {"actiononpurge=", ".actiononpurge" } }; #define key_size ((int)(sizeof(cpl_keywords)/sizeof(struct cpl_keywords_t))) diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 3f5e75254d..3dd161a259 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -193,7 +193,7 @@ static struct cmdstruct commands[] = { /* C "\n\t pool= recycle= slot=\n\t inchanger=" "\n\t maxvolbytes= maxvolfiles= maxvoljobs=" "\n\t enable= recyclepool= actiononpurge="),true}, - { NT_("use"), use_cmd, _("Use catalog xxx"), NT_(""), false}, + { NT_("use"), use_cmd, _("Use catalog xxx"), NT_("catalog="), false}, { NT_("var"), var_cmd, _("Does variable expansion"), NT_(""), false}, { NT_("version"), version_cmd, _("Print Director version"), NT_(""), true}, { NT_("wait"), wait_cmd, _("Wait until no jobs are running"), diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index 887387e458..2bd5f1f835 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -71,6 +71,7 @@ static bool mediatypescmd(UAContext *ua, const char *cmd); static bool locationscmd(UAContext *ua, const char *cmd); static bool mediacmd(UAContext *ua, const char *cmd); static bool aopcmd(UAContext *ua, const char *cmd); +static bool catalogscmd(UAContext *ua, const char *cmd); static bool dot_bvfs_lsdirs(UAContext *ua, const char *cmd); static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd); @@ -91,6 +92,7 @@ static struct cmdstruct commands[] = { /* help */ /* can be used in runscript * { NT_(".api"), api_cmd, NULL, false}, { NT_(".backups"), backupscmd, NULL, false}, { NT_(".clients"), clientscmd, NULL, true}, + { NT_(".catalogs"), catalogscmd, NULL, false}, { NT_(".defaults"), defaultscmd, NULL, false}, { NT_(".die"), admin_cmds, NULL, false}, { NT_(".dump"), admin_cmds, NULL, false}, @@ -788,6 +790,19 @@ static bool filesetscmd(UAContext *ua, const char *cmd) return true; } +static bool catalogscmd(UAContext *ua, const char *cmd) +{ + CAT *cat; + LockRes(); + foreach_res(cat, R_CATALOG) { + if (acl_access_ok(ua, Catalog_ACL, cat->name())) { + ua->send_msg("%s\n", cat->name()); + } + } + UnlockRes(); + return true; +} + static bool clientscmd(UAContext *ua, const char *cmd) { CLIENT *client; -- 2.39.5