diff options
author | 2006-05-06 16:09:30 +0000 | |
---|---|---|
committer | 2006-05-06 16:09:30 +0000 | |
commit | 7d36914fb14b8220ece25c31505be6af24ef6a5b (patch) | |
tree | f0cd4cc84d31d787a23402f6bd024c653429d4d0 /lib/libexpat/examples/elements.c | |
parent | remove a block of duplicated defines, ok marco (diff) | |
download | wireguard-openbsd-7d36914fb14b8220ece25c31505be6af24ef6a5b.tar.xz wireguard-openbsd-7d36914fb14b8220ece25c31505be6af24ef6a5b.zip |
Update to 2.0.0; keep our local changes
ok espie@, djm@
Diffstat (limited to 'lib/libexpat/examples/elements.c')
-rw-r--r-- | lib/libexpat/examples/elements.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/libexpat/examples/elements.c b/lib/libexpat/examples/elements.c index 4ed4da6a346..421a1ce7793 100644 --- a/lib/libexpat/examples/elements.c +++ b/lib/libexpat/examples/elements.c @@ -2,31 +2,48 @@ reads an XML document from standard input and writes a line with the name of each element to standard output indenting child elements by one tab stop more than their parent element. + It must be used with Expat compiled for UTF-8 output. */ #include <stdio.h> #include "expat.h" -static void +#ifdef XML_LARGE_SIZE +#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 +#define XML_FMT_INT_MOD "I64" +#else +#define XML_FMT_INT_MOD "ll" +#endif +#else +#define XML_FMT_INT_MOD "l" +#endif + +static void XMLCALL startElement(void *userData, const char *name, const char **atts) { int i; - int *depthPtr = userData; + int *depthPtr = (int *)userData; for (i = 0; i < *depthPtr; i++) putchar('\t'); puts(name); *depthPtr += 1; } -static void +static void XMLCALL endElement(void *userData, const char *name) { - int *depthPtr = userData; + int *depthPtr = (int *)userData; *depthPtr -= 1; } +#ifdef AMIGA_SHARED_LIB +#include <proto/expat.h> +int +amiga_main(int argc, char *argv[]) +#else int main(int argc, char *argv[]) +#endif { char buf[BUFSIZ]; XML_Parser parser = XML_ParserCreate(NULL); @@ -39,7 +56,7 @@ main(int argc, char *argv[]) done = len < sizeof(buf); if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) { fprintf(stderr, - "%s at line %d\n", + "%s at line %" XML_FMT_INT_MOD "u\n", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); return 1; |