src/lib/tree.c
TREE_NODE *make_tree_path(char *path, TREE_ROOT *root)
{
   TREE_NODE *parent, *node;
   char *fname, *p;
   int type = TN_NEWDIR;

   Dmsg1(100, "make_tree_path: %s\n", path);
   if (*path == 0) {
      Dmsg0(100, "make_tree_path: parent=*root*\n");
      return (TREE_NODE *)root;
   }
   p = (char *)last_path_separator(path);           /* get last dir component of path */
   if (p) {
      fname = p + 1;
      *p = 0;                         /* terminate path */
      parent = make_tree_path(path, root);
      *p = '/';                       /* restore full name */
   } else {
      fname = path;
      parent = (TREE_NODE *)root;
      type = TN_DIR_NLS;
   }
   node = search_and_insert_tree_node(fname, type, root, parent);
   return node;
}
/*
 * Ensure that all appropriate nodes for a full path exist in
 *  the tree.
 */
Ensure that all appropriate nodes for a full path exist in
the tree.
Ensure that all appropriate nodes for a full path exist in the tree .
TREE_NODE *make_tree_path(char *path, TREE_ROOT *root)
{
   TREE_NODE *parent, *node;
   char *fname, *p;
   int type = TN_NEWDIR;
   Dmsg1(100, "make_tree_path: %s\n", path);
   if (*path == 0) {
      Dmsg0(100, "make_tree_path: parent=*root*\n");
      return (TREE_NODE *)root;
   }
   p = (char *)last_path_separator(path);           
   if (p) {
      fname = p + 1;
      *p = 0;                         
      parent = make_tree_path(path, root);
      *p = '/';                       
   } else {
      fname = path;
      parent = (TREE_NODE *)root;
      type = TN_DIR_NLS;
   }
   node = search_and_insert_tree_node(fname, type, root, parent);
   return node;
}
TREE_NODE * make_tree_path ( char * path , TREE_ROOT * root ) { TREE_NODE * parent , * node ; char * fname , * p ; int type = TN_NEWDIR ; Dmsg1 ( 100 , " \n " , path ) ; if ( * path == 0 ) { Dmsg0 ( 100 , " \n " ) ; return ( TREE_NODE * ) root ; } p = ( char * ) last_path_separator ( path ) ; if ( p ) { fname = p + 1 ; * p = 0 ; parent = make_tree_path ( path , root ) ; * p = ' ' ; } else { fname = path ; parent = ( TREE_NODE * ) root ; type = TN_DIR_NLS ; } node = search_and_insert_tree_node ( fname , type , root , parent ) ; return node ; }
Ensure that all appropriate nodes for a full path exist in
  the tree.
Ensure that all appropriate nodes for a full path exist in the tree .
/* get last dir component of path */ /* terminate path */ /* restore full name */