projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
izmjene za lintian
[ossec-hids.git]
/
src
/
shared
/
dirtree_op.c
diff --git
a/src/shared/dirtree_op.c
b/src/shared/dirtree_op.c
index
5d469b5
..
47adbb4
100755
(executable)
--- a/
src/shared/dirtree_op.c
+++ b/
src/shared/dirtree_op.c
@@
-1,25
+1,26
@@
-/* @(#) $Id: dirtree_op.c,v 1.4 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id: ./src/shared/dirtree_op.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
* online at: http://www.ossec.net/en/licensing.html
*/
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
* online at: http://www.ossec.net/en/licensing.html
*/
-
-/* Common API for dealing with directory trees */
+
+/* Common API for dealing with directory trees */
#include "shared.h"
#include "shared.h"
-/* Create the tree
+/* Create the tree
* Return NULL on error
*/
OSDirTree *OSDirTree_Create()
* Return NULL on error
*/
OSDirTree *OSDirTree_Create()
@@
-31,16
+32,16
@@
OSDirTree *OSDirTree_Create()
{
return(NULL);
}
{
return(NULL);
}
-
+
my_tree->first_node = NULL;
my_tree->last_node = NULL;
my_tree->first_node = NULL;
my_tree->last_node = NULL;
-
+
return(my_tree);
}
return(my_tree);
}
-/* Get first node from tree (starting from parent)
+/* Get first node from tree (starting from parent)
* Returns null on invalid tree (not initialized)
*/
OSTreeNode *OSDirTree_GetFirstNode(OSDirTree *tree)
* Returns null on invalid tree (not initialized)
*/
OSTreeNode *OSDirTree_GetFirstNode(OSDirTree *tree)
@@
-54,7
+55,7
@@
OSTreeNode *OSDirTree_GetFirstNode(OSDirTree *tree)
* Internal call, looks up for an entry in the middle of the tree.
* Should not be called directly.
*/
* Internal call, looks up for an entry in the middle of the tree.
* Should not be called directly.
*/
-OSDirTree *_OSTreeNode_Add(OSDirTree *tree, char *str,
+OSDirTree *_OSTreeNode_Add(OSDirTree *tree, char *str,
void *data, char sep)
{
char *tmp_str;
void *data, char sep)
{
char *tmp_str;
@@
-82,7
+83,7
@@
OSDirTree *_OSTreeNode_Add(OSDirTree *tree, char *str,
tree->first_node = NULL;
tree->last_node = NULL;
}
tree->first_node = NULL;
tree->last_node = NULL;
}
-
+
curnode = tree->first_node;
curnode = tree->first_node;
@@
-108,7
+109,7
@@
OSDirTree *_OSTreeNode_Add(OSDirTree *tree, char *str,
{
os_calloc(1, sizeof(OSTreeNode), newnode);
//printf("XXXX Adding node: %s\n", str);
{
os_calloc(1, sizeof(OSTreeNode), newnode);
//printf("XXXX Adding node: %s\n", str);
-
+
if(!tree->first_node && !tree->last_node)
{
if(!tree->first_node && !tree->last_node)
{
@@
-146,11
+147,11
@@
OSDirTree *_OSTreeNode_Add(OSDirTree *tree, char *str,
{
*tmp_str = sep;
}
{
*tmp_str = sep;
}
-
+
return(tree);
}
return(tree);
}
-
+
/** void OSDirTree_AddToTree
/** void OSDirTree_AddToTree
@@
-168,16
+169,16
@@
void OSDirTree_AddToTree(OSDirTree *tree, char *str, void *data, char sep)
char *tmp_str;
OSTreeNode *newnode;
OSTreeNode *curnode;
char *tmp_str;
OSTreeNode *newnode;
OSTreeNode *curnode;
-
-
+
+
/* First character doesn't count as a separator */
tmp_str = strchr(str +1, sep);
if(tmp_str)
{
*tmp_str = '\0';
}
/* First character doesn't count as a separator */
tmp_str = strchr(str +1, sep);
if(tmp_str)
{
*tmp_str = '\0';
}
-
-
+
+
curnode = tree->first_node;
while(curnode)
{
curnode = tree->first_node;
while(curnode)
{
@@
-186,7
+187,7
@@
void OSDirTree_AddToTree(OSDirTree *tree, char *str, void *data, char sep)
/* If we have other elements, keep going */
if(tmp_str)
{
/* If we have other elements, keep going */
if(tmp_str)
{
- curnode->child = _OSTreeNode_Add(curnode->child,
+ curnode->child = _OSTreeNode_Add(curnode->child,
tmp_str +1, data, sep);
}
break;
tmp_str +1, data, sep);
}
break;
@@
-213,7
+214,7
@@
void OSDirTree_AddToTree(OSDirTree *tree, char *str, void *data, char sep)
tree->last_node->next = newnode;
tree->last_node = newnode;
}
tree->last_node->next = newnode;
tree->last_node = newnode;
}
-
+
newnode->next = NULL;
os_strdup(str, newnode->value);
newnode->next = NULL;
os_strdup(str, newnode->value);
@@
-221,7
+222,7
@@
void OSDirTree_AddToTree(OSDirTree *tree, char *str, void *data, char sep)
/* If we have other elements, keep going */
if(tmp_str)
{
/* If we have other elements, keep going */
if(tmp_str)
{
- newnode->child = _OSTreeNode_Add(newnode->child,
+ newnode->child = _OSTreeNode_Add(newnode->child,
tmp_str +1, data, sep);
newnode->data = NULL;
}
tmp_str +1, data, sep);
newnode->data = NULL;
}
@@
-290,7
+291,7
@@
void *OSDirTree_SearchTree(OSDirTree *tree, char *str, char sep)
{
*tmp_str = sep;
}
{
*tmp_str = sep;
}
-
+
return(ret);
}
return(ret);
}