diff options
author | Xin LI <delphij@FreeBSD.org> | 2019-11-25 07:48:16 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2019-11-25 07:48:16 +0000 |
commit | 6b2c1e49da284f28ec7b52f7c031474087e37104 (patch) | |
tree | 1c6eabb549a0be6167f4f25f3e388afa0f730197 /contrib/expat/xmlwf | |
parent | 6a14746c01a91a9f33f67d79565d01d96a879a3a (diff) | |
parent | 987ba809b8add6260181a8c036ec3c017948ff56 (diff) | |
download | src-6b2c1e49da284f28ec7b52f7c031474087e37104.tar.gz src-6b2c1e49da284f28ec7b52f7c031474087e37104.zip |
MFV r355071: libbsdxml (expat) 2.2.9.
MFC after: 2 weeks
Relnotes: yes
Notes
Notes:
svn path=/head/; revision=355085
Diffstat (limited to 'contrib/expat/xmlwf')
-rw-r--r-- | contrib/expat/xmlwf/Makefile.am | 4 | ||||
-rw-r--r-- | contrib/expat/xmlwf/Makefile.in | 57 | ||||
-rw-r--r-- | contrib/expat/xmlwf/codepage.c | 48 | ||||
-rw-r--r-- | contrib/expat/xmlwf/ct.c | 26 | ||||
-rw-r--r-- | contrib/expat/xmlwf/filemap.h | 12 | ||||
-rw-r--r-- | contrib/expat/xmlwf/readfilemap.c | 59 | ||||
-rw-r--r-- | contrib/expat/xmlwf/unixfilemap.c | 17 | ||||
-rw-r--r-- | contrib/expat/xmlwf/win32filemap.c | 35 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlfile.c | 129 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlfile.h | 11 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlmime.c | 38 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmltchar.h | 72 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlwf.c | 404 | ||||
-rwxr-xr-x | contrib/expat/xmlwf/xmlwf_helpgen.py | 69 | ||||
-rwxr-xr-x | contrib/expat/xmlwf/xmlwf_helpgen.sh | 35 |
15 files changed, 543 insertions, 473 deletions
diff --git a/contrib/expat/xmlwf/Makefile.am b/contrib/expat/xmlwf/Makefile.am index ff460902caa0..4b41c2cbdab8 100644 --- a/contrib/expat/xmlwf/Makefile.am +++ b/contrib/expat/xmlwf/Makefile.am @@ -56,6 +56,4 @@ EXTRA_DIST = \ xmlfile.h \ xmlmime.c \ xmlmime.h \ - xmltchar.h \ - xmlurl.h \ - xmlwin32url.cxx + xmltchar.h diff --git a/contrib/expat/xmlwf/Makefile.in b/contrib/expat/xmlwf/Makefile.in index 152bbe97eec3..368d3777431d 100644 --- a/contrib/expat/xmlwf/Makefile.in +++ b/contrib/expat/xmlwf/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -125,7 +125,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/conftools/ax-require-defined.m4 \ + $(top_srcdir)/conftools/ax-check-compile-flag.m4 \ + $(top_srcdir)/conftools/ax-check-link-flag.m4 \ + $(top_srcdir)/conftools/ax-append-flag.m4 \ + $(top_srcdir)/conftools/ax-append-compile-flags.m4 \ + $(top_srcdir)/conftools/ax-append-link-flags.m4 \ + $(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -161,7 +168,10 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/xmlwf-@FILEMAP@.Po \ + ./$(DEPDIR)/xmlwf-codepage.Po ./$(DEPDIR)/xmlwf-xmlfile.Po \ + ./$(DEPDIR)/xmlwf-xmlwf.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -355,9 +365,7 @@ EXTRA_DIST = \ xmlfile.h \ xmlmime.c \ xmlmime.h \ - xmltchar.h \ - xmlurl.h \ - xmlwin32url.cxx + xmltchar.h all: all-am @@ -380,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -452,10 +460,16 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-@FILEMAP@.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-@FILEMAP@.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -592,7 +606,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -664,7 +681,10 @@ clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po + -rm -f ./$(DEPDIR)/xmlwf-codepage.Po + -rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po + -rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -710,7 +730,10 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po + -rm -f ./$(DEPDIR)/xmlwf-codepage.Po + -rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po + -rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -731,7 +754,7 @@ uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ diff --git a/contrib/expat/xmlwf/codepage.c b/contrib/expat/xmlwf/codepage.c index 1a0487ff91d2..1095adf63eb2 100644 --- a/contrib/expat/xmlwf/codepage.c +++ b/contrib/expat/xmlwf/codepage.c @@ -31,25 +31,24 @@ */ #include "codepage.h" -#include "internal.h" /* for UNUSED_P only */ +#include "internal.h" /* for UNUSED_P only */ #if defined(_WIN32) -#define STRICT 1 -#define WIN32_LEAN_AND_MEAN 1 +# define STRICT 1 +# define WIN32_LEAN_AND_MEAN 1 -#include <windows.h> +# include <windows.h> int -codepageMap(int cp, int *map) -{ +codepageMap(int cp, int *map) { int i; CPINFO info; - if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2) + if (! GetCPInfo(cp, &info) || info.MaxCharSize > 2) return 0; for (i = 0; i < 256; i++) map[i] = -1; if (info.MaxCharSize > 1) { - for (i = 0; i < MAX_LEADBYTES; i+=2) { + for (i = 0; i < MAX_LEADBYTES; i += 2) { int j, lim; if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0) break; @@ -59,23 +58,24 @@ codepageMap(int cp, int *map) } } for (i = 0; i < 256; i++) { - if (map[i] == -1) { - char c = (char)i; - unsigned short n; - if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, - &c, 1, &n, 1) == 1) - map[i] = n; - } + if (map[i] == -1) { + char c = (char)i; + unsigned short n; + if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, &c, 1, + &n, 1) + == 1) + map[i] = n; + } } return 1; } int -codepageConvert(int cp, const char *p) -{ +codepageConvert(int cp, const char *p) { unsigned short c; - if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, - p, 2, &c, 1) == 1) + if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, p, 2, &c, + 1) + == 1) return c; return -1; } @@ -83,14 +83,16 @@ codepageConvert(int cp, const char *p) #else /* not _WIN32 */ int -codepageMap(int UNUSED_P(cp), int *UNUSED_P(map)) -{ +codepageMap(int cp, int *map) { + UNUSED_P(cp); + UNUSED_P(map); return 0; } int -codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p)) -{ +codepageConvert(int cp, const char *p) { + UNUSED_P(cp); + UNUSED_P(p); return -1; } diff --git a/contrib/expat/xmlwf/ct.c b/contrib/expat/xmlwf/ct.c index dd42f5ec98d8..dcf92bab568b 100644 --- a/contrib/expat/xmlwf/ct.c +++ b/contrib/expat/xmlwf/ct.c @@ -33,8 +33,7 @@ #define CHARSET_MAX 41 static const char * -getTok(const char **pp) -{ +getTok(const char **pp) { enum { inAtom, inString, init, inComment }; int state = init; const char *tokStart = 0; @@ -102,9 +101,8 @@ getTok(const char **pp) /* key must be lowercase ASCII */ static int -matchkey(const char *start, const char *end, const char *key) -{ - if (!start) +matchkey(const char *start, const char *end, const char *key) { + if (! start) return 0; for (; start != end; start++, key++) if (*start != *key && *start != 'A' + (*key - 'a')) @@ -113,8 +111,7 @@ matchkey(const char *start, const char *end, const char *key) } void -getXMLCharset(const char *buf, char *charset) -{ +getXMLCharset(const char *buf, char *charset) { const char *next, *p; charset[0] = '\0'; @@ -122,10 +119,10 @@ getXMLCharset(const char *buf, char *charset) p = getTok(&next); if (matchkey(p, next, "text")) strcpy(charset, "us-ascii"); - else if (!matchkey(p, next, "application")) + else if (! matchkey(p, next, "application")) return; p = getTok(&next); - if (!p || *p != '/') + if (! p || *p != '/') return; p = getTok(&next); if (matchkey(p, next, "xml")) @@ -151,8 +148,7 @@ getXMLCharset(const char *buf, char *charset) *s++ = *p; } *s++ = '\0'; - } - else { + } else { if (next - p > CHARSET_MAX - 1) break; while (p != next) @@ -163,15 +159,13 @@ getXMLCharset(const char *buf, char *charset) } } } - } - else - p = getTok(&next); + } else + p = getTok(&next); } } int -main(int argc, char **argv) -{ +main(int argc, char **argv) { char buf[CHARSET_MAX]; getXMLCharset(argv[1], buf); printf("charset = \"%s\"\n", buf); diff --git a/contrib/expat/xmlwf/filemap.h b/contrib/expat/xmlwf/filemap.h index 5487a4ebe50b..ef66114422f3 100644 --- a/contrib/expat/xmlwf/filemap.h +++ b/contrib/expat/xmlwf/filemap.h @@ -30,10 +30,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include <limits.h> /* INT_MAX */ +#include <limits.h> /* INT_MAX */ #include <stddef.h> - /* The following limit (for XML_Parse's int len) derives from * this loop in xmparse.c: * @@ -41,17 +40,14 @@ * bufferSize = (int) (2U * (unsigned) bufferSize); * } while (bufferSize < neededSize && bufferSize > 0); */ -#define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1) - +#define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1) #ifdef XML_UNICODE int filemap(const wchar_t *name, - void (*processor)(const void *, size_t, - const wchar_t *, void *arg), + void (*processor)(const void *, size_t, const wchar_t *, void *arg), void *arg); #else int filemap(const char *name, - void (*processor)(const void *, size_t, - const char *, void *arg), + void (*processor)(const void *, size_t, const char *, void *arg), void *arg); #endif diff --git a/contrib/expat/xmlwf/readfilemap.c b/contrib/expat/xmlwf/readfilemap.c index 4c4780bde0e3..d5b84f995ad4 100644 --- a/contrib/expat/xmlwf/readfilemap.c +++ b/contrib/expat/xmlwf/readfilemap.c @@ -37,40 +37,40 @@ #include <stdio.h> /* Functions close(2) and read(2) */ -#if !defined(_WIN32) && !defined(_WIN64) -# include <unistd.h> +#if ! defined(_WIN32) && ! defined(_WIN64) +# include <unistd.h> #endif /* Function "read": */ #if defined(_MSC_VER) -# include <io.h> - /* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */ -# define _EXPAT_read _read -# define _EXPAT_read_count_t int -# define _EXPAT_read_req_t unsigned int -#else /* POSIX */ - /* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */ -# define _EXPAT_read read -# define _EXPAT_read_count_t ssize_t -# define _EXPAT_read_req_t size_t +# include <io.h> +/* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */ +# define _EXPAT_read _read +# define _EXPAT_read_count_t int +# define _EXPAT_read_req_t unsigned int +#else /* POSIX */ +/* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */ +# define _EXPAT_read read +# define _EXPAT_read_count_t ssize_t +# define _EXPAT_read_req_t size_t #endif #ifndef S_ISREG -# ifndef S_IFREG -# define S_IFREG _S_IFREG -# endif -# ifndef S_IFMT -# define S_IFMT _S_IFMT -# endif -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# ifndef S_IFREG +# define S_IFREG _S_IFREG +# endif +# ifndef S_IFMT +# define S_IFMT _S_IFMT +# endif +# define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) #endif /* not S_ISREG */ #ifndef O_BINARY -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif +# ifdef _O_BINARY +# define O_BINARY _O_BINARY +# else +# define O_BINARY 0 +# endif #endif #include "xmltchar.h" @@ -79,15 +79,14 @@ int filemap(const tchar *name, void (*processor)(const void *, size_t, const tchar *, void *arg), - void *arg) -{ + void *arg) { size_t nbytes; int fd; _EXPAT_read_count_t n; struct stat sb; void *p; - fd = topen(name, O_RDONLY|O_BINARY); + fd = topen(name, O_RDONLY | O_BINARY); if (fd < 0) { tperror(name); return 0; @@ -97,14 +96,14 @@ filemap(const tchar *name, close(fd); return 0; } - if (!S_ISREG(sb.st_mode)) { + if (! S_ISREG(sb.st_mode)) { ftprintf(stderr, T("%s: not a regular file\n"), name); close(fd); return 0; } if (sb.st_size > XML_MAX_CHUNK_LEN) { close(fd); - return 2; /* Cannot be passed to XML_Parse in one go */ + return 2; /* Cannot be passed to XML_Parse in one go */ } nbytes = sb.st_size; @@ -116,7 +115,7 @@ filemap(const tchar *name, return 1; } p = malloc(nbytes); - if (!p) { + if (! p) { ftprintf(stderr, T("%s: out of memory\n"), name); close(fd); return 0; diff --git a/contrib/expat/xmlwf/unixfilemap.c b/contrib/expat/xmlwf/unixfilemap.c index 4ab757c2ab9c..0d0dc0424dc0 100644 --- a/contrib/expat/xmlwf/unixfilemap.c +++ b/contrib/expat/xmlwf/unixfilemap.c @@ -40,23 +40,22 @@ #include <unistd.h> #ifndef MAP_FILE -#define MAP_FILE 0 +# define MAP_FILE 0 #endif #include "xmltchar.h" #include "filemap.h" #ifdef XML_UNICODE_WCHAR_T -# define XML_FMT_STR "ls" +# define XML_FMT_STR "ls" #else -# define XML_FMT_STR "s" +# define XML_FMT_STR "s" #endif int filemap(const tchar *name, void (*processor)(const void *, size_t, const tchar *, void *arg), - void *arg) -{ + void *arg) { int fd; size_t nbytes; struct stat sb; @@ -72,14 +71,14 @@ filemap(const tchar *name, close(fd); return 0; } - if (!S_ISREG(sb.st_mode)) { + if (! S_ISREG(sb.st_mode)) { close(fd); fprintf(stderr, "%" XML_FMT_STR ": not a regular file\n", name); return 0; } if (sb.st_size > XML_MAX_CHUNK_LEN) { close(fd); - return 2; /* Cannot be passed to XML_Parse in one go */ + return 2; /* Cannot be passed to XML_Parse in one go */ } nbytes = sb.st_size; @@ -90,8 +89,8 @@ filemap(const tchar *name, close(fd); return 1; } - p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, - MAP_FILE|MAP_PRIVATE, fd, (off_t)0); + p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, MAP_FILE | MAP_PRIVATE, + fd, (off_t)0); if (p == (void *)-1) { tperror(name); close(fd); diff --git a/contrib/expat/xmlwf/win32filemap.c b/contrib/expat/xmlwf/win32filemap.c index a040a097db4c..0c9b7ecc5ffb 100644 --- a/contrib/expat/xmlwf/win32filemap.c +++ b/contrib/expat/xmlwf/win32filemap.c @@ -34,14 +34,14 @@ #define WIN32_LEAN_AND_MEAN 1 #ifdef XML_UNICODE_WCHAR_T -# ifndef XML_UNICODE -# define XML_UNICODE -# endif +# ifndef XML_UNICODE +# define XML_UNICODE +# endif #endif #ifdef XML_UNICODE -# define UNICODE -# define _UNICODE +# define UNICODE +# define _UNICODE #endif /* XML_UNICODE */ #include <windows.h> #include <stdio.h> @@ -53,8 +53,7 @@ static void win32perror(const TCHAR *); int filemap(const TCHAR *name, void (*processor)(const void *, size_t, const TCHAR *, void *arg), - void *arg) -{ + void *arg) { HANDLE f; HANDLE m; DWORD size; @@ -62,7 +61,7 @@ filemap(const TCHAR *name, void *p; f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_FLAG_SEQUENTIAL_SCAN, NULL); + FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (f == INVALID_HANDLE_VALUE) { win32perror(name); return 0; @@ -75,7 +74,7 @@ filemap(const TCHAR *name, } if (sizeHi || (size > XML_MAX_CHUNK_LEN)) { CloseHandle(f); - return 2; /* Cannot be passed to XML_Parse in one go */ + return 2; /* Cannot be passed to XML_Parse in one go */ } /* CreateFileMapping barfs on zero length files */ if (size == 0) { @@ -97,7 +96,7 @@ filemap(const TCHAR *name, CloseHandle(f); return 0; } - processor(p, size, name, arg); + processor(p, size, name, arg); UnmapViewOfFile(p); CloseHandle(m); CloseHandle(f); @@ -105,21 +104,15 @@ filemap(const TCHAR *name, } static void -win32perror(const TCHAR *s) -{ +win32perror(const TCHAR *s) { LPVOID buf; - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buf, - 0, + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL)) { _ftprintf(stderr, _T("%s: %s"), s, buf); fflush(stderr); LocalFree(buf); - } - else + } else _ftprintf(stderr, _T("%s: unknown Windows error\n"), s); } diff --git a/contrib/expat/xmlwf/xmlfile.c b/contrib/expat/xmlwf/xmlfile.c index 4075f5710cad..922e18b0b7e2 100644 --- a/contrib/expat/xmlwf/xmlfile.c +++ b/contrib/expat/xmlwf/xmlfile.c @@ -37,87 +37,77 @@ #include <fcntl.h> #ifdef _WIN32 -#include "winconfig.h" +# include "winconfig.h" #elif defined(HAVE_EXPAT_CONFIG_H) -#include <expat_config.h> +# include <expat_config.h> #endif /* ndef _WIN32 */ #include "expat.h" -#include "internal.h" /* for UNUSED_P only */ +#include "internal.h" /* for UNUSED_P only */ #include "xmlfile.h" #include "xmltchar.h" #include "filemap.h" #if defined(_MSC_VER) -#include <io.h> +# include <io.h> #endif #ifdef HAVE_UNISTD_H -#include <unistd.h> +# include <unistd.h> #endif #ifndef O_BINARY -#ifdef _O_BINARY -#define O_BINARY _O_BINARY -#else -#define O_BINARY 0 -#endif +# ifdef _O_BINARY +# define O_BINARY _O_BINARY +# else +# define O_BINARY 0 +# endif #endif #ifdef _DEBUG -#define READ_SIZE 16 +# define READ_SIZE 16 #else -#define READ_SIZE (1024*8) +# define READ_SIZE (1024 * 8) #endif - typedef struct { XML_Parser parser; int *retPtr; } PROCESS_ARGS; -static int -processStream(const XML_Char *filename, XML_Parser parser); +static int processStream(const XML_Char *filename, XML_Parser parser); static void -reportError(XML_Parser parser, const XML_Char *filename) -{ +reportError(XML_Parser parser, const XML_Char *filename) { enum XML_Error code = XML_GetErrorCode(parser); const XML_Char *message = XML_ErrorString(code); if (message) ftprintf(stdout, - T("%s") - T(":%") T(XML_FMT_INT_MOD) T("u") - T(":%") T(XML_FMT_INT_MOD) T("u") - T(": %s\n"), - filename, - XML_GetErrorLineNumber(parser), - XML_GetErrorColumnNumber(parser), - message); + T("%s") T(":%") T(XML_FMT_INT_MOD) T("u") T(":%") + T(XML_FMT_INT_MOD) T("u") T(": %s\n"), + filename, XML_GetErrorLineNumber(parser), + XML_GetErrorColumnNumber(parser), message); else ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); } - + /* This implementation will give problems on files larger than INT_MAX. */ static void -processFile(const void *data, size_t size, - const XML_Char *filename, void *args) -{ +processFile(const void *data, size_t size, const XML_Char *filename, + void *args) { XML_Parser parser = ((PROCESS_ARGS *)args)->parser; int *retPtr = ((PROCESS_ARGS *)args)->retPtr; if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) { reportError(parser, filename); *retPtr = 0; - } - else + } else *retPtr = 1; } #if defined(_WIN32) static int -isAsciiLetter(XML_Char c) -{ +isAsciiLetter(XML_Char c) { return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); } @@ -125,21 +115,19 @@ isAsciiLetter(XML_Char c) static const XML_Char * resolveSystemId(const XML_Char *base, const XML_Char *systemId, - XML_Char **toFree) -{ + XML_Char **toFree) { XML_Char *s; *toFree = 0; - if (!base - || *systemId == T('/') + if (! base || *systemId == T('/') #if defined(_WIN32) || *systemId == T('\\') || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) #endif - ) + ) return systemId; *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2) * sizeof(XML_Char)); - if (!*toFree) + if (! *toFree) return systemId; tcscpy(*toFree, base); s = *toFree; @@ -154,18 +142,16 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId, } static int -externalEntityRefFilemap(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *UNUSED_P(publicId)) -{ +externalEntityRefFilemap(XML_Parser parser, const XML_Char *context, + const XML_Char *base, const XML_Char *systemId, + const XML_Char *publicId) { int result; XML_Char *s; const XML_Char *filename; XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); int filemapRes; PROCESS_ARGS args; + UNUSED_P(publicId); args.retPtr = &result; args.parser = entParser; filename = resolveSystemId(base, systemId, &s); @@ -176,8 +162,10 @@ externalEntityRefFilemap(XML_Parser parser, result = 0; break; case 2: - ftprintf(stderr, T("%s: file too large for memory-mapping") - T(", switching to streaming\n"), filename); + ftprintf(stderr, + T("%s: file too large for memory-mapping") + T(", switching to streaming\n"), + filename); result = processStream(filename, entParser); break; } @@ -187,13 +175,12 @@ externalEntityRefFilemap(XML_Parser parser, } static int -processStream(const XML_Char *filename, XML_Parser parser) -{ +processStream(const XML_Char *filename, XML_Parser parser) { /* passing NULL for filename means read intput from stdin */ - int fd = 0; /* 0 is the fileno for stdin */ + int fd = 0; /* 0 is the fileno for stdin */ if (filename != NULL) { - fd = topen(filename, O_BINARY|O_RDONLY); + fd = topen(filename, O_BINARY | O_RDONLY); if (fd < 0) { tperror(filename); return 0; @@ -202,7 +189,7 @@ processStream(const XML_Char *filename, XML_Parser parser) for (;;) { int nread; char *buf = (char *)XML_GetBuffer(parser, READ_SIZE); - if (!buf) { + if (! buf) { if (filename != NULL) close(fd); ftprintf(stderr, T("%s: out of memory\n"), @@ -217,7 +204,7 @@ processStream(const XML_Char *filename, XML_Parser parser) return 0; } if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) { - reportError(parser, filename != NULL ? filename : T("STDIN")); + reportError(parser, filename != NULL ? filename : T("STDIN")); if (filename != NULL) close(fd); return 0; @@ -225,23 +212,22 @@ processStream(const XML_Char *filename, XML_Parser parser) if (nread == 0) { if (filename != NULL) close(fd); - break;; + break; + ; } } return 1; } static int -externalEntityRefStream(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *UNUSED_P(publicId)) -{ +externalEntityRefStream(XML_Parser parser, const XML_Char *context, + const XML_Char *base, const XML_Char *systemId, + const XML_Char *publicId) { XML_Char *s; const XML_Char *filename; int ret; XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); + UNUSED_P(publicId); filename = resolveSystemId(base, systemId, &s); XML_SetBase(entParser, filename); ret = processStream(filename, entParser); @@ -251,22 +237,18 @@ externalEntityRefStream(XML_Parser parser, } int -XML_ProcessFile(XML_Parser parser, - const XML_Char *filename, - unsigned flags) -{ +XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags) { int result; - if (!XML_SetBase(parser, filename)) { + if (! XML_SetBase(parser, filename)) { ftprintf(stderr, T("%s: out of memory"), filename); exit(1); } if (flags & XML_EXTERNAL_ENTITIES) - XML_SetExternalEntityRefHandler(parser, - (flags & XML_MAP_FILE) - ? externalEntityRefFilemap - : externalEntityRefStream); + XML_SetExternalEntityRefHandler(parser, (flags & XML_MAP_FILE) + ? externalEntityRefFilemap + : externalEntityRefStream); if (flags & XML_MAP_FILE) { int filemapRes; PROCESS_ARGS args; @@ -278,13 +260,14 @@ XML_ProcessFile(XML_Parser parser, result = 0; break; case 2: - ftprintf(stderr, T("%s: file too large for memory-mapping") - T(", switching to streaming\n"), filename); + ftprintf(stderr, + T("%s: file too large for memory-mapping") + T(", switching to streaming\n"), + filename); result = processStream(filename, parser); break; } - } - else + } else result = processStream(filename, parser); return result; } diff --git a/contrib/expat/xmlwf/xmlfile.h b/contrib/expat/xmlwf/xmlfile.h index c47ea2cf5947..6e5d5b49eb78 100644 --- a/contrib/expat/xmlwf/xmlfile.h +++ b/contrib/expat/xmlwf/xmlfile.h @@ -34,15 +34,10 @@ #define XML_EXTERNAL_ENTITIES 02 #ifdef XML_LARGE_SIZE -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -#define XML_FMT_INT_MOD "I64" +# define XML_FMT_INT_MOD "ll" #else -#define XML_FMT_INT_MOD "ll" -#endif -#else -#define XML_FMT_INT_MOD "l" +# define XML_FMT_INT_MOD "l" #endif -extern int XML_ProcessFile(XML_Parser parser, - const XML_Char *filename, +extern int XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags); diff --git a/contrib/expat/xmlwf/xmlmime.c b/contrib/expat/xmlwf/xmlmime.c index c530979060f4..39160d7198ce 100644 --- a/contrib/expat/xmlwf/xmlmime.c +++ b/contrib/expat/xmlwf/xmlmime.c @@ -34,8 +34,7 @@ #include "xmlmime.h" static const char * -getTok(const char **pp) -{ +getTok(const char **pp) { /* inComment means one level of nesting; inComment+1 means two levels etc */ enum { inAtom, inString, init, inComment }; int state = init; @@ -106,9 +105,8 @@ getTok(const char **pp) /* key must be lowercase ASCII */ static int -matchkey(const char *start, const char *end, const char *key) -{ - if (!start) +matchkey(const char *start, const char *end, const char *key) { + if (! start) return 0; for (; start != end; start++, key++) if (*start != *key && *start != 'A' + (*key - 'a')) @@ -117,8 +115,7 @@ matchkey(const char *start, const char *end, const char *key) } void -getXMLCharset(const char *buf, char *charset) -{ +getXMLCharset(const char *buf, char *charset) { const char *next, *p; charset[0] = '\0'; @@ -126,16 +123,18 @@ getXMLCharset(const char *buf, char *charset) p = getTok(&next); if (matchkey(p, next, "text")) strcpy(charset, "us-ascii"); - else if (!matchkey(p, next, "application")) + else if (! matchkey(p, next, "application")) return; p = getTok(&next); - if (!p || *p != '/') + if (! p || *p != '/') return; p = getTok(&next); -#if 0 - if (!matchkey(p, next, "xml") && charset[0] == '\0') - return; -#endif + /* BEGIN disabled code */ + if (0) { + if (! matchkey(p, next, "xml") && charset[0] == '\0') + return; + } + /* END disabled code */ p = getTok(&next); while (p) { if (*p == ';') { @@ -157,8 +156,7 @@ getXMLCharset(const char *buf, char *charset) *s++ = *p; } *s++ = '\0'; - } - else { + } else { if (next - p > CHARSET_MAX - 1) break; while (p != next) @@ -170,19 +168,17 @@ getXMLCharset(const char *buf, char *charset) } break; } - } - else - p = getTok(&next); + } else + p = getTok(&next); } } #ifdef TEST -#include <stdio.h> +# include <stdio.h> int -main(int argc, char *argv[]) -{ +main(int argc, char *argv[]) { char buf[CHARSET_MAX]; if (argc <= 1) return 1; diff --git a/contrib/expat/xmlwf/xmltchar.h b/contrib/expat/xmlwf/xmltchar.h index cdfaea79552f..d7e7b411b44b 100644 --- a/contrib/expat/xmlwf/xmltchar.h +++ b/contrib/expat/xmlwf/xmltchar.h @@ -34,41 +34,41 @@ #include "expat_external.h" #ifdef XML_UNICODE -# ifndef XML_UNICODE_WCHAR_T -# error xmlwf requires a 16-bit Unicode-compatible wchar_t -# endif -# define _PREPEND_BIG_L(x) L ## x -# define T(x) _PREPEND_BIG_L(x) -# define ftprintf fwprintf -# define tfopen _wfopen -# define fputts fputws -# define puttc putwc -# define tcscmp wcscmp -# define tcscpy wcscpy -# define tcscat wcscat -# define tcschr wcschr -# define tcsrchr wcsrchr -# define tcslen wcslen -# define tperror _wperror -# define topen _wopen -# define tmain wmain -# define tremove _wremove -# define tchar wchar_t +# ifndef XML_UNICODE_WCHAR_T +# error xmlwf requires a 16-bit Unicode-compatible wchar_t +# endif +# define _PREPEND_BIG_L(x) L##x +# define T(x) _PREPEND_BIG_L(x) +# define ftprintf fwprintf +# define tfopen _wfopen +# define fputts fputws +# define puttc putwc +# define tcscmp wcscmp +# define tcscpy wcscpy +# define tcscat wcscat +# define tcschr wcschr +# define tcsrchr wcsrchr +# define tcslen wcslen +# define tperror _wperror +# define topen _wopen +# define tmain wmain +# define tremove _wremove +# define tchar wchar_t #else /* not XML_UNICODE */ -# define T(x) x -# define ftprintf fprintf -# define tfopen fopen -# define fputts fputs -# define puttc putc -# define tcscmp strcmp -# define tcscpy strcpy -# define tcscat strcat -# define tcschr strchr -# define tcsrchr strrchr -# define tcslen strlen -# define tperror perror -# define topen open -# define tmain main -# define tremove remove -# define tchar char +# define T(x) x +# define ftprintf fprintf +# define tfopen fopen +# define fputts fputs +# define puttc putc +# define tcscmp strcmp +# define tcscpy strcpy +# define tcscat strcat +# define tcschr strchr +# define tcsrchr strrchr +# define tcslen strlen +# define tperror perror +# define topen open +# define tmain main +# define tremove remove +# define tchar char #endif /* not XML_UNICODE */ diff --git a/contrib/expat/xmlwf/xmlwf.c b/contrib/expat/xmlwf/xmlwf.c index 82d028ea56fd..2d5a87e7d99d 100644 --- a/contrib/expat/xmlwf/xmlwf.c +++ b/contrib/expat/xmlwf/xmlwf.c @@ -38,16 +38,16 @@ #include "expat.h" #include "codepage.h" -#include "internal.h" /* for UNUSED_P only */ +#include "internal.h" /* for UNUSED_P only */ #include "xmlfile.h" #include "xmltchar.h" #ifdef _MSC_VER -# include <crtdbg.h> +# include <crtdbg.h> #endif #ifdef XML_UNICODE -# include <wchar.h> +# include <wchar.h> #endif /* Structures for handler user data */ @@ -64,14 +64,12 @@ typedef struct xmlwfUserData { const XML_Char *currentDoctypeName; } XmlwfUserData; - /* This ensures proper sorting. */ #define NSSEP T('\001') static void XMLCALL -characterData(void *userData, const XML_Char *s, int len) -{ +characterData(void *userData, const XML_Char *s, int len) { FILE *fp = ((XmlwfUserData *)userData)->fp; for (; len > 0; --len, ++s) { switch (*s) { @@ -106,8 +104,7 @@ characterData(void *userData, const XML_Char *s, int len) } static void -attributeValue(FILE *fp, const XML_Char *s) -{ +attributeValue(FILE *fp, const XML_Char *s) { puttc(T('='), fp); puttc(T('"'), fp); assert(s); @@ -158,14 +155,12 @@ attributeValue(FILE *fp, const XML_Char *s) is equivalent to lexicographically comparing based on the character number. */ static int -attcmp(const void *att1, const void *att2) -{ +attcmp(const void *att1, const void *att2) { return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); } static void XMLCALL -startElement(void *userData, const XML_Char *name, const XML_Char **atts) -{ +startElement(void *userData, const XML_Char *name, const XML_Char **atts) { int nAtts; const XML_Char **p; FILE *fp = ((XmlwfUserData *)userData)->fp; @@ -188,8 +183,7 @@ startElement(void *userData, const XML_Char *name, const XML_Char **atts) } static void XMLCALL -endElement(void *userData, const XML_Char *name) -{ +endElement(void *userData, const XML_Char *name) { FILE *fp = ((XmlwfUserData *)userData)->fp; puttc(T('<'), fp); puttc(T('/'), fp); @@ -198,8 +192,7 @@ endElement(void *userData, const XML_Char *name) } static int -nsattcmp(const void *p1, const void *p2) -{ +nsattcmp(const void *p1, const void *p2) { const XML_Char *att1 = *(const XML_Char **)p1; const XML_Char *att2 = *(const XML_Char **)p2; int sep1 = (tcsrchr(att1, NSSEP) != 0); @@ -210,8 +203,7 @@ nsattcmp(const void *p1, const void *p2) } static void XMLCALL -startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) -{ +startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) { int nAtts; int nsi; const XML_Char **p; @@ -226,8 +218,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) fputts(T(" xmlns:n1"), fp); attributeValue(fp, name); nsi = 2; - } - else { + } else { fputts(name, fp); nsi = 1; } @@ -245,8 +236,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) if (sep) { ftprintf(fp, T("n%d:"), nsi); fputts(sep + 1, fp); - } - else + } else fputts(name, fp); attributeValue(fp, *atts); if (sep) { @@ -259,8 +249,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) } static void XMLCALL -endElementNS(void *userData, const XML_Char *name) -{ +endElementNS(void *userData, const XML_Char *name) { FILE *fp = ((XmlwfUserData *)userData)->fp; const XML_Char *sep; puttc(T('<'), fp); @@ -269,8 +258,7 @@ endElementNS(void *userData, const XML_Char *name) if (sep) { fputts(T("n1:"), fp); fputts(sep + 1, fp); - } - else + } else fputts(name, fp); puttc(T('>'), fp); } @@ -279,8 +267,7 @@ endElementNS(void *userData, const XML_Char *name) static void XMLCALL processingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ + const XML_Char *data) { FILE *fp = ((XmlwfUserData *)userData)->fp; puttc(T('<'), fp); puttc(T('?'), fp); @@ -291,9 +278,8 @@ processingInstruction(void *userData, const XML_Char *target, puttc(T('>'), fp); } - -static XML_Char *xcsdup(const XML_Char *s) -{ +static XML_Char * +xcsdup(const XML_Char *s) { XML_Char *result; int count = 0; int numBytes; @@ -311,19 +297,18 @@ static XML_Char *xcsdup(const XML_Char *s) } static void XMLCALL -startDoctypeDecl(void *userData, - const XML_Char *doctypeName, - const XML_Char *UNUSED_P(sysid), - const XML_Char *UNUSED_P(publid), - int UNUSED_P(has_internal_subset)) -{ +startDoctypeDecl(void *userData, const XML_Char *doctypeName, + const XML_Char *sysid, const XML_Char *publid, + int has_internal_subset) { XmlwfUserData *data = (XmlwfUserData *)userData; + UNUSED_P(sysid); + UNUSED_P(publid); + UNUSED_P(has_internal_subset); data->currentDoctypeName = xcsdup(doctypeName); } static void -freeNotations(XmlwfUserData *data) -{ +freeNotations(XmlwfUserData *data) { NotationList *notationListHead = data->notationListHead; while (notationListHead != NULL) { @@ -337,8 +322,8 @@ freeNotations(XmlwfUserData *data) data->notationListHead = NULL; } -static int xcscmp(const XML_Char *xs, const XML_Char *xt) -{ +static int +xcscmp(const XML_Char *xs, const XML_Char *xt) { while (*xs != 0 && *xt != 0) { if (*xs < *xt) return -1; @@ -355,17 +340,15 @@ static int xcscmp(const XML_Char *xs, const XML_Char *xt) } static int -notationCmp(const void *a, const void *b) -{ - const NotationList * const n1 = *(NotationList **)a; - const NotationList * const n2 = *(NotationList **)b; +notationCmp(const void *a, const void *b) { + const NotationList *const n1 = *(NotationList **)a; + const NotationList *const n2 = *(NotationList **)b; return xcscmp(n1->notationName, n2->notationName); } static void XMLCALL -endDoctypeDecl(void *userData) -{ +endDoctypeDecl(void *userData) { XmlwfUserData *data = (XmlwfUserData *)userData; NotationList **notations; int notationCount = 0; @@ -389,9 +372,7 @@ endDoctypeDecl(void *userData) return; } - for (p = data->notationListHead, i = 0; - i < notationCount; - p = p->next, i++) { + for (p = data->notationListHead, i = 0; i < notationCount; p = p->next, i++) { notations[i] = p; } qsort(notations, notationCount, sizeof(NotationList *), notationCmp); @@ -415,8 +396,7 @@ endDoctypeDecl(void *userData) fputts(notations[i]->systemId, data->fp); puttc(T('\''), data->fp); } - } - else if (notations[i]->systemId != NULL) { + } else if (notations[i]->systemId != NULL) { fputts(T(" SYSTEM '"), data->fp); fputts(notations[i]->systemId, data->fp); puttc(T('\''), data->fp); @@ -435,16 +415,13 @@ endDoctypeDecl(void *userData) } static void XMLCALL -notationDecl(void *userData, - const XML_Char *notationName, - const XML_Char *UNUSED_P(base), - const XML_Char *systemId, - const XML_Char *publicId) -{ +notationDecl(void *userData, const XML_Char *notationName, const XML_Char *base, + const XML_Char *systemId, const XML_Char *publicId) { XmlwfUserData *data = (XmlwfUserData *)userData; NotationList *entry = malloc(sizeof(NotationList)); const char *errorMessage = "Unable to store NOTATION for output\n"; + UNUSED_P(base); if (entry == NULL) { fputs(errorMessage, stderr); return; /* Nothing we can really do about this */ @@ -463,8 +440,7 @@ notationDecl(void *userData, free(entry); return; } - } - else { + } else { entry->systemId = NULL; } if (publicId != NULL) { @@ -476,8 +452,7 @@ notationDecl(void *userData, free(entry); return; } - } - else { + } else { entry->publicId = NULL; } @@ -488,101 +463,103 @@ notationDecl(void *userData, #endif /* not W3C14N */ static void XMLCALL -defaultCharacterData(void *userData, const XML_Char *UNUSED_P(s), int UNUSED_P(len)) -{ - XML_DefaultCurrent((XML_Parser) userData); +defaultCharacterData(void *userData, const XML_Char *s, int len) { + UNUSED_P(s); + UNUSED_P(len); + XML_DefaultCurrent((XML_Parser)userData); } static void XMLCALL -defaultStartElement(void *userData, const XML_Char *UNUSED_P(name), - const XML_Char **UNUSED_P(atts)) -{ - XML_DefaultCurrent((XML_Parser) userData); +defaultStartElement(void *userData, const XML_Char *name, + const XML_Char **atts) { + UNUSED_P(name); + UNUSED_P(atts); + XML_DefaultCurrent((XML_Parser)userData); } static void XMLCALL -defaultEndElement(void *userData, const XML_Char *UNUSED_P(name)) -{ - XML_DefaultCurrent((XML_Parser) userData); +defaultEndElement(void *userData, const XML_Char *name) { + UNUSED_P(name); + XML_DefaultCurrent((XML_Parser)userData); } static void XMLCALL -defaultProcessingInstruction(void *userData, const XML_Char *UNUSED_P(target), - const XML_Char *UNUSED_P(data)) -{ - XML_DefaultCurrent((XML_Parser) userData); +defaultProcessingInstruction(void *userData, const XML_Char *target, + const XML_Char *data) { + UNUSED_P(target); + UNUSED_P(data); + XML_DefaultCurrent((XML_Parser)userData); } static void XMLCALL -nopCharacterData(void *UNUSED_P(userData), const XML_Char *UNUSED_P(s), int UNUSED_P(len)) -{ +nopCharacterData(void *userData, const XML_Char *s, int len) { + UNUSED_P(userData); + UNUSED_P(s); + UNUSED_P(len); } static void XMLCALL -nopStartElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) -{ +nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) { + UNUSED_P(userData); + UNUSED_P(name); + UNUSED_P(atts); } static void XMLCALL -nopEndElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name)) -{ +nopEndElement(void *userData, const XML_Char *name) { + UNUSED_P(userData); + UNUSED_P(name); } static void XMLCALL -nopProcessingInstruction(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), - const XML_Char *UNUSED_P(data)) -{ +nopProcessingInstruction(void *userData, const XML_Char *target, + const XML_Char *data) { + UNUSED_P(userData); + UNUSED_P(target); + UNUSED_P(data); } static void XMLCALL -markup(void *userData, const XML_Char *s, int len) -{ - FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp; +markup(void *userData, const XML_Char *s, int len) { + FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp; for (; len > 0; --len, ++s) puttc(*s, fp); } static void -metaLocation(XML_Parser parser) -{ +metaLocation(XML_Parser parser) { const XML_Char *uri = XML_GetBase(parser); FILE *fp = ((XmlwfUserData *)XML_GetUserData(parser))->fp; if (uri) ftprintf(fp, T(" uri=\"%s\""), uri); ftprintf(fp, - T(" byte=\"%") T(XML_FMT_INT_MOD) T("d\"") - T(" nbytes=\"%d\"") - T(" line=\"%") T(XML_FMT_INT_MOD) T("u\"") - T(" col=\"%") T(XML_FMT_INT_MOD) T("u\""), - XML_GetCurrentByteIndex(parser), - XML_GetCurrentByteCount(parser), + T(" byte=\"%") T(XML_FMT_INT_MOD) T("d\"") T(" nbytes=\"%d\"") + T(" line=\"%") T(XML_FMT_INT_MOD) T("u\"") T(" col=\"%") + T(XML_FMT_INT_MOD) T("u\""), + XML_GetCurrentByteIndex(parser), XML_GetCurrentByteCount(parser), XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser)); } static void -metaStartDocument(void *userData) -{ +metaStartDocument(void *userData) { fputts(T("<document>\n"), - ((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp); + ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp); } static void -metaEndDocument(void *userData) -{ +metaEndDocument(void *userData) { fputts(T("</document>\n"), - ((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp); + ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp); } static void XMLCALL -metaStartElement(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - XML_Parser parser = (XML_Parser) userData; +metaStartElement(void *userData, const XML_Char *name, const XML_Char **atts) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; const XML_Char **specifiedAttsEnd - = atts + XML_GetSpecifiedAttributeCount(parser); + = atts + XML_GetSpecifiedAttributeCount(parser); const XML_Char **idAttPtr; int idAttIndex = XML_GetIdAttributeIndex(parser); if (idAttIndex < 0) @@ -605,15 +582,13 @@ metaStartElement(void *userData, const XML_Char *name, fputts(T("\"/>\n"), fp); } while (*(atts += 2)); fputts(T("</starttag>\n"), fp); - } - else + } else fputts(T("/>\n"), fp); } static void XMLCALL -metaEndElement(void *userData, const XML_Char *name) -{ - XML_Parser parser = (XML_Parser) userData; +metaEndElement(void *userData, const XML_Char *name) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; ftprintf(fp, T("<endtag name=\"%s\""), name); @@ -623,9 +598,8 @@ metaEndElement(void *userData, const XML_Char *name) static void XMLCALL metaProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ - XML_Parser parser = (XML_Parser) userData; + const XML_Char *data) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = usrData->fp; ftprintf(fp, T("<pi target=\"%s\" data=\""), target); @@ -636,9 +610,8 @@ metaProcessingInstruction(void *userData, const XML_Char *target, } static void XMLCALL -metaComment(void *userData, const XML_Char *data) -{ - XML_Parser parser = (XML_Parser) userData; +metaComment(void *userData, const XML_Char *data) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = usrData->fp; fputts(T("<comment data=\""), fp); @@ -649,9 +622,8 @@ metaComment(void *userData, const XML_Char *data) } static void XMLCALL -metaStartCdataSection(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; +metaStartCdataSection(void *userData) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; fputts(T("<startcdata"), fp); @@ -660,9 +632,8 @@ metaStartCdataSection(void *userData) } static void XMLCALL -metaEndCdataSection(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; +metaEndCdataSection(void *userData) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; fputts(T("<endcdata"), fp); @@ -671,9 +642,8 @@ metaEndCdataSection(void *userData) } static void XMLCALL -metaCharacterData(void *userData, const XML_Char *s, int len) -{ - XML_Parser parser = (XML_Parser) userData; +metaCharacterData(void *userData, const XML_Char *s, int len) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; fputts(T("<chars str=\""), fp); @@ -684,24 +654,23 @@ metaCharacterData(void *userData, const XML_Char *s, int len) } static void XMLCALL -metaStartDoctypeDecl(void *userData, - const XML_Char *doctypeName, - const XML_Char *UNUSED_P(sysid), - const XML_Char *UNUSED_P(pubid), - int UNUSED_P(has_internal_subset)) -{ - XML_Parser parser = (XML_Parser) userData; +metaStartDoctypeDecl(void *userData, const XML_Char *doctypeName, + const XML_Char *sysid, const XML_Char *pubid, + int has_internal_subset) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; + UNUSED_P(sysid); + UNUSED_P(pubid); + UNUSED_P(has_internal_subset); ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName); metaLocation(parser); fputts(T("/>\n"), fp); } static void XMLCALL -metaEndDoctypeDecl(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; +metaEndDoctypeDecl(void *userData) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; fputts(T("<enddoctype"), fp); @@ -710,15 +679,13 @@ metaEndDoctypeDecl(void *userData) } static void XMLCALL -metaNotationDecl(void *userData, - const XML_Char *notationName, - const XML_Char *UNUSED_P(base), - const XML_Char *systemId, - const XML_Char *publicId) -{ - XML_Parser parser = (XML_Parser) userData; +metaNotationDecl(void *userData, const XML_Char *notationName, + const XML_Char *base, const XML_Char *systemId, + const XML_Char *publicId) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; + UNUSED_P(base); ftprintf(fp, T("<notation name=\"%s\""), notationName); if (publicId) ftprintf(fp, T(" public=\"%s\""), publicId); @@ -731,30 +698,24 @@ metaNotationDecl(void *userData, fputts(T("/>\n"), fp); } - static void XMLCALL -metaEntityDecl(void *userData, - const XML_Char *entityName, - int UNUSED_P(is_param), - const XML_Char *value, - int value_length, - const XML_Char *UNUSED_P(base), - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName) -{ - XML_Parser parser = (XML_Parser) userData; +metaEntityDecl(void *userData, const XML_Char *entityName, int is_param, + const XML_Char *value, int value_length, const XML_Char *base, + const XML_Char *systemId, const XML_Char *publicId, + const XML_Char *notationName) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; + UNUSED_P(is_param); + UNUSED_P(base); if (value) { ftprintf(fp, T("<entity name=\"%s\""), entityName); metaLocation(parser); puttc(T('>'), fp); characterData(data, value, value_length); fputts(T("</entity/>\n"), fp); - } - else if (notationName) { + } else if (notationName) { ftprintf(fp, T("<entity name=\"%s\""), entityName); if (publicId) ftprintf(fp, T(" public=\"%s\""), publicId); @@ -764,8 +725,7 @@ metaEntityDecl(void *userData, ftprintf(fp, T(" notation=\"%s\""), notationName); metaLocation(parser); fputts(T("/>\n"), fp); - } - else { + } else { ftprintf(fp, T("<entity name=\"%s\""), entityName); if (publicId) ftprintf(fp, T(" public=\"%s\""), publicId); @@ -778,11 +738,9 @@ metaEntityDecl(void *userData, } static void XMLCALL -metaStartNamespaceDecl(void *userData, - const XML_Char *prefix, - const XML_Char *uri) -{ - XML_Parser parser = (XML_Parser) userData; +metaStartNamespaceDecl(void *userData, const XML_Char *prefix, + const XML_Char *uri) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; fputts(T("<startns"), fp); @@ -792,74 +750,70 @@ metaStartNamespaceDecl(void *userData, fputts(T(" ns=\""), fp); characterData(data, uri, (int)tcslen(uri)); fputts(T("\"/>\n"), fp); - } - else + } else fputts(T("/>\n"), fp); } static void XMLCALL -metaEndNamespaceDecl(void *userData, const XML_Char *prefix) -{ - XML_Parser parser = (XML_Parser) userData; +metaEndNamespaceDecl(void *userData, const XML_Char *prefix) { + XML_Parser parser = (XML_Parser)userData; XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); FILE *fp = data->fp; - if (!prefix) + if (! prefix) fputts(T("<endns/>\n"), fp); else ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix); } static int XMLCALL -unknownEncodingConvert(void *data, const char *p) -{ +unknownEncodingConvert(void *data, const char *p) { return codepageConvert(*(int *)data, p); } static int XMLCALL -unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *info) -{ +unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) { int cp; static const XML_Char prefixL[] = T("windows-"); static const XML_Char prefixU[] = T("WINDOWS-"); int i; + UNUSED_P(userData); for (i = 0; prefixU[i]; i++) if (name[i] != prefixU[i] && name[i] != prefixL[i]) return 0; - + cp = 0; for (; name[i]; i++) { static const XML_Char digits[] = T("0123456789"); const XML_Char *s = tcschr(digits, name[i]); - if (!s) + if (! s) return 0; cp *= 10; cp += (int)(s - digits); if (cp >= 0x10000) return 0; } - if (!codepageMap(cp, info->map)) + if (! codepageMap(cp, info->map)) return 0; info->convert = unknownEncodingConvert; /* We could just cast the code page integer to a void *, and avoid the use of release. */ info->release = free; info->data = malloc(sizeof(int)); - if (!info->data) + if (! info->data) return 0; *(int *)info->data = cp; return 1; } static int XMLCALL -notStandalone(void *UNUSED_P(userData)) -{ +notStandalone(void *userData) { + UNUSED_P(userData); return 0; } static void -showVersion(XML_Char *prog) -{ +showVersion(XML_Char *prog) { XML_Char *s = prog; XML_Char ch; const XML_Feature *features = XML_GetFeatureList(); @@ -868,7 +822,7 @@ showVersion(XML_Char *prog) #if defined(_WIN32) || ch == '\\' #endif - ) + ) prog = s + 1; ++s; } @@ -889,10 +843,46 @@ showVersion(XML_Char *prog) } static void -usage(const XML_Char *prog, int rc) -{ - ftprintf(stderr, - T("usage: %s [-s] [-n] [-p] [-x] [-e encoding] [-w] [-d output-dir] [-c] [-m] [-r] [-t] [-N] [file ...]\n"), prog); +usage(const XML_Char *prog, int rc) { + ftprintf( + stderr, + /* Generated with: + * $ xmlwf/xmlwf_helpgen.sh + */ + /* clang-format off */ + T("usage: %s [-s] [-n] [-p] [-x] [-e ENCODING] [-w] [-r] [-d DIRECTORY]\n") + T(" [-c | -m | -t] [-N]\n") + T(" [FILE [FILE ...]]\n") + T("\n") + T("xmlwf - Determines if an XML document is well-formed\n") + T("\n") + T("positional arguments:\n") + T(" FILE files to process (default: STDIN)\n") + T("\n") + T("input control arguments:\n") + T(" -s print an error if the document is not [s]tandalone\n") + T(" -n enable [n]amespace processing\n") + T(" -p enable processing external DTDs and [p]arameter entities\n") + T(" -x enable processing of e[x]ternal entities\n") + T(" -e ENCODING override any in-document [e]ncoding declaration\n") + T(" -w enable support for [W]indows code pages\n") + T(" -r disable memory-mapping and use normal file [r]ead IO calls instead\n") + T("\n") + T("output control arguments:\n") + T(" -d DIRECTORY output [d]estination directory\n") + T(" -c write a [c]opy of input XML, not canonical XML\n") + T(" -m write [m]eta XML, not canonical XML\n") + T(" -t write no XML output for [t]iming of plain parsing\n") + T(" -N enable adding doctype and [n]otation declarations\n") + T("\n") + T("info arguments:\n") + T(" -h show this [h]elp message and exit\n") + T(" -v show program's [v]ersion number and exit\n") + T("\n") + T("libexpat is software libre, licensed under the MIT license.\n") + T("Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!\n") + , /* clang-format on */ + prog); exit(rc); } @@ -902,8 +892,7 @@ int wmain(int argc, XML_Char **argv); #endif int -tmain(int argc, XML_Char **argv) -{ +tmain(int argc, XML_Char **argv) { int i, j; const XML_Char *outputDir = NULL; const XML_Char *encoding = NULL; @@ -913,13 +902,13 @@ tmain(int argc, XML_Char **argv) int useNamespaces = 0; int requireStandalone = 0; int requiresNotations = 0; - enum XML_ParamEntityParsing paramEntityParsing = - XML_PARAM_ENTITY_PARSING_NEVER; + enum XML_ParamEntityParsing paramEntityParsing + = XML_PARAM_ENTITY_PARSING_NEVER; int useStdin = 0; - XmlwfUserData userData = { NULL, NULL, NULL }; + XmlwfUserData userData = {NULL, NULL, NULL}; #ifdef _MSC_VER - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif i = 1; @@ -980,8 +969,7 @@ tmain(int argc, XML_Char **argv) if (++i == argc) usage(argv[0], 2); outputDir = argv[i]; - } - else + } else outputDir = argv[i] + j + 1; i++; j = 0; @@ -991,8 +979,7 @@ tmain(int argc, XML_Char **argv) if (++i == argc) usage(argv[0], 2); encoding = argv[i]; - } - else + } else encoding = argv[i] + j + 1; i++; j = 0; @@ -1043,18 +1030,17 @@ tmain(int argc, XML_Char **argv) XML_SetElementHandler(parser, nopStartElement, nopEndElement); XML_SetCharacterDataHandler(parser, nopCharacterData); XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction); - } - else if (outputDir) { - const XML_Char * delim = T("/"); + } else if (outputDir) { + const XML_Char *delim = T("/"); const XML_Char *file = useStdin ? T("STDIN") : argv[i]; - if (!useStdin) { + if (! useStdin) { /* Jump after last (back)slash */ - const XML_Char * lastDelim = tcsrchr(file, delim[0]); + const XML_Char *lastDelim = tcsrchr(file, delim[0]); if (lastDelim) file = lastDelim + 1; #if defined(_WIN32) else { - const XML_Char * winDelim = T("\\"); + const XML_Char *winDelim = T("\\"); lastDelim = tcsrchr(file, winDelim[0]); if (lastDelim) { file = lastDelim + 1; @@ -1064,12 +1050,12 @@ tmain(int argc, XML_Char **argv) #endif } outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2) - * sizeof(XML_Char)); + * sizeof(XML_Char)); tcscpy(outName, outputDir); tcscat(outName, delim); tcscat(outName, file); userData.fp = tfopen(outName, T("wb")); - if (!userData.fp) { + if (! userData.fp) { tperror(outName); exit(1); } @@ -1126,13 +1112,15 @@ tmain(int argc, XML_Char **argv) if (outputType == 'm') metaEndDocument(parser); fclose(userData.fp); - if (!result) { + if (! result) { tremove(outName); - exit(2); } free(outName); } XML_ParserFree(parser); + if (! result) { + exit(2); + } } return 0; } diff --git a/contrib/expat/xmlwf/xmlwf_helpgen.py b/contrib/expat/xmlwf/xmlwf_helpgen.py new file mode 100755 index 000000000000..0dcb6d34e37c --- /dev/null +++ b/contrib/expat/xmlwf/xmlwf_helpgen.py @@ -0,0 +1,69 @@ +#! /usr/bin/env python3 +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser +# +# Copyright (c) 2019 Expat development team +# Licensed under the MIT license: +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. + +import argparse + +epilog = """ +libexpat is software libre, licensed under the MIT license. +Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you! +""" + +parser = argparse.ArgumentParser(prog='xmlwf', add_help=False, + description='xmlwf - Determines if an XML document is well-formed', + formatter_class=argparse.RawTextHelpFormatter, + epilog=epilog) + +input_related = parser.add_argument_group('input control arguments') +input_related.add_argument('-s', action='store_true', help='print an error if the document is not [s]tandalone') +input_related.add_argument('-n', action='store_true', help='enable [n]amespace processing') +input_related.add_argument('-p', action='store_true', help='enable processing external DTDs and [p]arameter entities') +input_related.add_argument('-x', action='store_true', help='enable processing of e[x]ternal entities') +input_related.add_argument('-e', action='store', metavar='ENCODING', help='override any in-document [e]ncoding declaration') +input_related.add_argument('-w', action='store_true', help='enable support for [W]indows code pages') +input_related.add_argument('-r', action='store_true', help='disable memory-mapping and use normal file [r]ead IO calls instead') + +output_related = parser.add_argument_group('output control arguments') +output_related.add_argument('-d', action='store', metavar='DIRECTORY', help='output [d]estination directory') +output_mode = output_related.add_mutually_exclusive_group() +output_mode.add_argument('-c', action='store_true', help='write a [c]opy of input XML, not canonical XML') +output_mode.add_argument('-m', action='store_true', help='write [m]eta XML, not canonical XML') +output_mode.add_argument('-t', action='store_true', help='write no XML output for [t]iming of plain parsing') +output_related.add_argument('-N', action='store_true', help='enable adding doctype and [n]otation declarations') + +parser.add_argument('files', metavar='FILE', nargs='*', help='files to process (default: STDIN)') + +info = parser.add_argument_group('info arguments') +info = info.add_mutually_exclusive_group() +info.add_argument('-h', action='store_true', help='show this [h]elp message and exit') +info.add_argument('-v', action='store_true', help='show program\'s [v]ersion number and exit') + + +if __name__ == '__main__': + parser.print_help() diff --git a/contrib/expat/xmlwf/xmlwf_helpgen.sh b/contrib/expat/xmlwf/xmlwf_helpgen.sh new file mode 100755 index 000000000000..6b0fbf929a09 --- /dev/null +++ b/contrib/expat/xmlwf/xmlwf_helpgen.sh @@ -0,0 +1,35 @@ +#! /usr/bin/env bash +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser +# +# Copyright (c) 2019 Expat development team +# Licensed under the MIT license: +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. + +./xmlwf/xmlwf_helpgen.py | sed \ + -e 's,usage: xmlwf,usage: %s,' \ + -e 's, \[-h | -v\],,' \ + -e 's,^, T(",' \ + -e 's,$,\\n"),' |