-/* @(#) $Id$ */
+/* @(#) $Id: ./src/os_xml/os_xml_writer.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
/* Internal functions */
int _oswcomment(FILE *fp_in, FILE *fp_out);
-int _WReadElem(FILE *fp_in, FILE *fp_out, int position, int parent,
+int _WReadElem(FILE *fp_in, FILE *fp_out, int position, int parent,
char **node, char *value, int node_pos);
if(c == '\n') /* add new line */
_line++;
-
- return(c);
+
+ return(c);
}
#define FWGETC(fp_in, fp_out) _xml_wfgetc(fp_in, fp_out)
{
int r = 0;
int rwidth = 0;
-
+
fseek(fp_out, 0, SEEK_END);
fprintf(fp_out, "\n");
-
+
/* Printing each node. */
while(nodes[r])
{
if(nodes[r])
fprintf(fp_out, "\n");
}
-
+
/* Printing val. */
r--;
rwidth -=6;
fprintf(fp_out, "%s</%s>\n", newval, nodes[r]);
r--;
-
+
/* Closing each node. */
while(r >= 0)
rwidth -= 3;
}
}
-
+
fclose(fp_in);
fclose(fp_out);
return(0);
-int _WReadElem(FILE *fp_in, FILE *fp_out,
+int _WReadElem(FILE *fp_in, FILE *fp_out,
int position, int parent, char **nodes, char *val, int node_pos)
{
int c;
continue;
}
}
-
-
+
+
/* Real checking */
if(location == -1)
{
continue;
}
}
-
+
/* Looking for the closure */
else if((location == 0) && ((c == _R_CONFE) || (c == ' ')))
_ge = '/';
elem[count -1] = '\0';
}
-
+
/* If we may have more attributes */
if(c == ' ')
{
count = 0;
location = -1;
-
+
memset(elem,'\0',XML_MAXSIZE);
memset(closedelem,'\0',XML_MAXSIZE);
memset(cont,'\0',XML_MAXSIZE);
-
+
if(parent > 0)
{
return(ret_code);
{
count = 0;
location = 1;
- }
+ }
/* Checking position of the node */
}
/* Checking if the element name matches */
- if(node_pos == position &&
+ if(node_pos == position &&
nodes[node_pos] && strcmp(elem, nodes[node_pos]) == 0)
{
node_pos++;
}
}
}
-
+
else if((location == 2) &&(c == _R_CONFE))
{
closedelem[count]='\0';
memset(elem,'\0',XML_MAXSIZE);
memset(closedelem,'\0',XML_MAXSIZE);
memset(cont,'\0',XML_MAXSIZE);
-
+
count = 0;
location = -1;
if(parent > 0)
{
ret_code = 1;
}
-
+
count = 0;
}
}
}
}
}
-
+
if(location == -1)
{
return(ret_code);