---
help.c | 7 ++++---
tools.c | 11 +++++++----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/help.c b/help.c
index 5061c48dcdec..24700d05f1d6 100644
--- a/help.c
+++ b/help.c
@@ -5658,12 +5658,15 @@ NULL
char *help_tree[] = {
"tree",
"display radix tree or red-black tree",
-"-t [radix|rbtree] [-r offset] [-[s|S] struct[.member[,member]] -[x|d]]\n
[-o offset] [-p] [-l] [-N] start",
+"[-t {radix|rbtree}] [-l] [-p] [{-s|-S} struct[.member[,member]] [-x|-d]]\n
[-o offset] [-r offset|-N] start",
" This command dumps the contents of a radix tree or a red-black tree.",
" The arguments are as follows:\n",
" -t type The type of tree to dump; the type string can be either ",
" \"radix\" or \"rbtree\", although only the first
two characters",
" are required. If not specified, rbtree is the default type.",
+" -l For red-black trees, dump the tree sorted in linear order
starting",
+" with the leftmost node and progressing to the right. This
option",
+" does not apply to radix trees.",
" -r offset If the \"start\" argument is the address of a data structure
that",
" contains the radix_tree_root or rb_root structure, then this is",
" the offset to that structure member. If the offset is
non-zero,",
@@ -5698,8 +5701,6 @@ char *help_tree[] = {
" indicates \"root/l/r\" means that the node is the right
child",
" of the left child of the root node. For radix trees, the
height",
" and slot index values are shown with respect to the root.",
-" -l Dump the tree sorted in linear order starting with the
leftmost",
-" node and progressing to the right.",
" ",
" The meaning of the \"start\" argument, which can be expressed either
in",
" hexadecimal format or symbolically, depends upon whether the -N option",
diff --git a/tools.c b/tools.c
index cd8947147480..b09e564fd3cc 100644
--- a/tools.c
+++ b/tools.c
@@ -3946,6 +3946,10 @@ cmd_tree()
break;
+ case 'l':
+ td->flags |= TREE_LINEAR_ORDER;
+ break;
+
case 'r':
if (td->flags & TREE_ROOT_OFFSET_ENTERED)
error(FATAL,
@@ -3993,10 +3997,6 @@ cmd_tree()
td->flags |= TREE_POSITION_DISPLAY;
break;
- case 'l':
- td->flags |= TREE_LINEAR_ORDER;
- break;
-
case 'N':
td->flags |= TREE_NODE_POINTER;
break;
@@ -4023,6 +4023,9 @@ cmd_tree()
if (argerrs)
cmd_usage(pc->curcmd, SYNOPSIS);
+ if ((type_flag & RADIXTREE_REQUEST) && (td->flags |= TREE_LINEAR_ORDER))
+ error(INFO, "-l option does not apply for radix trees, ignoring\n");
+
if ((type_flag & RADIXTREE_REQUEST) && (td->flags &
TREE_NODE_OFFSET_ENTERED))
error(FATAL, "-o option is not applicable to radix trees\n");
--
2.17.0