#include <string.h>
#ifndef _MSC_VER
# include <strings.h>
+# include <unistd.h> /* read */
#else
# define strncasecmp strnicmp
# include <stdlib.h>
+# include <io.h>
#endif
#include <assert.h>
-#include <unistd.h> /* read */
#include <sys/stat.h> /* fstat */
#include <fcntl.h> /* open */
{
if (arg == 0) SHOW_NOVAL(opt);
alen = strlen(arg)+1;
+ if (_root) free(_root);
_root = malloc(alen);
memcpy(_root, arg, alen);
return 2;
{
if (arg == 0) SHOW_NOVAL(opt);
alen = strlen(arg)+1;
+ if (_element) free(_element);
_element = malloc(alen);
memcpy(_element, arg, alen);
return 2;
{
if (arg == 0) SHOW_NOVAL(opt);
alen = strlen(arg)+1;
+ if (_value) free(_value);
_value = malloc(alen);
memcpy(_value, arg, alen);
return 2;
{
if (arg == 0) SHOW_NOVAL(opt);
alen = strlen(arg)+1;
+ if (_print) free(_print);
_print = malloc(alen);
memcpy(_print, arg, alen);
return 2;
{
if (arg == 0) SHOW_NOVAL(opt);
alen = strlen(arg)+1;
+ if (_attribute) free(_attribute);
_attribute = malloc(alen);
memcpy(_attribute, arg, alen);
return 2;
{
if (xmlNodeGetPos(xid, xmid, _print, i) != 0)
{
- char value[STRING_LEN];
+ char *value;
- xmlCopyString(xmid, (char *)&value, STRING_LEN);
- if (_value && _attribute)
+ value = xmlGetString(xmid);
+ if (_value && _attribute && value)
{
+#if 1
+ char *a = xmlAttributeGetString(xmid, _attribute);
+ if (a && !strcmp(a, _value))
+#else
if (!xmlAttributeCompareString(xmid, _attribute, _value))
+#endif
{
printf("%s: <%s %s=\"%s\">%s</%s>\n",
_filenames[num], _print, _attribute, _value,
value, _print);
}
+ if (value) free(value);
}
else
{