From: Kern Sibbald Date: Tue, 14 Dec 2010 10:58:42 +0000 (+0100) Subject: Add indentation in lsmark command output X-Git-Tag: Release-7.0.0~1263 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=736a9a7ef2d5e1a88bd88c928e83cdf1413a89af;p=bacula%2Fbacula Add indentation in lsmark command output --- diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index fd6825638a..bba9112667 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -559,14 +559,24 @@ static int dot_lsmarkcmd(UAContext *ua, TREE_CTX *tree) } /* - * Ls command that lists only the marked files + * This recursive ls command that lists only the marked files */ -static void rlsmark(UAContext *ua, TREE_NODE *tnode) +static void rlsmark(UAContext *ua, TREE_NODE *tnode, int level) { TREE_NODE *node; + const int max_level = 100; + char indent[max_level*2+1]; + int i, j; if (!tree_node_has_child(tnode)) { return; } + level = MIN(level, max_level); + j = 0; + for (i=0; iargc == 1 || fnmatch(ua->argk[1], node->fname, 0) == 0) && (node->extract || node->extract_dir)) { @@ -578,9 +588,9 @@ static void rlsmark(UAContext *ua, TREE_NODE *tnode) } else { tag = ""; } - ua->send_msg("%s%s%s\n", tag, node->fname, tree_node_has_child(node)?"/":""); + ua->send_msg("%s%s%s%s\n", indent, tag, node->fname, tree_node_has_child(node)?"/":""); if (tree_node_has_child(node)) { - rlsmark(ua, node); + rlsmark(ua, node, level+1); } } } @@ -588,7 +598,7 @@ static void rlsmark(UAContext *ua, TREE_NODE *tnode) static int lsmarkcmd(UAContext *ua, TREE_CTX *tree) { - rlsmark(ua, tree->node); + rlsmark(ua, tree->node, 0); return 1; }