html-xml-utils-7.7/0000755000175000017500000000000013271374344011300 500000000000000html-xml-utils-7.7/hxuncdata.c0000644000175000017500000001100313244022534013325 00000000000000/* * uncdata -- remove CDATA sections from an XML file * * The input is scanned for occurrences of "". Those strings are removed and all occurrences * of "&", "<" and ">" in between them will be replaced by "&", * "&;t;" and ">" resp. * * The input must be 1 byte per character. If it is not, convert it to * UTF-8 first. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Author: Bert Bos * Created: 20 Feb 2002 * Version: $Id: hxuncdata.c,v 1.2 2009/01/08 14:35:09 bbos Exp $ */ #include #include #include /* process -- process one file */ static void process(FILE *f) { int c; enum {INITIAL, START, CDATA1, CDATA2, CDATA3, CDATA4, CDATA5, CDATA6, CDATA7, CDATA98, CDATA99, CDATA, MARKUP, DECL1, DECL, COMMENT1, COMMENT, COMMENT99, DQUOTE, SQUOTE} state = INITIAL; /* No attempt at reporting errors for impossible XML, and no support for internal DTD subsets */ while ((c = getc(f)) != EOF) { switch (state) { case INITIAL: if (c == '<') state = START; else putchar(c); break; case START: /* Seen "<" */ if (c == '!') state = DECL1; else if (c == '>') {putchar('<'); putchar('>'); state = INITIAL;} else {putchar('<'); putchar(c); state = MARKUP;} break; case MARKUP: /* Inside "<...>" */ if (c == '"') {putchar('"'); state = DQUOTE;} else if (c == '\'') {putchar('\''); state = SQUOTE;} else if (c == '>') {putchar('>'); state = INITIAL;} else putchar(c); break; case DQUOTE: /* Inside double quotes */ if (c == '"') {putchar('"'); state = MARKUP;} else putchar(c); break; case SQUOTE: /* Inside single quotes */ if (c == '\'') {putchar('\''); state = MARKUP;} else putchar(c); break; case DECL1: /* Seen "" */ if (c == '-') {putchar('-'); state = COMMENT1;} else if (c == '>') {putchar('>'); state = INITIAL;} else putchar(c); break; case COMMENT1: /* Seen "-" */ if (c == '-') {putchar('-'); state = COMMENT;} else {putchar(c); state = DECL;} break; case COMMENT: /* Seen "--" */ if (c == '-') {putchar('-'); state = COMMENT99;} else putchar(c); break; case COMMENT99: /* Seen "-" */ if (c == '-') {putchar('-'); state = DECL;} else {putchar(c); state = COMMENT;} break; case CDATA1: /* Seen "" */ if (c == ']') state = CDATA98; else if (c == '<') fputs("<", stdout); else if (c == '>') fputs(">", stdout); else if (c == '&') fputs("&", stdout); else putchar(c); break; case CDATA98: /* Seen "]" */ if (c == ']') state = CDATA99; else {putchar(']'); putchar(c); state = CDATA;} break; case CDATA99: /* Seen "]]" */ if (c == '>') state = INITIAL; else {putchar(']'); putchar(']'); putchar(c); state = CDATA;} break; default: assert(!"Cannot happen!"); } } } int main(int argc, char *argv[]) { int i, err = 0; FILE *f; if (argc == 1) process(stdin); else if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0) printf("Usage: %s [XML-FILE]...\n", argv[0]); else for (i = 1; i < argc; i++) { if (!(f = fopen(argv[i], "r"))) {perror(argv[i]); err++; continue;} process(f); if (fclose(f) != 0) {perror(argv[i]); err++; continue;} } return err; } html-xml-utils-7.7/hxprune.c0000645000175000017500000001147713244022534013057 00000000000000/* * Remove subtrees which have a certain class attribute. * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Bert Bos * Created Feb 2000 * $Id: hxprune.c,v 1.8 2017/11/24 09:50:25 bbos Exp $ * **/ /* #include */ #include "config.h" #include #include #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #include "export.h" #include "types.e" #include "tree.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "class.e" #include "errexit.e" #define EXCLUDE_CLASS "exclude" /* Default value for class */ static Tree tree; static bool xml = false; /* Use convention */ /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) { tree = create(); return NULL; } /* end -- called after the last event is reported */ static void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, string commenttext) { tree = append_comment(tree, commenttext); } /* handle_text -- called after a tex chunk is parsed */ static void handle_text(void *clientdata, string text) { tree = append_text(tree, text); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *clientdata, string gi, string fpi, string url) { tree = append_declaration(tree, gi, fpi, url); } /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *clientdata, string pi_text) { tree = append_procins(tree, pi_text); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, string name, pairlist attribs) { tree = html_push(tree, name, attribs); } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, string name, pairlist attribs) { tree = html_push(tree, name, attribs); } /* handle_pop -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, string name) { tree = html_pop(tree, name); } /* prune -- write the tree, suppressing elements with a certain class */ static void prune(Tree t, const string class) { Tree h; pairlist a; for (h = t->children; h != NULL; h = h->sister) { switch (h->tp) { case Text: printf("%s", h->text); break; case Comment: printf("", h->text); break; case Declaration: printf("name); if (h->text) printf(" PUBLIC \"%s\"", h->text); if (h->url) printf(" %s\"%s\"", h->text ? "" : "SYSTEM ", h->url); printf(">"); break; case Procins: printf("", h->text); break; case Element: if (! has_class(h->attribs, class)) { printf("<%s", h->name); for (a = h->attribs; a != NULL; a = a->next) { printf(" %s", a->name); if (a->value != NULL) printf("=\"%s\"", a->value); else if (xml) printf("=\"%s\"", a->name); } if (is_empty(h->name)) { assert(h->children == NULL); printf(xml ? " />" : ">"); } else { printf(">"); prune(h, class); printf("", h->name); } } break; case Root: assert(! "Cannot happen"); break; default: assert(! "Cannot happen"); } } } /* usage -- print usage message and exit */ static void usage(string name) { fprintf(stderr, "Usage: %s [-c class] [-x] [html-file]\n", name); exit(1); } int main(int argc, char *argv[]) { int i, status; string class = EXCLUDE_CLASS; /* mtrace(); */ /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); yyin = stdin; for (i = 1; i < argc; i++) { if (eq(argv[i], "-c")) { if (i >= argc - 1) usage(argv[0]); class = argv[++i]; } else if (eq(argv[i], "-x")) { xml = true; } else { yyin = fopenurl(argv[i], "r", &status); if (yyin == NULL) {perror(argv[1]); exit(2);} if (status != 200) errexit("%s : %s\n", argv[i], http_strerror(status)); } } if (yyparse() != 0) { exit(3); } tree = get_root(tree); prune(tree, class); tree_delete(tree); /* Just to test memory mgmt */ return 0; } html-xml-utils-7.7/hxaddid.10000644000175000017500000000536613244022534012710 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXADDID" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxaddid \- add IDs to selected elements .SH SYNOPSIS .B hxaddid .RB "[\| " \-x " \|]" .RB "[\-\-]" .IR elem|.class|elem.class .RI "[\| " file-or-URL " \|]" .SH DESCRIPTION .LP The .B hxaddid command copies an HTML or XML file to standard output, while adding element IDs to the specified elements or classes. .LP For example, given the input .d

A paragraph without an ID

.e the command .d hxaddid p .e will output .d

A paragraph without an ID

.e .LP If you specify a class using \fB.class\fP then IDs will only be added to elements that contain that class. And if you specify an element and a class using \fBelem.class\fP then IDs will only be added to the specified elements that contain the specified class. .LP If two elements would naturally generate the same ID, a number is added to the ID name (starting with 0) to make sure the IDs are unique. IDs are not added to matching elements that already contain an ID. .SH OPTIONS The following options are supported: .TP 10 .B \-x Use XML conventions: empty elements are written with a slash at the end: . Also causes the element to be matched case-sensitively. .SH OPERANDS The following operands are supported: .TP 10 .I elem The name of element to select. .TP 10 .I .class The name of class to select. .TP 10 .I elem.class The name of element that contains class to select. .TP 10 .I file-or-URL The name or URL of an HTML or XHTML file. .SH "EXIT STATUS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of one of the HTML or XML files. .SH ENVIRONMENT To use a proxy to retrieve remote files, set the environment variables .B http_proxy or .BR ftp_proxy "." E.g., .B http_proxy="http://localhost:8080/" .SH BUGS .LP Assumes UTF-8 as input. Doesn't expand character entities. Instead pipe the input through .BR hxunent (1) and .BR asc2xml (1) to convert it to UTF-8. .LP .B hxaddid tries first to generate "readable" IDs, by forming the ID out of the letters and digits found in the content of the element and falls back to generating arbitrary IDs if it doesn't find enough. However, the algorithm in this version is primitive and only gives reasonable results for ASCII letters and digits. .LP Remote files (specified with a URL) are currently only supported for HTTP. Password-protected files or files that depend on HTTP "cookies" are not handled. (You can use tools such as .BR curl (1) or .BR wget (1) to retrieve such files.) .SH "SEE ALSO" .BR asc2xml (1), .BR hxprune (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxtoc (1), .BR hxunent (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/unent.e0000755000175000017500000000025213244022534012510 00000000000000struct _Entity {char *name; unsigned int code;}; extern const struct _Entity *lookup_entity (register const char *str, register size_t len); html-xml-utils-7.7/hxref.10000644000175000017500000000705713244022534012416 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXREF" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxref \- generate cross-references inside and between HTML files .SH SYNOPSIS .B hxref .RB "[\| " \-x " \|]" .RB "[\| " \-l " \|]" .RB "[\| " \-b .IR base " \|]" .RB "[\| " \-i .IR index " \|]" .RI "[\| -- \|] [\| " input " [\| " output " \|] \|]" .SH DESCRIPTION .LP The .B hxref command links inline elements to DFN elements with the same content. It adds ID attributes where necessary. If the content of a DFN or other element isn't suitable, the TITLE attribute may be used to provide the term to use for comparisons. .LP Here is an example: .d

A b-box is defined to be...

For every b there is a b-box... .e The output of .B hxref will be similar to this: .d

A b-box is defined to be...

For every b there is a b-box... .e .SH OPTIONS The following options are supported: .TP 10 .B \-x Use XML conventions: empty elements are written with a slash at the end: .TP .BI \-b " base" Sets the prefix for the generated URLs. By default .I base is empty, which generates URLs like "#b-box" above. If .I base is set to, e.g., "http://xyz/", the URLs will look like "http://xyz/#b-box". .TP .BI \-i " index" Directs .B hxref to read terms from a database file before looking for them in the document and afterwards store the terms that were found in the same file. DFN element in the document override terms found in .IR index "." This allows .B hxref to be run multiple times on different files, to make the files refer to each other. It may be necessary to run the commands twice, to resolve all cross-references. .TP .B \-l Try to use language-specific information to match instances to their definitions. Currently, only English is supported and the only rules applied are to search without a final "s" ("trees" matches "tree"), without a final "es" ("bosses" matches "boss") and with a "y" replacing a final "ies" ("bounties" matches "bounty"). .B hxref determines the language from "lang" and "xml:lang" attributes in the document. .SH OPERANDS The following operands are supported: .TP 10 .I input The name of an HTML file. If absent, standard input is read instead. The special name "-" also indicates standard input. The .I input may be an URL. .TP .I output The file to write to. If absent, standard output is used. This may .I not be a URL. .SH "DIAGNOSTICS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the HTML file. .B hxref will try to correct the error and produce output anyway. .SH "SEE ALSO" .BR asc2xml (1), .BR hxindex (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxtoc (1), .BR xml2asc (1) .SH BUGS .LP The error recovery for incorrect HTML is primitive. .LP The program generates ID attributes, but doesn't generate tags, so the links only work in browsers that recognize ID attributes. .LP The rules for matching English plurals are primitive. No dictionary is used. E.g., "bees" will be considered a plural of "be". .LP There is currently no way to set the default language for a document for when the root element has no "lang" or "xml:lang" attribute. .LP .B hxref tries first to generate "readable" ID attributes, by forming the ID out of the letters and digits found in the content of the element and falls back to generating arbitrary IDs if it doesn't find enough. However, the algorithm in this version is primitive and only gives reasonable results for ASCII letters and digits. html-xml-utils-7.7/scan.e0000755000175000017500000000034113271372416012311 00000000000000extern FILE *yyin; extern void set_yyin(FILE *f, const conststring name); extern conststring get_yyin_name(void); extern void include_file(FILE *f, const conststring name); extern void set_cdata_element(const conststring e); html-xml-utils-7.7/hxclean.10000644000175000017500000000041213244022534012710 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXCLEAN" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxclean \- apply heuristics to correct an HTML file .SH SYNOPSIS .B hxclean .RI "[\| " file " \|]" .SH DESCRIPTION [ToDo] html-xml-utils-7.7/config.rpath0000755000175000017500000004421613271362111013524 00000000000000#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2016 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's _LT_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; mingw* | cygwin* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in ecc*) wl='-Wl,' ;; icc* | ifort*) wl='-Wl,' ;; lf95*) wl='-Wl,' ;; nagfor*) wl='-Wl,-Wl,,' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; xl* | bgxl* | bgf* | mpixl*) wl='-Wl,' ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) wl= ;; *Sun\ C*) wl='-Wl,' ;; esac ;; esac ;; newsos6) ;; *nto* | *qnx*) ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; rdos*) ;; solaris*) case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) wl='-Qoption ld ' ;; *) wl='-Wl,' ;; esac ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) wl='-Wl,' ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's _LT_LINKER_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; haiku*) ;; interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' else ld_shlibs=no fi ;; esac ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then hardcode_libdir_flag_spec= fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then : else ld_shlibs=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd2.[01]*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no ;; *) hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. # Unlike libtool.m4, here we don't care about _all_ names of the library, but # only about the one the linker finds when passed -lNAME. This is the last # element of library_names_spec in libtool.m4, or possibly two of them if the # linker has special search rules. library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) library_names_spec='$libname.a' ;; aix[4-9]*) library_names_spec='$libname$shrext' ;; amigaos*) case "$host_cpu" in powerpc*) library_names_spec='$libname$shrext' ;; m68k) library_names_spec='$libname.a' ;; esac ;; beos*) library_names_spec='$libname$shrext' ;; bsdi[45]*) library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32* | cegcc*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib library_names_spec='$libname$shrext' ;; dgux*) library_names_spec='$libname$shrext' ;; freebsd[23].*) library_names_spec='$libname$shrext$versuffix' ;; freebsd* | dragonfly*) library_names_spec='$libname$shrext' ;; gnu*) library_names_spec='$libname$shrext' ;; haiku*) library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac library_names_spec='$libname$shrext' ;; interix[3-9]*) library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) library_names_spec='$libname$shrext' ;; knetbsd*-gnu) library_names_spec='$libname$shrext' ;; netbsd*) library_names_spec='$libname$shrext' ;; newsos6) library_names_spec='$libname$shrext' ;; *nto* | *qnx*) library_names_spec='$libname$shrext' ;; openbsd*) library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) library_names_spec='$libname$shrext' ;; rdos*) ;; solaris*) library_names_spec='$libname$shrext' ;; sunos4*) library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) library_names_spec='$libname$shrext' ;; sysv4*MP*) library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) library_names_spec='$libname$shrext' ;; tpf*) library_names_spec='$libname$shrext' ;; uts4*) library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < * Created 31 July 1999 * $Id: hxwls.c,v 1.12 2017/12/07 02:05:23 bbos Exp $ */ #include "config.h" #include #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRDUP # include "strdup.e" # endif #endif #include "export.h" #include "heap.e" #include "types.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "url.e" #include "errexit.e" #include "unent.e" static bool has_error = false; static string base = NULL; static string self; static enum {Short, Long, HTML, Tuple} format = Short; /* Option -l -h -t */ static bool relative = false; /* Option -r */ static bool ascii = false; /* Option -a */ /* append_utf8 -- add UTF-8 bytes for code n at s, return end of string */ static string append_utf8(string s, const unsigned long n) { /* We assume s is long enough */ if (n <= 0x7F) { *(s++) = n; } else if (n <= 0x7FF) { *(s++) = 0xC0 | (n >> 6); *(s++) = 0x80 | (n & 0x3F); } else if (n <= 0xFFFF) { *(s++) = 0xE0 | (n >> 12); *(s++) = 0x80 | ((n >> 6) & 0x3F); *(s++) = 0x80 | (n & 0x3F); } else if (n <= 0x1FFFFF) { *(s++) = 0xF0 | (n >> 18); *(s++) = 0x80 | ((n >> 12) & 0x3F); *(s++) = 0x80 | ((n >> 6) & 0x3F); *(s++) = 0x80 | (n & 0x3F); } else if (n <= 0x3FFFFFF) { *(s++) = 0xF0 | (n >> 24); *(s++) = 0x80 | ((n >> 18) & 0x3F); *(s++) = 0x80 | ((n >> 12) & 0x3F); *(s++) = 0x80 | ((n >> 6) & 0x3F); *(s++) = 0x80 | (n & 0x3F); } else { *(s++) = 0xF0 | (n >> 30); *(s++) = 0x80 | ((n >> 24) & 0x3F); *(s++) = 0x80 | ((n >> 18) & 0x3F); *(s++) = 0x80 | ((n >> 12) & 0x3F); *(s++) = 0x80 | ((n >> 6) & 0x3F); *(s++) = 0x80 | (n & 0x3F); } return s; } /* output -- print the link (lowercases rel argument) */ static void output(const conststring type, const conststring rel, conststring url) { string h = NULL, q, r, rel1; conststring p, s; const struct _Entity *e; unsigned long c; if (url) { /* If we found a URL */ /* Replace entities. */ h = newnstring(url, 2 * strlen(url)); /* Reserve sufficient space */ for (p = url, q = h; *p; p++) { if (*p != '&') { *(q++) = *p; } else if (*(p+1) == '#') { /* Numeric entity */ if (*(p+2) == 'x') c = strtoul(p + 3, &r, 16); else c = strtoul(p + 2, &r, 10); if (c > 0 && c <= 2147483647) q = append_utf8(q, c); p = *r == ';' ? r : r - 1; } else { /* Entity */ for (s = p + 1; isalnum(*s); s++); if (!(e = lookup_entity(p+1, s - (p+1)))) *(q++) = '&'; /* Unknown */ else {q = append_utf8(q, e->code); p = *s == ';' ? s : s -1;} } } *q = '\0'; url = h; /* Make URL absolute */ if (! relative && base) { h = URL_s_absolutize(base, url); dispose(url); url = h; } /* Convert IRI to URL, if requested */ if (ascii) { h = URL_s_to_ascii(url); dispose(url); url = h; } rel1 = newstring(rel ? rel : ""); down(rel1); switch (format) { case HTML: printf("

  • %s
  • \n", type, rel1, url, url); break; case Long: printf("%s\t%s\t%s\n", type, rel1, url); break; case Short: printf("%s\n", url); break; case Tuple: printf("%s\t%s\t%s\t%s\n", self, type, rel1, url); break; default: assert(!"Cannot happen!"); } free(rel1); free(h); } } /* --------------- implements parser interface api------------------------- */ /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); has_error = true; } /* start -- called before the first event is reported */ void* start(void) { if (format == HTML) { printf("\n"); printf("\n"); printf("Output of listlinks\n"); printf("\n"); printf("
      \n"); } return NULL; } /* end -- called after the last event is reported */ void end(void *clientdata) { if (format == HTML) { printf("
    \n"); printf("\n"); printf("\n"); } } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { free(commenttext); } /* handle_text -- called after a text chunk is parsed */ void handle_text(void *clientdata, string text) { /* There may be several consecutive calls to this routine. */ /* escape(text); */ free(text); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) { /* skip */ if (gi) free(gi); if (fpi) free(fpi); if (url) free(url); } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { if (pi_text) free(pi_text); } /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { /* ToDo: print text of anchor, if available */ conststring h; if (strcasecmp(name, "base") == 0) { h = pairlist_get(attribs, "href"); if (h) base = strdup(h); /* Use as base from now on */ output("base", NULL, h); } else if (strcasecmp(name, "link") == 0) { output("link", pairlist_get(attribs, "rel"), pairlist_get(attribs, "href")); } else if (strcasecmp(name, "a") == 0) { output("a", pairlist_get(attribs, "rel"), pairlist_get(attribs, "href")); } else if (strcasecmp(name, "img") == 0) { output("img", NULL, pairlist_get(attribs, "src")); output("longdesc", NULL, pairlist_get(attribs, "longdesc")); } else if (strcasecmp(name, "input") == 0) { output("input", NULL, pairlist_get(attribs, "src")); } else if (strcasecmp(name, "object") == 0) { output("object", NULL, pairlist_get(attribs, "data")); output("object", NULL, pairlist_get(attribs, "classid")); output("object", NULL, pairlist_get(attribs, "codebase")); } else if (strcasecmp(name, "area") == 0) { output("area", pairlist_get(attribs, "rel"), pairlist_get(attribs, "href")); } else if (strcasecmp(name, "ins") == 0) { output("ins", NULL, pairlist_get(attribs, "cite")); } else if (strcasecmp(name, "del") == 0) { output("del", NULL, pairlist_get(attribs, "cite")); } else if (strcasecmp(name, "q") == 0) { output("q", NULL, pairlist_get(attribs, "cite")); } else if (strcasecmp(name, "blockquote") == 0) { output("bq", NULL, pairlist_get(attribs, "cite")); } else if (strcasecmp(name, "form") == 0) { output("form", pairlist_get(attribs, "method"), pairlist_get(attribs, "action")); } else if (strcasecmp(name, "frame") == 0) { output("frame", NULL, pairlist_get(attribs, "src")); } else if (strcasecmp(name, "iframe") == 0) { output("iframe", NULL, pairlist_get(attribs, "src")); } else if (strcasecmp(name, "head") == 0) { output("head", NULL, pairlist_get(attribs, "profile")); } else if (strcasecmp(name, "script") == 0) { output("script", NULL, pairlist_get(attribs, "src")); } else if (strcasecmp(name, "body") == 0) { output("body", NULL, pairlist_get(attribs, "background")); } else if (strcasecmp(name, "video") == 0) { output("video", NULL, pairlist_get(attribs, "src")); } else if (strcasecmp(name, "audio") == 0) { output("audio", NULL, pairlist_get(attribs, "src")); } else if (strcasecmp(name, "source") == 0) { output("source", NULL, pairlist_get(attribs, "srcset")); output("source", NULL, pairlist_get(attribs, "src")); } /* Free memory */ pairlist_delete(attribs); free(name); } /* handle_emptytag -- called after an empty tag is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { handle_starttag(clientdata, name, attribs); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { free(name); } /* --------------------------------------------------------------------- */ /* usage -- print usage message and exit */ static void usage(string progname) { fprintf(stderr, "Version %s\nUsage: %s [-l] [-r] [-h] [-b base] [-t] [-a] [HTML-file]\n", VERSION, progname); exit(1); } int main(int argc, char *argv[]) { int c, status = 200; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Parse command line arguments */ while ((c = getopt(argc, argv, "lb:rhta")) != -1) { switch (c) { case 'l': format = Long; break; /* Long listing */ case 'b': base = strdup(optarg); break; /* Set base of URL */ case 'r': relative = true; break; /* Do not make URLs absolute */ case 'h': format = HTML; break; /* Output in HTML format */ case 't': format = Tuple; break; /* Output as 4-tuples */ case 'a': ascii = true; break; /* Convert IRIs to URLs */ default: usage(argv[0]); } } if (optind == argc) { yyin = stdin; self = "-"; } else if (optind == argc - 1) { if (!base) base = strdup(argv[optind]); if (eq(argv[optind], "-")) yyin = stdin; else yyin = fopenurl(argv[optind], "r", &status); self = argv[optind]; } else { usage(argv[0]); } if (yyin == NULL) {perror(argv[optind]); exit(1);} if (status != 200) errexit("%s : %s\n", argv[optind], http_strerror(status)); if (yyparse() != 0) exit(3); if (base) free(base); return has_error ? 1 : 0; } html-xml-utils-7.7/hxnum.10000644000175000017500000000033713244022534012433 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXNUM" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxnum \- number section headings in an HTML file .SH SYNOPSIS [ToDo. Try num -?] html-xml-utils-7.7/hxcopy.c0000644000175000017500000002003713244022534012667 00000000000000/* hxcopy -- copy an HTML file and update relative URLs at the same time * * Copy an HTML file with all URLs that were relative to OLDURL * updated to be relative to NEWURL instead. (If the document has a * BASE element, only that is updated.) OLDURL and NEWURL may * themselves be relative (to the same base URL, which need not be * mentioned). * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * TO DO: Should it be an option whether URL references of the form * "", "#foo" and "?bar" are replaced by "oldurl", "oldurl#foo" and * "oldurl?bar"? (See adjust_url().) * * Created: 5 Dec 2008 * Author: Bert Bos * * Copyright © 2008-2012 W3C * See http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 */ #include "config.h" #include #include #include #include #include #include #if HAVE_STRING_H # include #endif #if HAVE_STRINGS_H # include #endif #include "export.h" #include "heap.e" #include "types.e" #include "html.e" #include "scan.e" #include "url.e" #include "dict.e" #include "openurl.e" #include "errexit.e" #define same(a, b) ((a) ? ((b) && eq((a), (b))) : !(b)) static bool has_errors = false; /* Enconutered errors during parsing */ static FILE *out = NULL; /* Where to write output */ static bool has_base = false; /* Document has a element */ static string newbase; /* Path from OLDURL to NEWURL */ static bool replace_self = false; /* Change link to self in link to old */ /* path_from_url_to_url -- compute URL that is path from one URL to another */ static string path_from_url_to_url(const conststring a, const conststring b) { URL p, q; string s = NULL; char cwd[4096]; int i, j; if (!getcwd(cwd, sizeof(cwd) - 1)) return NULL; /* To do: handle long path */ strcat(cwd, "/"); s = URL_s_absolutize(cwd, a); p = URL_new(s); dispose(s); s = URL_s_absolutize(cwd, b); q = URL_new(s); dispose(s); if (p->proto && !q->proto) { errno = EACCES; /* Path from remote to local not possible */ } else if (!same(p->proto, q->proto) || !same(p->user, q->user) || !same(p->password, q->password) || !same(p->machine, q->machine) || !same(p->port, q->port)) { s = newstring(b); /* Just use the URL b */ } else { /* Find the last '/' before which both paths are the same */ for (j = i = 0; p->path[i] && q->path[i] && p->path[i] == q->path[i]; i++) if (p->path[i] == '/') j = i; /* Construct path from a to b by descending a and climbing b */ for (i = j + 1; p->path[i]; i++) if (p->path[i] == '/') strapp(&s, "../", NULL); strapp(&s, q->path + j + 1, NULL); } URL_dispose(p); URL_dispose(q); return s; } /* adjust_url -- return a new URL relative to newurl instead of oldurl */ static conststring adjust_url(const conststring url) { if (!replace_self && (!url || !url[0] || url[0] == '#' || url[0] == '?')) return url; /* Don't replace references to self */ else return URL_s_absolutize(newbase, url); } /* attribute_is_url -- check if the attribute is URL-valued */ static bool attribute_is_url(const conststring attrib) { return strcasecmp(attrib, "href") == 0 || strcasecmp(attrib, "src") == 0 || strcasecmp(attrib, "action") == 0 || strcasecmp(attrib, "background") == 0 || strcasecmp(attrib, "cite") == 0 || strcasecmp(attrib, "classid") == 0 || strcasecmp(attrib, "codebase") == 0 || strcasecmp(attrib, "data") == 0 || strcasecmp(attrib, "longdesc") == 0 || strcasecmp(attrib, "profile") == 0 || strcasecmp(attrib, "usemap") == 0; } /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); has_errors = true; } /* start -- called before the first event is reported */ void* start(void) { return NULL; } /* end -- called after the last event is reported */ void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { fprintf(out, "", commenttext); } /* handle_text -- called after a text chunk is parsed */ void handle_text(void *clientdata, string text) { fprintf(out, "%s", text); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) { fprintf(out, ""); } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { fprintf(out, "", pi_text); } /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { conststring v; pairlist p; fprintf(out, "<%s", name); for (p = attribs; p; p = p->next) { fprintf(out, " %s", p->name); if (!p->value) v = NULL; else if (has_base) v = newstring(p->value); /* No need to adjust */ else if (attribute_is_url(p->name)) v = adjust_url(p->value); else v = newstring(p->value); /* No need to adjust */ if (v) fprintf(out, "=\"%s\"", v); dispose(v); } fprintf(out, ">"); /* If this is a tag, no further adjustments are needed */ if (strcasecmp(name, "base") == 0) has_base = true; } /* handle_emptytag -- called after an empty tag is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { conststring v; pairlist p; fprintf(out, "<%s", name); for (p = attribs; p; p = p->next) { fprintf(out, " %s", p->name); if (!p->value) v = NULL; else if (has_base) v = newstring(p->value); /* No need to adjust */ else if (attribute_is_url(p->name)) v = adjust_url(p->value); else v = newstring(p->value); /* No need to adjust */ if (v) fprintf(out, "=\"%s\"", v); dispose(v); } fprintf(out, " />"); /* If this is a tag, no further adjustments are needed */ if (strcasecmp(name, "base") == 0) has_base = true; } /* handle_endtag -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { fprintf(out, "", name); } /* usage -- print usage message and exit */ static void usage(const conststring progname) { fprintf(stderr, "Usage: %s [-v] [-s] [-i old-URL] [-o new-URL] [URL [URL]]\n", progname); exit(1); } int main(int argc, char *argv[]) { int c, status = 200; string oldurl = NULL, newurl = NULL; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Parse command line */ while ((c = getopt(argc, argv, "i:o:sv")) != -1) switch (c) { case 'o': newurl = optarg; break; case 'i': oldurl = optarg; break; case 's': replace_self = true; break; case 'v': printf("Version: %s %s\n", PACKAGE, VERSION); return 0; default: usage(argv[0]); } if (argc > optind + 2) usage(argv[0]); if (argc > optind + 1) out = fopenurl(argv[optind+1], "w", NULL); else if (newurl) out = stdout; else errexit("%s: option -o is required if output is to stdout\n", argv[0]); if (!out) {perror(argv[optind+1]); exit(3);} if (argc > optind) yyin = fopenurl(argv[optind], "r", &status); else if (oldurl) yyin = stdin; else errexit("%s: option -i is required if input is from stdin\n", argv[0]); if (!yyin) {perror(argv[optind]); exit(2);} if (status != 200) errexit("%s : %s\n", argv[1], http_strerror(status)); if (!oldurl) oldurl = argv[optind]; if (!newurl) newurl = argv[optind+1]; newbase = path_from_url_to_url(newurl, oldurl); if (!newbase) errexit("%s: could not parse argument as a URL\n", argv[0]); if (yyparse() != 0) exit(4); return has_errors ? 1 : 0; } html-xml-utils-7.7/hxtoc.c0000645000175000017500000003356313244022534012513 00000000000000/* * Insert an active ToC between "" and "", * or replacing the comment "" * * Headers with class "no-toc" will not be listed in the ToC. * * The ToC links to elements with ID attributes as well as with * empty elements. * * Tags for a with class "index" are assumed to be used by * a cross-reference generator and will not be copied to the ToC. * * Similarly, DFN tags are not copied to the ToC (but the element's * content is). * * Any tags with a class of "bctarget" are not copied, but * regenerated. They are assumed to be backwards-compatible versions * of ID attributes on their parent elements. With the option -t or -x * they are removed. * * Copyright © 1994-2013 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created Sep 1997 * Version: $Id: hxtoc.c,v 1.12 2017/11/24 09:50:25 bbos Exp $ * **/ #include "config.h" #include #include #include #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #ifdef HAVE_ERRNO_H # include #endif #ifdef HAVE_SEARCH_H # include #else # include "search-freebsd.h" #endif #include "export.h" #include "types.e" #include "heap.e" #include "tree.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" #include "genid.e" #include "class.e" #define BEGIN_TOC "begin-toc" /* */ #define END_TOC "end-toc" /* */ #define TOC "toc" /* */ #define NO_TOC "no-toc" /* CLASS="... no-toc..." */ #define INDEX "index" /* CLASS="... index..." */ #define TARGET "bctarget" /* CLASS="...bctarget..." */ #define EXPAND true #define NO_EXPAND false #define KEEP_ANCHORS true #define REMOVE_ANCHORS false #define DONT_FLATTEN false #define INDENT " " /* Amount to indent ToC per level */ static Tree tree; static int toc_low = 1, toc_high = 6; /* Which headers to include */ static bool xml = false; /* Use convention */ static bool bctarget = true; /* Generate after IDs */ static string toc_class = "toc"; /*
      */ static bool use_div = false; /* Option -d */ static bool do_flatten = false; /* Option -f */ /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) { tree = create(); return NULL; } /* end -- called after the last event is reported */ static void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, string commenttext) { tree = append_comment(tree, commenttext); } /* handle_text -- called after a tex chunk is parsed */ static void handle_text(void *clientdata, string text) { tree = append_text(tree, text); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *clientdata, string gi, string fpi, string url) { tree = append_declaration(tree, gi, fpi, url); } /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *clientdata, string pi_text) { tree = append_procins(tree, pi_text); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, string name, pairlist attribs) { conststring id; tree = html_push(tree, name, attribs); /* If it has an ID, store it (so we don't accidentally generate it) */ if ((id = pairlist_get(attribs, "id"))) storeID(id); } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, string name, pairlist attribs) { handle_starttag(clientdata, name, attribs); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, string name) { tree = html_pop(tree, name); } /* indent -- print level times a number of spaces */ static void indent(int level) { for (; level > 0; level--) printf(INDENT); } /* is_div -- t is a division (DIV, SECTION, ARTICLE, ASIDE or NAV) */ static bool is_div(Tree t) { assert(t->tp == Element); return eq(t->name, "div") || eq(t->name, "section") || /* HTML5 */ eq(t->name, "article") || /* HTML5 */ eq(t->name, "aside") || /* HTML5 */ eq(t->name, "nav"); /* HTML5 */ } /* heading_level -- return 1..6 if t is H1..H6, else 0 */ static int heading_level(Tree t) { assert(t->tp == Element); if (has_class(t->attribs, NO_TOC)) return 0; if (eq(t->name, "h1")) return 1; if (eq(t->name, "h2")) return 2; if (eq(t->name, "h3")) return 3; if (eq(t->name, "h4")) return 4; if (eq(t->name, "h5")) return 5; if (eq(t->name, "h6")) return 6; return 0; } /* div_parent -- if t is the first child of a section elt, return that elt */ static Tree div_parent(Tree t) { Tree h, result = NULL; assert(t->tp == Element); assert(t->parent); if (t->parent->tp != Element) return NULL; if (has_class(t->parent->attribs, NO_TOC)) return NULL; if (is_div(t->parent)) result = t->parent; else if (!eq(t->parent->name, "header")) return NULL; else if (!(result = div_parent(t->parent))) return NULL; for (h = t->parent->children; h != t; h = h->sister) { if (h->tp == Element) return NULL; if (h->tp == Text && !only_space(h->text)) return NULL; } return result; } /* first_child_is_heading -- true if first child is a Hn or HEADER */ static bool first_child_is_heading(Tree t) { Tree h; assert(t->tp == Element); for (h = t->children; h; h = h->sister) { switch (h->tp) { case Element: return eq(h->name, "header") || heading_level(h) > 0; case Text: if (!only_space(h->text)) return false; break; default: break; } } return false; } static void expand(Tree t, bool *write, bool exp, bool keep_anchors, int div_depth, bool flatten); /* toc -- create a table of contents */ static void toc(Tree t, int *curlevel, bool *item_is_open, int div_depth) { conststring val, id; int level; Tree h, div = NULL; bool write = true; switch (t->tp) { case Text: break; case Comment: break; case Declaration: break; case Procins: break; case Element: if (use_div && is_div(t) && first_child_is_heading(t)) { /* It's a section element with a heading as first child */ div_depth++; level = 0; } else { /* Check if the element is a heading and what its level is */ level = heading_level(t); if (level && use_div && (div = div_parent(t))) level = div_depth; } /* If it's a header for the ToC, create a list item for it */ if (level >= toc_low && level <= toc_high) { /* Ensure there is an ID to point to */ h = use_div && div ? div : t; if (! (id = get_attrib(h, "id"))) { id = gen_id(h); set_attrib(h, "id", id); } assert(*curlevel <= level || *item_is_open); while (*curlevel > level) { printf(xml ? "\n" : "\n"); indent(*curlevel - toc_low); printf("
    "); (*curlevel)--; } if (*curlevel == level && *item_is_open) { printf(xml ? "\n" : "\n"); } else if (*item_is_open) { printf("\n"); (*curlevel)++; indent(*curlevel - toc_low); printf("
      \n", toc_class); } while (*curlevel < level) { indent(*curlevel - toc_low); printf("
    • \n"); (*curlevel)++; indent(*curlevel - toc_low); printf("
        \n", toc_class); } indent(*curlevel - toc_low); if ((val = get_attrib(t, "class"))) { printf("
      • ", val, id); } else { printf("
      • ", id); } expand(t, &write, NO_EXPAND, REMOVE_ANCHORS, div_depth, do_flatten); printf(""); *item_is_open = true; } else { for (h = t->children; h != NULL; h = h->sister) toc(h, curlevel, item_is_open, div_depth); } break; case Root: for (h = t->children; h != NULL; h = h->sister) toc(h, curlevel, item_is_open, div_depth); break; default: assert(! "Cannot happen"); } } /* expand -- write the tree, inserting ID's at H* and inserting a toc */ static void expand(Tree t, bool *write, bool exp, bool keep_anchors, int div_depth, bool flatten) { conststring val; Tree h; pairlist a; conststring s; int level; bool item_is_open = false; for (h = t->children; h != NULL; h = h->sister) { switch (h->tp) { case Text: if (*write) printf("%s", h->text); break; case Comment: for (s = h->text; isspace(*s); s++) ; if (exp && (!strncmp(s, TOC, sizeof(TOC) - 1) || !strncmp(s, BEGIN_TOC, sizeof(BEGIN_TOC) - 1))) { printf("\n", BEGIN_TOC); printf("
          \n", toc_class); level = toc_low; toc(get_root(t), &level, &item_is_open, 1); while (level > toc_low) { printf(xml ? "\n" : "\n"); indent(level - toc_low); printf("
        "); level--; } if (item_is_open && xml) printf("
      • \n"); printf("
      \n"); printf("", END_TOC); if (!strncmp(s, BEGIN_TOC, sizeof(BEGIN_TOC) - 1)) *write = false; /* Suppress old ToC */ } else if (exp && !strncmp(s, END_TOC, sizeof(END_TOC) - 1)) { *write = true; } else { printf("", h->text); } break; case Declaration: printf("name); if (h->text) printf(" PUBLIC \"%s\"", h->text); if (h->url) printf(" %s\"%s\"", h->text ? "" : "SYSTEM ", h->url); printf(">"); break; case Procins: if (*write) printf("", h->text); break; case Element: if (use_div && is_div(h) && first_child_is_heading(h)) { /* It's a section element with a heading as first child */ div_depth++; level = div_depth; } else { /* Check if the element is a heading and what its level is */ level = heading_level(h); if (level && use_div && div_parent(h)) level = 0; } /* Give DIVs and headers an ID, if they need one */ if (level >= toc_low && level <= toc_high) { if (!get_attrib(h, "id")) set_attrib(h, "id", gen_id(h)); } if (*write) { if (flatten && ((s = get_attrib(h, "alt")))) { /* Flatten: use ALT attribute instead of element */ printf("%s", s); } else if (flatten && !eq(h->name, "bdo") && ((s = get_attrib(h, "dir")))) { /* Flatten: keep DIR attributes */ printf("", s); expand(h, write, exp, false, div_depth, flatten); printf(""); } else if (flatten && !eq(h->name, "bdo")) { /* Flatten: remove all elements except BDO */ expand(h, write, exp, false, div_depth, flatten); } else if (! keep_anchors && eq(h->name, "a")) { /* Don't write the and tags */ expand(h, write, exp, false, div_depth, flatten); } else if (! keep_anchors && eq(h->name, "span") && has_class(h->attribs, INDEX)) { /* Don't write ... tags */ expand(h, write, exp, false, div_depth, flatten); } else if (! keep_anchors && eq(h->name, "dfn")) { /* Don't copy dfn tags to the ToC */ expand(h, write, exp, false, div_depth, flatten); } else if (eq(h->name, "a") && (has_class(h->attribs, TARGET) || has_class(h->attribs, TOC))) { /* This was inserted by toc itself; remove it */ expand(h, write, exp, false, div_depth, flatten); } else { printf("<%s", h->name); for (a = h->attribs; a != NULL; a = a->next) { if (keep_anchors || !eq(a->name, "id")) { /* If we don't keep anchors, we don't keep IDs either */ printf(" %s", a->name); if (a->value != NULL) printf("=\"%s\"", a->value); } } if (is_empty(h->name)) { assert(h->children == NULL); printf(xml ? " />" : ">"); } else { printf(">"); /* Insert an if element has an ID and is not */ if (bctarget && is_mixed(h->name) && (val = get_attrib(h, "id")) && !eq(h->name, "a") && ! xml) printf("", TARGET, val); expand(h, write, exp, keep_anchors, div_depth, flatten); printf("", h->name); } } } break; case Root: assert(! "Cannot happen"); break; default: assert(! "Cannot happen"); } } } /* usage -- print usage message and exit */ static void usage(string name) { errexit("Version %s\nUsage: %s [-l low] [-h high] [-x] [-t] [-d] [-c class] [html-file]\n", VERSION, name); } int main(int argc, char *argv[]) { int c, status; bool write = true; while ((c = getopt(argc, argv, "l:h:xtdc:f")) != -1) { switch (c) { case 'l': toc_low = atoi(optarg); break; case 'h': toc_high = atoi(optarg); break; case 'x': xml = true; break; case 't': bctarget = false; break; case 'd': use_div = true; break; case 'c': toc_class = newstring(optarg); break; case 'f': do_flatten = true; break; default: usage(argv[0]); } } if (toc_low < 1) toc_low = 1; if (toc_high > 6) toc_high = 6; if (argc > optind + 1) { usage(argv[0]); } else if (optind >= argc || eq(argv[optind], "-")) { yyin = stdin; } else if (!(yyin = fopenurl(argv[optind], "r", &status))) { perror(argv[optind]); exit(2); } else if (status != 200) { errexit("%s : %s\n", argv[optind], http_strerror(status)); } /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); if (yyparse() != 0) exit(3); tree = get_root(tree); expand(tree, &write, EXPAND, KEEP_ANCHORS, 1, DONT_FLATTEN); #if 0 tree_delete(tree); /* Just to test memory mgmt */ #endif return 0; } html-xml-utils-7.7/hxextract.c0000645000175000017500000001605413244022534013374 00000000000000/* * Output all elements with a certain name and/or class. * Input must be well-formed, since no HTML heuristics are applied. * * Copyright © 2000-2012 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 20 Aug 2000 * Version: $Id: hxextract.c,v 1.7 2017/11/24 09:50:25 bbos Exp $ */ #include "config.h" #include #include #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #include "export.h" #include "types.e" #include "html.e" #include "heap.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "class.e" #define INDEX "index" /* CLASS="... index..." */ #define MAXLINELEN 1024 /* In configfile */ static bool xml = false; /* Use convention */ static int copying = 0; /* Start by not copying */ static string base = NULL; /* URL of each file */ static string endtext = ""; /* Text to insert at end */ static string targetelement = NULL; /* Element to extract */ static string targetclass = NULL; /* Class to extract */ /* add_href -- add an "href" attribute to a list of attributes */ static void add_href(pairlist *attribs, const string base, const conststring id) { string h = NULL; pairlist_set(attribs, "href", strapp(&h, base, "#", id, NULL)); free(h); } /* handle_error -- called when a parse error occurred */ static void handle_error(void *unused, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) {return NULL;} /* end -- called after the last event is reported */ static void end(void *unused) {} /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *unused, const string commenttext) {} /* handle_text -- called after a text chunk is parsed */ static void handle_text(void *unused, const string text) { if (copying > 0) fputs(text, stdout); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *unused, const string gi, const string fpi, const string url) {} /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *unused, const string pi_text) {} /* print_tag -- print a start- or empty tag */ static void print_tag(const string name, pairlist attribs, bool empty) { pairlist a; conststring t, h; printf("<%s", name); for (a = attribs; a != NULL; a = a->next) { printf(" %s", a->name); if (strcasecmp(a->name, "class") == 0 && (t = contains(a->value, INDEX))) { /* Print value excluding INDEX */ printf("=\""); for (h = a->value; h != t; h++) putchar(*h); printf("%s\"", t + sizeof(INDEX) - 1); } else { if (a->value) printf("=\"%s\"", a->value); } } printf((empty && xml) ? " />" : ">"); } /* is_match check whether the element matches the target element and class */ static bool is_match(const string name, pairlist attribs) { return ((!targetelement || strcasecmp(name, targetelement) == 0) && (!targetclass || has_class(attribs, targetclass))); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *unused, const string name, pairlist attribs) { conststring id; if (copying || is_match(name, attribs)) { if (!copying && (id = pairlist_get(attribs, "id"))) add_href(&attribs, base, id); if (!eq(name, "a") && !eq(name, "A")) print_tag(name, attribs, false); copying++; } } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *unused, const string name, pairlist attribs) { conststring id; if (copying || is_match(name, attribs)) { if (!copying && (id = pairlist_get(attribs, "id"))) add_href(&attribs, base, id); if (!eq(name, "a") && !eq(name, "A")) print_tag(name, attribs, true); } } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *unused, const string name) { if (copying) { if (!eq(name, "a") && !eq(name, "A")) printf("", name); copying--; } } /* process_configfile -- read @chapter lines from config file */ static void process_configfile(const string configfile) { char line[MAXLINELEN], chapter[MAXLINELEN]; FILE *f; if (! (f = fopenurl(configfile, "r", NULL))) {perror(configfile); exit(2);} /* ToDo: accept quoted file names with spaces in their name */ while (fgets(line, sizeof(line), f)) { if (sscanf(line, " @chapter %s", chapter) == 1) { if (!base) base = chapter; yyin = fopenurl(chapter, "r", NULL); if (yyin == NULL) {perror(chapter); exit(2);} if (yyparse() != 0) exit(3); fclose(yyin); base = NULL; } } fclose(f); } /* usage -- print usage message and exit */ static void usage(const string name) { fprintf(stderr, "Usage: %s [-v] [-x] [-s text] [-e text] [-b base] element-or-class [-c configfile | file-or-URL]...\n", name); exit(1); } int main(int argc, char *argv[]) { char *p; int i; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Loop over arguments; options may be in between file names */ for (i = 1; i < argc; i++) { if (eq(argv[i], "-h") || eq(argv[i], "-?")) { /* Usage */ usage(argv[0]); } else if (eq(argv[i], "-x")) { /* XML format */ xml = true; } else if (eq(argv[i], "-s")) { /* Insert text at start */ printf("%s", argv[++i]); } else if (eq(argv[i], "-e")) { /* Insert text at end */ endtext = argv[++i]; } else if (eq(argv[i], "-b")) { /* URL base */ base = argv[++i]; } else if (eq(argv[i], "-c")) { /* Config file */ process_configfile(argv[++i]); } else if (eq(argv[i], "-v")) { printf("Version: %s %s\n", PACKAGE, VERSION); return 0; } else if (eq(argv[i], "-")) { /* "-" = stdin */ if (!base) base = ""; yyin = stdin; if (yyparse() != 0) exit(3); base = NULL; /* Reset base */ } else if (targetelement || targetclass) { /* It's a file name or URL */ if (!base) base = argv[i]; yyin = fopenurl(argv[i], "r", NULL); if (yyin == NULL) {perror(argv[i]); exit(2);} if (yyparse() != 0) exit(3); fclose(yyin); base = NULL; } else if (argv[i][0] == '.') { /* Class name */ targetclass = argv[i] + 1; } else { /* Element name */ targetelement = argv[i]; if ((p = strchr(targetelement, '.'))) { *p = '\0'; targetclass = p + 1; } } } if (!targetelement && !targetclass) usage(argv[0]); printf("%s", endtext); /* Insert text at end */ return 0; } html-xml-utils-7.7/install-sh0000755000175000017500000003325513244022534013223 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # 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 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: html-xml-utils-7.7/selmatch.e0000644000175000017500000000034013244022534013152 00000000000000extern void init_language(const conststring lang); extern void set_case_insensitive(void); extern _Bool same(const string a, const string b); extern _Bool matches_sel(const Tree t, const Selector s); html-xml-utils-7.7/hxcount.c0000645000175000017500000001051113244022534013042 00000000000000/* * Count elements and attributes. * * This counts occurrences of elements and element/attribute pairs. * This is just an example of how to use the parser. * No attempt is made to count efficiently. * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Bert Bos * Created Nov 1998 * $Id: hxcount.c,v 1.5 2017/11/24 09:50:25 bbos Exp $ */ #include "config.h" #include #ifdef HAVE_UNISTD_H # include #endif #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRdup # include "strdup.e" # endif #endif #include #include #include #include "export.h" #include "types.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" typedef struct _pair { char *name; int count; } pair; static pair *freq = NULL; static int nrelems = 0; static bool has_errors = false; /* countstring -- add 1 to number of occurences for s (case-insensitively) */ static void countstring(char *s) { int i; i = 0; while (i < nrelems && strcasecmp(freq[i].name, s) != 0) i++; if (i == nrelems) { nrelems++; freq = realloc(freq, nrelems * sizeof(freq[0])); if (freq == NULL) {fprintf(stderr, "Out of memory\n"); exit(4);} freq[i].name = strdup(s); freq[i].count = 0; } freq[i].count++; } /* count -- count element types and their attributes */ static void count(char *name, pairlist attribs) { /* Count element name */ countstring(name); /* Count attribute names (or rather, the strings "elem/attrib") */ for (; attribs != NULL; attribs = attribs->next) { char *s = malloc(strlen(name) + strlen(attribs->name) + 2); if (s == NULL) {fprintf(stderr, "Out of memory\n"); exit(4);} strcat(strcat(strcpy(s, name), "/"), attribs->name); countstring(s); free(s); } } /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); has_errors = true; } /* start -- called before the first event is reported */ void* start(void) {return NULL;} /* end -- called after the last event is reported */ void end(void *clientdata) {} /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) {} /* handle_text -- called after a tex chunk is parsed */ void handle_text(void *clientdata, string text) {} /* handle_declaration -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) {} /* handle_proc_instr -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) {} /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { count(name, attribs); } /* handle_emptytag -- called after am empty tag is parsed */ extern void handle_emptytag(void *clientdata, string name, pairlist attribs) { count(name, attribs); } /* handle_pop -- called after an endtag is parsed (name may be "") */ extern void handle_endtag(void *clientdata, string name) {} /* usage -- print usage message and exit */ static void usage(string prog) { fprintf(stderr, "Version %s\n", VERSION); fprintf(stderr, "Usage: %s [html-file]\n", prog); exit(2); } /* main -- parse input, count elements and attributes of each type */ int main(int argc, char *argv[]) { int i, status = 200; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); if (argc == 1) yyin = stdin; else if (argc == 2) yyin = fopenurl(argv[1], "r", &status); else usage(argv[0]); if (yyin == NULL) {perror(argv[1]); exit(1);} if (status != 200) errexit("%s : %s\n", argv[1], http_strerror(status)); /* Parse input */ if (yyparse() != 0) exit(3); /* Print results */ for (i = 0; i < nrelems; i++) printf("%6d\t%s\n", freq[i].count, freq[i].name); return has_errors ? 1 : 0; } html-xml-utils-7.7/strdup.c0000645000175000017500000000105113244022534012672 00000000000000/* * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 31 Mar 2000 * Version: $Id: strdup.c,v 1.4 2017/11/24 09:50:25 bbos Exp $ **/ #include "config.h" #include #include "export.h" #ifndef HAVE_STRDUP /* strdup -- allocate a copy of a string on the heap; NULL if no memory */ EXPORT char *strdup(const char *s) { char *t; if ((t = malloc((strlen(s) + 1) * sizeof(*s)))) strcpy(t, s); return t; } #endif /* HAVE_STRDUP */ html-xml-utils-7.7/headers.e0000644000175000017500000000011113244022534012761 00000000000000extern _Bool read_mail_headers(FILE *f, Dictionary headers); html-xml-utils-7.7/README0000645000175000017500000000704313244022534012074 00000000000000In this directory: html-xml-utils-*.tar.gz A number of simple utilities for manipulating HTML and XML files. See INSTALL for generic installation instructions. Get the source at: http://www.w3.org/Tools/HTML-XML-utils/ htmlutils-*.tar.gz Old versions (before version 0.1) Note 1: Your package manager may have a precompiled copy already. There are versions in Debian, Ubuntu, Macports and others. In that case you need to download from here only if you want a different version or want to hack on the source. Note 2: the names changed in version 5.0: most programs got an "hx" prefix. Please, uninstall any version < 5.0 before installing a version >= 5.0 cexport (1) - create headerfile of exported declarations from a C file hxaddid (1) - add ID's to selected elements hxcite (1) - replace bibliographic references by hyperlinks hxcite-mkbib (1) - expand references and create bibliography hxcopy (1) - copy an HTML file while preserving relative links hxcount (1) - count elements and attributes in HTML or XML files hxextract (1) - extract selected elements hxclean (1) - apply heuristics to correct an HTML file hxprune (1) - remove marked elements from an HTML file hxincl (1) - expand included HTML or XML files hxindex (1) - create an alphabetically sorted index hxmkbib (1) - create bibliography from a template hxmultitoc (1) - create a table of contents for a set of HTML files hxname2id - move some ID= or NAME= from A elements to their parents hxnormalize (1) - pretty-print an HTML file hxnum (1) - number section headings in an HTML file hxpipe (1) - convert XML to a format easier to parse with Perl or AWK hxprintlinks (1) - number links & add table of URLs at end of an HTML file hxremove (1) - remove selected elements from an XML file hxtabletrans (1) - transpose an HTML or XHTML table hxtoc (1) - insert a table of contents in an HTML file hxuncdata (1) - replace CDATA sections by character entities hxunent (1) - replace HTML predefined character entities to UTF-8 hxunpipe (1) - convert output of pipe back to XML format hxunxmlns (1) - replace "global names" by XML Namespace prefixes hxwls (1) - list links in an HTML file hxxmlns (1) - replace XML Namespace prefixes by "global names" asc2xml, xml2asc (1) - convert between UTF8 and &#nnn; entities hxref (1) - generate cross-references hxselect (1) - extract elements that match a (CSS) selector This package is configured with automake/autoconf. Generic instructions are in the file INSTALL. Here are some specific problems that may arise: 1) Error when running lex: lex scan.l && mv lex.yy.c scan.c "scan.l":line 2: Error: missing translation value The scan.l file uses features of flex that do not exist in lex. However, it is not necessary to run lex, since the file scan.c is provided in the package. Just do a "touch scan.c" to make sure "make" will not try to generate it anew. 2) Warning about "libidn not found": Without libidn2 or libidn, hxwls will not be able to translate Internationalized Domain Names to ASCII (option -a). You can install either libidn2 or libidn. If you install them in a non-standard location, use --with-libidn2 or --with-libidn when invoking ./configure. E.g., if you install libidn from MacPorts on Mac OS X, run: ./configure --with-libidn=/opt/local $Date: 2016/04/14 00:42:15 $ html-xml-utils-7.7/scan.c0000644000175000017500000023664513271372416012326 00000000000000 #line 3 "scan.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ /* TODO: this is always defined, so inline it */ #define yyconst const #if defined(__GNUC__) && __GNUC__ >= 3 #define yynoreturn __attribute__((__noreturn__)) #else #define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr yytext static yyconst flex_int16_t yy_nxt[][39] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 13, 14, 14, 15, 16, 14, 14, 14, 14, 14, 14, 14, 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18 }, { 13, 14, 14, 15, 16, 14, 14, 14, 14, 14, 14, 14, 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18 }, { 13, 19, 20, 21, 22, 19, 19, 19, 23, 23, 24, 23, 25, 26, 27, 19, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 23, 23, 23, 23, 23, 23, 23, 23, 28, 19, 23, 23, 23 }, { 13, 19, 20, 21, 22, 19, 19, 19, 23, 23, 24, 23, 25, 26, 27, 19, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 23, 23, 23, 23, 23, 23, 23, 23, 28, 19, 23, 23, 23 }, { 13, 29, 30, 31, 32, 29, 33, 34, 29, 29, 29, 29, 19, 29, 19, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 }, { 13, 29, 30, 31, 32, 29, 33, 34, 29, 29, 29, 29, 19, 29, 19, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 }, { 13, 19, 35, 36, 37, 19, 38, 39, 40, 40, 19, 40, 19, 19, 41, 19, 40, 40, 40, 40, 40, 40, 40, 40, 19, 19, 40, 40, 40, 40, 40, 40, 40, 40, 42, 19, 40, 40, 40 }, { 13, 19, 35, 36, 37, 19, 38, 39, 40, 40, 19, 40, 19, 19, 41, 19, 40, 40, 40, 40, 40, 40, 40, 40, 19, 19, 40, 40, 40, 40, 40, 40, 40, 40, 42, 19, 40, 40, 40 }, { 13, 14, 14, 15, 16, 14, 14, 14, 14, 14, 14, 14, 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }, { 13, 14, 14, 15, 16, 14, 14, 14, 14, 14, 14, 14, 17, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }, { 13, 43, 43, 44, 43, 43, 43, 43, 43, 43, 43, 43, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { 13, 43, 43, 44, 43, 43, 43, 43, 43, 43, 43, 43, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13 }, { 13, 46, 46, -14, -14, 46, 46, 46, 46, 46, 46, 46, -14, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46 }, { 13, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15 }, { 13, -16, -16, 47, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16 }, { 13, -17, -17, -17, -17, 48, -17, -17, 49, 49, 50, 49, -17, -17, -17, 51, 49, 49, 49, 49, 49, 49, 49, 49, -17, -17, 49, 49, 49, 49, 49, 49, 49, 49, 52, -17, 49, 49, 49 }, { 13, 46, 46, -18, -18, 46, 46, 46, 46, 46, 46, 46, -18, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 53, 46, 46 }, { 13, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19 }, { 13, -20, 54, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20 }, { 13, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21 }, { 13, -22, -22, 55, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22 }, { 13, -23, -23, -23, -23, -23, -23, -23, 56, 56, -23, 56, -23, -23, -23, -23, 56, 56, 56, 56, 56, 56, 56, 56, -23, -23, 56, 56, 56, 56, 56, 56, 56, 56, -23, -23, 56, 56, 56 }, { 13, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, 57, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24 }, { 13, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25 }, { 13, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26 }, { 13, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27 }, { 13, 58, -28, -28, -28, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, 58, 58, 58 }, { 13, 60, -29, -29, -29, 60, -29, -29, 60, 60, 60, 60, -29, 60, -29, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 }, { 13, -30, 61, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30 }, { 13, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31 }, { 13, -32, -32, 62, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32 }, { 13, 63, 63, 63, 63, 63, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 }, { 13, 65, 65, 65, 65, 65, 65, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 }, { 13, -35, 67, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35 }, { 13, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36 }, { 13, -37, -37, 68, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37 }, { 13, 69, 69, 69, 69, 69, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69 }, { 13, 71, 71, 71, 71, 71, 71, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71 }, { 13, -40, -40, -40, -40, -40, -40, -40, 73, 73, -40, 73, -40, -40, -40, -40, 73, 73, 73, 73, 73, 73, 73, 73, -40, -40, 73, 73, 73, 73, 73, 73, 73, 73, -40, -40, 73, 73, 73 }, { 13, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41 }, { 13, 74, -42, -42, -42, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 74, 74, 74 }, { 13, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76 }, { 13, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76 }, { 13, 76, 76, 76, 76, 76, 76, 76, 76, 76, 78, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76 }, { 13, 46, 46, -46, -46, 46, 46, 46, 46, 46, 46, 46, -46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46 }, { 13, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47 }, { 13, -48, -48, -48, -48, -48, -48, -48, 79, -48, -48, -48, -48, -48, -48, -48, -48, -48, 80, -48, -48, -48, -48, -48, 81, -48, -48, -48, 80, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48 }, { 13, -49, -49, -49, -49, -49, -49, -49, 49, 49, -49, 49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, -49, -49, 49, 49, 49 }, { 13, -50, -50, -50, -50, -50, -50, -50, 82, 82, -50, 82, -50, -50, -50, -50, 82, 82, 82, 82, 82, 82, 82, 82, -50, -50, 82, 82, 82, 82, 82, 82, 82, 82, 83, -50, 82, 82, 82 }, { 13, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84 }, { 13, 86, -52, -52, -52, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 86, 86, 86 }, { 13, 46, 46, -53, -53, 46, 46, 46, 46, 46, 46, 46, -53, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 88, 46 }, { 13, -54, 54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54 }, { 13, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55 }, { 13, -56, -56, -56, -56, -56, -56, -56, 56, 56, -56, 56, -56, -56, -56, -56, 56, 56, 56, 56, 56, 56, 56, 56, -56, -56, 56, 56, 56, 56, 56, 56, 56, 56, -56, -56, 56, 56, 56 }, { 13, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57 }, { 13, 58, -58, -58, -58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, 58, 58, 58 }, { 13, -59, -59, -59, -59, -59, -59, -59, 56, 56, -59, 56, -59, -59, -59, -59, 56, 56, 56, 56, 56, 56, 56, 56, -59, -59, 56, 56, 56, 56, 56, 56, 56, 56, -59, -59, 56, 56, 56 }, { 13, 60, -60, -60, -60, 60, -60, -60, 60, 60, 60, 60, -60, 60, -60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 }, { 13, -61, 61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61 }, { 13, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62 }, { 13, 63, 63, 63, 63, 63, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 }, { 13, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64 }, { 13, 65, 65, 65, 65, 65, 65, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 }, { 13, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66 }, { 13, -67, 67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67 }, { 13, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68 }, { 13, 69, 69, 69, 69, 69, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69 }, { 13, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70 }, { 13, 71, 71, 71, 71, 71, 71, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71 }, { 13, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72 }, { 13, -73, -73, -73, -73, -73, -73, -73, 73, 73, -73, 73, -73, -73, -73, -73, 73, 73, 73, 73, 73, 73, 73, 73, -73, -73, 73, 73, 73, 73, 73, 73, 73, 73, -73, -73, 73, 73, 73 }, { 13, 74, -74, -74, -74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 74, 74, 74 }, { 13, -75, -75, -75, -75, -75, -75, -75, 73, 73, -75, 73, -75, -75, -75, -75, 73, 73, 73, 73, 73, 73, 73, 73, -75, -75, 73, 73, 73, 73, 73, 73, 73, 73, -75, -75, 73, 73, 73 }, { 13, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76 }, { 13, 76, 76, 76, 76, 76, 76, 76, 76, 76, 89, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76 }, { 13, 76, 76, 76, 76, 76, 76, 76, 90, 90, 76, 91, 76, 76, 76, 76, 91, 91, 91, 91, 91, 91, 91, 91, 76, 76, 90, 90, 90, 90, 90, 90, 90, 90, 92, 76, 91, 91, 91 }, { 13, -79, -79, -79, -79, -79, -79, -79, 93, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79 }, { 13, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 94, -80, -80, -80, -80, -80, -80, -80, -80, -80, 94, -80, -80, -80, -80, -80, -80, -80, -80 }, { 13, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, 95, -81, -81, -81, -81, -81, -81, -81, -81, -81, 95, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81 }, { 13, -82, -82, -82, -82, -82, -82, -82, 82, 82, -82, 82, -82, -82, -82, -82, 82, 82, 82, 82, 82, 82, 82, 82, -82, -82, 82, 82, 82, 82, 82, 82, 82, 82, -82, -82, 82, 82, 82 }, { 13, 96, -83, -83, -83, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 96, 96, 96 }, { 13, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84 }, { 13, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85 }, { 13, 86, -86, -86, -86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 86, 86, 86 }, { 13, -87, -87, -87, -87, -87, -87, -87, 49, 49, -87, 49, -87, -87, -87, -87, 49, 49, 49, 49, 49, 49, 49, 49, -87, -87, 49, 49, 49, 49, 49, 49, 49, 49, -87, -87, 49, 49, 49 }, { 13, 46, 46, -88, -88, 46, 46, 46, 46, 46, 46, 46, -88, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46 }, { 13, 76, 76, 76, 76, 76, 76, 76, -89, -89, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, -89, -89, -89, -89, -89, -89, -89, -89, -89, 76, 76, 76, 76 }, { 13, -90, -90, -90, -90, -90, -90, -90, 90, 90, -90, 90, -90, -90, -90, -90, 90, 90, 90, 90, 90, 90, 90, 90, -90, -90, 90, 90, 90, 90, 90, 90, 90, 90, -90, -90, 90, 90, 90 }, { 13, 76, 76, 76, 76, 76, 76, 76, 91, 91, 76, 91, 77, 76, 76, 76, 91, 91, 91, 91, 91, 91, 91, 91, 76, 76, 91, 91, 91, 91, 91, 91, 91, 91, 76, 76, 91, 91, 91 }, { 13, 98, -92, -92, -92, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 98, 98, 98 }, { 13, 100, 100, 100, 100, 100, 100, 100, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 13, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 102, -94, -94, -94, -94, -94, -94, -94, -94, -94, 102, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94 }, { 13, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 103, -95, -95, -95, -95, -95, -95, -95, -95, -95, 103, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95 }, { 13, 96, -96, -96, -96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 96, 96, 96 }, { 13, -97, -97, -97, -97, -97, -97, -97, 82, 82, -97, 82, -97, -97, -97, -97, 82, 82, 82, 82, 82, 82, 82, 82, -97, -97, 82, 82, 82, 82, 82, 82, 82, 82, -97, -97, 82, 82, 82 }, { 13, 98, -98, -98, -98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 98, 98, 98 }, { 13, -99, -99, -99, -99, -99, -99, -99, 90, 90, -99, 90, -99, -99, -99, -99, 90, 90, 90, 90, 90, 90, 90, 90, -99, -99, 90, 90, 90, 90, 90, 90, 90, 90, -99, -99, 90, 90, 90 }, { 13, 100, 100, 100, 100, 100, 100, 100, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 13, 100, 100, 100, 100, 100, 100, 100, 104, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 13, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 105, -102, -102, -102, -102, -102, -102, -102, -102, -102, 105, -102, -102, -102, -102, -102, -102 }, { 13, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, 106, -103, -103, -103, -103, -103, -103, -103, -103, -103, 106, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103 }, { 13, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 107, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 13, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, 108, -105, -105, -105, -105, -105, -105, -105, -105, -105, 108, -105, -105, -105, -105, -105 }, { 13, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, 109, -106, -106, -106, -106, -106, -106, -106, -106, -106, 109, -106, -106, -106, -106, -106, -106 }, { 13, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107 }, { 13, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, 110, -108, -108, -108, -108, -108, -108, -108, -108, -108, 110, -108, -108, -108, -108, -108, -108, -108 }, { 13, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, 111, -109, -109, -109, -109, -109, -109, -109, -109, -109, 111, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109 }, { 13, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 112, -110, -110, -110, -110, -110, -110, -110, -110, -110, 112, -110, -110, -110, -110, -110, -110, -110, -110, -110 }, { 13, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, 113, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111 }, { 13, -112, 114, 114, 114, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112 }, { 13, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115 }, { 13, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114 }, { 13, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115 }, { 13, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 117, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115 }, { 13, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 118, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115 }, { 13, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118 }, } ; static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yynoreturn yy_fatal_error (yyconst char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 32 #define YY_END_OF_BUFFER 33 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[119] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 29, 33, 4, 6, 6, 10, 4, 31, 13, 14, 14, 11, 31, 17, 12, 15, 31, 20, 18, 19, 19, 31, 31, 24, 25, 25, 31, 31, 23, 28, 31, 29, 29, 31, 4, 6, 0, 2, 3, 0, 0, 4, 13, 14, 11, 16, 0, 0, 20, 18, 19, 0, 21, 0, 22, 24, 25, 0, 26, 0, 27, 23, 0, 0, 29, 0, 0, 0, 0, 0, 3, 0, 0, 9, 0, 0, 1, 0, 30, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 5 } ; static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 6, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 9, 1, 12, 13, 14, 15, 1, 16, 11, 17, 18, 19, 11, 11, 11, 11, 11, 11, 11, 11, 11, 20, 21, 11, 11, 11, 22, 11, 11, 11, 11, 23, 11, 24, 1, 25, 1, 9, 1, 26, 9, 27, 28, 29, 9, 9, 9, 9, 9, 9, 9, 9, 9, 30, 31, 9, 9, 9, 32, 9, 9, 9, 9, 33, 9, 34, 1, 35, 1, 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 36, 11, 11, 11, 37, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 38, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "scan.l" /* %option yylineno */ #line 5 "scan.l" /* * Copyright © 1997-2017 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 1997 **/ #include "config.h" #include #if HAVE_STRING_H # include #elif HAVE_STRINGS_H # include #endif #if !HAVE_STRDUP # include "strdup.e" #endif #include #include #include #include "export.h" #include "types.e" #include "heap.e" #include "html.h" #include "html.e" #include "errexit.e" EXPORT extern FILE *yyin; string yyin_name = NULL; string cur_cdata_element = NULL; typedef struct _Stack { YY_BUFFER_STATE buf; FILE *f; string name; struct _Stack *next; } *Stack; static Stack stack = NULL; /* set_yyin -- routine to set yyin and store its file name */ EXPORT void set_yyin(FILE *f, const conststring name) { yyin = f; free(yyin_name); yyin_name = newstring(name); } /* get_yyin_name -- return the name of the current input, if known */ EXPORT conststring get_yyin_name(void) { return yyin_name; } /* include_file -- stack current file and switch to another one */ EXPORT void include_file(FILE *f, const conststring name) { Stack h; new(h); h->buf = YY_CURRENT_BUFFER; h->f = f; h->name = yyin_name; h->next = stack; stack = h; yyin_name = newstring(name); yy_switch_to_buffer(yy_create_buffer(f,YY_BUF_SIZE)); } /* pop_file -- back to previous input file */ static bool pop_file(void) { Stack h; if (!stack) { return false; } else { h = stack; yy_delete_buffer(YY_CURRENT_BUFFER); fclose(h->f); free(yyin_name); yyin_name = h->name; yy_switch_to_buffer(h->buf); stack = h->next; dispose(h); return true; } } /* esc -- remove outer quotes, escape ", remove \n, return malloc'ed string */ static string esc(string s) { int i, j; string u; /* Find new length */ for (i = 0, j = 1; s[j] != s[0]; i++, j++) { if (s[j] == '"' || s[j] == '<' || s[j] == '>') i+= 4; } /* Copy and expand */ u = malloc(i + 1); if (!u) errexit("Out of memory\n"); for (i = 0, j = 1; s[j] != s[0]; i++, j++) { if (s[j] == '"') {strcpy(u + i, """); i += 4;} else if (s[j] == '<') {strcpy(u + i, "<"); i += 4;} else if (s[j] == '>') {strcpy(u + i, ">"); i += 4;} else if (s[j] == '\n') u[i] = ' '; /* \n */ else if (s[j] == '\r' && s[j+1] == '\n') {u[i] = ' '; j++;} /* \r\n */ else if (s[j] == '\r') {u[i] = ' ';} /* \r */ else u[i] = s[j]; } u[i] = '\0'; return u; } #ifndef HAVE_STRNDUP /* strndup -- allocate a string, copy n characters into it and add \0 */ static string strndup(const string s, size_t n) { string t = malloc(n + 1); if (!t) errexit("Out of memory\n"); strncpy(t, s, n); t[n] = '\0'; return t; } #else # ifndef strndup /* We know strndup() exists (HAVE_STRNDUP) and it is not defined as a macro (!strndup), but older versions of string.h do not provide the declaration, so let's declare it here to be sure. */ extern char *strndup(const char *s, size_t n); # endif #endif /* lns -- count newlines */ static void lns(const string t) { string s = t; while (*s) { if (*s == '\n') lineno++; else if (*s != '\r') ; else if (*(s+1) == '\n') {lineno++; s++;} else lineno++; s++; } } /* thing is rather too permissive, but it will accept ... */ #line 1485 "scan.c" #define INITIAL 0 #define MARKUP 1 #define VALUE 2 #define DECL 3 #define INIT 4 #define CDATA 5 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); void yyset_in (FILE * _in_str ); FILE *yyget_out (void ); void yyset_out (FILE * _out_str ); int yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); void yyset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } { #line 177 "scan.l" #line 1710 "scan.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } ++yy_cp; } yy_current_state = -yy_current_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos) + 1; yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 180 "scan.l" {BEGIN(INIT); /* Byte Order Mark is ignored */} YY_BREAK case 2: YY_RULE_SETUP #line 182 "scan.l" {BEGIN(MARKUP); yylval.s=strdup(yytext+1); return START;} YY_BREAK case 3: YY_RULE_SETUP #line 183 "scan.l" {BEGIN(MARKUP); yylval.s=strdup(yytext+2); return END;} YY_BREAK case 4: YY_RULE_SETUP #line 184 "scan.l" {yylval.s=strdup(yytext); return TEXT;} YY_BREAK case 5: /* rule 5 can match eol */ YY_RULE_SETUP #line 185 "scan.l" {yylval.s=strdup(yytext); lns(yytext); return TEXT;} YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP #line 186 "scan.l" {yylval.s=strdup(yytext); lineno++; return TEXT;} YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP #line 187 "scan.l" {yylval.s=strndup(yytext+4,yyleng-7); lns(yytext); return COMMENT;} YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP #line 188 "scan.l" {BEGIN(DECL); lns(yytext+9); return DOCTYPE;} YY_BREAK case 9: /* rule 9 can match eol */ YY_RULE_SETUP #line 189 "scan.l" {yylval.s=strndup(yytext+2,yyleng-3); lns(yytext); return PROCINS;} YY_BREAK case 10: YY_RULE_SETUP #line 190 "scan.l" {yylval.s=strdup("<"); return TEXT;} YY_BREAK case 11: YY_RULE_SETUP #line 192 "scan.l" {yylval.s = strdup(yytext); return NAME;} YY_BREAK case 12: YY_RULE_SETUP #line 193 "scan.l" {BEGIN(VALUE); return '=';} YY_BREAK case 13: YY_RULE_SETUP #line 194 "scan.l" {; /* skip */} YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP #line 195 "scan.l" {lineno++; /* skip */} YY_BREAK case 15: YY_RULE_SETUP #line 196 "scan.l" {BEGIN(INIT); return '>';} YY_BREAK case 16: YY_RULE_SETUP #line 197 "scan.l" {BEGIN(INIT); return EMPTYEND;} YY_BREAK case 17: YY_RULE_SETUP #line 198 "scan.l" {BEGIN(INIT); yyless(0); return '>'; /* Implicit ">" */} YY_BREAK case 18: YY_RULE_SETUP #line 200 "scan.l" {; /* skip */} YY_BREAK case 19: /* rule 19 can match eol */ YY_RULE_SETUP #line 201 "scan.l" {lineno++; /* skip */} YY_BREAK case 20: YY_RULE_SETUP #line 202 "scan.l" {BEGIN(MARKUP); yylval.s=strdup(yytext); return NAME;} YY_BREAK case 21: /* rule 21 can match eol */ #line 204 "scan.l" case 22: /* rule 22 can match eol */ YY_RULE_SETUP #line 204 "scan.l" {BEGIN(MARKUP); yylval.s=esc(yytext); lns(yytext); return STRING;} YY_BREAK case 23: YY_RULE_SETUP #line 206 "scan.l" {yylval.s = strdup(yytext); return NAME;} YY_BREAK case 24: YY_RULE_SETUP #line 207 "scan.l" {; /* skip */} YY_BREAK case 25: /* rule 25 can match eol */ YY_RULE_SETUP #line 208 "scan.l" {lineno++; /* skip */} YY_BREAK case 26: /* rule 26 can match eol */ #line 210 "scan.l" case 27: /* rule 27 can match eol */ YY_RULE_SETUP #line 210 "scan.l" {lns(yytext); yylval.s = esc(yytext); return STRING;} YY_BREAK case 28: YY_RULE_SETUP #line 211 "scan.l" {BEGIN(INIT); return '>';} YY_BREAK case 29: /* rule 29 can match eol */ YY_RULE_SETUP #line 213 "scan.l" {lns(yytext); yylval.s = strdup(yytext); return TEXT;} YY_BREAK case 30: YY_RULE_SETUP #line 214 "scan.l" {lns(yytext); if (strcasecmp(yytext+2, cur_cdata_element) == 0) { BEGIN(MARKUP); yylval.s = strdup(yytext+2); return END; } else { yylval.s = strdup(yytext); return TEXT; } } YY_BREAK case 31: YY_RULE_SETUP #line 225 "scan.l" {return *yytext; /* illegal char, in fact */} YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(MARKUP): case YY_STATE_EOF(VALUE): case YY_STATE_EOF(DECL): case YY_STATE_EOF(INIT): case YY_STATE_EOF(CDATA): #line 227 "scan.l" {if (pop_file()) return ENDINCL; else yyterminate();} YY_BREAK case 32: YY_RULE_SETUP #line 229 "scan.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 1940 "scan.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); yy_current_state = yy_nxt[yy_current_state][1]; yy_is_jam = (yy_current_state <= 0); if ( ! yy_is_jam ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return NULL; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { return yy_scan_bytes(yystr,(int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yynoreturn yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param _line_number line number * */ void yyset_lineno (int _line_number ) { yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * _in_str ) { yyin = _in_str ; } void yyset_out (FILE * _out_str ) { yyout = _out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int _bdebug ) { yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = NULL; yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return realloc(ptr, size); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 229 "scan.l" /* set_cdata_element -- set parsing rule for an element with CDATA content */ EXPORT void set_cdata_element(const conststring e) { dispose(cur_cdata_element); cur_cdata_element = newstring(e); BEGIN(CDATA); } /* * Local variables: * mode: indented-text * End: */ html-xml-utils-7.7/connectsock.e0000644000175000017500000000056013244022534013667 00000000000000extern u_short portbase ; extern int connectsock(const char *host, const char *service, char *protocol); extern int connectTCP(const char *host, const char *service); extern int connectUDP(char *host, char *service); extern int passivesock(char *service, char *protocol, int qlen); extern int passiveTCP(char *service, int qlen); extern int passiveUDP(char *service); html-xml-utils-7.7/hxremove.c0000645000175000017500000001355713244022534013224 00000000000000/* * Copy input (well-formed XML) without any elements that match a given selector * * To do: Put common routines with hxselect in separate module. * * To do: Only look for a LANG attribute if the input is XHTML. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 2012-2017 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 21 Oct 2012 */ #include "config.h" #include #include #include #include #include #include #ifdef HAVE_STRING_H # include #elif HAVE_STRINGS_H # include #endif #include "types.e" #include "tree.e" #include "selector.e" #include "heap.e" #include "errexit.e" #include "html.e" #include "scan.e" #include "selmatch.e" static Selector selector; /* The selector to match */ /* print_tree -- print tree below t, omitting elements that match the selector */ static void print_tree(Tree t) { pairlist p; if (!t) return; switch (t->tp) { case Element: /* Print the element, unless it matches the selector */ if (!matches_sel(t, selector)) { printf("<%s", t->name); /* Print each attribute, unless it matches the selector */ for (p = t->attribs; p; p = p->next) if (!selector->pseudoelts || selector->pseudoelts->type != AttrNode || !same(p->name, selector->pseudoelts->s) || !matches_sel(t, selector->context)) printf(" %s=\"%s\"", p->name, p->value); if (!t->children) { printf("/>"); } else { printf(">"); print_tree(t->children); printf("", t->name); } } break; case Text: printf("%s", t->text); break; case Comment: printf("", t->text); break; case Declaration: printf("name); if (t->text && t->url) printf(" PUBLIC \"%s\" \"%s\"", t->text, t->url); else if (t->text) printf(" PUBLIC \"%s\"", t->text); else if (t->url) printf(" SYSTEM \"%s\"", t->url); printf(">"); break; case Procins: printf("", t->text); break; case Root: print_tree(t->children); break; default: assert(!"Cannot happen!"); } print_tree(t->sister); } /*********************** Parser callback API ***********************/ /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* handle_start -- called before the first event is reported */ static void* handle_start(void) { Tree *tp; new(tp); *tp = create(); /* Create an empty tree */ return tp; } /* handle_end -- called after the last event is reported */ static void handle_end(void *clientdata) { Tree *t = (Tree*)clientdata; print_tree(get_root(*t)); /* Print tree, filtering out unwanted elements */ tree_delete(*t); } /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, const string commenttext) { Tree *t = (Tree*)clientdata; *t = append_comment(*t, commenttext); } /* handle_text -- called after a text chunk is parsed */ static void handle_text(void *clientdata, const string text) { Tree *t = (Tree*)clientdata; *t = tree_append_text(*t, text); } /* handle_decl -- called after a declaration is parsed */ static void handle_decl(void *clientdata, const string gi, const string fpi, const string url) { Tree *t = (Tree*)clientdata; *t = append_declaration(*t, gi, fpi, url); } /* handle_pi -- called after a Processing Instruction is parsed */ static void handle_pi(void *clientdata, const string pi_text) { Tree *t = (Tree*)clientdata; *t = append_procins(*t, pi_text); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, const string name, pairlist attribs) { Tree *t = (Tree*)clientdata; *t = tree_push(*t, name, attribs); } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, const string name, pairlist attribs) { Tree *t = (Tree*)clientdata; *t = tree_push(*t, name, attribs); *t = tree_pop(*t, name); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, const string name) { Tree *t = (Tree*)clientdata; *t = tree_pop(*t, name); } /* handle_endincl -- called at the end of an included file */ /* void handle_endincl(void *clientdata) */ /********************* End of parser callbacks *********************/ /* usage -- print usage message and exit */ static void usage(const conststring progname) { errexit("Usage: %s [-v] [-l language] [-i] selector\n", progname); } int main(int argc, char *argv[]) { string s; int c; /* Command line options */ while ((c = getopt(argc, argv, "il:v")) != -1) { switch (c) { case 'l': init_language(optarg); break; case 'i': set_case_insensitive(); break; case 'v': printf("Version: %s %s\n", PACKAGE, VERSION); return 0; case '?': usage(argv[0]); break; default: assert(!"Cannot happen"); } } /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(handle_start); set_end_handler(handle_end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Parse the selector */ if (optind >= argc) usage(argv[0]); /* Need at least 1 arg */ for (s = newstring(argv[optind++]); optind < argc; optind++) strapp(&s, " ", argv[optind], NULL); selector = parse_selector(s, &s); if (*s) errexit("Syntax error at \"%c\"\n", *s); /* Parse the input, build a tree, filter the tree */ yyin = stdin; if (yyparse() != 0) exit(3); return 0; } html-xml-utils-7.7/selector.e0000644000175000017500000000206313244022534013176 00000000000000typedef enum { AttrNode, RootSel, NthChild, NthOfType, FirstChild, FirstOfType, Lang, NthLastChild, NthLastOfType, LastChild, LastOfType, OnlyChild, OnlyOfType, Empty, Not, } PseudoType; typedef struct _PseudoCond { PseudoType type; int a, b; string s; struct _SimpleSelector *sel; struct _PseudoCond *next; } PseudoCond; typedef enum { Exists, Equals, Includes, StartsWith, EndsWith, Contains, LangMatch, HasClass, HasID } Operator; typedef struct _AttribCond { Operator op; string name; string value; struct _AttribCond *next; } AttribCond; typedef enum { Descendant, Child, Adjacent, Sibling } Combinator; typedef struct _SimpleSelector { string name; AttribCond *attribs; PseudoCond *pseudos; PseudoCond *pseudoelts; Combinator combinator; struct _SimpleSelector *context; struct _SimpleSelector *next; } SimpleSelector, *Selector; extern Selector parse_selector(const string selector, string *rest); extern void dump_simple_selector(FILE *f, const SimpleSelector *s); extern void dump_selector(FILE *f, const Selector s); html-xml-utils-7.7/xml2asc.10000644000175000017500000000223213244022535012642 00000000000000.TH "XML2ASC" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .de d \" begin display .sp .in +4 .nf .ft CR .CDS .. .de e \" end display .CDE .in -4 .fi .ft R .sp .. .SH NAME xml2asc \- convert UTF-8 to &#nnn; entities .SH SYNOPSIS .B xml2asc .SH DESCRIPTION .LP Reads an UTF-8 encoded text from standard input and writes to standard output, converting all non-ASCII characters to &#nnn; entities, so that the result is ASCII-encoded. .LP One example use is to convert ISO-8859-1 to ASCII with &#nnn; entities, by first running .B asc2xml to convert ISO-8859-1 to UTF-8 and then pipe the result into .B xml2asc to convert to ASCII with &#nnn; entities for all accented characters. .LP To test if a file is correct UTF-8, ignore the output and test the exit code, e.g. in Bash: .d xml2asc /dev/null && echo "OK" || echo "Fail" .e .SH "DIAGNOSTICS" .B xml2asc returns with a non-zero exit code if the input was not UTF-8. .SH "SEE ALSO" .BR asc2xml (1), .BR UTF-8 " (RFC 2279)" .SH BUGS .LP Doesn't distinguish mark-up from content, so if the input uses non-ASCII characters in XML element names, they will be output with numerical entities in them, which is not legal in XML. html-xml-utils-7.7/heap.c0000644000175000017500000000411713244022534012273 00000000000000/* * Some memory allocation routines, they call abort() in case of failure * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 1994-2003 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: before 1995 **/ #include "config.h" #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #include "export.h" #ifdef __export #undef __FILE__ /* Don't expand while making the .e file */ #undef __LINE__ /* Don't expand while making the .e file */ #endif #define fatal(msg) fatal3(msg, __FILE__, __LINE__) #define new(p) if (((p)=malloc(sizeof(*(p))))); else fatal("out of memory") #define dispose(p) if (!(p)) ; else (free((void*)p), (p) = (void*)0) #define heapmax(p) 9999999 /* ? */ #define newstring(s) heap_newstring(s, __FILE__, __LINE__) #define newnstring(s,n) heap_newnstring(s, n, __FILE__, __LINE__) #define newarray(p,n) \ if (((p)=malloc((n)*sizeof(*(p))))); else fatal("out of memory") #define renewarray(p,n) \ if (((p)=realloc(p,(n)*sizeof(*(p))))); else fatal("out of memory") EXPORTDEF(fatal(msg)) EXPORTDEF(new(p)) EXPORTDEF(dispose(p)) EXPORTDEF(heapmax(p)) EXPORTDEF(newstring(s)) EXPORTDEF(newnstring(s,n)) EXPORTDEF(newarray(p,n)) EXPORTDEF(renewarray(p,n)) EXPORT void fatal3(const char *s, const char *file, const unsigned int line) { fprintf(stderr, "%s (file %s, line %d)\n", s, file, line); abort(); } EXPORT char * heap_newstring(const char *s, const char *file, const int line) { char *t; if (!s) return NULL; t = malloc((strlen(s) + 1) * sizeof(*t)); if (!t) fatal3("out of memory", file, line); strcpy(t, s); return t; } EXPORT char * heap_newnstring(const char *s, const size_t n, const char *file, const int line) { char *t; if (!s) return NULL; t = malloc((n + 1) * sizeof(*t)); if (!t) fatal3("out of memory", file, line); strncpy(t, s, n); t[n] = '\0'; return t; } html-xml-utils-7.7/ABOUT-NLS0000644000175000017500000026747413271361351012465 000000000000001 Notes on the Free Translation Project *************************************** Free software is going international! The Free Translation Project is a way to get maintainers of free software, translators, and users all together, so that free software will gradually become able to speak many languages. A few packages already provide translations for their messages. If you found this 'ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU 'gettext' internally, itself available at your nearest GNU archive site. But you do _not_ need to install GNU 'gettext' prior to configuring, installing or using this package with messages translated. Installers will find here some useful hints. These notes also explain how users should proceed for getting the programs to use the available translations. They tell how people wanting to contribute and work on translations can contact the appropriate team. 1.1 INSTALL Matters =================== Some packages are "localizable" when properly installed; the programs they contain can be made to speak your own native language. Most such packages use GNU 'gettext'. Other packages have their own ways to internationalization, predating GNU 'gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system already provides the GNU 'gettext' functions. Installers may use special options at configuration time for changing the default behaviour. The command: ./configure --disable-nls will _totally_ disable translation of messages. When you already have GNU 'gettext' installed on your system and run configure without an option for your new package, 'configure' will probably detect the previously built and installed 'libintl' library and will decide to use it. If not, you may have to to use the '--with-libintl-prefix' option to tell 'configure' where to look for it. Internationalized packages usually have many 'po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless translations have been forbidden at 'configure' time by using the '--disable-nls' switch, all available translations are installed together with the package. However, the environment variable 'LINGUAS' may be set, prior to configuration, to limit the installed set. 'LINGUAS' should then contain a space separated list of two-letter codes, stating which languages are allowed. 1.2 Using This Package ====================== As a user, if your language has been installed for this package, you only have to set the 'LANG' environment variable to the appropriate 'LL_CC' combination. If you happen to have the 'LC_ALL' or some other 'LC_xxx' environment variables set, you should unset them before setting 'LANG', otherwise the setting of 'LANG' will not have the desired effect. Here 'LL' is an ISO 639 two-letter language code, and 'CC' is an ISO 3166 two-letter country code. For example, let's suppose that you speak German and live in Germany. At the shell prompt, merely execute 'setenv LANG de_DE' (in 'csh'), 'export LANG; LANG=de_DE' (in 'sh') or 'export LANG=de_DE' (in 'bash'). This can be done from your '.login' or '.profile' file, once and for all. You might think that the country code specification is redundant. But in fact, some languages have dialects in different countries. For example, 'de_AT' is used for Austria, and 'pt_BR' for Brazil. The country code serves to distinguish the dialects. The locale naming convention of 'LL_CC', with 'LL' denoting the language and 'CC' denoting the country, is the one use on systems based on GNU libc. On other systems, some variations of this scheme are used, such as 'LL' or 'LL_CC.ENCODING'. You can get the list of locales supported by your system for your language by running the command 'locale -a | grep '^LL''. Not all programs have translations for all languages. By default, an English message is shown in place of a nonexistent translation. If you understand other languages, you can set up a priority list of languages. This is done through a different environment variable, called 'LANGUAGE'. GNU 'gettext' gives preference to 'LANGUAGE' over 'LANG' for the purpose of message handling, but you still need to have 'LANG' set to the primary language; this is required by other parts of the system libraries. For example, some Swedish users who would rather read translations in German than English for when Swedish is not available, set 'LANGUAGE' to 'sv:de' while leaving 'LANG' to 'sv_SE'. Special advice for Norwegian users: The language code for Norwegian bokma*l changed from 'no' to 'nb' recently (in 2003). During the transition period, while some message catalogs for this language are installed under 'nb' and some older ones under 'no', it's recommended for Norwegian users to set 'LANGUAGE' to 'nb:no' so that both newer and older translations are used. In the 'LANGUAGE' environment variable, but not in the 'LANG' environment variable, 'LL_CC' combinations can be abbreviated as 'LL' to denote the language's main dialect. For example, 'de' is equivalent to 'de_DE' (German as spoken in Germany), and 'pt' to 'pt_PT' (Portuguese as spoken in Portugal) in this context. 1.3 Translating Teams ===================== For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list. The up-to-date list of teams can be found at the Free Translation Project's homepage, 'http://translationproject.org/', in the "Teams" area. If you'd like to volunteer to _work_ at translating messages, you should become a member of the translating team for your own language. The subscribing address is _not_ the same as the list itself, it has '-request' appended. For example, speakers of Swedish can send a message to 'sv-request@li.org', having this message body: subscribe Keep in mind that team members are expected to participate _actively_ in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to get started, please write to 'coordinator@translationproject.org' to reach the coordinator for all translator teams. The English team is special. It works at improving and uniformizing the terminology in use. Proven linguistic skills are praised more than programming skills, here. 1.4 Available Packages ====================== Languages are not equally supported in all packages. The following matrix shows the current state of internationalization, as of Jun 2014. The matrix shows, in regard of each package, for which languages PO files have been submitted to translation coordination, with a translation percentage of at least 50%. Ready PO files af am an ar as ast az be bg bn bn_IN bs ca crh cs +---------------------------------------------------+ a2ps | [] [] [] | aegis | | anubis | | aspell | [] [] [] | bash | [] [] [] | bfd | | binutils | [] | bison | | bison-runtime | [] | buzztrax | [] | ccd2cue | | ccide | | cflow | | clisp | | coreutils | [] [] | cpio | | cppi | | cpplib | [] | cryptsetup | [] | datamash | | denemo | [] [] | dfarc | [] | dialog | [] [] [] | dico | | diffutils | [] | dink | [] | direvent | | doodle | [] | dos2unix | | dos2unix-man | | e2fsprogs | [] [] | enscript | [] | exif | [] | fetchmail | [] [] | findutils | [] | flex | [] | freedink | [] [] | fusionforge | | gas | | gawk | [] | gcal | [] | gcc | | gdbm | | gettext-examples | [] [] [] [] [] | gettext-runtime | [] [] [] | gettext-tools | [] [] | gjay | | glunarclock | [] [] [] | gnubiff | [] | gnubik | [] | gnucash | () () [] | gnuchess | | gnulib | [] | gnunet | | gnunet-gtk | | gold | | gphoto2 | [] | gprof | [] | gramadoir | | grep | [] [] [] | grub | [] | gsasl | | gss | | gst-plugins-bad | [] [] | gst-plugins-base | [] [] [] | gst-plugins-good | [] [] [] | gst-plugins-ugly | [] [] [] | gstreamer | [] [] [] [] | gtick | [] | gtkam | [] [] | gtkspell | [] [] [] [] [] | guix | | guix-packages | | gutenprint | [] | hello | [] | help2man | | help2man-texi | | hylafax | | idutils | | iso_15924 | [] | iso_3166 | [] [] [] [] [] [] [] [] [] [] | iso_3166_2 | | iso_4217 | [] | iso_639 | [] [] [] [] [] [] [] [] [] | iso_639_3 | [] [] | iso_639_5 | | jwhois | | kbd | [] | klavaro | [] [] [] [] [] | ld | [] | leafpad | [] [] [] [] | libc | [] [] [] | libexif | () | libextractor | | libgnutls | [] | libgphoto2 | [] | libgphoto2_port | [] | libgsasl | | libiconv | [] [] | libidn | [] | liferea | [] [] [] [] | lilypond | [] [] | lordsawar | [] | lprng | | lynx | [] [] | m4 | [] | mailfromd | | mailutils | | make | [] | man-db | [] [] | man-db-manpages | | midi-instruments | [] [] [] | minicom | [] | mkisofs | [] | myserver | [] | nano | [] [] [] | opcodes | | parted | [] | pies | | pnmixer | | popt | [] | procps-ng | | procps-ng-man | | psmisc | [] | pspp | [] | pushover | [] | pwdutils | | pyspread | | radius | [] | recode | [] [] [] | recutils | | rpm | | rush | | sarg | | sed | [] [] [] [] | sharutils | [] | shishi | | skribilo | | solfege | [] [] | solfege-manual | | spotmachine | | sudo | [] [] | sudoers | [] [] | sysstat | [] | tar | [] [] [] | texinfo | [] [] | texinfo_document | [] [] | tigervnc | [] | tin | | tin-man | | tracgoogleappsa... | | trader | | util-linux | [] | ve | | vice | | vmm | | vorbis-tools | [] | wastesedge | | wcd | | wcd-man | | wdiff | [] [] | wget | [] | wyslij-po | | xboard | | xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] | +---------------------------------------------------+ af am an ar as ast az be bg bn bn_IN bs ca crh cs 4 0 2 5 3 11 0 8 25 3 3 1 55 4 74 da de el en en_GB en_ZA eo es et eu fa fi fr +--------------------------------------------------+ a2ps | [] [] [] [] [] [] [] [] [] | aegis | [] [] [] [] | anubis | [] [] [] [] [] | aspell | [] [] [] [] [] [] [] | bash | [] [] [] | bfd | [] [] [] [] | binutils | [] [] [] | bison | [] [] [] [] [] [] [] [] | bison-runtime | [] [] [] [] [] [] [] [] | buzztrax | [] [] [] [] | ccd2cue | [] [] [] [] | ccide | [] [] [] [] [] [] | cflow | [] [] [] [] [] | clisp | [] [] [] [] [] | coreutils | [] [] [] [] [] | cpio | [] [] [] [] [] | cppi | [] [] [] [] [] | cpplib | [] [] [] [] [] [] | cryptsetup | [] [] [] [] [] | datamash | [] [] [] [] | denemo | [] | dfarc | [] [] [] [] [] [] | dialog | [] [] [] [] [] [] [] [] [] | dico | [] [] [] [] | diffutils | [] [] [] [] [] [] | dink | [] [] [] [] [] [] | direvent | [] [] [] [] | doodle | [] [] [] [] | dos2unix | [] [] [] [] [] | dos2unix-man | [] [] [] | e2fsprogs | [] [] [] [] [] | enscript | [] [] [] [] [] [] | exif | [] [] [] [] [] [] | fetchmail | [] () [] [] [] [] [] | findutils | [] [] [] [] [] [] [] [] | flex | [] [] [] [] [] [] | freedink | [] [] [] [] [] [] [] [] | fusionforge | [] [] [] | gas | [] [] [] | gawk | [] [] [] [] [] | gcal | [] [] [] [] | gcc | [] | gdbm | [] [] [] [] [] | gettext-examples | [] [] [] [] [] [] [] | gettext-runtime | [] [] [] [] [] [] | gettext-tools | [] [] [] [] [] | gjay | [] [] [] [] | glunarclock | [] [] [] [] [] | gnubiff | () [] [] () | gnubik | [] [] [] [] [] | gnucash | [] () () () () () () | gnuchess | [] [] [] [] | gnulib | [] [] [] [] [] [] [] | gnunet | [] | gnunet-gtk | [] | gold | [] [] [] | gphoto2 | [] () [] [] | gprof | [] [] [] [] [] [] | gramadoir | [] [] [] [] [] | grep | [] [] [] [] [] [] [] | grub | [] [] [] [] [] | gsasl | [] [] [] [] [] | gss | [] [] [] [] [] | gst-plugins-bad | [] [] [] | gst-plugins-base | [] [] [] [] [] [] | gst-plugins-good | [] [] [] [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] [] [] [] | gstreamer | [] [] [] [] [] [] [] | gtick | [] () [] [] [] | gtkam | [] () [] [] [] [] | gtkspell | [] [] [] [] [] [] [] [] | guix | [] [] | guix-packages | | gutenprint | [] [] [] [] | hello | [] [] [] [] [] [] [] [] | help2man | [] [] [] [] [] [] [] | help2man-texi | [] [] [] | hylafax | [] [] | idutils | [] [] [] [] [] | iso_15924 | [] () [] [] () [] () | iso_3166 | [] () [] [] [] [] () [] () | iso_3166_2 | [] () () () | iso_4217 | [] () [] [] [] () [] () | iso_639 | [] () [] [] () [] () | iso_639_3 | () () () | iso_639_5 | () () () | jwhois | [] [] [] [] [] | kbd | [] [] [] [] [] [] | klavaro | [] [] [] [] [] [] [] | ld | [] [] [] [] | leafpad | [] [] [] [] [] [] [] [] | libc | [] [] [] [] [] | libexif | [] [] () [] [] | libextractor | [] | libgnutls | [] [] [] [] | libgphoto2 | [] () [] | libgphoto2_port | [] () [] [] [] [] | libgsasl | [] [] [] [] [] | libiconv | [] [] [] [] [] [] [] | libidn | [] [] [] [] [] | liferea | [] () [] [] [] [] [] | lilypond | [] [] [] [] [] [] | lordsawar | [] [] | lprng | | lynx | [] [] [] [] [] [] | m4 | [] [] [] [] [] [] | mailfromd | [] | mailutils | [] [] [] [] | make | [] [] [] [] [] | man-db | [] [] [] [] | man-db-manpages | [] [] | midi-instruments | [] [] [] [] [] [] [] [] [] | minicom | [] [] [] [] [] | mkisofs | [] [] [] | myserver | [] [] [] [] | nano | [] [] [] [] [] [] [] | opcodes | [] [] [] [] [] | parted | [] [] [] | pies | [] | pnmixer | [] [] | popt | [] [] [] [] [] [] | procps-ng | [] [] | procps-ng-man | [] [] | psmisc | [] [] [] [] [] [] [] | pspp | [] [] [] | pushover | () [] [] [] | pwdutils | [] [] [] | pyspread | [] [] [] | radius | [] [] | recode | [] [] [] [] [] [] [] | recutils | [] [] [] [] | rpm | [] [] [] [] [] | rush | [] [] [] | sarg | [] [] | sed | [] [] [] [] [] [] [] [] | sharutils | [] [] [] [] | shishi | [] [] [] | skribilo | [] [] [] | solfege | [] [] [] [] [] [] [] [] | solfege-manual | [] [] [] [] [] | spotmachine | [] [] [] [] [] | sudo | [] [] [] [] [] [] | sudoers | [] [] [] [] [] [] | sysstat | [] [] [] [] [] [] | tar | [] [] [] [] [] [] [] | texinfo | [] [] [] [] [] | texinfo_document | [] [] [] [] | tigervnc | [] [] [] [] [] [] | tin | [] [] [] [] | tin-man | [] | tracgoogleappsa... | [] [] [] [] [] | trader | [] [] [] [] [] [] | util-linux | [] [] [] [] | ve | [] [] [] [] [] | vice | () () () | vmm | [] [] | vorbis-tools | [] [] [] [] | wastesedge | [] | wcd | [] [] [] [] | wcd-man | [] | wdiff | [] [] [] [] [] [] [] | wget | [] [] [] [] [] [] | wyslij-po | [] [] [] [] | xboard | [] [] [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] [] [] [] [] | +--------------------------------------------------+ da de el en en_GB en_ZA eo es et eu fa fi fr 119 131 32 1 6 0 94 95 22 13 4 102 139 ga gd gl gu he hi hr hu hy ia id is it ja ka kk +-------------------------------------------------+ a2ps | [] [] [] [] | aegis | [] | anubis | [] [] [] [] | aspell | [] [] [] [] [] | bash | [] [] [] [] | bfd | [] [] | binutils | [] [] [] | bison | [] | bison-runtime | [] [] [] [] [] [] [] [] | buzztrax | | ccd2cue | [] | ccide | [] [] | cflow | [] [] [] | clisp | | coreutils | [] [] | cpio | [] [] [] [] [] [] | cppi | [] [] [] [] [] | cpplib | [] [] | cryptsetup | [] | datamash | | denemo | [] | dfarc | [] [] [] | dialog | [] [] [] [] [] [] [] [] [] [] | dico | | diffutils | [] [] [] [] | dink | [] | direvent | [] | doodle | [] [] | dos2unix | [] [] | dos2unix-man | | e2fsprogs | [] [] | enscript | [] [] [] | exif | [] [] [] [] [] [] | fetchmail | [] [] [] | findutils | [] [] [] [] [] [] [] | flex | [] | freedink | [] [] [] [] | fusionforge | | gas | [] | gawk | [] () [] | gcal | | gcc | | gdbm | | gettext-examples | [] [] [] [] [] [] [] | gettext-runtime | [] [] [] [] [] [] [] | gettext-tools | [] [] [] | gjay | [] | glunarclock | [] [] [] [] [] [] | gnubiff | [] [] () | gnubik | [] [] [] | gnucash | () () () () () | gnuchess | | gnulib | [] [] [] [] [] | gnunet | | gnunet-gtk | | gold | [] [] | gphoto2 | [] [] [] [] | gprof | [] [] [] [] | gramadoir | [] [] [] | grep | [] [] [] [] [] [] [] | grub | [] [] [] | gsasl | [] [] [] [] [] | gss | [] [] [] [] [] | gst-plugins-bad | [] [] [] | gst-plugins-base | [] [] [] [] | gst-plugins-good | [] [] [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] [] | gstreamer | [] [] [] [] [] | gtick | [] [] [] [] [] | gtkam | [] [] [] [] [] | gtkspell | [] [] [] [] [] [] [] [] [] [] | guix | | guix-packages | | gutenprint | [] [] [] | hello | [] [] [] [] [] | help2man | [] [] [] | help2man-texi | | hylafax | [] | idutils | [] [] | iso_15924 | [] [] [] [] [] [] | iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | iso_3166_2 | [] [] | iso_4217 | [] [] [] [] [] [] | iso_639 | [] [] [] [] [] [] [] [] [] | iso_639_3 | [] [] | iso_639_5 | | jwhois | [] [] [] [] | kbd | [] [] [] | klavaro | [] [] [] [] [] | ld | [] [] [] [] | leafpad | [] [] [] [] [] [] [] () | libc | [] [] [] [] [] | libexif | [] | libextractor | | libgnutls | [] | libgphoto2 | [] [] | libgphoto2_port | [] [] | libgsasl | [] [] [] [] | libiconv | [] [] [] [] [] [] [] | libidn | [] [] [] [] | liferea | [] [] [] [] [] | lilypond | [] | lordsawar | | lprng | [] | lynx | [] [] [] [] | m4 | [] [] [] [] [] | mailfromd | | mailutils | | make | [] [] [] [] | man-db | [] [] | man-db-manpages | [] [] | midi-instruments | [] [] [] [] [] [] [] [] [] | minicom | [] [] [] | mkisofs | [] [] | myserver | [] | nano | [] [] [] [] [] [] | opcodes | [] [] [] | parted | [] [] [] [] [] | pies | | pnmixer | [] [] | popt | [] [] [] [] [] [] [] [] [] [] | procps-ng | | procps-ng-man | | psmisc | [] [] [] [] | pspp | [] [] | pushover | [] | pwdutils | [] | pyspread | | radius | [] | recode | [] [] [] [] [] [] [] | recutils | | rpm | [] | rush | [] | sarg | | sed | [] [] [] [] [] [] [] | sharutils | | shishi | | skribilo | [] | solfege | [] [] | solfege-manual | | spotmachine | | sudo | [] [] [] [] | sudoers | [] [] [] | sysstat | [] [] [] [] | tar | [] [] [] [] [] [] | texinfo | [] [] [] | texinfo_document | [] [] [] | tigervnc | | tin | | tin-man | | tracgoogleappsa... | [] [] [] [] | trader | [] [] | util-linux | [] | ve | [] | vice | () () | vmm | | vorbis-tools | [] [] | wastesedge | [] | wcd | | wcd-man | | wdiff | [] [] [] | wget | [] [] [] [] | wyslij-po | [] [] [] | xboard | | xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] [] [] [] | +-------------------------------------------------+ ga gd gl gu he hi hr hu hy ia id is it ja ka kk 35 2 47 4 8 2 60 71 2 6 81 11 87 57 0 3 kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl +--------------------------------------------------+ a2ps | [] [] | aegis | [] | anubis | [] [] [] | aspell | [] [] | bash | [] [] | bfd | | binutils | | bison | [] | bison-runtime | [] [] [] [] [] [] | buzztrax | | ccd2cue | | ccide | [] [] | cflow | [] | clisp | [] | coreutils | [] [] | cpio | [] | cppi | | cpplib | [] | cryptsetup | [] | datamash | [] [] | denemo | | dfarc | [] [] | dialog | [] [] [] [] [] [] | dico | | diffutils | [] [] [] | dink | [] | direvent | [] | doodle | [] | dos2unix | [] [] | dos2unix-man | [] | e2fsprogs | [] | enscript | [] | exif | [] [] [] | fetchmail | [] | findutils | [] [] | flex | [] | freedink | [] [] | fusionforge | | gas | | gawk | [] | gcal | | gcc | | gdbm | | gettext-examples | [] [] [] [] [] [] | gettext-runtime | [] [] [] | gettext-tools | [] | gjay | | glunarclock | [] [] | gnubiff | [] | gnubik | [] [] | gnucash | () () () () () () () [] | gnuchess | [] [] | gnulib | [] | gnunet | | gnunet-gtk | | gold | | gphoto2 | [] | gprof | [] [] | gramadoir | [] | grep | [] [] | grub | [] [] [] | gsasl | [] | gss | | gst-plugins-bad | [] [] [] | gst-plugins-base | [] [] [] | gst-plugins-good | [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] | gstreamer | [] [] [] | gtick | [] | gtkam | [] [] | gtkspell | [] [] [] [] [] [] [] | guix | | guix-packages | | gutenprint | [] | hello | [] [] [] | help2man | [] | help2man-texi | | hylafax | [] | idutils | [] | iso_15924 | () [] [] | iso_3166 | [] [] [] () [] [] [] [] [] [] | iso_3166_2 | () [] | iso_4217 | () [] [] [] | iso_639 | [] [] () [] [] [] [] | iso_639_3 | [] () [] | iso_639_5 | () | jwhois | [] [] | kbd | [] | klavaro | [] [] | ld | | leafpad | [] [] [] [] [] | libc | [] [] | libexif | [] | libextractor | [] | libgnutls | [] [] | libgphoto2 | [] | libgphoto2_port | [] | libgsasl | [] | libiconv | [] [] | libidn | [] | liferea | [] [] [] | lilypond | [] | lordsawar | | lprng | | lynx | [] | m4 | [] | mailfromd | | mailutils | | make | [] [] | man-db | [] | man-db-manpages | [] | midi-instruments | [] [] [] [] [] [] [] | minicom | [] | mkisofs | [] | myserver | | nano | [] [] [] | opcodes | [] | parted | [] [] | pies | | pnmixer | [] | popt | [] [] [] [] [] | procps-ng | | procps-ng-man | | psmisc | [] | pspp | [] [] | pushover | | pwdutils | [] | pyspread | | radius | [] | recode | [] [] | recutils | [] | rpm | [] | rush | [] | sarg | | sed | [] [] | sharutils | [] | shishi | | skribilo | | solfege | [] [] | solfege-manual | [] | spotmachine | [] | sudo | [] [] [] | sudoers | [] [] [] | sysstat | [] [] | tar | [] [] [] | texinfo | [] | texinfo_document | [] | tigervnc | [] | tin | | tin-man | | tracgoogleappsa... | [] [] [] | trader | [] | util-linux | [] | ve | [] | vice | [] | vmm | [] | vorbis-tools | [] | wastesedge | [] | wcd | [] | wcd-man | [] | wdiff | [] | wget | [] [] | wyslij-po | [] | xboard | [] | xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] | +--------------------------------------------------+ kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl 5 15 4 6 0 13 23 3 3 3 4 11 2 42 1 125 nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr +------------------------------------------------+ a2ps | [] [] [] [] [] [] [] | aegis | [] [] | anubis | [] [] [] | aspell | [] [] [] [] [] [] [] | bash | [] [] [] [] [] [] | bfd | [] [] | binutils | [] [] | bison | [] [] [] | bison-runtime | [] [] [] [] [] [] [] [] | buzztrax | [] | ccd2cue | [] [] | ccide | [] [] [] | cflow | [] [] [] | clisp | [] | coreutils | [] [] [] [] | cpio | [] [] [] | cppi | [] [] [] | cpplib | [] [] [] | cryptsetup | [] [] [] | datamash | [] [] | denemo | | dfarc | [] [] [] | dialog | [] [] [] [] [] [] [] | dico | [] | diffutils | [] [] [] | dink | | direvent | [] [] [] | doodle | [] [] | dos2unix | [] [] [] [] | dos2unix-man | [] [] | e2fsprogs | [] | enscript | [] [] [] [] [] [] | exif | [] [] [] [] [] [] | fetchmail | [] [] [] | findutils | [] [] [] [] [] [] | flex | [] [] [] [] [] | freedink | [] [] [] [] [] | fusionforge | | gas | | gawk | [] | gcal | | gcc | | gdbm | [] [] [] | gettext-examples | [] [] [] [] [] [] [] [] | gettext-runtime | [] [] [] [] [] [] [] [] [] | gettext-tools | [] [] [] [] [] [] [] | gjay | [] | glunarclock | [] [] [] [] [] [] | gnubiff | [] | gnubik | [] [] [] [] | gnucash | () () () () () [] | gnuchess | [] [] | gnulib | [] [] [] [] [] | gnunet | | gnunet-gtk | | gold | | gphoto2 | [] [] [] [] [] | gprof | [] [] [] [] | gramadoir | [] [] | grep | [] [] [] [] [] [] | grub | [] [] [] [] [] | gsasl | [] [] [] | gss | [] [] [] [] | gst-plugins-bad | [] [] [] [] [] | gst-plugins-base | [] [] [] [] [] [] | gst-plugins-good | [] [] [] [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] [] [] | gstreamer | [] [] [] [] [] [] [] | gtick | [] [] [] [] [] | gtkam | [] [] [] [] [] [] | gtkspell | [] [] [] [] [] [] [] [] [] | guix | | guix-packages | | gutenprint | [] [] | hello | [] [] [] [] [] [] | help2man | [] [] [] [] | help2man-texi | [] | hylafax | | idutils | [] [] [] | iso_15924 | [] () [] [] [] [] | iso_3166 | [] [] [] [] () [] [] [] [] [] [] [] [] | iso_3166_2 | [] () [] | iso_4217 | [] [] () [] [] [] [] [] | iso_639 | [] [] [] () [] [] [] [] [] [] | iso_639_3 | [] () | iso_639_5 | () [] | jwhois | [] [] [] [] | kbd | [] [] | klavaro | [] [] [] [] [] | ld | | leafpad | [] [] [] [] [] [] [] [] | libc | [] [] [] | libexif | [] () [] | libextractor | [] | libgnutls | [] | libgphoto2 | [] | libgphoto2_port | [] [] [] [] [] | libgsasl | [] [] [] [] | libiconv | [] [] [] [] [] | libidn | [] [] [] | liferea | [] [] [] [] () [] [] | lilypond | | lordsawar | | lprng | [] | lynx | [] [] | m4 | [] [] [] [] [] | mailfromd | [] | mailutils | [] | make | [] [] [] | man-db | [] [] [] | man-db-manpages | [] [] [] | midi-instruments | [] [] [] [] [] [] [] [] | minicom | [] [] [] [] | mkisofs | [] [] [] | myserver | [] [] | nano | [] [] [] [] [] [] | opcodes | | parted | [] [] [] [] [] [] | pies | [] | pnmixer | [] | popt | [] [] [] [] [] [] | procps-ng | [] | procps-ng-man | [] | psmisc | [] [] [] [] | pspp | [] [] | pushover | | pwdutils | [] | pyspread | [] [] | radius | [] [] | recode | [] [] [] [] [] [] [] [] | recutils | [] [] | rpm | [] | rush | [] [] [] | sarg | [] [] | sed | [] [] [] [] [] [] [] [] | sharutils | [] [] [] | shishi | [] [] | skribilo | [] | solfege | [] [] [] | solfege-manual | [] [] | spotmachine | [] [] | sudo | [] [] [] [] [] [] | sudoers | [] [] [] [] | sysstat | [] [] [] [] [] | tar | [] [] [] [] [] | texinfo | [] [] [] | texinfo_document | [] [] | tigervnc | [] [] [] | tin | [] | tin-man | | tracgoogleappsa... | [] [] [] [] | trader | [] [] | util-linux | [] [] | ve | [] [] [] | vice | | vmm | | vorbis-tools | [] [] [] | wastesedge | | wcd | | wcd-man | | wdiff | [] [] [] [] [] | wget | [] [] [] [] [] | wyslij-po | [] [] [] [] | xboard | [] [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] [] | +------------------------------------------------+ nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr 7 3 6 114 1 12 88 32 82 3 40 45 7 101 sv sw ta te tg th tr uk ur vi wa wo zh_CN +----------------------------------------------+ a2ps | [] [] [] [] [] | aegis | [] | anubis | [] [] [] [] | aspell | [] [] [] [] [] | bash | [] [] [] [] | bfd | [] [] [] | binutils | [] [] [] | bison | [] [] [] [] | bison-runtime | [] [] [] [] [] [] | buzztrax | [] [] [] | ccd2cue | [] [] [] | ccide | [] [] [] [] | cflow | [] [] [] [] | clisp | | coreutils | [] [] [] | cpio | [] [] [] [] [] | cppi | [] [] [] [] | cpplib | [] [] [] [] [] | cryptsetup | [] [] [] | datamash | [] [] [] | denemo | [] | dfarc | [] [] | dialog | [] [] [] [] [] [] | dico | [] | diffutils | [] [] [] [] [] | dink | [] | direvent | [] [] | doodle | [] [] | dos2unix | [] [] [] [] | dos2unix-man | [] [] [] | e2fsprogs | [] [] [] [] | enscript | [] [] [] [] | exif | [] [] [] [] [] | fetchmail | [] [] [] [] | findutils | [] [] [] [] [] | flex | [] [] [] [] | freedink | [] [] [] | fusionforge | | gas | [] | gawk | [] [] [] | gcal | [] [] [] | gcc | [] | gdbm | [] [] | gettext-examples | [] [] [] [] [] | gettext-runtime | [] [] [] [] [] | gettext-tools | [] [] [] [] [] | gjay | [] [] [] | glunarclock | [] [] [] [] | gnubiff | [] [] | gnubik | [] [] [] [] | gnucash | () () () () [] | gnuchess | [] [] [] | gnulib | [] [] [] [] | gnunet | | gnunet-gtk | | gold | [] [] | gphoto2 | [] [] [] [] | gprof | [] [] [] [] | gramadoir | [] [] [] | grep | [] [] [] [] [] | grub | [] [] [] [] | gsasl | [] [] [] [] | gss | [] [] [] | gst-plugins-bad | [] [] [] [] [] | gst-plugins-base | [] [] [] [] [] | gst-plugins-good | [] [] [] [] [] | gst-plugins-ugly | [] [] [] [] [] | gstreamer | [] [] [] [] [] | gtick | [] [] [] | gtkam | [] [] [] [] | gtkspell | [] [] [] [] [] [] [] | guix | | guix-packages | | gutenprint | [] [] [] [] | hello | [] [] [] [] [] [] | help2man | [] [] [] | help2man-texi | [] | hylafax | [] | idutils | [] [] [] | iso_15924 | [] () [] [] () [] | iso_3166 | [] [] () [] [] () [] [] | iso_3166_2 | () [] [] () [] | iso_4217 | [] () [] [] () [] | iso_639 | [] [] [] () [] [] () [] [] | iso_639_3 | [] () [] [] () | iso_639_5 | () [] () | jwhois | [] [] [] [] | kbd | [] [] [] [] | klavaro | [] [] [] [] [] [] | ld | [] [] [] [] [] | leafpad | [] [] [] [] [] [] | libc | [] [] [] [] [] | libexif | [] [] () | libextractor | [] [] | libgnutls | [] [] [] [] | libgphoto2 | [] [] [] | libgphoto2_port | [] [] [] [] | libgsasl | [] [] [] [] | libiconv | [] [] [] [] [] | libidn | () [] [] [] | liferea | [] [] [] [] [] | lilypond | [] | lordsawar | | lprng | [] | lynx | [] [] [] [] | m4 | [] [] [] | mailfromd | [] [] | mailutils | [] | make | [] [] [] [] | man-db | [] [] [] | man-db-manpages | [] [] | midi-instruments | [] [] [] [] [] [] | minicom | [] [] | mkisofs | [] [] [] | myserver | [] | nano | [] [] [] [] | opcodes | [] [] [] | parted | [] [] [] [] [] | pies | [] [] | pnmixer | [] [] [] | popt | [] [] [] [] [] [] [] | procps-ng | [] [] | procps-ng-man | [] | psmisc | [] [] [] [] | pspp | [] [] [] | pushover | [] | pwdutils | [] [] | pyspread | [] | radius | [] [] | recode | [] [] [] [] | recutils | [] [] [] | rpm | [] [] [] [] | rush | [] [] | sarg | | sed | [] [] [] [] [] | sharutils | [] [] [] [] | shishi | [] [] | skribilo | [] [] | solfege | [] [] [] [] | solfege-manual | [] | spotmachine | [] [] [] | sudo | [] [] [] [] [] | sudoers | [] [] [] [] | sysstat | [] [] [] [] [] | tar | [] [] [] [] [] | texinfo | [] [] [] | texinfo_document | [] | tigervnc | [] [] [] | tin | [] | tin-man | | tracgoogleappsa... | [] [] [] [] [] | trader | [] | util-linux | [] [] [] [] | ve | [] [] [] [] | vice | () () | vmm | | vorbis-tools | [] [] | wastesedge | | wcd | [] [] [] | wcd-man | [] | wdiff | [] [] [] [] | wget | [] [] [] | wyslij-po | [] [] | xboard | [] [] | xdg-user-dirs | [] [] [] [] [] [] [] [] | xkeyboard-config | [] [] [] [] | +----------------------------------------------+ sv sw ta te tg th tr uk ur vi wa wo zh_CN 106 1 4 3 0 13 51 115 1 125 7 1 100 zh_HK zh_TW +-------------+ a2ps | | 30 aegis | | 9 anubis | | 19 aspell | | 29 bash | [] | 23 bfd | | 11 binutils | | 12 bison | [] | 18 bison-runtime | [] | 38 buzztrax | | 9 ccd2cue | | 10 ccide | | 17 cflow | | 16 clisp | | 10 coreutils | | 18 cpio | | 20 cppi | | 17 cpplib | [] | 19 cryptsetup | | 14 datamash | | 11 denemo | | 5 dfarc | | 17 dialog | [] | 42 dico | | 6 diffutils | | 22 dink | | 10 direvent | | 11 doodle | | 12 dos2unix | [] | 18 dos2unix-man | | 9 e2fsprogs | | 15 enscript | | 21 exif | | 27 fetchmail | | 19 findutils | | 29 flex | [] | 19 freedink | | 24 fusionforge | | 3 gas | | 5 gawk | | 13 gcal | | 8 gcc | | 2 gdbm | | 10 gettext-examples | [] [] | 40 gettext-runtime | [] [] | 35 gettext-tools | [] | 24 gjay | | 9 glunarclock | [] | 27 gnubiff | | 9 gnubik | | 19 gnucash | () | 6 gnuchess | | 11 gnulib | | 23 gnunet | | 1 gnunet-gtk | | 1 gold | | 7 gphoto2 | [] | 19 gprof | | 21 gramadoir | | 14 grep | [] | 31 grub | | 21 gsasl | [] | 19 gss | | 17 gst-plugins-bad | | 21 gst-plugins-base | | 27 gst-plugins-good | | 32 gst-plugins-ugly | | 34 gstreamer | [] | 32 gtick | | 19 gtkam | | 24 gtkspell | [] [] | 48 guix | | 2 guix-packages | | 0 gutenprint | | 15 hello | [] | 30 help2man | | 18 help2man-texi | | 5 hylafax | | 5 idutils | | 14 iso_15924 | [] | 23 iso_3166 | [] [] | 58 iso_3166_2 | | 9 iso_4217 | [] [] | 28 iso_639 | [] [] | 46 iso_639_3 | | 10 iso_639_5 | | 2 jwhois | [] | 20 kbd | | 17 klavaro | | 30 ld | [] | 15 leafpad | [] | 39 libc | [] | 24 libexif | | 10 libextractor | | 5 libgnutls | | 13 libgphoto2 | | 10 libgphoto2_port | [] | 19 libgsasl | | 18 libiconv | [] | 29 libidn | | 17 liferea | | 29 lilypond | | 11 lordsawar | | 3 lprng | | 3 lynx | | 19 m4 | [] | 22 mailfromd | | 4 mailutils | | 6 make | | 19 man-db | | 15 man-db-manpages | | 10 midi-instruments | [] | 43 minicom | [] | 17 mkisofs | | 13 myserver | | 9 nano | [] | 30 opcodes | | 12 parted | [] | 23 pies | | 4 pnmixer | | 9 popt | [] | 36 procps-ng | | 5 procps-ng-man | | 4 psmisc | [] | 22 pspp | | 13 pushover | | 6 pwdutils | | 8 pyspread | | 6 radius | | 9 recode | | 31 recutils | | 10 rpm | [] | 13 rush | | 10 sarg | | 4 sed | [] | 35 sharutils | | 13 shishi | | 7 skribilo | | 7 solfege | | 21 solfege-manual | | 9 spotmachine | | 11 sudo | | 26 sudoers | | 22 sysstat | | 23 tar | [] | 30 texinfo | | 17 texinfo_document | | 13 tigervnc | | 14 tin | [] | 7 tin-man | | 1 tracgoogleappsa... | [] | 22 trader | | 12 util-linux | | 13 ve | | 14 vice | | 1 vmm | | 3 vorbis-tools | | 13 wastesedge | | 3 wcd | | 8 wcd-man | | 3 wdiff | [] | 23 wget | | 21 wyslij-po | | 14 xboard | | 10 xdg-user-dirs | [] [] | 68 xkeyboard-config | [] | 28 +-------------+ 89 teams zh_HK zh_TW 166 domains 7 42 2809 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are used for implementing regional variants of languages, or language dialects. For a PO file in the matrix above to be effective, the package to which it applies should also have been internationalized and distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. If Jun 2014 seems to be old, you may fetch a more recent copy of this 'ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix with full percentage details can be found at 'http://translationproject.org/extra/matrix.html'. 1.5 Using 'gettext' in new packages =================================== If you are writing a freely available program and want to internationalize it you are welcome to use GNU 'gettext' in your package. Of course you have to respect the GNU Lesser General Public License which covers the use of the GNU 'gettext' library. This means in particular that even non-free programs can use 'libintl' as a shared library, whereas only free software can use 'libintl' as a static library or use modified versions of 'libintl'. Once the sources are changed appropriately and the setup can handle the use of 'gettext' the only thing missing are the translations. The Free Translation Project is also available for packages which are not developed inside the GNU project. Therefore the information given above applies also for every other Free Software Project. Contact 'coordinator@translationproject.org' to make the '.pot' files available to the translation teams. html-xml-utils-7.7/hxxmlns.c0000645000175000017500000001631113244022534013057 00000000000000/* * hxxmlns - expand XML Namespace prefixes * * Expand all element and attribute names to "global names" by * expanding the prefix. All names will be printed as "{URL}name". * Attribute names without a prefix will have an empty namespace part: * "{}name". * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 22 Mar 2000 * Version: $Id: hxxmlns.c,v 1.8 2017/11/24 09:50:25 bbos Exp $ * **/ #include "config.h" #include #ifdef HAVE_UNISTD_H # include #endif #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #include #include #include #include "export.h" #include "types.e" #include "heap.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" extern int yylineno; /* From scan.l */ /* The symbol table is a chain of prefix/uri pairs. Every time an * element starts, the prefixes defined by it are added at the end. To * expand a prefix, the most recently added prefix/uri pair is used. * When en element ends, the chain is reduced to what it was when the * element started. The stack keeps track of where the chain ended at * the start of the element. * * ToDo: should we hash the prefixes? or is linear search good enough? **/ typedef struct _Symbol { string prefix; string uri; struct _Symbol *next; } Symbol, *SymbolTable; typedef struct _StackElt { Symbol *frame; struct _StackElt *next; } *Stack; static Symbol xml = {"xml", "http://www.w3.org/XML/1998/namespace", NULL}; static bool has_error = false; static SymbolTable symtable = &xml; static Stack stack = NULL; static bool do_decls = true; /* Print decl, comment, PI? */ /* print_globalname -- print a name with expanded prefix */ static void print_globalname(string name, bool use_default) { string h, prefix, local; Symbol *s; /* Split the name */ h = strchr(name, ':'); if (!h && !use_default) { /* No prefix & no default ns */ printf("%s", name); return; } if (h) { *h = '\0'; prefix = name; local = h + 1; } else { prefix = ""; local = name; } /* Find the prefix in the symbol table */ for (s = symtable; s && !eq(prefix, s->prefix); s = s->next) ; if (!s && !eq(prefix, "")) { fprintf(stderr, "%d: prefix \"%s\" not defined\n", yylineno, prefix); has_error = true; /* To do: do we report anything if the default prefix is undefined? */ } /* ToDo: check that any '}' in uri is escaped */ printf("{%s}%s", s ? s->uri : (string)"", local); } /* do_tag -- print a start or empty tag expanded */ static void do_tag(string name, pairlist attribs, bool empty) { Stack h; pairlist p; Symbol *sym; /* Mark the current end of the symbol table */ new(h); h->next = stack; h->frame = symtable; stack = h; /* Scan the attributes for namespace definitions and store them */ for (p = attribs; p; p = p->next) { if (strncmp(p->name, "xmlns", 5) == 0) { new(sym); sym->prefix = newstring(p->name + (p->name[5] ? 6 : 5)); sym->uri = newstring(p->value); sym->next = symtable; symtable = sym; } } /* Print the tag with prefixes expanded */ putchar('<'); print_globalname(name, true); for (p = attribs; p; p = p->next) { if (strncmp(p->name, "xmlns", 5) != 0) { putchar(' '); print_globalname(p->name, false); printf("=\"%s\"", p->value); } } printf(empty ? "/>" : ">"); } /* pop_symboltable -- unwind the symbol table to previous mark */ static void pop_symboltable(string name) { Symbol *h; Stack p; if (!stack) { if (! has_error) fprintf(stderr, "%d: too many end tags\n", yylineno); has_error = true; return; } /* Remove entries from symbol table chain until last mark */ while (symtable != stack->frame) { h = symtable; symtable = symtable->next; dispose(h->prefix); dispose(h->uri); dispose(h); } /* Pop stack itself */ p = stack; stack = stack->next; dispose(p); } /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); has_error = true; } /* start -- called before the first event is reported */ void* start(void) { return NULL; } /* end -- called after the last event is reported */ void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { if (do_decls) printf("", commenttext); free(commenttext); } /* handle_text -- called after a text chunk is parsed */ void handle_text(void *clientdata, string text) { printf("%s", text); free(text); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) { if (do_decls) { printf("", fpi); if (url) printf(" %s\"%s\">", fpi ? "" : "SYSTEM ", url); printf(">"); } free(gi); if (fpi) free(fpi); if (url) free(url); } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { if (do_decls) printf("", pi_text); free(pi_text); } /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { do_tag(name, attribs, false); free(name); pairlist_delete(attribs); } /* handle_emptytag -- called after an empty tag is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { do_tag(name, attribs, true); pop_symboltable(name); free(name); pairlist_delete(attribs); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { /* Printf the end tag */ printf("'); /* Unwind the symbol table */ pop_symboltable(name); free(name); } /* usage -- print usage message and exit */ static void usage(string prog) { fprintf(stderr, "Version %s\nUsage: %s [-d] [xml-file-or-url]\n", VERSION, prog); exit(2); } int main(int argc, char *argv[]) { int i, status = 200; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Parse command line arguments */ for (i = 1; i < argc && argv[i][0] == '-' && !eq(argv[i], "--"); i++) { switch (argv[i][1]) { case 'd': do_decls = false; break; default: usage(argv[0]); } } if (i < argc && eq(argv[i], "--")) i++; if (i == argc) yyin = stdin; else if (i == argc - 1) yyin = fopenurl(argv[i], "r", &status); else usage(argv[0]); if (yyin == NULL) {perror(argv[i]); exit(1);} if (status != 200) errexit("%s : %s\n", argv[i], http_strerror(status)); if (yyparse() != 0) exit(3); return has_error ? 1 : 0; } html-xml-utils-7.7/hxtoc.10000644000175000017500000001026013244022534012415 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXTOC" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxtoc \- insert a table of contents in an HTML file .SH SYNOPSIS .B hxtoc .RB "[\| " \-x " \|]" .RB "[\| " \-l .IR low " \|]" .RB "[\| " \-h .IR high " \|]" .RB "[\| " \-t " \|]" .RB "[\| " \-d " \|]" .RB "[\| " \-c .IR class " \|]" .RB "[\| " \-f " \|]" .RI "[\| " file-or-URL " \|]" .SH DESCRIPTION .LP The .B hxtoc command reads an HTML file, inserts missing ID attributes in all H1 to H6 elements between the levels .B \-l and .B \-h (unless the option .B \-d is in effect, see below) and also inserts A elements with NAME attributes, so old browsers will recognize the H1 to H6 headers as target anchors as well (unless the option .B \-t is in effect). The output is written to stdout. .LP If there is a comment of the form .d .e or a pair of comments .d \&... .e then the comment, or the pair with everything in between, will be replaced by a table of contents, consisting of a list (UL) of links to all headers in the document. .LP The text of headers is copied to this table of contents, including any inline markup, except that ID attributes, DFN tags and SPAN tags with a CLASS of "index" are omitted (but the elements' content is copied). .LP The copied text can optionally be "flattened" first, see option .BR \-f . .LP If a header has a CLASS attribute with as value (or one of its values) the keyword "no-toc", then that header will not appear in the table of contents. .SH OPTIONS The following options are supported: .TP 10 .B \-x Use XML conventions: empty elements are written with a slash at the end: .TP .BI \-l " low" Sets the lowest numbered header to appear in the table of content. Default is 1 (i.e., H1). .TP .BI \-h " high" Sets the highest numbered header to appear in the table of content. Default is 6 (i.e., H6). .TP .B \-t Normally, .B hxtoc adds both ID attributes and empty A elements with a NAME attribute and CLASS="bctarget", so that older browsers that do no understand ID will still find the target. With this option, the A elements will not be generated. .TP .BI \-c " class" The generated UL elements in the table of contents will have a CLASS attribute with the value .I class. The default is "toc". .TP .B \-d Tries to use sectioning elements as targets in the table of contents instead of H1 to H6. A sectioning elements is a DIV, SECTION, ARTICLE, ASIDE or NAV element whose first child is a heading element (H1 to H6) or an HGROUP. The sectioning element will be given an ID if it doesn't have one yet. With this option, the level of any H1 to H6 that is the first child of a sectioning element (or of an HGROUP that is itself the first child of a sectioning element) is not determined by its name, but by the nesting depth of the sectioning elements. (Any H1 to H6 that are not the first child of a sectioning element still have their level implied by their name.) .TP .B \-f Flatten the text of the table of contents. Without .BR \-f , the contents of header elements are copied to the table of contents almost unchanged, i.e., including any child elements and their attributes (except for ID attributes, DFN elements and certain SPAN elements, as explained above). With .BR \-f , the contents are flattened instead: All child elements are removed and only their contents are copied to the table of contents. Additionally elements with an ALT attribute, such as IMG, are replaced by the contents of the ALT attribute. Exception: BDO tags are copied unchanged and elements with a DIR attribute are replaced by a SPAN with that DIR attribute. (BDO and DIR may occur in languages written right-to-left.) .SH OPERANDS The following operand is supported: .TP 10 .I file-or-URL The name or URL of an HTML file. If absent, standard input is read instead. .SH "DIAGNOSTICS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the HTML file. .B hxtoc will try to correct the error and produce output anyway. .SH "SEE ALSO" .BR asc2xml (1), .BR hxnormalize (1), .BR hxnum (1), .BR xml2asc (1) .SH BUGS .LP The error recovery for incorrect HTML is primitive. html-xml-utils-7.7/hxclean.c0000645000175000017500000000535513244022534013006 00000000000000/* * Clean up an HTML file: * Insert missing tags. * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * 16 September 1997 * Bert Bos * $Id: hxclean.c,v 1.4 2017/11/24 09:50:25 bbos Exp $ */ #include "config.h" #include #include #include "export.h" #include "types.e" #include "tree.e" #include "html.e" #include "scan.e" static Tree tree; /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ void* start(void) { tree = create(); return NULL; } /* end -- called after the last even is reported */ void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { tree = append_comment(tree, commenttext); } /* handle_text -- called after a tex chunk is parsed */ void handle_text(void *clientdata, string text) { tree = append_text(tree, text); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) { tree = append_declaration(tree, gi, fpi, url); } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { tree = append_procins(tree, pi_text); } /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { tree = html_push(tree, name, attribs); } /* handle_emptytag -- called after an empty tag is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { tree = html_push(tree, name, attribs); } /* handle_pop -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { tree = html_pop(tree, name); } int main(int argc, char *argv[]) { /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); if (argc == 1) { yyin = stdin; } else if (argc == 2) { yyin = fopen(argv[1], "r"); if (yyin == NULL) { perror(argv[1]); exit(2); } } else { fprintf(stderr, "Version %s\n", VERSION); fprintf(stderr, "Usage: %s [html-file]\n", argv[0]); exit(1); } if (yyparse() != 0) { exit(3); } tree = get_root(tree); dumptree(tree, stdout); return 0; } html-xml-utils-7.7/test-driver0000755000175000017500000001027713244022534013414 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2013-07-13.22; # UTC # Copyright (C) 2011-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: html-xml-utils-7.7/hxname2id.c0000645000175000017500000001410313244022534013232 00000000000000/* * Move target anchors to the element they belong to, i.e., look for * and and replace it with * * There is no attempt to check if the name is a valid SGML/XML token * or whether it is unique. The replacement is syntactical only. * * Copyright © 2004 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: Dec 2004 * Version: $Id: hxname2id.c,v 1.7 2017/11/24 09:50:25 bbos Exp $ * **/ #include "config.h" #include #include #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #ifdef HAVE_ERRNO_H # include #endif #ifdef HAVE_SEARCH_H # include #else # include "search-freebsd.h" #endif #include "export.h" #include "types.e" #include "heap.e" #include "tree.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" static Tree tree; static bool xml = false; /* Use convention */ /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) { tree = create(); return NULL; } /* end -- called after the last event is reported */ static void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, string commenttext) { tree = append_comment(tree, commenttext); } /* handle_text -- called after a tex chunk is parsed */ static void handle_text(void *clientdata, string text) { tree = append_text(tree, text); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *clientdata, string gi, string fpi, string url) { tree = append_declaration(tree, gi, fpi, url); } /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *clientdata, string pi_text) { tree = append_procins(tree, pi_text); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, string name, pairlist attribs) { tree = html_push(tree, name, attribs); } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, string name, pairlist attribs) { handle_starttag(clientdata, name, attribs); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, string name) { tree = html_pop(tree, name); } /* has_anchor_child -- check if the first thing in the element is an */ static bool has_anchor_child(Tree t, conststring *nameval) { Tree h; /* Loop until either text or an element is found */ for (h = t->children; h != NULL; h = h->sister) { switch (h->tp) { case Comment: /* Skip these */ case Procins: break; case Text: /* Skip if whitespace, otherwise return false */ if (! only_space(h->text)) return false; break; case Element: /* true if or , else false */ return eq(h->name, "a") && ((*nameval = get_attrib(h, "id")) || (*nameval = get_attrib(h, "name"))); default: assert(! "Cannot happen"); } } return false; } /* process -- write the tree, add IDs at elements with an child */ static void process(Tree t, bool remove_anchor) { Tree h; conststring nameval; bool remove_next_anchor = false; pairlist a; for (h = t->children; h != NULL; h = h->sister) { switch (h->tp) { case Text: printf("%s", h->text); break; case Comment: printf("", h->text); break; case Declaration: printf("name); if (h->text) printf(" PUBLIC \"%s\"", h->text); if (h->url) printf(" %s\"%s\"", h->text ? "" : "SYSTEM ", h->url); printf(">"); break; case Procins: printf("", h->text); break; case Element: if (!get_attrib(h, "id") && has_anchor_child(h, &nameval)) { /* Put the anchor on this element and remove it from the child */ set_attrib(h, "id", nameval); remove_next_anchor = true; } printf("<%s", h->name); for (a = h->attribs; a != NULL; a = a->next) { /* Print attribs, except id/name that the parent wants us to remove */ if (!remove_anchor || (!eq(a->name, "id") && !eq(a->name, "name"))) { printf(" %s", a->name); if (a->value != NULL) printf("=\"%s\"", a->value); } } if (is_empty(h->name)) { assert(h->children == NULL); printf(xml ? " />" : ">"); } else { printf(">"); process(h, remove_next_anchor); printf("", h->name); } break; case Root: assert(! "Cannot happen"); break; default: assert(! "Cannot happen"); } } } /* usage -- print usage message and exit */ static void usage(string name) { errexit("Version %s\nUsage: %s [-x] [html-file]\n", VERSION, name); } int main(int argc, char *argv[]) { int i, status; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); yyin = stdin; for (i = 1; i < argc; i++) { if (eq(argv[i], "-x")) { xml = true; } else if (eq(argv[i], "-?")) { usage(argv[0]); } else if (eq(argv[i], "-")) { /* yyin = stdin; */ } else { yyin = fopenurl(argv[i], "r", &status); if (yyin == NULL) {perror(argv[1]); exit(2);} if (status != 200) errexit("%s : %s\n", argv[i], http_strerror(status)); } } if (yyparse() != 0) exit(3); tree = get_root(tree); process(tree, false); tree_delete(tree); /* Just to test memory mgmt */ return 0; } html-xml-utils-7.7/hxcount.10000644000175000017500000000252513244022534012765 00000000000000.TH "HXCOUNT" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxcount \- count elements and attributes in HTML or XML files .SH SYNOPSIS .B hxcount .RI "[\| " file-or-URL " \|]" .SH DESCRIPTION .LP The .B hxcount command counts the number of elements and attributes of each type that appears in the input and prints a report on stdout. .SH OPERANDS The following operand is supported: .TP 10 .I file-or-URL The name or URL of an HTML or XML file. If absent, standard input is read instead. .SH "EXIT STATUS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the HTML or XML file. .B hxcount will try to recover from the error and produce output anyway. .SH ENVIRONMENT To use a proxy to retrieve remote files, set the environment variables .B http_proxy and .BR ftp_proxy "." E.g., .B http_proxy="http://localhost:8080/" .SH BUGS .LP Don't trust the output if there were errors in the input. .LP Remote files (specified with a URL) are currently only supported for HTTP. Password-protected files or files that depend on HTTP "cookies" are not handled. (You can use tools such as .BR curl (1) or .BR wget (1) to retrieve such files.) .SH "SEE ALSO" .BR asc2xml (1), .BR hxprune (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxtoc (1), .BR hxunent (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/hxwls.10000645000175000017500000000372513244022534012446 00000000000000.TH "HXWLS" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .de d \" begin display .sp .in +4 .nf .ft CR .CDS .. .de e \" end display .CDE .in -4 .fi .ft R .sp .. .SH NAME hxwls \- list links in an HTML file .SH SYNOPSIS .B hxwls .RB "[\| " \-l " \|]" .RB "[\| " \-t " \|]" .RB "[\| " \-r " \|]" .RB "[\| " \-h " \|]" .RB "[\| " \-a " \|]" .RB "[\| " \-b .IR " base" " \|]" .RI "[\| " file " \|]" .SH DESCRIPTION .LP The .B hxwls command reads an HTML file (standard input by default) and prints out all links it finds. The output is written to stdout. .SH OPTIONS The following options are supported: .TP 10 .B \-l Produce a long listing. Instead of just the URI, .B hxwls prints three columns: the element name, the value of the REL attribute, and the target URI. .TP .B \-t Produce a tuple listing. .B hxwls prints four columns: the URI of the document itself, the element name, the value of the REL attribute, and the target URI. .TP .BI \-r Print relative URLs as they are, without converting them to absolute URLs. .TP .BI \-b " base" Use .I base as the initial base URL. If there is a element in the document, it will override the \-b option. .TP .B \-h Output as HTML. The output will be listed in the form of elements. .TP .B \-a Convert any IRIs (Internationalized Resource Identifiers) to ASCII-only URIs. This causes any non-ASCII characters in the path of a URI to be encoded as %-escaped octets and non-ASCII characters in the domain name as punycode. (Punycode encoding is only available if .B hxwls is compiled with libidn support.) .SH OPERANDS The following operand is supported: .TP 10 .I file The name or the URL of an HTML file. If absent, standard input is read instead. .SH "DIAGNOSTICS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the HTML file. .B hxwls will try to correct the error and produce output anyway. .SH "SEE ALSO" .BR asc2xml (1), .BR hxnormalize (1), .BR hxnum (1), .BR xml2asc (1) html-xml-utils-7.7/strstr.c0000645000175000017500000000117313244022534012717 00000000000000/* * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 31 Mar 2000 * Version: $Id: strstr.c,v 1.4 2017/11/24 09:50:25 bbos Exp $ **/ #include "config.h" #include "export.h" #ifndef HAVE_STRSTR EXPORT char *strstr(const char *haystack, const char *needle) { char *s, *t, *u; if (! needle) return haystack; /* No needle */ for (s = haystack; *s; s++) { for (t = needle, u = s; *t == *u && *t; t++, u++); if (! *t) return s; /* Found it */ } return NULL; /* Not found */ } #endif /* HAVE_STRSTR */ html-xml-utils-7.7/hxunpipe.10000644000175000017500000000321413244022534013131 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXUNPIPE" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxunpipe \- convert output of hxpipe back to XML format .SH SYNOPSIS .B hxunpipe .RB "[\| " \-b " \|]" .RI "[\| " file-or-URL " \|]" .SH DESCRIPTION .B hxunpipe takes the output of .BR hxpipe (1) (or of .BR onsgmls (1)) and turns it back into XML/SGML mark-up. .SH OPTIONS The following options are supported: .TP 10 .B \-b Normally, .B hxunpipe assumes the input was made by hxpipe, i.e., the input may contain character entities but will never contain SGML/XML delimiters (<>&"') that need to be escaped. When the input was made by (o)nsgmls, however, the entities will have been expanded and the input may contain SGML/XML delimiters. The option .B \-b causes .B hxunpipe to look for those delimiters and escape them: "<" as "<", ">" as ">", "&" as "&", """ as """ and "'" as "'". .SH OPERANDS The following operand is supported: .TP 10 .I file-or-URL The name or URL of an HTML file. If absent, standard input is read instead. .SH "EXIT STATUS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the input. .SH ENVIRONMENT To use a proxy to retrieve remote files, set the environment variables .B http_proxy and .BR ftp_proxy "." E.g., .B http_proxy="http://localhost:8080/" .SH BUGS .LP Not all syntax errors in the input are recognized. .LP .B hxunpipe can currently only retrieve remote files over HTTP. It doesn't handle password-protected files, nor files whose content depends on HTTP "cookies." .SH "SEE ALSO" .BR hxpipe (1), .BR onsgmls (1). html-xml-utils-7.7/hxcite.c0000645000175000017500000002510513244022534012643 00000000000000/* * cite - adds hyperlinks to bibliographic references in HTML * * The programs looks for strings of the form [[name]] (i.e., a * bibliographic label inside a double pair of square brackets), e.g., * [[Knuth84]] or [[LieBos97]]. The label will be looked up in a * bibliography database and if it is found, the string will be * replaced by a pattern which is typically of the form [name], but the pattern can be changed * with a command line option. * * If the string is of the form {{name}}, the name will be looked up, * but the string will be copied unchanged. * * If the label is not found, a warning is printed and the string is * left unchanged. * * All labels that are found are also stored, one label per line, in a * separate file with extension .aux. This file can be used by mkbib * to create the bibliography by extracting the corresponding * bibliographic entries from the database. * * The bibliography database must be a refer-style database. Though * for the purposes of this program all lines that don't start with * "%L" or %K are ignored. Lines with "%L" are assumed to contain a * label. Lines with %K are assumed to contain whitespace separated * keywords, which are effectively aliases for the label. Entries must * have one %L line and one or zero %K lines. * * Options: * * -b base * Give the value for %b in the pattern. * * -p pattern * The replacement for the string [[label]]. The default is * * [%L] * * %L will be replaced by the label, %b by the value of the -b * option and %m by the marker (-m option). * * -a auxfile * The name of the file in which the list of labels will be stored. * Default is the name of the file given as argument, minus its * extension, plus ".aux". If no file is give (input comes from * stdin), the default name is "aux.aux". * * -m marker * By default, the program looks for "[[name]]", but it can be * made to look for "[[Xname]]" where X is some string, usually a * symbol such as '!' or ='. This allows references to be * classified, e.g., "[[!name]]" for normative references and * "[[name]]" for non-normative references. * * -c * Assume that every pair "" delimit a comment and * do not process any [[label]] that occurs between them. Any * "{{label}}" is processed as normal. This does not actually * parse the input as HTML or XML and thus the program will * mistake occurrences of these two strings inside CDATA sections * or attribute values for comment delimiters. * * Copyright © 1994-2012 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 18 March 2000 * Version: $Id: hxcite.c,v 1.11 2018/02/15 19:02:36 bbos Exp $ **/ #include "config.h" #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #ifdef HAVE_SEARCH_H # include #else # include "hash.e" #endif #include #include #include "export.h" #include "heap.e" #include "types.e" #include "errexit.e" /* Warning: arbitrary limits! */ #define LINESIZE 32768 #define HASHSIZE 4096 /* Size of hash table */ #define WS " \t\r\n\f" /* Separates %K keywords */ static string base = ""; /* URL of bibilography */ static string mark = ""; /* Flag after "'[[" */ static size_t marklen = 0; /* Length of mark */ static string prog; /* = argv[0] */ static string pattern = "[%L]"; static FILE *aux; static bool skip_comments = false; /* Whether to skip [[ inside */ /* get_label -- get the label for the keyword, or NULL */ static string get_label(const string keyword) { ENTRY *result, e = {keyword, NULL}; result = hsearch(e, FIND); return result ? (string) result->data : NULL; } /* valid_label -- check if the label is well-formed */ static bool valid_label(const string label) { int i; for (i = 0; label[i]; i++) if (! isalnum(label[i]) && label[i] != '-' && label[i] != '_' && label[i] != '.') return false; return true; } /* expand_ref -- print the reformatted reference */ static void expand_ref(const string label) { int i; /* ToDo: somehow allow sequence numbers for references [1], [2], etc. */ for (i = 0; pattern[i]; i++) { if (pattern[i] != '%') { putchar(pattern[i]); } else { switch (pattern[++i]) { case '%': putchar('%'); break; /* Literal '%' */ case 'b': printf("%s", base); break; /* Base URL */ case 'L': printf("%s", label); break; /* Label */ case 'm': printf("%s", mark); break; /* Mark (-m option) */ default: break; /* Error in pattern */ } } } } /* process_line -- look for citations in a line */ EXPORT void process_line(const string text, const string fname, int lineno, bool *in_comment) { string h = text, p, q, label = NULL, key; char c; /* Loop over occurrences of "[[" + mark + label + "]]" and "{{" + mark + label + "}}" */ while (*in_comment ? (p = strpbrk(h, "-{")) : (p = strpbrk(h, "[{<"))) { while (h != p) putchar(*(h++)); /* Print text up to here */ if (strncmp(p, "-->", 3) == 0) { /* End of comment */ putchar(*(h++)); *in_comment = false; continue; } if (strncmp(p, "" data [^<\r\n]+ doctype ])*\]\]> %s MARKUP VALUE DECL INIT CDATA %% \357\273\277 {BEGIN(INIT); /* Byte Order Mark is ignored */} "<"{name} {BEGIN(MARKUP); yylval.s=strdup(yytext+1); return START;} "{data} {yylval.s=strdup(yytext); return TEXT;} {cdata} {yylval.s=strdup(yytext); lns(yytext); return TEXT;} {nl} {yylval.s=strdup(yytext); lineno++; return TEXT;} {comment} {yylval.s=strndup(yytext+4,yyleng-7); lns(yytext); return COMMENT;} {doctype} {BEGIN(DECL); lns(yytext+9); return DOCTYPE;} "]*">" {yylval.s=strndup(yytext+2,yyleng-3); lns(yytext); return PROCINS;} "<" {yylval.s=strdup("<"); return TEXT;} {name} {yylval.s = strdup(yytext); return NAME;} "=" {BEGIN(VALUE); return '=';} [ \t\f]+ {; /* skip */} {nl} {lineno++; /* skip */} ">" {BEGIN(INIT); return '>';} "/>" {BEGIN(INIT); return EMPTYEND;} "<" {BEGIN(INIT); yyless(0); return '>'; /* Implicit ">" */} [ \t\f]+ {; /* skip */} {nl} {lineno++; /* skip */} {thing} {BEGIN(MARKUP); yylval.s=strdup(yytext); return NAME;} \"[^"]*\" | \'[^']*\' {BEGIN(MARKUP); yylval.s=esc(yytext); lns(yytext); return STRING;} {name} {yylval.s = strdup(yytext); return NAME;} [ \t\f]+ {; /* skip */} {nl} {lineno++; /* skip */} \"[^"]*\" | \'[^']*\' {lns(yytext); yylval.s = esc(yytext); return STRING;} ">" {BEGIN(INIT); return '>';} ([^<]|\<[^/]|\<\/[^{a-z:._-])* {lns(yytext); yylval.s = strdup(yytext); return TEXT;} "> {if (pop_file()) return ENDINCL; else yyterminate();} %% /* set_cdata_element -- set parsing rule for an element with CDATA content */ EXPORT void set_cdata_element(const conststring e) { dispose(cur_cdata_element); cur_cdata_element = newstring(e); BEGIN(CDATA); } /* * Local variables: * mode: indented-text * End: */ html-xml-utils-7.7/configure.ac0000645000175000017500000000354013271372501013502 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) AC_INIT([html-xml-utils],[7.7]) dnl print all automake warnings with -Wall dnl http://sources.redhat.com/automake/automake.html#Options AM_INIT_AUTOMAKE([-Wall]) AC_CONFIG_SRCDIR([cexport.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) # Checks for programs. AC_PROG_YACC AC_PROG_CC AC_PROG_MAKE_SET AM_PROG_LEX # AC_PROG_INSTALL # AC_PROG_CPP # AC_PROG_LN_S # AC_PROG_AWK # AC_PROG_MAN2HTML # Checks for libraries. AC_SEARCH_LIBS(socket, socket nsl) AC_SEARCH_LIBS(gethostbyname, socket nsl) AM_ICONV LIBIDN2_CHECK LIBIDN_CHECK LIBCURL_CHECK_CONFIG(yes, 7.9.7) # Checks for header files. AC_HEADER_STDC AC_FUNC_ALLOCA AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h inttypes.h libintl.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/time.h unistd.h search.h wchar.h]) # Checks for typedefs, structures, and compiler characteristics. AC_CHECK_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT8_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC AC_FUNC_STRERROR_R AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit getcwd memchr gethostbyname memmove memset regcomp select setlocale socket strcasecmp strchr strcspn strdup strerror strncasecmp strndup strpbrk strrchr strspn strstr strtol strtoul fopencookie]) AC_REPLACE_FUNCS(strdup strerror strstr tsearch tfind twalk) # Check for library variables CHECK_GETOPT_OPTRESET # Optimization flags for flex AC_FLEX_OPTIMIZE AC_SUBST(lex_opt_flags) AC_CONFIG_FILES([Makefile]) AC_OUTPUT if test "$libidn2" = "no" && test "$libidn" = "no"; then AC_MSG_WARN([Neither libidn2 nor libidn found]) fi html-xml-utils-7.7/unent.c0000755000175000017500000005076613244022534012525 00000000000000/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -a -c -C -o -t -p -k '1,2,$' -D -N lookup_entity unent.hash */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 1 "unent.hash" /* -*-indented-text-*- */ /* * Copyright © 1998-2010 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 2 Dec 1998 * * Input file for gperf, to generate a perfect hash function * of all HTML named character entities. This list translates * names to Unicode numbers. */ #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include "export.h" EXPORT struct _Entity {char *name; unsigned int code;}; EXPORT const struct _Entity *lookup_entity (register const char *str, register size_t len); #line 37 "unent.hash" struct _Entity; #define TOTAL_KEYWORDS 253 #define MIN_WORD_LENGTH 2 #define MAX_WORD_LENGTH 8 #define MIN_HASH_VALUE 10 #define MAX_HASH_VALUE 533 /* maximum key range = 524, duplicates = 2 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (register const char *str, register size_t len) { static const unsigned short asso_values[] = { 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 40, 70, 20, 50, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 193, 5, 215, 0, 219, 534, 185, 5, 215, 190, 45, 5, 0, 30, 199, 35, 534, 15, 15, 10, 110, 0, 534, 10, 40, 0, 534, 534, 534, 534, 534, 534, 10, 210, 5, 155, 0, 200, 10, 15, 100, 175, 155, 20, 150, 145, 45, 65, 200, 35, 105, 55, 75, 140, 115, 0, 250, 80, 534, 100, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534 }; return len + asso_values[(unsigned char)str[1]+2] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; } const struct _Entity * lookup_entity (register const char *str, register size_t len) { static const struct _Entity wordlist[] = { #line 114 "unent.hash" {"ecirc", 234}, #line 113 "unent.hash" {"eacute", 233}, #line 60 "unent.hash" {"acute", 180}, #line 106 "unent.hash" {"acirc", 226}, #line 105 "unent.hash" {"aacute", 225}, #line 239 "unent.hash" {"ge", 8805}, #line 142 "unent.hash" {"Zeta", 918}, #line 140 "unent.hash" {"Delta", 916}, #line 147 "unent.hash" {"Lambda", 923}, #line 138 "unent.hash" {"Beta", 914}, #line 163 "unent.hash" {"gamma", 947}, #line 111 "unent.hash" {"ccedil", 231}, #line 238 "unent.hash" {"le", 8804}, #line 110 "unent.hash" {"aelig", 230}, #line 253 "unent.hash" {"lang", 9001}, #line 64 "unent.hash" {"cedil", 184}, #line 171 "unent.hash" {"lambda", 955}, #line 249 "unent.hash" {"lceil", 8968}, #line 288 "unent.hash" {"Dagger", 8225}, #line 223 "unent.hash" {"radic", 8730}, #line 101 "unent.hash" {"Yacute", 221}, #line 254 "unent.hash" {"rang", 9002}, #line 124 "unent.hash" {"ocirc", 244}, #line 123 "unent.hash" {"oacute", 243}, #line 54 "unent.hash" {"reg", 174}, #line 204 "unent.hash" {"harr", 8596}, #line 250 "unent.hash" {"rceil", 8969}, #line 200 "unent.hash" {"larr", 8592}, #line 146 "unent.hash" {"Kappa", 922}, #line 197 "unent.hash" {"real", 8476}, #line 266 "unent.hash" {"oelig", 339}, #line 42 "unent.hash" {"cent", 162}, #line 51 "unent.hash" {"laquo", 171}, #line 251 "unent.hash" {"lfloor", 8970}, #line 229 "unent.hash" {"cap", 8745}, #line 202 "unent.hash" {"rarr", 8594}, #line 109 "unent.hash" {"aring", 229}, #line 62 "unent.hash" {"para", 182}, #line 131 "unent.hash" {"ucirc", 251}, #line 130 "unent.hash" {"uacute", 250}, #line 226 "unent.hash" {"ang", 8736}, #line 67 "unent.hash" {"raquo", 187}, #line 252 "unent.hash" {"rfloor", 8971}, #line 155 "unent.hash" {"Tau", 932}, #line 192 "unent.hash" {"Prime", 8243}, #line 190 "unent.hash" {"hellip", 8230}, #line 205 "unent.hash" {"crarr", 8629}, #line 289 "unent.hash" {"permil", 8240}, #line 166 "unent.hash" {"zeta", 950}, #line 185 "unent.hash" {"omega", 969}, #line 112 "unent.hash" {"egrave", 232}, #line 118 "unent.hash" {"icirc", 238}, #line 117 "unent.hash" {"iacute", 237}, #line 273 "unent.hash" {"emsp", 8195}, #line 198 "unent.hash" {"trade", 8482}, #line 104 "unent.hash" {"agrave", 224}, #line 201 "unent.hash" {"uarr", 8593}, #line 99 "unent.hash" {"Ucirc", 219}, #line 98 "unent.hash" {"Uacute", 218}, #line 261 "unent.hash" {"amp", 38}, #line 191 "unent.hash" {"prime", 8242}, #line 212 "unent.hash" {"part", 8706}, #line 187 "unent.hash" {"upsih", 978}, #line 272 "unent.hash" {"ensp", 8194}, #line 41 "unent.hash" {"iexcl", 161}, #line 258 "unent.hash" {"hearts", 9829}, #line 228 "unent.hash" {"or", 8744}, #line 180 "unent.hash" {"tau", 964}, #line 115 "unent.hash" {"euml", 235}, #line 213 "unent.hash" {"exist", 8707}, #line 128 "unent.hash" {"oslash", 248}, #line 48 "unent.hash" {"uml", 168}, #line 247 "unent.hash" {"perp", 8869}, #line 281 "unent.hash" {"lsquo", 8216}, #line 290 "unent.hash" {"lsaquo", 8249}, #line 108 "unent.hash" {"auml", 228}, #line 196 "unent.hash" {"image", 8465}, #line 122 "unent.hash" {"ograve", 242}, #line 167 "unent.hash" {"eta", 951}, #line 262 "unent.hash" {"apos", 39}, #line 235 "unent.hash" {"asymp", 8776}, #line 107 "unent.hash" {"atilde", 227}, #line 236 "unent.hash" {"ne", 8800}, #line 120 "unent.hash" {"eth", 240}, #line 282 "unent.hash" {"rsquo", 8217}, #line 291 "unent.hash" {"rsaquo", 8250}, #line 292 "unent.hash" {"euro", 8364}, #line 215 "unent.hash" {"nabla", 8711}, #line 267 "unent.hash" {"Scaron", 352}, #line 270 "unent.hash" {"circ", 710}, #line 161 "unent.hash" {"alpha", 945}, #line 47 "unent.hash" {"sect", 167}, #line 170 "unent.hash" {"kappa", 954}, #line 89 "unent.hash" {"Ntilde", 209}, #line 56 "unent.hash" {"deg", 176}, #line 269 "unent.hash" {"Yuml", 376}, #line 164 "unent.hash" {"delta", 948}, #line 129 "unent.hash" {"ugrave", 249}, #line 126 "unent.hash" {"ouml", 246}, #line 154 "unent.hash" {"Sigma", 931}, #line 165 "unent.hash" {"epsilon", 949}, #line 230 "unent.hash" {"cup", 8746}, #line 224 "unent.hash" {"prop", 8733}, #line 245 "unent.hash" {"oplus", 8853}, #line 125 "unent.hash" {"otilde", 245}, #line 148 "unent.hash" {"Mu", 924}, #line 55 "unent.hash" {"macr", 175}, #line 193 "unent.hash" {"oline", 8254}, #line 195 "unent.hash" {"weierp", 8472}, #line 203 "unent.hash" {"darr", 8595}, #line 144 "unent.hash" {"Theta", 920}, #line 287 "unent.hash" {"dagger", 8224}, #line 74 "unent.hash" {"Acirc", 194}, #line 73 "unent.hash" {"Aacute", 193}, #line 139 "unent.hash" {"Gamma", 915}, #line 116 "unent.hash" {"igrave", 236}, #line 264 "unent.hash" {"gt", 62}, #line 92 "unent.hash" {"Ocirc", 212}, #line 91 "unent.hash" {"Oacute", 211}, #line 159 "unent.hash" {"Psi", 936}, #line 132 "unent.hash" {"uuml", 252}, #line 271 "unent.hash" {"tilde", 732}, #line 97 "unent.hash" {"Ugrave", 217}, #line 263 "unent.hash" {"lt", 60}, #line 234 "unent.hash" {"cong", 8773}, #line 103 "unent.hash" {"szlig", 223}, #line 149 "unent.hash" {"Nu", 925}, #line 231 "unent.hash" {"int", 8747}, #line 243 "unent.hash" {"sube", 8838}, #line 244 "unent.hash" {"supe", 8839}, #line 86 "unent.hash" {"Icirc", 206}, #line 85 "unent.hash" {"Iacute", 205}, #line 88 "unent.hash" {"ETH", 208}, #line 277 "unent.hash" {"lrm", 8206}, #line 82 "unent.hash" {"Ecirc", 202}, #line 81 "unent.hash" {"Eacute", 201}, #line 227 "unent.hash" {"and", 8743}, #line 162 "unent.hash" {"beta", 946}, #line 102 "unent.hash" {"THORN", 222}, #line 153 "unent.hash" {"Rho", 929}, #line 119 "unent.hash" {"iuml", 239}, #line 79 "unent.hash" {"Ccedil", 199}, #line 175 "unent.hash" {"omicron", 959}, #line 184 "unent.hash" {"psi", 968}, #line 59 "unent.hash" {"sup3", 179}, #line 168 "unent.hash" {"theta", 952}, #line 100 "unent.hash" {"Uuml", 220}, #line 237 "unent.hash" {"equiv", 8801}, #line 256 "unent.hash" {"spades", 9824}, #line 66 "unent.hash" {"ordm", 186}, #line 268 "unent.hash" {"scaron", 353}, #line 174 "unent.hash" {"xi", 958}, #line 177 "unent.hash" {"rho", 961}, #line 160 "unent.hash" {"Omega", 937}, #line 257 "unent.hash" {"clubs", 9827}, #line 133 "unent.hash" {"yacute", 253}, #line 181 "unent.hash" {"upsilon", 965}, #line 77 "unent.hash" {"Aring", 197}, #line 65 "unent.hash" {"sup1", 185}, #line 71 "unent.hash" {"iquest", 191}, #line 150 "unent.hash" {"Xi", 926}, #line 210 "unent.hash" {"hArr", 8660}, #line 284 "unent.hash" {"ldquo", 8220}, #line 44 "unent.hash" {"curren", 164}, #line 206 "unent.hash" {"lArr", 8656}, #line 179 "unent.hash" {"sigma", 963}, #line 219 "unent.hash" {"prod", 8719}, #line 194 "unent.hash" {"frasl", 8260}, #line 222 "unent.hash" {"lowast", 8727}, #line 183 "unent.hash" {"chi", 967}, #line 285 "unent.hash" {"rdquo", 8221}, #line 232 "unent.hash" {"there4", 8756}, #line 241 "unent.hash" {"sup", 8835}, #line 208 "unent.hash" {"rArr", 8658}, #line 121 "unent.hash" {"ntilde", 241}, #line 152 "unent.hash" {"Pi", 928}, #line 58 "unent.hash" {"sup2", 178}, #line 96 "unent.hash" {"Oslash", 216}, #line 246 "unent.hash" {"otimes", 8855}, #line 156 "unent.hash" {"Upsilon", 933}, #line 72 "unent.hash" {"Agrave", 192}, #line 214 "unent.hash" {"empty", 8709}, #line 274 "unent.hash" {"thinsp", 8201}, #line 255 "unent.hash" {"loz", 9674}, #line 50 "unent.hash" {"ordf", 170}, #line 90 "unent.hash" {"Ograve", 210}, #line 46 "unent.hash" {"brvbar", 166}, #line 283 "unent.hash" {"sbquo", 8218}, #line 68 "unent.hash" {"frac14", 188}, #line 70 "unent.hash" {"frac34", 190}, #line 199 "unent.hash" {"alefsym", 8501}, #line 157 "unent.hash" {"Phi", 934}, #line 169 "unent.hash" {"iota", 953}, #line 225 "unent.hash" {"infin", 8734}, #line 127 "unent.hash" {"divide", 247}, #line 95 "unent.hash" {"times", 215}, #line 84 "unent.hash" {"Igrave", 204}, #line 176 "unent.hash" {"pi", 960}, #line 216 "unent.hash" {"isin", 8712}, #line 80 "unent.hash" {"Egrave", 200}, #line 207 "unent.hash" {"uArr", 8657}, #line 69 "unent.hash" {"frac12", 189}, #line 76 "unent.hash" {"Auml", 196}, #line 278 "unent.hash" {"rlm", 8207}, #line 173 "unent.hash" {"nu", 957}, #line 94 "unent.hash" {"Ouml", 214}, #line 75 "unent.hash" {"Atilde", 195}, #line 172 "unent.hash" {"mu", 956}, #line 182 "unent.hash" {"phi", 966}, #line 93 "unent.hash" {"Otilde", 213}, #line 189 "unent.hash" {"bull", 8226}, #line 137 "unent.hash" {"Alpha", 913}, #line 87 "unent.hash" {"Iuml", 207}, #line 61 "unent.hash" {"micro", 181}, #line 83 "unent.hash" {"Euml", 203}, #line 57 "unent.hash" {"plusmn", 177}, #line 188 "unent.hash" {"piv", 982}, #line 248 "unent.hash" {"sdot", 8901}, #line 279 "unent.hash" {"ndash", 8211}, #line 63 "unent.hash" {"middot", 183}, #line 40 "unent.hash" {"nbsp", 160}, #line 280 "unent.hash" {"mdash", 8212}, #line 143 "unent.hash" {"Eta", 919}, #line 220 "unent.hash" {"sum", 8721}, #line 260 "unent.hash" {"quot", 34}, #line 134 "unent.hash" {"thorn", 254}, #line 186 "unent.hash" {"thetasym", 977}, #line 135 "unent.hash" {"yuml", 255}, #line 78 "unent.hash" {"AElig", 198}, #line 151 "unent.hash" {"Omicron", 927}, #line 265 "unent.hash" {"OElig", 338}, #line 218 "unent.hash" {"ni", 8715}, #line 52 "unent.hash" {"not", 172}, #line 141 "unent.hash" {"Epsilon", 917}, #line 45 "unent.hash" {"yen", 165}, #line 209 "unent.hash" {"dArr", 8659}, #line 233 "unent.hash" {"sim", 8764}, #line 221 "unent.hash" {"minus", 8722}, #line 259 "unent.hash" {"diams", 9830}, #line 43 "unent.hash" {"pound", 163}, #line 211 "unent.hash" {"forall", 8704}, #line 145 "unent.hash" {"Iota", 921}, #line 240 "unent.hash" {"sub", 8834}, #line 242 "unent.hash" {"nsub", 8836}, #line 49 "unent.hash" {"copy", 169}, #line 286 "unent.hash" {"bdquo", 8222}, #line 178 "unent.hash" {"sigmaf", 962}, #line 136 "unent.hash" {"fnof", 402}, #line 158 "unent.hash" {"Chi", 935}, #line 217 "unent.hash" {"notin", 8713}, #line 276 "unent.hash" {"zwj", 8205}, #line 275 "unent.hash" {"zwnj", 8204}, #line 53 "unent.hash" {"shy", 173} }; static const short lookup[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, 2, -1, -1, -1, -1, 3, 4, 5, -1, 6, 7, 8, -1, -1, 9, 10, 11, 12, -1, -1, 13, -1, -1, -1, 14, 15, 16, -1, -1, -1, 17, 18, -1, -1, -1, 19, 20, -1, -1, 21, 22, 23, -1, 24, 25, 26, -1, -1, -1, 27, 28, -1, -1, -1, 29, 30, -1, -1, -1, 31, 32, 33, -1, 34, 35, 36, -1, -1, -1, 37, 38, 39, -1, 40, -1, 41, 42, -1, 43, -1, 44, 45, -1, -1, -1, 46, 47, -1, -1, 48, 49, 50, -1, -1, -1, 51, 52, -1, -1, 53, 54, 55, -1, -1, 56, 57, 58, -1, 59, -1, 60, -1, -1, -1, 61, 62, -1, -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, -1, 71, 72, 73, 74, -1, -1, 75, 76, 77, -1, 78, 79, 80, 81, 82, 83, -1, 84, 85, -1, -1, 86, 87, 88, -1, -1, 89, 90, -1, -1, -1, 91, 92, 93, -1, 94, 95, 96, 97, -1, -1, 98, 99, -1, 100, 101, 102, 103, 104, 105, -1, 106, 107, 108, -1, -1, 109, 110, 111, -1, 112, 113, 114, 115, 116, -1, 117, 118, -1, -1, 119, 120, 121, 122, 123, -1, 124, 125, -1, 126, 127, -485, 130, 131, 132, 133, 134, 135, -125, -2, 136, 137, 138, -1, -1, 139, 140, -1, 141, 142, 143, 144, 145, -1, -1, -1, 146, 147, 148, -1, -1, 149, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, -1, 159, 160, -1, 161, 162, 163, -1, -1, 164, 165, -1, -1, -1, 166, 167, 168, -1, 169, -1, 170, 171, -1, 172, 173, -1, 174, 175, -1, 176, 177, 178, 179, -1, 180, 181, 182, -1, 183, 184, 185, 186, -1, -1, -1, 187, -571, 190, 191, 192, 193, 194, -65, -2, -1, 195, 196, 197, -1, 198, 199, -1, -1, -1, 200, -1, 201, 202, 203, -1, -1, -1, 204, 205, 206, -1, -1, 207, 208, -1, 209, -1, -1, -1, 210, -1, -1, -1, 211, 212, 213, -1, -1, 214, -1, -1, 215, -1, 216, 217, 218, 219, -1, -1, 220, 221, -1, 222, 223, 224, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, -1, -1, -1, 226, 227, -1, -1, -1, 228, -1, -1, 229, -1, -1, 230, -1, -1, 231, 232, -1, -1, 233, -1, 234, 235, -1, -1, -1, 236, -1, 237, -1, -1, -1, -1, 238, -1, -1, -1, -1, 239, 240, -1, -1, 241, -1, -1, -1, 242, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 244, 245, -1, -1, -1, -1, -1, 246, -1, -1, 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, 249, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 250, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 252 }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash (str, len); if (key <= MAX_HASH_VALUE) { register int index = lookup[key]; if (index >= 0) { register const char *s = wordlist[index].name; if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') return &wordlist[index]; } else if (index < -TOTAL_KEYWORDS) { register int offset = - 1 - TOTAL_KEYWORDS - index; register const struct _Entity *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]]; register const struct _Entity *wordendptr = wordptr + -lookup[offset + 1]; while (wordptr < wordendptr) { register const char *s = wordptr->name; if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') return wordptr; wordptr++; } } } } return 0; } #line 293 "unent.hash" html-xml-utils-7.7/tsearch.c0000644000175000017500000000314013244022534013002 00000000000000/* $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $ */ /* $FreeBSD: src/lib/libc/stdlib/tsearch.c,v 1.1.2.1 2000/08/17 07:38:39 jhb Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like * the AT&T man page says. * * The node_t structure is for internal use only, lint doesn't grok it. * * Written by reading the System V Interface Definition, not the code. * * Totally public domain. */ #include #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $"); #endif /* LIBC_SCCS and not lint */ #include #define _SEARCH_PRIVATE #include "config.h" #ifdef HAVE_SEARCH_H # include #else # include "search-freebsd.h" #endif #include /* find or insert datum into search tree */ void * tsearch(vkey, vrootp, compar) const void *vkey; /* key to be located */ void **vrootp; /* address of tree root */ int (*compar) __P((const void *, const void *)); { node_t *q; node_t **rootp = (node_t **)vrootp; if (rootp == NULL) return NULL; while (*rootp != NULL) { /* Knuth's T1: */ int r; if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ return *rootp; /* we found it! */ rootp = (r < 0) ? &(*rootp)->llink : /* T3: follow left branch */ &(*rootp)->rlink; /* T4: follow right branch */ } q = malloc(sizeof(node_t)); /* T5: key not found */ if (q != 0) { /* make new node */ *rootp = q; /* link new node to old */ /* LINTED const castaway ok */ q->key = (void *)vkey; /* initialize new node */ q->llink = q->rlink = NULL; } return q; } html-xml-utils-7.7/config.sub0000755000175000017500000010676313271365360013216 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2016 Free Software Foundation, Inc. timestamp='2016-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: html-xml-utils-7.7/cexport.c0000645000175000017500000003170713244022534013050 00000000000000/* cexport.c -- create header file of EXPORT'ed declarations from c files */ /* * Author: Bert Bos * Created: before 1995 * * C files are scanned for the keyword EXPORT. Any declaration that * follows it is copied to a file with the extension .e. It works for * typedefs, #defines, variables and functions, but only if ANSI * prototypes are used. Macros are exported with EXPORTDEF(.) * * Examples: * * EXPORT typedef int * IntPtr -- export IntPtr * * EXPORT void walkTree(Tree t) -- export walkTree() * * #define max(a,b) ((a)>(b)?(a):(b)) * EXPORTDEF(max(a,b)) -- export max(a,b) * * Files are first piped through the C preprocessor cpp. * * Command line options: * -c : use instead of cpp * -e : use instead of '.e' * other options are passed to cpp * * The program is not very smart about C syntax, but it doesn't have * to be, as long as the input is correct ANSI C. If it is not, no * warnings will be given (except possibly for unmatched braces, * quotes and paretheses), but the output will not be correct C, * either. * * TO DO: an option to check if the new .e file is different any * existing one and to keep the old one in that case. (Useful to save * unnecessary recompilations.) */ #include "config.h" #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #include #include #ifndef CPP #define CPP "cc -E" #endif #define LINELEN BUFSIZ static int err = 0; /* Global error counter */ static char *cppcmd = CPP; static char *extension = ".e"; static FILE *in, *out; static int eof; static long lineno; static char line[LINELEN]; static char *curname; /*************************************************************************** * get_line -- read next line, return 0 if eof ***************************************************************************/ static int get_line() { static char buf[BUFSIZ]; char *s; int i; do { if (eof) return 0; else if (! fgets(line, LINELEN, in)) { eof = 1; return 0; } else if (line[0] != '#') { lineno++; return 1; } else if (line[1] == ' ') { i = 2; while (isspace(line[i])) i++; if (! isdigit(line[i])) { lineno++; return 1; } else { lineno = strtol(line + i, &s, 0) - 1; if (*(s+1) != '"') { strcpy(buf, s + 1); buf[strlen(buf)-1] = '\0'; } else { strcpy(buf, s + 2); for (i = 2; buf[i] != '"'; i++) ; buf[i] = '\0'; } if (buf[0]) curname = buf; } } else if (line[1] == 'l' && strncmp(line, "#line", 5) == 0) { lineno = strtol(line + 5, &s, 0) - 1; if (*(s+1) != '"') { strcpy(buf, s + 1); buf[strlen(buf)-1] = '\0'; } else { strcpy(buf, s + 2); for (i = 2; buf[i] != '"'; i++) ; buf[i] = '\0'; } if (buf[0]) curname = buf; } else { lineno++; return 1; } } while (1); } /*************************************************************************** * exportdef -- copy a #define to output ***************************************************************************/ static void exportdef(i) long i; { unsigned long len; /* * TO DO: encountering an end of file should produce a suitable error * message: end of file in middle of macro definition. */ fputs("#define ", out); /* EXPORTDEF -> #define */ /* Unquote the following string */ for (i += 10; line[i] && line[i] != '"'; i++) ; for (i++; line[i] && line[i] != '"'; i++) putc(line[i], out); putc(' ', out); fputs(line + i + 1, out); /* Write rest of line */ len = strlen(line); /* Continuation lines? */ while (len >= 2 && line[len-2] == '\\') { if (! get_line()) break; fputs(line, out); len = strlen(line); } } /*************************************************************************** * export -- copy next declaration to output ***************************************************************************/ static void export(i) long *i; { int brace, paren, squote, dquote, comment, stop, is_typedef, start, is_enum, is_extern, is_struct; /* * TO DO: End of file while any of the variables is still * non-null is also an error. */ *i += 6; /* Skip "EXPORT" */ comment = 0; squote = 0; dquote = 0; paren = 0; brace = 0; stop = 0; is_typedef = 0; is_enum = 0; is_extern = 0; is_struct = 0; start = 1; do { switch (line[*i]) { case '\\': if (line[*i+1]) (*i)++; /* Skip next char */ break; case '{': if (!comment && !squote && !dquote && !paren) brace++; break; case '}': if (!comment && !squote && !dquote && !paren) brace--; if (brace < 0) { fprintf(stderr, "%s:%ld: syntax error (too many '}'s)\n", curname, lineno); err++; brace = 0; } break; case '"': if (!comment && !squote) dquote = !dquote; break; case '\'': if (!comment && !dquote) squote = !squote; break; case '*': if (!comment && !dquote && !squote && *i > 0 && line[*i-1] == '/') comment = 1; /* Start of comment */ break; case '/': /* Possible end of comment */ if (comment && *i > 0 && line[*i-1] == '*') comment = 0; break; case '(': if (!comment && !dquote && !squote && !brace) paren++; break; case ')': if (!comment && !dquote && !squote && !brace) { paren--; if (paren == 0 && !is_typedef) { putc(')', out); putc(';', out); putc('\n', out); stop = 1; } } break; case ';': if (!comment && !dquote && !squote && !paren && !brace) { putc(';', out); putc('\n', out); stop = 1; } break; case '=': if (!comment && !dquote && !squote && !brace && !paren) { putc(';', out); /* End of variable decl. */ putc('\n', out); stop = 1; } break; case '\n': if (dquote) { fprintf(stderr, "%s:%ld: syntax error (string didn't end)\n", curname, lineno); err++; dquote = 0; } if (squote) { fprintf(stderr, "%s:%ld: syntax error (char const didn't end)\n", curname, lineno); err++; squote = 0; } break; case '\0': if (! get_line()) stop = 1; else *i = -1; break; case 't': if (!comment && !squote && !dquote && paren == 0 && brace == 0 && strncmp("typedef", &line[*i], 7) == 0) is_typedef = 1; break; case 's': if (!comment && !squote && !dquote && paren == 0 && brace == 0 && strncmp("struct", &line[*i], 6) == 0) is_struct = 1; break; case 'e': if (!comment && !squote && !dquote && paren == 0 && brace == 0) { if (strncmp("enum", &line[*i], 4) == 0) is_enum = 1; else if (strncmp("extern", &line[*i], 6) == 0) is_extern = 1; } break; } if (! stop) { if (*i >= 0) { if (! start) { putc(line[*i], out); } else if (! isspace(line[*i])) { if (! is_typedef && ! is_enum && ! is_extern && ! is_struct) fputs("extern ", out); putc(line[*i], out); start = 0; } } (*i)++; } } while (! stop); } /*************************************************************************** * process -- scan file and write exported declarations ***************************************************************************/ static void process(file, cpp) char *file, *cpp; { char cmd[1024], *s, outname[1024]; int brace, paren, dquote, squote, comment; long i; strcpy(cmd, cppcmd); /* Build cpp command line */ strcat(cmd, cpp); strcat(cmd, file ? file : "-"); eof = 0; lineno = 0; in = popen(cmd, "r"); /* Pipe file through cpp */ if (! in) { perror(cmd); err++; return; } if (file) { strcpy(outname, file); /* Construct output file */ s = strrchr(outname, '.'); /* Extension becomes .e */ if (! s) s = outname + strlen(outname); strcpy(s, extension); out = fopen(outname, "w"); if (! out) { perror(outname); err++; return; } } else { out = stdout; /* No file name, use stdout */ } if (file) curname = file; else curname = ""; /* * If the word EXPORT is found and it is not inside a comment, between * quotes, parentheses or braces, the export() function is called to copy * the declaration to the out file. When the export() function ends, `line' * may have changed, but `i' points to the last copied character. * * If the word EXPORTDEF is found at the start of a line and it * is not inside a comment or between quotes, exportdef is called. */ comment = 0; dquote = 0; squote = 0; paren = 0; brace = 0; while (get_line()) { for (i = 0; line[i]; i++) { switch (line[i]) { case '\\': if (line[i+1]) i++; /* Skip next char */ break; case '{': if (!comment && !dquote && !squote) brace++; break; case '}': if (!comment && !dquote && !squote) brace--; if (brace < 0) { fprintf(stderr, "%s:%ld: syntax error (too many '}'s)\n", curname, lineno); err++; brace = 0; } break; case '(': if (!comment && !dquote && !squote) paren++; break; case ')': if (!comment && !dquote && !squote) paren--; if (paren < 0) { fprintf(stderr, "%s:%ld: syntax error (too many ')'s)\n", curname, lineno); err++; paren = 0; } break; case '\'': if (!comment && !dquote) squote = !squote; break; case '"': if (!comment && !squote) dquote = !dquote; break; case '\n': if (dquote) { fprintf(stderr, "%s:%ld: syntax error (string didn't end)\n", curname, lineno); err++; dquote = 0; } if (squote) { fprintf(stderr, "%s:%ld: syntax error (char const didn't end)\n", curname, lineno); err++; squote = 0; } break; case '*': if (!comment && !dquote && !squote && i > 0 && line[i-1] == '/') comment = 1; /* Start of comment */ break; case '/': /* Possible end of comment */ if (comment && i > 0 && line[i-1] == '*') comment = 0; break; case 'E': if (comment || dquote || squote || paren != 0 || brace != 0) ; else if (strncmp(&line[i], "EXPORT", 6) == 0 && (i == 0 || !isalnum(line[i-1])) && !isalnum(line[i+6])) export(&i); else if (strncmp(&line[i], "EXPORTDEF ", 10) == 0 && (i == 0 || !isalnum(line[i-1]))) { exportdef(i); i = (long) strlen(line) - 1; } break; } } } if (comment) { fprintf(stderr, "%s:%ld: syntax error (comment didn't end)\n", curname, lineno); err++; } if (dquote) { fprintf(stderr, "%s:%ld: syntax error (string didn't end)\n", curname, lineno); err++; } if (squote) { fprintf(stderr, "%s:%ld: syntax error (char const didn't end)\n", curname, lineno); err++; } if (file) fclose(out); fclose(in); } static void usage(s) char *s; { fprintf(stderr, "Usage: %s {-Idir|-Dsym} [-h] [-c cppcmd] [-e ext] {file}\n", s); err++; } int main(argc, argv) int argc; char *argv[]; { char cpp[BUFSIZ]; /* Max. cmd. line length */ int nfiles, i; strcpy(cpp, " -D__export "); nfiles = 0; for (i = 1; i < argc; i++) { if (!strncmp(argv[i], "-c", 2)) { /* Replace cpp command */ if (argv[i][2]) cppcmd = argv[i] + 2; else cppcmd = argv[++i]; } else if (!strncmp(argv[i], "-e", 2)) { /* Extension instead of .e */ if (argv[i][2]) extension = argv[i] + 2; else extension = argv[++i]; } else if (!strncmp(argv[i], "-h", 2)) { /* -h: help */ usage(argv[0]); } else if (argv[i][0] == '-' || argv[i][0] == '+') { strcat(cpp, argv[i]); /* Pass options to cpp */ strcat(cpp, " "); } else { /* Not option, must be file */ nfiles++; process(argv[i], cpp); } } if (nfiles == 0) /* no arguments, use stdin */ process(NULL, cpp); return err; } html-xml-utils-7.7/hxcite.10000645000175000017500000001211513244022534012556 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXCITE" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxcite \- replace bibliographic references by hyperlinks .SH SYNOPSIS .B hxcite .RB "[\| " \-b .IR base " \|]" .RB "[\| " \-p .IR pattern " \|]" .RB "[\| " \-a .IR auxfile " \|]" .RB "[\| " \-m .IR marker " \|]" .RB "[\| " -c " \|]" .IR bibfile " [\| " file " \|]" .SH DESCRIPTION .LP The .B hxcite commands copies the .I file to standard output, looking for strings of the form [[\fIlabel\fP]]. The label may not include white space and the double pair of square brackets must enclose the label without any spaces in between. If .B hxcite finds the label in the .IR bibfile "," the string is replaced by the .IR pattern "." The pattern can include certain variables. If the label is not found in .IR bibfile "," it is left unchanged. .PP The default pattern replaces the string with a hyperlink, but if the .B \-p option is used, the replacement can be any pattern. The input doesn't even have to be HTML. .LP If the label is enclosed in {{...}} instead of [[...]], it is copied to the output unchanged and not replaced by the pattern, but the label is still searched in the .IR bibfile "." .SH OPTIONS The following options are supported: .TP 10 .BI \-p " pattern" Specifies the pattern by which the string [[\fIlabel\fP]] is replaced. The pattern may include the variables .B %b (which is replaced by the value of the .B \-b option), .B %m (which is replaced by the value of the .B \-m option) and .B %L (which is replaced by the .IR label ")." The default pattern is .d [%L] .e .TP .BI \-b " base" Sets the value for the .B %b variable in the pattern. Typically this is set to a relative or absolute URL. By default this value is an empty string. .TP .BI \-a " auxfile" All labels that have been found and replaced are also written to a file. This is so that .BR hxmkbib (1) can find them and create a bibliography. The default .I auxfile is constructed from the name of the .I file by removing the last extension (if any) and replacing it by ".aux". If no .I file is given, the default name is "aux.aux". .TP .BI \-m " marker" By default, the program looks for "[[name]]", but it can be made to look for "[[#name]]" where # is some string, usually a symbol such as '!' or '='. This allows references to be classified, e.g., "[[!name]]" for normative references and "[[name]]" for non-normative references. .TP .B \-c Causes "[[name]]" to be ignored when it occurs inside XML comments (""). This is useful for files where such labels occur in comments, to avoid that they be expanded and possibly lead to invalid output; useful also if .B hxcite is used for non-HTML files which may contain "" for the end of a comment. .PP There is currently no way to use numbers for references (e.g., "[1]", "[2]") instead of the labels ("[Lie1996]", "[UTN22]"). .PP .B hxcite requires the .B %L (label) field to be present in every entry in .IR bibfile "," which is not the case for .BR refer "(1)." .B hxcite does not implement .BR refer "'s" keyword search. .SH "EXAMPLE" .PP The following looks for reference of the form "[[!label]]" in "myfile.html", skipping references that occur inside HTML comments, and looks up the labels in "biblio.ref". The output is written to "new.html" and the list of recognized labels to "myfile.aux". .d hxcite -c -m '!' biblio.ref myfile.html > new.html .e .SH "SEE ALSO" .BR asc2xml (1), .BR refer (1), .BR hxmkbib (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxprune (1), .BR hxtoc (1), .BR hxunent (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/hxextract.10000644000175000017500000000346213244022534013310 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXEXTRACT" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxextract \- extract selected elements from a HTML or XML file .SH SYNOPSIS .B hxextract .RB "[\| " \-h .RB "| " \-? " \|]" .RB "[\| " \-x " \|]" .RB "[\| " \-s .IR text " \|]" .RB "[\| " \-e .IR text " \|]" .RB "[\| " \-b .IR base " \|]" .I element-or-class .RB "[\| " \-c .IR "configfile" " | " .IR file\-or\-URL " \|]" .SH DESCRIPTION .B hxextract outputs all elements with a certain name and/or class. .PP Input must be well-formed, since no HTML heuristics are applied. .SH OPTIONS The following options are supported: .TP 10 .B \-x Use XML format conventions. .TP 10 .BI \-s " text" Insert .I text at the start of the output. .TP 10 .BI \-e " text" Insert .I text at the end of the output. .TP 10 .BI \-b " base" URL base .TP 10 .BI \-c " configfile" Read @chapter lines from .I configfile (lines must be of the form "@chapter filename") and extract elements from each of those files. .TP 10 .BR \-h ", " \-? Print command usage. .SH OPERANDS The following operands are supported: .TP 10 .I element-or-class The name of an element to extract (e.g., "H2"), or the name of a class preceded by "." (e.g., ".example") or a combination of both (e.g., "H2.example"). .TP .I file-or-URL A file name or a URL. To read from standard input, use "-". .SH ENVIRONMENT To use a proxy to retrieve remote files, set the environment variables .B http_proxy and .BR ftp_proxy "." E.g., .B http_proxy="http://localhost:8080/" .SH BUGS .LP Remote files (specified with a URL) are currently only supported for HTTP. Password-protected files or files that depend on HTTP "cookies" are not handled. (You can use tools such as .BR curl (1) or .BR wget (1) to retrieve such files.) .SH "SEE ALSO" .BR hxselect (1) html-xml-utils-7.7/hxunent.10000644000175000017500000000313213244022534012761 00000000000000.TH "HXUNENT" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .de d \" begin display .sp .in +4 .nf .ft CR .CDS .. .de e \" end display .CDE .in -4 .fi .ft R .sp .. .SH NAME hxunent \- replace HTML predefined character entities by UTF-8 .SH SYNOPSIS .B hxunent .RB "[\| " \-b " \|]" .RB "[\| " \-f " \|]" .RI "[\| " file " \|]" .SH DESCRIPTION .LP The .B hxunent command reads the .I file (or standard input) and copies it to standard output with &-entities by their equivalent character (encoded as UTF-8). E.g., " is replaced by " and < is replaced by <. .SH OPTIONS The following options are supported: .TP 10 .B -b The five builtin entities of XML (< > " ' &) are not replaced but copied unchanged. This is necessary if the output has to be valid XML or SGML. .TP .B -f This option changes how unknown entities or lone ampersands are handled. Normally they are copied unchanged, but this option tries to "fix" them by replacing ampersands by &. Often such stray ampersands are the result of copy and paste of URLs into a document and then this option indeed fixes them and makes the document valid. .SH "DIAGNOSTICS" The program's exit value is 0 if all went well, otherwise: .TP 10 .B 1 The input couldn't be read (file not found, file not readable...) .TP .B 2 Wrong command line arguments. .SH "SEE ALSO" .BR asc2xml (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" .SH BUGS .LP The program assumes entities are as defined by HTML. It doesn't read a document's DTD to find the actual definitions in use in a document. With .BR \-f , it will even remove all entities that are not HTML entities. html-xml-utils-7.7/hxprintlinks.c0000644000175000017500000001355013244022534014114 00000000000000/* * Add a numbered list of links at the end of an HTML file * * Copyright © 2001-2015 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 * * Created 23 Jan 2015 (based on a Perl version from 1 Feb 2001) * Bert Bos */ #include "config.h" #include #include #include #ifdef HAVE_STRING_H # include #elif HAVE_STRINGS_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #include "types.e" #include "dict.e" #include "openurl.e" #include "errexit.e" #include "heap.e" #include "html.e" #include "scan.e" #include "url.e" static conststring attname[] = { /* Attributes that contain URLs: */ "src", "href", "data", "longdesc", "cite", "action", "profile", "background", "usemap", "classid", "codebase"}; static pairlist list = NULL; /* Stored list of URLs */ static bool has_error = false; /* Parsing errors occurred */ static conststring base = NULL; /* Make URLs relative to this base */ /* pairlist_push -- insert a name/value pair at the start of a list */ static void pairlist_push(pairlist *p, const conststring name, const conststring val) { pairlist h; new(h); h->name = newstring(name); h->value = newstring(val); h->next = *p; *p = h; } /* print_list_recursive -- print LI items for all entries in list */ static void print_list_recursive(const pairlist list) { conststring url; /* ToDo: Escape double quotes */ if (list) { print_list_recursive(list->next); url = base ? URL_s_absolutize(base, list->name) : list->name; printf("
    • %s
    • \n", list->value, url, url); } } /* print_list -- print an OL with the entries of list */ static void print_list(const pairlist list) { if (list) { printf("
        \n"); print_list_recursive(list); printf("
      \n"); } } /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); has_error = true; } /* start -- called before the first event is reported */ void* start(void) { return NULL; } /* end -- called after the last event is reported */ void end(void *clientdata) { /* If we still have a list, print it here */ if (list) { print_list(list); pairlist_delete(list); list = NULL; } } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { printf("", commenttext); } /* handle_text -- called after a text chunk is parsed */ void handle_text(void *clientdata, string text) { printf("%s", text); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) { if (fpi && url) printf("\n", gi, fpi, url); else if (fpi) printf("\n", gi, fpi); else if (url) printf("\n", gi, url); else printf("\n", gi); } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { printf("", pi_text); } /* print_attrs -- print attributes */ static void print_attrs(const pairlist attribs) { pairlist p; /* ToDo: Distinguish SGML (a NULL value means that the name is the value and the actual attribute name is implicit) and XML? */ for (p = attribs; p; p = p->next) printf(" %s=\"%s\"", p->name, p->value ? p->value : p->name); } /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { int i; conststring url; /* Store any URLs from attributes */ for (i = 0; i < sizeof(attname)/sizeof(*attname); i++) if ((url = pairlist_get(attribs, attname[i]))) pairlist_push(&list, url, attname[i]); printf("<%s", name); print_attrs(attribs); printf(">"); } /* handle_emptytag -- called after an empty element is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { int i; conststring url; /* Store any URLs from attributes */ for (i = 0; i < sizeof(attname)/sizeof(*attname); i++) if ((url = pairlist_get(attribs, attname[i]))) pairlist_push(&list, url, attname[i]); printf("<%s", name); print_attrs(attribs); printf(" />"); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { /* Just before , print the list. or if we see and haven't printed the list yet, print it there */ if (list && (strcasecmp(name,"body") == 0 || strcasecmp(name,"html") == 0)) { print_list(list); pairlist_delete(list); list = NULL; } printf("", name); } /* usage -- print usage message and exit */ static void usage(string prog) { fprintf(stderr, "Usage: %s [html-file-or-url]\n", prog); exit(2); } /* main -- main body */ int main(int argc, char *argv[]) { int c, status = 200; while ((c = getopt(argc, argv, "b:")) != -1) switch (c) { case 'b': base = optarg; break; default: usage(argv[0]); } if (optind < argc - 1) usage(argv[0]); else if (optind > argc - 1 || eq(argv[optind], "-")) yyin = stdin; else yyin = fopenurl(argv[optind], "r", &status); if (!yyin) {perror(argv[optind]); exit(2);} if (status != 200) errexit("%s : %s\n", argv[optind], http_strerror(status)); /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); if (yyparse() != 0) {exit(3);} return has_error ? 1 : 0; } html-xml-utils-7.7/hash.c0000644000175000017500000000630713244022534012304 00000000000000#ifndef HAVE_SEARCH_H /* * hsearch() on Mac OS X 10.1.2 appears to be broken: there is no * search.h; there is a search() in the C library, but it doesn't work * properly. We include some hash functions here, protected by * HAVE_SEARCH_H. Hopefully when search.h appears in Mac OS X, * hsearch() will be fixed at the same time... * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ */ #include "config.h" #include #include #include #include "export.h" #include "heap.e" EXPORT typedef struct entry {char *key; void *data;} ENTRY; EXPORT typedef enum {FIND, ENTER} ACTION; static ENTRY *htab; static int *htab_index1, *htab_index2; static unsigned int htab_size = 0; static unsigned int htab_inited; /* isprime -- test if n is a prime number */ static int isprime(unsigned int n) { /* Simplistic algorithm, probably good enough for now */ unsigned int i; assert(n % 2); /* n not even */ for (i = 3; i * i < n; i += 2) if (n % i == 0) return 0; return 1; } /* hcreate -- create a hash table for at least nel entries */ EXPORT int hcreate(size_t nel) { /* Change nel to next higher prime */ for (nel |= 1; !isprime(nel); nel += 2) ; /* Allocate hash table and array to keep track of initialized entries */ newarray(htab, nel); newarray(htab_index1, nel); newarray(htab_index2, nel); if (!htab || !htab_index1 || !htab_index2) { dispose(htab); dispose(htab_index1); dispose(htab_index2); return 0; /* Out of memory */ } htab_inited = 0; htab_size = nel; return 1; } /* hdestroy -- deallocate hash table */ EXPORT void hdestroy(void) { assert(htab_size); dispose(htab_index1); dispose(htab_index2); dispose(htab); htab_size = 0; } /* hsearch -- search for and/or insert an entry in the hash table */ EXPORT ENTRY *hsearch(ENTRY item, ACTION action) { unsigned int hval, i; char *p; assert(htab_size); /* There must be a hash table */ /* Compute a hash value */ #if 1 /* This function suggested by Dan Bernstein */ for (hval = 5381, p = item.key; *p; p++) hval = (hval * 33) ^ *p; #else i = hval = strlen(item.key); do {i--; hval = (hval << 1) + item.key[i];} while (i > 0); #endif hval %= htab_size; /* if (action == ENTER) debug("%d\n", hval); */ /* Look for either an empty slot or an entry with the wanted key */ i = hval; while (htab_index1[i] < htab_inited && htab_index2[htab_index1[i]] == i && strcmp(htab[i].key, item.key) != 0) { i = (i + 1) % htab_size; /* "Open" hash method */ if (i == hval) return NULL; /* Made full round */ } /* Now we either have an empty slot or an entry with the same key */ if (action == ENTER) { htab[i].key = item.key; /* Put the item in this slot */ htab[i].data = item.data; if (htab_index1[i] >= htab_inited || htab_index2[htab_index1[i]] != i) { /* Item was not yet used, mark it as used */ htab_index1[i] = htab_inited; htab_index2[htab_inited] = i; htab_inited++; } return &htab[i]; } else if (htab_index1[i] < htab_inited && htab_index2[htab_index1[i]] == i) return &htab[i]; /* action == FIND, found key */ return NULL; /* Found empty slot */ } #endif /* HAVE_SEARCH_H */ html-xml-utils-7.7/unent.hash0000645000175000017500000000705113244022534013211 00000000000000%{ /* -*-indented-text-*- */ /* * Copyright © 1998-2010 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 2 Dec 1998 * * Input file for gperf, to generate a perfect hash function * of all HTML named character entities. This list translates * names to Unicode numbers. */ #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include "export.h" EXPORT struct _Entity {char *name; unsigned int code;}; EXPORT const struct _Entity *lookup_entity (register const char *str, register size_t len); %} struct _Entity; %% nbsp, 160 iexcl, 161 cent, 162 pound, 163 curren, 164 yen, 165 brvbar, 166 sect, 167 uml, 168 copy, 169 ordf, 170 laquo, 171 not, 172 shy, 173 reg, 174 macr, 175 deg, 176 plusmn, 177 sup2, 178 sup3, 179 acute, 180 micro, 181 para, 182 middot, 183 cedil, 184 sup1, 185 ordm, 186 raquo, 187 frac14, 188 frac12, 189 frac34, 190 iquest, 191 Agrave, 192 Aacute, 193 Acirc, 194 Atilde, 195 Auml, 196 Aring, 197 AElig, 198 Ccedil, 199 Egrave, 200 Eacute, 201 Ecirc, 202 Euml, 203 Igrave, 204 Iacute, 205 Icirc, 206 Iuml, 207 ETH, 208 Ntilde, 209 Ograve, 210 Oacute, 211 Ocirc, 212 Otilde, 213 Ouml, 214 times, 215 Oslash, 216 Ugrave, 217 Uacute, 218 Ucirc, 219 Uuml, 220 Yacute, 221 THORN, 222 szlig, 223 agrave, 224 aacute, 225 acirc, 226 atilde, 227 auml, 228 aring, 229 aelig, 230 ccedil, 231 egrave, 232 eacute, 233 ecirc, 234 euml, 235 igrave, 236 iacute, 237 icirc, 238 iuml, 239 eth, 240 ntilde, 241 ograve, 242 oacute, 243 ocirc, 244 otilde, 245 ouml, 246 divide, 247 oslash, 248 ugrave, 249 uacute, 250 ucirc, 251 uuml, 252 yacute, 253 thorn, 254 yuml, 255 fnof, 402 Alpha, 913 Beta, 914 Gamma, 915 Delta, 916 Epsilon, 917 Zeta, 918 Eta, 919 Theta, 920 Iota, 921 Kappa, 922 Lambda, 923 Mu, 924 Nu, 925 Xi, 926 Omicron, 927 Pi, 928 Rho, 929 Sigma, 931 Tau, 932 Upsilon, 933 Phi, 934 Chi, 935 Psi, 936 Omega, 937 alpha, 945 beta, 946 gamma, 947 delta, 948 epsilon, 949 zeta, 950 eta, 951 theta, 952 iota, 953 kappa, 954 lambda, 955 mu, 956 nu, 957 xi, 958 omicron, 959 pi, 960 rho, 961 sigmaf, 962 sigma, 963 tau, 964 upsilon, 965 phi, 966 chi, 967 psi, 968 omega, 969 thetasym, 977 upsih, 978 piv, 982 bull, 8226 hellip, 8230 prime, 8242 Prime, 8243 oline, 8254 frasl, 8260 weierp, 8472 image, 8465 real, 8476 trade, 8482 alefsym, 8501 larr, 8592 uarr, 8593 rarr, 8594 darr, 8595 harr, 8596 crarr, 8629 lArr, 8656 uArr, 8657 rArr, 8658 dArr, 8659 hArr, 8660 forall, 8704 part, 8706 exist, 8707 empty, 8709 nabla, 8711 isin, 8712 notin, 8713 ni, 8715 prod, 8719 sum, 8721 minus, 8722 lowast, 8727 radic, 8730 prop, 8733 infin, 8734 ang, 8736 and, 8743 or, 8744 cap, 8745 cup, 8746 int, 8747 there4, 8756 sim, 8764 cong, 8773 asymp, 8776 ne, 8800 equiv, 8801 le, 8804 ge, 8805 sub, 8834 sup, 8835 nsub, 8836 sube, 8838 supe, 8839 oplus, 8853 otimes, 8855 perp, 8869 sdot, 8901 lceil, 8968 rceil, 8969 lfloor, 8970 rfloor, 8971 lang, 9001 rang, 9002 loz, 9674 spades, 9824 clubs, 9827 hearts, 9829 diams, 9830 quot, 34 amp, 38 apos, 39 lt, 60 gt, 62 OElig, 338 oelig, 339 Scaron, 352 scaron, 353 Yuml, 376 circ, 710 tilde, 732 ensp, 8194 emsp, 8195 thinsp, 8201 zwnj, 8204 zwj, 8205 lrm, 8206 rlm, 8207 ndash, 8211 mdash, 8212 lsquo, 8216 rsquo, 8217 sbquo, 8218 ldquo, 8220 rdquo, 8221 bdquo, 8222 dagger, 8224 Dagger, 8225 permil, 8240 lsaquo, 8249 rsaquo, 8250 euro, 8364 %% html-xml-utils-7.7/aclocal.m40000644000175000017500000027607513271372511013073 00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # iconv.m4 serial 19 (gettext-0.18.2) dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_LIB_LINKFLAGS_BODY([iconv]) ]) AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) dnl Add $INCICONV to CPPFLAGS before performing the following checks, dnl because if the user has installed libiconv and not disabled its use dnl via --without-libiconv-prefix, he wants to use it. The first dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #include ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_func_iconv=yes]) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #include ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_lib_iconv=yes] [am_cv_func_iconv=yes]) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, dnl Solaris 10. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include #include #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif ]], [[int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ if (/* Try standardized names. */ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) /* Try IRIX, OSF/1 names. */ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) /* Try AIX names. */ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) /* Try HP-UX names. */ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) result |= 16; return result; ]])], [am_cv_func_iconv_works=yes], , [case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac]) test "$am_cv_func_iconv_works" = no || break done LIBS="$am_save_LIBS" ]) case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then AC_DEFINE([HAVE_ICONV], [1], [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST([LIBICONV]) AC_SUBST([LTLIBICONV]) ]) dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to dnl avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". dnl This is tricky because of the way 'aclocal' is implemented: dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. dnl Otherwise aclocal's initial scan pass would miss the macro definition. dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. dnl Otherwise aclocal would emit many "Use of uninitialized value $1" dnl warnings. m4_define([gl_iconv_AC_DEFUN], m4_version_prereq([2.64], [[AC_DEFUN_ONCE( [$1], [$2])]], [m4_ifdef([gl_00GNULIB], [[AC_DEFUN_ONCE( [$1], [$2])]], [[AC_DEFUN( [$1], [$2])]])])) gl_iconv_AC_DEFUN([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL([am_cv_proto_iconv], [ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif ]], [[]])], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([ $am_cv_proto_iconv]) AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], [Define as const if the declaration of iconv() needs const.]) dnl Also substitute ICONV_CONST in the gnulib generated . m4_ifdef([gl_ICONV_H_DEFAULTS], [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) if test -n "$am_cv_proto_iconv_arg1"; then ICONV_CONST="const" fi ]) fi ]) # lib-ld.m4 serial 6 dnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid dnl collision with libtool.m4. dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], [# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 /dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL([acl_cv_path_LD], [if test -z "$LD"; then acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 = 1.10 to complain if config.rpath is missing. m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE([rpath], [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_FROMPACKAGE(name, package) dnl declares that libname comes from the given package. The configure file dnl will then not have a --with-libname-prefix option but a dnl --with-package-prefix option. Several libraries can come from the same dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar dnl macro call that searches for libname. AC_DEFUN([AC_LIB_FROMPACKAGE], [ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_frompackage_]NAME, [$2]) popdef([NAME]) pushdef([PACK],[$2]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_libsinpackage_]PACKUP, m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) popdef([PACKUP]) popdef([PACK]) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) dnl Autoconf >= 2.61 supports dots in --with options. pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_ARG_WITH(P_A_C_K[-prefix], [[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= LIB[]NAME[]_PREFIX= dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been dnl computed. So it has to be reset here. HAVE_LIB[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" dnl The same code as in the loop below: dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$acl_hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi popdef([P_A_C_K]) popdef([PACKLIBS]) popdef([PACKUP]) popdef([PACK]) popdef([NAME]) ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) dnl For those cases where a variable contains several -L and -l options dnl referring to unknown libraries and directories, this macro determines the dnl necessary additional linker options for the runtime path. dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) dnl sets LDADDVAR to linker options needed together with LIBSVALUE. dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, dnl otherwise linking without libtool is assumed. AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], [ AC_REQUIRE([AC_LIB_RPATH]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) $1= if test "$enable_rpath" != no; then if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode directories into the resulting dnl binary. rpathdirs= next= for opt in $2; do if test -n "$next"; then dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= else case $opt in -L) next=yes ;; -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= ;; *) next= ;; esac fi done if test "X$rpathdirs" != "X"; then if test -n ""$3""; then dnl libtool is used for linking. Use -R options. for dir in $rpathdirs; do $1="${$1}${$1:+ }-R$dir" done else dnl The linker is used for linking directly. if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user dnl must pass all path elements in one option. alldirs= for dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="$flag" else dnl The -rpath options are cumulative. for dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="${$1}${$1:+ }$flag" done fi fi fi fi fi AC_SUBST([$1]) ]) # lib-prefix.m4 serial 7 (gettext-0.18) dnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib-prefix], [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) dnl AC_LIB_PREPARE_MULTILIB creates dnl - a variable acl_libdirstem, containing the basename of the libdir, either dnl "lib" or "lib64" or "lib/64", dnl - a variable acl_libdirstem2, as a secondary possible value for dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or dnl "lib/amd64". AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ dnl There is no formal standard regarding lib and lib64. dnl On glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine dnl the compiler's default mode by looking at the compiler's library search dnl path. If at least one of its elements ends in /lib64 or points to a dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. dnl Otherwise we use the default, namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) acl_libdirstem=lib acl_libdirstem2= case "$host_os" in solaris*) dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment dnl . dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the dnl symlink is missing, so we set acl_libdirstem2 too. AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], [AC_EGREP_CPP([sixtyfour bits], [ #ifdef _LP64 sixtyfour bits #endif ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) ]) if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi ;; *) searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" ]) # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Copyright (C) 1998-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_PREREQ([2.50])dnl AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/flex-optimize.m4]) m4_include([m4/libcurl.m4]) m4_include([m4/libidn.m4]) m4_include([m4/libidn2.m4]) m4_include([m4/optreset.m4]) html-xml-utils-7.7/hxmultitoc.c0000645000175000017500000002104013244022534013551 00000000000000/* * Output a table of content of all the headers in all the files * given on the command line. * * Headers with class "no-toc" will not be listed in the ToC. * * The ToC links to elements with ID attributes as well as with * empty elements. * * Tags for a with class "index" are assumed to be used by * a cross-reference generator and will not be copied to the ToC. * * howcome 2005-01-16: class attributes from header tags are now * copied to generated LI tags * * Copyright © 1997-2005 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Bert Bos * Created Sep 1997 * $Id: hxmultitoc.c,v 1.6 2017/11/24 09:50:25 bbos Exp $ */ #include "config.h" #include #include #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #include "export.h" #include "types.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "class.e" #define NO_TOC "no-toc" /* CLASS="... no-toc..." */ #define INDEX "index" /* CLASS="... index..." */ #define MAXLINELEN 1024 /* In configfile */ #define EXPAND true #define NO_EXPAND false #define KEEP_ANCHORS true #define REMOVE_ANCHORS false static int toc_low = 1, toc_high = 6; /* Which headers to include */ static bool xml = false; /* Use convention */ static bool copying = false; /* Start by not copying */ static int curlevel = 0; /* Level of previous heading */ static string base = NULL; /* URL of each file */ static string endtext = ""; /* Text to insert at end */ /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) {return NULL;} /* end -- called after the last event is reported */ static void end(void *clientdata) {} /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, const string commenttext) {} /* handle_text -- called after a text chunk is parsed */ static void handle_text(void *clientdata, const string text) { if (copying) fputs(text, stdout); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *clientdata, const string gi, const string fpi, const string url) {} /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *clientdata, const string pi_text) {} /* handle_header -- handle a H? start tag */ static void handle_header(int level, pairlist attribs) { conststring id, class; if (has_class(attribs, NO_TOC)) return; if (level < toc_low || level > toc_high) return; for (; curlevel > level; curlevel--) printf("
    \n"); for (; curlevel < level - 1; curlevel++) printf("
    • \n"); if (curlevel == level - 1) {printf("\n"); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, const string name, pairlist attribs) { pairlist a; if (eq(name, "h1") || eq(name, "H1")) handle_header(1, attribs); else if (eq(name, "h2") || eq(name, "H2")) handle_header(2, attribs); else if (eq(name, "h3") || eq(name, "H3")) handle_header(3, attribs); else if (eq(name, "h4") || eq(name, "H4")) handle_header(4, attribs); else if (eq(name, "h5") || eq(name, "H5")) handle_header(5, attribs); else if (eq(name, "h6") || eq(name, "H6")) handle_header(6, attribs); else if (eq(name, "a") || eq(name, "A")) ; /* Skip anchors */ else if (copying && !strcasecmp(name, "span")) handle_span(attribs); else if (copying) { /* Copy the tag */ printf("<%s", name); for (a = attribs; a != NULL; a = a->next) { printf(" %s", a->name); if (a->value != NULL) printf("=\"%s\"", a->value); } printf(">"); } } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, const string name, pairlist attribs) { pairlist a; if (copying && !eq(name, "a") && !eq(name, "A")) { /* Copy the tag */ printf("<%s", name); for (a = attribs; a != NULL; a = a->next) { printf(" %s", a->name); if (a->value != NULL) printf("=\"%s\"", a->value); } printf(xml ? " />" : ">"); } } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, const string name) { if (copying) { if (eq(name, "h1") || eq(name, "H1") || eq(name, "h2") || eq(name, "H2") || eq(name, "h3") || eq(name, "H3") || eq(name, "h4") || eq(name, "H4") || eq(name, "h5") || eq(name, "H5") || eq(name, "h6") || eq(name, "H6")) { printf("\n"); copying = false; } else if (eq(name, "a") || eq(name, "A")) { /* skip anchors */ } else { printf("", name); } } } /* process_configfile -- read @chapter lines from config file */ static void process_configfile(const string configfile) { char line[MAXLINELEN], chapter[MAXLINELEN]; FILE *f; if (! (f = fopenurl(configfile, "r", NULL))) {perror(configfile); exit(2);} /* ToDo: accept quoted file names with spaces in their name */ while (fgets(line, sizeof(line), f)) { if (sscanf(line, " @chapter %s", chapter) == 1) { if (!base) base = chapter; yyin = fopenurl(chapter, "r", NULL); if (yyin == NULL) {perror(chapter); exit(2);} if (yyparse() != 0) exit(3); fclose(yyin); base = NULL; } } fclose(f); } /* usage -- print usage message and exit */ static void usage(const string name) { fprintf(stderr, "Version %s\n\ Usage: %s [-x] [-s text ] [-e text ] [-l low | -h high | -b base | html-file \ | -c configfile]+\n", VERSION, name); exit(1); } int main(int argc, char *argv[]) { int i; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Loop over arguments; options may be in between file names */ for (i = 1; i < argc; i++) { if (eq(argv[i], "-l")) { if (i >= argc - 1) usage(argv[0]); toc_low = atoi(argv[++i]); curlevel = toc_low - 1; if (toc_low < 1) toc_low = 1; } else if (eq(argv[i], "-h")) { if (i >= argc - 1) usage(argv[0]); toc_high = atoi(argv[++i]); if (toc_high > 6) toc_high = 6; } else if (eq(argv[i], "-x")) { /* XML format */ xml = true; } else if (eq(argv[i], "-s")) { /* Insert text at start */ printf("%s", argv[++i]); } else if (eq(argv[i], "-e")) { /* Insert text at end */ endtext = argv[++i]; } else if (eq(argv[i], "-b")) { base = argv[++i]; } else if (eq(argv[i], "-c")) { /* Config file */ process_configfile(argv[++i]); } else if (eq(argv[i], "-")) { if (!base) base = ""; yyin = stdin; if (yyparse() != 0) exit(3); base = NULL; /* Reset base */ } else { if (!base) base = argv[i]; yyin = fopenurl(argv[i], "r", NULL); if (yyin == NULL) {perror(argv[1]); exit(2);} if (yyparse() != 0) exit(3); fclose(yyin); base = NULL; } } finalize(); printf("%s", endtext); /* Insert text at end */ return 0; } html-xml-utils-7.7/hxtabletrans.10000645000175000017500000000254613244022534014000 00000000000000.TH "HXTABLETRANS" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxtabletrans \- transpose an HTML or XHTML table .SH SYNOPSIS .B hxtabletrans .RB "[\| " \-c " \|]" .RB "[\| " \-x " \|]" .RB "[\| " \-v " \|]" .RI "[\| " file-or-URL " \|]" .SH DESCRIPTION .B hxtabletrans reads an HTML or XHTML file (or fragment), finds the first element and outputs that element with the rows and columns transposed. I.e., rows become columns and columns become rows. .PP Any grouping of rows with , or is lost. Also, any comments outside the cells are lost. .SH OPTIONS The following options are supported: .TP 10 .B \-c Also try to transpose the contents of cells. If a cell consists only of horizontal or vertical arrows and ellipses (apart from mark-up and whitespace), then those arrows and ellipses are replaced by their transposed counterparts. E.g., a right arrow becomes a down arrow. .TP .B \-x Use XML syntax. Empty elements are written with a slash (/) at the end, e.g.:
      .TP .B \-v Print the version number and exit. .SH BUGS .B hxtabletrans should check for rows that have fewer cells than the longest row (taking into account the effect of the colspan and rowspan attributes) and create the omitted cells, but it currently doesn't. Tables with rows of unequal length may thus not be transposed correctly. .PP Nested tables are not transposed. html-xml-utils-7.7/strerror.c0000645000175000017500000000105113244022534013233 00000000000000/* * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 31 Mar 2000 * Version: $Id: strerror.c,v 1.5 2017/11/24 09:50:25 bbos Exp $ **/ #include "config.h" #ifdef HAVE_ERRNO_H # include #endif #include "export.h" #ifndef HAVE_STRERROR /* strerror -- return a string describing the error number */ EXPORT char *strerror(int errnum) { return errnum < sys_nerr ? sys_errlist[errnum] : "Unknown error"; } #endif /* HAVE_STRERROR */ html-xml-utils-7.7/hxname2id.10000644000175000017500000000316313244022534013153 00000000000000.TH "HXNAME2ID" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxname2id \- move some NAME and ID attributes from an A to its parent .SH SYNOPSIS .B hxname2id .RB "[\| " \-x " \|]" .RI "[\| " file " \|]" .SH DESCRIPTION .LP The .B hxname2id command reads an HTML file and looks for elements with an A element as first child, with no intervening text other than whitespace. If that A element has an ID or NAME attribute, it is moved to the parent element and removed from the A. .LP Because Netscape 4 doesn't understand ID attributes, it was common practice to write

      ...

      instead of

      . This program can be used to convert such old HTML files to the new convention. .LP Other programs in this suite, such as .BR hxmultitoc (1), require IDs on headings instead of A elements with NAME attributes. So it is useful to run .B hxname2id prior to running .B hxmultitoc and similar program. .B hxname2id can be used in a pipe. .SH OPTIONS The following options are supported: .TP 10 .B \-x Use XML conventions: empty elements are written with a slash at the end: .SH OPERANDS The following operand is supported: .TP 10 .I file The name of an HTML file. If absent, standard input is read instead. .SH "DIAGNOSTICS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the HTML file. .B hxname2id will try to correct the error and produce output anyway. .SH "SEE ALSO" .BR asc2xml (1), .BR hxmultitoc (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxtoc (1), .BR xml2asc (1) .SH BUGS .LP The error recovery for incorrect HTML is primitive. html-xml-utils-7.7/depcomp0000755000175000017500000005601613244022534012574 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: html-xml-utils-7.7/hxpipe.10000644000175000017500000001147613244022534012577 00000000000000.TH "HXPIPE" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .de d \" begin display .sp .in +4 .nf .ft CR .CDS .. .de e \" end display .CDE .in -4 .fi .ft R .sp .. .SH NAME hxpipe \- convert XML file to a format easier to parse with Perl or AWK .SH SYNOPSIS .B hxpipe .RB "[\| " \-l " \|]" .RB "[\| " \-\- " \|]" .RI "[\| " file-or-URL " \|]" .SH DESCRIPTION .B hxpipe parses an HTML or XML file and outputs a line-oriented representation of it that is well suited to further processing with AWK or similar tools. The format is similar to the ESIS (Element Structure Information Set) that is output by nsgmls/onsgmls. .LP The reverse operation, converting back to mark-up, is performed by the .B hxunpipe program. .LP The output format is as follows: .TP 10 Comments are output as .d *comment .e I.e., a single line starting with "*" followed by the text of the comment. Line feeds, carriage returns and tabs in the text are written as "\\n", "\\r" and "\\t", respectively. Text that looks like a numerical character entity is written with the "&" replaced by "\\". The line ends with a line feed. .IP "" Note that onsgmls outputs comments starting with a "_" instead of a "*" and doesn't replace the "&" of numerical character entities by "\\" (and by default it omits comments altogether). .TP Processing instructions are output as .d ?processing instruction .e I.e., a single line starting with a "?" followed by the text of the processing instruction. The text is escaped as for comments (see above). .TP DOCTYPEs are output as one of the following: .d !root "-//foo//DTD bar//EN" http://example.org/dtd !root "-//foo//DTD bar//EN" !root "" http://example.org/dtd !root "" .e for respectively: a DOCTYPE with (1) both a public and a system identifier, (2) only a public identifier, (3) only a system identifier, or (4) neither of the two. I.e., a single line starting with a "!", followed by a space and a possibly empty quoted string, followed optionally by a space and arbitrary text. Note the quotes for the public identifier and the absence of quotes for the system identifier. .TP A start tag is output as .d Aatt1 CDATA value1 Aatt2 CDATA value2 (elt .e I.e., as zero or more lines for the attributes and one line for the element type. Each line for an attribute starts with "A" followed by the name of the attribute, a space, the literal string "CDATA", another space, and the attribute value. The text of the attribute value is escaped as for comments (see above). The line for the element type starts with "(" followed by the element type. .IP "" .B hxpipe does not read DTDs and assumes that attributes are always CDATA. It never generates other types (IMPLIED, TOKEN, ID, etc.), unlike onsgmls. .TP End tags are output as .d )elt .e I.e., as a line starting with ")" followed by the element type. .TP Empty elements (in XML) are output as .d Aatt1 CDATA val1 Aatt2 CDATA val2 |empty .e I.e., as zero or more lines for attributes and one line starting with "|" followed by the element type. .IP "" Note that .B onsgmls never outputs "|". (However, it can optionally output a line consisting of a single "e" just before the "(" line, to indicate that the element is empty.) .TP text Text is output as .d \-text .e I.e., as a single line starting with a "\-". The text is escaped as for comments (see above). .TP line numbers When the .B \-l option is in effect, .B hxpipe will intersperse the output with lines of the form .d L12 .e where "12" is replaced with the line number in the source where the next output came from. .LP .B hxpipe does not normalize the input and does not add mising tags. It is thus possible that there are unequal numbers of "(" and ")" lines. If it is important that every start tag is matched by an end tag, pipe the input through .B hxnormalize -x first. .SH OPTIONS The following options are supported: .TP 10 .B \-l Add "L" lines to the output to indicate the line numbers in the source. .SH OPERANDS The following operand is supported: .TP 10 .I file-or-URL The name or URL of an HTML file. If absent, standard input is read instead. .SH "EXIT STATUS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the HTML file. .B hxpipe will try to correct the error and produce output anyway. .SH ENVIRONMENT To use a proxy to retrieve remote files, set the environment variables .B http_proxy and .BR ftp_proxy "." E.g., .B http_proxy="http://localhost:8080/" .SH BUGS .LP The error recovery for incorrect HTML is primitive. .B hxnormalize can currently only retrieve remote files over HTTP. It doesn't handle password-protected files, nor files whose content depends on HTTP "cookies." .SH "SEE ALSO" .BR hxunpipe (1), .BR onsgmls (1). html-xml-utils-7.7/hxmkbib.c0000645000175000017500000003712513244022534013010 00000000000000/* * mkbib - extract database entries from a db and format them * * mkbib reads a refer-style database of bibliographic entries, a list * of keys and a pattern file and outputs a list of citations * formatted according to the pattern and optionally sorted. * * The keys must correspond to %L fields in the refer database. * * The pattern file has the following structure: * * pattern: PREAMBLE entry POSTAMBLE; * entry: "{L:" [ TEXT | FIELD | conditional ]* "}"; * conditional: "{" !"? F ":" [ TEXT | FIELD | conditional ]* "}"; * * In the output, the entry will be repeated as often as there are * unique keys. A FIELD is of the form "%x" and wil be replaced by * field x of the entry. * * A part of the form "{x:ZZZ}" will be replaced by ZZZ if field x * exists and by nothing otherwise. A part of the form "{!x:ZZZ}" will * be replaced by ZZZ if field x does not exist. * * Occurrences of %x in the preamble (where x is a field name) will * not be output, but serve to build up the sort order. The default * sort order is to keep entries in the order they occur in the * auxfile, but if, e.g., "%A%D%T" occurs in the preamble, entries * will be sorted on author, date and title. * * To insert a literal "{", "}" or "%" in the preamble or in an entry, * prefix them with "%": "%{", "%}" and "%%". * * Usage: mkbib [-a auxfile] bibfile [inputfile] * * bibfile is a refer-style database. * * inputfile is the file that serves as template. If absent, stdin * is read. * * -a auxfile gives the name of the list of keys. If absent, the name * will be the same as inputfile with the extension (if any) * changed to ".aux". If no inputfile is given the default auxfile * is "aux.aux". Duplicate keys will only be used once. * * Note: When the "{x:" and "}" are inside an HTML file, they may be * in places where data is not allowed. To make the input file * itself valid HTML, it may be necessary to put them inside comments: * and . If one of them is put inside a comment, * the other must be as well. * * Here is an example of an input file: * * * Bibliography * *
      *
      %L *
      {A:%A.} {T:%T.} {D:%D. } *
      * * * To do: if the template adds something like "(eds)", allow it to be * changed to "(ed)" if there is only one editor. * * Copyright © 1994-2004 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 19 March 2000 * Version: $Id: hxmkbib.c,v 1.8 2018/02/15 19:04:22 bbos Exp $ **/ #include "config.h" #ifdef HAVE_ERRNO_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #include #include #ifdef HAVE_SEARCH_H # include #else # include "hash.e" /* Use our own implementation */ #endif #include #include #include "heap.e" #include "types.e" #include "errexit.e" #define LINESIZE 32768 #define INCR 25 /* Warning: arbitrary limit! */ #define HASHSIZE 4096 /* Size of hash table */ static string prog; /* argv[0] */ static string sortorder = NULL; /* Default is unsorted */ static string separator = "; "; /* Separates authors */ static int et_al_limit = 3; /* Max # of authors to print */ static string et_al = "et al."; /* String if more authors */ /* escape -- print a string, escaping characters dangerous for XML/HTML */ static void escape(const string s, unsigned char *last) { int i; for (i = 0; s[i]; i++) switch (s[i]) { case '<': printf("<"); break; case '>': printf(">"); break; case '&': printf("&"); break; case '"': printf("""); break; default: putchar(s[i]); } if (i > 0) *last = s[i-1]; } /* put_field -- copy field field of entry with label key */ static void put_field(const string key, unsigned char field, unsigned char *last) { ENTRY *e, e1 = {key, NULL}; string *lines; int i, j, nrfields; /* ToDo: escape dangerous characters */ /* ToDo: print "et. al." if more than N authors */ /* ToDo: for fields other than %A and %E use only the last occurrence */ /* ToDo: interpret and pretty-print dates in a consistent manner */ if (field == '%' || field == '{' || field == '}') { /* Literal */ putchar(field); *last = '\0'; return; } /* Find the entry for key */ if (! (e = hsearch(e1, FIND))) { fprintf(stderr, "%s: entry for key %s not found\n", prog, key); return; } /* Count how many occurences of %field there are in the entry */ lines = (string*)e->data; /* Type cast */ for (i = 0, nrfields = 0; lines[i]; i++) if (lines[i][1] == field) nrfields++; /* Check that there is indeed a field */ if (nrfields == 0) { fprintf(stderr, "%s: entry %s has no field %%%c\n", prog, key, field); return; } /* Check that there are no duplicate fields, other than for A and E */ if (nrfields != 1 && ! (field == 'A' || field == 'E')) { fprintf(stderr, "%s: entry %s has duplicate field %%%c\n", prog, key, field); return; } /* Now print the field(s) */ if (nrfields > et_al_limit) { /* Print only the first */ for (i = 0; lines[i][1] != field; i++); /* Find the first */ escape(lines[i] + 3, last); /* Print with entities */ printf("%s%s", separator, et_al); *last = et_al[strlen(et_al) - 1]; } else { /* Print all fields */ for (i = 0, j = 0; lines[i]; i++) { if (lines[i][1] == field) { /* Found it */ if (j != 0) printf("%s", separator); /* Multiple fields */ escape(lines[i] + 3, last); /* Print with entities */ j++; } } } } /* get_field -- check that entry for key has a field f, return ptr to field */ static string get_field(const string key, const unsigned char f) { ENTRY *e, e1 = {key, NULL}; string *lines; int i; /* Find the entry for key */ e = hsearch(e1, FIND); assert(e != NULL); assert(e->data != NULL); /* Find a line that starts with %field */ lines = (string*)e->data; /* Type cast */ for (i = 0; lines[i] && lines[i][1] != f; i++) ; assert(! lines[i] || (lines[i][0] == '%' && lines[i][2] == ' ')); return lines[i]; } /* compare_keys -- return the relative sort order for two keys: -1, 0, 1 */ static int compare_keys(const void *aptr, const void *bptr) { ENTRY e, *ae, *be; int c, i; string af, bf, a = *(string*)aptr, b = *(string*)bptr; /* Get the entry for key a */ e.key = a; ae = hsearch(e, FIND); assert(ae != NULL); /* Get the entry for key b */ e.key = b; be = hsearch(e, FIND); assert(be != NULL); /* Loop over sortorder, stop as soon as entries a and b are unequal */ for (i = 0, c = 0; c == 0 && sortorder[i]; i++) { af = get_field(a, sortorder[i]); bf = get_field(b, sortorder[i]); c = strcmp(af ? af : (string)"", bf ? bf : (string)""); } return c; } /* sort_keys -- sort the keys according to the sort order given */ static void sort_keys(string *keys, const int n) { assert(sortorder != NULL); qsort(keys, n, sizeof(*keys), compare_keys); } /* conditional -- conditionally copy a %{...%} segment */ static int conditional(const string pattern, const string key, unsigned char *last) { bool on; int level, i = 1; /* Pattern starts with '{' */ assert(pattern[0] == '{' && pattern[1] != '\0'); /* Check the condition */ if (pattern[i] == '!') on = !get_field(key, pattern[++i]); else on = get_field(key, pattern[i]) != NULL; if (pattern[i+1] != ':') errexit("%s: missing ':' in pattern\n", prog); /* Skip or copy until matching '%}' */ if (! on) { /* Skip until matching '}' */ for (i += 2, level = 1; level != 0; i++) if (pattern[i] == '%') { if (pattern[++i] == '{') level++; else if (pattern[i] == '}') level--; } i--; /* i points to '}' */ } else { /* Recursively copy segment */ for (i += 2; true; i++) if (pattern[i] == '%') { if (pattern[++i] == '{') i += conditional(pattern + i, key, last); else if (pattern[i] == '}') break; else if (pattern[i] == '%') {putchar('%'); *last = '\0';} else put_field(key, pattern[i], last); } else if (*last != '.' || pattern[i] != '.') { putchar(pattern[i]); *last = '\0'; } else { *last = '\0'; /* Don't print this '.' */ } } return i; /* Points at '}' */ } /* copy -- copy pattern, expanding fields. (May sort keys) */ static void copy(const string pattern, string *keys, const int n) { int j, start, end, level, slen = 0; unsigned char last = '\0'; /* Last char of field */ assert(sortorder == NULL); /* ToDo: Find a way to declare the separator in the source. Maybe {&:...} */ /* Find first '%{'. Also look for sort order */ for (start = 0; pattern[start]; start++) { if (pattern[start] == '%') { /* Special character */ if (pattern[++start] == '{') { /* Start of template */ break; } else if ('A' <= pattern[start] && pattern[start] <= 'Z') { renewarray(sortorder, slen + 2); /* Sort order */ sortorder[slen] = pattern[start]; sortorder[++slen] = '\0'; } else { putchar('%'); /* Not special */ putchar(pattern[start]); } } else { /* Normal character */ putchar(pattern[start]); } } if (!pattern[start]) { fprintf(stderr, "%s: warning: no '%%{' in input file\n", prog); return; /* Nothing more to copy */ } /* Sort the keys if there was a sort order */ if (sortorder) sort_keys(keys, n); /* Start now points to '{'. Find matching '%}' */ for (end = start + 1, level = 1; pattern[end] && level != 0; end++) { if (pattern[end] == '%') { if (pattern[++end] == '}') level--; else if (pattern[end] == '{') level++; } } if (level != 0) errexit("%s: unbalanced %{..%} in pattern\n", prog); /* End now points just after '}'. Loop over keys */ for (j = 0; j < n; j++) conditional(pattern + start, keys[j], &last); /* Copy postamble */ printf("%s", pattern + end); } /* in_list -- check if s is in the list of strings */ static bool in_list(const string s, const string *list, const int n) { int i; for (i = 0; i < n && strcmp(s, list[i]) != 0; i++) ; return i < n; } /* read_keys -- read the list of keys from file f */ static string *read_keys(FILE *f, int *number) { int i, e, n = 0; char line[LINESIZE]; string *keys = NULL; clearerr(f); while (fgets(line, sizeof(line), f)) { /* Remove trailing \n and other whitespace */ for (i = strlen(line); i > 0 && isspace(line[i-1]); i--) ; line[i] = '\0'; /* ToDo: linear search fast enough? Books don't have 1000's of refs... */ if (! in_list(line, keys, n)) { renewarray(keys, INCR * ((n + 1)/INCR + 1)); keys[n++] = newstring(line); } } if ((e = ferror(f))) errexit("%s: %s\n", prog, strerror(e)); *number = n; return keys; } /* check_and_store_entry -- check if we need this entry and if so store it */ static void check_and_store_entry(const string key, string *lines, int n) { ENTRY e, *e1; renewarray(lines, INCR * ((n + 1)/INCR + 1)); lines[n] = NULL; /* Mark end of entry */ if (key) { /* Does it have a key at all */ e.key = key; if ((e1 = hsearch(e, FIND))) /* Do we need this entry? */ e1->data = (char*)lines; /* Replace its data field */ } } /* read_entries -- read the relevant entries from the refer database */ static void read_entries(FILE *f, const string *keys, const int n) { char line[LINESIZE]; string *lines = NULL; string key = NULL; ENTRY e, *e1; int i, j, fe; /* First enter all keys into the hash table without any data */ for (i = 0; i < n; i++) { e.key = newstring(keys[i]); e.data = NULL; if (! hsearch(e, ENTER)) errexit("%s: %s\n", prog, strerror(errno)); } /* Now read entries from the database */ clearerr(f); i = 0; while (fgets(line, sizeof(line), f)) { if (line[0] != '%') { /* Separator line */ if (i != 0) { /* We were in an entry */ check_and_store_entry(key, lines, i); i = 0; /* Reset */ key = NULL; /* Reset */ lines = NULL; /* Reset */ } } else { /* This line is a field */ for (j = strlen(line); j > 0 && isspace(line[j-1]); j--) ; line[j] = '\0'; /* Remove trailing spaces */ renewarray(lines, INCR * ((i + 1)/INCR + 1)); lines[i] = newstring(line); if (strncmp(lines[i], "%L ", 3) == 0) key = lines[i] + 3; i++; } } if ((fe = ferror(f))) errexit("%s: %s\n", prog, strerror(fe)); /* Check if last entry was already stored */ if (i != 0) /* We were still in an entry */ check_and_store_entry(key, lines, i); /* Check that we found all keys */ for (i = 0; i < n; i++) { e.key = keys[i]; e1 = hsearch(e, FIND); assert(e1); if (! e1->data) errexit("%s: entry for \"%s\" not found\n", prog, keys[i]); } } /* read_pattern -- read the input file into memory */ static string read_pattern(FILE *f) { string p = NULL; int n, len = 0; /* ToDo: use ferror to check for errors */ do { renewarray(p, len + LINESIZE + 1); n = fread(p + len, sizeof(*p), LINESIZE, f); len += n; } while (! feof(f)); p[len] = '\0'; return p; } /* usage -- print usage message and exit */ static void usage(void) { errexit("Version %s\nUsage: %s [-a auxfile] [-s sep] [-n maxauthors] [-r moreauthors] bibfile [inputfile]\n", VERSION, prog); } /* main - main body */ int main(int argc, char *argv[]) { string auxfile = NULL, pattern, inputfile = NULL, dbfile, h; string *keys = NULL; FILE *f, *db, *aux; int c, n; /* Parse command line */ prog = argv[0]; while ((c = getopt(argc, argv, "a:s:n:r:")) != -1) { switch (c) { case 'a': auxfile = optarg; break; case 's': separator = optarg; break; case 'n': et_al_limit = atoi(optarg); break; case 'r': et_al = optarg; break; default: usage(); } } if (optind == argc || argc > optind + 2) usage(); /* First argument is refer database */ dbfile = argv[optind++]; /* Optional second argument is input file */ if (optind != argc) inputfile = argv[optind]; /* If we don't have an explicit auxfile yet, derive its name */ if (! auxfile) { if (! inputfile) { auxfile = "aux.aux"; } else { newarray(auxfile, strlen(argv[optind]) + 5); strcpy(auxfile, argv[optind]); if ((h = strrchr(auxfile, '.'))) *h = '\0'; strcat(auxfile, ".aux"); } } /* Create a hash table */ if (! hcreate(HASHSIZE)) errexit("%s: not enough memory for hash table\n", prog); /* Read the pattern *before* the auxfile, so that we have a chance that the pipeline "hxcite -a aux bibfile file | hxmkib -a aux bibfile" works. I.e., that hxcite finished writing the auxfile before we start reading it. */ /* Read pattern into memory */ if (! (f = inputfile ? fopen(inputfile, "r") : stdin)) errexit("%s: %s: %s\n", prog, inputfile, strerror(errno)); pattern = read_pattern(f); if (fclose(f) != 0) errexit("%s: %s: %s\n", prog, inputfile, strerror(errno)); /* Read keys from aux file */ if (! (aux = fopen(auxfile, "r"))) errexit("%s: %s: %s\n", prog, auxfile, strerror(errno)); keys = read_keys(aux, &n); if (fclose(aux) != 0) errexit("%s: %s: %s\n", prog, auxfile, strerror(errno)); /* Read the entries we need from the database */ if (! (db = fopen(dbfile, "r"))) errexit("%s: %s: %s\n", prog, dbfile, strerror(errno)); read_entries(db, keys, n); if (fclose(db) != 0) errexit("%s: %s: %s\n", prog, dbfile, strerror(errno)); /* Copy and expand the pattern */ copy(pattern, keys, n); return 0; } html-xml-utils-7.7/malloc.c0000644000175000017500000000043213244022534012621 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #undef malloc #include void *malloc (); /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ void * rpl_malloc (size_t n) { if (n == 0) n = 1; return malloc (n); } html-xml-utils-7.7/hxnsxml.10000644000175000017500000000130313244022534012767 00000000000000.TH "HXNSXML" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxnsxml \- convert output of hxxmlns back to XML .SH SYNOPSIS .B hxnsxml .RI "[\| " file " \|]" .SH DESCRIPTION .B hxnsxml looks for element and attribute names that start with an XML Namespace in curly braces and converts them into normal element and attribute names paired with an xmlns attribute. E.g., <{http://example.org/foo}bar> is converted to .SH "DIAGNOSTICS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the XML file. .B hxnsxml will try to correct the error and produce output anyway. .SH "SEE ALSO" .BR hxxmlns (1), html-xml-utils-7.7/hxremove.10000644000175000017500000000334713244022534013135 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXREMOVE" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxremove \- remove elements from an XML file by means of a CSS selector .SH SYNOPSIS .B hxremove .RB "[\| " \-i " \|]" .RB "[\| " \-l .IR language " \|]" .I selectors .SH DESCRIPTION .B hxremove reads a well-formed XML document from standard input and writes it to standard output without any elements that match one of the CSS selectors that are given as argument. For example .d hxremove ol li:first-child .e removes the first li (list item in XHTML) from every ol (ordered list). .PP If there are multiple selectors, they must be separated by commas. For example, .d hxremove p + ul, blockquote ol .e removes all ul elements that follow a p element and also all ol elements that are descendants of a blockquote element. .PP .B hxremove assumes that class selectors (".foo") refer to an attribute called "class". And assumes that ID selectors ("#foo") refer to an attribute called "id". .PP To handle HTML files, make them well-formed XML first, e.g., with .BR "hxnormalize -x" . .PP Compare with .BR hxselect , which removes everything .I but the selected elements. .SH OPTIONS The following options are supported: .TP 10 .B \-i Match case-insensitively. Useful for HTML and some other SGML-based languages. .TP .BI \-l " language" Sets the default language, in case the root element doesn't have an xml:lang attribute (default: none). Example: .B \-l en .SH OPERANDS The following operand is supported: .TP .I selectors One or more comma-separated selectors. Most selectors from CSS level 3 are supported. .SH "SEE ALSO" .BR asc2xml (1), .BR xml2asc (1), .BR hxnormalize (1), .BR hxselect (1), .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/AUTHORS0000644000175000017500000000002713244022534012256 00000000000000Bert Bos html-xml-utils-7.7/dtd.c0000644000175000017500000004376213271372166012153 00000000000000/* C code produced by gperf version 3.0.4 */ /* Command-line: gperf -a -c -C -o -t -p -T -k '1,2,$' -N lookup_element dtd.hash */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 1 "dtd.hash" /* -*-indented-text-*- */ /* * Copyright © 1998-2017 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Author: Bert Bos * Created: 5 Nov 1998 * * Input file for gperf, to generate a perfect hash function * for all HTML tags, and to store each element's type. * * mixed = element accepts text content * empty = element is empty * cdata = element has character data content (i.e., unparsed content) * stag = start tag is required * etag = end tag is required * pre = element is preformatted * break_before, break_after = pretty-print with a newline before/after the elt * parents = array of possible parents, first one is preferred parent * * The DTD is a mixture of strict HTML 4.0 and some HTML5 * */ #include #include #include #include #include #include "export.h" #include "types.e" #define MAXNAMELEN 10 /* Max. len. of elt. name */ EXPORTDEF(MAXNAMELEN) EXPORT typedef struct _ElementType { string name; bool mixed, empty, cdata, stag, etag, pre, break_before, break_after; string parents[76]; } ElementType; /* lookup_element -- look up the string in the hash table */ EXPORT const ElementType * lookup_element(/* register const char *str, register unsigned int len */); /* Different kinds of parent elements: */ #define PHRASE "abbr", "acronym", "b", "bdi", "bdo", "big", "cite", "code", "dfn", "em", "i", "kbd", "q", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "tt", "u", "var" #define BRIDGE "p", "address", "caption", "dt", "h1", "h2", "h3", "h4", "h5", "h6", "legend", "pre" #define FLOW "article", "aside", "dd", "del", "details", "div", "fieldset", "figcaption", "figure", "footer", "header", "ins", "li", "nav", "section", "main", "object", "td", "th" #define INLINE_PARENT BRIDGE, PHRASE, FLOW #define BLOCK_PARENT "body", "blockquote", "map", "main" #define TOTAL_KEYWORDS 97 #define MIN_WORD_LENGTH 1 #define MAX_WORD_LENGTH 10 #define MIN_HASH_VALUE 1 #define MAX_HASH_VALUE 227 /* maximum key range = 227, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (str, len) register const char *str; register unsigned int len; { static const unsigned char asso_values[] = { 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 0, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 35, 30, 20, 15, 5, 0, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 5, 60, 80, 5, 0, 85, 37, 65, 20, 228, 15, 10, 10, 25, 35, 25, 0, 80, 30, 0, 65, 105, 0, 228, 40, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228 }; register int hval = len; switch (hval) { default: hval += asso_values[(unsigned char)str[1]]; /*FALLTHROUGH*/ case 1: hval += asso_values[(unsigned char)str[0]]; break; } return hval + asso_values[(unsigned char)str[len - 1]]; } #ifdef __GNUC__ __inline #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ __attribute__ ((__gnu_inline__)) #endif #endif const ElementType * lookup_element (str, len) register const char *str; register unsigned int len; { static const ElementType wordlist[] = { {""}, #line 130 "dtd.hash" {"q", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 153 "dtd.hash" {"tt", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, {""}, {""}, #line 90 "dtd.hash" {"dt", 1, 0, 0, 1, 0, 0, 1, 1, {"dl", NULL}}, {""}, {""}, #line 143 "dtd.hash" {"table", 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 62 "dtd.hash" {"a", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "label", NULL}}, #line 145 "dtd.hash" {"td", 1, 0, 0, 1, 0, 0, 1, 1, {"tr", NULL}}, #line 146 "dtd.hash" {"textarea", 1, 0, 0, 1, 1, 1, 0, 0, {INLINE_PARENT, "a", "label", NULL}}, {""}, #line 61 "dtd.hash" {"%data", 1, 0, 0, 1, 0, 0, 0, 0, {"p", NULL}}, {""}, #line 84 "dtd.hash" {"dd", 1, 0, 0, 1, 0, 0, 1, 1, {"dl", NULL}}, #line 85 "dtd.hash" {"del", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, BLOCK_PARENT, "a", "button", "noscript", "form", "label", "option", "textarea", NULL}}, #line 120 "dtd.hash" {"meta", 0, 1, 0, 1, 0, 0, 1, 0, {INLINE_PARENT, "head", "a", "button", "noscript", "label", NULL}}, #line 92 "dtd.hash" {"embed", 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 115 "dtd.hash" {"legend", 1, 0, 0, 1, 1, 0, 1, 1, {"fieldset", NULL}}, #line 91 "dtd.hash" {"em", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, #line 150 "dtd.hash" {"title", 1, 0, 0, 1, 1, 0, 1, 1, {"head", NULL}}, {""}, #line 89 "dtd.hash" {"dl", 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, {""}, #line 114 "dtd.hash" {"label", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", NULL}}, {""}, {""}, {""}, {""}, #line 139 "dtd.hash" {"style", 1, 0, 1, 1, 1, 1, 1, 0, {"head", NULL}}, #line 134 "dtd.hash" {"select", 0, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "label", NULL}}, {""}, {""}, {""}, #line 68 "dtd.hash" {"aside", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 108 "dtd.hash" {"i", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 86 "dtd.hash" {"details", 1, 0, 0, 1, 1, 0, 1, 1, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 119 "dtd.hash" {"map", 0, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 118 "dtd.hash" {"main", 1, 0, 0, 1, 1, 0, 1, 1, {"body", "div", "noscript", NULL}}, #line 128 "dtd.hash" {"param", 0, 1, 0, 1, 0, 0, 1, 1, {"object", NULL}}, #line 113 "dtd.hash" {"keygen", 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 65 "dtd.hash" {"address", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, #line 117 "dtd.hash" {"link", 0, 1, 0, 1, 0, 0, 1, 0, {"head", NULL}}, #line 110 "dtd.hash" {"input", 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "label", NULL}}, #line 127 "dtd.hash" {"p", 1, 0, 0, 1, 0, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 116 "dtd.hash" {"li", 1, 0, 0, 1, 0, 0, 1, 1, {"ul", "ol", NULL}}, {""}, {""}, #line 135 "dtd.hash" {"small", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, #line 124 "dtd.hash" {"ol", 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, {""}, {""}, {""}, #line 133 "dtd.hash" {"section", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, #line 131 "dtd.hash" {"samp", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, #line 103 "dtd.hash" {"h6", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 122 "dtd.hash" {"noscript", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, BLOCK_PARENT, "a", "button", "noscript", "form", "label", "option", "textarea", NULL}}, #line 71 "dtd.hash" {"base", 0, 1, 0, 1, 0, 0, 1, 1, {"head", NULL}}, #line 109 "dtd.hash" {"img", 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 136 "dtd.hash" {"source", 0, 1, 0, 1, 0, 0, 1, 1, {"audio", "video", "template", NULL}}, {""}, #line 138 "dtd.hash" {"strong", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 104 "dtd.hash" {"head", 0, 0, 0, 0, 0, 0, 1, 1, {"html", NULL}}, #line 149 "dtd.hash" {"thead", 0, 0, 0, 1, 0, 0, 1, 1, {"table", NULL}}, {""}, #line 102 "dtd.hash" {"h5", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 111 "dtd.hash" {"ins", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, BLOCK_PARENT, "a", "button", "noscript", "form", "label", "option", "textarea", NULL}}, #line 107 "dtd.hash" {"html", 0, 0, 0, 0, 0, 0, 1, 1, {NULL, NULL}}, #line 75 "dtd.hash" {"blockquote", 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, {""}, #line 112 "dtd.hash" {"kbd", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 137 "dtd.hash" {"span", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, #line 154 "dtd.hash" {"ul", 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 72 "dtd.hash" {"bdi", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, #line 147 "dtd.hash" {"tfoot", 0, 0, 0, 1, 0, 0, 1, 1, {"table", NULL}}, #line 126 "dtd.hash" {"option", 1, 0, 0, 1, 0, 0, 1, 1, {"select", "optgroup", NULL}}, #line 67 "dtd.hash" {"article", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 125 "dtd.hash" {"optgroup", 0, 0, 0, 1, 1, 0, 1, 1, {"select", NULL}}, #line 66 "dtd.hash" {"area", 0, 1, 0, 1, 0, 0, 0, 0, {"map", NULL}}, {""}, {""}, #line 101 "dtd.hash" {"h4", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, {""}, #line 152 "dtd.hash" {"track", 0, 1, 0, 1, 0, 0, 1, 1, {"audio", "video", "template", NULL}}, #line 123 "dtd.hash" {"object", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "del", "header", "aside", "section", "main", "article", "nav", "fieldset", "head", "ins", "label", "object", NULL}}, #line 64 "dtd.hash" {"acronym", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 73 "dtd.hash" {"bdo", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 80 "dtd.hash" {"cite", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 144 "dtd.hash" {"tbody", 0, 0, 0, 0, 0, 0, 1, 1, {"table", NULL}}, {""}, #line 100 "dtd.hash" {"h3", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 129 "dtd.hash" {"pre", 1, 0, 0, 1, 1, 1, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, #line 69 "dtd.hash" {"audio", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 95 "dtd.hash" {"figure", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, #line 93 "dtd.hash" {"fieldset", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "form", NULL}}, {""}, {""}, #line 132 "dtd.hash" {"script", 1, 0, 1, 1, 1, 1, 1, 0, {"body", INLINE_PARENT, "blockquote", "head", "map", "a", "button", "noscript", "form", "label", NULL}}, #line 79 "dtd.hash" {"caption", 1, 0, 0, 1, 1, 0, 1, 1, {"table", NULL}}, #line 87 "dtd.hash" {"dfn", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 81 "dtd.hash" {"code", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 74 "dtd.hash" {"big", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, #line 70 "dtd.hash" {"b", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, #line 142 "dtd.hash" {"sup", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, {""}, #line 99 "dtd.hash" {"h2", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 82 "dtd.hash" {"col", 0, 1, 0, 1, 0, 0, 0, 0, {"colgroup", "table", NULL}}, {""}, {""}, {""}, #line 148 "dtd.hash" {"th", 1, 0, 0, 1, 0, 0, 1, 1, {"tr", NULL}}, #line 88 "dtd.hash" {"div", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 97 "dtd.hash" {"form", 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, NULL}}, {""}, {""}, #line 98 "dtd.hash" {"h1", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 121 "dtd.hash" {"nav", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, #line 76 "dtd.hash" {"body", 0, 0, 0, 0, 0, 0, 1, 1, {"html", NULL}}, #line 94 "dtd.hash" {"figcaption", 1, 0, 0, 1, 1, 0, 1, 1, {"figure", NULL}}, {""}, #line 141 "dtd.hash" {"summary", 1, 0, 0, 1, 1, 0, 0, 0, {"details", NULL}}, #line 157 "dtd.hash" {"wbr", 0, 1, 0, 1, 0, 0, 0, 1, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, {""}, {""}, #line 83 "dtd.hash" {"colgroup", 0, 0, 0, 1, 1, 0, 1, 1, {"table", NULL}}, #line 63 "dtd.hash" {"abbr", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, #line 105 "dtd.hash" {"header", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, {""}, {""}, {""}, #line 78 "dtd.hash" {"button", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "label", NULL}}, {""}, #line 140 "dtd.hash" {"sub", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, {""}, #line 151 "dtd.hash" {"tr", 0, 0, 0, 1, 0, 0, 1, 1, {"tbody", "tfoot", "thead", NULL}}, {""}, {""}, #line 156 "dtd.hash" {"video", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, #line 155 "dtd.hash" {"var", 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, #line 96 "dtd.hash" {"footer", 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, #line 77 "dtd.hash" {"br", 0, 1, 0, 1, 0, 0, 0, 1, {INLINE_PARENT, "a", "button", "noscript", "label", NULL}}, {""}, {""}, {""}, {""}, #line 106 "dtd.hash" {"hr", 0, 1, 0, 1, 0, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL}} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) { register const char *s = wordlist[key].name; if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') return &wordlist[key]; } } return 0; } #line 158 "dtd.hash" html-xml-utils-7.7/hxnsxml.c0000644000175000017500000001170413244022534013057 00000000000000/* * hxnsxml - convert output of hxxmlns back to normal XML * * To do: handle quotes in Namespace URLs. * To do: handle XML's own Namespace. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 1994-2010 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 12 July 2010 * **/ #include "config.h" #include #ifdef HAVE_UNISTD_H # include #endif #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #include #include #include #include "export.h" #include "types.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" #define XML "{http://www.w3.org/XML/1998/namespace}" static bool has_error = false; static bool has_ns = false; /* true if Namespaces occur anywhere in document */ /* --------------- implements interface api.h -------------------------- */ /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); has_error = true; } /* start -- called before the first event is reported */ void* start(void) { return NULL; } /* end -- called after the last event is reported */ void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { printf("", commenttext); } /* handle_text -- called after a text chunk is parsed */ void handle_text(void *clientdata, string text) { printf("%s", text); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) { printf("\n"); } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { printf("", pi_text); } /* print_attrs -- print attributes */ void print_attrs(const pairlist attribs) { pairlist p; int i, j; char c = 'a'; for (p = attribs; p; p = p->next) { if (p->name[0] != '{') { i = 0; } else { for (i = 1; p->name[i] && p->name[i] != '}'; i++); if (p->name[i]) i++; } if (i > 2) { if (c > 'z') { fprintf(stderr, "Bug: hxnsxml cannot handle > 26 namespaces per element.\n"); exit(2); } printf(" xmlns:%c=\"", c); for (j = 1; j < i - 1; j++) putchar(p->name[j]); putchar('\"'); printf(" %c:", c); c++; } else { printf(" "); } printf("%s=\"%s\"", p->name + i, p->value); } } /* print_tag -- print "<" and the element name, optionally with a namespace */ static void print_tag(const conststring name) { int i, j; if (name[0] != '{') { i = 0; } else { for (i = 1; name[i] && name[i] != '}'; i++); if (name[i]) i++; } printf("<%s", name + i); if (i > 2) { /* Element has a Namespace */ printf(" xmlns=\""); for (j = 1; j < i - 1; j++) putchar(name[j]); putchar('"'); has_ns = true; } else if (has_ns) { /* Document has Namespaces, this element not */ printf(" xmlns=\"\""); } } /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { print_tag(name); print_attrs(attribs); putchar('>'); } /* handle_emptytag -- called after an empty tag is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { print_tag(name); print_attrs(attribs); printf(" />"); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { int i; if (name[0] != '{') { i = 0; } else { for (i = 1; name[i] && name[i] != '}'; i++); if (name[i]) i++; } printf("", name + i); } /* --------------------------------------------------------------------- */ /* usage -- print usage message and exit */ static void usage(string prog) { fprintf(stderr, "Version %s\nUsage: %s [file-or-url]\n", VERSION, prog); exit(2); } int main(int argc, char *argv[]) { int status = 200; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); if (argc > 2) usage(argv[0]); else if (argc == 2) yyin = fopenurl(argv[1], "r", &status); else yyin = stdin; if (!yyin) {perror(argv[1]); exit(1);} if (status != 200) errexit("%s : %s\n", argv[1], http_strerror(status)); if (yyparse() != 0) exit(3); return has_error ? 1 : 0; } html-xml-utils-7.7/hxmultitoc.10000644000175000017500000000073613244022534013477 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXMULTITOC" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxmultitoc \- create a table of content for a set of HTML files .SH SYNOPSIS .B hxmultitoc .RB "[\| " \-x " \|]" .RB "[\| " \-s .IR preample " \|]" .RB "[\| " \-e .IR postample " \|]" .RB "[\| " \-l .IR low .RB " | " \-h .IR high .RB " | " \-b .IR base .RB " | " \-c .IR configfile .RI " | " file " \|] ..." .SH DESCRIPTION [ToDo] html-xml-utils-7.7/hxunxmlns.c0000645000175000017500000001321013244022534013415 00000000000000/* * unxmlns - convert <{namespace}foo> to * * This program is the reverse of xmlns. * * To do: optimize, i.e., reuse inherited namespace declaration, * instead of declaring them again on every element. * * Copyright © 2005 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 8 November 2005 * Version: $Id: hxunxmlns.c,v 1.7 2017/11/24 09:50:25 bbos Exp $ * **/ #include "config.h" #include #ifdef HAVE_UNISTD_H # include #endif #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif #endif #include #include #include #include "export.h" #include "types.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" #define XMLNS "{http://www.w3.org/XML/1998/namespace}" const static size_t XMLNSLEN = 39; /* strlen(XMLNS) */ extern int yylineno; /* From scan.l */ static bool has_error = false; /* --------------- implements interface api.h -------------------------- */ /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); has_error = true; } /* start -- called before the first event is reported */ void* start(void) { return NULL; } /* end -- called after the last event is reported */ void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { printf("", commenttext); } /* handle_text -- called after a text chunk is parsed */ void handle_text(void *clientdata, string text) { fputs(text, stdout); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, string gi, string fpi, string url) { printf(""); } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { printf("", pi_text); } /* print_attrs -- print attributes and declare their namespaces, if any */ static void print_attrs(const pairlist attribs) { string h, s; pairlist p; int n = 0; for (p = attribs; p; p = p->next) { if (p->name[0] != '{') { printf(" %s=\"%s\"", p->name, p->value); } else if (p->name[1] == '}') { printf(" %s=\"%s\"", p->name + 2, p->value); } else if (strncmp(p->name, XMLNS, XMLNSLEN) == 0) { printf(" xml:%s=\"%s\"", p->name + XMLNSLEN, p->value); } else if (! (h = strchr(p->name, '}'))) { fprintf(stderr, "%d: Unmatched \"{\" in attribute name (\"%s\")\n", yylineno, p->name); has_error = true; } else { printf(" xmlns:x%d=\"", n); for (s = p->name + 1; s != h; s++) putchar(*s); printf("\" x%d:%s=\"%s\"", n, h + 1, p->value); } } } /* print_tag_start -- print "'); } /* handle_emptytag -- called after an empty tag is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { print_tag_start(name); print_attrs(attribs); printf(" />"); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { string h; if (name[0] != '{') { printf("", name); } else if (! (h = strchr(name, '}'))) { fprintf(stderr, "%d: Unmatched \"{\" in tag name (\"%s\")\n", yylineno, name); has_error = true; } else { printf("", h + 1); } } /* --------------------------------------------------------------------- */ /* usage -- print usage message and exit */ static void usage(string prog) { fprintf(stderr, "Version %s\nUsage: %s [html-file-or-url]\n", VERSION, prog); exit(2); } int main(int argc, char *argv[]) { int i, status = 200; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Parse command line arguments */ for (i = 1; i < argc && argv[i][0] == '-' && !eq(argv[i], "--"); i++) { switch (argv[i][1]) { default: usage(argv[0]); } } if (i < argc && eq(argv[i], "--")) i++; if (i == argc) yyin = stdin; else if (i == argc - 1 && eq(argv[i], "-")) yyin = stdin; else if (i == argc - 1) yyin = fopenurl(argv[i], "r", &status); else usage(argv[0]); if (yyin == NULL) {perror(argv[i]); exit(1);} if (status != 200) errexit("%s : %s\n", argv[i], http_strerror(status)); if (yyparse() != 0) exit(3); return has_error ? 1 : 0; } html-xml-utils-7.7/NEWS0000644000175000017500000000000013244022534011674 00000000000000html-xml-utils-7.7/fopencookie.h0000644000175000017500000000111513244022534013657 00000000000000#ifndef _FOPENCOOKIE_H_ #define _FOPENCOOKIE_H_ typedef signed long long int off64_t; typedef ssize_t cookie_read_function_t (void *, char *, size_t); typedef ssize_t cookie_write_function_t (void *, const char *, size_t); typedef int cookie_seek_function_t (void *, off64_t, int); typedef int cookie_close_function_t (void *); typedef struct { cookie_read_function_t *read; cookie_write_function_t *write; cookie_seek_function_t *seek; cookie_close_function_t *close; } cookie_io_functions_t; FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t funcs); #endif html-xml-utils-7.7/export.h0000644000175000017500000000161713244022534012706 00000000000000/* * export.h -- header file for programs that use cexport * * Copyright 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * * Functions, type definitions, variable declarations can all be * exported by putting EXPORT (uppercase only) in front of the * declaration. The declarations must be ANSI-C. Macros can be * exported with EXPORTDEF. Examples: * * EXPORT int sqr(int n) {...} -- exports function sqr() * EXPORT typedef struct _Str * MyStr; -- exports type MyStr * EXPORT int maximum; -- exports variable maximum * #define max(a,b) ((a)>(b)?(a):(b)) * EXPORTDEF(max(a,b)) -- exports macro max(a,b) */ #ifndef _EXPORT_H_ #define _EXPORT_H_ #ifndef __export #define EXPORT /* nothing */ #define EXPORTDEF(x) /* nothing */ #else //#define EXPORTDEF(x) EXPORTDEF_##x x #define EXPORTDEF(x) EXPORTDEF #x x #endif #endif /* _EXPORT_H_ */ html-xml-utils-7.7/hxnum.c0000645000175000017500000002217313244022534012520 00000000000000/* * Number headers. Counters are inserted at the start * of H1 to H6. CLASS="no-num" suppresses numbering for * that heading. * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Bert Bos * Created Sep 1997 * $Id: hxnum.c,v 1.11 2017/11/24 09:50:25 bbos Exp $ */ #include "config.h" #include #ifdef HAVE_UNISTD_H # include #endif #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #include #include #include "export.h" #include "types.e" #include "class.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" #define SECNO "secno" /* class attribute */ #define NO_NUM "no-num" /* class-attribute */ #define OPTS ":l:h:n:1:2:3:4:5:6:?" /* Command line options */ static int h[] = {-1, 0, 0, 0, 0, 0, 0}; /* Counters for each level */ static int low = 1; /* First counter to use */ static int high = 6; /* Last counter to use */ static string format[7] = { /* Format for each counter */ NULL, "%d.", "%d.%d.", "%d.%d.%d.", "%d.%d.%d.%d.", "%d.%d.%d.%d.%d.", "%d.%d.%d.%d.%d.%d."}; static int skipping = 0; /* >0 to suppress output */ /* romannumeral -- generate roman numeral for 1 <= n <= 4000 */ static char* romannumeral(int n) { static char buf[30]; int len = 0; while (n >= 1000) {buf[len++] = 'M'; n -= 1000;} if (n >= 500) {buf[len++] = 'D'; n -= 500;} while (n >= 100) {buf[len++] = 'C'; n -= 100;} if (n >= 50) {buf[len++] = 'L'; n -= 50;} while (n >= 10) {buf[len++] = 'X'; n -= 10;} if (n >= 9) {buf[len++] = 'I'; buf[len++] = 'X'; n -= 9;} if (n >= 5) {buf[len++] = 'V'; n -= 5;} if (n >= 4) {buf[len++] = 'I'; buf[len++] = 'V'; n -= 4;} while (n >= 1) {buf[len++] = 'I'; n -= 1;} buf[len] = '\0'; return buf; } /* --------------- implements interface api.h -------------------------- */ /* handle_error -- called when a parse error occurred */ void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ void* start(void) { return NULL; } /* end -- called after the last event is reported */ void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ void handle_comment(void *clientdata, string commenttext) { printf("", commenttext); } /* handle_text -- called after a text chunk is parsed */ void handle_text(void *clientdata, string text) { if (skipping == 0) fputs(text, stdout); } /* handle_decl -- called after a declaration is parsed */ void handle_decl(void *clientdata, const string gi, const string fpi, const string url) { if (skipping == 0) { printf(""); } } /* handle_pi -- called after a PI is parsed */ void handle_pi(void *clientdata, string pi_text) { if (skipping == 0) printf("", pi_text); } /* handle_starttag -- called after a start tag is parsed */ void handle_starttag(void *clientdata, string name, pairlist attribs) { pairlist p; int lev, i; string s; /* Skip everything inside */ if (skipping > 0) { skipping++; return; } /* Check for old counters, skip them */ if (strcasecmp(name, "span") == 0 && has_class(attribs, SECNO)) { skipping = 1; return; } /* Print tag and attributes */ printf("<%s", name); for (p = attribs; p != NULL; p = p->next) { printf(" %s", p->name); if (p->value != NULL) printf("=\"%s\"", p->value); } printf(">"); /* If header, insert counters */ if (eq("h1", name) || eq("H1", name)) lev = 1; else if (eq("h2", name) || eq("H2", name)) lev = 2; else if (eq("h3", name) || eq("H3", name)) lev = 3; else if (eq("h4", name) || eq("H4", name)) lev = 4; else if (eq("h5", name) || eq("H5", name)) lev = 5; else if (eq("h6", name) || eq("H6", name)) lev = 6; else lev = 0; /* Don't number headers with class "no-num" */ if (lev > 0 && has_class(attribs, NO_NUM)) lev = 0; if (low <= lev && lev <= high) { h[lev]++; for (i = lev + 1; i <= high; i++) h[i] = 0; printf("", SECNO); for (i = low, s = format[lev]; *s; s++) { if (*s == '%') { s++; switch (*s) { case 'n': i++; break; /* No number */ case 'd': printf("%d", h[i++]); break; /* Decimal */ case 'a': printf("%c", 'a' + (h[i++] - 1)); break; /* Lowercase */ case 'A': printf("%c", 'A' + (h[i++] - 1)); break; /* Uppercase */ case 'i': printf("%s", down(romannumeral(h[i++]))); break; case 'I': printf("%s", romannumeral(h[i++])); break; /* Roman */ default: putchar(*s); /* Escaped char */ } } else { putchar(*s); } } printf(" "); } } /* handle_emptytag -- called after an empty tag is parsed */ void handle_emptytag(void *clientdata, string name, pairlist attribs) { pairlist p; if (skipping == 0) { printf("<%s", name); for (p = attribs; p != NULL; p = p->next) { printf(" %s", p->name); if (p->value != NULL) printf("=\"%s\"", p->value); } printf(" />"); } } /* handle_endtag -- called after an endtag is parsed (name may be "") */ void handle_endtag(void *clientdata, string name) { if (skipping == 0) printf("", name); else skipping--; } /* --------------------------------------------------------------------- */ /* usage -- print usage message and exit */ static void usage(string prog) { fprintf(stderr, "Version %s\n\ Usage: %s [-l low] [-h high] [-1 format] [-2 format] [-3 format]\n\ [-4 format] [-5 format] [-6 format] [html-file]\n", VERSION, prog); exit(2); } /* help -- print help */ static void help(void) { printf("Version %s\n", VERSION); printf("Options:\n"); printf(" -l low lowest header level to number (1-6) [default 1]\n"); printf(" -h high highest header level to number (1-6) [default 6]\n"); printf(" -n start number of first heading [default: 1]\n"); printf(" -1 format format for level 1 [default \"%%d.\"]\n"); printf(" -2 format format for level 2 [default \"%%d.%%d.\"]\n"); printf(" -3 format format for level 3 [default \"%%d.%%d.%%d.\"]\n"); printf(" -4 format format for level 4 [default \"%%d.%%d.%%d.%%d.\"]\n"); printf(" -5 format format for level 5 [default \"%%d.%%d.%%d.%%d.%%d.\"]\n"); printf(" -6 format format for level 6 [default \"%%d.%%d.%%d.%%d.%%d.%%d.\"]\n"); printf(" -? this help\n"); printf("The format strings may contain:\n"); printf(" %%d replaced by decimal number\n"); printf(" %%a replaced by letter a, b, c,..., z\n"); printf(" %%A replaced by letter A, B, C,..., Z\n"); printf(" %%i replaced by lowercase roman numeral i, ii, iii,...\n"); printf(" %%I replaced by roman numeral I, II, III,...\n"); printf(" %%n replaced by nothing, but skips a level\n"); printf(" %%%% replaced by a %%\n"); printf("The first %% in the format is replaced by the counter for level\n"); printf("low, the second by the counter for low+1, etc.\n"); exit(0); } int main(int argc, char *argv[]) { int i, status = 200, c; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* First find -l and -h */ while ((c = getopt(argc, argv, OPTS)) != -1) { switch (c) { case 'l': low = atoi(optarg); break; case 'h': high = atoi(optarg); break; default: /* skip */; } } if (low < 1 || low > 6 || high < 1 || high > 6) usage(argv[0]); #ifdef HAVE_GETOPT_OPTRESET optreset = 1; #else optind = 1; #endif /* If -l and/or -h have been set, the default formats are different */ if (low != 1 || high != 6) { for (i = high; i >= low; i--) format[i] = format[i-low+1]; for (i = high + 1; i <= 6; i++) format[i] = ""; } /* Then treat other options */ while ((c = getopt(argc, argv, OPTS)) != -1) { switch (c) { case 'l': break; /* Already handled */ case 'h': break; /* Already handled */ case 'n': h[low] = atoi(optarg) - 1; break; case '1': format[1] = optarg; break; case '2': format[2] = optarg; break; case '3': format[3] = optarg; break; case '4': format[4] = optarg; break; case '5': format[5] = optarg; break; case '6': format[6] = optarg; break; case '?': help(); break; default: usage(argv[0]); } } if (optind == argc) yyin = stdin; else if (optind == argc - 1 && eq(argv[optind], "-")) yyin = stdin; else if (optind == argc - 1) yyin = fopenurl(argv[optind], "r", &status); else usage(argv[0]); if (yyin == NULL) {perror(argv[optind]); exit(1);} if (status != 200) errexit("%s : %s\n", argv[optind], http_strerror(status)); if (yyparse() != 0) { exit(3); } return 0; } html-xml-utils-7.7/errexit.c0000644000175000017500000000124013244022534013032 00000000000000/* errexit.c -- print message and exit * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 12 May 1998 **/ #include "config.h" #include #include #include #ifdef HAVE_STRING_H # include #elif HAVE_STRINGS_H # include #endif #include "export.h" /* errexit -- print message and exit */ EXPORT int errexit(char *format,...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); exit(1); } html-xml-utils-7.7/hash.e0000644000175000017500000000030613244022534012277 00000000000000typedef struct entry {char *key; void *data;} ENTRY; typedef enum {FIND, ENTER} ACTION; extern int hcreate(size_t nel); extern void hdestroy(void); extern ENTRY *hsearch(ENTRY item, ACTION action); html-xml-utils-7.7/dict.c0000644000175000017500000001560713244022534012307 00000000000000/* dict -- hash table of strings indexed by strings * * dict_create(initial_size) -- create a new, empty hash table * dict_find(dict, key) -- return value for key, or NULL if not found * dict_add(dict, key, value) -- add value for key, overwriting if it exists * dict_destroy(dict, key) -- remove value for key * dict_delete(dict) -- remove table, free memory * * The dictionary will automatically expand beyond its initial size if * it gets full. But enlarging a large dictionary can be slow. The * algorithm will try to keep the dictionary less than 50% filled (as * long as there is memory available), so an initial size of more than * twice the total number of keys results in the best performance. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 2008 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 4 Aug 2008 */ #include #include #include #include "export.h" #define eq(s, t) (*(s) == *(t) && strcmp(s, t) == 0) EXPORT typedef struct _Dictionary * Dictionary; struct _Dictionary { unsigned long size, entries; unsigned long *seqno2index, *index2seqno; char **keys, **values; }; /* hash -- compute a hash sum modulo n over a string */ static unsigned long hash(const unsigned long n, const char *s) { unsigned long h = 5381; for (; *s; s++) h = ((h << 5) + h) ^ (unsigned)*s; h = h % n; if (h == 0) h = 1; /* We don't use index 0 */ return h; } /* find -- return index of key in dictionary, 0 if not found */ static unsigned long find(Dictionary d, const char *key) { unsigned long index0, index, seqno; assert(d); index0 = hash(d->size, key); index = index0; while (1) { seqno = d->index2seqno[index]; if (seqno >= d->entries || d->seqno2index[seqno] != index) return 0; if (eq(d->keys[index], key)) return index; index = (index + 1) % d->size; if (index == 0) index = 1; if (index == index0) return 0; /* We've tried all entries */ } } /* dict_create -- create a new, empty dictionary; return NULL if no memory */ EXPORT Dictionary dict_create(int initial_size) { Dictionary d; if (initial_size < 2) initial_size = 2; if (!(d = malloc(sizeof(*d)))) return NULL; d->keys = d->values = NULL; d->index2seqno = d->seqno2index = NULL; if (!(d->keys = malloc(initial_size * sizeof(*(d->keys)))) || !(d->values = malloc(initial_size * sizeof(*(d->values)))) || !(d->seqno2index = malloc(initial_size * sizeof(*(d->seqno2index)))) || !(d->index2seqno = malloc(initial_size * sizeof(*(d->index2seqno))))) { free(d->index2seqno); free(d->seqno2index); free(d->values); free(d->keys); free(d); return NULL; } d->size = initial_size; d->entries = 0; return d; } /* dict_delete -- delete a dictionary, free all allocated memory */ EXPORT void dict_delete(Dictionary d) { unsigned long i; assert(d); for (i = 0; i < d->entries; i++) { free(d->keys[d->seqno2index[i]]); free(d->values[d->seqno2index[i]]); } free(d->keys); free(d->values); free(d->seqno2index); free(d->index2seqno); free(d); } /* dict_destroy_all -- remove all keys and values from dictionary */ EXPORT void dict_destroy_all(Dictionary d) { unsigned long i; assert(d); for (i = 0; i < d->entries; i++) { free(d->keys[d->seqno2index[i]]); free(d->values[d->seqno2index[i]]); } d->entries = 0; } /* dict_destroy -- delete a value from the dictionary */ EXPORT void dict_destroy(Dictionary d, const char *key) { unsigned long index, seqno; assert(d); if ((index = find(d, key)) > 0) { free(d->keys[index]); free(d->values[index]); seqno = d->index2seqno[index]; assert(seqno < d->entries); assert(d->entries > 0); d->entries--; d->seqno2index[seqno] = d->seqno2index[d->entries]; d->index2seqno[d->seqno2index[seqno]] = seqno; } } /* Forward declaration */ static int expand(Dictionary d); /* dict_add -- add a key-value pair to dictionary, return 0 if out of memory */ EXPORT int dict_add(Dictionary d, const char *key, const char *value) { unsigned long index0, index, seqno, found; assert(d); index0 = hash(d->size, key); index = index0; while (1) { seqno = d->index2seqno[index]; if (seqno >= d->entries) { found = 0; break; } if (d->seqno2index[seqno] != index) { found = 0; break; } if (eq(d->keys[index], key)) { found = 1; break; } index = (index + 1) % d->size; if (index == 0) index = 1; if (index == index0) {if (!expand(d)) return 0; } /* Dictionary full */ } if (found) { free(d->values[index]); d->values[index] = strdup(value); if (!d->values[index]) return 0; /* Out of memory */ } else { assert(d->entries < d->size); d->keys[index] = strdup(key); if (!d->keys[index]) return 0; /* Out of memory */ d->values[index] = strdup(value); if (!d->values[index]) { free(d->keys[index]); return 0; } /* Out of mem. */ d->seqno2index[d->entries] = index; d->index2seqno[index] = d->entries; d->entries++; if (d->entries > d->size/2) (void) expand(d); /* Try expand, fail is OK */ } return 1; } /* expand -- make the tables in the dictionary larger, return 0 if out of mem */ static int expand(Dictionary d) { unsigned long i; Dictionary h; assert(d); h = dict_create(2 * d->size); if (!h) return 0; /* Add all old entries to the new dictionary */ for (i = 0; i < d->entries; i++) { if (!dict_add(h, d->keys[d->seqno2index[i]],d->values[d->seqno2index[i]])) { dict_delete(h); return 0; /* Failed */ } } /* Succeeded in making a copy, now delete the old entries */ for (i = 0; i < d->entries; i++) { free(d->keys[d->seqno2index[i]]); free(d->values[d->seqno2index[i]]); } free(d->keys); free(d->values); free(d->seqno2index); free(d->index2seqno); /* Put the larger arrays from the new dictionary in the old dictionary */ d->size = h->size; assert(d->entries == h->entries); d->keys = h->keys; d->values = h->values; d->index2seqno = h->index2seqno; d->seqno2index = h->seqno2index; free(h); return 1; } /* dict_find -- return value associated with key in dictionary, or NULL */ EXPORT const char* dict_find(Dictionary d, const char* key) { unsigned long i; assert(d); if ((i = find(d, key)) > 0) return d->values[i]; else return NULL; } /* dict_next -- return next key, or 1st key if NULL, or NULL if no more */ EXPORT const char *dict_next(Dictionary d, const char *prev_key) { unsigned long index, seqno; assert(d); if (d->entries == 0) return NULL; /* Empty dictionary */ if (!prev_key) return d->keys[d->seqno2index[0]]; /* Return first key */ index = find(d, prev_key); if (index == 0) return NULL; /* Error, unknown key */ seqno = d->index2seqno[index] + 1; if (seqno == d->entries) return NULL; /* No more keys */ return d->keys[d->seqno2index[seqno]]; } html-xml-utils-7.7/COPYING0000644000175000017500000000423213244022534012243 00000000000000W3C® SOFTWARE NOTICE AND LICENSE http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications: 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the [1]W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code. 3. Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-short-notice-20021231.html html-xml-utils-7.7/dtd.hash0000645000175000017500000002273313271371101012634 00000000000000%{ /* -*-indented-text-*- */ /* * Copyright © 1998-2017 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Author: Bert Bos * Created: 5 Nov 1998 * * Input file for gperf, to generate a perfect hash function * for all HTML tags, and to store each element's type. * * mixed = element accepts text content * empty = element is empty * cdata = element has character data content (i.e., unparsed content) * stag = start tag is required * etag = end tag is required * pre = element is preformatted * break_before, break_after = pretty-print with a newline before/after the elt * parents = array of possible parents, first one is preferred parent * * The DTD is a mixture of strict HTML 4.0 and some HTML5 * */ #include #include #include #include #include #include "export.h" #include "types.e" #define MAXNAMELEN 10 /* Max. len. of elt. name */ EXPORTDEF(MAXNAMELEN) EXPORT typedef struct _ElementType { string name; bool mixed, empty, cdata, stag, etag, pre, break_before, break_after; string parents[76]; } ElementType; /* lookup_element -- look up the string in the hash table */ EXPORT const ElementType * lookup_element(/* register const char *str, register unsigned int len */); /* Different kinds of parent elements: */ #define PHRASE "abbr", "acronym", "b", "bdi", "bdo", "big", "cite", "code", "dfn", "em", "i", "kbd", "q", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "tt", "u", "var" #define BRIDGE "p", "address", "caption", "dt", "h1", "h2", "h3", "h4", "h5", "h6", "legend", "pre" #define FLOW "article", "aside", "dd", "del", "details", "div", "fieldset", "figcaption", "figure", "footer", "header", "ins", "li", "nav", "section", "main", "object", "td", "th" #define INLINE_PARENT BRIDGE, PHRASE, FLOW #define BLOCK_PARENT "body", "blockquote", "map", "main" %} ElementType {} %% # name mixed empty cdata stag etag pre b a parents # ---- ----- ----- ----- ---- ---- --- - - ------- "%data", 1, 0, 0, 1, 0, 0, 0, 0, {"p", NULL} a, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "label", NULL} abbr, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} acronym, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} address, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} area, 0, 1, 0, 1, 0, 0, 0, 0, {"map", NULL} article, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} aside, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} audio, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} b, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} base, 0, 1, 0, 1, 0, 0, 1, 1, {"head", NULL} bdi, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} bdo, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} big, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} blockquote, 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} body, 0, 0, 0, 0, 0, 0, 1, 1, {"html", NULL} br, 0, 1, 0, 1, 0, 0, 0, 1, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} button, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "label", NULL} caption, 1, 0, 0, 1, 1, 0, 1, 1, {"table", NULL} cite, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} code, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} col, 0, 1, 0, 1, 0, 0, 0, 0, {"colgroup", "table", NULL} colgroup, 0, 0, 0, 1, 1, 0, 1, 1, {"table", NULL} dd, 1, 0, 0, 1, 0, 0, 1, 1, {"dl", NULL} del, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, BLOCK_PARENT, "a", "button", "noscript", "form", "label", "option", "textarea", NULL} details, 1, 0, 0, 1, 1, 0, 1, 1, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} dfn, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} div, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} dl, 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} dt, 1, 0, 0, 1, 0, 0, 1, 1, {"dl", NULL} em, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} embed, 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} fieldset, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "form", NULL} figcaption, 1, 0, 0, 1, 1, 0, 1, 1, {"figure", NULL} figure, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} footer, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} form, 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, NULL} h1, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} h2, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} h3, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} h4, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} h5, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} h6, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} head, 0, 0, 0, 0, 0, 0, 1, 1, {"html", NULL} header, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} hr, 0, 1, 0, 1, 0, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} html, 0, 0, 0, 0, 0, 0, 1, 1, {NULL, NULL} i, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} img, 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} input, 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "label", NULL} ins, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, BLOCK_PARENT, "a", "button", "noscript", "form", "label", "option", "textarea", NULL} kbd, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} keygen, 0, 1, 0, 1, 0, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} label, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", NULL} legend, 1, 0, 0, 1, 1, 0, 1, 1, {"fieldset", NULL} li, 1, 0, 0, 1, 0, 0, 1, 1, {"ul", "ol", NULL} link, 0, 1, 0, 1, 0, 0, 1, 0, {"head", NULL} main, 1, 0, 0, 1, 1, 0, 1, 1, {"body", "div", "noscript", NULL} map, 0, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} meta, 0, 1, 0, 1, 0, 0, 1, 0, {INLINE_PARENT, "head", "a", "button", "noscript", "label", NULL} nav, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} noscript, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, BLOCK_PARENT, "a", "button", "noscript", "form", "label", "option", "textarea", NULL} object, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "del", "header", "aside", "section", "main", "article", "nav", "fieldset", "head", "ins", "label", "object", NULL} ol, 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} optgroup, 0, 0, 0, 1, 1, 0, 1, 1, {"select", NULL} option, 1, 0, 0, 1, 0, 0, 1, 1, {"select", "optgroup", NULL} p, 1, 0, 0, 1, 0, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} param, 0, 1, 0, 1, 0, 0, 1, 1, {"object", NULL} pre, 1, 0, 0, 1, 1, 1, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} q, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} samp, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} script, 1, 0, 1, 1, 1, 1, 1, 0, {"body", INLINE_PARENT, "blockquote", "head", "map", "a", "button", "noscript", "form", "label", NULL} section, 1, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} select, 0, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "label", NULL} small, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} source, 0, 1, 0, 1, 0, 0, 1, 1, {"audio", "video", "template", NULL} span, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} strong, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} style, 1, 0, 1, 1, 1, 1, 1, 0, {"head", NULL} sub, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} summary, 1, 0, 0, 1, 1, 0, 0, 0, {"details", NULL} sup, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} table, 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} tbody, 0, 0, 0, 0, 0, 0, 1, 1, {"table", NULL} td, 1, 0, 0, 1, 0, 0, 1, 1, {"tr", NULL} textarea, 1, 0, 0, 1, 1, 1, 0, 0, {INLINE_PARENT, "a", "label", NULL} tfoot, 0, 0, 0, 1, 0, 0, 1, 1, {"table", NULL} th, 1, 0, 0, 1, 0, 0, 1, 1, {"tr", NULL} thead, 0, 0, 0, 1, 0, 0, 1, 1, {"table", NULL} title, 1, 0, 0, 1, 1, 0, 1, 1, {"head", NULL} tr, 0, 0, 0, 1, 0, 0, 1, 1, {"tbody", "tfoot", "thead", NULL} track, 0, 1, 0, 1, 0, 0, 1, 1, {"audio", "video", "template", NULL} tt, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} ul, 0, 0, 0, 1, 1, 0, 1, 1, {BLOCK_PARENT, FLOW, "button", "noscript", "form", NULL} var, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} video, 1, 0, 0, 1, 1, 0, 0, 0, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} wbr, 0, 1, 0, 1, 0, 0, 0, 1, {INLINE_PARENT, "a", "button", "noscript", "label", NULL} %% html-xml-utils-7.7/hxmkbib.10000644000175000017500000001746413244022534012731 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXMKBIB" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxmkbib \- create bibliography from a template .SH SYNOPSIS .B hxmkbib .RB "[\| " \-s .IR separator " \|]" .RB "[\| " \-a .IR auxfile " \|]" .RB "[\| " \-n .IR maxauthors " \|]" .RB "[\| " \-r .IR moreauthors " \|]" .IR bibfile " [\| " templatefile " \|]" .SH DESCRIPTION .LP The .B hxmkbib commands reads a list of bibliographic keys (labels) from .IR auxfile , finds the corresponding entries in .I bibfile and creates a bibliography, using .I templatefile as a model. The .I auxfile may, e.g., have been created by .BR hxcite (1). It consists of labels, one per line. The .I bibfile is a .BR refer (1) style database. .B hxmkbib looks for entries with a .B %L field equal to a key in the .IR auxfile . .PP The .I templatefile consists of three parts: .TP 10 .B preamble The preamble is the part up to the first occurrence of .BR %{ . The preamble is copied to the output unchanged, except for occurrences of .BR % . To create a single % in the output, there must be two in the preamble (%%). All other occurrences of % followed by another letter are not copied, but are collected into a string called the "sort order." and use to sort the entries, as explained below. .TP .B template The template starts with .B %{L: and ends with a matching .BR %} . The text in between is copied as often as there are bibliographic entries in .I bibfile that correspond to keys in .IR auxfile . Variables in the template are replaced by the corresponding field in the bibliographic entry: all occurrences of .BI % x will be replaced by the field .BI % x of the entry. Parts of the text may be enclosed in .BI %{ x : and .BR %} . This means that the text in between should only be output if the current entry has a field .IR x . Text that is enclosed in .BI %{! x : and .B %} will only be output if the entry does .B not have a field .IR x . Both kinds of conditional sections may also be nested. .TP .B postamble The text after the .B %} is copied unchanged to the output, after all bibliographic entries have been processed. .PP By default bibliographic entries are copied to the output in the order of the keys in .IR auxfile , except that keys that occur more than once are only used once. If the preamble contains occurrences of .BI % x (where .I x is neither "%" nor "{") then these together determine the sort order. E.g., if the preamble contains %A%D then the entries will be sorted first on field A (author) and then on field D (date). .PP Here is an example of template file that creates a bibliography in HTML format: .d Bibliography
      %{L:
      %{A:%A%}%{!A:%{E:%E%}%{!E:%{Q:%Q%}%{!Q:-%}%}%}
      %{B:"%T" in: %{E:%E (eds) %}%B.%{V: %V.%} %}%{J:"%T" in: %{E:%E (eds) %}%J.%{V: %V.%}%{N: %N.%}%{P: pp. %P.%} %}%{!B:%{!J:%T. %}%}%{I:%I. %}%{D:%D. %}%{C:%C. %}%{R:%R. %}%{S:%S. %}%{O:%O %}%{U:%U %}
      %}
      .e This template starts with four lines of preamble, including the sort string %A%D on line 3. The sort string itself will not be output, but the rest of the comment will. .PP From the line .B %{L: to the line .B %} is the template. E.g., the line that starts with .B
      Gosling, James; Joy, Bill; Steele, Guy
      The Java language specification. Addison-Wesley. 1998. http://java.sun.com/docs/books/jls/index.html
      .e .SH OPTIONS The following options are supported: .TP 10 .BI \-a " auxfile" The file that contains the list of keys (labels) for which bibliographic entries should be printed. If the option is absent, the name of this file is formed from the .I templatefile argument by removing the last extension and adding .BR .aux . If no .I templatefile is given, the default .I auxfile is .BR aux.aux . .TP .BI \-s " separator" If there are multiple authors or editors in an entry, their names will be listed with a separator in between. By default the separator is "; " (i.e., a semicolon and a space). With this option the separator can be changed. .TP .BI \-n " maxauthors" If there are more than .I maxauthors authors in an entry, only the first author will be printed and the others will be replaced by the string .IR moreauthors . The default is 3. .TP .BI \-r " moreauthors" The string to print if there are more than .I maxauthors authors. The default is "et al.". .SH OPERANDS The following operands are supported: .TP 10 .I bibfile The name of a bibliographic database must be given. It must be a file in .BR refer (1) format and every entry must have at least a .B %L field, which is used as key. (Entries without such a field will be ignored.) .TP .I templatefile The name of the input file is optional. If absent, .B hxmkbib will read the template from stdin. .SH "DIAGNOSTICS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred. Usually this is because a file could not be opened or because the %{ and %} pairs are not properly nested. Very rarely it may also be an out of memory error. Some of the possible error messages: .TP .I missing ':' in pattern .B hxmkbib found a %{ but the second or third letter after it was not a colon. .TP .I no '%{' in template file The template file is unusable, because it contains no template. .TP .I unbalanced %{..%} in pattern There are more %{ than %}. .SH "SEE ALSO" .BR asc2xml (1), .BR hxcite (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxprune (1), .BR hxtoc (1), .BR hxunent (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" .SH BUGS Sorting is primitive: the program doesn't parse dates or names and simply sorts "Jan 2000" under the letter "J" and "Albert Camus" under the letter "A". For the moment the only work-around is to put names in the .I bibfile as "Camus, Albert". .PP The program simply lists all authors or editors. There is no way to generate an "et. al." after the third one. The work-around is to put the "et. al." in the .IR bibfile . Putting commas between the first authors and the word "and" before the final one is also not possible. .PP The program doesn't try to interpret names of authors or editors and they cannot be reformatted. It is impossible to write a name that is specified as "Sartre, Jean-Paul" in the .I bibfile as "J. Sartre" or as "Jean-Paul Sartre" in the output. .PP There is no way to suppress a period after a field if the field already ends with a period. E.g., the template "%{A:A.%}" may generate "A. Person Jr.." if the author is "A. Person Jr." The only option is to either not put periods in the .IR bibfile or not put periods in the template. .PP Entries in the .I bibfile can only be used if they have a .B %L (label) field. The program cannot find entries by searching for keywords, like .BR refer (1). .PP .B hxmkbib will replace any ampersands (&) and less-than (<) and greater-than (>) signs that occur in the .I bibfile by their XML entities & < > on the assumption that the template is HTML/XML. This may not be appropriate for other formats. html-xml-utils-7.7/heap.e0000644000175000017500000000153413244022534012275 00000000000000#define fatal(msg) fatal3(msg, __FILE__, __LINE__) #define new(p) if (((p)=malloc(sizeof(*(p))))); else fatal3("out of memory", __FILE__, __LINE__) #define dispose(p) if (!(p)) ; else (free((void*)p), (p) = (void*)0) #define heapmax(p) 9999999 #define newstring(s) heap_newstring(s, __FILE__, __LINE__) #define newnstring(s,n) heap_newnstring(s, n, __FILE__, __LINE__) #define newarray(p,n) if (((p)=malloc((n)*sizeof(*(p))))); else fatal3("out of memory", __FILE__, __LINE__) #define renewarray(p,n) if (((p)=realloc(p,(n)*sizeof(*(p))))); else fatal3("out of memory", __FILE__, __LINE__) extern void fatal3(const char *s, const char *file, const unsigned int line); extern char * heap_newstring(const char *s, const char *file, const int line); extern char * heap_newnstring(const char *s, const size_t n, const char *file, const int line); html-xml-utils-7.7/html.y0000644000175000017500000001162013244022534012345 00000000000000%{ /* * Simple XML grammar, with call-back functions. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 1997 **/ #include "config.h" #include #include #include #include #include "export.h" #include "types.e" /* The types of the various callback routines */ EXPORT typedef void (*html_handle_error_fn) (void *clientdata, const string s, int lineno); EXPORT typedef void* (*html_handle_start_fn) (void); EXPORT typedef void (*html_handle_end_fn) (void *clientdata); EXPORT typedef void (*html_handle_comment_fn) (void *clientdata, const string commenttext); EXPORT typedef void (*html_handle_text_fn) (void *clientdata, const string text); EXPORT typedef void (*html_handle_decl_fn) (void *clientdata, const string gi, const string fpi, const string url); EXPORT typedef void (*html_handle_pi_fn) (void *clientdata, const string pi_text); EXPORT typedef void (*html_handle_starttag_fn) (void *clientdata, const string name, pairlist attribs); EXPORT typedef void (*html_handle_emptytag_fn) (void *clientdata, const string name, pairlist attribs); EXPORT typedef void (*html_handle_endtag_fn) (void *clientdata, const string name); EXPORT typedef void (*html_handle_endincl_fn) (void *clientdata); /* yyparse -- entry point for the parser */ EXPORT extern int yyparse(void); /* Store client data */ static void *data; /* All callback routines */ static struct { html_handle_error_fn error; html_handle_start_fn start; html_handle_end_fn end; html_handle_comment_fn comment; html_handle_text_fn text; html_handle_decl_fn decl; html_handle_pi_fn pi; html_handle_starttag_fn starttag; html_handle_emptytag_fn emptytag; html_handle_endtag_fn endtag; html_handle_endincl_fn endincl; } h = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; /* Routines to bind concrete routines to the callbacks */ EXPORT void set_error_handler(html_handle_error_fn f) {h.error = f;} EXPORT void set_start_handler(html_handle_start_fn f) {h.start = f;} EXPORT void set_end_handler(html_handle_end_fn f) {h.end = f;} EXPORT void set_comment_handler(html_handle_comment_fn f) {h.comment = f;} EXPORT void set_text_handler(html_handle_text_fn f) {h.text = f;} EXPORT void set_decl_handler(html_handle_decl_fn f) {h.decl = f;} EXPORT void set_pi_handler(html_handle_pi_fn f) {h.pi = f;} EXPORT void set_starttag_handler(html_handle_starttag_fn f){h.starttag = f;} EXPORT void set_emptytag_handler(html_handle_emptytag_fn f){h.emptytag = f;} EXPORT void set_endtag_handler(html_handle_endtag_fn f) {h.endtag = f;} EXPORT void set_endincl_handler(html_handle_endincl_fn f) {h.endincl = f;} extern int yylex(void); EXPORT int lineno = 1; /* Line number in input file */ static int nrerrors = 0; #define MAX_ERRORS_REPORTED 20 /* yyerror -- report parse error */ static void yyerror(const string s) { nrerrors++; if (nrerrors < MAX_ERRORS_REPORTED) h.error(data, s, lineno); else if (nrerrors == MAX_ERRORS_REPORTED) h.error(data, "too many errors", lineno); else ; /* don't report any more errors */ } /* call -- if the function exists, call it with the given aguments */ #define call(fn, args) do {if (fn) (fn)args;} while (0) %} %union { string s; pairlist p; } %token TEXT COMMENT START END NAME STRING PROCINS %token EMPTYEND DOCTYPE ENDINCL %type

      attribute attributes %% start : {data = h.start ? h.start() : NULL;} document {call(h.end, (data));} ; document : document COMMENT {call(h.comment, (data, $2));} | document TEXT {call(h.text, (data, $2));} | document starttag | document endtag | document decl | document PROCINS {call(h.pi, (data, $2));} | document ENDINCL {call(h.endincl, (data));} | document error | /* empty */ ; starttag : START attributes '>' {call(h.starttag, (data, $1, $2));} | START attributes EMPTYEND {call(h.emptytag, (data, $1, $2));} ; attributes : attribute attributes {$$ = $1; $$->next = $2;} | /* empty */ {$$ = NULL;} ; attribute : NAME {pairlist h = malloc(sizeof(*h)); assert(h != NULL); h->name = $1; h->value=NULL; $$ = h;} | NAME '=' NAME {pairlist h = malloc(sizeof(*h)); assert(h != NULL); h->name = $1; h->value = $3; $$ = h;} | NAME '=' STRING {pairlist h = malloc(sizeof(*h)); assert(h != NULL); h->name = $1; h->value = $3; $$ = h;} ; endtag : END '>' {call(h.endtag, (data, $1));} ; decl : DOCTYPE NAME NAME STRING STRING '>' {call(h.decl, (data, $2, $4, $5));} | DOCTYPE NAME NAME STRING '>' {if (strcasecmp($3, "public") == 0) call(h.decl, (data, $2, $4, NULL)); else /* "system" */ call(h.decl, (data, $2, NULL, $4));} | DOCTYPE NAME '>' {call(h.decl, (data, $2, NULL, NULL));} ; html-xml-utils-7.7/missing0000755000175000017500000001533013244022534012610 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: html-xml-utils-7.7/hxincl.10000645000175000017500000001031713244022534012561 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXINCL" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxincl \- expand included HTML or XML files .SH SYNOPSIS .B hxincl .RB "[\| " \-x " \|]" .RB "[\| " \-f " \|]" .RB "[\| " \-s .IR name=subst " \|]" .RB "[\| " \-s .IR name=subst " \|]..." .RB "[\| " \-b .IR base " \|]" .RI "[\| " file\-or\-URL " \|]" .LP .B hxincl .B \-M .I target .RB "[\| " \-s .IR name=subst " \|]" .RB "[\| " \-s .IR name=subst " \|]..." .RB "[\| " \-b .IR base " \|]" .RB "[\| " \-G " \|]" .RI "[\| " file\-or\-URL " \|]" .SH DESCRIPTION .LP Without .BR \-M , the .B hxincl command copies an HTML or XML file to standard output, looking for comments with a certain structure. Such a comment is replaced by the file whose name is given as the attribute of the directive. For example: .d \&...... .e will be replaced by the content of the file \fIfoo.html\fP. .LP The comment is replaced by .d .e before the included text and .d .e after it. These comments make it possible to run .B hxincl on the resulting file again to update the inclusions. .PP Single quotes are allowed instead of double quotes. And if the file name contains no spaces, the quotes may also be omitted. .PP With .BR \-M , the .B hxincl command outputs a line of dependencies that is suitable for inclusion in a Makefile. The .I target is the target of the Makefile rule and .B hxincl will list after the ':' all the files that are included, recursively. E.g., the result of .d hxincl -M myfile.html inputfile .e might be .d myfile.html: foo.html bar.html .e .SH OPTIONS The following options are supported: .TP 10 .B \-x Use XML conventions: empty elements are written with a slash at the end: . .TP .BI \-b " base" Sets the base URL for resolving relative URLs. By default the file given as argument is the base URL. .TP .B \-f Removes the comments after including the files. This means .B hxincl cannot be run on the resulting file later to update the inclusions. (Mnemonic: .BR f inal or .BR f rozen.) .TP .BI \-s " name=substitution" Include a different file than the one mentioned in the directive. If the comment is .d .e the file .I substitution is included instead. And if the file name in the comment includes a variable called .I name delimited by %, e.g., .d .e then .RI % name % is replaced by .I substitution and thus the file .RI xxx\- substitution is included. The option .B \-s may occur multiple times. %-delimited variables are expanded recursively, i.e., if the substitution text contains a variable, that variable is expanded, too. E.g., if the two options .B \-s name=%p1%.rrr and .B \-s p1=subst are given, then the "xxx-%name%" will expand to "xxx-subst.rrr". .TP .BI \-M " target" Instead of outputting the input file with all inclusions expanded, output just the list of all files that the input includes, recursively, in the form of a rule that is suitable for a Makefile. The .I target is printed as the target of that rule. .TP .B \-G Suppress error messages if a file to include cannot be found. (Only with .BR \-M .) .SH OPERANDS The following operand is supported: .TP 10 .I file\-or\-URL The name of an HTML or XML file or the URL of one. If absent, standard input is read instead. .SH "EXIT STATUS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of one of the HTML or XML files. .SH ENVIRONMENT To use a proxy to retrieve remote files, set the environment variables .B http_proxy or .BR ftp_proxy "." E.g., .B http_proxy="http://localhost:8080/" .SH BUGS .LP Assumes UTF-8 as input. Doesn't expand character entities. Instead pipe the input through .BR hxunent (1) and .BR asc2xml (1) to convert it to UTF-8. .LP Remote files (specified with a URL) are currently only supported for HTTP. Password-protected files or files that depend on HTTP "cookies" are not handled. (You can use tools such as .BR curl (1) or .BR wget (1) to retrieve such files.) .SH "SEE ALSO" .BR asc2xml (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxprune (1), .BR hxtoc (1), .BR hxunent (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/realloc.c0000644000175000017500000000045213244022534012775 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #undef realloc #include void *realloc (); /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ void * rpl_realloc (void *p, size_t n) { if (n == 0) n = 1; return realloc (p, n); } html-xml-utils-7.7/hxxmlns.10000644000175000017500000000121313244022534012767 00000000000000.TH "HXXMLNS" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxxmlns \- replace XML Namespace prefixes by "global names" .SH SYNOPSIS .B hxxmlns .RB "[\| " \-d " \|]" .RB "[\| " \-\- " \|]" .RI "[\| " file " \|]" .SH DESCRIPTION .B hxxmlns expands all element and attribute names to "global names" by expanding the prefix. All names will be printed as "{URL}name". Attribute names without a prefix will have an empty namespace part: "{}name". The namespace attributes (those that start with "xmlns") will be removed. .PP By default comments, PIs and the DOCTYPE declaration are copied unchanged, but with option .B \-d they are removed. .PP [ToDo] html-xml-utils-7.7/html.c0000755000175000017500000014345213244022534012333 00000000000000/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.0.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Copy the first part of user declarations. */ #line 1 "html.y" /* yacc.c:339 */ /* * Simple XML grammar, with call-back functions. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 1997 **/ #include "config.h" #include #include #include #include #include "export.h" #include "types.e" /* The types of the various callback routines */ EXPORT typedef void (*html_handle_error_fn) (void *clientdata, const string s, int lineno); EXPORT typedef void* (*html_handle_start_fn) (void); EXPORT typedef void (*html_handle_end_fn) (void *clientdata); EXPORT typedef void (*html_handle_comment_fn) (void *clientdata, const string commenttext); EXPORT typedef void (*html_handle_text_fn) (void *clientdata, const string text); EXPORT typedef void (*html_handle_decl_fn) (void *clientdata, const string gi, const string fpi, const string url); EXPORT typedef void (*html_handle_pi_fn) (void *clientdata, const string pi_text); EXPORT typedef void (*html_handle_starttag_fn) (void *clientdata, const string name, pairlist attribs); EXPORT typedef void (*html_handle_emptytag_fn) (void *clientdata, const string name, pairlist attribs); EXPORT typedef void (*html_handle_endtag_fn) (void *clientdata, const string name); EXPORT typedef void (*html_handle_endincl_fn) (void *clientdata); /* yyparse -- entry point for the parser */ EXPORT extern int yyparse(void); /* Store client data */ static void *data; /* All callback routines */ static struct { html_handle_error_fn error; html_handle_start_fn start; html_handle_end_fn end; html_handle_comment_fn comment; html_handle_text_fn text; html_handle_decl_fn decl; html_handle_pi_fn pi; html_handle_starttag_fn starttag; html_handle_emptytag_fn emptytag; html_handle_endtag_fn endtag; html_handle_endincl_fn endincl; } h = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; /* Routines to bind concrete routines to the callbacks */ EXPORT void set_error_handler(html_handle_error_fn f) {h.error = f;} EXPORT void set_start_handler(html_handle_start_fn f) {h.start = f;} EXPORT void set_end_handler(html_handle_end_fn f) {h.end = f;} EXPORT void set_comment_handler(html_handle_comment_fn f) {h.comment = f;} EXPORT void set_text_handler(html_handle_text_fn f) {h.text = f;} EXPORT void set_decl_handler(html_handle_decl_fn f) {h.decl = f;} EXPORT void set_pi_handler(html_handle_pi_fn f) {h.pi = f;} EXPORT void set_starttag_handler(html_handle_starttag_fn f){h.starttag = f;} EXPORT void set_emptytag_handler(html_handle_emptytag_fn f){h.emptytag = f;} EXPORT void set_endtag_handler(html_handle_endtag_fn f) {h.endtag = f;} EXPORT void set_endincl_handler(html_handle_endincl_fn f) {h.endincl = f;} extern int yylex(void); EXPORT int lineno = 1; /* Line number in input file */ static int nrerrors = 0; #define MAX_ERRORS_REPORTED 20 /* yyerror -- report parse error */ static void yyerror(const string s) { nrerrors++; if (nrerrors < MAX_ERRORS_REPORTED) h.error(data, s, lineno); else if (nrerrors == MAX_ERRORS_REPORTED) h.error(data, "too many errors", lineno); else ; /* don't report any more errors */ } /* call -- if the function exists, call it with the given aguments */ #define call(fn, args) do {if (fn) (fn)args;} while (0) #line 168 "html.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "y.tab.h". */ #ifndef YY_YY_HTML_H_INCLUDED # define YY_YY_HTML_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { TEXT = 258, COMMENT = 259, START = 260, END = 261, NAME = 262, STRING = 263, PROCINS = 264, EMPTYEND = 265, DOCTYPE = 266, ENDINCL = 267 }; #endif /* Tokens. */ #define TEXT 258 #define COMMENT 259 #define START 260 #define END 261 #define NAME 262 #define STRING 263 #define PROCINS 264 #define EMPTYEND 265 #define DOCTYPE 266 #define ENDINCL 267 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE YYSTYPE; union YYSTYPE { #line 103 "html.y" /* yacc.c:355 */ string s; pairlist p; #line 237 "html.c" /* yacc.c:355 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_HTML_H_INCLUDED */ /* Copy the second part of user declarations. */ #line 252 "html.c" /* yacc.c:358 */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE # if (defined __GNUC__ \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif #ifndef YY_ATTRIBUTE_PURE # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif #if !defined _Noreturn \ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) # if defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 27 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 15 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 9 /* YYNRULES -- Number of rules. */ #define YYNRULES 23 /* YYNSTATES -- Number of states. */ #define YYNSTATES 33 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 267 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 14, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 116, 116, 116, 120, 121, 122, 123, 124, 125, 126, 127, 128, 131, 132, 135, 136, 139, 142, 145, 150, 153, 154, 158 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "TEXT", "COMMENT", "START", "END", "NAME", "STRING", "PROCINS", "EMPTYEND", "DOCTYPE", "ENDINCL", "'>'", "'='", "$accept", "start", "$@1", "document", "starttag", "attributes", "attribute", "endtag", "decl", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 62, 61 }; # endif #define YYPACT_NINF -6 #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-6))) #define YYTABLE_NINF -4 #define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int8 yypact[] = { -6, 7, -6, -6, 0, -6, -6, -6, 12, 1, -6, 13, -6, -6, -6, -6, 8, 3, 12, -6, -5, 10, -6, -6, -6, 15, -6, -6, -6, 2, 11, -6, -6 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 12, 1, 0, 11, 5, 4, 16, 0, 9, 0, 10, 6, 7, 8, 17, 0, 16, 20, 0, 0, 14, 13, 15, 0, 23, 18, 19, 0, 0, 22, 21 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -6, -6, -6, -6, -6, 9, -6, -6, -6 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 2, 4, 13, 17, 18, 14, 15 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { -3, 5, 25, 6, 7, 8, 9, 3, 26, 10, 30, 11, 12, 22, 19, 31, 23, 27, 28, 16, 20, 0, 21, 29, 32, 0, 0, 24 }; static const yytype_int8 yycheck[] = { 0, 1, 7, 3, 4, 5, 6, 0, 13, 9, 8, 11, 12, 10, 13, 13, 13, 7, 8, 7, 7, -1, 14, 8, 13, -1, -1, 18 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 16, 17, 0, 18, 1, 3, 4, 5, 6, 9, 11, 12, 19, 22, 23, 7, 20, 21, 13, 7, 14, 10, 13, 20, 7, 13, 7, 8, 8, 8, 13, 13 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 15, 17, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 23, 23, 23 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 3, 3, 2, 0, 1, 3, 3, 2, 6, 5, 3 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { FILE *yyo = yyoutput; YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T yystrlen (const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse (void) { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 116 "html.y" /* yacc.c:1646 */ {data = h.start ? h.start() : NULL;} #line 1340 "html.c" /* yacc.c:1646 */ break; case 3: #line 117 "html.y" /* yacc.c:1646 */ {call(h.end, (data));} #line 1346 "html.c" /* yacc.c:1646 */ break; case 4: #line 120 "html.y" /* yacc.c:1646 */ {call(h.comment, (data, (yyvsp[0].s)));} #line 1352 "html.c" /* yacc.c:1646 */ break; case 5: #line 121 "html.y" /* yacc.c:1646 */ {call(h.text, (data, (yyvsp[0].s)));} #line 1358 "html.c" /* yacc.c:1646 */ break; case 9: #line 125 "html.y" /* yacc.c:1646 */ {call(h.pi, (data, (yyvsp[0].s)));} #line 1364 "html.c" /* yacc.c:1646 */ break; case 10: #line 126 "html.y" /* yacc.c:1646 */ {call(h.endincl, (data));} #line 1370 "html.c" /* yacc.c:1646 */ break; case 13: #line 131 "html.y" /* yacc.c:1646 */ {call(h.starttag, (data, (yyvsp[-2].s), (yyvsp[-1].p)));} #line 1376 "html.c" /* yacc.c:1646 */ break; case 14: #line 132 "html.y" /* yacc.c:1646 */ {call(h.emptytag, (data, (yyvsp[-2].s), (yyvsp[-1].p)));} #line 1382 "html.c" /* yacc.c:1646 */ break; case 15: #line 135 "html.y" /* yacc.c:1646 */ {(yyval.p) = (yyvsp[-1].p); (yyval.p)->next = (yyvsp[0].p);} #line 1388 "html.c" /* yacc.c:1646 */ break; case 16: #line 136 "html.y" /* yacc.c:1646 */ {(yyval.p) = NULL;} #line 1394 "html.c" /* yacc.c:1646 */ break; case 17: #line 139 "html.y" /* yacc.c:1646 */ {pairlist h = malloc(sizeof(*h)); assert(h != NULL); h->name = (yyvsp[0].s); h->value=NULL; (yyval.p) = h;} #line 1402 "html.c" /* yacc.c:1646 */ break; case 18: #line 142 "html.y" /* yacc.c:1646 */ {pairlist h = malloc(sizeof(*h)); assert(h != NULL); h->name = (yyvsp[-2].s); h->value = (yyvsp[0].s); (yyval.p) = h;} #line 1410 "html.c" /* yacc.c:1646 */ break; case 19: #line 145 "html.y" /* yacc.c:1646 */ {pairlist h = malloc(sizeof(*h)); assert(h != NULL); h->name = (yyvsp[-2].s); h->value = (yyvsp[0].s); (yyval.p) = h;} #line 1418 "html.c" /* yacc.c:1646 */ break; case 20: #line 150 "html.y" /* yacc.c:1646 */ {call(h.endtag, (data, (yyvsp[-1].s)));} #line 1424 "html.c" /* yacc.c:1646 */ break; case 21: #line 153 "html.y" /* yacc.c:1646 */ {call(h.decl, (data, (yyvsp[-4].s), (yyvsp[-2].s), (yyvsp[-1].s)));} #line 1430 "html.c" /* yacc.c:1646 */ break; case 22: #line 154 "html.y" /* yacc.c:1646 */ {if (strcasecmp((yyvsp[-2].s), "public") == 0) call(h.decl, (data, (yyvsp[-3].s), (yyvsp[-1].s), NULL)); else /* "system" */ call(h.decl, (data, (yyvsp[-3].s), NULL, (yyvsp[-1].s)));} #line 1439 "html.c" /* yacc.c:1646 */ break; case 23: #line 158 "html.y" /* yacc.c:1646 */ {call(h.decl, (data, (yyvsp[-1].s), NULL, NULL));} #line 1445 "html.c" /* yacc.c:1646 */ break; #line 1449 "html.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } html-xml-utils-7.7/class.e0000644000175000017500000000032013244022534012455 00000000000000extern conststring contains(const conststring s, const conststring word); extern _Bool has_class(pairlist attribs, const string word); extern _Bool has_class_in_list(const pairlist attribs, const string *c); html-xml-utils-7.7/ChangeLog0000645000175000017500000012016713271372000012765 000000000000002018-04-29 Bert Bos * dtd.hash: Don't include the arguments in the forward declaration of lookup_element(), because those arguments differ slightly depending on which version of gperf is used to generate dtd.c: "unsigned int" in gperf 3.0 vs "size_t" in gperf 3.1. * conficgure.ac: Check for libiconv with the AM_ICONV macro (from gettext) instead of AC_SEARCH_LIBS. (Advice from Christian Weisgerber, received via Anthony Bentley). That in turn requires adding config.rpath to the EXTRA_DIST in Makefile.am. 2018-02-23 Bert Bos * tests/index10.sh: Added a test for a term database. * hxindex.c: Replaced fgets() by getline(), to allow lines of arbitrary length in the term database. 2018-02-15 Bert Bos * tests/index9.sh: Added a test for hxindex's option -N. * tests/index5.sh: Updated for hxindex's option -N. * tests/cite5.sh: Added the example from hxmkbib.1 as a test. * tests/normalize12.sh: Added a test for the NOSCRIPT element. * hxindex.1: Added option -N. * hxmkbib.1: The example was missing some "%" signs. * hxmkdir.c: Read the template before reading the auxfile, so that a pipe like "hxcite -a auxfile bib template | hxmkbib -a auxfile bib" becomes possible. hxcite will have the time to finishe writing the auxfile before hxmkbib reads it. 2018-02-12 Bert Bos * hxindex.c: Added option -N. * dtd.hash: Since HTML5, the NOSCRIPT element is phrase-level instead of block-level. 2018-02-09 Bert Bos * Version 7.6 released. * selmatch.c: matches_sel() could read uninitialized memory (h->parent where h is the root of a tree) potentially leading to a SIGBUS. Thanks to Anthony J. Bentley for finding this bug. 2018-01-20 Bert Bos * Version 7.5 released. * hxcite.1: Spelling error. * hxincl.1: Spelling error. * url.c: Fixed unsafe way to call warnx(). Thanks to Robin Naundorf for these three corrections. 2017-12-08 Bert Bos * tests/normalize11.sh: Added to test for "main". * dtd.hash: Added the HTML5 element "main". 2017-12-07 Bert Bos * hxwls.c: Added support for HTML5 elements (source, audio, video) and for the classid and codebase attribute. Fixed an error: input has a src attribute, not href. 2017-11-24 Bert Bos * Version 7.4 released. * hxremove.1, hxselect.1: Updated. * tests/remove4.sh, tests/select18.sh, tests/select19.sh, tests/select20.sh, tests/select21.sh, tests/select22.sh, tests/remove5.sh tests/remove6.sh tests/remove7.sh, tests/select23.sh tests/select24.sh: Added. * selmatch.c: Now handles the ':not()' pseudo-class and comma-separated selectors. Fixed a bug in matching the ':root' pseudo-class. * hxremove.c, hxselect.c: parse_selector() has different arguments. * selector.c: Now parses the ':not()' pseudo-class and comma-separated selectors. Errors are now printed with a newline at the end. Added new functions to dump (serialize) a selector to a file, useful for debugging. * openurl.c: Functions now either return CURLcode or CURLMcode, but not some mixture. 2017-11-11 Bert Bos * dtd.hash: Added some HTML5 elements: source, track, wbr (because they are empty) and audio and video (as parents for source and track). * toc4.sh, normalize10.sh: Added tests for the element. * Released version 7.3. 2017-10-16 Bert Bos * normalize9.sh: Added test for A inside FIGCAPTION. * dtd.hash: An A can now be inside a FIGCAPTION. Made source shorter and more readable with some macros. 2017-10-06 Bert Bos * Released version 7.2. * tests/extract1.sh: Added option -N to nc, to close the connection after EOF on stdin, because hxextract (with libcurl) seems to wait for the closing of the connection. * tests/unent1.ssh, tests/unent2.ssh, tests/unent3.ssh, tests/unent4.ssh, tests/unent5.ssh: Added tests for hxunent. * hxunentmain.c: Fixed bug reported by Laurent Martelli: When a line was longer than the 4096-byte buffer, an entity could be on the edge between two buffers and not be recognized. 2017-08-13 Bert Bos * extract1.sh: return code 77 (skip) rather than 0 when netcat is unavailable. * tests/pipe4.sh, tests/select01.sh, ..., tests/select17.sh, tests/unpipe6.sh: New tests. * scan.l: Accept non-ASCII characters in names (element names, attribute names, etc.) * hxselect.c, hxremove.c: Put their common code in selmatch.c. hxselect now uses the data structures from tree.c, just like hxremove.c. The non-element selector '::attr(...)' is now also supported. * selector.c, selmatch.c: Added support for more structural pseudo-classes (last-child, nth-last-of-type, etc.). Generalized support for backslash escapes. Support hexadecimal backslash escapes also outside ASCII range (such characters are converted to UTF-8). Bug fixes. 2016-10-17 Bert Bos * Released version 7.1. * textwrap.c, hxnormalize.c, normalize7.sh, normalize8.sh: Allow a line break before the final ">" of a tag. Line length (option -l) is now counted in characters, not bytes, at least if it is UTF-8. Added two tests for these new features. 2016-05-10 Bert Bos * hxunpipe.c: Added option -b to escape SGML delimiters. 2016-04-14 Bert Bos * Released version 7.0. * hxwls.c: Added option -a to output URLs in ASCII (using punycode and %-escaping if needed). Converting Internationalized Domain Names to ASCII (with punycode) requires libidn or libidn2. 2016-04-08 Bert Bos * wls3.sh, wls5.sh: Tests for hxwls (entity expansion, ASCII conversion) * hxwls.c: Expand entities in URLs, into ASCII characters if possible, or into %-escaped UTF-8 octets otherwise. 2016-03-10 Bert Bos * tree.c (main): dumptree() now takes a FILE argument. 2016-03-07 Bert Bos * hxnormalize.c: Attempt at inserting into EOF cat >$TMP2 <<-EOF EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/xref2.sh0000755000175000017500000000100313244022534013730 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxref >$TMP1 <<-EOF

      term is referenced twice: here and term. EOF # Add a newline at the end: echo >>$TMP1 cat >$TMP2 <<-EOF

      term is referenced twice: here and term.

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select24.sh0000755000175000017500000000037513244022534014342 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmpXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmpXXXXXX` || exit 1 cat >$TMP1 < def EOF ./hxselect :root <$TMP1 >$TMP2 diff -u $TMP2 $TMP2 html-xml-utils-7.7/tests/cite2.sh0000755000175000017500000000107613244022534013722 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3 $TMP4' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF %L label1 %L label2 EOF cat >$TMP2 <<-EOF label1 label1 label1 label2 label1 EOF ./hxcite -c -a $TMP4 $TMP1 >$TMP3 <<-EOF aaa [[label1]] bbb [[label1]] ccc aaa [[label1]] bbb [label1] ccc aaa {{label1]] bbb {label1} ccc aaa aaa[[label1]]bbb EOF cmp -s $TMP2 $TMP4 html-xml-utils-7.7/tests/wls1.sh0000755000175000017500000000120513244022534013574 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . EOF cat >$TMP2 <<-EOF http://example.org/style.css ../othersub/foo.html ../othersub/bar/foo.png ../bar/foo.png ../othersub/foo.svg ../othersub/foo.png EOF ./hxwls -b ../othersub/base $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/xref3.sh0000755000175000017500000000103613244022534013737 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxref -l >$TMP1 <<-EOF

      term is referenced twice: term and plural. EOF # Add a newline at the end: echo >>$TMP1 cat >$TMP2 <<-EOF

      term is referenced twice: term and plural.

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/toc1.sh0000755000175000017500000000170613244022534013562 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxtoc -d -t >$TMP1 <<-EOF Test

      Document heading

      Second-level heading

      Third-level heading
      EOF echo >>$TMP1 # Add newline cat >$TMP2 <<-EOF Test

      Document heading

      Second-level heading

      Third-level heading
      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select09.sh0000755000175000017500000000060213244022534014336 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' 'div.this /* comment */ p' >$TMP1 <<-EOF

      Not this.

      Select this.

      But not this.
      EOF cat >$TMP2 <<-EOF

      Select this.

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/unpipe1.sh0000755000175000017500000000060513244022534014272 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxunpipe >$TMP1 <<-EOF !root "test1" test2 -\n !root "" test2 -\n !root "test1" -\n !root "" -\n EOF cat >$TMP2 <<-EOF EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select16.sh0000755000175000017500000000054413244022534014341 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -c '\03B2' >$TMP1 <<-EOF
      <β>Select this.
      But not this.
      <β>Select this, too. EOF cat >$TMP2 <<-EOF Select this.Select this, too. EOF echo >>$TMP1 # Add newline cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/xref4.sh0000755000175000017500000000103413244022534013736 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxref -l >$TMP1 <<-EOF

      boss is referenced twice: bosses and here. EOF # Add a newline at the end: echo >>$TMP1 cat >$TMP2 <<-EOF

      boss is referenced twice: bosses and here.

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/mkbib1.sh0000755000175000017500000000203413244022534014054 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3 $TMP4 $TMP5' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP5=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 # Make a Refer database with bibliographic data # cat >$TMP1 <<-EOF %L LABEL1 %T Title One %A Author One %L LABEL2 %T Title Two %A Author Two %A Another Author %D 2013 EOF # Make an auxiliary file with a list of labels # cat >$TMP2 <<-EOF LABEL2 LABEL2 LABEL1 EOF # Make a template for the generated bibliography # cat >$TMP3 <<-EOF Bibliography # %L sorted by label %{L:%L %A %T %{D:%D%}%{!D:no date%} %}End EOF # The expected output of hxmkbib # cat >$TMP4 <<-EOF Bibliography # sorted by label LABEL1 Author One Title One no date LABEL2 Author Two; Another Author Title Two 2013 End EOF # Run hxmkbib with the above three files # ./hxmkbib -a $TMP2 $TMP1 $TMP3 >$TMP5 # Compare to the expected output # cmp -s $TMP4 $TMP5 html-xml-utils-7.7/tests/printlinks1.sh0000755000175000017500000000067613244022534015177 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxprintlinks >$TMP1 <

      atom EOF cat >$TMP2 <

      atom

      1. a.atom
      2. a.atom
      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/mkbib2.sh0000755000175000017500000000304313244022534014056 00000000000000: trap 'rm $TEMPLATE $BIBFILE $AUXFILE $TMP1 $TMP2 $TMP3' 0 TEMPLATE=`mktemp /tmp/tmp-XXXXXX` || exit 1 BIBFILE=`mktemp /tmp/tmp-XXXXXX` || exit 1 AUXFILE=`mktemp /tmp/tmp-XXXXXX` || exit 1 TMP1=`mktemp /tmp/tmp-XXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp-XXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp-XXXXXX` || exit 1 cat >$TEMPLATE < Bibliography

      ... text with [[Java]] here...

      %{L:
      %{A:%A%}%{!A:%{E:%E%}%{!E:%{Q:%Q%}%{!Q:-%}%}%}
      %{B:"%T" in: %{E:%E (eds) %}%B.%{V: %V.%} %}%{J:"%T" in: %{E:%E (eds) %}%J.%{V: %V.%}%{N: %N.%}%{P: pp. %P.%} %}%{!B:%{!J:%T. %}%}%{I:%I. %}%{D:%D. %}%{C:%C. %}%{R:%R. %}%{S:%S. %}%{O:%O %}%{U:%U %}
      %}
      EOF cat >$BIBFILE <$TMP1 < Bibliography

      ... text with [Java] here...

      Gosling, James; Joy, Bill; Steele, Guy
      The Java language specification. Addison-Wesley. 1998. http://java.sun.com/docs/books/jls/index.html
      EOF ./hxcite -a $AUXFILE $BIBFILE $TEMPLATE | ./hxmkbib -a $AUXFILE $BIBFILE >$TMP2 diff -u $TMP1 $TMP2 html-xml-utils-7.7/tests/tabletrans1.sh0000755000175000017500000000107413244022534015132 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo '

      head 1head 2
      head AA1A2
      head BB1B2
      head CC1C2
      ' | ./hxtabletrans >$TMP1 echo '
      head A head B head C
      head 1 A1 B1 C1
      head 2 A2 B2 C2
      ' >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/toc2.sh0000755000175000017500000000150313244022534013556 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxtoc -d -t >$TMP1 <<-EOF Test

      Document heading

      Second-level heading

      Third-level heading

      EOF echo >>$TMP1 # Add newline cat >$TMP2 <<-EOF Test

      Document heading

      Second-level heading

      Third-level heading

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/index4.sh0000755000175000017500000000340213244022534014102 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      Heading 0

      Heading 1

      A-term

      Z-term

      Heading 2

      <M-term>

      A-term

      Heading 3

      Z-term

      M-term

      Index

      Remove this. EOF # The echo adds a newline at the end of the file # (./hxnum $TMP1 | LC_ALL=C ./hxindex -t -n -f -r; echo) >$TMP2 cat >$TMP3 <

      1. Heading 0

      Heading 1

      A-term

      Z-term

      1.1. Heading 2

      <M-term>

      A-term

      1.1.1. Heading 3

      Z-term

      M-term

      2. Index

      EOF cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/index5.sh0000755000175000017500000000154213244022534014106 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3 $TMP4 $TMP5' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP5=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 # Make a file to index echo 'This documentterm1 term2' >$TMP1 # Initialize a database with some terms cat >$TMP2 <$TMP3 <>$TMP3 # Call hxindex ./hxindex -i $TMP2 -b foo $TMP1 >/dev/null # Check. The order of the terms in the database may differ. sort $TMP2 >$TMP4 sort $TMP3 >$TMP5 diff -u $TMP4 $TMP5 html-xml-utils-7.7/tests/copy5.sh0000755000175000017500000000102013244022534013740 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . . . EOF cat >$TMP3 <<-EOF . . . EOF ./hxcopy -i http://example.com/foo1/bar -o foo2/bar $TMP1 $TMP2 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/incl9.sh0000755000175000017500000000106213244022534013725 00000000000000: trap 'rm -r $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp -d /tmp/tmp.XXXXXXXXXX` || exit 1 echo 'Test1' >$TMP3/file1 echo 'Test2' >$TMP3/file2 echo 'Test3' >$TMP3/file3 echo '' >$TMP3/file0 echo '' >>$TMP3/file0 echo '' >>$TMP3/file0 ./hxincl -M foo -s sub=$TMP3 $TMP3/file0 >$TMP1 echo "foo: \\" >$TMP2 echo " $TMP3/file1 \\" >>$TMP2 echo " $TMP3/file2 \\" >>$TMP2 echo " $TMP3/file3" >>$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/hxnsxml2.sh0000755000175000017500000000040713244022534014474 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF EOF # No namespaces in input then none in output # ./hxnsxml $TMP1 >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/hxnsxml1.sh0000755000175000017500000000105713244022534014475 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3 $TMP4 $TMP5' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP5=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF EOF # Running hxxmlns and hxnsxml twice should not change anything: # ./hxxmlns $TMP1 >$TMP2 ./hxnsxml $TMP2 >$TMP3 ./hxxmlns $TMP3 >$TMP4 ./hxnsxml $TMP4 >$TMP5 cmp -s $TMP2 $TMP4 && cmp -s $TMP3 $TMP5 html-xml-utils-7.7/tests/remove5.sh0000755000175000017500000000057413244022534014300 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmpXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmpXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmpXXXXXX` || exit 1 cat >$TMP1 <
    • item 1
    • item 2
    • item 3
    • item 4
    • item 5
    • EOF ./hxremove 'ol #l1, ol #l3' <$TMP1 >$TMP2 ./hxremove 'li[id]' <$TMP1 >$TMP3 diff -u $TMP2 $TMP3 html-xml-utils-7.7/tests/select02.sh0000755000175000017500000000053513244022534014334 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -c '\p' >$TMP1 <<-EOF

      Select this.

      But not this.

      Select this, too.

      EOF cat >$TMP2 <<-EOF Select this.Select this, too. EOF echo >>$TMP1 # Add newline cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/xmlns1.sh0000755000175000017500000000100613244022534014127 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxxmlns >$TMP1 <<-EOF EOF cat >$TMP2 <<-EOF <{}outer> <{x:y}a f="f"> <{p:q}b g="g"> <{x:y}a h="h"/> <{p:q}b/> <{http://www.w3.org/XML/1998/namespace}c/> EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/ref1.sh0000755000175000017500000000072313244022534013547 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF term 1 text... term 1 EOF # The echo adds a newline at the end of the file # (./hxref $TMP1; echo) >$TMP2 cat >$TMP3 <<-EOF

      term 1 text... term 1

      EOF cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/normalize8.sh0000755000175000017500000000141313244022534014777 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      ииииииии ииииииии ииииииии EOF cat >$TMP2 <<-EOF

      ииииииии ииииииии ииииииии EOF ./hxnormalize -i 0 $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/xmlasc2.sh0000755000175000017500000000017513244022534014264 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo -e "\0200" >$TMP1 ! ./xml2asc <$TMP1 >/dev/null html-xml-utils-7.7/tests/uncdata1.sh0000755000175000017500000000052513244022534014412 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxuncdata >$TMP1 <<-EOF EOF cat >$TMP2 <<-EOF EOF # if cmp -s $TMP1 $TMP2; then echo Pass; else echo Fail; exit 2; fi cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/copy2.sh0000755000175000017500000000101313244022534013737 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . . . . EOF cat >$TMP3 <<-EOF . . . . EOF ./hxcopy -i foo1/bar -o foo2/bar $TMP1 $TMP2 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/hxnsxml3.sh0000755000175000017500000000033713244022534014477 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF EOF ./hxnsxml $TMP1 >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/clean1.sh0000755000175000017500000000061613244022534014056 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo '' >$TMP3 echo '

      <!- this is not a comment -->' >$TMP2 echo '

      ' >>$TMP2 ./hxclean $TMP3 >$TMP1 echo >>$TMP1 # Add a newline at the end cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/remove2.sh0000755000175000017500000000073113244022534014270 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXX` || exit 1 cat >$TMP1 < EOF cat >$TMP2 < EOF ./hxremove ':lang(fr)' <$TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/select23.sh0000755000175000017500000000052413244022534014335 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmpXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmpXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmpXXXXXX` || exit 1 cat >$TMP1 < EOF ./hxselect ':not(:first-child)' <$TMP1 >$TMP2 ./hxselect ':nth-child(n+2)' <$TMP1 >$TMP3 diff -u $TMP2 $TMP3 html-xml-utils-7.7/tests/index.sh0000755000175000017500000000240013244022534014013 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      Heading 0

      Heading 1

      A-term

      Heading 2

      <M-term>

      Heading 3

      Z-term

      Index

      Remove this. EOF # The echo adds a newline at the end of the file # (./hxnum $TMP1 | LC_ALL=C ./hxindex -t -n; echo) >$TMP2 cat >$TMP3 <

      1. Heading 0

      Heading 1

      A-term

      1.1. Heading 2

      <M-term>

      1.1.1. Heading 3

      Z-term

      2. Index

      EOF cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/pipe3.sh0000755000175000017500000000032413244022534013727 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF test 1 test 2 EOF ./hxpipe file:$TMP1 | ./hxunpipe >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/xref6.sh0000755000175000017500000000070613244022534013745 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxref -l >$TMP1 <<-EOF

      @foo and foo @foo, foo. EOF # Add a newline at the end: echo >>$TMP1 cat >$TMP2 <<-EOF

      @foo and foo @foo, foo.

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/copy4.sh0000755000175000017500000000077413244022534013756 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . . . EOF cat >$TMP3 <<-EOF . . . EOF ./hxcopy -i http://example.com/foo1/bar -o foo2/bar <$TMP1 >$TMP2 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/copy3.sh0000755000175000017500000000071113244022534013744 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . . . EOF cat >$TMP3 <<-EOF . . . EOF ./hxcopy -i foo1/bar -o foo2/bar <$TMP1 >$TMP2 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/normalize11.sh0000755000175000017500000000153513244022534015056 00000000000000: # Test of HTML5 element "main" trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 < Title

      Before the main text.

      Also before the main text. Missing close tag for section.

      Inside the main text. Missing close tag for main. EOF cat >$TMP2 < Title

      Before the main text.

      Also before the main text. Missing close tag for section.

      Inside the main text. Missing close tag for main.

      EOF ./hxnormalize $TMP1 >$TMP3 diff -u $TMP2 $TMP3 html-xml-utils-7.7/tests/normalize4.sh0000755000175000017500000000140613244022534014775 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      ]]> EOF cat >$TMP2 <<-EOF

      ]]> EOF ./hxnormalize -i 2 $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/xmlasc3.sh0000755000175000017500000000026213244022534014262 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo "<" | ./xml2asc >$TMP1 echo "<" >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/printlinks3.sh0000755000175000017500000000132313244022534015167 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxprintlinks >$TMP1 <

      atom EOF cat >$TMP2 <

      atom

      1. http://www.microformats.org/wiki/hcard-profile
      2. a.atom
      3. a.atom
      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/normalize10.sh0000755000175000017500000000143013244022534015047 00000000000000: # Test of some HTML5 elements trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 < Title

      Powwow Highway: Gillette scene

      EOF cat >$TMP2 < Title

      Powwow Highway: Gillette scene EOF ./hxnormalize $TMP1 >$TMP3 diff -u $TMP2 $TMP3 html-xml-utils-7.7/tests/normalize5.sh0000755000175000017500000000101513244022534014772 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF EOF cat >$TMP2 <<-EOF EOF ./hxnormalize -i 0 -x $TMP1 | ./hxnormalize -i 0 -x >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/tabletrans3.sh0000755000175000017500000000106213244022534015131 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo '
      head 1head 2
      head AABC1A2
      head BB2
      head CC2
      ' | ./hxtabletrans >$TMP1 echo '
      head A head B head C
      head 1 ABC1
      head 2 A2 B2 C2
      ' >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/normalize1.sh0000755000175000017500000000055513244022534014776 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      EOF cat >$TMP2 <<-EOF

      EOF ./hxnormalize -i 0 -L $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/unent4.sh0000755000175000017500000000110213244022534014117 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxunent -b -f >$TMP1 <<-EOF <<< < A&B A&B AAAA A AAA A """"--"" &&unknown;&unknown &unknown &#;&#&#y&#x;&#x &#xg ééééé EOF cat >$TMP2 <<-EOF <<< < A&B A&B AAAA A AAA A """"--"" &&unknown;&unknown &unknown &#;&#&#y&#x;&#x &#xg ééééé EOF diff -u -a $TMP1 $TMP2 html-xml-utils-7.7/tests/relurl2.sh0000755000175000017500000000261213244022534014300 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxwls -l -b "http://example.org/remove/this" >$TMP1 <<-EOF link1 link2 link3 query query self self link4 link5 img link6 link7 link8 EOF cat >$TMP2 <<-EOF link rel http://example.org/link0 base http://user:pass@[1234:abcd]:90/base/segm?query1 a http://user:pass@[1234:abcd]:90/base/link1 a http://user:pass@[1234:abcd]:90/link2 a http://other.com/base3/link3 a http://user:pass@[1234:abcd]:90/base/query?query2 a http://user:pass@[1234:abcd]:90/base/segm?query3 a http://user:pass@[1234:abcd]:90/base/segm?query1 a http://user:pass@[1234:abcd]:90/base/segm?query1#fragment a http://user:pass@[1234:abcd]:90/link4 a http://user:pass@[1234:abcd]:90/link5 img http://user:pass@[1234:abcd]:90/base/img.png a http://user:pass@[1234:abcd]:90/base/ a http://user:pass@[1234:abcd]:90/base/link7 a http://user:pass@[1234:abcd]:90/link7 EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/incl8.sh0000755000175000017500000000132513244022534013726 00000000000000: trap 'rm -r $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp -d /tmp/tmp.XXXXXXXXXX` || exit 1 echo 'Test1' >$TMP3/%v% echo 'Test2' >$TMP3/%v (echo '' echo '' echo '' echo '' ) | ./hxincl -s sub=%v% -s v=$TMP3 >$TMP1 (echo 'Test1' echo '' echo 'Test2' echo '' echo 'Test2' echo '' echo 'Test2' echo '' ) >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select10.sh0000755000175000017500000000065513244022534014336 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' 'li:nth-child(3)' >$TMP1 <<-EOF

      Not this.

      • One
      • Two
      • Select this
      • Four
      But not this.
      EOF cat >$TMP2 <<-EOF
    • Select this
    • EOF diff -u $TMP1 $TMP2 # cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/incl11.sh0000755000175000017500000000033013244022534013773 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 printf "Test\n" >$TMP2 printf '' | ./hxincl -f >$TMP1 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/cite3.sh0000755000175000017500000000162313244022534013721 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3 $TMP4' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF %L label1 %L label2 EOF cat >$TMP2 <<-EOF aaa [label1] bbb [label1] ccc aaa [label1] bbb [label1] ccc aaa {{label1]] bbb {label1} ccc aaa aaa[label1]bbb EOF ./hxcite -a $TMP4 $TMP1 >$TMP3 <<-EOF aaa [[label1]] bbb [[label1]] ccc aaa [[label1]] bbb [label1] ccc aaa {{label1]] bbb {label1} ccc aaa aaa[[label1]]bbb EOF cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/printlinks2.sh0000755000175000017500000000071613244022534015173 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxprintlinks >$TMP1 <

      atom EOF cat >$TMP2 <

      atom

      1. a.atom
      2. a.atom
      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/xmlasc5.sh0000755000175000017500000000013313244022534014261 00000000000000: # Illegal UTF-8 sequence echo -e "\0340\0200\0274" | ./xml2asc >/dev/null [[ $? != 0 ]] html-xml-utils-7.7/tests/xmlasc1.sh0000755000175000017500000000035213244022534014260 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo -e "abcdefghijklmnopqrstuvwxyz\0000\0002\0003\0175\0176\0177" >$TMP1 ./xml2asc <$TMP1 >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/ref3.sh0000755000175000017500000000074513244022534013555 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF other text... term EOF # The echo adds a newline at the end of the file # (./hxref $TMP1; echo) >$TMP2 cat >$TMP3 <<-EOF

      other text... term

      EOF cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/remove6.sh0000755000175000017500000000055113244022534014274 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmpXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmpXXXXXX` || exit 1 ./hxremove ':root :not(z)' >$TMP1 < Remove this element Remove this element Remove this element Remove this with this inside EOF cat >$TMP2 < EOF diff -u $TMP2 $TMP1 html-xml-utils-7.7/tests/select17.sh0000755000175000017500000000054313244022534014341 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' 'div ::attr(title)' >$TMP1 <<-EOF

      Not this

      And not this.
      EOF cat >$TMP2 <<-EOF title="Select this." EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/xmlasc4.sh0000755000175000017500000000012613244022534014262 00000000000000: # Illegal UTF-8 sequence echo -e "\0300\0274" | ./xml2asc >/dev/null [[ $? != 0 ]] html-xml-utils-7.7/tests/index8.sh0000755000175000017500000000176613244022534014121 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      Not indexed 1 Indexed 1 Not indexed 2 Indexed 2

      Not indexed 3 Indexed 3

      Remove this. EOF LC_ALL=C ./hxindex -t -O span,p,i -X p $TMP1 >$TMP2 echo >>$TMP2 cat >$TMP3 <<-EOF

      Not indexed 1 Indexed 1 Not indexed 2 Indexed 2

      Not indexed 3 Indexed 3

      • Indexed 1, #
      • Indexed 2, #
      • Indexed 3, #

      EOF cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/remove7.sh0000755000175000017500000000040313244022534014271 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmpXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmpXXXXXX` || exit 1 cat >$TMP1 < def EOF ./hxremove :root :root <$TMP1 >$TMP2 diff -u $TMP2 $TMP2 html-xml-utils-7.7/tests/select19.sh0000755000175000017500000000052613244022534014344 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/select18-XXXXXX` || exit 1 TMP2=`mktemp /tmp/select18-XXXXXX` || exit 1 ./hxselect -s '\n' 'a:not(div a)' >$TMP1 <<-EOF

      Second Third Fourth

      EOF cat >$TMP2 <<-EOF Second Third Fourth EOF diff -u $TMP2 $TMP1 html-xml-utils-7.7/tests/toc3.sh0000755000175000017500000000227613244022534013567 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxtoc -d -t -f >$TMP1 <<-EOF Test

      Document heading

      Second-level heading

      Third-level heading

      Another Third-level heading

      EOF echo >>$TMP1 # Add newline cat >$TMP2 <<-EOF Test

      Document heading

      Second-level heading

      Third-level heading

      Another Third-level heading

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/tabletrans4.sh0000755000175000017500000000117113244022534015133 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo '
      head 1head 2
      head A
      head B
      head C
      ' | ./hxtabletrans -c >$TMP1 echo '
      head A head B head C
      head 1
      head 2
      ' >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select13.sh0000755000175000017500000000074013244022534014334 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' 'div + ul > li:nth-last-child(2n+1)' >$TMP1 <<-EOF

      Not this.

      • This
      • Two
      • This
      • Four
      • This
      But not this.
      EOF cat >$TMP2 <<-EOF
    • This
    • This
    • This
    • EOF diff -u $TMP1 $TMP2 # cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/normalize3.sh0000755000175000017500000000120513244022534014771 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF
      EOF cat >$TMP2 <<-EOF
      EOF ./hxnormalize -i 1 $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/normalize2.sh0000755000175000017500000000074013244022534014773 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF
      EOF cat >$TMP2 <<-EOF
      EOF ./hxnormalize -i 0 -L $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/index9.sh0000755000175000017500000000272513244022534014116 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF Document title

      0-term

      Heading 0

      Heading 1

      A-term

      Heading 2

      <M-term>

      Heading 3

      Z-term

      Index

      Remove this. EOF # The echo adds a newline at the end of the file # (./hxnum $TMP1 | LC_ALL=C ./hxindex -t -N; echo) >$TMP2 cat >$TMP3 <Document title

      0-term

      1. Heading 0

      Heading 1

      A-term

      1.1. Heading 2

      <M-term>

      1.1.1. Heading 3

      Z-term

      2. Index

      EOF diff -u $TMP2 $TMP3 html-xml-utils-7.7/tests/incl2.sh0000755000175000017500000000061413244022534013720 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo "Test" >$TMP3 (echo '' echo 'Ignore this' echo '' ) | ./hxincl >$TMP1 (echo 'Test' echo '' ) >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select07.sh0000755000175000017500000000053613244022534014342 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' -c 'div ::attr(title)' >$TMP1 <<-EOF

      Not this

      And not this.
      EOF cat >$TMP2 <<-EOF Select this. EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/wls5.sh0000755000175000017500000000123413244022534013602 00000000000000: if ! grep '#define HAVE_LIBIDN 1' config.h >/dev/null; then exit 77; fi trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . . . EOF cat >$TMP2 <<-EOF http://8211.example.org/bar/foo%E2%80%93bar.html http://ndash.example.org/bar/foo%E2%80%93bar.html http://xn--caf-dma.example.org/bar/foobar.html EOF ./hxwls -a $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/index10.sh0000755000175000017500000000242313244060633014163 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3 $TMP4 $TMP5 $TMP6' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP5=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP6=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 # Make three files to index echo 'This documentterm1 term2' >$TMP1 echo 'That documentterm1 term3' >$TMP2 echo 'Index' >$TMP3 # Call hxindex on all three files to create a term database in $TMP4 ./hxindex -i $TMP4 -b foo1 -t $TMP1 >/dev/null ./hxindex -i $TMP4 -b foo2 -t $TMP2 >/dev/null ./hxindex -i $TMP4 -b foo3 -t $TMP3 >/dev/null # Call hxindex again to create the index ./hxindex -i $TMP4 -b foo3 -t $TMP3 >$TMP5 # Add a newline echo >>$TMP5 cat $TMP4 # Create the expected result cat >$TMP6 <Index
      • term1, #, #
      • term2, #
      • term3, #
      EOF # Check. diff -u $TMP6 $TMP5 html-xml-utils-7.7/tests/select05.sh0000755000175000017500000000055713244022534014343 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' -c '::attr(title)' >$TMP1 <<-EOF

      Not this.

      And not this.
      EOF cat >$TMP2 <<-EOF Select this. Select this, too. EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/normalize7.sh0000755000175000017500000000111413244022534014774 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      Text EOF cat >$TMP2 <<-EOF

      Text EOF ./hxnormalize $TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/unent5.sh0000755000175000017500000002037713244022534014137 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 # An old version of hxunent failed at 4096-byte boundaries ./hxunent >$TMP1 <$TMP2 <$TMP1 <<-EOF EOF cat >$TMP2 <<-EOF link rel http:/path EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/printlinks4.sh0000755000175000017500000000146413244022534015176 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxprintlinks -b "http://example/base/" >$TMP1 <

      EOF cat >$TMP2 <

      1. http://www.microformats.org/wiki/hcard-profile
      2. http://example/base/a.atom
      3. http://example/b.png
      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/tabletrans5.sh0000755000175000017500000000136513244022534015141 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 echo '
      head 1head 2
      head A
      head B
      head C
      ' | ./hxtabletrans -c >$TMP1 echo '
      head A head B head C
      head 1
      head 2
      ' >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select04.sh0000755000175000017500000000060513244022534014334 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' -c '::attr(title)' >$TMP1 <<-EOF

      Not this.

      And not this.
      EOF cat >$TMP2 <<-EOF Select this. Select this, too. EOF diff -u $TMP1 $TMP2 # cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/pipe2.sh0000755000175000017500000000056313244022534013733 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxpipe >$TMP1 <<-EOF text1 <_foo>text2 text3 EOF cat >$TMP2 <<-EOF Afoo1 CDATA bar1 Afoo2 CDATA bar2 bar2 (abc -\ntext1\n |def -\n (_foo -text2 )_foo -\ntext3\n )abc -\n EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/copy1.sh0000755000175000017500000000040413244022534013741 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . . . EOF ./hxcopy $TMP1 $TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/unpipe2.sh0000755000175000017500000000046613244022534014300 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF Text EOF ./hxpipe $TMP1 | ./hxunpipe >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/incl10.sh0000755000175000017500000000075713244022534014007 00000000000000: trap 'rm -r $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp -d /tmp/tmp.XXXXXXXXXX` || exit 1 p=$PWD cd $TMP3 mkdir dir echo 'Test1' >file1 echo '' >dir/file2 echo 'Test3' >file3 (echo '' echo '' ) >file0 $p/hxincl -M target file0 >$TMP1 (echo "target: \\" echo " file1 \\" echo " dir/file2 \\" echo " file3" ) >$TMP2 cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select06.sh0000755000175000017500000000053413244022534014337 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' -c 'p::attr(title)' >$TMP1 <<-EOF

      Not this.

      And not this.
      EOF cat >$TMP2 <<-EOF Select this. EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/addid1.sh0000755000175000017500000000140713244022534014040 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxaddid p >$TMP1 <<-EOF

      This is a paragraph in English.

      Voilà un écrit en français.

      АБВГҐ ДЂЃЕЁ ЄЖЗЗ́Ѕ ИІЇЙЈ КЛЉМФ ХЦЧЏШ ЩЪЫЬЭ ЮЯ

      αβγδε ζηθικ λμνοπ ρςστ υφχψω EOF echo >>$TMP1 # Add newline cat >$TMP2 <<-EOF

      This is a paragraph in English.

      Voilà un écrit en français.

      АБВГҐ ДЂЃЕЁ ЄЖЗЗ́Ѕ ИІЇЙЈ КЛЉМФ ХЦЧЏШ ЩЪЫЬЭ ЮЯ

      αβγδε ζηθικ λμνοπ ρςστ υφχψω

      EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/pipe1.sh0000755000175000017500000000045613244022534013733 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxpipe -l >$TMP1 <<-EOF EOF cat >$TMP2 <<-EOF L1 (style L1 -/*\n/*]]>*/ L3 )style L4 -\n EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/select11.sh0000755000175000017500000000072613244022534014336 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/addidXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/addidXXXXXXXX` || exit 1 ./hxselect -s '\n' 'li + li + li + li' >$TMP1 <<-EOF

      Not this.

      • One
      • Two
      • Three
      • Select this
      • And this
      But not this.
      EOF cat >$TMP2 <<-EOF
    • Select this
    • And this
    • EOF diff -u $TMP1 $TMP2 # cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/unpipe6.sh0000755000175000017500000000053513244022534014301 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF <αβγ> ✁✂✃✔✍ EOF ./hxpipe $TMP1 | ./hxunpipe >$TMP2 diff -u $TMP1 $TMP2 # cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/normalize6.sh0000755000175000017500000000104213244022534014773 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF

      ...

      EOF cat >$TMP2 <<-EOF

      ... EOF ./hxnormalize -x $TMP1 | ./hxnormalize -i 0 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/copy8.sh0000755000175000017500000000065313244022534013756 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 <<-EOF . . EOF cat >$TMP3 <<-EOF . . EOF ./hxcopy -i https://example.org/foo1/bar -o ./ $TMP1 $TMP2 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/unpipe3.sh0000755000175000017500000000077613244022534014305 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./hxunpipe >$TMP1 <<-EOF ?processing instruction -\n !root "fpi" si -\n *comment L3 -\n Afoo CDATA bar\012 Abar IMPLIED Aid TOKEN x12 (x -line 1\nline 2\n \012111 )x |empty -\n C EOF cat >$TMP2 <<-EOF line 1 line 2 111 EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/remove1.sh0000755000175000017500000000065213244022534014271 00000000000000: trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXX` || exit 1 cat >$TMP1 < EOF cat >$TMP2 < EOF ./hxremove foo <$TMP1 >$TMP3 cmp -s $TMP2 $TMP3 html-xml-utils-7.7/tests/toc4.sh0000755000175000017500000000151213244022534013560 00000000000000: # Test if hxtoc treatc some HTML5 elements correctly trap 'rm $TMP1 $TMP2 $TMP3' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP3=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 cat >$TMP1 < Title

      Powwow Highway: Gillette scene

      EOF cat >$TMP2 <Title

      Powwow Highway: Gillette scene

      EOF ./hxtoc $TMP1 >$TMP3 echo >>$TMP3 # Add newline diff -u $TMP2 $TMP3 html-xml-utils-7.7/tests/ascxml.sh0000755000175000017500000000057413244022534014205 00000000000000: trap 'rm $TMP1 $TMP2' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 ./asc2xml <<-EOF | ./xml2asc >$TMP1 abc123  ¡¢ “ „ „ ☀☁☂ ☃ EOF cat >$TMP2 <<-EOF abc123  ¡¢ “ „ „ ☀☁☂ ☃ EOF cmp -s $TMP1 $TMP2 html-xml-utils-7.7/tests/cite4.sh0000755000175000017500000000124613244022534013723 00000000000000: trap 'rm $TMP1 $TMP2 $TMP4' 0 TMP1=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP2=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 TMP4=`mktemp /tmp/tmp.XXXXXXXXXX` || exit 1 # Make a Refer database # cat >$TMP1 <<-EOF %L label1 %K key-a key-b %K key-c key-d %L label2 EOF # The expected auxiliary file # cat >$TMP2 <<-EOF label1 label1 label2 label2 EOF # Run hxcite # ./hxcite -c -a $TMP4 $TMP1 >/dev/null <<-EOF Here is a reference that uses the label directly: [[label1]] Here is a reference that uses a key: [[key-a]] Here is another one: [[key-d]] And on that uses a key not expanded: {{key-c}} EOF # Compare the generated auxiliary file # cmp -s $TMP2 $TMP4 html-xml-utils-7.7/hxnormalize.10000645000175000017500000000650413244022534013637 00000000000000.TH "HXNORMALIZE" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxnormalize \- pretty-print an HTML file .SH SYNOPSIS .B hxnormalize .RB "[\| " \-x " \|]" .RB "[\| " \-e " \|]" .RB "[\| " \-d " \|]" .RB "[\| " \-s " \|]" .RB "[\| " \-L " \|]" .RB "[\| " \-i .IR indent " \|]" .RB "[\| " \-l .IR line\-length " \|]" .RB "[\| " \-c .IR commentmagic " \|]" .RI "[\| " file-or-URL " \|]" .SH DESCRIPTION .LP The .B hxnormalize command pretty-prints an HTML file, and also tries to fix small errors. The output is the same HTML, but with a maximum line length and with optional indentation to indicate the nesting level of each line. .SH OPTIONS The following options are supported: .TP 10 .B \-x Use XML conventions: empty elements are written with a slash at the end: . Implies .BR \-e . .TP .B \-e Always insert endtags, even if HTML does not require them (for example:

      and ). .TP .B \-d Omit the DOCTYPE from the output. .TP .BI \-i " indent" Set the number of spaces to indent each nesting level. Default is 2. Not all elements cause an indent. In general, elements that can occur in a block environment are started on a new line and cause an indent, but inline elements, such as EM and SPAN do not cause an indent. .TP .BI \-l " line\-length" Sets the maximum length of lines. .B hxnormalize will wrap lines so that all lines are as long as possible, but no longer than this length. Default is 72. Words that are longer than the line length will not be broken, and will extend past this length. A \(lqword\(rq is a sequence of characters delimited by white space.) The content of the STYLE, SCRIPT and PRE elements will not be line-wrapped. .TP .B \-s Omit tags that don't have any attributes. .TP .B \-L Remove redundant "lang" and "xml:lang" attributes. (I.e., those whose value is the same as the language inherited from the parent element.) .TP .BI \-c " commentmagic" Comments are normally placed right after the preceding text. That is usually correct for short comments, but some comments are meant to be on a separate line. .I commentmagic is a string and when that string occurs inside a comment, .B hxnormalize will output an empty line before that comment. E.g. \fB\-c "===="\fR can be used to put all comments that contain "====" on a separate line, preceded by an empty line. By default, no comments are treated that way. .SH OPERANDS The following operand is supported: .TP 10 .I file-or-URL The name or URL of an HTML file. If absent, standard input is read instead. .SH "EXIT STATUS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred in the parsing of the HTML file. .B hxnormalize will try to correct the error and produce output anyway. .SH ENVIRONMENT To use a proxy to retrieve remote files, set the environment variables .B http_proxy and .BR ftp_proxy "." E.g., .B http_proxy="http://localhost:8080/" .SH BUGS .LP The error recovery for incorrect HTML is primitive. .LP .B hxnormalize will not omit an endtag if the white space after it could possibly be significant. E.g., it will not remove the first

      from "

      text

      text

      ". .LP .B hxnormalize can currently only retrieve remote files over HTTP. It doesn't handle password-protected files, nor files whose content depends on HTTP "cookies." .SH "SEE ALSO" .BR asc2xml (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/configure0000755000175000017500000077243413271372511013142 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for html-xml-utils 7.7. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='html-xml-utils' PACKAGE_TARNAME='html-xml-utils' PACKAGE_VERSION='7.7' PACKAGE_STRING='html-xml-utils 7.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="cexport.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS lex_opt_flags LIBOBJS ALLOCA LIBCURL LIBCURL_CPPFLAGS _libcurl_config LTLIBICONV LIBICONV EGREP GREP CPP host_os host_vendor host_cpu host build_os build_vendor build_cpu build LEXLIB LEX_OUTPUT_ROOT LEX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC YFLAGS YACC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking with_gnu_ld enable_rpath with_libiconv_prefix with_libidn2 with_libidn with_libcurl ' ac_precious_vars='build_alias host_alias target_alias YACC YFLAGS CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures html-xml-utils 7.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/html-xml-utils] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of html-xml-utils 7.7:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-rpath do not hardcode runtime library paths Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-libidn2=PREFIX Look for libidn2 in PREFIX/lib and PREFIX/include --with-libidn=PREFIX Look for libidn in PREFIX/lib and PREFIX/include --with-libcurl=PREFIX look for the curl library in PREFIX/lib and headers in PREFIX/include Some influential environment variables: YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF html-xml-utils configure 7.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by html-xml-utils $as_me 7.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.15' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='html-xml-utils' VERSION='7.7' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_config_headers="$ac_config_headers config.h" # Checks for programs. for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi # AC_PROG_INSTALL # AC_PROG_CPP # AC_PROG_LN_S # AC_PROG_AWK # AC_PROG_MAN2HTML # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if ${ac_cv_search_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' socket nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostbyname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostbyname+:} false; then : break fi done if ${ac_cv_search_gethostbyname+:} false; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${acl_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${acl_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 $as_echo_n "checking for shared library run path origin... " >&6; } if ${acl_cv_rpath+:} false; then : $as_echo_n "(cached) " >&6 else CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 $as_echo "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; : else enable_rpath=yes fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" acl_libdirstem=lib acl_libdirstem2= case "$host_os" in solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 $as_echo_n "checking for 64-bit host... " >&6; } if ${gl_cv_solaris_64bit+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _LP64 sixtyfour bits #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "sixtyfour bits" >/dev/null 2>&1; then : gl_cv_solaris_64bit=yes else gl_cv_solaris_64bit=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 $as_echo "$gl_cv_solaris_64bit" >&6; } if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi ;; *) searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi fi LIBICONV= LTLIBICONV= INCICONV= LIBICONV_PREFIX= HAVE_LIBICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if ${am_cv_func_iconv+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 $as_echo "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 $as_echo_n "checking for working iconv... " >&6; } if ${am_cv_func_iconv_works+:} false; then : $as_echo_n "(cached) " >&6 else am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do if test "$cross_compiling" = yes; then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif int main () { int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ if (/* Try standardized names. */ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) /* Try IRIX, OSF/1 names. */ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) /* Try AIX names. */ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) /* Try HP-UX names. */ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) result |= 16; return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : am_cv_func_iconv_works=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi test "$am_cv_func_iconv_works" = no || break done LIBS="$am_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 $as_echo "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then $as_echo "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 $as_echo_n "checking how to link with libiconv... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 $as_echo "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi if test "$am_cv_func_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 $as_echo_n "checking for iconv declaration... " >&6; } if ${am_cv_proto_iconv+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : am_cv_proto_iconv_arg1="" else am_cv_proto_iconv_arg1="const" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_proto_iconv" >&5 $as_echo " $am_cv_proto_iconv" >&6; } cat >>confdefs.h <<_ACEOF #define ICONV_CONST $am_cv_proto_iconv_arg1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-libidn2 was given. if test "${with_libidn2+set}" = set; then : withval=$with_libidn2; libidn2=$withval else libidn2=yes fi if test "$libidn2" != "no"; then if test "$libidn2" != "yes"; then LDFLAGS="${LDFLAGS} -L$libidn2/lib" CPPFLAGS="${CPPFLAGS} -I$libidn2/include" fi ac_fn_c_check_header_mongrel "$LINENO" "idn2.h" "ac_cv_header_idn2_h" "$ac_includes_default" if test "x$ac_cv_header_idn2_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for idn2_lookup_u8 in -lidn2" >&5 $as_echo_n "checking for idn2_lookup_u8 in -lidn2... " >&6; } if ${ac_cv_lib_idn2_idn2_lookup_u8+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lidn2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char idn2_lookup_u8 (); int main () { return idn2_lookup_u8 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_idn2_idn2_lookup_u8=yes else ac_cv_lib_idn2_idn2_lookup_u8=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_idn2_idn2_lookup_u8" >&5 $as_echo "$ac_cv_lib_idn2_idn2_lookup_u8" >&6; } if test "x$ac_cv_lib_idn2_idn2_lookup_u8" = xyes; then : libidn2=yes LIBS="${LIBS} -lidn2" else libidn2=no fi else libidn2=no fi fi if test "$libidn2" != "no" ; then $as_echo "#define HAVE_LIBIDN2 1" >>confdefs.h #else # AC_MSG_WARN([libidn2 not found]) fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libidn2 should be used" >&5 $as_echo_n "checking if libidn2 should be used... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libidn2" >&5 $as_echo "$libidn2" >&6; } # Check whether --with-libidn was given. if test "${with_libidn+set}" = set; then : withval=$with_libidn; libidn=$withval else libidn=yes fi if test "$libidn" != "no"; then if test "$libidn" != "yes"; then LDFLAGS="${LDFLAGS} -L$libidn/lib" CPPFLAGS="${CPPFLAGS} -I$libidn/include" fi ac_fn_c_check_header_mongrel "$LINENO" "idna.h" "ac_cv_header_idna_h" "$ac_includes_default" if test "x$ac_cv_header_idna_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stringprep_check_version in -lidn" >&5 $as_echo_n "checking for stringprep_check_version in -lidn... " >&6; } if ${ac_cv_lib_idn_stringprep_check_version+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lidn $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char stringprep_check_version (); int main () { return stringprep_check_version (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_idn_stringprep_check_version=yes else ac_cv_lib_idn_stringprep_check_version=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_idn_stringprep_check_version" >&5 $as_echo "$ac_cv_lib_idn_stringprep_check_version" >&6; } if test "x$ac_cv_lib_idn_stringprep_check_version" = xyes; then : libidn=yes LIBS="${LIBS} -lidn" else libidn=no fi else libidn=no fi fi if test "$libidn" != "no" ; then $as_echo "#define HAVE_LIBIDN 1" >>confdefs.h #else # AC_MSG_WARN([libidn not found]) fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libidn should be used" >&5 $as_echo_n "checking if libidn should be used... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libidn" >&5 $as_echo "$libidn" >&6; } # Check whether --with-libcurl was given. if test "${with_libcurl+set}" = set; then : withval=$with_libcurl; _libcurl_with=$withval else _libcurl_with=yes fi if test "$_libcurl_with" != "no" ; then for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[1]+256*A[2]+A[3]; print X;}'" _libcurl_try_link=yes if test -d "$_libcurl_with" ; then LIBCURL_CPPFLAGS="-I$withval/include" _libcurl_ldflags="-L$withval/lib" # Extract the first word of "curl-config", so it can be a program name with args. set dummy curl-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path__libcurl_config+:} false; then : $as_echo_n "(cached) " >&6 else case $_libcurl_config in [\\/]* | ?:[\\/]*) ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in "$withval/bin" do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi _libcurl_config=$ac_cv_path__libcurl_config if test -n "$_libcurl_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5 $as_echo "$_libcurl_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else # Extract the first word of "curl-config", so it can be a program name with args. set dummy curl-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path__libcurl_config+:} false; then : $as_echo_n "(cached) " >&6 else case $_libcurl_config in [\\/]* | ?:[\\/]*) ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi _libcurl_config=$ac_cv_path__libcurl_config if test -n "$_libcurl_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5 $as_echo "$_libcurl_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$_libcurl_config != "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the version of libcurl" >&5 $as_echo_n "checking for the version of libcurl... " >&6; } if ${libcurl_cv_lib_curl_version+:} false; then : $as_echo_n "(cached) " >&6 else libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_version" >&5 $as_echo "$libcurl_cv_lib_curl_version" >&6; } _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` _libcurl_wanted=`echo 7.9.7 | $_libcurl_version_parse` if test $_libcurl_wanted -gt 0 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl >= version 7.9.7" >&5 $as_echo_n "checking for libcurl >= version 7.9.7... " >&6; } if ${libcurl_cv_lib_version_ok+:} false; then : $as_echo_n "(cached) " >&6 else if test $_libcurl_version -ge $_libcurl_wanted ; then libcurl_cv_lib_version_ok=yes else libcurl_cv_lib_version_ok=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_version_ok" >&5 $as_echo "$libcurl_cv_lib_version_ok" >&6; } fi if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then if test x"$LIBCURL_CPPFLAGS" = "x" ; then LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` fi if test x"$LIBCURL" = "x" ; then LIBCURL=`$_libcurl_config --libs` # This is so silly, but Apple actually has a bug in their # curl-config script. Fixed in Tiger, but there are still # lots of Panther installs around. case "${host}" in powerpc-apple-darwin7*) LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` ;; esac fi # All curl-config scripts support --feature _libcurl_features=`$_libcurl_config --feature` # Is it modern enough to have --protocols? (7.12.4) if test $_libcurl_version -ge 461828 ; then _libcurl_protocols=`$_libcurl_config --protocols` fi else _libcurl_try_link=no fi unset _libcurl_wanted fi if test $_libcurl_try_link = yes ; then # we didn't find curl-config, so let's see if the user-supplied # link line (or failing that, "-lcurl") is enough. LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcurl is usable" >&5 $as_echo_n "checking whether libcurl is usable... " >&6; } if ${libcurl_cv_lib_curl_usable+:} false; then : $as_echo_n "(cached) " >&6 else _libcurl_save_cppflags=$CPPFLAGS CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" _libcurl_save_libs=$LIBS LIBS="$LIBCURL $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { /* Try and use a few common options to force a failure if we are missing symbols or can't link. */ int x; curl_easy_setopt(NULL,CURLOPT_URL,NULL); x=CURL_ERROR_SIZE; x=CURLOPT_WRITEFUNCTION; x=CURLOPT_FILE; x=CURLOPT_ERRORBUFFER; x=CURLOPT_STDERR; x=CURLOPT_VERBOSE; if (x) ; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : libcurl_cv_lib_curl_usable=yes else libcurl_cv_lib_curl_usable=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS=$_libcurl_save_cppflags LIBS=$_libcurl_save_libs unset _libcurl_save_cppflags unset _libcurl_save_libs fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_usable" >&5 $as_echo "$libcurl_cv_lib_curl_usable" >&6; } if test $libcurl_cv_lib_curl_usable = yes ; then # Does curl_free() exist in this version of libcurl? # If not, fake it with free() _libcurl_save_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" _libcurl_save_libs=$LIBS LIBS="$LIBS $LIBCURL" ac_fn_c_check_func "$LINENO" "curl_free" "ac_cv_func_curl_free" if test "x$ac_cv_func_curl_free" = xyes; then : else $as_echo "#define curl_free free" >>confdefs.h fi CPPFLAGS=$_libcurl_save_cppflags LIBS=$_libcurl_save_libs unset _libcurl_save_cppflags unset _libcurl_save_libs $as_echo "#define HAVE_LIBCURL 1" >>confdefs.h for _libcurl_feature in $_libcurl_features ; do cat >>confdefs.h <<_ACEOF #define `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_cpp` 1 _ACEOF eval `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_sh`=yes done if test "x$_libcurl_protocols" = "x" ; then # We don't have --protocols, so just assume that all # protocols are available _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" if test x$libcurl_feature_SSL = xyes ; then _libcurl_protocols="$_libcurl_protocols HTTPS" # FTPS wasn't standards-compliant until version # 7.11.0 (0x070b00 == 461568) if test $_libcurl_version -ge 461568; then _libcurl_protocols="$_libcurl_protocols FTPS" fi fi # RTSP, IMAP, POP3 and SMTP were added in # 7.20.0 (0x071400 == 463872) if test $_libcurl_version -ge 463872; then _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" fi fi for _libcurl_protocol in $_libcurl_protocols ; do cat >>confdefs.h <<_ACEOF #define `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_cpp` 1 _ACEOF eval `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_sh`=yes done else unset LIBCURL unset LIBCURL_CPPFLAGS fi fi unset _libcurl_try_link unset _libcurl_version_parse unset _libcurl_config unset _libcurl_feature unset _libcurl_features unset _libcurl_protocol unset _libcurl_protocols unset _libcurl_version unset _libcurl_ldflags fi if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then # This is the IF-NO path : else # This is the IF-YES path : fi unset _libcurl_with # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi for ac_header in arpa/inet.h errno.h fcntl.h inttypes.h libintl.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/time.h unistd.h search.h wchar.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int8_t $ac_cv_c_int8_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac # Checks for library functions. for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R $ac_have_decl _ACEOF for ac_func in strerror_r do : ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR_R 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then $as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done for ac_func in atexit getcwd memchr gethostbyname memmove memset regcomp select setlocale socket strcasecmp strchr strcspn strdup strerror strncasecmp strndup strpbrk strrchr strspn strstr strtol strtoul fopencookie do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" if test "x$ac_cv_func_strdup" = xyes; then : $as_echo "#define HAVE_STRDUP 1" >>confdefs.h else case " $LIBOBJS " in *" strdup.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strdup.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes; then : $as_echo "#define HAVE_STRERROR 1" >>confdefs.h else case " $LIBOBJS " in *" strerror.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strerror.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" if test "x$ac_cv_func_strstr" = xyes; then : $as_echo "#define HAVE_STRSTR 1" >>confdefs.h else case " $LIBOBJS " in *" strstr.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strstr.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" if test "x$ac_cv_func_tsearch" = xyes; then : $as_echo "#define HAVE_TSEARCH 1" >>confdefs.h else case " $LIBOBJS " in *" tsearch.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS tsearch.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "tfind" "ac_cv_func_tfind" if test "x$ac_cv_func_tfind" = xyes; then : $as_echo "#define HAVE_TFIND 1" >>confdefs.h else case " $LIBOBJS " in *" tfind.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS tfind.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "twalk" "ac_cv_func_twalk" if test "x$ac_cv_func_twalk" = xyes; then : $as_echo "#define HAVE_TWALK 1" >>confdefs.h else case " $LIBOBJS " in *" twalk.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS twalk.$ac_objext" ;; esac fi # Check for library variables { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt has optreset support" >&5 $as_echo_n "checking whether getopt has optreset support... " >&6; } if ${ac_cv_have_getopt_optreset+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { extern int optreset; optreset = 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_have_getopt_optreset="yes" else ac_cv_have_getopt_optreset="no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_getopt_optreset" >&5 $as_echo "$ac_cv_have_getopt_optreset" >&6; } if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then $as_echo "#define HAVE_GETOPT_OPTRESET 1" >>confdefs.h fi # Optimization flags for flex case "$ac_cv_prog_LEX" in *flex) lex_opt_flags=-Cfe;; esac ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by html-xml-utils $as_me 7.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ html-xml-utils config.status 7.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi if test "$libidn2" = "no" && test "$libidn" = "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Neither libidn2 nor libidn found" >&5 $as_echo "$as_me: WARNING: Neither libidn2 nor libidn found" >&2;} fi html-xml-utils-7.7/asc2xml.10000644000175000017500000000047513244022534012650 00000000000000.TH "ASC2XML" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME asc2xml \- convert &#nnn; entities to UTF-8 .SH SYNOPSIS .B asc2xml .SH DESCRIPTION .LP Reads an ASCII or ISO-8859-1 (Latin-1) text from standard input and writes encoded UTF-8 to standard output. .SH "SEE ALSO" .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/class.c0000644000175000017500000000345513244022534012467 00000000000000/* * Routines to check for the occurrence of a class. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Author: Bert Bos * Created: 20 Aug 2000 * **/ #define _GNU_SOURCE /* We need strcasestr() */ #include "config.h" #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #include #include #include "export.h" #include "types.e" /* contains -- check if s contains word (case-insenstive), return pointer */ EXPORT conststring contains(const conststring s, const conststring word) { conststring t = s; unsigned char c; while ((t = strcasestr(t, word))) { if ((c = *(t + strlen(word))) && !isspace(c)) t++; /* Not end of word */ else if (t != s && !isspace(*(t - 1))) t++; /* Not beginning of word */ else return t; /* Found it */ } return NULL; /* Not found */ } /* has_class -- check for class=word in list of attributes */ EXPORT bool has_class(pairlist attribs, const string word) { pairlist p; for (p = attribs; p; p = p->next) { if (strcasecmp(p->name, "class") == 0 && contains(p->value, word)) return true; } return false; } /* in_list -- check if word occurs in array list */ static bool in_list(const string word, const string *list) { int i; for (i = 0; list[i]; i++) if (contains(word, list[i])) return true; return false; } /* has_class_in_list -- check for class=word for all words in array c */ EXPORT bool has_class_in_list(const pairlist attribs, const string *c) { pairlist p; assert(c); for (p = attribs; p; p = p->next) { if (strcasecmp(p->name, "class") == 0 && in_list(p->value, c)) return true; } return false; } html-xml-utils-7.7/m4/0000755000175000017500000000000013271374344011620 500000000000000html-xml-utils-7.7/m4/flex-optimize.m40000645000175000017500000000035613271361474014603 00000000000000# AC_FLEX_OPTIMIZE # -------------------------------------------------------------- # Check whether we can use option -Cfe to optimize the lexer AC_DEFUN([AC_FLEX_OPTIMIZE], [case "$ac_cv_prog_LEX" in *flex) lex_opt_flags=-Cfe;; esac]) html-xml-utils-7.7/m4/libidn2.m40000645000175000017500000000154213271361474013330 00000000000000# CHECK_LIBIDN # -------------------------------------------------------------- # Define --with-libidn2 and test macro HAVE_LIBIDN2 AC_DEFUN([LIBIDN2_CHECK], [ AC_ARG_WITH(libidn2, AC_HELP_STRING([--with-libidn2=[PREFIX]], [Look for libidn2 in PREFIX/lib and PREFIX/include]), libidn2=$withval, libidn2=yes) if test "$libidn2" != "no"; then if test "$libidn2" != "yes"; then LDFLAGS="${LDFLAGS} -L$libidn2/lib" CPPFLAGS="${CPPFLAGS} -I$libidn2/include" fi AC_CHECK_HEADER(idn2.h, AC_CHECK_LIB(idn2, idn2_lookup_u8, [libidn2=yes LIBS="${LIBS} -lidn2"], libidn2=no), libidn2=no) fi if test "$libidn2" != "no" ; then AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you want IDN2 support.]) #else # AC_MSG_WARN([libidn2 not found]) fi AC_MSG_CHECKING([if libidn2 should be used]) AC_MSG_RESULT($libidn2) ])dnl html-xml-utils-7.7/m4/optreset.m40000645000175000017500000000112413271361474013646 00000000000000# CHECK_GETOPT_OPTRESET # -------------------------------------------------------------- # Set HAVE_GETOPT_OPTRESET if getopt() needs optreset to restart AC_DEFUN([CHECK_GETOPT_OPTRESET], [AC_CACHE_CHECK([whether getopt has optreset support], ac_cv_have_getopt_optreset, [ AC_TRY_LINK( [ #include ], [ extern int optreset; optreset = 0; ], [ ac_cv_have_getopt_optreset="yes" ], [ ac_cv_have_getopt_optreset="no" ] ) ]) if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then AC_DEFINE(HAVE_GETOPT_OPTRESET, 1, [Define if your getopt(3) defines and uses optreset]) fi]) html-xml-utils-7.7/m4/libidn.m40000645000175000017500000000152513271361474013247 00000000000000# CHECK_LIBIDN # -------------------------------------------------------------- # Define --with-libidn and test macro HAVE_LIBIDN AC_DEFUN([LIBIDN_CHECK], [ AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[PREFIX]], [Look for libidn in PREFIX/lib and PREFIX/include]), libidn=$withval, libidn=yes) if test "$libidn" != "no"; then if test "$libidn" != "yes"; then LDFLAGS="${LDFLAGS} -L$libidn/lib" CPPFLAGS="${CPPFLAGS} -I$libidn/include" fi AC_CHECK_HEADER(idna.h, AC_CHECK_LIB(idn, stringprep_check_version, [libidn=yes LIBS="${LIBS} -lidn"], libidn=no), libidn=no) fi if test "$libidn" != "no" ; then AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want IDN support.]) #else # AC_MSG_WARN([libidn not found]) fi AC_MSG_CHECKING([if libidn should be used]) AC_MSG_RESULT($libidn) ])dnl html-xml-utils-7.7/m4/libcurl.m40000645000175000017500000002367113271361474013450 00000000000000# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], # [ACTION-IF-YES], [ACTION-IF-NO]) # ---------------------------------------------------------- # David Shaw May-09-2006 # # Checks for libcurl. DEFAULT-ACTION is the string yes or no to # specify whether to default to --with-libcurl or --without-libcurl. # If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the # minimum version of libcurl to accept. Pass the version as a regular # version number like 7.10.1. If not supplied, any version is # accepted. ACTION-IF-YES is a list of shell commands to run if # libcurl was successfully found and passed the various tests. # ACTION-IF-NO is a list of shell commands that are run otherwise. # Note that using --without-libcurl does run ACTION-IF-NO. # # This macro #defines HAVE_LIBCURL if a working libcurl setup is # found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary # values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are # the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy # where yyy are the various protocols supported by libcurl. Both xxx # and yyy are capitalized. See the list of AH_TEMPLATEs at the top of # the macro for the complete list of possible defines. Shell # variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also # defined to 'yes' for those features and protocols that were found. # Note that xxx and yyy keep the same capitalization as in the # curl-config list (e.g. it's "HTTP" and not "http"). # # Users may override the detected values by doing something like: # LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure # # For the sake of sanity, this macro assumes that any libcurl that is # found is after version 7.7.2, the first version that included the # curl-config script. Note that it is very important for people # packaging binary versions of libcurl to include this script! # Without curl-config, we can only guess what protocols are available, # or use curl_version_info to figure it out at runtime. AC_DEFUN([LIBCURL_CHECK_CONFIG], [ AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL]) AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4]) AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN]) AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI]) AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM]) AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP]) AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3]) AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP]) AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) AC_ARG_WITH(libcurl, AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) if test "$_libcurl_with" != "no" ; then AC_PROG_AWK _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" _libcurl_try_link=yes if test -d "$_libcurl_with" ; then LIBCURL_CPPFLAGS="-I$withval/include" _libcurl_ldflags="-L$withval/lib" AC_PATH_PROG([_libcurl_config],[curl-config],[], ["$withval/bin"]) else AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH]) fi if test x$_libcurl_config != "x" ; then AC_CACHE_CHECK([for the version of libcurl], [libcurl_cv_lib_curl_version], [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` if test $_libcurl_wanted -gt 0 ; then AC_CACHE_CHECK([for libcurl >= version $2], [libcurl_cv_lib_version_ok], [ if test $_libcurl_version -ge $_libcurl_wanted ; then libcurl_cv_lib_version_ok=yes else libcurl_cv_lib_version_ok=no fi ]) fi if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then if test x"$LIBCURL_CPPFLAGS" = "x" ; then LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` fi if test x"$LIBCURL" = "x" ; then LIBCURL=`$_libcurl_config --libs` # This is so silly, but Apple actually has a bug in their # curl-config script. Fixed in Tiger, but there are still # lots of Panther installs around. case "${host}" in powerpc-apple-darwin7*) LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` ;; esac fi # All curl-config scripts support --feature _libcurl_features=`$_libcurl_config --feature` # Is it modern enough to have --protocols? (7.12.4) if test $_libcurl_version -ge 461828 ; then _libcurl_protocols=`$_libcurl_config --protocols` fi else _libcurl_try_link=no fi unset _libcurl_wanted fi if test $_libcurl_try_link = yes ; then # we didn't find curl-config, so let's see if the user-supplied # link line (or failing that, "-lcurl") is enough. LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} AC_CACHE_CHECK([whether libcurl is usable], [libcurl_cv_lib_curl_usable], [ _libcurl_save_cppflags=$CPPFLAGS CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" _libcurl_save_libs=$LIBS LIBS="$LIBCURL $LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[ /* Try and use a few common options to force a failure if we are missing symbols or can't link. */ int x; curl_easy_setopt(NULL,CURLOPT_URL,NULL); x=CURL_ERROR_SIZE; x=CURLOPT_WRITEFUNCTION; x=CURLOPT_FILE; x=CURLOPT_ERRORBUFFER; x=CURLOPT_STDERR; x=CURLOPT_VERBOSE; if (x) ; ]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) CPPFLAGS=$_libcurl_save_cppflags LIBS=$_libcurl_save_libs unset _libcurl_save_cppflags unset _libcurl_save_libs ]) if test $libcurl_cv_lib_curl_usable = yes ; then # Does curl_free() exist in this version of libcurl? # If not, fake it with free() _libcurl_save_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" _libcurl_save_libs=$LIBS LIBS="$LIBS $LIBCURL" AC_CHECK_FUNC(curl_free,, AC_DEFINE(curl_free,free, [Define curl_free() as free() if our version of curl lacks curl_free.])) CPPFLAGS=$_libcurl_save_cppflags LIBS=$_libcurl_save_libs unset _libcurl_save_cppflags unset _libcurl_save_libs AC_DEFINE(HAVE_LIBCURL,1, [Define to 1 if you have a functional curl library.]) AC_SUBST(LIBCURL_CPPFLAGS) AC_SUBST(LIBCURL) for _libcurl_feature in $_libcurl_features ; do AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes done if test "x$_libcurl_protocols" = "x" ; then # We don't have --protocols, so just assume that all # protocols are available _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" if test x$libcurl_feature_SSL = xyes ; then _libcurl_protocols="$_libcurl_protocols HTTPS" # FTPS wasn't standards-compliant until version # 7.11.0 (0x070b00 == 461568) if test $_libcurl_version -ge 461568; then _libcurl_protocols="$_libcurl_protocols FTPS" fi fi # RTSP, IMAP, POP3 and SMTP were added in # 7.20.0 (0x071400 == 463872) if test $_libcurl_version -ge 463872; then _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" fi fi for _libcurl_protocol in $_libcurl_protocols ; do AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes done else unset LIBCURL unset LIBCURL_CPPFLAGS fi fi unset _libcurl_try_link unset _libcurl_version_parse unset _libcurl_config unset _libcurl_feature unset _libcurl_features unset _libcurl_protocol unset _libcurl_protocols unset _libcurl_version unset _libcurl_ldflags fi if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then # This is the IF-NO path ifelse([$4],,:,[$4]) else # This is the IF-YES path ifelse([$3],,:,[$3]) fi unset _libcurl_with ])dnl html-xml-utils-7.7/textwrap.e0000755000175000017500000000121613244022534013236 00000000000000extern void set_indent(int n); extern void set_linelen(int n); extern void flush(); extern void outc(char c, _Bool preformatted); extern void out(string s, _Bool preformatted); extern void outn(string s, size_t n, _Bool preformatted); extern void outln(char *s, _Bool preformatted); extern void outbreak(void); extern void outbreakpoint(void); extern void inc_indent(void); extern void dec_indent(void); html-xml-utils-7.7/headers.c0000644000175000017500000000346613244022534012777 00000000000000/* * Routines to read headers of the style found in HTTP and mail * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 2008 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 6 August 2008 */ #include "config.h" #include #include #include #include #include #include #include "export.h" #include "heap.e" #include "types.e" #include "dict.e" #define BUFLEN 4096 /* Max len of header lines */ /* read_mail_headers -- read mail-style headers into headers, false on error */ EXPORT bool read_mail_headers(FILE *f, Dictionary headers) { int i; string p, line = NULL; char buf[BUFLEN]; /* Read first line */ if (!fgets(buf, sizeof(buf), f)) return (ferror(f) == 0); if (!(line = strdup(buf))) return false; /* While not read an empty line, read and process more lines */ while (line[0] != '\r' && line[0] != '\n' && fgets(buf, sizeof(buf), f)) { i = strlen(line); assert(i != 0); if (line[i-1] != '\n') { strapp(&line, buf, NULL); /* Previous fgets() didn't reach eol */ } else if (buf[0] == ' ' || buf[0] == '\t') { /* Continuation line */ if (line[i-1] == '\n') line[i-1] = '\0'; if (i > 1 && line[i-2] == '\r') line[i-2] = '\0'; strapp(&line, buf + 1, NULL); } else { if (!(p = strchr(line, ':'))) {free(line); return 0;} /* Syntax error */ *p = '\0'; for (p++; isspace(*p); p++) ; for (i = strlen(p) - 1; i >= 0 && isspace(p[i]); i--) p[i] = '\0'; down(line); /* Header name to lowercase */ if (!dict_add(headers, line, p)) {free(line); return 0;} free(line); line = newstring(buf); } } free(line); return ferror(f) == 0; } html-xml-utils-7.7/hxaddid.c0000645000175000017500000001354213244022534012766 00000000000000/* * Add an ID to selected elements * * Copyright © 2000-2012 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 20 Aug 2000 * Version: $Id: hxaddid.c,v 1.8 2017/11/24 09:50:25 bbos Exp $ * **/ #include "config.h" #include #include #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #ifdef HAVE_ERRNO_H # include #endif #include "export.h" #include "types.e" #include "heap.e" #include "tree.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "errexit.e" #include "genid.e" #include "class.e" static Tree tree; static bool xml = false; /* Use convention */ static string targetelement = NULL; /* Element to extract */ static string targetclass = NULL; /* Class to extract */ /* is_match check whether the element matches the target element and class */ static bool is_match(const string name, pairlist attribs) { if (xml) return ((!targetelement || strcasecmp(name, targetelement) == 0) && (!targetclass || has_class(attribs, targetclass))); else return ((!targetelement || strcmp(name, targetelement) == 0) && (!targetclass || has_class(attribs, targetclass))); } /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) { tree = create(); return NULL; } /* end -- called after the last event is reported */ static void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, string commenttext) { tree = append_comment(tree, commenttext); } /* handle_text -- called after a tex chunk is parsed */ static void handle_text(void *clientdata, string text) { tree = append_text(tree, text); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *clientdata, string gi, string fpi, string url) { tree = append_declaration(tree, gi, fpi, url); } /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *clientdata, string pi_text) { tree = append_procins(tree, pi_text); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, string name, pairlist attribs) { conststring id; tree = html_push(tree, name, attribs); /* If it has an ID, store it (so we don't accidentally generate it) */ if ((id = pairlist_get(attribs, "id"))) storeID(id); } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, string name, pairlist attribs) { handle_starttag(clientdata, name, attribs); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, string name) { tree = html_pop(tree, name); } /* expand -- write the tree, inserting ID's at matching elements */ static void expand(Tree t) { Tree h; pairlist a; for (h = t->children; h != NULL; h = h->sister) { switch (h->tp) { case Text: printf("%s", h->text); break; case Comment: printf("", h->text); break; case Declaration: printf("name); if (h->text) printf(" PUBLIC \"%s\"", h->text); if (h->url) printf(" %s\"%s\"", h->text ? "" : "SYSTEM ", h->url); printf(">"); break; case Procins: printf("", h->text); break; case Element: if (is_match(h->name, h->attribs) && !get_attrib(h, "id")) set_attrib(h, "id", gen_id(h)); printf("<%s", h->name); for (a = h->attribs; a != NULL; a = a->next) { printf(" %s", a->name); if (a->value != NULL) printf("=\"%s\"", a->value); } if (is_empty(h->name)) { printf(xml ? " />" : ">"); } else { printf(">"); expand(h); printf("", h->name); } break; case Root: assert(! "Cannot happen"); break; default: assert(! "Cannot happen"); } } } /* usage -- print usage message and exit */ static void usage(string name) { errexit("Usage: %s [-x] [-v] [--] elem|.class|elem.class [html-file]\n", name); } int main(int argc, char *argv[]) { char *p; int i, status = 200; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Parse command line options */ for (i = 1; i < argc && argv[i][0] == '-' && !eq(argv[i], "--"); i++) { switch (argv[i][1]) { case 'x': xml = true; break; case 'v': printf("Version: %s %s\n", PACKAGE, VERSION); return 0; default: usage(argv[0]); } } if (i < argc && eq(argv[i], "--")) i++; if (i == argc) usage(argv[0]); if (argv[i][0] == '.') { /* Class name */ targetclass = argv[i] + 1; } else { /* Element name */ targetelement = argv[i]; if ((p = strchr(targetelement, '.'))) { *p = '\0'; targetclass = p + 1; } } i++; if (i == argc) yyin = stdin; else if (i == argc - 1 && eq(argv[i], "-")) yyin = stdin; else if (i == argc - 1) yyin = fopenurl(argv[i], "r", &status); else usage(argv[0]); if (yyin == NULL) {perror(argv[i]); exit(1);} if (status != 200) errexit("%s : %s\n", argv[i], http_strerror(status)); if (yyparse() != 0) exit(3); tree = get_root(tree); expand(tree); tree_delete(tree); /* Just to test memory mgmt */ return 0; } html-xml-utils-7.7/tree.c0000645000175000017500000003374213244022534012324 00000000000000/* * Copyright © 1997-2016 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 1997 **/ #include "config.h" #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRDUP # include "strdup.e" # endif #endif #include #include #include #include "export.h" #include "heap.e" #include "types.e" #include "dtd.e" #include "errexit.e" #include "scan.e" EXPORT typedef enum { Element, Text, Comment, Declaration, Procins, Root } Nodetype; EXPORT typedef struct _node { Nodetype tp; string name; pairlist attribs; string text; string url; struct _node *parent; struct _node *sister; struct _node *children; } Node, *Tree; /* create -- create an empty tree */ EXPORT Tree create(void) { Tree t = malloc(sizeof(*t)); assert(t != NULL); t->tp = Root; t->name = ""; t->sister = t->children = NULL; return t; } /* tree_delete -- recursively free the memory occupied by a tree */ EXPORT void tree_delete(Tree t) { if (t != NULL) { switch (t->tp) { case Element: dispose(t->name); pairlist_delete(t->attribs); tree_delete(t->sister); tree_delete(t->children); break; case Text: dispose(t->text); assert(t->children == NULL); tree_delete(t->sister); break; case Comment: dispose(t->text); assert(t->children == NULL); tree_delete(t->sister); break; case Declaration: dispose(t->name); dispose(t->text); dispose(t->url); assert(t->children == NULL); tree_delete(t->sister); break; case Procins: dispose(t->text); assert(t->children == NULL); tree_delete(t->sister); break; case Root: assert(t->sister == NULL); tree_delete(t->children); break; default: assert(!"Cannot happen"); } dispose(t); } } /* get_root -- return root of tree */ EXPORT Tree get_root(Tree t) { while (t->tp != Root) t = t->parent; return t; } /* get_attrib -- return a ptr to the value of a named attibute, or false */ EXPORT conststring get_attrib(const Node *e, const conststring attname) { assert(e->tp == Element); return pairlist_get(e->attribs, attname); } /* set_attrib -- set an attribute to a value */ EXPORT void set_attrib(Node *e, string name, conststring value) { assert(e->tp == Element); pairlist_set(&e->attribs, name, value); } /* delete_attrib -- remove attribute from element, false if not found */ EXPORT bool delete_attrib(Node *e, const conststring name) { assert(e->tp == Element); return pairlist_unset(&e->attribs, name); } /* get_by_id -- recursively get the element node with the id in subtree n */ static Tree get_by_id(Node *n, const conststring id) { conststring val; Tree h, p; assert(n->tp == Element); if ((val = get_attrib(n, "id")) && eq(val, id)) return n; for (h = n->children; h; h = h->sister) if (h->tp == Element && (p = get_by_id(h, id))) return p; return NULL; } /* get_elt_by_id -- get the element node with the ID attribute id */ EXPORT Tree get_elt_by_id(Node *n, const conststring id) { /* To do: should this use a hash table? */ Tree h, p; h = get_root(n); for (h = h->children; h; h = h->sister) if (h->tp == Element && (p = get_by_id(h, id))) return p; return NULL; } /* wrap_contents -- wrap contents of a node in an element, return new elt */ EXPORT Tree wrap_contents(Node *n, const string elem, pairlist attr) { Node *h, *k; new(h); h->tp = Element; h->name = newstring(elem); h->attribs = attr; h->sister = NULL; h->parent = n; h->children = n->children; n->children = h; for (k = h->children; k; k = k->sister) k->parent = h; return h; } /* wrap_elt -- wrap an element in a new element, return the new element */ EXPORT Tree wrap_elt(Node *n, const conststring elem, pairlist attr) { Node *h, *k; new(h); h->tp = Element; h->name = newstring(elem); h->attribs = attr; h->sister = n->sister; h->parent = n->parent; h->children = n; n->sister = NULL; n->parent = h; if (h->parent->children == n) { h->parent->children = h; } else { k = h->parent->children; while (k->sister != n) {assert(k->sister->sister); k = k->sister;} k->sister = h; } return h; } /* rename_elt -- change the name of an element to elem */ EXPORT void rename_elt(Node *n, const string elem) { assert(n->tp == Element); n->name = newstring(elem); } /* push -- add a child node to the tree */ static Tree push(Tree t, Node *n) { if (t->children == NULL) { t->children = n; } else { Tree h = t->children; while (h->sister != NULL) h = h->sister; h->sister = n; } n->parent = t; return n; } /* pop -- go up one level */ static Tree pop(Tree t) { assert(t != NULL); assert(t->tp != Root); return t->parent; } /* append -- add at end of children */ static Tree append(Tree t, Node *n) { assert(t != NULL); if (t->children == NULL) { t->children = n; } else { Tree h = t->children; while (h->sister != NULL) h = h->sister; h->sister = n; } n->parent = t; return t; } /* lookup -- lookup info about an element case-insensitively */ static const ElementType *lookup(const string e) { char h[MAXNAMELEN+2]; strncpy(h, e, sizeof(h) - 1); h[sizeof(h)-1] = '\0'; down(h); return lookup_element(h, strlen(h)); } /* is_known -- true if the element is an HTML 4 element */ EXPORT bool is_known(const string e) { return lookup(e) != NULL; } /* is_pre -- true if the element has preformatted content */ EXPORT bool is_pre(const string e) { const ElementType *info = lookup(e); return info && info->pre; } /* need_stag -- true if the element's start tag is required */ EXPORT bool need_stag(const string e) { const ElementType *info = lookup(e); return !info || info->stag; } /* need_etag -- true if the element's end tag is required */ EXPORT bool need_etag(const string e) { const ElementType *info = lookup(e); return !info || info->etag; } /* is_empty -- true if element is empty */ EXPORT bool is_empty(const string e) { const ElementType *info = lookup(e); return info && info->empty; } /* has_parent -- true if c accepts p as a parent */ EXPORT bool has_parent(const string c, const string p) { const ElementType *info = lookup_element(c, strlen(c)); int i; if (!info) return false; for (i = 0; info->parents[i]; i++) if (eq(info->parents[i], p)) return true; return false; } /* preferred_parent -- return first possible parent of e */ static string preferred_parent(const string e) { const ElementType *info = lookup_element(e, strlen(e)); assert(info != NULL); /* element is known */ assert(info->parents[0] != NULL); /* element is not root */ return info->parents[0]; } /* is_root -- true if e has no possible parents */ static bool is_root(const string e) { const ElementType *info = lookup_element(e, strlen(e)); assert(info != NULL); /* element is known */ return info->parents[0] == NULL; } /* is_mixed -- true if e accepts text content */ EXPORT bool is_mixed(const string e) { const ElementType *info = lookup(e); return !info || info->mixed; } /* break_before -- true if element looks better with a newline before it */ EXPORT bool break_before(const string e) { const ElementType *info = lookup(e); return info && info->break_before; } /* break_after -- true if element looks better with a newline after it */ EXPORT bool break_after(const string e) { const ElementType *info = lookup(e); return info && info->break_after; } /* is_cdata_elt -- true if element has character data content */ EXPORT bool is_cdata_elt(const string e) { const ElementType *info = lookup(e); return info && info->cdata; } /* build_path -- try to add omittable start tags to make elem acceptable */ static bool build_path(Tree *t, string elem) { const ElementType *info; Node *n; int i; assert(is_known(elem)); assert(is_known((*t)->name)); /* Check if we are done */ if (has_parent(elem, (*t)->name)) return true; /* Try recursively if any possible parent can be a child of t */ info = lookup(elem); for (i = 0; info->parents[i]; i++) { if (!need_stag(info->parents[i]) && build_path(t, info->parents[i])) { /* Success, so add this parent and return true */ n = malloc(sizeof(*n)); assert(n != NULL); n->tp = Element; n->name = newstring(info->parents[i]); assert(islower(n->name[0])); n->attribs = NULL; n->sister = n->children = NULL; *t = push(*t, n); return true; } } return false; } /* tree_push -- add an element to the tree, without checking the DTD */ EXPORT Tree tree_push(Tree t, string elem, pairlist attr) { Node *n; new(n); n->tp = Element; n->name = newstring(elem); n->attribs = attr; n->sister = n->children = NULL; return push(t, n); } /* html_push -- add an element to the tree, open or close missing elements */ EXPORT Tree html_push(Tree t, string elem, pairlist attr) { pairlist a; Node *h, *n = malloc(sizeof(*n)); assert(n != NULL); n->tp = Element; n->name = down(newstring(elem)); for (a = attr; a; a = a->next) down(a->name); n->attribs = attr; n->sister = n->children = NULL; /* Unknown elements are just pushed where they are */ if (!is_known(n->name)) return push(t, n); if (is_root(n->name)) { while (t->tp != Root) t = pop(t); /* Make sure root is at root */ } else if (is_known(t->name) && build_path(&t, n->name)) { ; /* Added missing start tags */ } else { /* Check if there is a possible parent further up the tree */ for (h=t; h->tp!=Root && is_known(h->name) && !has_parent(n->name,h->name); h = h->parent) ; /* Close omitted end tags */ if (h->tp != Root) while (t != h) t = pop(t); /* If no valid parent, fabricate one */ if (t->tp == Root || (is_known(t->name) && !has_parent(n->name, t->name))) t = html_push(t, preferred_parent(n->name), NULL); } t = push(t, n); if (is_empty(n->name)) t = pop(t); if (is_cdata_elt(n->name)) set_cdata_element(n->name); /* Change scanner */ return t; } /* tree_pop -- close an open element, without checking the DTD */ EXPORT Tree tree_pop(Tree t, string elem) { assert(t != NULL); if (t->tp == Root) errexit("End tag without matching start tag\n", elem); assert(t->tp == Element); if (*elem == '\0') return pop(t); /* Empty end tag */ if (eq(t->name, elem)) return pop(t); errexit("End tag doesn't match start tag <%s>\n", elem, t->name); return NULL; /* Keep lint happy */ } /* html_pop -- close an open element */ EXPORT Tree html_pop(Tree t, string elem) { Tree h = t; assert(t != NULL); down(elem); if (*elem == '\0') { /* */ if (t->tp != Root) t = pop(t); } else { /* */ for (h = t; h->tp != Root && !eq(h->name, elem); h = h->parent) ; if (h->tp != Root) { /* Found open element */ while (t != h) t = pop(t); t = pop(t); } } return t; } /* append_comment -- add a comment to the tree */ EXPORT Tree append_comment(Tree t, string comment) { Node *n = malloc(sizeof(*n)); assert(n != NULL); n->tp = Comment; n->text = comment; n->sister = n->children = NULL; return append(t, n); } /* append_declaration -- add a declaration to the tree */ EXPORT Tree append_declaration(Tree t, string gi, string fpi, string url) { Node *n = malloc(sizeof(*n)); assert(n != NULL); n->tp = Declaration; n->name = down(gi); n->text = fpi; n->url = url; n->sister = n->children = NULL; return append(t, n); } /* append_procins -- append a processing instruction */ EXPORT Tree append_procins(Tree t, string procins) { Node *n = malloc(sizeof(*n)); assert(n != NULL); n->tp = Procins; n->text = procins; n->sister = n->children = NULL; return append(t, n); } /* tree_append_text -- append a text chunk, without checking the DTD */ EXPORT Tree tree_append_text(Tree t, string text) { Node *n; assert(text); new(n); n->tp = Text; n->text = text; n->sister = n->children = NULL; return append(t, n); } /* append_text -- append a text chunk to the document tree */ EXPORT Tree append_text(Tree t, string text) { Node *n; string new_parent; if (only_space(text) && (t->tp == Root || !is_mixed(t->name))) { /* Drop text, since it is non-significant whitespace */ return t; } if (t->tp == Root || !is_mixed(t->name)) { /* Need heuristics to make a valid tree */ new_parent = preferred_parent("%data"); /* Close omitted end tags until text or preferred parent fits */ while (t->tp != Root && !is_mixed(t->name) && !need_etag(t->name) && !has_parent(new_parent, t->name)) t = pop(t); /* Fabricate a parent if needed */ if (t->tp == Root || !is_mixed(t->name)) t = html_push(t, new_parent, NULL); } n = malloc(sizeof(*n)); assert(n != NULL); n->tp = Text; n->text = text; assert(n->text != NULL); n->sister = n->children = NULL; return append(t, n); } static void dump2(Tree n, FILE *f) { pairlist h; Tree l; switch (n->tp) { case Text: fprintf(f, "%s", n->text); break; case Comment: fprintf(f, "", n->text); break; case Declaration: fprintf(f, "name); if (n->text) fprintf(f, " PUBLIC \"%s\">", n->text); if (n->url) fprintf(f, " %s\"%s\">", n->text ? "" : "SYSTEM ", n->url); fprintf(f, ">"); break; case Procins: fprintf(f, "", n->text); break; case Element: fprintf(f, "<%s", n->name); for (h = n->attribs; h != NULL; h = h->next) { fprintf(f, " %s", h->name); if (h->value != NULL) fprintf(f, "=\"%s\"", h->value); } if (is_empty(n->name)) { assert(n->children == NULL); fprintf(f, " />"); } else { fprintf(f, ">"); for (l = n->children; l != NULL; l = l->sister) dump2(l, f); fprintf(f, "", n->name); } break; default: assert(!"Cannot happen"); } } /* dumptree -- write out the tree below t (t's children, not t itself)*/ EXPORT void dumptree(Tree t, FILE *f) { Tree h; for (h = t->children; h != NULL; h = h->sister) dump2(h, f); } html-xml-utils-7.7/selmatch.c0000645000175000017500000002071713244022534013163 00000000000000/* * Match a selector against a element in a document tree. * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 2017 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 11 Aug 2017 */ #include "config.h" #include #include #include #include #include #include #ifdef HAVE_STRING_H # include #elif HAVE_STRINGS_H # include #endif #include "types.e" #include "tree.e" #include "selector.e" #include "export.h" #include "heap.e" #include "errexit.e" static conststring language = ""; /* Initial language */ static bool case_insensitive = false; /* How to match elems/attrs */ bool matches_sel(const Tree t, const Selector s); /* init_language -- set the initial language for the document */ EXPORT void init_language(const conststring lang) { language = newstring(lang); } /* set_case_insensitive -- make all string comparisons case-insensitive */ EXPORT void set_case_insensitive(void) { case_insensitive = true; } /* get_language -- return the (inherited) human language of an element */ static conststring get_language(const Node *n) { conststring s; assert(n); if (n->tp == Root) return language; /* Language from -l option */ assert(n->tp == Element); if ((s = get_attrib(n, "xml:lang"))) return s; if ((s = get_attrib(n, "lang"))) return s; return get_language(n->parent); } /* same -- compare two names, case-(in)sensitively, depending */ EXPORT bool same(const string a, const string b) { return case_insensitive ? strcasecmp(a, b) == 0 : eq(a, b); } /* count_siblings - compute own index and total number of siblings of t */ static void count_siblings(const Node *n, int *index, /* Index of n among its siblings */ int *typeindex, /* Index among those of same type */ int *total, /* Total # of siblings, including n */ int *typetotal) /* Total # of siblings of same type */ { Node *h; for (*total = *typetotal = 0, h = n->parent->children; h; h = h->sister) if (h->tp == Element) { (*total)++; if (same(h->name, n->name)) (*typetotal)++; if (h == n) {*index = *total; *typeindex = *typetotal;} } } /* get_attr -- return the value of the named attribute, or NULL */ static string get_attr(const Node *n, const string name) { pairlist p; for (p = n->attribs; p && !same(p->name, name); p = p->next) ; return p ? p->value : NULL; } /* includes -- check for word in the space-separated words of line */ static bool includes(const string line, const string word) { int i = 0, n = strlen(word); /* What should happen if word is the empty string? */ /* To do: compare with contains() in class.c, keep the best */ while (line[i]) { if (case_insensitive) { if (!strncasecmp(line+i, word, n) && (!line[i+n] || isspace(line[i+n]))) return true; } else { if (!strncmp(line+i, word, n) && (!line[i+n] || isspace(line[i+n]))) return true; } do i++; while (line[i] && !isspace(line[i])); while (isspace(line[i])) i++; } return false; } /* starts_with -- check if line starts with prefix */ static bool starts_with(const string line, const string prefix) { return case_insensitive ? strncasecmp(line, prefix, strlen(prefix)) == 0 : strncmp(line, prefix, strlen(prefix)) == 0; } /* ends_with -- check if line ends with suffix */ static bool ends_with(const string line, const string suffix) { int n1 = strlen(line), n2 = strlen(suffix); return n1 >= n2 && eq(line + n1 - n2, suffix); } /* contains -- check if line contains s */ static bool contains(const string line, const string s) { return strstr(line, s) != NULL; } /* lang_match -- check if language specific is subset of general */ static bool lang_match(const conststring specific, const conststring general) { assert(specific); assert(general); size_t n = strlen(general); return !strncasecmp(specific, general, n) && (specific[n] == '-' || !specific[n]); } /* simple_match -- check if a node matches a simple selector */ static bool simple_match(const Tree n, const SimpleSelector *s) { int index = 0, tpindex = 0, total = 0, tptotal = 0; AttribCond *p; PseudoCond *q; string h; Node *c; /* Pseudo-elements can't match elements */ if (s->pseudoelts) return false; /* Match the type selector */ if (s->name && !same(s->name, n->name)) return false; /* Match the attribute selectors, including class and ID */ for (p = s->attribs; p; p = p->next) { if (!(h = get_attr(n, (p->op == HasClass) ? (string)"class" : (p->op == HasID) ? (string)"id" : p->name))) return false; switch (p->op) { case Exists: break; case Equals: case HasID: if (!eq(p->value, h)) return false; break; case Includes: case HasClass: if (!includes(h, p->value)) return false; break; case StartsWith: if (!starts_with(h, p->value)) return false; break; case EndsWith: if (!ends_with(h, p->value)) return false; break; case Contains: if (!contains(h, p->value)) return false; break; case LangMatch: if (!lang_match(h, p->value)) return false; break; default: assert(!"Cannot happen"); } } /* Match the pseudo-classes */ for (q = s->pseudos; q; q = q->next) { switch (q->type) { case RootSel: if (n->parent->tp != Root) return false; break; case NthChild: if (index == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); if (q->a == 0) return index == q->b; else return (index - q->b) % q->a == 0 && (index - q->b) / q->a >= 0; break; case NthLastChild: if (index == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); if (q->a == 0) return total - tpindex + 1 == q->b; else return (total - tpindex + 1 - q->b) % q->a == 0 && (total - tpindex + 1 - q->b) / q->a >= 0; break; case NthOfType: if (index == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); if (q->a == 0) return tpindex == q->b; else return (tpindex - q->b) % q->a == 0 && (tpindex - q->b) / q->a >= 0; break; case NthLastOfType: if (tpindex == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); if (q->a == 0) return tptotal - tpindex + 1 == q->b; else return (tptotal - tpindex + 1 - q->b) % q->a == 0 && (tptotal - tpindex + 1 - q->b) / q->a >= 0; break; case FirstChild: if (index == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); return index == 1; break; case LastChild: if (index == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); return index == total; break; case FirstOfType: if (tpindex == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); return tpindex == 1; break; case LastOfType: if (tpindex == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); return tpindex == tptotal; break; case OnlyChild: if (index == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); return total == 1; break; case OnlyOfType: if (tpindex == 0) count_siblings(n, &index, &tpindex, &total, &tptotal); return tptotal == 1; break; case Empty: for (c = n->children; c; c = c->sister) if (c->tp == Element || c->tp == Text) return false; return true; break; case Lang: if (!lang_match(get_language(n), q->s)) return false; break; case Not: if (matches_sel(n, q->sel)) return false; break; default: assert(!"Cannot happen"); } } return true; } /* matches_sel -- check if an element t matches the selector s */ EXPORT bool matches_sel(const Tree t, const Selector s) { Tree g, h; assert(s); if (!t || t->tp == Root) return false; assert(t->tp == Element); if (!simple_match(t, s)) return s->next && matches_sel(t, s->next); if (!s->context) return true; switch (s->combinator) { case Descendant: for (h = t->parent; h->tp != Root && !matches_sel(h, s->context); h = h->parent); return h->tp != Root; case Child: return matches_sel(t->parent, s->context); case Adjacent: for (g = NULL, h = t->parent->children; h != t; h = h->sister) if (h->tp == Element) g = h; return g && matches_sel(g, s->context); case Sibling: for (h = t->parent->children; h != t; h = h->sister) if (matches_sel(h, s->context)) return true; return false; default: assert(!"Cannot happen"); return false; } } html-xml-utils-7.7/connectsock.c0000644000175000017500000000775313244022534013700 00000000000000/* connectsock.c * * Part of HTML-XML-utils, see: * http://www.w3.org/Tools/HTML-XML-utils/ * * Copyright © 1994-2011 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 12 May 1998 **/ #include "config.h" #include #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_ARPA_INET_H # include #endif #include #include #include #include #include #include "export.h" EXPORT u_short portbase = 0; /* for non-root servers */ /* connectsock -- allocate & connect a socket using TCP or UDP */ EXPORT int connectsock(const char *host, const char *service, char *protocol) { /* host = name of host to which connection is desired */ /* service = service associated with the desired port */ /* protocol = name of protocol to use ("tcp" or "udp") */ struct addrinfo hints, *result, *rp; int t, s; /* Specify what type of connection we're looking for */ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_socktype = (strcmp(protocol, "udp") == 0) ? SOCK_DGRAM : SOCK_STREAM; hints.ai_flags = 0; hints.ai_protocol = 0; /* Any protocol */ /* Parse network address and service */ if (getaddrinfo(host, service, &hints, &result) != 0) return -1; /* result is a linked list of address structures. */ for (s = -1, rp = result; s == -1 && rp; rp = rp->ai_next) { if ((t = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) != -1) { if (connect(t, rp->ai_addr, rp->ai_addrlen) != -1) s = t; else close(t); } } freeaddrinfo(result); /* Free the memory */ return s; /* If -1 no address succeeded */ } /* connectTCP -- connect to a specified UDP service on a specified host */ EXPORT int connectTCP(const char *host, const char *service) { return connectsock(host, service, "tcp"); } /* connectUDP -- connect to a specified UDP service on a specified host */ EXPORT int connectUDP(char *host, char *service) { return connectsock(host, service, "udp"); } /* passivesock -- allocate & bind a server socket using TCP or UDP */ EXPORT int passivesock(char *service, char *protocol, int qlen) { /* service = service associated with the desired port */ /* protocol = name of protocol to use ("tcp" or "udp") */ /* qlen = maximum length of the server request queue */ struct addrinfo hints, *result, *rp; int t, s; /* Specify what type of connection we're looking for */ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_socktype = (strcmp(protocol, "udp") == 0) ? SOCK_DGRAM : SOCK_STREAM; hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ hints.ai_protocol = 0; /* Any protocol */ hints.ai_canonname = NULL; hints.ai_addr = NULL; hints.ai_next = NULL; /* Parse network address and service */ if (getaddrinfo(NULL, service, &hints, &result) != 0) return -1; /* result is a linked list of address structures. */ for (s = -1, rp = result; s == -1 && rp; rp = rp->ai_next) { if ((t = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) != -1) { if (bind(t, rp->ai_addr, rp->ai_addrlen) != -1) s = t; else close(t); } } freeaddrinfo(result); /* Free the memory */ if (s == -1) return -1; /* No address succeeded */ /* If we want a TCP connection, also call listen(2) */ if (hints.ai_socktype == SOCK_STREAM && listen(s, qlen) < 0) return -1; return s; } /* passiveTCP -- creat a passive socket for use in a TCP server */ EXPORT int passiveTCP(char *service, int qlen) { /* service = service associated with thte desired port */ /* qlen = maximum server request queue length */ return passivesock(service, "tcp", qlen); } /* passiveUDP -- creat a passive socket for use in a UDP server */ EXPORT int passiveUDP(char *service) { return passivesock(service, "udp", 0); } html-xml-utils-7.7/tfind.c0000644000175000017500000000247313244022534012465 00000000000000/* $NetBSD: tfind.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */ /* $FreeBSD: src/lib/libc/stdlib/tfind.c,v 1.1.2.1 2000/08/17 07:38:39 jhb Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like * the AT&T man page says. * * The node_t structure is for internal use only, lint doesn't grok it. * * Written by reading the System V Interface Definition, not the code. * * Totally public domain. */ #include #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: tfind.c,v 1.2 1999/09/16 11:45:37 lukem Exp $"); #endif /* LIBC_SCCS and not lint */ #include #define _SEARCH_PRIVATE #include #include "config.h" #ifdef HAVE_SEARCH_H # include #else # include "search-freebsd.h" #endif /* find a node, or return 0 */ void * tfind(vkey, vrootp, compar) const void *vkey; /* key to be found */ void **vrootp; /* address of the tree root */ int (*compar) __P((const void *, const void *)); { node_t **rootp = (node_t **)vrootp; if (rootp == NULL) return NULL; while (*rootp != NULL) { /* T1: */ int r; if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ return *rootp; /* key found */ rootp = (r < 0) ? &(*rootp)->llink : /* T3: follow left branch */ &(*rootp)->rlink; /* T4: follow right branch */ } return NULL; } html-xml-utils-7.7/hxcite-mkbib.10000644000175000017500000002014713244022534013643 00000000000000.de d \" begin display .sp .in +4 .nf .. .de e \" end display .in -4 .fi .sp .. .TH "HXCITE\-MKBIB" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxcite-mkbib \- expand references and create bibliography .SH SYNOPSIS .B hxcite\-mkbib .RB "[\| " \-b .IR base " \|]" .RB "[\| " \-p .IR pattern " \|]" .RB "[\| " \-s .IR separator " \|]" .IR bibfile " [\| " file " \|]" .SH DESCRIPTION .LP The .B hxcite\-mkbib commands copies .I file to standard output, looking for strings of the form "[[\fIlabel\fP]]" and for a template for a bibliography. The label may not include white space and the double pair of square brackets must enclose the label without any spaces in between. If .B hxcite\-mkbib finds the label in the .IR bibfile "," the string is replaced by the .IR pattern "." The pattern can include certain variables. If the label is not found in .IR bibfile "," it is left unchanged. .PP The default pattern replaces the string with a hyperlink, but if the .B \-p option is used, the replacement can be any pattern. The input doesn't even have to be HTML. .PP The .I file consists of three parts: .TP 10 .B preamble The preamble is the part up to the first occurrence of .BR %{ . The preamble is copied to the output once (with bracketed labels ("[[\fIlabel\fP]]") expanded). The character .B % is treated specially. To create a single % in the output, there must be two in the preamble (%%). All other occurrences of % followed by another letter are not copied, but are collected into a string called the "sort order." and used to sort the entries, as explained below. .TP .B template The template starts with .B %{L: and ends with a matching .BR %} . The text in between is copied as often as there are bibliographic entries in .I bibfile that correspond to bracketed labels in .IR file . Variables in the template are replaced by the corresponding field in the bibliographic entry: all occurrences of .BI % x will be replaced by the field .BI % x of the entry. Parts of the text may be enclosed in .BI %{ x : and .BR %} . This means that the text in between should only be output if the current entry has a field .IR x . Text that is enclosed in .BI %{! x : and .B %} will only be output if the entry does .B not have a field .IR x . Both kinds of conditional sections may also be nested. .TP .B postamble The text after the .B %} is copied unchanged to the output, after all bibliographic entries have been processed. .PP By default bibliographic entries are copied to the output in the order of the labels in .IR file , except that labels that occur more than once are only used once. If the preamble contains occurrences of .BI % x (where .I x is neither "%" nor "{") then these together determine the sort order. E.g., if the preamble contains %A%D then the entries will be sorted first on field A (author) and then on field D (date). .PP Here is an example of a file that creates a bibliography in HTML format: .d Bibliography \&... text with [[references]] here...
      %{L:
      %{A:A%}%{!A:%{E:E%}%{!E:%{Q:Q%}%{!Q:-%}%}%}
      %{B:"%T" in: %{E:%E (eds) %}%B.%{V: %V.%} %}%{J:"%T" in: %{E:%E (eds) %}%J.%{V: %V.%}%{N: %N.%}%{P: pp. %P.%} %}%{!B:%{!J:%T. %}%}%{I:%I. %}%{D:%D. %}%{C:%C. %}%{R:%R. %}%{S:%S. %}%{O:%O %}%{U:%U %}
      %}
      .e This template starts with four lines of preamble, including the sort string %A%D on line 3. The sort string itself will not be output, but the rest of the comment will. .PP From the line .B %{L: to the line .B %} is the template. E.g., the line that starts with .B
      Gosling, James; Joy, Bill; Steele, Guy
      The Java language specification. Addison-Wesley. 1998. http://java.sun.com/docs/books/jls/index.html
      .e .SH OPTIONS The following options are supported: .TP 10 .BI \-p " pattern" Specifies the pattern by which the string [[\fIlabel\fP]] is replaced. The pattern may include the variables .B %b (which will be replaced by the value of the .B \-b option) and .B %L (which will be replaced by the .IR label ")." The default pattern is .d [%L] .e .TP .BI \-b " base" Sets the value for the .B %b variable in the pattern. Typically this is set to a relative or absolute URL. By default this value is an empty string. .TP .BI \-s " separator" If there are multiple authors or editors in an entry, their names will be listed with a separator in between. By default the separator is "; " (i.e., a semicolon and a space). With this option the separator can be changed. .SH OPERANDS The following operands are supported: .TP 10 .I bibfile The name of a bibliographic database must be given. It must be a file in .BR refer (1) format and every entry must have at least a .B %L field, which is compared to the bracketed labels. (Entries without such a field will be ignored.) .TP .I file The name of the input file is optional. If absent, .BR hxmkbib (1) will read the template from stdin. .SH "DIAGNOSTICS" The following exit values are returned: .TP 10 .B 0 Successful completion. .TP .B > 0 An error occurred. Usually this is because a file could not be opened or because the %{ and %} pairs are not properly nested. Very rarely it may also be an out of memory error. Some of the possible error messages: .TP .I missing ':' in pattern .B hxmkbib found a %{ but the second or third letter after it was not a colon. .TP .I no '%{' in template file The template file is unusable, because it contains no template. .TP .I unbalanced %{..%} in pattern There are more %{ than %}. .SH "SEE ALSO" .BR asc2xml (1), .BR hxcite (1), .BR hxmkbib (1), .BR hxnormalize (1), .BR hxnum (1), .BR hxprune (1), .BR hxtoc (1), .BR hxunent (1), .BR xml2asc (1), .BR UTF-8 " (RFC 2279)" .SH BUGS Sorting is primitive: the program doesn't parse dates or names and simply sorts "Jan 2000" under the letter "J" and "Albert Camus" under the letter "A". For the moment the only work-around is to put names in the .I bibfile as "Camus, Albert". .PP The program simply lists all authors or editors. There is no way to generate an "et. al." after the third one. The work-around is to put the "et. al." in the .IR bibfile . Putting commas between the first authors and the word "and" before the final one is also not possible. .PP The program doesn't try to interpret names of authors or editors and they cannot be reformatted. It is impossible to write a name that is specified as "Sartre, Jean-Paul" in the .I bibfile as "J. Sartre" or as "Jean-Paul Sartre" in the output. .PP There is no way to suppress a period after a field if the field already ends with a period. E.g., the template "%{A:A.%}" may generate "A. Person Jr.." if the author is "A. Person Jr." The only option is to either not put periods in the .IR bibfile or not put periods in the template. .PP Entries in the .I bibfile can only be used if they have a .B %L (label) field. The program cannot find entries by searching for keywords, like .BR refer (1). .PP .B hxmkbib will replace any ampersands (&) and less-than (<) and greater-than (>) signs that occur in the .I bibfile by their XML entities & < > on the assumption that the template is HTML/XML. This may not be appropriate for other formats. .PP .B hxcite\-mkbib is a (bash) shell script that calls .BR hxcite (1) and .BR hxmkbib (1), and is therefore not portable to all platforms. html-xml-utils-7.7/url.c0000645000175000017500000003001313244022535012154 00000000000000/* * Routines and data structures to parse URLs * * Assumes the strings are encoded in UTF-8 * * Bug: URL_s_absolutize("foo/bar", "../") yields "" but should return "./" * * Copyright © 1994-2011 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 7 March 1999 */ #include "config.h" #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #include #include #include #include #if HAVE_LIBIDN2 # include #elif HAVE_LIBIDN # include #endif #include "export.h" #include "heap.e" #include "types.e" EXPORT typedef struct { string full; /* Full URL as a string */ string proto; /* Protocol */ string user; /* User name */ string password; /* User's password */ string machine; /* Domain name or IP number */ string port; /* Port number or service */ string path; /* Path part of URL */ string query; /* Query part of URL */ string fragment; /* Fragment ID part of URL */ } *URL; /* idn_to_ascii -- convert UTF-8 to Punycode, allocate on heap */ static string idn_to_ascii(const conststring s) { #if HAVE_LIBIDN2 string p; int rc; rc = idn2_lookup_u8((uint8_t*)s, (uint8_t**)&p, IDN2_NFC_INPUT); if (rc == IDN2_OK) return p; warnx("%s", idn2_strerror(rc)); return newstring(s); #elif HAVE_LIBIDN string p; Idna_rc rc; rc = idna_to_ascii_8z(s, &p, 0); if (rc == IDNA_SUCCESS) return p; warnx("%s", idna_strerror(rc)); return newstring(s); #else conststring p; for (p = s; *p; p++) if ((unsigned char)(*p) < 33 || (unsigned char)(*p) > 127) warnx("Internationalized domain names in URLs require libidn."); return newstring(s); #endif } /* utf8tohex -- convert UTF-8 to %HH hex encoding, allocate on heap */ static string utf8tohex(const conststring s) { static string hex = "0123456789ABCDEF"; string h; int i, j; if (!s) return NULL; newarray(h, 3 * strlen(s) + 1); /* Usually too much */ for (i = 0, j = 0; s[i]; i++) { if (s[i] & 0x80) { /* Not ASCII */ h[j++] = '%'; h[j++] = hex[((unsigned char)s[i])/16]; h[j++] = hex[((unsigned char)s[i])%16]; } else if (s[i] == ' ') { /* Also escape spaces */ h[j++] = '%'; h[j++] = '2'; h[j++] = '0'; } else h[j++] = s[i]; } h[j] = '\0'; return h; } /* URL_dispose -- free the memory used by a URL struct */ EXPORT void URL_dispose(URL url) { if (url) { dispose(url->full); dispose(url->proto); dispose(url->user); dispose(url->password); dispose(url->machine); dispose(url->port); dispose(url->path); dispose(url->query); dispose(url->fragment); dispose(url); } } /* URL_new -- create a new URL struct; return NULL if not a valid URL */ EXPORT URL URL_new(const conststring url) { #define PROTO "([^:/?#]+)" /* 2--------2 */ #define USER "([^/?#@:[]*)" /* 5----------5 */ #define PASSWORD "([^/?#@[]*)" /* 7---------7 */ #define HOST "(([^/?#:[]+)|\\[([0-9a-fA-F:]*)])?" /* 89---------9----A-------------A-8 */ #define PORT "([^/?#]*)" /* C-------C */ #define AUTH "(" USER "(:" PASSWORD ")?@)?" HOST "(:" PORT ")?" /* 4--5--5--6---7------7--6--4 8--8 B---C--C--B */ #define PATH "([^?#[]*)" /* D------D */ #define QUERY "([^#]*)" /* F---F */ #define FRAGM "(.*)" /* H--H */ #define PAT "(" PROTO ":)?(//" AUTH ")?" PATH "(\\?" QUERY ")?(#" FRAGM ")?" /* 1 2---2 1 3 3 D--D E F---F E G H---H G */ /* * 2 = proto, 5 = user, 7 = password, 9/A = machine, C = port, D = path, * F = query, H = fragment */ # define MAXSUB 18 static regex_t re; static int initialized = 0; regmatch_t pm[MAXSUB]; URL result; assert(url != NULL); /* Compile the regexp, only once */ if (! initialized) { assert(regcomp(&re, PAT, REG_EXTENDED) == 0); /* Could be memory... */ initialized = 1; } /* Match the URL against the pattern; return NULL if no match */ if (regexec(&re, url, MAXSUB, pm, 0) != 0) return NULL; /* Store the various parts */ new(result); result->full = newstring(url); result->proto = pm[2].rm_so == -1 ? NULL : down(newnstring(url, pm[2].rm_eo)); result->user = pm[5].rm_so == -1 ? NULL : newnstring(url + pm[5].rm_so, pm[5].rm_eo - pm[5].rm_so); result->password = pm[7].rm_so == -1 ? NULL : newnstring(url + pm[7].rm_so, pm[7].rm_eo - pm[7].rm_so); result->machine = pm[9].rm_so != -1 ? newnstring(url + pm[9].rm_so, pm[9].rm_eo - pm[9].rm_so) : pm[10].rm_so != -1 ? newnstring(url + pm[10].rm_so, pm[10].rm_eo - pm[10].rm_so) : NULL; result->port = pm[12].rm_so == -1 ? NULL : newnstring(url + pm[12].rm_so, pm[12].rm_eo - pm[12].rm_so); result->path = pm[13].rm_so == -1 ? NULL : newnstring(url + pm[13].rm_so, pm[13].rm_eo - pm[13].rm_so); result->query = pm[15].rm_so == -1 ? NULL : newnstring(url + pm[15].rm_so, pm[15].rm_eo - pm[15].rm_so); result->fragment = pm[17].rm_so == -1 ? NULL : newnstring(url + pm[17].rm_so, pm[17].rm_eo - pm[17].rm_so); return result; } /* merge -- merge a base path and a relative path */ static string merge(const URL base, const string path) { string s; int j; if (base->machine && (!base->path || !base->path[0])) { newarray(s, strlen(path) + 2); s[0] = '/'; strcpy(s + 1, path); } else if (!base->path) { s = newstring(path); } else { for (j = strlen(base->path); j > 0 && base->path[j-1] != '/'; j--); newarray(s, j + strlen(path) + 1); memmove(s, base->path, j); strcpy(s + j, path); } return s; } /* remove_dot_segments -- remove /./ and /foo/../ */ static void remove_dot_segments(string path) { int i = 0, len = strlen(path), j; while (len) { if (hasprefix(path + i, "/../")) { len -= 3; if (i == 0) { memmove(path + 1, path + 4, len); } else { for (j = i - 1; j > 0 && path[j-1] != '/'; j--) ; if (!hasprefix(path + j, "../")) { memmove(path + j, path + i + 4, len); i = j != 0 ? j - 1 : 0; } else { i += 3; } } } else if (eq(path + i, "/..")) { len = 0; if (i == 0) { path[1] = '\0'; i = 1; } else { for (j = i - 1; j > 0 && path[j-1] != '/'; j--) ; if (!hasprefix(path + j, "../")) { path[j] = '\0'; i = j; } else { i += 3; } } } else if (hasprefix(path + i, "/./")) { memmove(path + i, path + i + 2, len - 1); len -= 2; } else if (eq(path + i, "/.")) { path[i+1] = '\0'; len--; } else { i++; len--; } } } /* URL_absolutize -- make a relative URL absolute */ EXPORT URL URL_absolutize(const URL base, const URL url) { URL abs; new(abs); /* RFC 3986, section 5.2.2 */ if (url->proto) { abs->proto = newstring(url->proto); abs->user = newstring(url->user); abs->password = newstring(url->password); abs->machine = newstring(url->machine); abs->port = newstring(url->port); abs->path = newstring(url->path); remove_dot_segments(abs->path); abs->query = newstring(url->query); } else { if (url->machine) { abs->user = newstring(url->user); abs->password = newstring(url->password); abs->machine = newstring(url->machine); abs->port = newstring(url->port); abs->path = newstring(url->path); remove_dot_segments(abs->path); abs->query = newstring(url->query); } else { if (!url->path || !url->path[0]) { abs->path = newstring(base->path); if (url->query) { abs->query = newstring(url->query); } else { abs->query = newstring(base->query); } } else { if (url->path[0] == '/') { abs->path = newstring(url->path); remove_dot_segments(abs->path); } else { abs->path = merge(base, url->path); remove_dot_segments(abs->path); } abs->query = newstring(url->query); } abs->user = newstring(base->user); abs->password = newstring(base->password); abs->machine = newstring(base->machine); abs->port = newstring(base->port); } abs->proto = newstring(base->proto); } abs->fragment = newstring(url->fragment); newarray(abs->full, (abs->proto ? strlen(abs->proto) + 1 : 0) + (abs->user ? strlen(abs->user) + 1 : 0) + (abs->password ? strlen(abs->password) + 1 : 0) + (abs->machine ? strlen(abs->machine) + 4 : 0) + (abs->port ? strlen(abs->port) + 1 : 0) + (abs->path ? strlen(abs->path) : 0) + (abs->query ? strlen(abs->query) + 1 : 0) + (abs->fragment ? strlen(abs->fragment) + 1 : 0) + 1); sprintf(abs->full, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", abs->proto ? abs->proto : (string) "", abs->proto ? (string) ":" : (string) "", abs->machine ? (string) "//" : (string) "", abs->user ? abs->user : (string) "", abs->password ? (string) ":" : (string) "", abs->password ? abs->password : (string) "", abs->user ? (string) "@" : (string) "", abs->machine && strchr(abs->machine, ':') ? "[" : "", abs->machine ? abs->machine : (string) "", abs->machine && strchr(abs->machine, ':') ? "]" : "", abs->port ? (string) ":" : (string) "", abs->port ? abs->port : (string) "", abs->path ? abs->path : (string) "", abs->query ? "?" : (string) "", abs->query ? abs->query : (string) "", abs->fragment ? (string) "#" : (string) "", abs->fragment ? abs->fragment : (string) ""); /* Instead of strchr() above, we could have an IPv6 flag. Necessary? */ return abs; } /* URL_s_absolutize -- make a relative URL absolute */ EXPORT string URL_s_absolutize(const conststring base, const conststring url) { URL url1 = URL_new(url), base1 = URL_new(base); URL abs = URL_absolutize(base1, url1); string result = newstring(abs->full); URL_dispose(abs); URL_dispose(url1); URL_dispose(base1); return result; } /* URL_to_ascii -- use punycode and %-escaping to turn an IRI into a URI */ EXPORT URL URL_to_ascii(const URL iri) { URL url; new(url); url->proto = newstring(iri->proto); url->user = newstring(iri->user); url->password = newstring(iri->password); url->machine = idn_to_ascii(iri->machine); url->port = newstring(iri->port); url->path = utf8tohex(iri->path); url->query = utf8tohex(iri->query); url->fragment = utf8tohex(iri->fragment); newarray(url->full, (url->proto ? strlen(url->proto) + 1 : 0) + (url->user ? strlen(url->user) + 1 : 0) + (url->password ? strlen(url->password) + 1 : 0) + (url->machine ? strlen(url->machine) + 4 : 0) + (url->port ? strlen(url->port) + 1 : 0) + (url->path ? strlen(url->path) : 0) + (url->query ? strlen(url->query) + 1 : 0) + (url->fragment ? strlen(url->fragment) + 1 : 0) + 1); sprintf(url->full, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", url->proto ? url->proto : (string) "", url->proto ? (string) ":" : (string) "", url->machine ? (string) "//" : (string) "", url->user ? url->user : (string) "", url->password ? (string) ":" : (string) "", url->password ? url->password : (string) "", url->user ? (string) "@" : (string) "", url->machine && strchr(url->machine, ':') ? "[" : "", url->machine ? url->machine : (string) "", url->machine && strchr(url->machine, ':') ? "]" : "", url->port ? (string) ":" : (string) "", url->port ? url->port : (string) "", url->path ? url->path : (string) "", url->query ? "?" : (string) "", url->query ? url->query : (string) "", url->fragment ? (string) "#" : (string) "", url->fragment ? url->fragment : (string) ""); /* Instead of strchr() above, we could have an IPv6 flag. Necessary? */ return url; } /* URL_s_to_ascii -- use punycode and %-escaping to turn an IRI into a URI */ EXPORT string URL_s_to_ascii(const conststring iri) { URL x = URL_new(iri); URL y = URL_to_ascii(x); string result = newstring(y->full); URL_dispose(y); URL_dispose(x); return result; } html-xml-utils-7.7/hxref.c0000645000175000017500000003454713244022534012505 00000000000000/* * Program to (semi-)automatically link instances of terms and phrases * in an HTML file to their definitions. * * The program collects all elements, and stores either their * title attribute, or if there is none, their content (without * mark-up). Then it looks for occurrences of the same text and makes * a link from the occurrence to the corresponding element. The * occurrences that are checked are the contents of all inline * elements, such as and . HTML unfortunately forbids * nested links, so the program doesn't look for occurrences inside an * . * * The program can store the elements (the terms they define, * the file they occur in and their ID) in a file, so that * cross-references among several files are possible, by running the * program on each of the files. It may be necessary to run the * program twice on a series of files, to create all the references. * * Copyright © 2000-2012 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 4 August 2000 * Version: $Id: hxref.c,v 1.14 2017/11/24 09:50:25 bbos Exp $ **/ #include "config.h" #include #include #include #include #include #ifdef HAVE_ERRNO_H # include #endif #ifdef HAVE_SEARCH_H # include #else # include "hash.e" #endif #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #include "heap.e" #include "types.e" #include "html.e" #include "scan.e" #include "tree.e" #include "dict.e" #include "openurl.e" #include "genid.e" #include "errexit.e" /* Warning: arbitrary limit! */ #define MAXLINE 4096 /* Max. len. of url + term */ #define HASHSIZE 4096 /* Size of hash table */ static Tree tree; static string base = NULL, progname; static bool do_xml = false; static bool use_language = false; static char *extras = "-_@()"; /* Significant characters */ /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) { tree = create(); return NULL; } /* end -- called after the last event is reported */ static void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, string commenttext) { tree = append_comment(tree, commenttext); } /* handle_text -- called after a tex chunk is parsed */ static void handle_text(void *clientdata, string text) { tree = append_text(tree, text); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *clientdata, string gi, string fpi, string url) { tree = append_declaration(tree, gi, fpi, url); } /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *clientdata, string pi_text) { tree = append_procins(tree, pi_text); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, string name, pairlist attribs) { conststring id; tree = html_push(tree, name, attribs); /* If it has an ID, store it (so we don't accidentally generate it) */ if ((id = pairlist_get(attribs, "id"))) storeID(id); } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, string name, pairlist attribs) { handle_starttag(clientdata, name, attribs); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, string name) { tree = html_pop(tree, name); } /* load_definitions -- read already defined terms from file */ static void load_definitions(FILE *f) { char buf[MAXLINE]; ENTRY entry; string h; while (fgets(buf, sizeof(buf), f)) { /* Format is PHRASE\tURL\n */ h = strchr(buf, '\t'); if (! h) errexit("%s: index file not in correct format\n", progname); chomp(h); entry.key = newnstring(buf, h - buf); entry.data = newstring(h + 1); hsearch(entry, ENTER); } } /* get_contents -- collect all text content of an elt into a single string */ static string get_contents(Tree t) { Node *h; string contents = NULL, k; assert(t->tp == Element); for (h = t->children; h; h = h->sister) { if (h->tp == Text) { strapp(&contents, h->text, NULL); } else if (h->tp == Element && !eq(h->name, "a") && !eq(h->name, "dfn") && (k = get_contents(h))) { strapp(&contents, k, NULL); dispose(k); } } return contents; } /* normalize -- collapse whitespace, trim, lowercase (modifies s) */ static string normalize(string s) { int i = 0, j; if (!s) return newstring(""); for (j = 0; isspace(s[j]); j++) ; /* Skip initial whitespace */ for (; s[j]; j++) if (isupper(s[j])) s[i++] = tolower(s[j]); /* Upper -> lowercase */ else if (isalnum(s[j])) s[i++] = s[j]; /* Keep these */ else if (strchr(extras, s[j])) s[i++] = s[j]; /* Keep these, too */ else if (! isspace(s[j])) ; /* Skip rest, except spaces */ else if (s[i-1] != ' ') s[i++] = ' '; /* Collapse whitespace */ for (; i > 0 && s[i-1] == ' '; i--) ; /* Remove trailing spaces */ s[i] = '\0'; return s; } /* search -- search a matching string in the hash table */ static ENTRY* search(string key, const conststring language) { ENTRY entry, *e; int n; string t; /* Assumes key has already passed normalize() */ /* First try the key as it is */ entry.key = key; if ((e = hsearch(entry, FIND))) return e; /* Should we try language-specific modifications to the key? */ if (!language || !use_language) return NULL; if (eq(language, "en") || hasprefix(language, "en-")) { /* English */ /* Remove plural s */ if ((n = strlen(key)) > 1 && key[n-1] == 's' && islower(key[n-2])) { t = newnstring(key, n - 1); entry.key = t; e = hsearch(entry, FIND); dispose(t); if (e) return e; } /* Remove plural es */ if (n > 2 && key[n-1] == 's' && key[n-2] == 'e' && islower(key[n-3])) { t = newnstring(key, n - 2); entry.key = t; e = hsearch(entry, FIND); dispose(t); if (e) return e; } /* Replace plural ies by singular y */ if (n > 3 && hasaffix(key, "ies") && islower(key[n-4])) { t = newnstring(key, n - 3); strapp(&t, "y", NULL); entry.key = t; e = hsearch(entry, FIND); dispose(t); if (e) return e; } } return NULL; } /* collect_terms -- walk the document tree looking for elements */ static void collect_terms(Tree tree, FILE *db) { conststring id, title; string url = NULL, s; ENTRY entry, *e; int i, n; Node *h; switch (tree->tp) { case Text: case Comment: case Declaration: case Procins: break; case Root: for (h = tree->children; h; h = h->sister) collect_terms(h, db); break; case Element: if (! eq(tree->name, "dfn")) { for (h = tree->children; h; h = h->sister) collect_terms(h, db); } else { if (! (id = get_attrib(tree, "id"))) { /* Make sure there's an ID */ id = gen_id(tree); set_attrib(tree, "id", id); } if ((title = get_attrib(tree, "title"))) /* Use title if it exists */ s = newstring(title); /* Don't normalize yet */ else /* otherwise grab contents */ s = normalize(get_contents(tree)); /* Normalize, also removes "|" */ entry.data = strapp(&url, base ? base : (string)"", "#", id, NULL); for (i = 0; s[i];) { /* Loop over |-separated terms */ n = strcspn(s + i, "|"); entry.key = normalize(newnstring(s + i, n)); /* Add to hash table and to db file, if not already there */ if (! (e = hsearch(entry, FIND)) || ! eq((string)e->data, (string)entry.data)) { hsearch(entry, ENTER); if (db) fprintf(db, "%s\t%s\n", entry.key, (char*)entry.data); } i += n; if (s[i]) i++; /* Skip "|" */ } } break; default: assert(!"Cannot happen"); } } /* find_instances -- walk tree, make instances of defined terms into links */ static void find_instances(Tree tree, const conststring language) { ENTRY *e; conststring title, lang; string key; if (!tree) return; switch (tree->tp) { case Text: case Comment: case Declaration: case Procins: find_instances(tree->sister, language); break; case Root: find_instances(tree->children, language); /* Recurse over children */ find_instances(tree->sister, language); /* Recurse over siblings */ break; case Element: if (!(lang = get_attrib(tree, "lang")) && !(lang = get_attrib(tree, "xml:lang"))) lang = language; if (eq(tree->name, "a") || eq(tree->name, "dfn")) ; /* Don't descend into these */ else if (eq(tree->name, "abbr") || eq(tree->name, "acronym") || eq(tree->name, "b") || eq(tree->name, "bdo") || eq(tree->name, "big") /*|| eq(tree->name, "cite")*/ || eq(tree->name, "code") || eq(tree->name, "del") /*|| eq(tree->name, "dt")*/ || eq(tree->name, "em") || eq(tree->name, "i") || eq(tree->name, "ins") || eq(tree->name, "kbd") || eq(tree->name, "label") || eq(tree->name, "legend") || eq(tree->name, "q") || eq(tree->name, "samp") || eq(tree->name, "small") || eq(tree->name, "span") || eq(tree->name, "strong") || eq(tree->name, "sub") || eq(tree->name, "sup") || eq(tree->name, "tt") || eq(tree->name, "var")) { if ((title = get_attrib(tree, "title"))) /* Use title if it exists */ key = newstring(title); else /* Get flattened contents */ key = get_contents(tree); if (!(e = search(normalize(key), lang))) { /* If not an instance */ find_instances(tree->children, lang); /* Recurse over children */ } else if (eq(tree->name, "span")) { /* Found an instance */ rename_elt(tree, "a"); /* Turn the span into an a */ set_attrib(tree, "href", e->data); } else { tree = wrap_elt(tree, "a", NULL); /* Wrap element in an */ set_attrib(tree, "href", e->data); } dispose(key); } else { /* Not an inline element */ find_instances(tree->children, lang); /* Recurse over children */ } find_instances(tree->sister, language); /* Recurse over siblings */ break; default: assert(!"Cannot happen"); } } /* write_doc -- write the tree to a file */ static void write_doc(Tree n, bool do_xml, FILE *f) { pairlist h; Tree l; switch (n->tp) { case Root: for (l = n->children; l; l = l->sister) write_doc(l, do_xml, f); break; case Text: fprintf(f, "%s", n->text); break; case Comment: fprintf(f, "", n->text); break; case Declaration: fprintf(f, "name); if (n->text) fprintf(f, " PUBLIC \"%s\"", n->text); if (n->url) fprintf(f, " %s\"%s\"", n->text ? "" : "SYSTEM ", n->url); fprintf(f, ">"); break; case Procins: fprintf(f, "", n->text); break; case Element: fprintf(f, "<%s", n->name); for (h = n->attribs; h != NULL; h = h->next) { fprintf(f, " %s", h->name); if (h->value != NULL) fprintf(f, "=\"%s\"", h->value); else if (do_xml) fprintf(f, "=\"%s\"", h->name); } if (is_empty(n->name)) { assert(n->children == NULL); fprintf(f, do_xml ? " />" : ">"); } else { fprintf(f, ">"); for (l = n->children; l; l = l->sister) write_doc(l, do_xml, f); fprintf(f, "", n->name); } break; default: assert(!"Cannot happen"); } } /* usage -- print usage message and exit */ static void usage(void) { fprintf(stderr, "Usage: %s [-v] [-b base] [-i index] [-x] [-l] [--] [input [output]]\n", progname); exit(1); } /* main -- main body of xref */ int main(int argc, char *argv[]) { int i, status = 200; FILE *outfile = NULL, *db = NULL; /* Bind the parser callback routines to our handlers */ set_error_handler(handle_error); set_start_handler(start); set_end_handler(end); set_comment_handler(handle_comment); set_text_handler(handle_text); set_decl_handler(handle_decl); set_pi_handler(handle_pi); set_starttag_handler(handle_starttag); set_emptytag_handler(handle_emptytag); set_endtag_handler(handle_endtag); /* Parse command line */ progname = argv[0]; yyin = NULL; for (i = 1; i < argc && argv[i][0] == '-' && !eq(argv[i], "--"); i++) { switch (argv[i][1]) { case 'b': if (!argv[i][2] && i + 1 == argc) usage(); /* Missing argument */ if (base) usage(); /* Option was already set */ base = argv[i][2] ? argv[i] + 2 : argv[++i]; break; case 'x': if (do_xml) usage(); /* Option was already set */ do_xml = true; break; case 'i': if (!argv[i][2] && i + 1 == argc) usage(); /* Missing argument */ if (db) usage(); /* Index was already set */ db = fopen(argv[i][2] ? argv[i] + 2 : argv[++i], "a+"); if (! db) errexit("%s: %s\n", argv[i], strerror(errno)); break; case 'l': if (use_language) usage(); /* Option was already set */ use_language = true; break; case 'v': printf("Version: %s %s\n", PACKAGE, VERSION); return 0; case '\0': if (!yyin) yyin = stdin; else if (!outfile) outfile = stdout; else usage(); /* Was already set */ break; default: usage(); /* Unknown option */ } } if (i < argc && eq(argv[i], "--")) i++; if (i < argc) { if (yyin) usage(); /* Input was already set */ if (eq(argv[i], "-")) yyin = stdin; else yyin = fopenurl(argv[i], "r", &status); if (! yyin) errexit("%s: %s\n", argv[i], strerror(errno)); if (status != 200) errexit("%s : %s\n", argv[i], http_strerror(status)); } if (++i < argc) { if (outfile) usage(); /* Output was already set */ if (eq(argv[i], "-")) outfile = stdout; else outfile = fopen(argv[i], "w"); if (! outfile) perror(argv[i]); } if (++i < argc) usage(); /* Too many args */ if (! yyin) yyin = stdin; if (! outfile) outfile = stdout; if (! hcreate(HASHSIZE)) errexit("%s: cannot create hash table (out of memory?)\n", argv[0]); if (db) { if (fseek(db, 0L, SEEK_SET) == -1) errexit("%s: %s\n", progname, strerror(errno)); load_definitions(db); } if (yyparse() != 0) exit(3); tree = get_root(tree); collect_terms(tree, db); find_instances(tree, NULL); if (db) fclose(db); write_doc(tree, do_xml, outfile); return 0; } html-xml-utils-7.7/hxunpipe.c0000645000175000017500000001342413244022534013220 00000000000000/* * unpipe - takes output of pipe and convert to HTML/XML form * * Copyright © 1994-2000 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 23 May 1999 * Version: $Id: hxunpipe.c,v 1.11 2017/11/24 09:50:25 bbos Exp $ */ #include "config.h" #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #include #ifdef HAVE_STRING_H # include #elif HAVE_STRINGS_H # include #endif #include "export.h" #include "types.e" #include "heap.e" #include "errexit.e" #include "dict.e" #include "openurl.e" static int nrattrs = 0; static char **attrs = NULL; static bool escape = false; /* put_text -- replace newlines and print text */ static void put_text(FILE *in) { int c, c1, c2; while ((c = getc(in)) != EOF && c != '\n') if (c != '\\') { if (!escape) putchar(c); else if (c == '<') printf("<"); else if (c == '>') printf(">"); else if (c == '"') printf("""); else if (c == '&') printf("&"); else if (c == '\'') printf("'"); else putchar(c); } else if ((c = getc(in)) == EOF) return; /* Error */ else if (c == '\n') return; /* Error */ else if (c == 'n') putchar('\n'); else if (c == 'r') putchar('\r'); else if (c == 't') putchar('\t'); else if (c == '#') printf("&#"); else if (c < '0' || '7' < c) putchar(c); else if ((c1 = getc(in)) < '0' || '7' < c1) printf("%c%c", c, c1); else if ((c2 = getc(in)) < '0' || '7' < c2) printf("%c%c%c", c, c1, c2); else printf("&#%d;", 64 * (c - '0') + 8 * (c1 - '0') + (c2 - '0')); } /* store_attr -- store attributes temporarily */ static void store_attr(FILE *in) { # define INC 1014 int c, n = 0; renewarray(attrs, nrattrs + 1); attrs[nrattrs] = NULL; renewarray(attrs[nrattrs], INC); while ((c = getc(in)) != EOF && c != '\n') { attrs[nrattrs][n++] = c; if (n % INC == 0) {renewarray(attrs[nrattrs], INC * (n/INC + 1));} } attrs[nrattrs][n] = '\0'; nrattrs++; } /* put_attr -- write out attributes */ static void put_attr(void) { int i, j; for (j = 0; j < nrattrs; j++) { for (i = 0; attrs[j][i] && attrs[j][i] != ' '; i++); if (attrs[j][i] != ' ') errexit("Incorrect A (attribute) line\n"); if (! eq(attrs[j] + i + 1, "IMPLIED")) { putchar(' '); for (i = 0; attrs[j][i] && attrs[j][i] != ' '; i++) putchar(attrs[j][i]); if (attrs[j][i] != ' ') errexit("Incorrect A (attribute) line\n"); putchar('='); for (i++; attrs[j][i] && attrs[j][i] != ' '; i++) ; /* skip type */ if (attrs[j][i] != ' ') errexit("Incorrect A (attribute) line\n"); putchar('"'); for (i++; attrs[j][i]; i++) { if (attrs[j][i] != '\\') putchar(attrs[j][i]); else if (attrs[j][i+1]) { i++; if (attrs[j][i] == 'n') putchar('\n'); else if (attrs[j][i] == 'r') putchar('\r'); else if (attrs[j][i] == 't') putchar('\t'); else if (attrs[j][i] == '#') printf("&#"); else if ('0' <= attrs[j][i] && attrs[j][i] <= '7' && '0' <= attrs[j][i+1] && attrs[j][i+1] <= '7' && '0' <= attrs[j][i+2] && attrs[j][i+2] <= '7') { printf("&#%d;", 64 * (attrs[j][i] - '0') + 8 * (attrs[j][i+1] - '0') + (attrs[j][i+2] - '0')); i += 2; } else putchar(attrs[j][i]); } } putchar('"'); } dispose(attrs[j]); } nrattrs = 0; } /* put_decl -- write a DOCTYPE declaration */ static void put_decl(FILE *in) { int c; bool hasfpi = false; printf("'); } /* usage -- print usage message and exit */ static void usage(string prog) { fprintf(stderr, "Version %s\nUsage: %s [file_or_url]\n", VERSION, prog); exit(1); } int main(int argc, char *argv[]) { int c, status = 200; FILE *in = NULL; bool empty = false; while ((c = getopt(argc, argv, "b")) != -1) switch (c) { case 'b': escape = true; break; default: usage(argv[0]); } if (optind == argc) in = stdin; else if (optind == argc - 1) in = fopenurl(argv[optind], "r", &status); else usage(argv[0]); if (in == NULL) { perror(argv[optind]); exit(2); } if (status != 200) errexit("%s : %s\n", argv[optind], http_strerror(status)); while ((c = getc(in)) != EOF) { switch (c) { case '-': put_text(in); break; case '?': printf(""); break; case '_': case '*': printf(""); break; case 'L': break; case 'A': store_attr(in); break; case '(': putchar('<'); put_text(in); put_attr(); putchar('>'); break; case ')': if (!empty) {printf("');} else empty = false; break; case '|': putchar('<'); put_text(in); put_attr(); printf(" />"); break; case '!': put_decl(in); break; case 'e': empty = true; break; /* Generated by onsgmls */ case 'i': case 'o': break; /* Generated by onsgmls */ case 'C': break; } } if (! feof(in)) { perror(argv[0]); exit(1); } fclose(in); return 0; } html-xml-utils-7.7/TODO0000644000175000017500000000131413244022534011676 00000000000000Proprietary extensions: Microsoft Internet Explorer accepts a proprietary extension to HTML that looks like malformed mark-up: "" or "" (where xxx is text that doesn't contain "]"). The parser currently reports (correctly) a syntax error. Should there be a mode in which this is accepted? If so, as what? as TEXT? Let hxindex recognize DATA-INDEX attributes in addition to TITLE? (These new DATA- attributes are suggested by HTML5.) Let hxindex look at locale for sorting order? Let hxnormalize sort the into a canonical order? (title, meta sorted by name and http-equiv, link sorted by rel, style, script) Add ruby, rb, rp, rt and rtc to dtd.hash. Add MathML elements to dtd.hash.html-xml-utils-7.7/hxuncdata.10000644000175000017500000000141013244022534013244 00000000000000.TH "HXUNCDATA" "1" "10 Jul 2011" "7.x" "HTML-XML-utils" .SH NAME hxuncdata \- replace CDATA sections by character entities .SH SYNOPSIS .B hxuncdata .RI "[\| " xml-file " \|]" .SH DESCRIPTION .B hxuncdata replaces CDATA sections by character entities. The input is scanned for occurrences of "". Those strings are removed and all occurrences of "&", "<" and ">" in between them will be replaced by "&", "<" and ">" respectively. .PP The input must be 1 byte per character. If it is not, convert it to UTF-8 first. .SH OPTIONS The following options are supported: .TP .BR \-? ", " \-\-help Show command usage. .SH OPERANDS The following operand is supported: .TP .I xml-file The file to work on. .SH SEE ALSO .BR UTF-8 " (RFC 2279)" html-xml-utils-7.7/hxindex.c0000645000175000017500000006541313244062740013037 00000000000000/* * Insert an index between "" and "", * or replacing the comment "" * * The index links to elements with ID attributes as well as with * empty elements. * * Any tags with a class of "bctarget" are not copied, but * regenerated. They are assumed to be backwards-compatible versions * of ID attributes on their parent elements. But if the option -t or * -x are given, those elements are removed. * * There's a limit of 100000 index terms (10^(MAXIDLEN-1)). * * Index terms are elements with a class of "index", "index-inst" or * "index-def", as well as all elements. The contents of the * element is the index term, unless the element has a title * attribute. The title attribute can contain "|" and "!!": * * "term" * "term1|term2|term3|..." * "term!!subterm!!subsubterm!!..." * "term1!!subterm1|term2!!subterm2|..." * etc. * * For backward compatibility with an earlier Perl program, "::" is * accepted as an alternative for "!!", but it is better not to use * both separators in the same project, since the sorting maybe * adversely affected. * * Class "index-def" results in a bold entry in the index, "index" in * a normal one. "index-inst" is an alias for "index", provided for * backward compatibility. * * To do: an option to split the index at each new first letter. * * Copyright © 1994-2005 World Wide Web Consortium * See http://www.w3.org/Consortium/Legal/copyright-software * * Author: Bert Bos * Created: 11 Apr 2000 * Version: $Id: hxindex.c,v 1.24 2018/02/23 19:05:04 bbos Exp $ * **/ #include "config.h" #include #include #include #include #include #include #include #include #include #include #if STDC_HEADERS # include #else # ifndef HAVE_STRCHR # define strchr index # define strrchr rindex # endif # ifndef HAVE_STRSTR # include "strstr.e" # endif #endif #ifdef HAVE_ERRNO_H # include #else extern int errno; char *strerror(int errnum); int strerror_r(int errnum, char *buf, size_t n); #endif #ifdef HAVE_SEARCH_H # include #else # include "search-freebsd.h" #endif #include "export.h" #include "types.e" #include "heap.e" #include "tree.e" #include "html.e" #include "scan.e" #include "dict.e" #include "openurl.e" #include "genid.e" #include "class.e" #undef USE_DATA_ATTRIBUTE /* Data attributes are a proposal in HTML5 */ #define BEGIN_INDEX "begin-index" /* */ #define END_INDEX "end-index" /* */ #define INDEX "index" /* */ #define INDEX_INST "index-inst" /* class="index-inst" */ #define INDEX_DEF "index-def" /* class="index-def" */ #define TARGET "bctarget" /* CLASS="...bctarget..." */ #define MAXSUBS 20 /* Max. depth of subterms */ #define SECNO "secno" /* Class of elements that define section # */ #define NO_NUM "no-num" /* Class of elements without a section # */ typedef struct _indexterm { string url; int importance; /* 1 (low) or 2 (high) */ string secno; /* For option -n */ string sectitle; /* For option -N */ string doctitle; string *terms; /* Array of subterms */ wchar_t **sortkeys; /* Array of normalized subterms */ int nrkeys; /* Length of term and sortkeys arrays */ } *Indexterm; static Tree tree; static bool xml = false; /* Use convention */ static string base = NULL; /* (Rel.) URL of output file */ static string indexdb = NULL; /* Persistent store of terms */ static string* userclassnames = NULL; /* Persistent store of class names */ static FILE *globalfile; /* Must be global for twalk */ static Indexterm globalprevious; /* Must be global for twalk */ static string globalurlprevious;/* Must be global for twalk */ static bool bctarget = true; /* Add after IDs */ static bool use_secno = false; /* Anchor text is "#" instead of section # */ static bool use_sectitle = false; /* Anchor text is section title, not # */ static bool final = false; /* Leave used attributes in document */ static bool trim_punct = true; /* Remove trailing punctuation from terms */ static string section_name = NULL; /* Term meaning "section %s" */ static string unknown_name = NULL; /* Term meaning "without number" */ static string* exclude_elts = NULL; /* Don't index these elements */ static string* only_elts = NULL; /* Only index these elements */ /* handle_error -- called when a parse error occurred */ static void handle_error(void *clientdata, const string s, int lineno) { (void) fprintf(stderr, "%d: %s\n", lineno, s); } /* start -- called before the first event is reported */ static void* start(void) { tree = create(); return NULL; } /* end -- called after the last event is reported */ static void end(void *clientdata) { /* skip */ } /* handle_comment -- called after a comment is parsed */ static void handle_comment(void *clientdata, string commenttext) { tree = append_comment(tree, commenttext); } /* handle_text -- called after a tex chunk is parsed */ static void handle_text(void *clientdata, string text) { tree = append_text(tree, text); } /* handle_declaration -- called after a declaration is parsed */ static void handle_decl(void *clientdata, string gi, string fpi, string url) { tree = append_declaration(tree, gi, fpi, url); } /* handle_proc_instr -- called after a PI is parsed */ static void handle_pi(void *clientdata, string pi_text) { tree = append_procins(tree, pi_text); } /* handle_starttag -- called after a start tag is parsed */ static void handle_starttag(void *clientdata, string name, pairlist attribs) { conststring id; tree = html_push(tree, name, attribs); /* If it has an ID, store it (so we don't accidentally generate it) */ if ((id = pairlist_get(attribs, "id"))) storeID(id); } /* handle_emptytag -- called after an empty tag is parsed */ static void handle_emptytag(void *clientdata, string name, pairlist attribs) { conststring id; tree = html_push(tree, name, attribs); /* If it has an ID, store it (so we don't accidentally generate it) */ if ((id = pairlist_get(attribs, "id"))) storeID(id); } /* handle_endtag -- called after an endtag is parsed (name may be "") */ static void handle_endtag(void *clientdata, string name) { tree = html_pop(tree, name); } /* trim -- remove leading and trailing white space, collapse white space */ static void trim(string s) { string t; int i, j; if (!s) return; t = newstring(s); for (i = 0; isspace(t[i]); i++); /* Skip leading white space */ for (j = 0; t[i]; i++) if (!isspace(t[i])) s[j++] = t[i]; else if (!isspace(t[i-1])) s[j++] = ' '; if (j == 0) s[j] = '\0'; else if (isspace(s[j-1])) s[j-1] = '\0'; else s[j] = '\0'; dispose(t); } /* parse_subterms -- parse s to create terms & sortkeys array in an Indexterm */ static void parse_subterms(const Indexterm term, const conststring s) { enum {TEXT, TAG, DQUOTE, SQUOTE} state; string h, k, p, q; iconv_t cd; size_t len, len2; int i; /* Create the terms array and count the number of subterms */ h = newstring(s); trim(h); term->nrkeys = 1; newarray(term->terms, 1); term->terms[0] = h; while ((k = strstr(h, "!!")) || (k = strstr(h, "::"))) { h = k + 2; *k = '\0'; renewarray(term->terms, term->nrkeys + 1); trim(h); /* Remove leading & trailing space */ term->terms[term->nrkeys] = h; /* All terms point into h */ term->nrkeys++; } /* Create the sortkeys array by normalizing each term */ newarray(term->sortkeys, term->nrkeys); for (i = 0; i < term->nrkeys; i++) { /* First remove mark-up and expand the standard XML entities */ h = newstring(term->terms[i]); for (state = TEXT, p = q = h; *p; p++) { switch (state) { case TEXT: if (*p == '<') state = TAG; else if (hasprefix(p, "<")) {*(q++) = '<'; p += 3;} else if (hasprefix(p, "<")) {*(q++) = '<'; p += 4;} else if (hasprefix(p, "<")) {*(q++) = '<'; p += 5;} else if (hasprefix(p, "<")) {*(q++) = '<'; p += 5;} else if (hasprefix(p, ">")) {*(q++) = '>'; p += 3;} else if (hasprefix(p, ">")) {*(q++) = '>'; p += 4;} else if (hasprefix(p, ">")) {*(q++) = '>'; p += 5;} else if (hasprefix(p, ">")) {*(q++) = '>'; p += 5;} else if (hasprefix(p, """)) {*(q++) = '"'; p += 5;} else if (hasprefix(p, """)) {*(q++) = '"'; p += 4;} else if (hasprefix(p, """)) {*(q++) = '"'; p += 5;} else if (hasprefix(p, "&")) {*(q++) = '&'; p += 4;} else if (hasprefix(p, "&")) {*(q++) = '&'; p += 4;} else if (hasprefix(p, "&")) {*(q++) = '&'; p += 5;} else *(q++) = tolower(*p); break; case TAG: if (*p == '>') state = TEXT; else if (*p == '"') state = DQUOTE; else if (*p == '\'') state = SQUOTE; break; case DQUOTE: if (*p == '"') state = TAG; break; case SQUOTE: if (*p == '\'') state = TAG; break; default: assert(!"Cannot happen!"); } } *q = '\0'; if (trim_punct) { /* Remove some trailing white space and punctuation */ for (q--; q != h && strspn(q, " \r\n\t\f\v,:;!?"); q--) *q = '\0'; /* Remove final '.' only if it is the only '.' in the term */ if ((q = strrchr(h, '.')) && !*(q+1) && q == strchr(h, '.')) *q = '\0'; } /* Then convert from UTF-8 to wchar_t */ cd = iconv_open("wchar_t", "UTF-8"); if (cd == (iconv_t)(-1)) {perror("hxindex"); exit(1);} len = strlen(h) + 1; newarray(term->sortkeys[i], len); /* Large enough */ p = (string) term->sortkeys[i]; len2 = len * sizeof(term->sortkeys[i][0]); if (iconv(cd, &h, &len, &p, &len2) == (size_t)(-1)) { perror("hxindex"); exit(1); } /* *p = L'\0'; */ if (iconv_close(cd) == -1) {perror("hxindex"); exit(1);} } } /* folding_cmp -- compare two arrays of sort keys */ static int folding_cmp(wchar_t **a, const int alen, wchar_t **b, const int blen) { int i, j; assert(a && alen >= 0); assert(b && blen >= 0); for (i = 0;; i++) { if (i == alen) return i == blen ? 0 : -1; if (i == blen) return 1; assert(a[i] && b[i]); if ((j = wcscoll(a[i], b[i])) != 0) return j; } assert(! "Cannot happen!"); } /* indent -- print newline and n times 2 spaces */ static void indent(int n) { putchar('\n'); for (; n > 0; n--) printf(" "); } /* print_escaped -- print s escaped for use in an attribute */ static void print_escaped(const conststring s) { conststring h; for (h = s; *h; h++) if (*h == '"') printf("""); else putchar(*h); } /* print_title -- print a TITLE attribute */ static void print_title(const Indexterm term) { enum {TEXT, TAG, DQUOTE, SQUOTE} state; string h; assert(use_secno); fputs(" title=\"", stdout); if (base[0]) { /* Only add document titles if needed */ for (state = TEXT, h = term->doctitle; *h; h++) { switch (state) { case TEXT: if (*h == '<') state = TAG; else if (*h == '"') fputs(""", stdout); else putchar(*h); break; case TAG: if (*h == '>') state = TEXT; else if (*h == '"') state = DQUOTE; else if (*h == '\'') state = SQUOTE; break; case DQUOTE: if (*h == '"') state = TAG; break; case SQUOTE: if (*h == '\'') state = TAG; break; default: assert(!"Cannot happen!"); } } fputs(", ", stdout); } for (h = section_name; *h; h++) switch (*h) { case '"': fputs(""", stdout); break; case '>': fputs(">", stdout); break; case '<': fputs("<", stdout); break; case '%': if (*(h+1) == '%') {putchar('%'); h++;} else if (*(h+1) != 's') putchar('%'); else if (term->secno) {print_escaped(term->secno); h++;} else {print_escaped(unknown_name); h++;} break; default: putchar(*h); } putchar('"'); } /* write_index_item -- write one item in the list of index terms */ static void write_index_item(const void *term1, const VISIT which, const int depth) { Indexterm term = *(Indexterm*)term1; int i, j; if (which != postorder && which != leaf) return; /* Count how many subterms are equal to the previous entry */ i = 0; while (i < min(term->nrkeys, globalprevious->nrkeys) && !folding_cmp(term->sortkeys + i, 1, globalprevious->sortkeys + i, 1)) i++; /* Close lists as needed */ for (j = globalprevious->nrkeys - 1; j > i; j--) { indent(j); printf("
    "); } /* Open a list if needed */ if (term->nrkeys > globalprevious->nrkeys && globalprevious->nrkeys == i) { indent(i); printf("