fixed return value, limit dumping to level 40
authorChristian Thaeter <ct@pipapo.org>
Tue, 2 Oct 2007 02:17:07 +0000 (04:17 +0200)
committerChristian Thaeter <ct@pipapo.org>
Tue, 2 Oct 2007 02:17:07 +0000 (04:17 +0200)
psplay.c

index bd5ab69..da0d4db 100644 (file)
--- a/psplay.c
+++ b/psplay.c
@@ -458,12 +458,17 @@ psplay_walk (PSplayroot root, PSplay node, psplay_action_t action, int level, vo
   return 1;
 }
 
-psplay_delete_t psplay_print_node (PSplay node, const enum psplay_order_e which, int level, void* data)
+psplay_delete_t
+psplay_print_node (PSplay node, const enum psplay_order_e which, int level, void* data)
 {
-  static char* sp = "                                        ";
-  if (level>40) return;
-
   FILE* fh = data;
+  static char* sp = "                                        ";
+  if (level>40)
+    {
+      if (which == PSPLAY_PREORDER)
+        fprintf (fh, "%s ...\n", sp+40-level);
+      return PSPLAY_CONT;
+    }
 
   switch (which)
     {