From: Eric Bollengier Date: Mon, 16 Nov 2009 09:59:29 +0000 (+0100) Subject: Add completion for unmark X-Git-Tag: Release-7.0.0~2563^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4c602d930798d77ddbb423538e2cee4a28d5aedf;p=bacula%2Fbacula Add completion for unmark --- diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index c70e2a3558..4d423588c5 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -608,6 +608,7 @@ static struct cpl_keywords_t cpl_keywords[] = { {"cd", ".lsdir" }, {"mark", ".ls" }, {"m", ".ls" }, + {"unmark", ".lsmark" }, {"actiononpurge=", ".actiononpurge" } }; #define key_size ((int)(sizeof(cpl_keywords)/sizeof(struct cpl_keywords_t))) diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index 6c10c749bc..064a9f0cb2 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -68,6 +68,7 @@ static int donecmd(UAContext *ua, TREE_CTX *tree); static int dot_lsdircmd(UAContext *ua, TREE_CTX *tree); static int dot_lscmd(UAContext *ua, TREE_CTX *tree); static int dot_helpcmd(UAContext *ua, TREE_CTX *tree); +static int dot_lsmarkcmd(UAContext *ua, TREE_CTX *tree); struct cmdstruct { const char *key; int (*func)(UAContext *ua, TREE_CTX *tree); const char *help; }; static struct cmdstruct commands[] = { @@ -86,6 +87,7 @@ static struct cmdstruct commands[] = { { NT_(".ls"), dot_lscmd, _("list current directory, wildcards allowed")}, { NT_(".lsdir"), dot_lsdircmd, _("list subdir in current directory, wildcards allowed")}, { NT_("lsmark"), lsmarkcmd, _("list the marked files in and below the cd")}, + { NT_(".lsmark"), dot_lsmarkcmd,_("list the marked files in")}, { NT_("mark"), markcmd, _("mark dir/file to be restored recursively, wildcards allowed")}, { NT_("markdir"), markdircmd, _("mark directory name to be restored (no files)")}, { NT_("pwd"), pwdcmd, _("print current working directory")}, @@ -511,6 +513,24 @@ static int lscmd(UAContext *ua, TREE_CTX *tree) return 1; } +/* + * Ls command that lists only the marked files + */ +static int dot_lsmarkcmd(UAContext *ua, TREE_CTX *tree) +{ + TREE_NODE *node; + if (!tree_node_has_child(tree->node)) { + return 1; + } + foreach_child(node, tree->node) { + if ((ua->argc == 1 || fnmatch(ua->argk[1], node->fname, 0) == 0) && + (node->extract || node->extract_dir)) { + ua->send_msg("%s%s\n", node->fname, tree_node_has_child(node)?"/":""); + } + } + return 1; +} + /* * Ls command that lists only the marked files */