X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=utils%2Fxmlgrep%2Fxmlgrep.c;h=23577b0c8d2415a25343817e413c1dcd33836cf1;hb=224afcc7e4cb4191be15f3df025164fcd83f5102;hp=3ec17fbcb02d1c2d46d6cb7c3696dbc7aaa3fab3;hpb=09adb5ee05ed96c6fa9d8c77e963d09adf57ef03;p=flightgear.git diff --git a/utils/xmlgrep/xmlgrep.c b/utils/xmlgrep/xmlgrep.c index 3ec17fbcb..23577b0c8 100644 --- a/utils/xmlgrep/xmlgrep.c +++ b/utils/xmlgrep/xmlgrep.c @@ -5,12 +5,13 @@ #include #ifndef _MSC_VER # include +# include /* read */ #else # define strncasecmp strnicmp # include +# include #endif #include -#include /* read */ #include /* fstat */ #include /* open */ @@ -212,17 +213,23 @@ void walk_the_tree(size_t num, void *xid, char *tree) { 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\n", _filenames[num], _print, _attribute, _value, value, _print); } + if (value) free(value); } else {