obrisane nepotrebne datoteke od zadnjeg builda
[ossec-hids.git] / examples / mem_test.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include "os_xml.h"
6
7 int main(int argc, char ** argv)
8 {
9     OS_XML xml;
10     xml_node **node=NULL;
11     int i = 0;
12
13     if(argc < 2)
14     {
15         printf("usage: %s file\n",argv[0]);
16         return(-1);
17     }
18
19     while(1)
20     {
21         usleep(10);
22         printf(".");
23         fflush(stdout);
24
25         if(OS_ReadXML(argv[1],&xml) < 0)
26         {
27             printf("Error reading XML!%s\n",xml.err);
28             return(1);
29         }
30
31         node = OS_GetElementsbyNode(&xml,NULL);
32         if(node == NULL)
33         {
34             printf("error reading xml\n");
35             return(1);
36         }
37
38         i = 0;
39
40         while(node[i])
41         {
42             xml_node **cnode = NULL;
43             int j=0;
44             cnode = OS_GetElementsbyNode(&xml,node[i]);
45             if(cnode == NULL)
46             {
47                 i++;
48                 continue;
49             }
50             while(cnode[j])
51             {
52                 /* */
53                 j++;
54             }
55
56             OS_ClearNode(cnode);
57             i++;
58         }
59
60         OS_ClearNode(node);
61
62         node = NULL;
63
64         OS_ClearXML(&xml);
65     }
66     return(0);
67 }