cadaver-0.23.3/0000775000076400007640000000000011312007552012622 5ustar jortonjortoncadaver-0.23.3/cadaver.spec.in0000664000076400007640000000247210132320456015515 0ustar jortonjorton Name: cadaver Version: @VERSION@ Release: 1 Summary: Command-line WebDAV client License: GPL Group: Applications/Internet Source: http://www.webdav.org/cadaver/%{name}-%{version}.tar.gz URL: http://www.webdav.org/cadaver/ BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildPrereq: libxml2-devel, openssl-devel, readline-devel %description cadaver is a command-line WebDAV client, with support for file upload, download, on-screen display, in-place editing, namespace operations (move/copy), collection creation and deletion, property manipulation, and resource locking. %prep %setup -q %build # cadaver doesn't use neon's zlib support, so disable it. # force the XML parser to be libxml2 %configure --with-libxml2 --with-ssl --without-zlib make %install rm -rf $RPM_BUILD_ROOT %makeinstall %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_bindir}/* %doc NEWS TODO COPYING README ChangeLog %{_mandir}/*/* %changelog * Wed May 1 2002 Joe Orton - add man page * Sat Jan 19 2002 Joe Orton - updated description * Mon Nov 19 2001 Joe Orton - Merge changes from Nalin Dahyabhai . * Fri Feb 11 2000 Joe Orton - Text descriptions modified * Thu Feb 10 2000 Lee Mallabone - Initial creation. cadaver-0.23.3/COPYING0000664000076400007640000004307610132320456013667 0ustar jortonjorton GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cadaver-0.23.3/README0000664000076400007640000000101310132320456013475 0ustar jortonjorton cadaver is a command-line WebDAV client, with support for file upload, download, on-screen display, in-place editing, namespace operations (move/copy), collection creation and deletion, property manipulation, and resource locking. Please send in bug reports, feature requests or any questions to the discussion list, cadaver@webdav.org. Subscribe to the discussion list via the web site: http://mailman.lyra.org/mailman/listinfo/cadaver; the list arhive is also avilable at: http://mailman.lyra.org/pipermail/cadaver/ cadaver-0.23.3/.update-po.sh0000775000076400007640000000204310754023043015136 0ustar jortonjorton#!/bin/sh -ex # Script to run update-po and update-gmo before generating # a release tarball. Run from .release.sh, *before* # autogen.sh. inmk=Makefile.in.in tmpmk=`mktemp /tmp/cadaver.XXXXXX` pot=`mktemp /tmp/cadaver.XXXXXX` trap 'rm -f $tmpmk $pot' TERM INT 0 cd po lngs=`cat LINGUAS` for l in $lngs; do CATALOGS="$CATALOGS $l.gmo" POFILES="$POFILES $l.po" done GMOFILES="$CATALOGS" sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, ../& \\\\," \ -e "\$s/\(.*\) \\\\/\1/" < POTFILES.in > $pot sed -e " /POTFILES =/r $pot; s/@SET_MAKE@//g; s/@PACKAGE@/cadaver/g; s/@VERSION@/$1/g; /^.*VPATH.*$/d; 1i\ DOMAIN = cadaver s/@srcdir@/./g; s/@top_srcdir@/../g; s/@CATALOGS@/$CATALOGS/g; s/@POFILES@/$POFILES/g; s/@UPDATEPOFILES@/$POFILES/g; s/@GMOFILES@/$GMOFILES/g; s/@GMSGFMT@/msgfmt/g; s/@MSGFMT@/msgfmt/g; s/@XGETTEXT@/xgettext/g; s/@MSGMERGE@/msgmerge/g; s/@XGETTEXT_EXTRA_OPTIONS@/--msgid-bugs-address cadaver@webdav.org/g; s/: Makefile.*/:/g; s/\$(MAKE) update-gmo/echo Done/g;" $inmk > $tmpmk make -f $tmpmk cadaver.pot-update ${GMOFILES} cadaver-0.23.3/TODO0000664000076400007640000001333210132320456013314 0ustar jortonjorton ** Bugs ** - mput will try to upload directories ** Requested Features ** From Jules : > Now the request: I use gvim -f as my editor and it would be great if > there was an option for Cadaver to upload the file on each :w (or a > switch in my ~/.cadaverrc). That way I wouldn't have to save and quit > gvim each time I wanted the file to go back on the server. ** Definitely Required Features ** - Abort download/uploads? - Places where a server request is made before an UI feedback is given after running a command: do_copymove - Copy/move over existing file gives 412 failed. PROPFIND the destination and prompt/fail (option!). - restart downloads/uploads if they time out: use byte ranges? - If PUT in 'edit' sequence fails, offer to save locally (idea from Lee M) - redirectref: What command to use? 'ln' == HARD links == DAV BIND != DAV refres. 'alias' might be good, since it is like Apache's Alias directive, and is equivalent. Or 'mkref', like the old spec had MKREF. - 'rget' and 'rput' to do recursive get/put: mkcol/mkdir where necessary ...use infinite-depth PROPFIND? - configurable sort order of 'ls' response - the need for some kind of resource state caching is increasing: remote glob expansion needs it. we need to know whether ANY resources we act on are collections to do locking properly, so locking needs it too. we really want to do this is a little hash table, indexed by URI, which is only used for one command execution cycle: parse -> expand globs -> add trailing slashes -> execute We are very chatty over the wire at the moment. One way of implementing this would be on TOP of neon (i.e., cache the decoded RESULTS of the PROPFIND). Another way to do this would be INSIDE of neon: cache (like a normal Web browser caches stuff) the PROPFIND response entity-body and supply that on demand. But the RFCs say no-go to caching PROPFINDs, so probably not an option. - Test progress bar over slow links. - Show activity with a spinning bar |/-\ - Bytes done / todo as human-readable strings: 15k/200k - Maybe a speed too, but these are often misleading/badly calculated - Danger of information overload. Download [===============> ] 88% (15K/2Mb) at 2.5Kb/s / - Some better handling of mv/cp over same resource: 'mv foo foo' could give better error. - ls is inflexible, should take multi-args, maybe not default to 'ls -l' style... allow different properties to be displayed. would be ultra-swish: dav> dcls Type Name Title Res rfc2518.txt HTTP Extensions for Distributed Authoring -- WEBDAV Res rfc2616.txt Hypertext Transfer Protocol -- HTTP/1.1 Completely configurable fields/widths/orders would be nice. It would be rather groovy to have a DAV-enabled Dublin-Core indexed RFC archive. - properties: display all... display from namespace (draft-stracke-webdav-propfind-space)... display Dublin Core... set specific. Lots of scope. - verbosity level for connection status messages - man page - PROPFIND issues, try http://sandbox.xerox.com:8080/joe.orton/ ** Longer-term Required Features ** - DASL searching, redirect references, ordered colls, binding... some server support for the last three would be nice first ;) We have better XML response support now, so these shouldn't be quite such a beach to implement. ** Code Issues ** - Maybe put a union in struct command to get better typesafeness... the Apache 2 config uses some GCC trickery to help. - set_path/is_collection is screwy. - may have to consider some "proper" URI handling, i.e., using a URI ADT... this is bothersome, since thus far, we have managed to cope with just using strings (i.e. the absPath segment), which makes for a nice simple, efficient, easy-to-use API. - should probably get rid of the global state in cadaver.c/commands.c etc - Better mapping between aliases and commands: ideally, the aliases would be declared statically in the command structure, but I can't see any way to do this in C. It would be nice to be able to do command->aliases mapping easily, too. ** WebDAV issues ** ** WebDAV Locking Issues ** - 'capable' command, or something, for capability discovery. this could be not specific to locking, doing OPTIONS too? - shared locks - put full URI in lock->uri - have locks follow MOVE's? ** Possible features ** - Have edit poll for changes, and PUT on modification? - Run a command from the command line, e.g. cadaver --command="get asda.txt" http://www.wherever.com/some/where/ - at the mo, 'cd' does a PROPFIND/depth0... could (optionally?) do a PROPFIND/depth1 instead to save a round-trip, and cache the results. ditto for globbing. - Generic mechanism for running commands locally (optionally, passing a downloaded remote file?)... abstract out "edit" functionality, which has two parts: 1) the LOCK -> (do stuff) -> UNLOCK sequence 2) Download resource to temp file, execute command, passing temp file - could also interpret known status-codes with more friendly responses. e.g. 423... 401... 404... maybe some extra explanation for 5xx responses, since they tend to be "something is broken" type errors. - command options - color 'ls' - read sitecopyrc file for host/username/password+proxy - netrc files are a bit outdated... maybe extend the syntax somewhat? Better, invent "~/.inetrc"? index by URL: location http://www.wherever.com/mysite/ username joe password secret location ftp://ftp.server.com etc etc. would be nice, can store different username/passwords for different services then... imap:// too etc. ** Misfeatures (a.k.a. known bugs) ** - See INTEROP for known interoperability problems - rm * is a bit dangerous... 'interactive' option makes like -i option to shell tools. cadaver-0.23.3/install-sh0000775000076400007640000001272110132320456014631 0ustar jortonjorton#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # 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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 cadaver-0.23.3/THANKS0000664000076400007640000000050610555420037013543 0ustar jortonjortonThanks to all who contributed to cadaver in one way or another: Brendan Quinn, David Reid, David Sloat, Dan Mullen, Jeff Costlow, Jules, Kip Lubliner, Sean Treadway, Tres Seaver, Wolfgang Goetz, Sebastian Harl, Greg Stein, GRASE team at UCSC, Peter O'Gorman, Andrew Belov, Tony Bennett and also to all contributors to neon! cadaver-0.23.3/config.guess0000755000076400007640000013226411267054423015160 0ustar jortonjorton#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2009-04-27' # 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 2 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, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # 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 Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. 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.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd | genuineintel) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp 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` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cadaver-0.23.3/config.h.in0000664000076400007640000005601311312007551014651 0ustar jortonjorton/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to specific EGD socket path */ #undef EGD_PATH /* Define if EGD should be supported */ #undef ENABLE_EGD /* Define to enable netrc support */ #undef ENABLE_NETRC /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS /* Define if GSS_C_NT_HOSTBASED_SERVICE is not defined otherwise */ #undef GSS_C_NT_HOSTBASED_SERVICE /* Define if you have the add_history function */ #undef HAVE_ADD_HISTORY /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the `argz_count' function. */ #undef HAVE_ARGZ_COUNT /* Define to 1 if you have the header file. */ #undef HAVE_ARGZ_H /* Define to 1 if you have the `argz_next' function. */ #undef HAVE_ARGZ_NEXT /* Define to 1 if you have the `argz_stringify' function. */ #undef HAVE_ARGZ_STRINGIFY /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF /* Define to 1 if the compiler understands __builtin_expect. */ #undef HAVE_BUILTIN_EXPECT /* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYCURRENT /* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* Define to 1 if you have the `CRYPTO_set_idptr_callback' function. */ #undef HAVE_CRYPTO_SET_IDPTR_CALLBACK /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FEOF_UNLOCKED /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FGETS_UNLOCKED /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETC_UNLOCKED /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. */ #undef HAVE_DECL_GETENV /* Define to 1 if you have the declaration of `h_errno', and to 0 if you don't. */ #undef HAVE_DECL_H_ERRNO /* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't. */ #undef HAVE_DECL_STPCPY /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R /* Define to 1 if you have the declaration of `_snprintf', and to 0 if you don't. */ #undef HAVE_DECL__SNPRINTF /* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you don't. */ #undef HAVE_DECL__SNWPRINTF /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define if you have expat */ #undef HAVE_EXPAT /* Define to 1 if you have the `fchmod' function. */ #undef HAVE_FCHMOD /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if your system has a working POSIX `fnmatch' function. */ #undef HAVE_FNMATCH /* Define to 1 if you have the `fstat64' function. */ #undef HAVE_FSTAT64 /* Define to 1 if you have the `fwprintf' function. */ #undef HAVE_FWPRINTF /* Define to 1 if you have the `gai_strerror' function. */ #undef HAVE_GAI_STRERROR /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `getegid' function. */ #undef HAVE_GETEGID /* Define to 1 if you have the `geteuid' function. */ #undef HAVE_GETEUID /* Define to 1 if you have the `getgid' function. */ #undef HAVE_GETGID /* Define to 1 if you have the `getnameinfo' function. */ #undef HAVE_GETNAMEINFO /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the `getpass' function. */ #undef HAVE_GETPASS /* Define to 1 if you have the `getsockopt' function. */ #undef HAVE_GETSOCKOPT /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID /* Define if GnuTLS support is enabled */ #undef HAVE_GNUTLS /* Define to 1 if you have the `gnutls_certificate_get_x509_cas' function. */ #undef HAVE_GNUTLS_CERTIFICATE_GET_X509_CAS /* Define to 1 if you have the `gnutls_certificate_verify_peers2' function. */ #undef HAVE_GNUTLS_CERTIFICATE_VERIFY_PEERS2 /* Define to 1 if you have the `gnutls_session_get_data2' function. */ #undef HAVE_GNUTLS_SESSION_GET_DATA2 /* Define to 1 if you have the `gnutls_sign_callback_set' function. */ #undef HAVE_GNUTLS_SIGN_CALLBACK_SET /* Define to 1 if you have the `gnutls_x509_dn_get_rdn_ava' function. */ #undef HAVE_GNUTLS_X509_DN_GET_RDN_AVA /* Define if GSSAPI support is enabled */ #undef HAVE_GSSAPI /* Define to 1 if you have the header file. */ #undef HAVE_GSSAPI_GSSAPI_GENERIC_H /* Define to 1 if you have the header file. */ #undef HAVE_GSSAPI_GSSAPI_H /* Define to 1 if you have the header file. */ #undef HAVE_GSSAPI_H /* Define to 1 if you have the `gss_init_sec_context' function. */ #undef HAVE_GSS_INIT_SEC_CONTEXT /* Define to 1 if you have the header file. */ #undef HAVE_HISTORY_H /* Define to 1 if you have the `hstrerror' function. */ #undef HAVE_HSTRERROR /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV /* Define to 1 if you have the header file. */ #undef HAVE_ICONV_H /* Define to 1 if you have the `inet_ntop' function. */ #undef HAVE_INET_NTOP /* Define to 1 if you have the `inet_pton' function. */ #undef HAVE_INET_PTON /* Define if you have the 'intmax_t' type in or . */ #undef HAVE_INTMAX_T /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if exists, doesn't clash with , and declares uintmax_t. */ #undef HAVE_INTTYPES_H_WITH_UINTMAX /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET /* Define if your file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H /* Define to 1 if you have the `ncurses' library (-lncurses). */ #undef HAVE_LIBNCURSES /* Define if libproxy is supported */ #undef HAVE_LIBPROXY /* Define to 1 if you have the `readline' library (-lreadline). */ #undef HAVE_LIBREADLINE /* Define if you have libxml */ #undef HAVE_LIBXML /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_PARSER_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_XMLVERSION_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R /* Define to 1 if the system has the type `long long int'. */ #undef HAVE_LONG_LONG_INT /* Define to 1 if you have the `lseek64' function. */ #undef HAVE_LSEEK64 /* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the `munmap' function. */ #undef HAVE_MUNMAP /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_TCP_H /* Define if you have and it defines the NL_LOCALE_NAME macro if _GNU_SOURCE is defined. */ #undef HAVE_NL_LOCALE_NAME /* Define if NTLM is supported */ #undef HAVE_NTLM /* Define if OpenSSL support is enabled */ #undef HAVE_OPENSSL /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_OPENSSLV_H /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_SSL_H /* Define if pakchois library supported */ #undef HAVE_PAKCHOIS /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL /* Define if your printf() function supports format strings with positions. */ #undef HAVE_POSIX_PRINTF /* Define to 1 if you have the `pthread_mutex_init' function. */ #undef HAVE_PTHREAD_MUTEX_INIT /* Define to 1 if you have the `pthread_mutex_lock' function. */ #undef HAVE_PTHREAD_MUTEX_LOCK /* Define if the defines PTHREAD_MUTEX_RECURSIVE. */ #undef HAVE_PTHREAD_MUTEX_RECURSIVE /* Define if the POSIX multithreading library has read/write locks. */ #undef HAVE_PTHREAD_RWLOCK /* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_HISTORY_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H /* Define to 1 if you have the `rl_completion_matches' function. */ #undef HAVE_RL_COMPLETION_MATCHES /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the `setsockopt' function. */ #undef HAVE_SETSOCKOPT /* Define to 1 if you have the `setvbuf' function. */ #undef HAVE_SETVBUF /* Define to 1 if you have the header file. */ #undef HAVE_SGTTY_H /* Define to 1 if you have the `signal' function. */ #undef HAVE_SIGNAL /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define if need to include snprintf.h */ #undef HAVE_SNPRINTF_H /* Define to 1 if the system has the type `socklen_t'. */ #undef HAVE_SOCKLEN_T /* Define to 1 if you have the `SSL_SESSION_cmp' function. */ #undef HAVE_SSL_SESSION_CMP /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define if exists, doesn't clash with , and declares uintmax_t. */ #undef HAVE_STDINT_H_WITH_UINTMAX /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `stpcpy' function. */ #undef HAVE_STPCPY /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strcoll' function. */ #undef HAVE_STRCOLL /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtoll' function. */ #undef HAVE_STRTOLL /* Define to 1 if you have the `strtoq' function. */ #undef HAVE_STRTOQ /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL /* Define to 1 if `tm_gmtoff' is member of `struct tm'. */ #undef HAVE_STRUCT_TM_TM_GMTOFF /* Define to 1 if `__tm_gmtoff' is member of `struct tm'. */ #undef HAVE_STRUCT_TM___TM_GMTOFF /* Define to 1 if you have the `stty' function. */ #undef HAVE_STTY /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LIMITS_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the `tcsetattr' function. */ #undef HAVE_TCSETATTR /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H /* Define if the timezone global is available */ #undef HAVE_TIMEZONE /* Define to 1 if you have the `tsearch' function. */ #undef HAVE_TSEARCH /* Define if you have the 'uintmax_t' type in or . */ #undef HAVE_UINTMAX_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the unsigned long long type. */ #undef HAVE_UNSIGNED_LONG_LONG /* Define to 1 if the system has the type `unsigned long long int'. */ #undef HAVE_UNSIGNED_LONG_LONG_INT /* Define to 1 or 0, depending whether the compiler supports simple visibility declarations. */ #undef HAVE_VISIBILITY /* Define to 1 if you have the header file. */ #undef HAVE_VMSDIR_H /* Define if you have the 'wchar_t' type. */ #undef HAVE_WCHAR_T /* Define to 1 if you have the `wcslen' function. */ #undef HAVE_WCSLEN /* Define if you have the 'wint_t' type. */ #undef HAVE_WINT_T /* Define if using expat which includes xmlparse.h */ #undef HAVE_XMLPARSE_H /* Define to 1 if you have the `__fsetlocking' function. */ #undef HAVE___FSETLOCKING /* Define to 1 if you have the `__secure_getenv' function. */ #undef HAVE___SECURE_GETENV /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST /* Define if integer division by zero raises signal SIGFPE. */ #undef INTDIV0_RAISES_SIGFPE /* Define to be the neon version string */ #undef NEON_VERSION /* Define to enable debugging */ #undef NE_DEBUGGING /* Define to be printf format string for ne_off_t */ #undef NE_FMT_NE_OFF_T /* Define to be printf format string for off64_t */ #undef NE_FMT_OFF64_T /* Define to be printf format string for off_t */ #undef NE_FMT_OFF_T /* Define to be printf format string for size_t */ #undef NE_FMT_SIZE_T /* Define to be printf format string for ssize_t */ #undef NE_FMT_SSIZE_T /* Define to be printf format string for time_t */ #undef NE_FMT_TIME_T /* Define to be printf format string for XML_Size */ #undef NE_FMT_XML_SIZE /* Defined if DAV is supported */ #undef NE_HAVE_DAV /* Defined if IPV6 is supported */ #undef NE_HAVE_IPV6 /* Defined if LFS is supported */ #undef NE_HAVE_LFS /* Defined if LIBPXY is supported */ #undef NE_HAVE_LIBPXY /* Defined if SSL is supported */ #undef NE_HAVE_SSL /* Defined if TS_SSL is supported */ #undef NE_HAVE_TS_SSL /* Defined if ZLIB is supported */ #undef NE_HAVE_ZLIB /* Define to be filename of an SSL CA root bundle */ #undef NE_SSL_CA_BUNDLE /* Define if poll() should be used */ #undef NE_USE_POLL /* Define to be neon library major version */ #undef NE_VERSION_MAJOR /* Define to be neon library minor version */ #undef NE_VERSION_MINOR /* Define to be neon library patch version */ #undef NE_VERSION_PATCH /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define if exists and defines unusable PRI* macros. */ #undef PRI_MACROS_BROKEN /* Define if the pthread_in_use() detection is hard. */ #undef PTHREAD_IN_USE_DETECTION_HARD /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `off64_t', as computed by sizeof. */ #undef SIZEOF_OFF64_T /* The size of `off_t', as computed by sizeof. */ #undef SIZEOF_OFF_T /* The size of `size_t', as computed by sizeof. */ #undef SIZEOF_SIZE_T /* The size of `ssize_t', as computed by sizeof. */ #undef SIZEOF_SSIZE_T /* The size of `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T /* The size of `XML_Size', as computed by sizeof. */ #undef SIZEOF_XML_SIZE /* Define as the maximum value of type 'size_t', if the system doesn't define it. */ #undef SIZE_MAX /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if getaddrinfo supports AI_ADDRCONFIG */ #undef USE_GAI_ADDRCONFIG /* Define if getaddrinfo() should be used */ #undef USE_GETADDRINFO /* Define if the POSIX multithreading library can be used. */ #undef USE_POSIX_THREADS /* Define if references to the POSIX multithreading library should be made weak. */ #undef USE_POSIX_THREADS_WEAK /* Define if the GNU Pth multithreading library can be used. */ #undef USE_PTH_THREADS /* Define if references to the GNU Pth multithreading library should be made weak. */ #undef USE_PTH_THREADS_WEAK /* Define if the old Solaris multithreading library can be used. */ #undef USE_SOLARIS_THREADS /* Define if references to the old Solaris multithreading library should be made weak. */ #undef USE_SOLARIS_THREADS_WEAK /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Define if the Win32 multithreading API can be used. */ #undef USE_WIN32_THREADS /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to enable GNU extensions */ #undef _GNU_SOURCE /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define if in_addr_t is not available */ #undef in_addr_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `long int' if does not define. */ #undef off_t /* Define as the type of the result of subtracting two pointers, if the system doesn't define it. */ #undef ptrdiff_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define if socklen_t is not available */ #undef socklen_t /* Define to unsigned long or unsigned long long if and don't define. */ #undef uintmax_t #if defined(HAVE_STPCPY) && defined(HAVE_DECL_STPCPY) && !HAVE_DECL_STPCPY && !defined(stpcpy) char *stpcpy(char *, const char *); #endif #define __libc_lock_t gl_lock_t #define __libc_lock_define gl_lock_define #define __libc_lock_define_initialized gl_lock_define_initialized #define __libc_lock_init gl_lock_init #define __libc_lock_lock gl_lock_lock #define __libc_lock_unlock gl_lock_unlock #define __libc_lock_recursive_t gl_recursive_lock_t #define __libc_lock_define_recursive gl_recursive_lock_define #define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized #define __libc_lock_init_recursive gl_recursive_lock_init #define __libc_lock_lock_recursive gl_recursive_lock_lock #define __libc_lock_unlock_recursive gl_recursive_lock_unlock #define glthread_in_use libintl_thread_in_use #define glthread_lock_init libintl_lock_init #define glthread_lock_lock libintl_lock_lock #define glthread_lock_unlock libintl_lock_unlock #define glthread_lock_destroy libintl_lock_destroy #define glthread_rwlock_init libintl_rwlock_init #define glthread_rwlock_rdlock libintl_rwlock_rdlock #define glthread_rwlock_wrlock libintl_rwlock_wrlock #define glthread_rwlock_unlock libintl_rwlock_unlock #define glthread_rwlock_destroy libintl_rwlock_destroy #define glthread_recursive_lock_init libintl_recursive_lock_init #define glthread_recursive_lock_lock libintl_recursive_lock_lock #define glthread_recursive_lock_unlock libintl_recursive_lock_unlock #define glthread_recursive_lock_destroy libintl_recursive_lock_destroy #define glthread_once libintl_once #define glthread_once_call libintl_once_call #define glthread_once_singlethreaded libintl_once_singlethreaded cadaver-0.23.3/lib/0000775000076400007640000000000011312007552013370 5ustar jortonjortoncadaver-0.23.3/lib/glob.c0000664000076400007640000010557310132320456014472 0ustar jortonjorton/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* AIX requires this to be the first thing in the file. */ #if defined _AIX && !defined __GNUC__ #pragma alloca #endif #ifdef HAVE_CONFIG_H # include #endif /* joe: so we can interrupt easier */ #define SHELL 1 /* Enable GNU extensions in glob.h. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #include #include #include /* Outcomment the following line for production quality code. */ /* #define NDEBUG 1 */ #include #include /* Needed on stupid SunOS for assert. */ /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if 0 /* joe: do like it says above */ #define GLOB_INTERFACE_VERSION 1 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 # include # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #endif /* 0 */ #ifndef ELIDE_CODE #if defined STDC_HEADERS || defined __GNU_LIBRARY__ # include #endif #if defined HAVE_UNISTD_H || defined _LIBC # include # ifndef POSIX # ifdef _POSIX_VERSION # define POSIX # endif # endif #endif #if !defined _AMIGA && !defined VMS && !defined WINDOWS32 # include #endif #if !defined __GNU_LIBRARY__ && !defined STDC_HEADERS extern int errno; #endif #ifndef __set_errno # define __set_errno(val) errno = (val) #endif #ifndef NULL # define NULL 0 #endif #if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__ # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # ifdef HAVE_SYS_NDIR_H # include # endif # ifdef HAVE_SYS_DIR_H # include # endif # ifdef HAVE_NDIR_H # include # endif # ifdef HAVE_VMSDIR_H # include "vmsdir.h" # endif /* HAVE_VMSDIR_H */ #endif /* In GNU systems, defines this macro for us. */ #ifdef _D_NAMLEN # undef NAMLEN # define NAMLEN(d) _D_NAMLEN(d) #endif /* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available if the `d_type' member for `struct dirent' is available. */ #ifdef _DIRENT_HAVE_D_TYPE # define HAVE_D_TYPE 1 #endif #if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__ /* Posix does not require that the d_ino field be present, and some systems do not provide it. */ # define REAL_DIR_ENTRY(dp) 1 #else # define REAL_DIR_ENTRY(dp) (dp->d_ino != 0) #endif /* POSIX */ #if defined STDC_HEADERS || defined __GNU_LIBRARY__ # include # include # define ANSI_STRING #else /* No standard headers. */ extern char *getenv (); # ifdef HAVE_STRING_H # include # define ANSI_STRING # else # include # endif # ifdef HAVE_MEMORY_H # include # endif extern char *malloc (), *realloc (); extern void free (); extern void qsort (); extern void abort (), exit (); #endif /* Standard headers. */ /* joe: added this... __P was blowing up everywhere */ #ifndef __P #define __P(a) () #endif /* joe: added this */ int __glob_pattern_p __P ((__const char *__pattern, int __quote)); #ifdef HAVE_GETLOGIN_R extern int getlogin_r __P ((char *, size_t)); #else extern char *getlogin __P ((void)); #endif #ifndef ANSI_STRING # ifndef bzero extern void bzero (); # endif # ifndef bcopy extern void bcopy (); # endif # define memcpy(d, s, n) bcopy ((s), (d), (n)) # define strrchr rindex /* memset is only used for zero here, but let's be paranoid. */ # define memset(s, better_be_zero, n) \ ((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0))) #endif /* Not ANSI_STRING. */ #if !defined HAVE_STRCOLL && !defined _LIBC # define strcoll strcmp #endif #if !defined HAVE_MEMPCPY && __GLIBC__ - 0 == 2 && __GLIBC_MINOR__ >= 1 # define HAVE_MEMPCPY 1 # undef mempcpy # define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len) #endif #ifndef __GNU_LIBRARY__ # ifdef __GNUC__ __inline # endif # ifndef __SASC # ifdef WINDOWS32 static void * # else static char * # endif my_realloc (p, n) char *p; unsigned int n; { /* These casts are the for sake of the broken Ultrix compiler, which warns of illegal pointer combinations otherwise. */ if (p == NULL) return (char *) malloc (n); return (char *) realloc (p, n); } # define realloc my_realloc # endif /* __SASC */ #endif /* __GNU_LIBRARY__ */ #if !defined __alloca && !defined __GNU_LIBRARY__ # ifdef __GNUC__ # undef alloca # define alloca(n) __builtin_alloca (n) # else /* Not GCC. */ # ifdef HAVE_ALLOCA_H # include # else /* Not HAVE_ALLOCA_H. */ # ifndef _AIX # ifdef WINDOWS32 # include # else extern char *alloca (); # endif /* WINDOWS32 */ # endif /* Not _AIX. */ # endif /* sparc or HAVE_ALLOCA_H. */ # endif /* GCC. */ #endif # define __alloca alloca # define __stat stat #ifndef __GNU_LIBRARY__ # define __stat stat # ifdef STAT_MACROS_BROKEN # undef S_ISDIR # endif # ifndef S_ISDIR # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) # endif #endif #ifdef _LIBC # undef strdup # define strdup(str) __strdup (str) # define sysconf(id) __sysconf (id) # define closedir(dir) __closedir (dir) # define opendir(name) __opendir (name) # define readdir(str) __readdir (str) # define getpwnam_r(name, bufp, buf, len, res) \ __getpwnam_r (name, bufp, buf, len, res) # ifndef __stat # define __stat(fname, buf) __xstat (_STAT_VER, fname, buf) # endif #endif #if !(defined STDC_HEADERS || defined __GNU_LIBRARY__) # undef size_t # define size_t unsigned int #endif /* Some system header files erroneously define these. We want our own definitions from to take precedence. */ #ifndef __GNU_LIBRARY__ # undef FNM_PATHNAME # undef FNM_NOESCAPE # undef FNM_PERIOD #endif #include /* Some system header files erroneously define these. We want our own definitions from to take precedence. */ #ifndef __GNU_LIBRARY__ # undef GLOB_ERR # undef GLOB_MARK # undef GLOB_NOSORT # undef GLOB_DOOFFS # undef GLOB_NOCHECK # undef GLOB_APPEND # undef GLOB_NOESCAPE # undef GLOB_PERIOD #endif #include static #if __GNUC__ - 0 >= 2 inline #endif const char *next_brace_sub __P ((const char *begin)); static int glob_in_dir __P ((const char *pattern, const char *directory, int flags, int (*errfunc) (const char *, int), glob_t *pglob)); static int prefix_array __P ((const char *prefix, char **array, size_t n)); static int collated_compare __P ((const __ptr_t, const __ptr_t)); /* Find the end of the sub-pattern in a brace expression. We define this as an inline function if the compiler permits. */ static #if __GNUC__ - 0 >= 2 inline #endif const char * next_brace_sub (begin) const char *begin; { unsigned int depth = 0; const char *cp = begin; while (1) { if (depth == 0) { if (*cp != ',' && *cp != '}' && *cp != '\0') { if (*cp == '{') ++depth; ++cp; continue; } } else { while (*cp != '\0' && (*cp != '}' || depth > 0)) { if (*cp == '}') --depth; ++cp; } if (*cp == '\0') /* An incorrectly terminated brace expression. */ return NULL; continue; } break; } return cp; } /* Do glob searching for PATTERN, placing results in PGLOB. The bits defined above may be set in FLAGS. If a directory cannot be opened or read and ERRFUNC is not nil, it is called with the pathname that caused the error, and the `errno' value from the failing call; if it returns non-zero `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ int glob (pattern, flags, errfunc, pglob) const char *pattern; int flags; int (*errfunc) __P ((const char *, int)); glob_t *pglob; { const char *filename; const char *dirname; size_t dirlen; int status; size_t oldcount; if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) { __set_errno (EINVAL); return -1; } if (flags & GLOB_BRACE) { const char *begin = strchr (pattern, '{'); if (begin != NULL) { /* Allocate working buffer large enough for our work. Note that we have at least an opening and closing brace. */ size_t firstc; char *alt_start; const char *p; const char *next; const char *rest; size_t rest_len; #ifdef __GNUC__ char onealt[strlen (pattern) - 1]; #else char *onealt = (char *) malloc (strlen (pattern) - 1); if (onealt == NULL) { if (!(flags & GLOB_APPEND)) globfree (pglob); return GLOB_NOSPACE; } #endif /* We know the prefix for all sub-patterns. */ #ifdef HAVE_MEMPCPY alt_start = mempcpy (onealt, pattern, begin - pattern); #else memcpy (onealt, pattern, begin - pattern); alt_start = &onealt[begin - pattern]; #endif /* Find the first sub-pattern and at the same time find the rest after the closing brace. */ next = next_brace_sub (begin + 1); if (next == NULL) { /* It is an illegal expression. */ #ifndef __GNUC__ free (onealt); #endif return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob); } /* Now find the end of the whole brace expression. */ rest = next; while (*rest != '}') { rest = next_brace_sub (rest + 1); if (rest == NULL) { /* It is an illegal expression. */ #ifndef __GNUC__ free (onealt); #endif return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob); } } /* Please note that we now can be sure the brace expression is well-formed. */ rest_len = strlen (++rest) + 1; /* We have a brace expression. BEGIN points to the opening {, NEXT points past the terminator of the first element, and END points past the final }. We will accumulate result names from recursive runs for each brace alternative in the buffer using GLOB_APPEND. */ if (!(flags & GLOB_APPEND)) { /* This call is to set a new vector, so clear out the vector so we can append to it. */ pglob->gl_pathc = 0; pglob->gl_pathv = NULL; } firstc = pglob->gl_pathc; p = begin + 1; while (1) { int result; /* Construct the new glob expression. */ #ifdef HAVE_MEMPCPY mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len); #else memcpy (alt_start, p, next - p); memcpy (&alt_start[next - p], rest, rest_len); #endif result = glob (onealt, ((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC)) | GLOB_APPEND), errfunc, pglob); /* If we got an error, return it. */ if (result && result != GLOB_NOMATCH) { #ifndef __GNUC__ free (onealt); #endif if (!(flags & GLOB_APPEND)) globfree (pglob); return result; } if (*next == '}') /* We saw the last entry. */ break; p = next + 1; next = next_brace_sub (p); assert (next != NULL); } #ifndef __GNUC__ free (onealt); #endif if (pglob->gl_pathc != firstc) /* We found some entries. */ return 0; else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC))) return GLOB_NOMATCH; } } /* Find the filename. */ filename = strrchr (pattern, '/'); #if defined __MSDOS__ || defined WINDOWS32 /* The case of "d:pattern". Since `:' is not allowed in file names, we can safely assume that wherever it happens in pattern, it signals the filename part. This is so we could some day support patterns like "[a-z]:foo". */ if (filename == NULL) filename = strchr (pattern, ':'); #endif /* __MSDOS__ || WINDOWS32 */ if (filename == NULL) { /* This can mean two things: a simple name or "~name". The later case is nothing but a notation for a directory. */ if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~') { dirname = pattern; dirlen = strlen (pattern); /* Set FILENAME to NULL as a special flag. This is ugly but other solutions would require much more code. We test for this special case below. */ filename = NULL; } else { filename = pattern; #ifdef _AMIGA dirname = ""; #else dirname = "."; #endif dirlen = 0; } } else if (filename == pattern) { /* "/pattern". */ dirname = "/"; dirlen = 1; ++filename; } else { char *newp; dirlen = filename - pattern; #if defined __MSDOS__ || defined WINDOWS32 if (*filename == ':' || (filename > pattern + 1 && filename[-1] == ':')) { char *drive_spec; ++dirlen; drive_spec = (char *) __alloca (dirlen + 1); #ifdef HAVE_MEMPCPY *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0'; #else memcpy (drive_spec, pattern, dirlen); drive_spec[dirlen] = '\0'; #endif /* For now, disallow wildcards in the drive spec, to prevent infinite recursion in glob. */ if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE))) return GLOB_NOMATCH; /* If this is "d:pattern", we need to copy `:' to DIRNAME as well. If it's "d:/pattern", don't remove the slash from "d:/", since "d:" and "d:/" are not the same.*/ } #endif newp = (char *) __alloca (dirlen + 1); #ifdef HAVE_MEMPCPY *((char *) mempcpy (newp, pattern, dirlen)) = '\0'; #else memcpy (newp, pattern, dirlen); newp[dirlen] = '\0'; #endif dirname = newp; ++filename; if (filename[0] == '\0' #if defined __MSDOS__ || defined WINDOWS32 && dirname[dirlen - 1] != ':' && (dirlen < 3 || dirname[dirlen - 2] != ':' || dirname[dirlen - 1] != '/') #endif && dirlen > 1) /* "pattern/". Expand "pattern", appending slashes. */ { int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob); if (val == 0) pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK) | (flags & GLOB_MARK)); return val; } } if (!(flags & GLOB_APPEND)) { pglob->gl_pathc = 0; pglob->gl_pathv = NULL; } oldcount = pglob->gl_pathc; #ifndef VMS if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~') { if (dirname[1] == '\0' || dirname[1] == '/') { /* Look up home directory. */ const char *home_dir = getenv ("HOME"); # ifdef _AMIGA if (home_dir == NULL || home_dir[0] == '\0') home_dir = "SYS:"; # else # ifdef WINDOWS32 if (home_dir == NULL || home_dir[0] == '\0') home_dir = "c:/users/default"; /* poor default */ # else if (home_dir == NULL || home_dir[0] == '\0') { int success; char *name; # if defined HAVE_GETLOGIN_R || defined _LIBC #ifdef _SC_LOGIN_NAME_MAX size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1; #else size_t buflen = 20; #endif if (buflen == 0) /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try a moderate value. */ buflen = 20; name = (char *) __alloca (buflen); success = getlogin_r (name, buflen) >= 0; # else success = (name = getlogin ()) != NULL; # endif if (success) { struct passwd *p; # if defined HAVE_GETPWNAM_R || defined _LIBC size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX); char *pwtmpbuf; struct passwd pwbuf; int save = errno; if (pwbuflen == -1) /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a moderate value. */ pwbuflen = 1024; pwtmpbuf = (char *) __alloca (pwbuflen); while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) != 0) { if (errno != ERANGE) { p = NULL; break; } pwbuflen *= 2; pwtmpbuf = (char *) __alloca (pwbuflen); __set_errno (save); } # else p = getpwnam (name); # endif if (p != NULL) home_dir = p->pw_dir; } } if (home_dir == NULL || home_dir[0] == '\0') { if (flags & GLOB_TILDE_CHECK) return GLOB_NOMATCH; else home_dir = "~"; /* No luck. */ } # endif /* WINDOWS32 */ # endif /* Now construct the full directory. */ if (dirname[1] == '\0') dirname = home_dir; else { char *newp; size_t home_len = strlen (home_dir); newp = (char *) __alloca (home_len + dirlen); # ifdef HAVE_MEMPCPY mempcpy (mempcpy (newp, home_dir, home_len), &dirname[1], dirlen); # else memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], &dirname[1], dirlen); # endif dirname = newp; } } # if !defined _AMIGA && !defined WINDOWS32 else { char *end_name = strchr (dirname, '/'); const char *user_name; const char *home_dir; if (end_name == NULL) user_name = dirname + 1; else { char *newp; newp = (char *) __alloca (end_name - dirname); # ifdef HAVE_MEMPCPY *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) = '\0'; # else memcpy (newp, dirname + 1, end_name - dirname); newp[end_name - dirname - 1] = '\0'; # endif user_name = newp; } /* Look up specific user's home directory. */ { struct passwd *p; # if defined HAVE_GETPWNAM_R || defined _LIBC size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); char *pwtmpbuf; struct passwd pwbuf; int save = errno; if (buflen == -1) /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a moderate value. */ buflen = 1024; pwtmpbuf = (char *) __alloca (buflen); while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0) { if (errno != ERANGE) { p = NULL; break; } buflen *= 2; pwtmpbuf = __alloca (buflen); __set_errno (save); } # else p = getpwnam (user_name); # endif if (p != NULL) home_dir = p->pw_dir; else home_dir = NULL; } /* If we found a home directory use this. */ if (home_dir != NULL) { char *newp; size_t home_len = strlen (home_dir); size_t rest_len = end_name == NULL ? 0 : strlen (end_name); newp = (char *) __alloca (home_len + rest_len + 1); # ifdef HAVE_MEMPCPY *((char *) mempcpy (mempcpy (newp, home_dir, home_len), end_name, rest_len)) = '\0'; # else memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], end_name, rest_len); newp[home_len + rest_len] = '\0'; # endif dirname = newp; } else if (flags & GLOB_TILDE_CHECK) /* We have to regard it as an error if we cannot find the home directory. */ return GLOB_NOMATCH; } # endif /* Not Amiga && not WINDOWS32. */ } #endif /* Not VMS. */ /* Now test whether we looked for "~" or "~NAME". In this case we can give the answer now. */ if (filename == NULL) { struct stat st; /* Return the directory if we don't check for error or if it exists. */ if ((flags & GLOB_NOCHECK) || (((flags & GLOB_ALTDIRFUNC) ? (*pglob->gl_stat) (dirname, &st) : __stat (dirname, &st)) == 0 && S_ISDIR (st.st_mode))) { pglob->gl_pathv = (char **) realloc (pglob->gl_pathv, (pglob->gl_pathc + ((flags & GLOB_DOOFFS) ? pglob->gl_offs : 0) + 1 + 1) * sizeof (char *)); if (pglob->gl_pathv == NULL) return GLOB_NOSPACE; if (flags & GLOB_DOOFFS) while (pglob->gl_pathc < pglob->gl_offs) pglob->gl_pathv[pglob->gl_pathc++] = NULL; #if defined HAVE_STRDUP || defined _LIBC pglob->gl_pathv[pglob->gl_pathc] = strdup (dirname); #else { size_t len = strlen (dirname) + 1; char *dircopy = malloc (len); if (dircopy != NULL) pglob->gl_pathv[pglob->gl_pathc] = memcpy (dircopy, dirname, len); } #endif if (pglob->gl_pathv[pglob->gl_pathc] == NULL) { free (pglob->gl_pathv); return GLOB_NOSPACE; } pglob->gl_pathv[++pglob->gl_pathc] = NULL; pglob->gl_flags = flags; return 0; } /* Not found. */ return GLOB_NOMATCH; } if (__glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE))) { /* The directory name contains metacharacters, so we have to glob for the directory, and then glob for the pattern in each directory found. */ glob_t dirs; register size_t i; if (flags & GLOB_ALTDIRFUNC) { dirs.gl_opendir = pglob->gl_opendir; dirs.gl_readdir = pglob->gl_readdir; dirs.gl_closedir = pglob->gl_closedir; dirs.gl_stat = pglob->gl_stat; dirs.gl_lstat = pglob->gl_lstat; } status = glob (dirname, ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ALTDIRFUNC)) | GLOB_NOSORT | GLOB_ONLYDIR), errfunc, &dirs); if (status != 0) return status; /* We have successfully globbed the preceding directory name. For each name we found, call glob_in_dir on it and FILENAME, appending the results to PGLOB. */ for (i = 0; i < dirs.gl_pathc; ++i) { int old_pathc; #ifdef SHELL { /* Make globbing interruptible in the bash shell. */ extern int interrupt_state; if (interrupt_state) { globfree (&dirs); #if 0 /* joe: this isn't defined. */ globfree (&files); #endif return GLOB_ABORTED; } } #endif /* SHELL. */ old_pathc = pglob->gl_pathc; status = glob_in_dir (filename, dirs.gl_pathv[i], ((flags | GLOB_APPEND) & ~(GLOB_NOCHECK | GLOB_ERR)), errfunc, pglob); if (status == GLOB_NOMATCH) /* No matches in this directory. Try the next. */ continue; if (status != 0) { globfree (&dirs); globfree (pglob); return status; } /* Stick the directory on the front of each name. */ if (prefix_array (dirs.gl_pathv[i], &pglob->gl_pathv[old_pathc], pglob->gl_pathc - old_pathc)) { globfree (&dirs); globfree (pglob); return GLOB_NOSPACE; } } flags |= GLOB_MAGCHAR; /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls. But if we have not found any matching entry and thie GLOB_NOCHECK flag was set we must return the list consisting of the disrectory names followed by the filename. */ if (pglob->gl_pathc == oldcount) { /* No matches. */ if (flags & GLOB_NOCHECK) { size_t filename_len = strlen (filename) + 1; char **new_pathv; struct stat st; /* This is an pessimistic guess about the size. */ pglob->gl_pathv = (char **) realloc (pglob->gl_pathv, (pglob->gl_pathc + ((flags & GLOB_DOOFFS) ? pglob->gl_offs : 0) + dirs.gl_pathc + 1) * sizeof (char *)); if (pglob->gl_pathv == NULL) { globfree (&dirs); return GLOB_NOSPACE; } if (flags & GLOB_DOOFFS) while (pglob->gl_pathc < pglob->gl_offs) pglob->gl_pathv[pglob->gl_pathc++] = NULL; for (i = 0; i < dirs.gl_pathc; ++i) { const char *dir = dirs.gl_pathv[i]; size_t dir_len = strlen (dir); /* First check whether this really is a directory. */ if (((flags & GLOB_ALTDIRFUNC) ? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0 || !S_ISDIR (st.st_mode)) /* No directory, ignore this entry. */ continue; pglob->gl_pathv[pglob->gl_pathc] = malloc (dir_len + 1 + filename_len); if (pglob->gl_pathv[pglob->gl_pathc] == NULL) { globfree (&dirs); globfree (pglob); return GLOB_NOSPACE; } #ifdef HAVE_MEMPCPY mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len), "/", 1), filename, filename_len); #else memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len); pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/'; memcpy (&pglob->gl_pathv[pglob->gl_pathc][dir_len + 1], filename, filename_len); #endif ++pglob->gl_pathc; } pglob->gl_pathv[pglob->gl_pathc] = NULL; pglob->gl_flags = flags; /* Now we know how large the gl_pathv vector must be. */ new_pathv = (char **) realloc (pglob->gl_pathv, ((pglob->gl_pathc + 1) * sizeof (char *))); if (new_pathv != NULL) pglob->gl_pathv = new_pathv; } else return GLOB_NOMATCH; } globfree (&dirs); } else { status = glob_in_dir (filename, dirname, flags, errfunc, pglob); if (status != 0) return status; if (dirlen > 0) { /* Stick the directory on the front of each name. */ size_t ignore = oldcount; if ((flags & GLOB_DOOFFS) && ignore < pglob->gl_offs) ignore = pglob->gl_offs; if (prefix_array (dirname, &pglob->gl_pathv[ignore], pglob->gl_pathc - ignore)) { globfree (pglob); return GLOB_NOSPACE; } } } if (flags & GLOB_MARK) { /* Append slashes to directory names. */ size_t i; struct stat st; for (i = oldcount; i < pglob->gl_pathc; ++i) if (((flags & GLOB_ALTDIRFUNC) ? (*pglob->gl_stat) (pglob->gl_pathv[i], &st) : __stat (pglob->gl_pathv[i], &st)) == 0 && S_ISDIR (st.st_mode)) { size_t len = strlen (pglob->gl_pathv[i]) + 2; char *new = realloc (pglob->gl_pathv[i], len); if (new == NULL) { globfree (pglob); return GLOB_NOSPACE; } strcpy (&new[len - 2], "/"); pglob->gl_pathv[i] = new; } } if (!(flags & GLOB_NOSORT)) { /* Sort the vector. */ int non_sort = oldcount; if ((flags & GLOB_DOOFFS) && pglob->gl_offs > oldcount) non_sort = pglob->gl_offs; qsort ((__ptr_t) &pglob->gl_pathv[non_sort], pglob->gl_pathc - non_sort, sizeof (char *), collated_compare); } return 0; } /* Free storage allocated in PGLOB by a previous `glob' call. */ void globfree (pglob) register glob_t *pglob; { if (pglob->gl_pathv != NULL) { register size_t i; for (i = 0; i < pglob->gl_pathc; ++i) if (pglob->gl_pathv[i] != NULL) free ((__ptr_t) pglob->gl_pathv[i]); free ((__ptr_t) pglob->gl_pathv); } } /* Do a collated comparison of A and B. */ static int collated_compare (a, b) const __ptr_t a; const __ptr_t b; { const char *const s1 = *(const char *const * const) a; const char *const s2 = *(const char *const * const) b; if (s1 == s2) return 0; if (s1 == NULL) return 1; if (s2 == NULL) return -1; return strcoll (s1, s2); } /* Prepend DIRNAME to each of N members of ARRAY, replacing ARRAY's elements in place. Return nonzero if out of memory, zero if successful. A slash is inserted between DIRNAME and each elt of ARRAY, unless DIRNAME is just "/". Each old element of ARRAY is freed. */ static int prefix_array (dirname, array, n) const char *dirname; char **array; size_t n; { register size_t i; size_t dirlen = strlen (dirname); #if defined __MSDOS__ || defined WINDOWS32 int sep_char = '/'; # define DIRSEP_CHAR sep_char #else # define DIRSEP_CHAR '/' #endif if (dirlen == 1 && dirname[0] == '/') /* DIRNAME is just "/", so normal prepending would get us "//foo". We want "/foo" instead, so don't prepend any chars from DIRNAME. */ dirlen = 0; #if defined __MSDOS__ || defined WINDOWS32 else if (dirlen > 1) { if (dirname[dirlen - 1] == '/') /* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */ --dirlen; else if (dirname[dirlen - 1] == ':') { /* DIRNAME is "d:". Use `:' instead of `/'. */ --dirlen; sep_char = ':'; } } #endif for (i = 0; i < n; ++i) { size_t eltlen = strlen (array[i]) + 1; char *new = (char *) malloc (dirlen + 1 + eltlen); if (new == NULL) { while (i > 0) free ((__ptr_t) array[--i]); return 1; } #ifdef HAVE_MEMPCPY { char *endp = (char *) mempcpy (new, dirname, dirlen); *endp++ = DIRSEP_CHAR; mempcpy (endp, array[i], eltlen); } #else memcpy (new, dirname, dirlen); new[dirlen] = DIRSEP_CHAR; memcpy (&new[dirlen + 1], array[i], eltlen); #endif free ((__ptr_t) array[i]); array[i] = new; } return 0; } /* We must not compile this function twice. */ #if !defined _LIBC || !defined NO_GLOB_PATTERN_P /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ int __glob_pattern_p (pattern, quote) const char *pattern; int quote; { register const char *p; int open = 0; for (p = pattern; *p != '\0'; ++p) switch (*p) { case '?': case '*': return 1; case '\\': if (quote && p[1] != '\0') ++p; break; case '[': open = 1; break; case ']': if (open) return 1; break; } return 0; } # ifdef _LIBC weak_alias (__glob_pattern_p, glob_pattern_p) # endif #endif /* Like `glob', but PATTERN is a final pathname component, and matches are searched for in DIRECTORY. The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done. The GLOB_APPEND flag is assumed to be set (always appends). */ static int glob_in_dir (pattern, directory, flags, errfunc, pglob) const char *pattern; const char *directory; int flags; int (*errfunc) __P ((const char *, int)); glob_t *pglob; { __ptr_t stream = NULL; struct globlink { struct globlink *next; char *name; }; struct globlink *names = NULL; size_t nfound; int meta; int save; meta = __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)); if (meta == 0) { if (flags & (GLOB_NOCHECK|GLOB_NOMAGIC)) /* We need not do any tests. The PATTERN contains no meta characters and we must not return an error therefore the result will always contain exactly one name. */ flags |= GLOB_NOCHECK; else { /* Since we use the normal file functions we can also use stat() to verify the file is there. */ struct stat st; size_t patlen = strlen (pattern); size_t dirlen = strlen (directory); char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1); # ifdef HAVE_MEMPCPY mempcpy (mempcpy (mempcpy (fullname, directory, dirlen), "/", 1), pattern, patlen + 1); # else memcpy (fullname, directory, dirlen); fullname[dirlen] = '/'; memcpy (&fullname[dirlen + 1], pattern, patlen + 1); # endif if (((flags & GLOB_ALTDIRFUNC) ? (*pglob->gl_stat) (fullname, &st) : __stat (fullname, &st)) == 0) /* We found this file to be existing. Now tell the rest of the function to copy this name into the result. */ flags |= GLOB_NOCHECK; } nfound = 0; } else { if (pattern[0] == '\0') { /* This is a special case for matching directories like in "*a/". */ names = (struct globlink *) __alloca (sizeof (struct globlink)); names->name = (char *) malloc (1); if (names->name == NULL) goto memory_error; names->name[0] = '\0'; names->next = NULL; nfound = 1; meta = 0; } else { stream = ((flags & GLOB_ALTDIRFUNC) ? (*pglob->gl_opendir) (directory) : (__ptr_t) opendir (directory)); if (stream == NULL) { if (errno != ENOTDIR && ((errfunc != NULL && (*errfunc) (directory, errno)) || (flags & GLOB_ERR))) return GLOB_ABORTED; nfound = 0; meta = 0; } else { int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) #if defined _AMIGA || defined VMS | FNM_CASEFOLD #endif ); nfound = 0; flags |= GLOB_MAGCHAR; while (1) { const char *name; size_t len; struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ? (*pglob->gl_readdir) (stream) : readdir ((DIR *) stream)); if (d == NULL) break; if (! REAL_DIR_ENTRY (d)) continue; #ifdef HAVE_D_TYPE /* If we shall match only directories use the information provided by the dirent call if possible. */ if ((flags & GLOB_ONLYDIR) && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR) continue; #endif name = d->d_name; if (fnmatch (pattern, name, fnm_flags) == 0) { struct globlink *new = (struct globlink *) __alloca (sizeof (struct globlink)); len = NAMLEN (d); new->name = (char *) malloc (len + 1); if (new->name == NULL) goto memory_error; #ifdef HAVE_MEMPCPY *((char *) mempcpy ((__ptr_t) new->name, name, len)) = '\0'; #else memcpy ((__ptr_t) new->name, name, len); new->name[len] = '\0'; #endif new->next = names; names = new; ++nfound; } } } } } if (nfound == 0 && (flags & GLOB_NOCHECK)) { size_t len = strlen (pattern); nfound = 1; names = (struct globlink *) __alloca (sizeof (struct globlink)); names->next = NULL; names->name = (char *) malloc (len + 1); if (names->name == NULL) goto memory_error; #ifdef HAVE_MEMPCPY *((char *) mempcpy (names->name, pattern, len)) = '\0'; #else memcpy (names->name, pattern, len); names->name[len] = '\0'; #endif } if (nfound != 0) { pglob->gl_pathv = (char **) realloc (pglob->gl_pathv, (pglob->gl_pathc + ((flags & GLOB_DOOFFS) ? pglob->gl_offs : 0) + nfound + 1) * sizeof (char *)); if (pglob->gl_pathv == NULL) goto memory_error; if (flags & GLOB_DOOFFS) while (pglob->gl_pathc < pglob->gl_offs) pglob->gl_pathv[pglob->gl_pathc++] = NULL; for (; names != NULL; names = names->next) pglob->gl_pathv[pglob->gl_pathc++] = names->name; pglob->gl_pathv[pglob->gl_pathc] = NULL; pglob->gl_flags = flags; } save = errno; if (stream != NULL) { if (flags & GLOB_ALTDIRFUNC) (*pglob->gl_closedir) (stream); else closedir ((DIR *) stream); } __set_errno (save); return nfound == 0 ? GLOB_NOMATCH : 0; memory_error: { int esave = errno; if (flags & GLOB_ALTDIRFUNC) (*pglob->gl_closedir) (stream); else closedir ((DIR *) stream); __set_errno (esave); } while (names != NULL) { if (names->name != NULL) free ((__ptr_t) names->name); names = names->next; } return GLOB_NOSPACE; } #endif /* Not ELIDE_CODE. */ cadaver-0.23.3/lib/fnmatch.h0000664000076400007640000000460410132320456015165 0ustar jortonjorton/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _FNMATCH_H #define _FNMATCH_H 1 #ifdef __cplusplus extern "C" { #endif #if defined (__cplusplus) || (defined (__STDC__) && __STDC__) #undef __P #define __P(protos) protos #else /* Not C++ or ANSI C. */ #undef __P #define __P(protos) () /* We can get away without defining `const' here only because in this file it is used only inside the prototype for `fnmatch', which is elided in non-ANSI C where `const' is problematical. */ #endif /* C++ or ANSI C. */ /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in . */ #undef FNM_PATHNAME #undef FNM_NOESCAPE #undef FNM_PERIOD /* Bits set in the FLAGS argument to `fnmatch'. */ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) #define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ #define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ #define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ #define FNM_NOMATCH 1 /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch __P ((const char *__pattern, const char *__string, int __flags)); #ifdef __cplusplus } #endif #endif /* fnmatch.h */ cadaver-0.23.3/lib/snprintf.c0000664000076400007640000004657410132320456015417 0ustar jortonjorton /* Unix snprintf implementation. Version 1.1 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Revision History: sitecopy changes: renamed dtoa -> doubletoa to avoid dtoa conflict with cygwin. 1.1: * added changes from Miles Bader * corrected a bug with %f * added support for %#g * added more comments :-) 1.0: * supporting must ANSI syntaxic_sugars 0.0: * suppot %s %c %d THANKS(for the patches and ideas): Miles Bader Cyrille Rustom Jacek Slabocewiz Mike Parker(mouse) */ #ifdef HAVE_CONFIG_H #include #endif #include "snprintf.h" #ifdef HAVE_STRING_H #include /* for strlen() */ #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STDLIB_H #include /* for atoi() */ #endif #include /* * Find the nth power of 10 */ PRIVATE double #ifdef __STDC__ pow_10(int n) #else pow_10(n) int n; #endif { int i; double P; if (n < 0) for (i = 1, P = 1., n = -n ; i <= n ; i++) {P *= .1;} else for (i = 1, P = 1. ; i <= n ; i++) {P *= 10.0;} return P; } /* * Find the integral part of the log in base 10 * Note: this not a real log10() I just need and approximation(integerpart) of x in: 10^x ~= r * log_10(200) = 2; * log_10(250) = 2; */ PRIVATE int #ifdef __STDC__ log_10(double r) #else log_10(r) double r; #endif { int i = 0; double result = 1.; if (r < 0.) r = -r; if (r < 1.) { while (result >= r) {result *= .1; i++;} return (-i); } else { while (result <= r) {result *= 10.; i++;} return (i - 1); } } /* * This function return the fraction part of a double * and set in ip the integral part. * In many ways it resemble the modf() found on most Un*x */ PRIVATE double #ifdef __STDC__ integral(double real, double * ip) #else integral(real, ip) double real; double * ip; #endif { int j; double i, s, p; double real_integral = 0.; /* take care of the obvious */ /* equal to zero ? */ if (real == 0.) { *ip = 0.; return (0.); } /* negative number ? */ if (real < 0.) real = -real; /* a fraction ? */ if ( real < 1.) { *ip = 0.; return real; } /* the real work :-) */ for (j = log_10(real); j >= 0; j--) { p = pow_10(j); s = (real - real_integral)/p; i = 0.; while (i + 1. <= s) {i++;} real_integral += i*p; } *ip = real_integral; return (real - real_integral); } #define PRECISION 1.e-6 /* * return an ascii representation of the integral part of the number * and set fract to be an ascii representation of the fraction part * the container for the fraction and the integral part or staticly * declare with fix size */ PRIVATE char * #ifdef __STDC__ numtoa(double number, int base, int precision, char ** fract) #else numtoa(number, base, precision, fract) double number; int base; int precision; char ** fract; #endif { register int i, j; double ip, fp; /* integer and fraction part */ double fraction; int digits = MAX_INT - 1; static char integral_part[MAX_INT]; static char fraction_part[MAX_FRACT]; double sign; int ch; /* taking care of the obvious case: 0.0 */ if (number == 0.) { integral_part[0] = '0'; integral_part[1] = '\0'; fraction_part[0] = '0'; fraction_part[1] = '\0'; return integral_part; } /* for negative numbers */ if ((sign = number) < 0.) { number = -number; digits--; /* sign consume one digit */ } fraction = integral(number, &ip); number = ip; /* do the integral part */ if ( ip == 0.) { integral_part[0] = '0'; i = 1; } else { for ( i = 0; i < digits && number != 0.; ++i) { number /= base; fp = integral(number, &ip); ch = (int)((fp + PRECISION)*base); /* force to round */ integral_part[i] = (ch <= 9) ? ch + '0' : ch + 'a' - 10; if (! isxdigit(integral_part[i])) /* bail out overflow !! */ break; number = ip; } } /* Oh No !! out of bound, ho well fill it up ! */ if (number != 0.) for (i = 0; i < digits; ++i) integral_part[i] = '9'; /* put the sign ? */ if (sign < 0.) integral_part[i++] = '-'; integral_part[i] = '\0'; /* reverse every thing */ for ( i--, j = 0; j < i; j++, i--) SWAP_INT(integral_part[i], integral_part[j]); /* the fractionnal part */ for (i=0, fp=fraction; precision > 0 && i < MAX_FRACT ; i++, precision-- ) { fraction_part[i] = (int)((fp + PRECISION)*10. + '0'); if (! isdigit(fraction_part[i])) /* underflow ? */ break; fp = (fp*10.0) - (double)(long)((fp + PRECISION)*10.); } fraction_part[i] = '\0'; if (fract != (char **)0) *fract = fraction_part; return integral_part; } /* for %d and friends, it puts in holder * the representation with the right padding */ PRIVATE void #ifdef __STDC__ decimal(struct DATA *p, double d) #else decimal(p, d) struct DATA *p; double d; #endif { char *tmp; tmp = itoa(d); p->width -= strlen(tmp); PAD_RIGHT(p); PUT_PLUS(d, p); PUT_SPACE(d, p); while (*tmp) { /* the integral */ PUT_CHAR(*tmp, p); tmp++; } PAD_LEFT(p); } /* for %o octal representation */ PRIVATE void #ifdef __STDC__ octal(struct DATA *p, double d) #else octal(p, d) struct DATA *p; double d; #endif { char *tmp; tmp = otoa(d); p->width -= strlen(tmp); PAD_RIGHT(p); if (p->square == FOUND) /* had prefix '0' for octal */ PUT_CHAR('0', p); while (*tmp) { /* octal */ PUT_CHAR(*tmp, p); tmp++; } PAD_LEFT(p); } /* for %x %X hexadecimal representation */ PRIVATE void #ifdef __STDC__ hexa(struct DATA *p, double d) #else hexa(p, d) struct DATA *p; double d; #endif { char *tmp; tmp = htoa(d); p->width -= strlen(tmp); PAD_RIGHT(p); if (p->square == FOUND) { /* prefix '0x' for hexa */ PUT_CHAR('0', p); PUT_CHAR(*p->pf, p); } while (*tmp) { /* hexa */ PUT_CHAR((*p->pf == 'X' ? toupper(*tmp) : *tmp), p); tmp++; } PAD_LEFT(p); } /* %s strings */ PRIVATE void #ifdef __STDC__ strings(struct DATA *p, char *tmp) #else strings(p, tmp) struct DATA *p; char *tmp; #endif { int i; i = strlen(tmp); if (p->precision != NOT_FOUND) /* the smallest number */ i = (i < p->precision ? i : p->precision); p->width -= i; PAD_RIGHT(p); while (i-- > 0) { /* put the sting */ PUT_CHAR(*tmp, p); tmp++; } PAD_LEFT(p); } /* %f or %g floating point representation */ PRIVATE void #ifdef __STDC__ floating(struct DATA *p, double d) #else floating(p, d) struct DATA *p; double d; #endif { char *tmp, *tmp2; int i; DEF_PREC(p); d = ROUND(d, p); tmp = doubletoa(d, p->precision, &tmp2); /* calculate the padding. 1 for the dot */ p->width = p->width - ((d > 0. && p->justify == RIGHT) ? 1:0) - ((p->space == FOUND) ? 1:0) - strlen(tmp) - p->precision - 1; PAD_RIGHT(p); PUT_PLUS(d, p); PUT_SPACE(d, p); while (*tmp) { /* the integral */ PUT_CHAR(*tmp, p); tmp++; } if (p->precision != 0 || p->square == FOUND) PUT_CHAR('.', p); /* put the '.' */ if (*p->pf == 'g' || *p->pf == 'G') /* smash the trailing zeros */ for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--) tmp2[i] = '\0'; for (; *tmp2; tmp2++) PUT_CHAR(*tmp2, p); /* the fraction */ PAD_LEFT(p); } /* %e %E %g exponent representation */ PRIVATE void #ifdef __STDC__ exponent(struct DATA *p, double d) #else exponent(p, d) struct DATA *p; double d; #endif { char *tmp, *tmp2; int j, i; DEF_PREC(p); j = log_10(d); d = d / pow_10(j); /* get the Mantissa */ d = ROUND(d, p); tmp = doubletoa(d, p->precision, &tmp2); /* 1 for unit, 1 for the '.', 1 for 'e|E', * 1 for '+|-', 3 for 'exp' */ /* calculate how much padding need */ p->width = p->width - ((d > 0. && p->justify == RIGHT) ? 1:0) - ((p->space == FOUND) ? 1:0) - p->precision - 7; PAD_RIGHT(p); PUT_PLUS(d, p); PUT_SPACE(d, p); while (*tmp) {/* the integral */ PUT_CHAR(*tmp, p); tmp++; } if (p->precision != 0 || p->square == FOUND) PUT_CHAR('.', p); /* the '.' */ if (*p->pf == 'g' || *p->pf == 'G') /* smash the trailing zeros */ for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--) tmp2[i] = '\0'; for (; *tmp2; tmp2++) PUT_CHAR(*tmp2, p); /* the fraction */ if (*p->pf == 'g' || *p->pf == 'e') { /* the exponent put the 'e|E' */ PUT_CHAR('e', p); } else PUT_CHAR('E', p); if (j > 0) { /* the sign of the exp */ PUT_CHAR('+', p); } else { PUT_CHAR('-', p); j = -j; } tmp = itoa((double)j); if (j < 9) { /* need to pad the exponent with 0 '000' */ PUT_CHAR('0', p); PUT_CHAR('0', p); } else if (j < 99) PUT_CHAR('0', p); while (*tmp) { /* the exponent */ PUT_CHAR(*tmp, p); tmp++; } PAD_LEFT(p); } /* initialize the conversion specifiers */ PRIVATE void #ifdef __STDC__ conv_flag(char * s, struct DATA * p) #else conv_flag(s, p) char * s; struct DATA * p; #endif { char number[MAX_FIELD/2]; int i; p->precision = p->width = NOT_FOUND; p->star_w = p->star_p = NOT_FOUND; p->square = p->space = NOT_FOUND; p->a_long = p->justify = NOT_FOUND; p->pad = ' '; for(;s && *s ;s++) { switch(*s) { case ' ': p->space = FOUND; break; case '#': p->square = FOUND; break; case '*': if (p->width == NOT_FOUND) p->width = p->star_w = FOUND; else p->precision = p->star_p = FOUND; break; case '+': p->justify = RIGHT; break; case '-': p->justify = LEFT; break; case '.': if (p->width == NOT_FOUND) p->width = 0; break; case '0': p->pad = '0'; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* gob all the digits */ for (i = 0; isdigit(*s); i++, s++) if (i < MAX_FIELD/2 - 1) number[i] = *s; number[i] = '\0'; if (p->width == NOT_FOUND) p->width = atoi(number); else p->precision = atoi(number); s--; /* went to far go back */ break; } } } PUBLIC int #ifdef __STDC__ vsnprintf(char *string, size_t length, const char * format, va_list args) #else vsnprintf(string, length, format, args) char *string; size_t length; char * format; va_list args; #endif { struct DATA data; char conv_field[MAX_FIELD]; double d; /* temporary holder */ int state; int i; data.length = length - 1; /* leave room for '\0' */ data.holder = string; data.pf = format; data.counter = 0; /* sanity check, the string must be > 1 */ if (length < 1) return -1; for (; *data.pf && (data.counter < data.length); data.pf++) { if ( *data.pf == '%' ) { /* we got a magic % cookie */ conv_flag((char *)0, &data); /* initialise format flags */ for (state = 1; *data.pf && state;) { switch (*(++data.pf)) { case '\0': /* a NULL here ? ? bail out */ *data.holder = '\0'; return data.counter; break; case 'f': /* float, double */ STAR_ARGS(&data); d = va_arg(args, double); floating(&data, d); state = 0; break; case 'g': case 'G': STAR_ARGS(&data); DEF_PREC(&data); d = va_arg(args, double); i = log_10(d); /* * for '%g|%G' ANSI: use f if exponent * is in the range or [-4,p] exclusively * else use %e|%E */ if (-4 < i && i < data.precision) floating(&data, d); else exponent(&data, d); state = 0; break; case 'e': case 'E': /* Exponent double */ STAR_ARGS(&data); d = va_arg(args, double); exponent(&data, d); state = 0; break; case 'u': case 'd': /* decimal */ STAR_ARGS(&data); if (data.a_long == FOUND) d = va_arg(args, long); else d = va_arg(args, int); decimal(&data, d); state = 0; break; case 'o': /* octal */ STAR_ARGS(&data); if (data.a_long == FOUND) d = va_arg(args, long); else d = va_arg(args, int); octal(&data, d); state = 0; break; case 'x': case 'X': /* hexadecimal */ STAR_ARGS(&data); if (data.a_long == FOUND) d = va_arg(args, long); else d = va_arg(args, int); hexa(&data, d); state = 0; break; case 'c': /* character */ d = va_arg(args, int); PUT_CHAR(d, &data); state = 0; break; case 's': /* string */ STAR_ARGS(&data); strings(&data, va_arg(args, char *)); state = 0; break; case 'n': *(va_arg(args, int *)) = data.counter; /* what's the count ? */ state = 0; break; case 'l': data.a_long = FOUND; break; case 'h': break; case '%': /* nothing just % */ PUT_CHAR('%', &data); state = 0; break; case '#': case ' ': case '+': case '*': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* initialize width and precision */ for (i = 0; isflag(*data.pf); i++, data.pf++) if (i < MAX_FIELD - 1) conv_field[i] = *data.pf; conv_field[i] = '\0'; conv_flag(conv_field, &data); data.pf--; /* went to far go back */ break; default: /* is this an error ? maybe bail out */ state = 0; break; } /* end switch */ } /* end of for state */ } else { /* not % */ PUT_CHAR(*data.pf, &data); /* add the char the string */ } } *data.holder = '\0'; /* the end ye ! */ return data.counter; } #ifndef HAVE_SNPRINTF PUBLIC int #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ snprintf(char *string, size_t length, const char * format, ...) #else snprintf(string, length, format, va_alist) char *string; size_t length; char * format; va_dcl #endif { int rval; va_list args; #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ va_start(args, format); #else va_start(args); #endif rval = vsnprintf (string, length, format, args); va_end(args); return rval; } #endif /* HAVE_SNPRINTF */ #ifdef DRIVER #include /* set of small tests for snprintf() */ void main() { char holder[100]; int i; /* printf("Suite of test for snprintf:\n"); printf("a_format\n"); printf("printf() format\n"); printf("snprintf() format\n\n"); */ /* Checking the field widths */ printf("/%%d/, 336\n"); snprintf(holder, sizeof holder, "/%d/\n", 336); printf("/%d/\n", 336); printf("%s\n", holder); printf("/%%2d/, 336\n"); snprintf(holder, sizeof holder, "/%2d/\n", 336); printf("/%2d/\n", 336); printf("%s\n", holder); printf("/%%10d/, 336\n"); snprintf(holder, sizeof holder, "/%10d/\n", 336); printf("/%10d/\n", 336); printf("%s\n", holder); printf("/%%-10d/, 336\n"); snprintf(holder, sizeof holder, "/%-10d/\n", 336); printf("/%-10d/\n", 336); printf("%s\n", holder); /* floating points */ printf("/%%f/, 1234.56\n"); snprintf(holder, sizeof holder, "/%f/\n", 1234.56); printf("/%f/\n", 1234.56); printf("%s\n", holder); printf("/%%e/, 1234.56\n"); snprintf(holder, sizeof holder, "/%e/\n", 1234.56); printf("/%e/\n", 1234.56); printf("%s\n", holder); printf("/%%4.2f/, 1234.56\n"); snprintf(holder, sizeof holder, "/%4.2f/\n", 1234.56); printf("/%4.2f/\n", 1234.56); printf("%s\n", holder); printf("/%%3.1f/, 1234.56\n"); snprintf(holder, sizeof holder, "/%3.1f/\n", 1234.56); printf("/%3.1f/\n", 1234.56); printf("%s\n", holder); printf("/%%10.3f/, 1234.56\n"); snprintf(holder, sizeof holder, "/%10.3f/\n", 1234.56); printf("/%10.3f/\n", 1234.56); printf("%s\n", holder); printf("/%%10.3e/, 1234.56\n"); snprintf(holder, sizeof holder, "/%10.3e/\n", 1234.56); printf("/%10.3e/\n", 1234.56); printf("%s\n", holder); printf("/%%+4.2f/, 1234.56\n"); snprintf(holder, sizeof holder, "/%+4.2f/\n", 1234.56); printf("/%+4.2f/\n", 1234.56); printf("%s\n", holder); printf("/%%010.2f/, 1234.56\n"); snprintf(holder, sizeof holder, "/%010.2f/\n", 1234.56); printf("/%010.2f/\n", 1234.56); printf("%s\n", holder); #define BLURB "Outstanding acting !" /* strings precisions */ printf("/%%2s/, \"%s\"\n", BLURB); snprintf(holder, sizeof holder, "/%2s/\n", BLURB); printf("/%2s/\n", BLURB); printf("%s\n", holder); printf("/%%22s/ %s\n", BLURB); snprintf(holder, sizeof holder, "/%22s/\n", BLURB); printf("/%22s/\n", BLURB); printf("%s\n", holder); printf("/%%22.5s/ %s\n", BLURB); snprintf(holder, sizeof holder, "/%22.5s/\n", BLURB); printf("/%22.5s/\n", BLURB); printf("%s\n", holder); printf("/%%-22.5s/ %s\n", BLURB); snprintf(holder, sizeof holder, "/%-22.5s/\n", BLURB); printf("/%-22.5s/\n", BLURB); printf("%s\n", holder); /* see some flags */ printf("%%x %%X %%#x, 31, 31, 31\n"); snprintf(holder, sizeof holder, "%x %X %#x\n", 31, 31, 31); printf("%x %X %#x\n", 31, 31, 31); printf("%s\n", holder); printf("**%%d**%% d**%% d**, 42, 42, -42\n"); snprintf(holder, sizeof holder, "**%d**% d**% d**\n", 42, 42, -42); printf("**%d**% d**% d**\n", 42, 42, -42); printf("%s\n", holder); /* other flags */ printf("/%%g/, 31.4\n"); snprintf(holder, sizeof holder, "/%g/\n", 31.4); printf("/%g/\n", 31.4); printf("%s\n", holder); printf("/%%.6g/, 31.4\n"); snprintf(holder, sizeof holder, "/%.6g/\n", 31.4); printf("/%.6g/\n", 31.4); printf("%s\n", holder); printf("/%%.1G/, 31.4\n"); snprintf(holder, sizeof holder, "/%.1G/\n", 31.4); printf("/%.1G/\n", 31.4); printf("%s\n", holder); printf("abc%%n\n"); printf("abc%n", &i); printf("%d\n", i); snprintf(holder, sizeof holder, "abc%n", &i); printf("%s", holder); printf("%d\n\n", i); printf("%%*.*s --> 10.10\n"); snprintf(holder, sizeof holder, "%*.*s\n", 10, 10, BLURB); printf("%*.*s\n", 10, 10, BLURB); printf("%s\n", holder); printf("%%%%%%%%\n"); snprintf(holder, sizeof holder, "%%%%\n"); printf("%%%%\n"); printf("%s\n", holder); #define BIG "Hello this is a too big string for the buffer" /* printf("A buffer to small of 10, trying to put this:\n");*/ printf("<%%>, %s\n", BIG); i = snprintf(holder, 10, "%s\n", BIG); printf("<%s>\n", BIG); printf("<%s>\n", holder); } #endif cadaver-0.23.3/lib/neon/0000775000076400007640000000000011312007530014323 5ustar jortonjortoncadaver-0.23.3/lib/neon/ne_session.h0000664000076400007640000003512511153323035016653 0ustar jortonjorton/* HTTP session handling Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_SESSION_H #define NE_SESSION_H 1 #include #include "ne_ssl.h" #include "ne_uri.h" /* for ne_uri */ #include "ne_defs.h" #include "ne_socket.h" NE_BEGIN_DECLS typedef struct ne_session_s ne_session; /* Create a session to the given server, using the given scheme. If * "https" is passed as the scheme, SSL will be used to connect to the * server. */ ne_session *ne_session_create(const char *scheme, const char *hostname, unsigned int port); /* Finish an HTTP session */ void ne_session_destroy(ne_session *sess); /* Prematurely force the connection to be closed for the given * session. */ void ne_close_connection(ne_session *sess); /* Set the proxy server to be used for the session. This function * will override (remove) any proxy servers previously configured, and * must be called before any requests are created using this * session. */ void ne_session_proxy(ne_session *sess, const char *hostname, unsigned int port); /* Configure a SOCKS proxy server which will be used for the session. * The SOCKS protocol version 'vers' will be used to contact the * proxy at given 'hostname' and 'port'. * * If SOCKSv4 or v4a are used, username must be non-NULL. For v5, * username may be NULL, in which case, password is ignored. If * username is non-NULL, password must also be non-NULL. * * This function will override (remove) any proxy servers previously * configured, and must be called before any requests are created * using this session. */ void ne_session_socks_proxy(ne_session *sess, enum ne_sock_sversion vers, const char *hostname, unsigned int port, const char *username, const char *password); /* Configure use of proxy servers from any system-wide default sources * which are configured at build time. This function will override * (remove) any proxy servers previously configured, and must be * called before any requests are created using this session. The * 'flags' parameter must be zero. */ void ne_session_system_proxy(ne_session *sess, unsigned int flags); /* Defined session flags: */ typedef enum ne_session_flag_e { NE_SESSFLAG_PERSIST = 0, /* disable this flag to prevent use of * persistent connections. */ NE_SESSFLAG_ICYPROTO, /* enable this flag to enable support for * non-HTTP ShoutCast-style "ICY" responses. */ NE_SESSFLAG_SSLv2, /* disable this flag to disable support for * SSLv2, if supported by the SSL library. */ NE_SESSFLAG_RFC4918, /* enable this flag to enable support for * RFC4918-only WebDAV features; losing * backwards-compatibility with RFC2518 * servers. */ NE_SESSFLAG_CONNAUTH, /* enable this flag if an awful, broken, * RFC-violating, connection-based HTTP * authentication scheme is in use. */ NE_SESSFLAG_TLS_SNI, /* disable this flag to disable use of the * TLS Server Name Indication extension. */ NE_SESSFLAG_EXPECT100, /* enable this flag to enable the flag * NE_REQFLAG_EXPECT100 for new requests. */ NE_SESSFLAG_LAST /* enum sentinel value */ } ne_session_flag; /* Set a new value for a particular session flag. */ void ne_set_session_flag(ne_session *sess, ne_session_flag flag, int value); /* Return 0 if the given flag is not set, >0 it is set, or -1 if the * flag is not supported. */ int ne_get_session_flag(ne_session *sess, ne_session_flag flag); /* Bypass the normal name resolution; force the use of specific set of * addresses for this session, addrs[0]...addrs[n-1]. The 'addrs' * array and pointed-to objects must remain valid until the session is * destroyed. This function will override (remove) any proxy servers * previously configured, and must be called before any requests are * created using this session. */ void ne_set_addrlist(ne_session *sess, const ne_inet_addr **addrs, size_t n); /* Bind connections to the specified local address. If the address * determined for the remote host has a different family (type) to * 'addr', 'addr' will be ignored. The 'addr' object must remain * valid until the session is destroyed. */ void ne_set_localaddr(ne_session *sess, const ne_inet_addr *addr); /* DEPRECATED: Progress callback. */ typedef void (*ne_progress)(void *userdata, ne_off_t progress, ne_off_t total); /* DEPRECATED API: Set a progress callback for the session; this is * deprecated in favour of ne_set_notifier(). The progress callback * is invoked for after each block of the request and response body to * indicate request and response progress (there is no way to * distinguish between the two using this interface alone). * If progress is NULL, any existing callback is deregistered and will * no longer be invoked. * * NOTE: Use of this interface is mutually exclusive with the use of * ne_set_notifier(). A call to ne_set_progress() removes the * notifier callback, and vice versa. */ void ne_set_progress(ne_session *sess, ne_progress progress, void *userdata); /* Store an opaque context for the session, 'priv' is returned by a * call to ne_session_get_private with the same ID. */ void ne_set_session_private(ne_session *sess, const char *id, void *priv); void *ne_get_session_private(ne_session *sess, const char *id); /* Status event type. NOTE: More event types may be added in * subsequent releases, so callers must ignore unknown status types * for forwards-compatibility. */ typedef enum { ne_status_lookup = 0, /* looking up hostname */ ne_status_connecting, /* connecting to host */ ne_status_connected, /* connected to host */ ne_status_sending, /* sending a request body */ ne_status_recving, /* receiving a response body */ ne_status_disconnected /* disconnected from host */ } ne_session_status; /* Status event information union; the relevant structure within * corresponds to the event type. WARNING: the size of this union is * not limited by ABI constraint; it may be extended with additional * members of different size, or existing members may be extended. */ typedef union ne_session_status_info_u { struct /* ne_status_lookup */ { /* The hostname which is being resolved: */ const char *hostname; } lu; struct /* ne_status_connecting */ { /* The hostname and network address to which a connection * attempt is being made: */ const char *hostname; const ne_inet_addr *address; } ci; struct /* ne_status_connected, ne_status_disconnected */ { /* The hostname to which a connection has just been * established or closed: */ const char *hostname; } cd; struct /* ne_status_sending and ne_status_recving */ { /* Request/response body transfer progress; if total == -1, * the total size is unknown; otherwise, total gives the total * number of bytes which will be transferred. progress gives * the number of bytes transferred so far. */ ne_off_t progress, total; } sr; } ne_session_status_info; /* Callback invoked to notify a new session status event, given by the * 'status' argument. On invocation, the contents of exactly one of * the structures in the info union will be valid, as indicated * above. */ typedef void (*ne_notify_status)(void *userdata, ne_session_status status, const ne_session_status_info *info); /* Set a status notification callback for the session, to report * session status events. Only one notification callback per session * can be registered; the most recent of successive calls to this * function takes effect. If status is NULL, any existing callback * is deregistered and will no longer be invoked. * * NOTE: Use of this interface is mutually exclusive with the use of * ne_set_progress(). A call to ne_set_notifier() removes the * progress callback, and vice versa. */ void ne_set_notifier(ne_session *sess, ne_notify_status status, void *userdata); /* Certificate verification failures. */ /* NE_SSL_NOTYETVALID: the certificate is not yet valid. */ #define NE_SSL_NOTYETVALID (0x01) /* NE_SSL_EXPIRED: the certificate has expired. */ #define NE_SSL_EXPIRED (0x02) /* NE_SSL_IDMISMATCH: the hostname for which the certificate was * issued does not match the hostname of the server; this could mean * that the connection is being intercepted. */ #define NE_SSL_IDMISMATCH (0x04) /* NE_SSL_UNTRUSTED: the certificate authority which signed the server * certificate is not trusted: there is no indicatation the server is * who they claim to be: */ #define NE_SSL_UNTRUSTED (0x08) /* NE_SSL_BADCHAIN: the certificate chain contained a certificate * other than the server cert which failed verification for a reason * other than lack of trust; for example, due to a CA cert being * outside its validity period. */ #define NE_SSL_BADCHAIN (0x10) /* N.B.: 0x20 is reserved. */ /* NE_SSL_REVOKED: the server certificate has been revoked by the * issuing authority. */ #define NE_SSL_REVOKED (0x40) /* For purposes of forwards-compatibility, the bitmask of all * currently exposed failure bits is given as NE_SSL_FAILMASK. If the * expression (failures & ~NE_SSL_FAILMASK) is non-zero a failure type * is present which the application does not recognize but must treat * as a verification failure nonetheless. */ #define NE_SSL_FAILMASK (0x5f) /* A callback which is used when server certificate verification is * needed. The reasons for verification failure are given in the * 'failures' parameter, which is a binary OR of one or more of the * above NE_SSL_* values. failures is guaranteed to be non-zero. The * callback must return zero to accept the certificate: a non-zero * return value will fail the SSL negotiation. */ typedef int (*ne_ssl_verify_fn)(void *userdata, int failures, const ne_ssl_certificate *cert); /* Install a callback to handle server certificate verification. This * is required when the CA certificate is not known for the server * certificate, or the server cert has other verification problems. */ void ne_ssl_set_verify(ne_session *sess, ne_ssl_verify_fn fn, void *userdata); /* Use the given client certificate for the session. The client cert * MUST be in the decrypted state, otherwise behaviour is undefined. * The 'clicert' object is duplicated internally so can be destroyed * by the caller. */ void ne_ssl_set_clicert(ne_session *sess, const ne_ssl_client_cert *clicert); /* Indicate that the certificate 'cert' is trusted; the 'cert' object * is duplicated internally so can be destroyed by the caller. This * function has no effect for non-SSL sessions. */ void ne_ssl_trust_cert(ne_session *sess, const ne_ssl_certificate *cert); /* If the SSL library provided a default set of CA certificates, trust * this set of CAs. */ void ne_ssl_trust_default_ca(ne_session *sess); /* Callback used to load a client certificate on demand. If dncount * is > 0, the 'dnames' array dnames[0] through dnames[dncount-1] * gives the list of CA names which the server indicated were * acceptable. The callback should load an appropriate client * certificate and then pass it to 'ne_ssl_set_clicert'. */ typedef void (*ne_ssl_provide_fn)(void *userdata, ne_session *sess, const ne_ssl_dname *const *dnames, int dncount); /* Register a function to be called when the server requests a client * certificate. */ void ne_ssl_provide_clicert(ne_session *sess, ne_ssl_provide_fn fn, void *userdata); /* Set the timeout (in seconds) used when reading from a socket. The * timeout value must be greater than zero. */ void ne_set_read_timeout(ne_session *sess, int timeout); /* Set the timeout (in seconds) used when making a connection. The * timeout value must be greater than zero. */ void ne_set_connect_timeout(ne_session *sess, int timeout); /* Sets the user-agent string. neon/VERSION will be appended, to make * the full header "User-Agent: product neon/VERSION". * If this function is not called, the User-Agent header is not sent. * The product string must follow the RFC2616 format, i.e. * product = token ["/" product-version] * product-version = token * where token is any alpha-numeric-y string [a-zA-Z0-9]* */ void ne_set_useragent(ne_session *sess, const char *product); /* Returns non-zero if next-hop server does not claim compliance to * HTTP/1.1 or later. */ int ne_version_pre_http11(ne_session *sess); /* Returns the 'hostport' URI segment for the end-server, e.g. * "my.server.com:8080". */ const char *ne_get_server_hostport(ne_session *sess); /* Returns the URL scheme being used for the current session, omitting * the trailing ':'; e.g. "http" or "https". */ const char *ne_get_scheme(ne_session *sess); /* Sets the host, scheme, and port fields of the given URI structure * to that of the configured server and scheme for the session; host * and scheme are malloc-allocated. No other fields in the URI * structure are changed. */ void ne_fill_server_uri(ne_session *sess, ne_uri *uri); /* If a proxy is configured, sets the host and port fields in the * given URI structure to that of the proxy. If multiple proxies are * configured, the active is used if any, otherwise the first. The * hostname is malloc-allocated. No other fields in the URI structure * are changed; if no proxy is configured or a non-HTTP proxy is in * use, no fields are changed. */ void ne_fill_proxy_uri(ne_session *sess, ne_uri *uri); /* Set the error string for the session; takes printf-like format * string. */ void ne_set_error(ne_session *sess, const char *format, ...) ne_attribute((format (printf, 2, 3))); /* Retrieve the error string for the session */ const char *ne_get_error(ne_session *sess); NE_END_DECLS #endif /* NE_SESSION_H */ cadaver-0.23.3/lib/neon/ne_basic.h0000664000076400007640000001400411135622640016246 0ustar jortonjorton/* HTTP/1.1 methods Copyright (C) 1999-2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_BASIC_H #define NE_BASIC_H #include /* for time_t */ #include "ne_request.h" NE_BEGIN_DECLS /* Perform a GET request on resource at 'path', writing the entity * body which is returned to 'fd'. */ int ne_get(ne_session *sess, const char *path, int fd); /* Perform a PUT request on resource at 'path', reading the entity * body to submit from 'fd'. */ int ne_put(ne_session *sess, const char *path, int fd); #define NE_DEPTH_ZERO (0) #define NE_DEPTH_ONE (1) #define NE_DEPTH_INFINITE (2) /* For ne_copy and ne_move: * * If a resource exists at "dest" and overwrite is zero, the operation * will fail; if overwrite is non-zero, any existing resource will * be over-written. */ /* Copy resource from 'src to 'dest' paths. If 'src' identifies a * collection resource, depth may be NE_DEPTH_ZERO to request that the * collection and its properties are to be copied, or * NE_DEPTH_INFINITE to request that the collection and its contents * are to be copied. Returns NE_* error code. */ int ne_copy(ne_session *sess, int overwrite, int depth, const char *src, const char *dest); /* Move resource from 'src' to 'dest' path. Returns NE_* error * code. */ int ne_move(ne_session *sess, int overwrite, const char *src, const char *dest); /* Delete resource at 'path'. Returns NE_* error code. */ int ne_delete(ne_session *sess, const char *path); /* Create a collection at 'path', which is required to have a trailing * slash. Returns NE_* error code. */ int ne_mkcol(ne_session *sess, const char *path); /* Adds a Depth: header to a request. */ void ne_add_depth_header(ne_request *req, int depth); /* Retrieve modification time of resource at location 'path', using * the HEAD method, placing parsed time in *modtime. *modtime is set * to -1 if no Last-Modified response header was given, or the date * given could not be parsed. Returns NE_* error code. */ int ne_getmodtime(ne_session *sess, const char *path, time_t *modtime); typedef struct { const char *type, *subtype; const char *charset; char *value; } ne_content_type; /* Retrieve the content-type of the response; returns zero if response * had valid content-type, in which case all fields in *ctype are set * (and never NULL); the caller must free(ctype->value) after use. * Returns non-zero on error, in which case *ctype is not altered. */ int ne_get_content_type(ne_request *req, ne_content_type *ctype); /* DEPRECATED: Server capabilities. */ typedef struct { unsigned int dav_class1; /* True if Class 1 WebDAV server */ unsigned int dav_class2; /* True if Class 2 WebDAV server */ unsigned int dav_executable; /* True if supports the 'executable' * property a. la. mod_dav */ } ne_server_capabilities; /* DEPRECATED: Determines server capabilities (using OPTIONS). */ int ne_options(ne_session *sess, const char *path, ne_server_capabilities *caps); #define NE_CAP_DAV_CLASS1 (0x0001) /* Class 1 WebDAV (RFC 2518) */ #define NE_CAP_DAV_CLASS2 (0x0002) /* Class 2 WebDAV (RFC 2518) */ #define NE_CAP_DAV_CLASS3 (0x0004) /* Class 3 WebDAV (RFC 4918) */ #define NE_CAP_MODDAV_EXEC (0x0008) /* mod_dav "executable" property */ #define NE_CAP_DAV_ACL (0x0010) /* WebDAV ACL (RFC 3744) */ #define NE_CAP_VER_CONTROL (0x0020) /* DeltaV version-control */ #define NE_CAP_CO_IN_PLACE (0x0040) /* DeltaV checkout-in-place */ #define NE_CAP_VER_HISTORY (0x0080) /* DeltaV version-history */ #define NE_CAP_WORKSPACE (0x0100) /* DeltaV workspace */ #define NE_CAP_UPDATE (0x0200) /* DeltaV update */ #define NE_CAP_LABEL (0x0400) /* DeltaV label */ #define NE_CAP_WORK_RESOURCE (0x0800) /* DeltaV working-resouce */ #define NE_CAP_MERGE (0x1000) /* DeltaV merge */ #define NE_CAP_BASELINE (0x2000) /* DeltaV baseline */ #define NE_CAP_ACTIVITY (0x4000) /* DeltaV activity */ #define NE_CAP_VC_COLLECTION (0x8000) /* DeltaV version-controlled-collection */ /* Determines resource capailities, using an OPTIONS request. On * return, *caps is set to a bit-mask of the above NE_CAP_* constants * describing the advertised resource capabilities. */ int ne_options2(ne_session *sess, const char *path, unsigned int *caps); /* Defines a range of bytes, starting at 'start' and ending * at 'end'. 'total' is the number of bytes in the range. */ typedef struct { ne_off_t start, end, total; } ne_content_range; /* Partial GET. range->start must be >= 0. range->total is ignored. * * If range->end is -1, then the rest of the resource from start is * requested, and range->total and end are filled in on success. * * Otherwise, bytes from range->start to range->end are requested. * * This will write to the CURRENT position of f; so if you want * to do a resume download, use: * struct ne_content_range range; * range.start = resume_from; * range.end = range.start + 999; (= 1000 bytes) * fseek(myfile, resume_from, SEEK_SET); * ne_get_range(sess, path, &range, myfile); */ int ne_get_range(ne_session *sess, const char *path, ne_content_range *range, int fd); /* Post using buffer as request-body: stream response into f */ int ne_post(ne_session *sess, const char *path, int fd, const char *buffer); NE_END_DECLS #endif /* NE_BASIC_H */ cadaver-0.23.3/lib/neon/ne_uri.c0000664000076400007640000004221510725502717015772 0ustar jortonjorton/* URI manipulation routines. Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include #include #include "ne_string.h" /* for ne_buffer */ #include "ne_alloc.h" #include "ne_uri.h" /* URI ABNF from RFC 3986: */ #define PS (0x0001) /* "+" */ #define PC (0x0002) /* "%" */ #define DS (0x0004) /* "-" */ #define DT (0x0008) /* "." */ #define US (0x0010) /* "_" */ #define TD (0x0020) /* "~" */ #define FS (0x0040) /* "/" */ #define CL (0x0080) /* ":" */ #define AT (0x0100) /* "@" */ #define QU (0x0200) /* "?" */ #define DG (0x0400) /* DIGIT */ #define AL (0x0800) /* ALPHA */ #define GD (0x1000) /* gen-delims = "#" / "[" / "]" * ... except ":", "/", "@", and "?" */ #define SD (0x2000) /* sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" * ... except "+" which is PS */ #define OT (0x4000) /* others */ #define URI_ALPHA (AL) #define URI_DIGIT (DG) /* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" */ #define URI_UNRESERVED (AL | DG | DS | DT | US | TD) /* scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) */ #define URI_SCHEME (AL | DG | PS | DS | DT) /* real sub-delims definition, including "+" */ #define URI_SUBDELIM (PS | SD) /* real gen-delims definition, including ":", "/", "@" and "?" */ #define URI_GENDELIM (GD | CL | FS | AT | QU) /* userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) */ #define URI_USERINFO (URI_UNRESERVED | PC | URI_SUBDELIM | CL) /* pchar = unreserved / pct-encoded / sub-delims / ":" / "@" */ #define URI_PCHAR (URI_UNRESERVED | PC | URI_SUBDELIM | CL | AT) /* invented: segchar = pchar / "/" */ #define URI_SEGCHAR (URI_PCHAR | FS) /* query = *( pchar / "/" / "?" ) */ #define URI_QUERY (URI_PCHAR | FS | QU) /* fragment == query */ #define URI_FRAGMENT URI_QUERY /* any characters which should be path-escaped: */ #define URI_ESCAPE ((URI_GENDELIM & ~(FS)) | URI_SUBDELIM | OT | PC) static const unsigned int uri_chars[256] = { /* 0xXX x0 x2 x4 x6 x8 xA xC xE */ /* 0x */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* 1x */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* 2x */ OT, SD, OT, GD, SD, PC, SD, SD, SD, SD, SD, PS, SD, DS, DT, FS, /* 3x */ DG, DG, DG, DG, DG, DG, DG, DG, DG, DG, CL, SD, OT, SD, OT, QU, /* 4x */ AT, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, /* 5x */ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, GD, OT, GD, OT, US, /* 6x */ OT, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, /* 7x */ AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, OT, OT, OT, TD, OT, /* 8x */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* 9x */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* Ax */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* Bx */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* Cx */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* Dx */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* Ex */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, /* Fx */ OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT, OT }; #define uri_lookup(ch) (uri_chars[(unsigned char)ch]) char *ne_path_parent(const char *uri) { size_t len = strlen(uri); const char *pnt = uri + len - 1; /* skip trailing slash (parent of "/foo/" is "/") */ if (pnt >= uri && *pnt == '/') pnt--; /* find previous slash */ while (pnt > uri && *pnt != '/') pnt--; if (pnt < uri || (pnt == uri && *pnt != '/')) return NULL; return ne_strndup(uri, pnt - uri + 1); } int ne_path_has_trailing_slash(const char *uri) { size_t len = strlen(uri); return ((len > 0) && (uri[len-1] == '/')); } unsigned int ne_uri_defaultport(const char *scheme) { /* RFC2616/3.2.3 says use case-insensitive comparisons here. */ if (ne_strcasecmp(scheme, "http") == 0) return 80; else if (ne_strcasecmp(scheme, "https") == 0) return 443; else return 0; } int ne_uri_parse(const char *uri, ne_uri *parsed) { const char *p, *s; memset(parsed, 0, sizeof *parsed); p = s = uri; /* => s = p = URI-reference */ if (uri_lookup(*p) & URI_ALPHA) { while (uri_lookup(*p) & URI_SCHEME) p++; if (*p == ':') { parsed->scheme = ne_strndup(uri, p - s); s = p + 1; } } /* => s = heir-part, or s = relative-part */ if (s[0] == '/' && s[1] == '/') { const char *pa; /* => s = "//" authority path-abempty (from expansion of * either heir-part of relative-part) */ /* authority = [ userinfo "@" ] host [ ":" port ] */ s = pa = s + 2; /* => s = authority */ while (*pa != '/' && *pa != '\0') pa++; /* => pa = path-abempty */ p = s; while (p < pa && uri_lookup(*p) & URI_USERINFO) p++; if (*p == '@') { parsed->userinfo = ne_strndup(s, p - s); s = p + 1; } /* => s = host */ if (s[0] == '[') { p = s + 1; while (*p != ']' && p < pa) p++; if (p == pa || (p + 1 != pa && p[1] != ':')) { /* Ill-formed IP-literal. */ return -1; } p++; /* => p = colon */ } else { /* Find the colon. */ p = pa; while (*p != ':' && p > s) p--; } if (p == s) { p = pa; /* No colon; => p = path-abempty */ } else if (p + 1 != pa) { /* => p = colon */ parsed->port = atoi(p + 1); } parsed->host = ne_strndup(s, p - s); s = pa; if (*s == '\0') { s = "/"; /* FIXME: scheme-specific. */ } } /* => s = path-abempty / path-absolute / path-rootless * / path-empty / path-noscheme */ p = s; while (uri_lookup(*p) & URI_SEGCHAR) p++; /* => p = [ "?" query ] [ "#" fragment ] */ parsed->path = ne_strndup(s, p - s); if (*p != '\0') { s = p++; while (uri_lookup(*p) & URI_QUERY) p++; /* => p = [ "#" fragment ] */ /* => s = [ "?" query ] [ "#" fragment ] */ if (*s == '?') { parsed->query = ne_strndup(s + 1, p - s - 1); if (*p != '\0') { s = p++; while (uri_lookup(*p) & URI_FRAGMENT) p++; } } /* => p now points to the next character after the * URI-reference; which should be the NUL byte. */ if (*s == '#') { parsed->fragment = ne_strndup(s + 1, p - s - 1); } else if (*p || *s != '?') { return -1; } } return 0; } /* This function directly implements the "Merge Paths" algorithm * described in RFC 3986 section 5.2.3. */ static char *merge_paths(const ne_uri *base, const char *path) { const char *p; if (base->host && base->path[0] == '\0') { return ne_concat("/", path, NULL); } p = strrchr(base->path, '/'); if (p == NULL) { return ne_strdup(path); } else { size_t len = p - base->path + 1; char *ret = ne_malloc(strlen(path) + len + 1); memcpy(ret, base->path, len); memcpy(ret + len, path, strlen(path) + 1); return ret; } } /* This function directly implements the "Remove Dot Segments" * algorithm described in RFC 3986 section 5.2.4. */ static char *remove_dot_segments(const char *path) { char *in, *inc, *out; inc = in = ne_strdup(path); out = ne_malloc(strlen(path) + 1); out[0] = '\0'; while (in[0]) { /* case 2.A: */ if (strncmp(in, "./", 2) == 0) { in += 2; } else if (strncmp(in, "../", 3) == 0) { in += 3; } /* case 2.B: */ else if (strncmp(in, "/./", 3) == 0) { in += 2; } else if (strcmp(in, "/.") == 0) { in[1] = '\0'; } /* case 2.C: */ else if (strncmp(in, "/../", 4) == 0 || strcmp(in, "/..") == 0) { char *p; /* Make the next character in the input buffer a "/": */ if (in[3] == '\0') { /* terminating "/.." case */ in += 2; in[0] = '/'; } else { /* "/../" prefix case */ in += 3; } /* Trim the last component from the output buffer, or * empty it. */ p = strrchr(out, '/'); if (p) { *p = '\0'; } else { out[0] = '\0'; } } /* case 2.D: */ else if (strcmp(in, ".") == 0 || strcmp(in, "..") == 0) { in[0] = '\0'; } /* case 2.E */ else { char *p; /* Search for the *second* "/" if the leading character is * already "/": */ p = strchr(in + (in[0] == '/'), '/'); /* Otherwise, copy the whole string */ if (p == NULL) p = strchr(in, '\0'); strncat(out, in, p - in); in = p; } } ne_free(inc); return out; } /* Copy authority components from 'src' to 'dest' if defined. */ static void copy_authority(ne_uri *dest, const ne_uri *src) { if (src->host) dest->host = ne_strdup(src->host); dest->port = src->port; if (src->userinfo) dest->userinfo = ne_strdup(src->userinfo); } /* This function directly implements the "Transform References" * algorithm described in RFC 3986 section 5.2.2. */ ne_uri *ne_uri_resolve(const ne_uri *base, const ne_uri *relative, ne_uri *target) { memset(target, 0, sizeof *target); if (relative->scheme) { target->scheme = ne_strdup(relative->scheme); copy_authority(target, relative); target->path = remove_dot_segments(relative->path); if (relative->query) target->query = ne_strdup(relative->query); } else { if (relative->host) { copy_authority(target, relative); target->path = remove_dot_segments(relative->path); if (relative->query) target->query = ne_strdup(relative->query); } else { if (relative->path[0] == '\0') { target->path = ne_strdup(base->path); if (relative->query) { target->query = ne_strdup(relative->query); } else if (base->query) { target->query = ne_strdup(base->query); } } else { if (relative->path[0] == '/') { target->path = remove_dot_segments(relative->path); } else { char *merged = merge_paths(base, relative->path); target->path = remove_dot_segments(merged); ne_free(merged); } if (relative->query) target->query = ne_strdup(relative->query); } copy_authority(target, base); } if (base->scheme) target->scheme = ne_strdup(base->scheme); } if (relative->fragment) target->fragment = ne_strdup(relative->fragment); return target; } ne_uri *ne_uri_copy(ne_uri *dest, const ne_uri *src) { memset(dest, 0, sizeof *dest); if (src->scheme) dest->scheme = ne_strdup(src->scheme); copy_authority(dest, src); if (src->path) dest->path = ne_strdup(src->path); if (src->query) dest->query = ne_strdup(src->query); if (src->fragment) dest->fragment = ne_strdup(src->fragment); return dest; } void ne_uri_free(ne_uri *u) { if (u->host) ne_free(u->host); if (u->path) ne_free(u->path); if (u->scheme) ne_free(u->scheme); if (u->userinfo) ne_free(u->userinfo); if (u->fragment) ne_free(u->fragment); if (u->query) ne_free(u->query); memset(u, 0, sizeof *u); } char *ne_path_unescape(const char *uri) { const char *pnt; char *ret, *retpos, buf[5] = { "0x00" }; retpos = ret = ne_malloc(strlen(uri) + 1); for (pnt = uri; *pnt != '\0'; pnt++) { if (*pnt == '%') { if (!isxdigit((unsigned char) pnt[1]) || !isxdigit((unsigned char) pnt[2])) { /* Invalid URI */ ne_free(ret); return NULL; } buf[2] = *++pnt; buf[3] = *++pnt; /* bit faster than memcpy */ *retpos++ = (char)strtol(buf, NULL, 16); } else { *retpos++ = *pnt; } } *retpos = '\0'; return ret; } /* CH must be an unsigned char; evaluates to 1 if CH should be * percent-encoded. */ #define path_escape_ch(ch) (uri_lookup(ch) & URI_ESCAPE) char *ne_path_escape(const char *path) { const unsigned char *pnt; char *ret, *p; size_t count = 0; for (pnt = (const unsigned char *)path; *pnt != '\0'; pnt++) { count += path_escape_ch(*pnt); } if (count == 0) { return ne_strdup(path); } p = ret = ne_malloc(strlen(path) + 2 * count + 1); for (pnt = (const unsigned char *)path; *pnt != '\0'; pnt++) { if (path_escape_ch(*pnt)) { /* Escape it - % */ sprintf(p, "%%%02x", (unsigned char) *pnt); p += 3; } else { *p++ = *pnt; } } *p = '\0'; return ret; } #undef path_escape_ch #define CMPWITH(field, func) \ do { \ if (u1->field) { \ if (!u2->field) return -1; \ n = func(u1->field, u2->field); \ if (n) return n; \ } else if (u2->field) { \ return 1; \ } \ } while (0) #define CMP(field) CMPWITH(field, strcmp) #define CASECMP(field) CMPWITH(field, ne_strcasecmp) /* As specified by RFC 2616, section 3.2.3. */ int ne_uri_cmp(const ne_uri *u1, const ne_uri *u2) { int n; CMP(path); CASECMP(host); CASECMP(scheme); CMP(query); CMP(fragment); CMP(userinfo); return u2->port - u1->port; } #undef CMP #undef CASECMP #undef CMPWITH /* TODO: implement properly */ int ne_path_compare(const char *a, const char *b) { int ret = ne_strcasecmp(a, b); if (ret) { /* This logic says: "If the lengths of the two URIs differ by * exactly one, and the LONGER of the two URIs has a trailing * slash and the SHORTER one DOESN'T, then..." */ int traila = ne_path_has_trailing_slash(a), trailb = ne_path_has_trailing_slash(b), lena = strlen(a), lenb = strlen(b); if (traila != trailb && abs(lena - lenb) == 1 && ((traila && lena > lenb) || (trailb && lenb > lena))) { /* Compare them, ignoring the trailing slash on the longer * URI */ if (strncasecmp(a, b, lena < lenb ? lena : lenb) == 0) ret = 0; } } return ret; } char *ne_uri_unparse(const ne_uri *uri) { ne_buffer *buf = ne_buffer_create(); if (uri->scheme) { ne_buffer_concat(buf, uri->scheme, ":", NULL); } if (uri->host) { ne_buffer_czappend(buf, "//"); if (uri->userinfo) { ne_buffer_concat(buf, uri->userinfo, "@", NULL); } ne_buffer_zappend(buf, uri->host); if (uri->port > 0 && (!uri->scheme || ne_uri_defaultport(uri->scheme) != uri->port)) { char str[20]; ne_snprintf(str, 20, ":%d", uri->port); ne_buffer_zappend(buf, str); } } ne_buffer_zappend(buf, uri->path); if (uri->query) { ne_buffer_concat(buf, "?", uri->query, NULL); } if (uri->fragment) { ne_buffer_concat(buf, "#", uri->fragment, NULL); } return ne_buffer_finish(buf); } /* Give it a path segment, it returns non-zero if child is * a child of parent. */ int ne_path_childof(const char *parent, const char *child) { char *root = ne_strdup(child); int ret; if (strlen(parent) >= strlen(child)) { ret = 0; } else { /* root is the first of child, equal to length of parent */ root[strlen(parent)] = '\0'; ret = (ne_path_compare(parent, root) == 0); } ne_free(root); return ret; } cadaver-0.23.3/lib/neon/ne_acl.h0000664000076400007640000000265711075203020015725 0ustar jortonjorton/* Access control Copyright (C) 2001-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* * DEPRECATED ACL Interface. See ne_acl3744.h for replacement API. */ #ifndef NE_ACL_H #define NE_ACL_H #include "ne_session.h" NE_BEGIN_DECLS typedef struct { enum { ne_acl_href, ne_acl_property, ne_acl_all } apply; enum { ne_acl_grant, ne_acl_deny } type; char *principal; int read; int read_acl; int write; int write_acl; int read_cuprivset; } ne_acl_entry; /* Set the ACL for the given resource to the list of ACL entries. */ int ne_acl_set(ne_session *sess, const char *uri, const ne_acl_entry entries[], int numentries); NE_END_DECLS #endif /* NE_ACL_H */ cadaver-0.23.3/lib/neon/ne_pkcs11.h0000664000076400007640000001131410752606553016301 0ustar jortonjorton/* PKCS#11 support for neon Copyright (C) 2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_PKCS11_H #define NE_PKCS11_H 1 #include "ne_defs.h" #include "ne_session.h" NE_BEGIN_DECLS typedef struct ne_ssl_pkcs11_provider_s ne_ssl_pkcs11_provider; #define NE_PK11_OK (0) #define NE_PK11_NOTIMPL (-1) #define NE_PK11_FAILED (-2) /* Initialize a PKCS#11 provider of given name. Returns NE_OK on * success, NE_PK11_FAILED if the provider could not be * loaded/initialized, and NE_PK11_NOTIMPL if PKCS#11 is not * supported. On success, *provider is set to non-NULL. */ int ne_ssl_pkcs11_provider_init(ne_ssl_pkcs11_provider **provider, const char *name); /* Initialize a NSS softoken pseudo-PKCS#11 provider of given name * (e.g. "softokn3") to supply a client certificate if requested, * using database in given directory name; the other parameters may be * NULL. Returns NE_OK on success, NE_PK11_FAILED if the provider * could not be loaded/initialized, and NE_PK11_NOTIMPL if PKCS#11 is * not supported. On success, *provider is set to non-NULL. */ int ne_ssl_pkcs11_nss_provider_init(ne_ssl_pkcs11_provider **provider, const char *name, const char *directory, const char *cert_prefix, const char *key_prefix, const char *secmod_db); /* Destroy a PKCS#11 provider object. */ void ne_ssl_pkcs11_provider_destroy(ne_ssl_pkcs11_provider *provider); /* Flags passed to PIN entry callback: */ #define NE_SSL_P11PIN_COUNT_LOW (0x01) /* an incorrect PIN has been * entered. */ #define NE_SSL_P11PIN_FINAL_TRY (0x02) /* token will become locked if * entered PIN is incorrect */ /* Size of buffer passed to PIN entry callback: */ #define NE_SSL_P11PINLEN (256) /* Callback for PKCS#11 PIN entry. The callback provides the PIN code * to unlock the token with label 'token_label' in the slot described * by 'slot_descr'. * * The PIN code, as a NUL-terminated ASCII string, should be copied * into the 'pin' buffer (of fixed length NE_SSL_P11PINLEN), and * return 0 to indicate success. Alternatively, the callback may * return -1 to indicate failure and cancel PIN entry (in which case, * the contents of the 'pin' parameter are ignored). * * When a PIN is required, the callback will be invoked repeatedly * (and indefinitely) until either the returned PIN code is correct, * the callback returns failure, or the token refuses login (e.g. when * the token is locked due to too many incorrect PINs!). For the * first such invocation, the 'attempt' counter will have value zero; * it will increase by one for each subsequent attempt. * * The NE_SSL_P11PIN_COUNT_LOW and/or NE_SSL_P11PIN_FINAL_TRY hints * may be set in the 'flags' argument, if these hints are made * available by the token; not all tokens expose these hints. */ typedef int (*ne_ssl_pkcs11_pin_fn)(void *userdata, int attempt, const char *slot_descr, const char *token_label, unsigned int flags, char *pin); /* Set the PIN entry callback for the given provider. This is * necessary for some (but not all) types of token. For tokens which * implement an out-of-band ("protected") authentication path, the PIN * entry callback will not be invoked. */ void ne_ssl_pkcs11_provider_pin(ne_ssl_pkcs11_provider *provider, ne_ssl_pkcs11_pin_fn fn, void *userdata); /* Set up a given PKCS#11 provider to supply an appropriate client * certificate if requested by the server. A provider may be * configured for use in multiple sessions. */ void ne_ssl_set_pkcs11_provider(ne_session *sess, ne_ssl_pkcs11_provider *provider); NE_END_DECLS #endif /* NE_PKCS11_H */ cadaver-0.23.3/lib/neon/README0000664000076400007640000000072011040461043015203 0ustar jortonjorton This is the source directory of the 'neon' HTTP/WebDAV client library, which can be bundled inside other packages. For the complete neon package, see: http://www.webdav.org/neon/ This source directory may be distributed and/or modified under the terms of the GNU Library General Public License, as given in COPYING.LIB. Please send questions, bug reports, feature requests, etc, regarding the neon library, to the mailing list at: neon@lists.manyfish.co.uk cadaver-0.23.3/lib/neon/ne_props.c0000664000076400007640000004467210750123773016346 0ustar jortonjorton/* WebDAV property manipulation Copyright (C) 2000-2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "ne_alloc.h" #include "ne_xml.h" #include "ne_props.h" #include "ne_basic.h" #include "ne_locks.h" #include "ne_internal.h" /* don't store flat props with a value > 10K */ #define MAX_FLATPROP_LEN (102400) struct ne_propfind_handler_s { ne_session *sess; ne_request *request; int has_props; /* whether we've already written some * props to the body. */ ne_buffer *body; ne_207_parser *parser207; ne_xml_parser *parser; /* Creator/destructor callbacks. */ ne_props_create_complex creator; ne_props_destroy_complex destructor; void *cd_userdata; /* Current propset, or NULL if none being processed. */ ne_prop_result_set *current; ne_buffer *value; /* current flat property value */ int depth; /* nesting depth within a flat property */ ne_props_result callback; void *userdata; }; #define ELM_flatprop (NE_207_STATE_TOP - 1) /* We build up the results of one 'response' element in memory. */ struct prop { char *name, *nspace, *value, *lang; /* Store a ne_propname here too, for convienience. pname.name = * name, pname.nspace = nspace, but they are const'ed in pname. */ ne_propname pname; }; #define NSPACE(x) ((x) ? (x) : "") struct propstat { struct prop *props; int numprops; ne_status status; }; /* Results set. */ struct ne_prop_result_set_s { struct propstat *pstats; int numpstats, counter; void *private; ne_uri uri; }; #define MAX_PROP_COUNTER (1024) static int startelm(void *userdata, int state, const char *name, const char *nspace, const char **atts); static int endelm(void *userdata, int state, const char *name, const char *nspace); /* Handle character data; flat property value. */ static int chardata(void *userdata, int state, const char *data, size_t len) { ne_propfind_handler *hdl = userdata; if (state == ELM_flatprop && hdl->value->length < MAX_FLATPROP_LEN) ne_buffer_append(hdl->value, data, len); return 0; } ne_xml_parser *ne_propfind_get_parser(ne_propfind_handler *handler) { return handler->parser; } ne_request *ne_propfind_get_request(ne_propfind_handler *handler) { return handler->request; } static int propfind(ne_propfind_handler *handler, ne_props_result results, void *userdata) { int ret; ne_request *req = handler->request; /* Register the flat property handler to catch any properties * which the user isn't handling as 'complex'. */ ne_xml_push_handler(handler->parser, startelm, chardata, endelm, handler); handler->callback = results; handler->userdata = userdata; ne_set_request_body_buffer(req, handler->body->data, ne_buffer_size(handler->body)); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); ne_add_response_body_reader(req, ne_accept_207, ne_xml_parse_v, handler->parser); ret = ne_request_dispatch(req); if (ret == NE_OK && ne_get_status(req)->klass != 2) { ret = NE_ERROR; } else if (ne_xml_failed(handler->parser)) { ne_set_error(handler->sess, "%s", ne_xml_get_error(handler->parser)); ret = NE_ERROR; } return ret; } static void set_body(ne_propfind_handler *hdl, const ne_propname *names) { ne_buffer *body = hdl->body; int n; if (!hdl->has_props) { ne_buffer_czappend(body, "\n"); hdl->has_props = 1; } for (n = 0; names[n].name != NULL; n++) { ne_buffer_concat(body, "<", names[n].name, " xmlns=\"", NSPACE(names[n].nspace), "\"/>\n", NULL); } } int ne_propfind_allprop(ne_propfind_handler *handler, ne_props_result results, void *userdata) { ne_buffer_czappend(handler->body, "\n"); return propfind(handler, results, userdata); } int ne_propfind_named(ne_propfind_handler *handler, const ne_propname *props, ne_props_result results, void *userdata) { set_body(handler, props); ne_buffer_czappend(handler->body, "\n"); return propfind(handler, results, userdata); } /* The easy one... PROPPATCH */ int ne_proppatch(ne_session *sess, const char *uri, const ne_proppatch_operation *items) { ne_request *req = ne_request_create(sess, "PROPPATCH", uri); ne_buffer *body = ne_buffer_create(); int n, ret; /* Create the request body */ ne_buffer_czappend(body, "\n" ""); for (n = 0; items[n].name != NULL; n++) { const char *elm = (items[n].type == ne_propset) ? "set" : "remove"; /* value */ ne_buffer_concat(body, "" "<", items[n].name->name, NULL); if (items[n].name->nspace) { ne_buffer_concat(body, " xmlns=\"", items[n].name->nspace, "\"", NULL); } if (items[n].type == ne_propset) { ne_buffer_concat(body, ">", items[n].value, NULL); } else { ne_buffer_append(body, ">", 1); } ne_buffer_concat(body, "name, ">\n", NULL); } ne_buffer_czappend(body, "\n"); ne_set_request_body_buffer(req, body->data, ne_buffer_size(body)); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); #ifdef NE_HAVE_DAV ne_lock_using_resource(req, uri, NE_DEPTH_ZERO); #endif ret = ne_simple_request(sess, req); ne_buffer_destroy(body); return ret; } /* Compare two property names. */ static int pnamecmp(const ne_propname *pn1, const ne_propname *pn2) { if (pn1->nspace == NULL && pn2->nspace != NULL) { return 1; } else if (pn1->nspace != NULL && pn2->nspace == NULL) { return -1; } else if (pn1->nspace == NULL) { return strcmp(pn1->name, pn2->name); } else { return (strcmp(pn1->nspace, pn2->nspace) || strcmp(pn1->name, pn2->name)); } } /* Find property in 'set' with name 'pname'. If found, set pstat_ret * to the containing propstat, likewise prop_ret, and returns zero. * If not found, returns non-zero. */ static int findprop(const ne_prop_result_set *set, const ne_propname *pname, struct propstat **pstat_ret, struct prop **prop_ret) { int ps, p; for (ps = 0; ps < set->numpstats; ps++) { for (p = 0; p < set->pstats[ps].numprops; p++) { struct prop *prop = &set->pstats[ps].props[p]; if (pnamecmp(&prop->pname, pname) == 0) { if (pstat_ret != NULL) *pstat_ret = &set->pstats[ps]; if (prop_ret != NULL) *prop_ret = prop; return 0; } } } return -1; } const char *ne_propset_value(const ne_prop_result_set *set, const ne_propname *pname) { struct prop *prop; if (findprop(set, pname, NULL, &prop)) { return NULL; } else { return prop->value; } } const char *ne_propset_lang(const ne_prop_result_set *set, const ne_propname *pname) { struct prop *prop; if (findprop(set, pname, NULL, &prop)) { return NULL; } else { return prop->lang; } } void *ne_propfind_current_private(ne_propfind_handler *handler) { return handler->current ? handler->current->private : NULL; } void *ne_propset_private(const ne_prop_result_set *set) { return set->private; } int ne_propset_iterate(const ne_prop_result_set *set, ne_propset_iterator iterator, void *userdata) { int ps, p; for (ps = 0; ps < set->numpstats; ps++) { for (p = 0; p < set->pstats[ps].numprops; p++) { struct prop *prop = &set->pstats[ps].props[p]; int ret = iterator(userdata, &prop->pname, prop->value, &set->pstats[ps].status); if (ret) return ret; } } return 0; } const ne_status *ne_propset_status(const ne_prop_result_set *set, const ne_propname *pname) { struct propstat *pstat; if (findprop(set, pname, &pstat, NULL)) { /* TODO: it is tempting to return a dummy status object here * rather than NULL, which says "Property result was not given * by server." but I'm not sure if this is best left to the * client. */ return NULL; } else { return &pstat->status; } } static void *start_response(void *userdata, const ne_uri *uri) { ne_prop_result_set *set = ne_calloc(sizeof(*set)); ne_propfind_handler *hdl = userdata; ne_uri_copy(&set->uri, uri); if (hdl->creator) { set->private = hdl->creator(hdl->cd_userdata, &set->uri); } hdl->current = set; return set; } static void *start_propstat(void *userdata, void *response) { ne_prop_result_set *set = response; ne_propfind_handler *hdl = userdata; struct propstat *pstat; int n; if (++hdl->current->counter == MAX_PROP_COUNTER) { ne_xml_set_error(hdl->parser, _("Response exceeds maximum property count")); return NULL; } n = set->numpstats; set->pstats = ne_realloc(set->pstats, sizeof(struct propstat) * (n+1)); set->numpstats = n+1; pstat = &set->pstats[n]; memset(pstat, 0, sizeof(*pstat)); /* And return this as the new pstat. */ return &set->pstats[n]; } static int startelm(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { ne_propfind_handler *hdl = userdata; struct propstat *pstat = ne_207_get_current_propstat(hdl->parser207); struct prop *prop; int n; const char *lang; /* Just handle all children of propstat and their descendants. */ if ((parent != NE_207_STATE_PROP && parent != ELM_flatprop) || pstat == NULL) return NE_XML_DECLINE; if (parent == ELM_flatprop) { /* collecting the flatprop value. */ hdl->depth++; if (hdl->value->used < MAX_FLATPROP_LEN) { const char **a = atts; ne_buffer_concat(hdl->value, "<", nspace, name, NULL); while (a[0] && hdl->value->used < MAX_FLATPROP_LEN) { const char *nsep = strchr(a[0], ':'), *pfx; /* Resolve the attribute namespace prefix, if any. * Ignore a failure to resolve the namespace prefix. */ pfx = nsep ? ne_xml_resolve_nspace(hdl->parser, a[0], nsep - a[0]) : NULL; if (pfx) { ne_buffer_concat(hdl->value, " ", pfx, nsep + 1, "='", a[1], "'", NULL); } else { ne_buffer_concat(hdl->value, " ", a[0], "='", a[1], "'", NULL); } a += 2; } ne_buffer_czappend(hdl->value, ">"); } return ELM_flatprop; } /* Enforce maximum number of properties per resource to prevent a * memory exhaustion attack by a hostile server. */ if (++hdl->current->counter == MAX_PROP_COUNTER) { ne_xml_set_error(hdl->parser, _("Response exceeds maximum property count")); return NE_XML_ABORT; } /* Add a property to this propstat */ n = pstat->numprops; pstat->props = ne_realloc(pstat->props, sizeof(struct prop) * (n + 1)); pstat->numprops = n+1; /* Fill in the new property. */ prop = &pstat->props[n]; prop->pname.name = prop->name = ne_strdup(name); if (nspace[0] == '\0') { prop->pname.nspace = prop->nspace = NULL; } else { prop->pname.nspace = prop->nspace = ne_strdup(nspace); } prop->value = NULL; NE_DEBUG(NE_DBG_XML, "Got property #%d: {%s}%s.\n", n, NSPACE(prop->nspace), prop->name); /* This is under discussion at time of writing (April '01), and it * looks like we need to retrieve the xml:lang property from any * element here or above. * * Also, I think we might need attribute namespace handling here. */ lang = ne_xml_get_attr(hdl->parser, atts, NULL, "xml:lang"); if (lang != NULL) { prop->lang = ne_strdup(lang); NE_DEBUG(NE_DBG_XML, "Property language is %s\n", prop->lang); } else { prop->lang = NULL; } hdl->depth = 0; return ELM_flatprop; } static int endelm(void *userdata, int state, const char *nspace, const char *name) { ne_propfind_handler *hdl = userdata; struct propstat *pstat = ne_207_get_current_propstat(hdl->parser207); int n; if (hdl->depth > 0) { /* nested. */ if (hdl->value->used < MAX_FLATPROP_LEN) ne_buffer_concat(hdl->value, "", NULL); hdl->depth--; } else { /* end of the current property value */ n = pstat->numprops - 1; pstat->props[n].value = ne_buffer_finish(hdl->value); hdl->value = ne_buffer_create(); } return 0; } static void end_propstat(void *userdata, void *pstat_v, const ne_status *status, const char *description) { struct propstat *pstat = pstat_v; /* Nothing to do if no status was given. */ if (!status) return; /* If we get a non-2xx response back here, we wipe the value for * each of the properties in this propstat, so the caller knows to * look at the status instead. It's annoying, since for each prop * we will have done an unnecessary strdup("") above, but there is * no easy way round that given the fact that we don't know * whether we've got an error or not till after we get the * property element. * * Interestingly IIS breaks the 2518 DTD and puts the status * element first in the propstat. This is useful since then we * *do* know whether each subsequent empty prop element means, but * we can't rely on that here. */ if (status->klass != 2) { int n; for (n = 0; n < pstat->numprops; n++) { ne_free(pstat->props[n].value); pstat->props[n].value = NULL; } } /* copy the status structure, and dup the reason phrase. */ pstat->status = *status; pstat->status.reason_phrase = ne_strdup(status->reason_phrase); } /* Frees up a results set */ static void free_propset(ne_propfind_handler *handler, ne_prop_result_set *set) { int n; if (handler->destructor && set->private) { handler->destructor(handler->cd_userdata, set->private); } for (n = 0; n < set->numpstats; n++) { int m; struct propstat *p = &set->pstats[n]; for (m = 0; m < p->numprops; m++) { if (p->props[m].nspace) ne_free(p->props[m].nspace); ne_free(p->props[m].name); if (p->props[m].lang) ne_free(p->props[m].lang); if (p->props[m].value) ne_free(p->props[m].value); p->props[m].nspace = p->props[m].lang = p->props[m].value = NULL; } if (p->status.reason_phrase) ne_free(p->status.reason_phrase); if (p->props) ne_free(p->props); } if (set->pstats) ne_free(set->pstats); ne_uri_free(&set->uri); ne_free(set); } static void end_response(void *userdata, void *resource, const ne_status *status, const char *description) { ne_propfind_handler *handler = userdata; ne_prop_result_set *set = resource; /* Pass back the results for this resource. */ if (handler->callback && set->numpstats > 0) handler->callback(handler->userdata, &set->uri, set); /* Clean up the propset tree we've just built. */ free_propset(handler, set); handler->current = NULL; } ne_propfind_handler * ne_propfind_create(ne_session *sess, const char *uri, int depth) { ne_propfind_handler *ret = ne_calloc(sizeof(ne_propfind_handler)); ne_uri base = {0}; ne_fill_server_uri(sess, &base); base.path = ne_strdup(uri); ret->parser = ne_xml_create(); ret->parser207 = ne_207_create(ret->parser, &base, ret); ret->sess = sess; ret->body = ne_buffer_create(); ret->request = ne_request_create(sess, "PROPFIND", uri); ret->value = ne_buffer_create(); ne_add_depth_header(ret->request, depth); ne_207_set_response_handlers(ret->parser207, start_response, end_response); ne_207_set_propstat_handlers(ret->parser207, start_propstat, end_propstat); /* The start of the request body is fixed: */ ne_buffer_czappend(ret->body, "\n" ""); ne_uri_free(&base); return ret; } /* Destroy a propfind handler */ void ne_propfind_destroy(ne_propfind_handler *handler) { ne_buffer_destroy(handler->value); if (handler->current) free_propset(handler, handler->current); ne_207_destroy(handler->parser207); ne_xml_destroy(handler->parser); ne_buffer_destroy(handler->body); ne_request_destroy(handler->request); ne_free(handler); } int ne_simple_propfind(ne_session *sess, const char *href, int depth, const ne_propname *props, ne_props_result results, void *userdata) { ne_propfind_handler *hdl; int ret; hdl = ne_propfind_create(sess, href, depth); if (props != NULL) { ret = ne_propfind_named(hdl, props, results, userdata); } else { ret = ne_propfind_allprop(hdl, results, userdata); } ne_propfind_destroy(hdl); return ret; } int ne_propnames(ne_session *sess, const char *href, int depth, ne_props_result results, void *userdata) { ne_propfind_handler *hdl; int ret; hdl = ne_propfind_create(sess, href, depth); ne_buffer_czappend(hdl->body, ""); ret = propfind(hdl, results, userdata); ne_propfind_destroy(hdl); return ret; } void ne_propfind_set_private(ne_propfind_handler *hdl, ne_props_create_complex creator, ne_props_destroy_complex destructor, void *userdata) { hdl->creator = creator; hdl->destructor = destructor; hdl->cd_userdata = userdata; } cadaver-0.23.3/lib/neon/ne_openssl.c0000664000076400007640000010604011253153374016651 0ustar jortonjorton/* neon SSL/TLS support using OpenSSL Copyright (C) 2002-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include #include #include #ifdef NE_HAVE_TS_SSL #include /* for abort() */ #include #endif #include "ne_ssl.h" #include "ne_string.h" #include "ne_session.h" #include "ne_internal.h" #include "ne_private.h" #include "ne_privssl.h" /* OpenSSL 0.9.6 compatibility */ #if OPENSSL_VERSION_NUMBER < 0x0090700fL #define PKCS12_unpack_authsafes M_PKCS12_unpack_authsafes #define PKCS12_unpack_p7data M_PKCS12_unpack_p7data /* cast away lack of const-ness */ #define OBJ_cmp(a,b) OBJ_cmp((ASN1_OBJECT *)(a), (ASN1_OBJECT *)(b)) #endif /* Second argument for d2i_X509() changed type in 0.9.8. */ #if OPENSSL_VERSION_NUMBER < 0x0090800fL typedef unsigned char ne_d2i_uchar; #else typedef const unsigned char ne_d2i_uchar; #endif struct ne_ssl_dname_s { X509_NAME *dn; }; struct ne_ssl_certificate_s { ne_ssl_dname subj_dn, issuer_dn; X509 *subject; ne_ssl_certificate *issuer; char *identity; }; struct ne_ssl_client_cert_s { PKCS12 *p12; int decrypted; /* non-zero if successfully decrypted. */ ne_ssl_certificate cert; EVP_PKEY *pkey; char *friendly_name; }; #define NE_SSL_UNHANDLED (0x20) /* failure bit for unhandled case. */ /* Append an ASN.1 DirectoryString STR to buffer BUF as UTF-8. * Returns zero on success or non-zero on error. */ static int append_dirstring(ne_buffer *buf, ASN1_STRING *str) { unsigned char *tmp = (unsigned char *)""; /* initialize to workaround 0.9.6 bug */ int len; switch (str->type) { case V_ASN1_IA5STRING: /* definitely ASCII */ case V_ASN1_VISIBLESTRING: /* probably ASCII */ case V_ASN1_PRINTABLESTRING: /* subset of ASCII */ ne_buffer_qappend(buf, str->data, str->length); break; case V_ASN1_UTF8STRING: /* Fail for embedded NUL bytes. */ if (strlen((char *)str->data) != (size_t)str->length) { return -1; } ne_buffer_append(buf, (char *)str->data, str->length); break; case V_ASN1_UNIVERSALSTRING: case V_ASN1_T61STRING: /* let OpenSSL convert it as ISO-8859-1 */ case V_ASN1_BMPSTRING: len = ASN1_STRING_to_UTF8(&tmp, str); if (len > 0) { /* Fail if there were embedded NUL bytes. */ if (strlen((char *)tmp) != (size_t)len) { OPENSSL_free(tmp); return -1; } else { ne_buffer_append(buf, (char *)tmp, len); OPENSSL_free(tmp); } break; } else { ERR_clear_error(); return -1; } break; default: NE_DEBUG(NE_DBG_SSL, "Could not convert DirectoryString type %d\n", str->type); return -1; } return 0; } /* Returns a malloc-allocated version of IA5 string AS, escaped for * safety. */ static char *dup_ia5string(const ASN1_IA5STRING *as) { return ne_strnqdup(as->data, as->length); } char *ne_ssl_readable_dname(const ne_ssl_dname *name) { int n, flag = 0; ne_buffer *dump = ne_buffer_create(); const ASN1_OBJECT * const cname = OBJ_nid2obj(NID_commonName), * const email = OBJ_nid2obj(NID_pkcs9_emailAddress); for (n = X509_NAME_entry_count(name->dn); n > 0; n--) { X509_NAME_ENTRY *ent = X509_NAME_get_entry(name->dn, n-1); /* Skip commonName or emailAddress except if there is no other * attribute in dname. */ if ((OBJ_cmp(ent->object, cname) && OBJ_cmp(ent->object, email)) || (!flag && n == 1)) { if (flag++) ne_buffer_append(dump, ", ", 2); if (append_dirstring(dump, ent->value)) ne_buffer_czappend(dump, "???"); } } return ne_buffer_finish(dump); } int ne_ssl_dname_cmp(const ne_ssl_dname *dn1, const ne_ssl_dname *dn2) { return X509_NAME_cmp(dn1->dn, dn2->dn); } void ne_ssl_clicert_free(ne_ssl_client_cert *cc) { if (cc->p12) PKCS12_free(cc->p12); if (cc->decrypted) { if (cc->cert.identity) ne_free(cc->cert.identity); EVP_PKEY_free(cc->pkey); X509_free(cc->cert.subject); } if (cc->friendly_name) ne_free(cc->friendly_name); ne_free(cc); } /* Format an ASN1 time to a string. 'buf' must be at least of size * 'NE_SSL_VDATELEN'. */ static time_t asn1time_to_timet(const ASN1_TIME *atm) { struct tm tm = {0}; int i = atm->length; if (i < 10) return (time_t )-1; tm.tm_year = (atm->data[0]-'0') * 10 + (atm->data[1]-'0'); /* Deal with Year 2000 */ if (tm.tm_year < 70) tm.tm_year += 100; tm.tm_mon = (atm->data[2]-'0') * 10 + (atm->data[3]-'0') - 1; tm.tm_mday = (atm->data[4]-'0') * 10 + (atm->data[5]-'0'); tm.tm_hour = (atm->data[6]-'0') * 10 + (atm->data[7]-'0'); tm.tm_min = (atm->data[8]-'0') * 10 + (atm->data[9]-'0'); tm.tm_sec = (atm->data[10]-'0') * 10 + (atm->data[11]-'0'); #ifdef HAVE_TIMEZONE /* ANSI C time handling is... interesting. */ return mktime(&tm) - timezone; #else return mktime(&tm); #endif } void ne_ssl_cert_validity_time(const ne_ssl_certificate *cert, time_t *from, time_t *until) { if (from) { *from = asn1time_to_timet(X509_get_notBefore(cert->subject)); } if (until) { *until = asn1time_to_timet(X509_get_notAfter(cert->subject)); } } /* Check certificate identity. Returns zero if identity matches; 1 if * identity does not match, or <0 if the certificate had no identity. * If 'identity' is non-NULL, store the malloc-allocated identity in * *identity. Logic specified by RFC 2818 and RFC 3280. */ static int check_identity(const ne_uri *server, X509 *cert, char **identity) { STACK_OF(GENERAL_NAME) *names; int match = 0, found = 0; const char *hostname; hostname = server ? server->host : ""; names = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); if (names) { int n; /* subjectAltName contains a sequence of GeneralNames */ for (n = 0; n < sk_GENERAL_NAME_num(names) && !match; n++) { GENERAL_NAME *nm = sk_GENERAL_NAME_value(names, n); /* handle dNSName and iPAddress name extensions only. */ if (nm->type == GEN_DNS) { char *name = dup_ia5string(nm->d.ia5); if (identity && !found) *identity = ne_strdup(name); match = ne__ssl_match_hostname(name, strlen(name), hostname); ne_free(name); found = 1; } else if (nm->type == GEN_IPADD) { /* compare IP address with server IP address. */ ne_inet_addr *ia; if (nm->d.ip->length == 4) ia = ne_iaddr_make(ne_iaddr_ipv4, nm->d.ip->data); else if (nm->d.ip->length == 16) ia = ne_iaddr_make(ne_iaddr_ipv6, nm->d.ip->data); else ia = NULL; /* ne_iaddr_make returns NULL if address type is unsupported */ if (ia != NULL) { /* address type was supported. */ char buf[128]; match = strcmp(hostname, ne_iaddr_print(ia, buf, sizeof buf)) == 0; found = 1; ne_iaddr_free(ia); } else { NE_DEBUG(NE_DBG_SSL, "iPAddress name with unsupported " "address type (length %d), skipped.\n", nm->d.ip->length); } } else if (nm->type == GEN_URI) { char *name = dup_ia5string(nm->d.ia5); ne_uri uri; if (ne_uri_parse(name, &uri) == 0 && uri.host && uri.scheme) { ne_uri tmp; if (identity && !found) *identity = ne_strdup(name); found = 1; if (server) { /* For comparison purposes, all that matters is * host, scheme and port; ignore the rest. */ memset(&tmp, 0, sizeof tmp); tmp.host = uri.host; tmp.scheme = uri.scheme; tmp.port = uri.port; match = ne_uri_cmp(server, &tmp) == 0; } } ne_uri_free(&uri); ne_free(name); } } /* free the whole stack. */ sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); } /* Check against the commonName if no DNS alt. names were found, * as per RFC3280. */ if (!found) { X509_NAME *subj = X509_get_subject_name(cert); X509_NAME_ENTRY *entry; ne_buffer *cname = ne_buffer_ncreate(30); int idx = -1, lastidx; /* find the most specific commonName attribute. */ do { lastidx = idx; idx = X509_NAME_get_index_by_NID(subj, NID_commonName, lastidx); } while (idx >= 0); if (lastidx < 0) { /* no commonName attributes at all. */ ne_buffer_destroy(cname); return -1; } /* extract the string from the entry */ entry = X509_NAME_get_entry(subj, lastidx); if (append_dirstring(cname, X509_NAME_ENTRY_get_data(entry))) { ne_buffer_destroy(cname); return -1; } if (identity) *identity = ne_strdup(cname->data); match = ne__ssl_match_hostname(cname->data, cname->used - 1, hostname); ne_buffer_destroy(cname); } NE_DEBUG(NE_DBG_SSL, "Identity match for '%s': %s\n", hostname, match ? "good" : "bad"); return match ? 0 : 1; } /* Populate an ne_ssl_certificate structure from an X509 object. */ static ne_ssl_certificate *populate_cert(ne_ssl_certificate *cert, X509 *x5) { cert->subj_dn.dn = X509_get_subject_name(x5); cert->issuer_dn.dn = X509_get_issuer_name(x5); cert->issuer = NULL; cert->subject = x5; /* Retrieve the cert identity; pass a dummy hostname to match. */ cert->identity = NULL; check_identity(NULL, x5, &cert->identity); return cert; } /* OpenSSL cert verification callback. This is invoked for *each* * error which is encoutered whilst verifying the cert chain; multiple * invocations for any particular cert in the chain are possible. */ static int verify_callback(int ok, X509_STORE_CTX *ctx) { /* OpenSSL, living in its own little happy world of global state, * where userdata was just a twinkle in the eye of an API designer * yet to be born. Or... "Seriously, wtf?" */ SSL *ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); ne_session *sess = SSL_get_app_data(ssl); int depth = X509_STORE_CTX_get_error_depth(ctx); int err = X509_STORE_CTX_get_error(ctx); int failures = 0; /* If there's no error, nothing to do here. */ if (ok) return ok; NE_DEBUG(NE_DBG_SSL, "ssl: Verify callback @ %d => %d\n", depth, err); /* Map the error code onto any of the exported cert validation * errors, if possible. */ switch (err) { case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: case X509_V_ERR_CERT_UNTRUSTED: case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: failures |= NE_SSL_UNTRUSTED; break; case X509_V_ERR_CERT_NOT_YET_VALID: failures |= depth > 0 ? NE_SSL_BADCHAIN : NE_SSL_NOTYETVALID; break; case X509_V_ERR_CERT_HAS_EXPIRED: failures |= depth > 0 ? NE_SSL_BADCHAIN : NE_SSL_EXPIRED; break; case X509_V_OK: break; default: /* Clear the failures bitmask so check_certificate knows this * is a bailout. */ sess->ssl_context->failures |= NE_SSL_UNHANDLED; NE_DEBUG(NE_DBG_SSL, "ssl: Unhandled verification error %d -> %s\n", err, X509_verify_cert_error_string(err)); return 0; } sess->ssl_context->failures |= failures; NE_DEBUG(NE_DBG_SSL, "ssl: Verify failures |= %d => %d\n", failures, sess->ssl_context->failures); return 1; } /* Return a linked list of certificate objects from an OpenSSL chain. */ static ne_ssl_certificate *make_chain(STACK_OF(X509) *chain) { int n, count = sk_X509_num(chain); ne_ssl_certificate *top = NULL, *current = NULL; NE_DEBUG(NE_DBG_SSL, "Chain depth: %d\n", count); for (n = 0; n < count; n++) { ne_ssl_certificate *cert = ne_malloc(sizeof *cert); populate_cert(cert, X509_dup(sk_X509_value(chain, n))); #ifdef NE_DEBUGGING if (ne_debug_mask & NE_DBG_SSL) { fprintf(ne_debug_stream, "Cert #%d:\n", n); X509_print_fp(ne_debug_stream, cert->subject); } #endif if (top == NULL) { current = top = cert; } else { current->issuer = cert; current = cert; } } return top; } /* Verifies an SSL server certificate. */ static int check_certificate(ne_session *sess, SSL *ssl, ne_ssl_certificate *chain) { X509 *cert = chain->subject; int ret, failures = sess->ssl_context->failures; ne_uri server; /* If the verification callback hit a case which can't be mapped * to one of the exported error bits, it's treated as a hard * failure rather than invoking the callback, which can't present * a useful error to the user. "Um, something is wrong. OK?" */ if (failures & NE_SSL_UNHANDLED) { long result = SSL_get_verify_result(ssl); ne_set_error(sess, _("Certificate verification error: %s"), X509_verify_cert_error_string(result)); return NE_ERROR; } /* Check certificate was issued to this server; pass URI of * server. */ memset(&server, 0, sizeof server); ne_fill_server_uri(sess, &server); ret = check_identity(&server, cert, NULL); ne_uri_free(&server); if (ret < 0) { ne_set_error(sess, _("Server certificate was missing commonName " "attribute in subject name")); return NE_ERROR; } else if (ret > 0) failures |= NE_SSL_IDMISMATCH; if (failures == 0) { /* verified OK! */ ret = NE_OK; } else { /* Set up the error string. */ ne__ssl_set_verify_err(sess, failures); ret = NE_ERROR; /* Allow manual override */ if (sess->ssl_verify_fn && sess->ssl_verify_fn(sess->ssl_verify_ud, failures, chain) == 0) ret = NE_OK; } return ret; } /* Duplicate a client certificate, which must be in the decrypted state. */ static ne_ssl_client_cert *dup_client_cert(const ne_ssl_client_cert *cc) { ne_ssl_client_cert *newcc = ne_calloc(sizeof *newcc); newcc->decrypted = 1; newcc->pkey = cc->pkey; if (cc->friendly_name) newcc->friendly_name = ne_strdup(cc->friendly_name); populate_cert(&newcc->cert, cc->cert.subject); cc->cert.subject->references++; cc->pkey->references++; return newcc; } /* Callback invoked when the SSL server requests a client certificate. */ static int provide_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey) { ne_session *const sess = SSL_get_app_data(ssl); if (!sess->client_cert && sess->ssl_provide_fn) { ne_ssl_dname **dnames = NULL, *dnarray = NULL; int n, count = 0; STACK_OF(X509_NAME) *ca_list = SSL_get_client_CA_list(ssl); count = ca_list ? sk_X509_NAME_num(ca_list) : 0; if (count > 0) { dnames = ne_malloc(count * sizeof(ne_ssl_dname *)); dnarray = ne_malloc(count * sizeof(ne_ssl_dname)); for (n = 0; n < count; n++) { dnames[n] = &dnarray[n]; dnames[n]->dn = sk_X509_NAME_value(ca_list, n); } } NE_DEBUG(NE_DBG_SSL, "Calling client certificate provider...\n"); sess->ssl_provide_fn(sess->ssl_provide_ud, sess, (const ne_ssl_dname *const *)dnames, count); if (count) { ne_free(dnarray); ne_free(dnames); } } if (sess->client_cert) { ne_ssl_client_cert *const cc = sess->client_cert; NE_DEBUG(NE_DBG_SSL, "Supplying client certificate.\n"); cc->pkey->references++; cc->cert.subject->references++; *cert = cc->cert.subject; *pkey = cc->pkey; return 1; } else { sess->ssl_cc_requested = 1; NE_DEBUG(NE_DBG_SSL, "No client certificate supplied.\n"); return 0; } } void ne_ssl_set_clicert(ne_session *sess, const ne_ssl_client_cert *cc) { sess->client_cert = dup_client_cert(cc); } ne_ssl_context *ne_ssl_context_create(int mode) { ne_ssl_context *ctx = ne_calloc(sizeof *ctx); if (mode == NE_SSL_CTX_CLIENT) { ctx->ctx = SSL_CTX_new(SSLv23_client_method()); ctx->sess = NULL; /* set client cert callback. */ SSL_CTX_set_client_cert_cb(ctx->ctx, provide_client_cert); /* enable workarounds for buggy SSL server implementations */ SSL_CTX_set_options(ctx->ctx, SSL_OP_ALL); SSL_CTX_set_verify(ctx->ctx, SSL_VERIFY_PEER, verify_callback); } else if (mode == NE_SSL_CTX_SERVER) { ctx->ctx = SSL_CTX_new(SSLv23_server_method()); SSL_CTX_set_session_cache_mode(ctx->ctx, SSL_SESS_CACHE_CLIENT); } else { ctx->ctx = SSL_CTX_new(SSLv2_server_method()); SSL_CTX_set_session_cache_mode(ctx->ctx, SSL_SESS_CACHE_CLIENT); } return ctx; } void ne_ssl_context_set_flag(ne_ssl_context *ctx, int flag, int value) { long opts = SSL_CTX_get_options(ctx->ctx); switch (flag) { case NE_SSL_CTX_SSLv2: if (value) { /* Enable SSLv2 support; clear the "no SSLv2" flag. */ opts &= ~SSL_OP_NO_SSLv2; } else { /* Disable it: set the flag. */ opts |= SSL_OP_NO_SSLv2; } break; } SSL_CTX_set_options(ctx->ctx, opts); } int ne_ssl_context_keypair(ne_ssl_context *ctx, const char *cert, const char *key) { int ret; ret = SSL_CTX_use_PrivateKey_file(ctx->ctx, key, SSL_FILETYPE_PEM); if (ret == 1) { ret = SSL_CTX_use_certificate_chain_file(ctx->ctx, cert); } return ret == 1 ? 0 : -1; } int ne_ssl_context_set_verify(ne_ssl_context *ctx, int required, const char *ca_names, const char *verify_cas) { if (required) { SSL_CTX_set_verify(ctx->ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL); } if (ca_names) { SSL_CTX_set_client_CA_list(ctx->ctx, SSL_load_client_CA_file(ca_names)); } if (verify_cas) { SSL_CTX_load_verify_locations(ctx->ctx, verify_cas, NULL); } return 0; } void ne_ssl_context_destroy(ne_ssl_context *ctx) { SSL_CTX_free(ctx->ctx); if (ctx->sess) SSL_SESSION_free(ctx->sess); ne_free(ctx); } #if !defined(HAVE_SSL_SESSION_CMP) && !defined(SSL_SESSION_cmp) \ && defined(OPENSSL_VERSION_NUMBER) \ && OPENSSL_VERSION_NUMBER > 0x10000000L /* OpenSSL 1.0 removed SSL_SESSION_cmp for no apparent reason - hoping * it is reasonable to assume that comparing the session IDs is * sufficient. */ static int SSL_SESSION_cmp(SSL_SESSION *a, SSL_SESSION *b) { return a->session_id_length == b->session_id_length && memcmp(a->session_id, b->session_id, a->session_id_length) == 0; } #endif /* For internal use only. */ int ne__negotiate_ssl(ne_session *sess) { ne_ssl_context *ctx = sess->ssl_context; SSL *ssl; STACK_OF(X509) *chain; int freechain = 0; /* non-zero if chain should be free'd. */ NE_DEBUG(NE_DBG_SSL, "Doing SSL negotiation.\n"); /* Pass through the hostname if SNI is enabled. */ ctx->hostname = sess->flags[NE_SESSFLAG_TLS_SNI] ? sess->server.hostname : NULL; sess->ssl_cc_requested = 0; ctx->failures = 0; if (ne_sock_connect_ssl(sess->socket, ctx, sess)) { if (ctx->sess) { /* remove cached session. */ SSL_SESSION_free(ctx->sess); ctx->sess = NULL; } if (sess->ssl_cc_requested) { ne_set_error(sess, _("SSL handshake failed, " "client certificate was requested: %s"), ne_sock_error(sess->socket)); } else { ne_set_error(sess, _("SSL handshake failed: %s"), ne_sock_error(sess->socket)); } return NE_ERROR; } ssl = ne__sock_sslsock(sess->socket); chain = SSL_get_peer_cert_chain(ssl); /* For an SSLv2 connection, the cert chain will always be NULL. */ if (chain == NULL) { X509 *cert = SSL_get_peer_certificate(ssl); if (cert) { chain = sk_X509_new_null(); sk_X509_push(chain, cert); freechain = 1; } } if (chain == NULL || sk_X509_num(chain) == 0) { ne_set_error(sess, _("SSL server did not present certificate")); return NE_ERROR; } if (sess->server_cert) { int diff = X509_cmp(sk_X509_value(chain, 0), sess->server_cert->subject); if (freechain) sk_X509_free(chain); /* no longer need the chain */ if (diff) { /* This could be a MITM attack: fail the request. */ ne_set_error(sess, _("Server certificate changed: " "connection intercepted?")); return NE_ERROR; } /* certificate has already passed verification: no need to * verify it again. */ } else { /* new connection: create the chain. */ ne_ssl_certificate *cert = make_chain(chain); if (freechain) sk_X509_free(chain); /* no longer need the chain */ if (check_certificate(sess, ssl, cert)) { NE_DEBUG(NE_DBG_SSL, "SSL certificate checks failed: %s\n", sess->error); ne_ssl_cert_free(cert); return NE_ERROR; } /* remember the chain. */ sess->server_cert = cert; } if (ctx->sess) { SSL_SESSION *newsess = SSL_get0_session(ssl); /* Replace the session if it has changed. */ if (newsess != ctx->sess || SSL_SESSION_cmp(ctx->sess, newsess)) { SSL_SESSION_free(ctx->sess); ctx->sess = SSL_get1_session(ssl); /* bumping the refcount */ } } else { /* Store the session. */ ctx->sess = SSL_get1_session(ssl); } return NE_OK; } const ne_ssl_dname *ne_ssl_cert_issuer(const ne_ssl_certificate *cert) { return &cert->issuer_dn; } const ne_ssl_dname *ne_ssl_cert_subject(const ne_ssl_certificate *cert) { return &cert->subj_dn; } const ne_ssl_certificate *ne_ssl_cert_signedby(const ne_ssl_certificate *cert) { return cert->issuer; } const char *ne_ssl_cert_identity(const ne_ssl_certificate *cert) { return cert->identity; } void ne_ssl_context_trustcert(ne_ssl_context *ctx, const ne_ssl_certificate *cert) { X509_STORE *store = SSL_CTX_get_cert_store(ctx->ctx); X509_STORE_add_cert(store, cert->subject); } void ne_ssl_trust_default_ca(ne_session *sess) { X509_STORE *store = SSL_CTX_get_cert_store(sess->ssl_context->ctx); #ifdef NE_SSL_CA_BUNDLE X509_STORE_load_locations(store, NE_SSL_CA_BUNDLE, NULL); #else X509_STORE_set_default_paths(store); #endif } /* Find a friendly name in a PKCS12 structure the hard way, without * decrypting the parts which are encrypted.. */ static char *find_friendly_name(PKCS12 *p12) { STACK_OF(PKCS7) *safes = PKCS12_unpack_authsafes(p12); int n, m; char *name = NULL; if (safes == NULL) return NULL; /* Iterate over the unpacked authsafes: */ for (n = 0; n < sk_PKCS7_num(safes) && !name; n++) { PKCS7 *safe = sk_PKCS7_value(safes, n); STACK_OF(PKCS12_SAFEBAG) *bags; /* Only looking for unencrypted authsafes. */ if (OBJ_obj2nid(safe->type) != NID_pkcs7_data) continue; bags = PKCS12_unpack_p7data(safe); if (!bags) continue; /* Iterate through the bags, picking out a friendly name */ for (m = 0; m < sk_PKCS12_SAFEBAG_num(bags) && !name; m++) { PKCS12_SAFEBAG *bag = sk_PKCS12_SAFEBAG_value(bags, m); name = PKCS12_get_friendlyname(bag); } sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); } sk_PKCS7_pop_free(safes, PKCS7_free); return name; } ne_ssl_client_cert *ne_ssl_clicert_read(const char *filename) { PKCS12 *p12; FILE *fp; X509 *cert; EVP_PKEY *pkey; ne_ssl_client_cert *cc; fp = fopen(filename, "rb"); if (fp == NULL) return NULL; p12 = d2i_PKCS12_fp(fp, NULL); fclose(fp); if (p12 == NULL) { ERR_clear_error(); return NULL; } /* Try parsing with no password. */ if (PKCS12_parse(p12, NULL, &pkey, &cert, NULL) == 1) { /* Success - no password needed for decryption. */ int len = 0; unsigned char *name; if (!cert || !pkey) { PKCS12_free(p12); return NULL; } name = X509_alias_get0(cert, &len); cc = ne_calloc(sizeof *cc); cc->pkey = pkey; cc->decrypted = 1; if (name && len > 0) cc->friendly_name = ne_strndup((char *)name, len); populate_cert(&cc->cert, cert); PKCS12_free(p12); return cc; } else { /* Failed to parse the file */ int err = ERR_get_error(); ERR_clear_error(); if (ERR_GET_LIB(err) == ERR_LIB_PKCS12 && ERR_GET_REASON(err) == PKCS12_R_MAC_VERIFY_FAILURE) { /* Decryption error due to bad password. */ cc = ne_calloc(sizeof *cc); cc->friendly_name = find_friendly_name(p12); cc->p12 = p12; return cc; } else { /* Some parse error, give up. */ PKCS12_free(p12); return NULL; } } } #ifdef HAVE_PAKCHOIS ne_ssl_client_cert *ne__ssl_clicert_exkey_import(const unsigned char *der, size_t der_len, const RSA_METHOD *method) { ne_ssl_client_cert *cc; ne_d2i_uchar *p; X509 *x5; RSA *pk; EVP_PKEY *epk, *tpk; p = der; x5 = d2i_X509(NULL, &p, der_len); /* p is incremented */ if (x5 == NULL) { ERR_clear_error(); return NULL; } pk = RSA_new(); RSA_set_method(pk, method); epk = EVP_PKEY_new(); EVP_PKEY_assign_RSA(epk, pk); /* It is necessary to initialize pk->n otherwise OpenSSL will barf * later calling RSA_size() on this RSA structure. * X509_get_pubkey() forces the relevant RSA parameters to be * extracted from the certificate. */ tpk = X509_get_pubkey(x5); pk->n = BN_dup(tpk->pkey.rsa->n); EVP_PKEY_free(tpk); cc = ne_calloc(sizeof *cc); cc->decrypted = 1; cc->pkey = epk; populate_cert(&cc->cert, x5); return cc; } #endif int ne_ssl_clicert_encrypted(const ne_ssl_client_cert *cc) { return !cc->decrypted; } int ne_ssl_clicert_decrypt(ne_ssl_client_cert *cc, const char *password) { X509 *cert; EVP_PKEY *pkey; if (PKCS12_parse(cc->p12, password, &pkey, &cert, NULL) != 1) { ERR_clear_error(); return -1; } if (X509_check_private_key(cert, pkey) != 1) { ERR_clear_error(); X509_free(cert); EVP_PKEY_free(pkey); NE_DEBUG(NE_DBG_SSL, "Decrypted private key/cert are not matched."); return -1; } PKCS12_free(cc->p12); populate_cert(&cc->cert, cert); cc->pkey = pkey; cc->decrypted = 1; cc->p12 = NULL; return 0; } const ne_ssl_certificate *ne_ssl_clicert_owner(const ne_ssl_client_cert *cc) { return &cc->cert; } const char *ne_ssl_clicert_name(const ne_ssl_client_cert *ccert) { return ccert->friendly_name; } ne_ssl_certificate *ne_ssl_cert_read(const char *filename) { FILE *fp = fopen(filename, "r"); X509 *cert; if (fp == NULL) return NULL; cert = PEM_read_X509(fp, NULL, NULL, NULL); fclose(fp); if (cert == NULL) { NE_DEBUG(NE_DBG_SSL, "d2i_X509_fp failed: %s\n", ERR_reason_error_string(ERR_get_error())); ERR_clear_error(); return NULL; } return populate_cert(ne_calloc(sizeof(struct ne_ssl_certificate_s)), cert); } int ne_ssl_cert_write(const ne_ssl_certificate *cert, const char *filename) { FILE *fp = fopen(filename, "w"); if (fp == NULL) return -1; if (PEM_write_X509(fp, cert->subject) != 1) { ERR_clear_error(); fclose(fp); return -1; } if (fclose(fp) != 0) return -1; return 0; } void ne_ssl_cert_free(ne_ssl_certificate *cert) { X509_free(cert->subject); if (cert->issuer) ne_ssl_cert_free(cert->issuer); if (cert->identity) ne_free(cert->identity); ne_free(cert); } int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, const ne_ssl_certificate *c2) { return X509_cmp(c1->subject, c2->subject); } /* The certificate import/export format is the base64 encoding of the * raw DER; PEM without the newlines and wrapping. */ ne_ssl_certificate *ne_ssl_cert_import(const char *data) { unsigned char *der; ne_d2i_uchar *p; size_t len; X509 *x5; /* decode the base64 to get the raw DER representation */ len = ne_unbase64(data, &der); if (len == 0) return NULL; p = der; x5 = d2i_X509(NULL, &p, len); /* p is incremented */ ne_free(der); if (x5 == NULL) { ERR_clear_error(); return NULL; } return populate_cert(ne_calloc(sizeof(struct ne_ssl_certificate_s)), x5); } char *ne_ssl_cert_export(const ne_ssl_certificate *cert) { int len; unsigned char *der, *p; char *ret; /* find the length of the DER encoding. */ len = i2d_X509(cert->subject, NULL); p = der = ne_malloc(len); i2d_X509(cert->subject, &p); /* p is incremented */ ret = ne_base64(der, len); ne_free(der); return ret; } #if SHA_DIGEST_LENGTH != 20 # error SHA digest length is not 20 bytes #endif int ne_ssl_cert_digest(const ne_ssl_certificate *cert, char *digest) { unsigned char sha1[EVP_MAX_MD_SIZE]; unsigned int len, j; char *p; if (!X509_digest(cert->subject, EVP_sha1(), sha1, &len) || len != 20) { ERR_clear_error(); return -1; } for (j = 0, p = digest; j < 20; j++) { *p++ = NE_HEX2ASC((sha1[j] >> 4) & 0x0f); *p++ = NE_HEX2ASC(sha1[j] & 0x0f); *p++ = ':'; } p[-1] = '\0'; return 0; } #ifdef NE_HAVE_TS_SSL /* Implementation of locking callbacks to make OpenSSL thread-safe. * If the OpenSSL API was better designed, this wouldn't be necessary. * In OpenSSL releases without CRYPTO_set_idptr_callback, it's not * possible to implement the locking in a POSIX-compliant way, since * it's necessary to cast from a pthread_t to an unsigned long at some * point. */ static pthread_mutex_t *locks; static size_t num_locks; #ifndef HAVE_CRYPTO_SET_IDPTR_CALLBACK /* Named to be obvious when it shows up in a backtrace. */ static unsigned long thread_id_neon(void) { /* This will break if pthread_t is a structure; upgrading OpenSSL * >= 0.9.9 (which does not require this callback) is the only * solution. */ return (unsigned long) pthread_self(); } #endif /* Another great API design win for OpenSSL: no return value! So if * the lock/unlock fails, all that can be done is to abort. */ static void thread_lock_neon(int mode, int n, const char *file, int line) { if (mode & CRYPTO_LOCK) { if (pthread_mutex_lock(&locks[n])) { abort(); } } else { if (pthread_mutex_unlock(&locks[n])) { abort(); } } } #endif /* ID_CALLBACK_IS_{NEON,OTHER} evaluate as true if the currently * registered OpenSSL ID callback is the neon function (_NEON), or has * been overwritten by some other app (_OTHER). */ #ifdef HAVE_CRYPTO_SET_IDPTR_CALLBACK #define ID_CALLBACK_IS_OTHER (0) #define ID_CALLBACK_IS_NEON (1) #else #define ID_CALLBACK_IS_OTHER (CRYPTO_get_id_callback() != NULL) #define ID_CALLBACK_IS_NEON (CRYPTO_get_id_callback() == thread_id_neon) #endif int ne__ssl_init(void) { CRYPTO_malloc_init(); SSL_load_error_strings(); SSL_library_init(); OpenSSL_add_all_algorithms(); #ifdef NE_HAVE_TS_SSL /* If some other library has already come along and set up the * thread-safety callbacks, then it must be presumed that the * other library will have a longer lifetime in the process than * neon. If the library which has installed the callbacks is * unloaded, then all bets are off. */ if (ID_CALLBACK_IS_OTHER || CRYPTO_get_locking_callback() != NULL) { NE_DEBUG(NE_DBG_SOCKET, "ssl: OpenSSL thread-safety callbacks already installed.\n"); NE_DEBUG(NE_DBG_SOCKET, "ssl: neon will not replace existing callbacks.\n"); } else { size_t n; num_locks = CRYPTO_num_locks(); /* For releases where CRYPTO_set_idptr_callback is present, * the default ID callback should be sufficient. */ #ifndef HAVE_CRYPTO_SET_IDPTR_CALLBACK CRYPTO_set_id_callback(thread_id_neon); #endif CRYPTO_set_locking_callback(thread_lock_neon); locks = malloc(num_locks * sizeof *locks); for (n = 0; n < num_locks; n++) { if (pthread_mutex_init(&locks[n], NULL)) { NE_DEBUG(NE_DBG_SOCKET, "ssl: Failed to initialize pthread mutex.\n"); return -1; } } NE_DEBUG(NE_DBG_SOCKET, "ssl: Initialized OpenSSL thread-safety callbacks " "for %" NE_FMT_SIZE_T " locks.\n", num_locks); } #endif return 0; } void ne__ssl_exit(void) { /* Cannot call ERR_free_strings() etc here in case any other code * in the process using OpenSSL. */ #ifdef NE_HAVE_TS_SSL /* Only unregister the callbacks if some *other* library has not * come along in the mean-time and trampled over the callbacks * installed by neon. */ if (CRYPTO_get_locking_callback() == thread_lock_neon && ID_CALLBACK_IS_NEON) { size_t n; #ifndef HAVE_CRYPTO_SET_IDPTR_CALLBACK CRYPTO_set_id_callback(NULL); #endif CRYPTO_set_locking_callback(NULL); for (n = 0; n < num_locks; n++) { pthread_mutex_destroy(&locks[n]); } free(locks); } #endif } cadaver-0.23.3/lib/neon/ne_ntlm.c0000664000076400007640000004761311305555706016155 0ustar jortonjorton/* Handling of NTLM Authentication Copyright (C) 2003, Daniel Stenberg Copyright (C) 2009, Kai Sommerfeld This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* NTLM details: http://davenport.sourceforge.net/ntlm.html http://www.innovation.ch/java/ntlm.html */ #include "ne_ntlm.h" #ifdef HAVE_NTLM #include "ne_string.h" typedef enum { NTLMSTATE_NONE, NTLMSTATE_TYPE1, NTLMSTATE_TYPE2, NTLMSTATE_TYPE3, NTLMSTATE_LAST } NTLMState; struct ne_ntlm_context_s { NTLMState state; unsigned char nonce[8]; char *user; char *passwd; char *requestToken; }; typedef enum { NTLM_NONE, /* not a ntlm */ NTLM_BAD, /* an ntlm, but one we don't like */ NTLM_FIRST, /* the first 401-reply we got with NTLM */ NTLM_FINE, /* an ntlm we act on */ NTLM_LAST /* last entry in this enum, don't use */ } ntlm; /* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */ #define NTLMFLAG_NEGOTIATE_UNICODE (1<<0) /* Indicates that Unicode strings are supported for use in security buffer data. */ #define NTLMFLAG_NEGOTIATE_OEM (1<<1) /* Indicates that OEM strings are supported for use in security buffer data. */ #define NTLMFLAG_REQUEST_TARGET (1<<2) /* Requests that the server's authentication realm be included in the Type 2 message. */ /* unknown (1<<3) */ #define NTLMFLAG_NEGOTIATE_SIGN (1<<4) /* Specifies that authenticated communication between the client and server should carry a digital signature (message integrity). */ #define NTLMFLAG_NEGOTIATE_SEAL (1<<5) /* Specifies that authenticated communication between the client and server should be encrypted (message confidentiality). */ #define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE (1<<6) /* unknown purpose */ #define NTLMFLAG_NEGOTIATE_LM_KEY (1<<7) /* Indicates that the LAN Manager session key should be used for signing and sealing authenticated communications. */ #define NTLMFLAG_NEGOTIATE_NETWARE (1<<8) /* unknown purpose */ #define NTLMFLAG_NEGOTIATE_NTLM_KEY (1<<9) /* Indicates that NTLM authentication is being used. */ /* unknown (1<<10) */ /* unknown (1<<11) */ #define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED (1<<12) /* Sent by the client in the Type 1 message to indicate that a desired authentication realm is included in the message. */ #define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED (1<<13) /* Sent by the client in the Type 1 message to indicate that the client workstation's name is included in the message. */ #define NTLMFLAG_NEGOTIATE_LOCAL_CALL (1<<14) /* Sent by the server to indicate that the server and client are on the same machine. Implies that the client may use a pre-established local security context rather than responding to the challenge. */ #define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN (1<<15) /* Indicates that authenticated communication between the client and server should be signed with a "dummy" signature. */ #define NTLMFLAG_TARGET_TYPE_DOMAIN (1<<16) /* Sent by the server in the Type 2 message to indicate that the target authentication realm is a domain. */ #define NTLMFLAG_TARGET_TYPE_SERVER (1<<17) /* Sent by the server in the Type 2 message to indicate that the target authentication realm is a server. */ #define NTLMFLAG_TARGET_TYPE_SHARE (1<<18) /* Sent by the server in the Type 2 message to indicate that the target authentication realm is a share. Presumably, this is for share-level authentication. Usage is unclear. */ #define NTLMFLAG_NEGOTIATE_NTLM2_KEY (1<<19) /* Indicates that the NTLM2 signing and sealing scheme should be used for protecting authenticated communications. */ #define NTLMFLAG_REQUEST_INIT_RESPONSE (1<<20) /* unknown purpose */ #define NTLMFLAG_REQUEST_ACCEPT_RESPONSE (1<<21) /* unknown purpose */ #define NTLMFLAG_REQUEST_NONNT_SESSION_KEY (1<<22) /* unknown purpose */ #define NTLMFLAG_NEGOTIATE_TARGET_INFO (1<<23) /* Sent by the server in the Type 2 message to indicate that it is including a Target Information block in the message. */ /* unknown (1<24) */ /* unknown (1<25) */ /* unknown (1<26) */ /* unknown (1<27) */ /* unknown (1<28) */ #define NTLMFLAG_NEGOTIATE_128 (1<<29) /* Indicates that 128-bit encryption is supported. */ #define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE (1<<30) /* unknown purpose */ #define NTLMFLAG_NEGOTIATE_56 (1<<31) /* Indicates that 56-bit encryption is supported. */ #ifdef HAVE_OPENSSL /* We need OpenSSL for the crypto lib to provide us with MD4 and DES */ /* -- WIN32 approved -- */ #include #include #include #include #include #include #include #include #if OPENSSL_VERSION_NUMBER < 0x00907001L #define DES_key_schedule des_key_schedule #define DES_cblock des_cblock #define DES_set_odd_parity des_set_odd_parity #define DES_set_key des_set_key #define DES_ecb_encrypt des_ecb_encrypt /* This is how things were done in the old days */ #define DESKEY(x) x #define DESKEYARG(x) x #else /* Modern version */ #define DESKEYARG(x) *x #define DESKEY(x) &x #endif /* Define this to make the type-3 message include the NT response message */ #define USE_NTRESPONSES 1 /* (*) = A "security buffer" is a triplet consisting of two shorts and one long: 1. a 'short' containing the length of the buffer in bytes 2. a 'short' containing the allocated space for the buffer in bytes 3. a 'long' containing the offset to the start of the buffer from the beginning of the NTLM message, in bytes. */ static ntlm ne_input_ntlm(ne_ntlm_context *ctx, const char *responseToken) { if(responseToken) { /* We got a type-2 message here: Index Description Content 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" (0x4e544c4d53535000) 8 NTLM Message Type long (0x02000000) 12 Target Name security buffer(*) 20 Flags long 24 Challenge 8 bytes (32) Context (optional) 8 bytes (two consecutive longs) (40) Target Information (optional) security buffer(*) 32 (48) start of data block */ unsigned char * buffer = NULL; int size = ne_unbase64(responseToken, &buffer); ctx->state = NTLMSTATE_TYPE2; /* we got a type-2 */ if(size >= 48) /* the nonce of interest is index [24 .. 31], 8 bytes */ memcpy(ctx->nonce, &buffer[24], 8); /* at index decimal 20, there's a 32bit NTLM flag field */ if (buffer) ne_free(buffer); } else { if(ctx->state >= NTLMSTATE_TYPE1) return NTLM_BAD; ctx->state = NTLMSTATE_TYPE1; /* we should sent away a type-1 */ } return NTLM_FINE; } /* * Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The * key schedule ks is also set. */ static void setup_des_key(unsigned char *key_56, DES_key_schedule DESKEYARG(ks)) { DES_cblock key; key[0] = key_56[0]; key[1] = ((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1); key[2] = ((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2); key[3] = ((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3); key[4] = ((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4); key[5] = ((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5); key[6] = ((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6); key[7] = (key_56[6] << 1) & 0xFF; DES_set_odd_parity(&key); DES_set_key(&key, ks); } /* * takes a 21 byte array and treats it as 3 56-bit DES keys. The * 8 byte plaintext is encrypted with each key and the resulting 24 * bytes are stored in the results array. */ static void calc_resp(unsigned char *keys, unsigned char *plaintext, unsigned char *results) { DES_key_schedule ks; setup_des_key(keys, DESKEY(ks)); DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) results, DESKEY(ks), DES_ENCRYPT); setup_des_key(keys+7, DESKEY(ks)); DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results+8), DESKEY(ks), DES_ENCRYPT); setup_des_key(keys+14, DESKEY(ks)); DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results+16), DESKEY(ks), DES_ENCRYPT); } /* * Set up lanmanager and nt hashed passwords */ static void mkhash(char *password, unsigned char *nonce, /* 8 bytes */ unsigned char *lmresp /* must fit 0x18 bytes */ #ifdef USE_NTRESPONSES , unsigned char *ntresp /* must fit 0x18 bytes */ #endif ) { unsigned char lmbuffer[21]; #ifdef USE_NTRESPONSES unsigned char ntbuffer[21]; #endif unsigned char *pw; static const unsigned char magic[] = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 }; int i; int len = strlen(password); /* make it fit at least 14 bytes */ pw = ne_malloc(len<7?14:len*2); if(!pw) return; /* this will lead to a badly generated package */ if (len > 14) len = 14; for (i=0; i> 8) #define LONGQUARTET(x) ((x) & 0xff), (((x) >> 8)&0xff), \ (((x) >>16)&0xff), ((x)>>24) /* this is for creating ntlm header output */ static int ne_output_ntlm(ne_ntlm_context *ctx) { const char *domain=""; /* empty */ const char *host=""; /* empty */ int domlen=strlen(domain); int hostlen = strlen(host); int hostoff; /* host name offset */ int domoff; /* domain name offset */ int size; unsigned char ntlmbuf[256]; /* enough, unless the host/domain is very long */ if(!ctx->user || !ctx->passwd) /* no user, no auth */ return 0; /* OK */ switch(ctx->state) { case NTLMSTATE_TYPE1: default: /* for the weird cases we (re)start here */ hostoff = 32; domoff = hostoff + hostlen; /* Create and send a type-1 message: Index Description Content 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" (0x4e544c4d53535000) 8 NTLM Message Type long (0x01000000) 12 Flags long 16 Supplied Domain security buffer(*) 24 Supplied Workstation security buffer(*) 32 start of data block */ ne_snprintf((char *)ntlmbuf, sizeof(ntlmbuf), "NTLMSSP%c" "\x01%c%c%c" /* 32-bit type = 1 */ "%c%c%c%c" /* 32-bit NTLM flag field */ "%c%c" /* domain length */ "%c%c" /* domain allocated space */ "%c%c" /* domain name offset */ "%c%c" /* 2 zeroes */ "%c%c" /* host length */ "%c%c" /* host allocated space */ "%c%c" /* host name offset */ "%c%c" /* 2 zeroes */ "%s" /* host name */ "%s", /* domain string */ 0, /* trailing zero */ 0,0,0, /* part of type-1 long */ LONGQUARTET( NTLMFLAG_NEGOTIATE_OEM| /* 2 */ NTLMFLAG_NEGOTIATE_NTLM_KEY /* 200 */ /* equals 0x0202 */ ), SHORTPAIR(domlen), SHORTPAIR(domlen), SHORTPAIR(domoff), 0,0, SHORTPAIR(hostlen), SHORTPAIR(hostlen), SHORTPAIR(hostoff), 0,0, host, domain); /* initial packet length */ size = 32 + hostlen + domlen; /* now keeper of the base64 encoded package size */ if (ctx->requestToken) ne_free(ctx->requestToken); ctx->requestToken = ne_base64(ntlmbuf, size); break; case NTLMSTATE_TYPE2: /* We received the type-2 already, create a type-3 message: Index Description Content 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" (0x4e544c4d53535000) 8 NTLM Message Type long (0x03000000) 12 LM/LMv2 Response security buffer(*) 20 NTLM/NTLMv2 Response security buffer(*) 28 Domain Name security buffer(*) 36 User Name security buffer(*) 44 Workstation Name security buffer(*) (52) Session Key (optional) security buffer(*) (60) Flags (optional) long 52 (64) start of data block */ { int lmrespoff; int ntrespoff; int useroff; unsigned char lmresp[0x18]; /* fixed-size */ #ifdef USE_NTRESPONSES unsigned char ntresp[0x18]; /* fixed-size */ #endif const char *user; int userlen; user = strchr(ctx->user, '\\'); if(!user) user = strchr(ctx->user, '/'); if (user) { domain = ctx->user; domlen = user - domain; user++; } else user = ctx->user; userlen = strlen(user); mkhash(ctx->passwd, &ctx->nonce[0], lmresp #ifdef USE_NTRESPONSES , ntresp #endif ); domoff = 64; /* always */ useroff = domoff + domlen; hostoff = useroff + userlen; lmrespoff = hostoff + hostlen; ntrespoff = lmrespoff + 0x18; /* Create the big type-3 message binary blob */ size = ne_snprintf((char *)ntlmbuf, sizeof(ntlmbuf), "NTLMSSP%c" "\x03%c%c%c" /* type-3, 32 bits */ "%c%c%c%c" /* LanManager length + allocated space */ "%c%c" /* LanManager offset */ "%c%c" /* 2 zeroes */ "%c%c" /* NT-response length */ "%c%c" /* NT-response allocated space */ "%c%c" /* NT-response offset */ "%c%c" /* 2 zeroes */ "%c%c" /* domain length */ "%c%c" /* domain allocated space */ "%c%c" /* domain name offset */ "%c%c" /* 2 zeroes */ "%c%c" /* user length */ "%c%c" /* user allocated space */ "%c%c" /* user offset */ "%c%c" /* 2 zeroes */ "%c%c" /* host length */ "%c%c" /* host allocated space */ "%c%c" /* host offset */ "%c%c%c%c%c%c" /* 6 zeroes */ "\xff\xff" /* message length */ "%c%c" /* 2 zeroes */ "\x01\x82" /* flags */ "%c%c" /* 2 zeroes */ /* domain string */ /* user string */ /* host string */ /* LanManager response */ /* NT response */ , 0, /* zero termination */ 0,0,0, /* type-3 long, the 24 upper bits */ SHORTPAIR(0x18), /* LanManager response length, twice */ SHORTPAIR(0x18), SHORTPAIR(lmrespoff), 0x0, 0x0, #ifdef USE_NTRESPONSES SHORTPAIR(0x18), /* NT-response length, twice */ SHORTPAIR(0x18), #else 0x0, 0x0, 0x0, 0x0, #endif SHORTPAIR(ntrespoff), 0x0, 0x0, SHORTPAIR(domlen), SHORTPAIR(domlen), SHORTPAIR(domoff), 0x0, 0x0, SHORTPAIR(userlen), SHORTPAIR(userlen), SHORTPAIR(useroff), 0x0, 0x0, SHORTPAIR(hostlen), SHORTPAIR(hostlen), SHORTPAIR(hostoff), 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0); /* size is now 64 */ size=64; ntlmbuf[62]=ntlmbuf[63]=0; /* Make sure that the user and domain strings fit in the target buffer before we copy them there. */ if((size_t)size + userlen + domlen >= sizeof(ntlmbuf)) { return -1; } memcpy(&ntlmbuf[size], domain, domlen); size += domlen; memcpy(&ntlmbuf[size], user, userlen); size += userlen; /* we append the binary hashes to the end of the blob */ if(size < ((int)sizeof(ntlmbuf) - 0x18)) { memcpy(&ntlmbuf[size], lmresp, 0x18); size += 0x18; } #ifdef USE_NTRESPONSES if(size < ((int)sizeof(ntlmbuf) - 0x18)) { memcpy(&ntlmbuf[size], ntresp, 0x18); size += 0x18; } #endif ntlmbuf[56] = size & 0xff; ntlmbuf[57] = size >> 8; /* convert the binary blob into base64 */ ctx->requestToken = ne_base64(ntlmbuf, size); ctx->state = NTLMSTATE_TYPE3; /* we sent a type-3 */ } break; case NTLMSTATE_TYPE3: /* connection is already authenticated, * don't send a header in future requests */ if (ctx->requestToken) ne_free(ctx->requestToken); ctx->requestToken = NULL; break; } return 0; /* OK */ } ne_ntlm_context *ne__ntlm_create_context(const char *userName, const char *password) { ne_ntlm_context *ctx = ne_calloc(sizeof(ne_ntlm_context)); ctx->state = NTLMSTATE_NONE; ctx->user = ne_strdup(userName); ctx->passwd = ne_strdup(password); return ctx; } void ne__ntlm_destroy_context(ne_ntlm_context *context) { if (context->user) ne_free(context->user); if (context->passwd) ne_free(context->passwd); if (context->requestToken) ne_free(context->requestToken); ne_free(context); } int ne__ntlm_authenticate(ne_ntlm_context *context, const char *responseToken) { if (context == NULL) { return -1; } else { if (!responseToken && (context->state == NTLMSTATE_TYPE3)) context->state = NTLMSTATE_NONE; if (context->state <= NTLMSTATE_TYPE3) { ntlm ntlmstatus = ne_input_ntlm(context, responseToken); if (ntlmstatus != NTLM_FINE) { return -1; } } } return ne_output_ntlm(context); } char *ne__ntlm_getRequestToken(ne_ntlm_context *context) { char *ret; if (context == NULL || !context->requestToken) { return NULL; } ret = ne_strdup(context->requestToken); ne_free(context->requestToken); context->requestToken = NULL; return ret; } #endif /* HAVE_OPENSSL */ #endif /* HAVE_NTLM */ cadaver-0.23.3/lib/neon/ne_207.c0000664000076400007640000002472110356210727015502 0ustar jortonjorton/* WebDAV 207 multi-status response handling Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* Generic handling for WebDAV 207 Multi-Status responses. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #include "ne_alloc.h" #include "ne_utils.h" #include "ne_xml.h" #include "ne_207.h" #include "ne_uri.h" #include "ne_basic.h" #include "ne_internal.h" struct ne_207_parser_s { ne_207_start_response *start_response; ne_207_end_response *end_response; ne_207_start_propstat *start_propstat; ne_207_end_propstat *end_propstat; ne_xml_parser *parser; void *userdata; ne_uri base; ne_buffer *cdata; /* remember whether we are in a response: the validation * doesn't encapsulate this since we only count as being * "in a response" when we've seen the href element. */ int in_response; /* current position */ void *response, *propstat; /* caching */ ne_status status; char *description, *href; }; #define ELM_multistatus 1 #define ELM_response 2 #define ELM_responsedescription 3 #define ELM_href 4 #define ELM_prop (NE_207_STATE_PROP) #define ELM_status 6 #define ELM_propstat 7 static const struct ne_xml_idmap map207[] = { { "DAV:", "multistatus", ELM_multistatus }, { "DAV:", "response", ELM_response }, { "DAV:", "responsedescription", ELM_responsedescription }, { "DAV:", "href", ELM_href }, { "DAV:", "propstat", ELM_propstat }, { "DAV:", "prop", ELM_prop }, { "DAV:", "status", ELM_status } }; /* Set the callbacks for the parser */ void ne_207_set_response_handlers(ne_207_parser *p, ne_207_start_response *start, ne_207_end_response *end) { p->start_response = start; p->end_response = end; } void ne_207_set_propstat_handlers(ne_207_parser *p, ne_207_start_propstat *start, ne_207_end_propstat *end) { p->start_propstat = start; p->end_propstat = end; } void *ne_207_get_current_response(ne_207_parser *p) { return p->response; } void *ne_207_get_current_propstat(ne_207_parser *p) { return p->propstat; } /* return non-zero if (child, parent) is an interesting element */ static int can_handle(int parent, int child) { return (parent == 0 && child == ELM_multistatus) || (parent == ELM_multistatus && child == ELM_response) || (parent == ELM_response && (child == ELM_href || child == ELM_status || child == ELM_propstat || child == ELM_responsedescription)) || (parent == ELM_propstat && (child == ELM_prop || child == ELM_status || child == ELM_responsedescription)); } static int cdata_207(void *userdata, int state, const char *buf, size_t len) { ne_207_parser *p = userdata; if ((state == ELM_href || state == ELM_responsedescription || state == ELM_status) && p->cdata->used + len < 2048) ne_buffer_append(p->cdata, buf, len); return 0; } static int start_element(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { ne_207_parser *p = userdata; int state = ne_xml_mapid(map207, NE_XML_MAPLEN(map207), nspace, name); if (!can_handle(parent, state)) return NE_XML_DECLINE; /* if not in a response, ignore everything. */ if (!p->in_response && state != ELM_response && state != ELM_multistatus && state != ELM_href) return NE_XML_DECLINE; if (state == ELM_propstat && p->start_propstat) { p->propstat = p->start_propstat(p->userdata, p->response); if (p->propstat == NULL) { return NE_XML_ABORT; } } ne_buffer_clear(p->cdata); return state; } #define GIVE_STATUS(p) ((p)->status.reason_phrase?&(p)->status:NULL) #define HAVE_CDATA(p) ((p)->cdata->used > 1) static int end_element(void *userdata, int state, const char *nspace, const char *name) { ne_207_parser *p = userdata; const char *cdata = ne_shave(p->cdata->data, "\r\n\t "); switch (state) { case ELM_responsedescription: if (HAVE_CDATA(p)) { if (p->description) ne_free(p->description); p->description = ne_strdup(cdata); } break; case ELM_href: /* Now we have the href, begin the response */ if (p->start_response && HAVE_CDATA(p)) { ne_uri ref, resolved; if (ne_uri_parse(cdata, &ref) == 0) { ne_uri_resolve(&p->base, &ref, &resolved); p->response = p->start_response(p->userdata, &resolved); p->in_response = 1; ne_uri_free(&resolved); } ne_uri_free(&ref); } break; case ELM_status: if (HAVE_CDATA(p)) { if (p->status.reason_phrase) ne_free(p->status.reason_phrase); if (ne_parse_statusline(cdata, &p->status)) { char buf[500]; NE_DEBUG(NE_DBG_HTTP, "Status line: %s\n", cdata); ne_snprintf(buf, 500, _("Invalid HTTP status line in status element " "at line %d of response:\nStatus line was: %s"), ne_xml_currentline(p->parser), cdata); ne_xml_set_error(p->parser, buf); return -1; } else { NE_DEBUG(NE_DBG_XML, "Decoded status line: %s\n", cdata); } } break; case ELM_propstat: if (p->end_propstat) p->end_propstat(p->userdata, p->propstat, GIVE_STATUS(p), p->description); p->propstat = NULL; if (p->description) ne_free(p->description); if (p->status.reason_phrase) ne_free(p->status.reason_phrase); p->description = p->status.reason_phrase = NULL; break; case ELM_response: if (!p->in_response) break; if (p->end_response) p->end_response(p->userdata, p->response, GIVE_STATUS(p), p->description); p->response = NULL; p->in_response = 0; if (p->description) ne_free(p->description); if (p->status.reason_phrase) ne_free(p->status.reason_phrase); p->description = p->status.reason_phrase = NULL; break; } return 0; } ne_207_parser *ne_207_create(ne_xml_parser *parser, const ne_uri *base, void *userdata) { ne_207_parser *p = ne_calloc(sizeof *p); p->parser = parser; p->userdata = userdata; p->cdata = ne_buffer_create(); ne_uri_copy(&p->base, base); /* Add handler for the standard 207 elements */ ne_xml_push_handler(parser, start_element, cdata_207, end_element, p); return p; } void ne_207_destroy(ne_207_parser *p) { if (p->status.reason_phrase) ne_free(p->status.reason_phrase); ne_buffer_destroy(p->cdata); ne_uri_free(&p->base); ne_free(p); } int ne_accept_207(void *userdata, ne_request *req, const ne_status *status) { return (status->code == 207); } /* Handling of 207 errors: we keep a string buffer, and append * messages to it as they come down. * * Note, 424 means it would have worked but something else went wrong. * We will have had the error for "something else", so we display * that, and skip 424 errors. */ /* This is passed as userdata to the 207 code. */ struct context { char *href; ne_buffer *buf; unsigned int is_error; }; static void *start_response(void *userdata, const ne_uri *uri) { struct context *ctx = userdata; if (ctx->href) ne_free(ctx->href); ctx->href = ne_uri_unparse(uri); return NULL; } static void handle_error(struct context *ctx, const ne_status *status, const char *description) { if (status && status->klass != 2 && status->code != 424) { char buf[50]; ctx->is_error = 1; sprintf(buf, "%d", status->code); ne_buffer_concat(ctx->buf, ctx->href, ": ", buf, " ", status->reason_phrase, "\n", NULL); if (description != NULL) { /* TODO: these can be multi-line. Would be good to * word-wrap this at col 80. */ ne_buffer_concat(ctx->buf, " -> ", description, "\n", NULL); } } } static void end_response(void *userdata, void *response, const ne_status *status, const char *description) { struct context *ctx = userdata; handle_error(ctx, status, description); } static void end_propstat(void *userdata, void *propstat, const ne_status *status, const char *description) { struct context *ctx = userdata; handle_error(ctx, status, description); } /* Dispatch a DAV request and handle a 207 error response appropriately */ /* TODO: hook up Content-Type parsing; passing charset to XML parser */ int ne_simple_request(ne_session *sess, ne_request *req) { int ret; struct context ctx = {0}; ne_207_parser *p207; ne_xml_parser *p = ne_xml_create(); ne_uri base = {0}; /* Mock up a base URI; it should really be retrieved from the * request object. */ ne_fill_server_uri(sess, &base); base.path = ne_strdup("/"); p207 = ne_207_create(p, &base, &ctx); ne_uri_free(&base); /* The error string is progressively written into the * ne_buffer by the element callbacks */ ctx.buf = ne_buffer_create(); ne_207_set_response_handlers(p207, start_response, end_response); ne_207_set_propstat_handlers(p207, NULL, end_propstat); ne_add_response_body_reader(req, ne_accept_207, ne_xml_parse_v, p); ret = ne_request_dispatch(req); if (ret == NE_OK) { if (ne_get_status(req)->code == 207) { if (ne_xml_failed(p)) { /* The parse was invalid */ ne_set_error(sess, "%s", ne_xml_get_error(p)); ret = NE_ERROR; } else if (ctx.is_error) { /* If we've actually got any error information * from the 207, then set that as the error */ ne_set_error(sess, "%s", ctx.buf->data); ret = NE_ERROR; } } else if (ne_get_status(req)->klass != 2) { ret = NE_ERROR; } } ne_207_destroy(p207); ne_xml_destroy(p); ne_buffer_destroy(ctx.buf); if (ctx.href) ne_free(ctx.href); ne_request_destroy(req); return ret; } cadaver-0.23.3/lib/neon/ne_socks.c0000664000076400007640000002333110772675651016325 0ustar jortonjorton/* SOCKS proxy support for neon Copyright (C) 2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include "ne_internal.h" #include "ne_string.h" #include "ne_socket.h" #include "ne_utils.h" #include /* SOCKS protocol reference: v4: http://www.ufasoft.com/doc/socks4_protocol.htm v4a http://www.smartftp.com/Products/SmartFTP/RFC/socks4a.protocol v5: http://tools.ietf.org/html/rfc1928 ...v5 auth: http://tools.ietf.org/html/rfc1929 */ #define V5_REPLY_OK 0 #define V5_REPLY_FAIL 1 #define V5_REPLY_DISALLOW 2 #define V5_REPLY_NET_UNREACH 3 #define V5_REPLY_HOST_UNREACH 4 #define V5_REPLY_CONN_REFUSED 5 #define V5_REPLY_TTL_EXPIRED 6 #define V5_REPLY_CMD_UNSUPPORTED 7 #define V5_REPLY_TYPE_UNSUPPORTED 8 #define V5_VERSION 0x05 #define V5_ADDR_IPV4 0x01 #define V5_ADDR_FQDN 0x03 #define V5_ADDR_IPV6 0x04 #define V5_CMD_CONNECT 0x01 #define V5_AUTH_NONE 0x00 #define V5_AUTH_USER 0x02 #define V5_AUTH_NOMETH 0xFF /* Fail with given V5 error code in given context. */ static int v5fail(ne_socket *sock, unsigned int code, const char *context) { const char *err; switch (code) { case V5_REPLY_FAIL: err = _("failure"); break; case V5_REPLY_DISALLOW: err = _("connection not permitted"); break; case V5_REPLY_NET_UNREACH: err = _("network unreachable"); break; case V5_REPLY_HOST_UNREACH: err = _("host unreachable"); break; case V5_REPLY_TTL_EXPIRED: err = _("TTL expired"); break; case V5_REPLY_CMD_UNSUPPORTED: err = _("command not supported"); break; case V5_REPLY_TYPE_UNSUPPORTED: err = _("address type not supported"); break; default: ne_sock_set_error(sock, _("%s: unrecognized error (%u)"), context, code); return NE_SOCK_ERROR; } ne_sock_set_error(sock, "%s: %s", context, err); return NE_SOCK_ERROR; } /* Fail with given error string. */ static int fail(ne_socket *sock, const char *error) { ne_sock_set_error(sock, "%s", error); return NE_SOCK_ERROR; } /* Fail with given NE_SOCK_* error code and given context. */ static int sofail(ne_socket *sock, ssize_t ret, const char *context) { char *err = ne_strdup(ne_sock_error(sock)); ne_sock_set_error(sock, "%s: %s", context, err); ne_free(err); return NE_SOCK_ERROR; } /* SOCKSv5 proxy. */ static int v5_proxy(ne_socket *sock, const ne_inet_addr *addr, const char *hostname, unsigned int port, const char *username, const char *password) { unsigned char msg[1024], *p; unsigned int len; int ret; ssize_t n; p = msg; *p++ = V5_VERSION; *p++ = 2; /* Two supported auth protocols; none and user. */ *p++ = V5_AUTH_NONE; *p++ = V5_AUTH_USER; ret = ne_sock_fullwrite(sock, (char *)msg, p - msg); if (ret) { return sofail(sock, ret, _("Could not send message to proxy")); } n = ne_sock_fullread(sock, (char *)msg, 2); if (n) { return sofail(sock, ret, _("Could not read initial response from proxy")); } else if (msg[0] != V5_VERSION) { return fail(sock, _("Invalid version in proxy response")); } /* Authenticate, if necessary. */ switch (msg[1]) { case V5_AUTH_NONE: break; case V5_AUTH_USER: p = msg; *p++ = 0x01; len = strlen(username) & 0xff; *p++ = len; memcpy(p, username, len); p += len; len = strlen(password) & 0xff; *p++ = len; memcpy(p, password, len); p += len; ret = ne_sock_fullwrite(sock, (char *)msg, p - msg); if (ret) { return sofail(sock, ret, _("Could not send login message")); } n = ne_sock_fullread(sock, (char *)msg, 2); if (n) { return sofail(sock, ret, _("Could not read login reply")); } else if (msg[0] != 1) { return fail(sock, _("Invalid version in login reply")); } else if (msg[1] != 0) { return fail(sock, _("Authentication failed")); } break; case V5_AUTH_NOMETH: return fail(sock, _("No acceptable authentication method")); default: return fail(sock, _("Unexpected authentication method chosen")); } /* Send the CONNECT command. */ p = msg; *p++ = V5_VERSION; *p++ = V5_CMD_CONNECT; *p++ = 0; /* reserved */ if (addr) { unsigned char raw[16]; if (ne_iaddr_typeof(addr) == ne_iaddr_ipv4) { len = 4; *p++ = V5_ADDR_IPV4; } else { len = 16; *p++ = V5_ADDR_IPV6; } memcpy(p, ne_iaddr_raw(addr, raw), len); p += len; } else { len = strlen(hostname) & 0xff; *p++ = V5_ADDR_FQDN; *p++ = len; memcpy(p, hostname, len); p += len; } *p++ = (port >> 8) & 0xff; *p++ = port & 0xff; ret = ne_sock_fullwrite(sock, (char *)msg, p - msg); if (ret) { return sofail(sock, ret, _("Could not send connect request")); } n = ne_sock_fullread(sock, (char *)msg, 4); if (n) { return sofail(sock, n, _("Could not read connect reply")); } if (msg[0] != V5_VERSION) { return fail(sock, _("Invalid version in connect reply")); } if (msg[1] != V5_REPLY_OK) { return v5fail(sock, msg[1], _("Could not connect")); } switch (msg[3]) { case V5_ADDR_IPV4: len = 4; break; case V5_ADDR_IPV6: len = 16; break; case V5_ADDR_FQDN: n = ne_sock_read(sock, (char *)msg, 1); if (n != 1) { return sofail(sock, n, _("Could not read FQDN length in connect reply")); } len = msg[0]; break; default: return fail(sock, _("Unknown address type in connect reply")); } n = ne_sock_fullread(sock, (char *)msg, len + 2); if (n) { return sofail(sock, n, _("Could not read address in connect reply")); } return 0; } #define V4_VERSION 0x04 #define V4_CMD_STREAM 0x01 #define V4_REP_OK 0x5a /* request granted */ #define V4_REP_FAIL 0x5b /* request rejected or failed */ #define V4_REP_NOIDENT 0x5c /* request failed, could connect to identd */ #define V4_REP_IDFAIL 0x5d /* request failed, identd denial */ /* Fail for given SOCKSv4 error code. */ static int v4fail(ne_socket *sock, unsigned int code, const char *context) { const char *err; switch (code) { case V4_REP_FAIL: err = _("request rejected or failed"); break; case V4_REP_NOIDENT: err = _("could not establish connection to identd"); break; case V4_REP_IDFAIL: err = _("rejected due to identd user mismatch"); break; default: ne_sock_set_error(sock, _("%s: unrecognized failure (%u)"), context, code); return NE_SOCK_ERROR; } ne_sock_set_error(sock, "%s: %s", context, err); return NE_SOCK_ERROR; } /* SOCKS v4 or v4A proxy. */ static int v4_proxy(ne_socket *sock, enum ne_sock_sversion vers, const ne_inet_addr *addr, const char *hostname, unsigned int port, const char *username) { unsigned char msg[1024], raw[16], *p; ssize_t n; int ret; p = msg; *p++ = V4_VERSION; *p++ = V4_CMD_STREAM; *p++ = (port >> 8) & 0xff; *p++ = port & 0xff; if (vers == NE_SOCK_SOCKSV4A) { /* A bogus address is used to signify use of the hostname, * 0.0.0.X where X != 0. */ memcpy(p, "\x00\x00\x00\xff", 4); } else { /* API precondition that addr is IPv4; if it's not this will * just copy out the first four bytes of the v6 address; * garbage in => garbage out. */ memcpy(p, ne_iaddr_raw(addr, raw), 4); } p += 4; if (username) { unsigned int len = strlen(username) & 0xff; memcpy(p, username, len); p += len; } *p++ = '\0'; if (vers == NE_SOCK_SOCKSV4A) { unsigned int len = strlen(hostname) & 0xff; memcpy(p, hostname, len); p += len; *p++ = '\0'; } ret = ne_sock_fullwrite(sock, (char *)msg, p - msg); if (ret) { return sofail(sock, ret, _("Could not send message to proxy")); } n = ne_sock_fullread(sock, (char *)msg, 8); if (n) { return sofail(sock, ret, _("Could not read response from proxy")); } if (msg[1] != V4_REP_OK) { return v4fail(sock, ret, _("Could not connect")); } return 0; } int ne_sock_proxy(ne_socket *sock, enum ne_sock_sversion vers, const ne_inet_addr *addr, const char *hostname, unsigned int port, const char *username, const char *password) { if (vers == NE_SOCK_SOCKSV5) { return v5_proxy(sock, addr, hostname, port, username, password); } else { return v4_proxy(sock, vers, addr, hostname, port, username); } } cadaver-0.23.3/lib/neon/ne_string.c0000664000076400007640000004125611240311511016464 0ustar jortonjorton/* String utility functions Copyright (C) 1999-2007, 2009, Joe Orton strcasecmp/strncasecmp implementations are: Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include #include "ne_alloc.h" #include "ne_string.h" char *ne_token(char **str, char separator) { char *ret = *str, *pnt = strchr(*str, separator); if (pnt) { *pnt = '\0'; *str = pnt + 1; } else { /* no separator found: return end of string. */ *str = NULL; } return ret; } char *ne_qtoken(char **str, char separator, const char *quotes) { char *pnt, *ret = NULL; for (pnt = *str; *pnt != '\0'; pnt++) { char *quot = strchr(quotes, *pnt); if (quot) { char *qclose = strchr(pnt+1, *quot); if (!qclose) { /* no closing quote: invalid string. */ return NULL; } pnt = qclose; } else if (*pnt == separator) { /* found end of token. */ *pnt = '\0'; ret = *str; *str = pnt + 1; return ret; } } /* no separator found: return end of string. */ ret = *str; *str = NULL; return ret; } char *ne_shave(char *str, const char *whitespace) { char *pnt, *ret = str; while (*ret != '\0' && strchr(whitespace, *ret) != NULL) { ret++; } /* pnt points at the NUL terminator. */ pnt = &ret[strlen(ret)]; while (pnt > ret && strchr(whitespace, *(pnt-1)) != NULL) { pnt--; } *pnt = '\0'; return ret; } void ne_buffer_clear(ne_buffer *buf) { memset(buf->data, 0, buf->length); buf->used = 1; } /* Grows for given size, returns 0 on success, -1 on error. */ void ne_buffer_grow(ne_buffer *buf, size_t newsize) { #define NE_BUFFER_GROWTH 512 if (newsize > buf->length) { /* If it's not big enough already... */ buf->length = ((newsize / NE_BUFFER_GROWTH) + 1) * NE_BUFFER_GROWTH; /* Reallocate bigger buffer */ buf->data = ne_realloc(buf->data, buf->length); } } static size_t count_concat(va_list *ap) { size_t total = 0; char *next; while ((next = va_arg(*ap, char *)) != NULL) total += strlen(next); return total; } static void do_concat(char *str, va_list *ap) { char *next; while ((next = va_arg(*ap, char *)) != NULL) { #ifdef HAVE_STPCPY str = stpcpy(str, next); #else size_t len = strlen(next); memcpy(str, next, len); str += len; #endif } } void ne_buffer_concat(ne_buffer *buf, ...) { va_list ap; ssize_t total; va_start(ap, buf); total = buf->used + count_concat(&ap); va_end(ap); /* Grow the buffer */ ne_buffer_grow(buf, total); va_start(ap, buf); do_concat(buf->data + buf->used - 1, &ap); va_end(ap); buf->used = total; buf->data[total - 1] = '\0'; } char *ne_concat(const char *str, ...) { va_list ap; size_t total, slen = strlen(str); char *ret; va_start(ap, str); total = slen + count_concat(&ap); va_end(ap); ret = memcpy(ne_malloc(total + 1), str, slen); va_start(ap, str); do_concat(ret + slen, &ap); va_end(ap); ret[total] = '\0'; return ret; } /* Append zero-terminated string... returns 0 on success or -1 on * realloc failure. */ void ne_buffer_zappend(ne_buffer *buf, const char *str) { ne_buffer_append(buf, str, strlen(str)); } void ne_buffer_append(ne_buffer *buf, const char *data, size_t len) { ne_buffer_grow(buf, buf->used + len); memcpy(buf->data + buf->used - 1, data, len); buf->used += len; buf->data[buf->used - 1] = '\0'; } size_t ne_buffer_snprintf(ne_buffer *buf, size_t max, const char *fmt, ...) { va_list ap; size_t ret; ne_buffer_grow(buf, buf->used + max); va_start(ap, fmt); ret = ne_vsnprintf(buf->data + buf->used - 1, max, fmt, ap); va_end(ap); buf->used += ret; return ret; } ne_buffer *ne_buffer_create(void) { return ne_buffer_ncreate(512); } ne_buffer *ne_buffer_ncreate(size_t s) { ne_buffer *buf = ne_malloc(sizeof(*buf)); buf->data = ne_malloc(s); buf->data[0] = '\0'; buf->length = s; buf->used = 1; return buf; } void ne_buffer_destroy(ne_buffer *buf) { ne_free(buf->data); ne_free(buf); } char *ne_buffer_finish(ne_buffer *buf) { char *ret = buf->data; ne_free(buf); return ret; } void ne_buffer_altered(ne_buffer *buf) { buf->used = strlen(buf->data) + 1; } /* ascii_quote[n] gives the number of bytes needed by * ne_buffer_qappend() to append character 'n'. */ static const unsigned char ascii_quote[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; static const char hex_chars[16] = "0123456789ABCDEF"; /* Return the expected number of bytes needed to append the string * beginning at byte 's', where 'send' points to the last byte after * 's'. */ static size_t qappend_count(const unsigned char *s, const unsigned char *send) { const unsigned char *p; size_t ret; for (p = s, ret = 0; p < send; p++) { ret += ascii_quote[*p]; } return ret; } /* Append the string 's', up to but not including 'send', to string * 'dest', quoting along the way. Returns pointer to NUL. */ static char *quoted_append(char *dest, const unsigned char *s, const unsigned char *send) { const unsigned char *p; char *q = dest; for (p = s; p < send; p++) { if (ascii_quote[*p] == 1) { *q++ = *p; } else { *q++ = '\\'; *q++ = 'x'; *q++ = hex_chars[(*p >> 4) & 0x0f]; *q++ = hex_chars[*p & 0x0f]; } } /* NUL terminate after the last character */ *q = '\0'; return q; } void ne_buffer_qappend(ne_buffer *buf, const unsigned char *data, size_t len) { const unsigned char *dend = data + len; char *q, *qs; ne_buffer_grow(buf, buf->used + qappend_count(data, dend)); /* buf->used >= 1, so this is safe. */ qs = buf->data + buf->used - 1; q = quoted_append(qs, data, dend); /* used already accounts for a NUL, so increment by number of * characters appended, *before* the NUL. */ buf->used += q - qs; } char *ne_strnqdup(const unsigned char *data, size_t len) { const unsigned char *dend = data + len; char *dest = malloc(qappend_count(data, dend) + 1); quoted_append(dest, data, dend); return dest; } static const char b64_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/="; char *ne_base64(const unsigned char *text, size_t inlen) { /* The tricky thing about this is doing the padding at the end, * doing the bit manipulation requires a bit of concentration only */ char *buffer, *point; size_t outlen; /* Use 'buffer' to store the output. Work out how big it should be... * This must be a multiple of 4 bytes */ outlen = (inlen*4)/3; if ((inlen % 3) > 0) /* got to pad */ outlen += 4 - (inlen % 3); buffer = ne_malloc(outlen + 1); /* +1 for the \0 */ /* now do the main stage of conversion, 3 bytes at a time, * leave the trailing bytes (if there are any) for later */ for (point=buffer; inlen>=3; inlen-=3, text+=3) { *(point++) = b64_alphabet[ (*text)>>2 ]; *(point++) = b64_alphabet[ ((*text)<<4 & 0x30) | (*(text+1))>>4 ]; *(point++) = b64_alphabet[ ((*(text+1))<<2 & 0x3c) | (*(text+2))>>6 ]; *(point++) = b64_alphabet[ (*(text+2)) & 0x3f ]; } /* Now deal with the trailing bytes */ if (inlen > 0) { /* We always have one trailing byte */ *(point++) = b64_alphabet[ (*text)>>2 ]; *(point++) = b64_alphabet[ (((*text)<<4 & 0x30) | (inlen==2?(*(text+1))>>4:0)) ]; *(point++) = (inlen==1?'=':b64_alphabet[ (*(text+1))<<2 & 0x3c ]); *(point++) = '='; } /* Null-terminate */ *point = '\0'; return buffer; } /* VALID_B64: fail if 'ch' is not a valid base64 character */ #define VALID_B64(ch) (((ch) >= 'A' && (ch) <= 'Z') || \ ((ch) >= 'a' && (ch) <= 'z') || \ ((ch) >= '0' && (ch) <= '9') || \ (ch) == '/' || (ch) == '+' || (ch) == '=') /* DECODE_B64: decodes a valid base64 character. */ #define DECODE_B64(ch) ((ch) >= 'a' ? ((ch) + 26 - 'a') : \ ((ch) >= 'A' ? ((ch) - 'A') : \ ((ch) >= '0' ? ((ch) + 52 - '0') : \ ((ch) == '+' ? 62 : 63)))) size_t ne_unbase64(const char *data, unsigned char **out) { size_t inlen = strlen(data); unsigned char *outp; const unsigned char *in; if (inlen == 0 || (inlen % 4) != 0) return 0; outp = *out = ne_malloc(inlen * 3 / 4); for (in = (const unsigned char *)data; *in; in += 4) { unsigned int tmp; if (!VALID_B64(in[0]) || !VALID_B64(in[1]) || !VALID_B64(in[2]) || !VALID_B64(in[3]) || in[0] == '=' || in[1] == '=' || (in[2] == '=' && in[3] != '=')) { ne_free(*out); return 0; } tmp = (DECODE_B64(in[0]) & 0x3f) << 18 | (DECODE_B64(in[1]) & 0x3f) << 12; *outp++ = (tmp >> 16) & 0xff; if (in[2] != '=') { tmp |= (DECODE_B64(in[2]) & 0x3f) << 6; *outp++ = (tmp >> 8) & 0xff; if (in[3] != '=') { tmp |= DECODE_B64(in[3]) & 0x3f; *outp++ = tmp & 0xff; } } } return outp - *out; } /* Character map array; ascii_clean[n] = isprint(n) ? n : 0x20. Used * by ne_strclean as a locale-independent isprint(). */ static const unsigned char ascii_clean[256] = { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; char *ne_strclean(char *str) { unsigned char *pnt; for (pnt = (unsigned char *)str; *pnt; pnt++) *pnt = (char)ascii_clean[*pnt]; return str; } char *ne_strerror(int errnum, char *buf, size_t buflen) { #ifdef HAVE_STRERROR_R #ifdef STRERROR_R_CHAR_P /* glibc-style strerror_r which may-or-may-not use provided buffer. */ char *ret = strerror_r(errnum, buf, buflen); if (ret != buf) ne_strnzcpy(buf, ret, buflen); #else /* POSIX-style strerror_r: */ char tmp[256]; if (strerror_r(errnum, tmp, sizeof tmp) == 0) ne_strnzcpy(buf, tmp, buflen); else ne_snprintf(buf, buflen, "Unknown error %d", errnum); #endif #else /* no strerror_r: */ ne_strnzcpy(buf, strerror(errnum), buflen); #endif return buf; } /* Wrapper for ne_snprintf. */ size_t ne_snprintf(char *str, size_t size, const char *fmt, ...) { va_list ap; va_start(ap, fmt); #ifdef HAVE_TRIO trio_vsnprintf(str, size, fmt, ap); #else vsnprintf(str, size, fmt, ap); #endif va_end(ap); str[size-1] = '\0'; return strlen(str); } /* Wrapper for ne_vsnprintf. */ size_t ne_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) { #ifdef HAVE_TRIO trio_vsnprintf(str, size, fmt, ap); #else vsnprintf(str, size, fmt, ap); #endif str[size-1] = '\0'; return strlen(str); } /* Locale-independent strcasecmp implementations. */ static const unsigned char ascii_tolower[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; #define TOLOWER(ch) ascii_tolower[ch] const unsigned char *ne_tolower_array(void) { return ascii_tolower; } int ne_strcasecmp(const char *s1, const char *s2) { const unsigned char *p1 = (const unsigned char *) s1; const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; if (p1 == p2) return 0; do { c1 = TOLOWER(*p1++); c2 = TOLOWER(*p2++); if (c1 == '\0') break; } while (c1 == c2); return c1 - c2; } int ne_strncasecmp(const char *s1, const char *s2, size_t n) { const unsigned char *p1 = (const unsigned char *) s1; const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; if (p1 == p2 || n == 0) return 0; do { c1 = TOLOWER(*p1++); c2 = TOLOWER(*p2++); if (c1 == '\0' || c1 != c2) return c1 - c2; } while (--n > 0); return c1 - c2; } cadaver-0.23.3/lib/neon/ne_stubssl.c0000664000076400007640000000644310752313011016660 0ustar jortonjorton/* Stubs for SSL support when no SSL library has been configured Copyright (C) 2002-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include /* for NULL */ #include "ne_ssl.h" #include "ne_session.h" char *ne_ssl_readable_dname(const ne_ssl_dname *dn) { return NULL; } ne_ssl_certificate *ne_ssl_cert_read(const char *filename) { return NULL; } int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, const ne_ssl_certificate *c2) { return 1; } const ne_ssl_certificate *ne_ssl_cert_signedby(const ne_ssl_certificate *cert) { return NULL; } const ne_ssl_dname *ne_ssl_cert_issuer(const ne_ssl_certificate *cert) { return NULL; } const ne_ssl_dname *ne_ssl_cert_subject(const ne_ssl_certificate *cert) { return NULL; } void ne_ssl_cert_free(ne_ssl_certificate *cert) {} ne_ssl_client_cert *ne_ssl_clicert_read(const char *filename) { return NULL; } const ne_ssl_certificate *ne_ssl_clicert_owner(const ne_ssl_client_cert *ccert) { return NULL; } int ne_ssl_clicert_encrypted(const ne_ssl_client_cert *ccert) { return -1; } int ne_ssl_clicert_decrypt(ne_ssl_client_cert *ccert, const char *password) { return -1; } void ne_ssl_clicert_free(ne_ssl_client_cert *ccert) {} void ne_ssl_trust_default_ca(ne_session *sess) {} ne_ssl_context *ne_ssl_context_create(int mode) { return NULL; } void ne_ssl_context_trustcert(ne_ssl_context *ctx, const ne_ssl_certificate *cert) {} int ne_ssl_context_set_verify(ne_ssl_context *ctx, int required, const char *ca_names, const char *verify_cas) { return -1; } void ne_ssl_context_set_flag(ne_ssl_context *ctx, int flag, int value) {} void ne_ssl_context_destroy(ne_ssl_context *ctx) {} int ne_ssl_cert_digest(const ne_ssl_certificate *cert, char digest[60]) { return -1; } void ne_ssl_cert_validity_time(const ne_ssl_certificate *cert, time_t *from, time_t *until) {} const char *ne_ssl_cert_identity(const ne_ssl_certificate *cert) { return NULL; } const char *ne_ssl_clicert_name(const ne_ssl_client_cert *ccert) { return NULL; } int ne_ssl_dname_cmp(const ne_ssl_dname *dn1, const ne_ssl_dname *dn2) { return -1; } int ne_ssl_cert_write(const ne_ssl_certificate *cert, const char *filename) { return -1; } char *ne_ssl_cert_export(const ne_ssl_certificate *cert) { return NULL; } ne_ssl_certificate *ne_ssl_cert_import(const char *data) { return NULL; } void ne_ssl_set_clicert(ne_session *sess, const ne_ssl_client_cert *cc) {} cadaver-0.23.3/lib/neon/ne_request.h0000664000076400007640000003411310753065614016667 0ustar jortonjorton/* HTTP Request Handling Copyright (C) 1999-2006, 2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_REQUEST_H #define NE_REQUEST_H #include "ne_utils.h" /* For ne_status */ #include "ne_string.h" /* For ne_buffer */ #include "ne_session.h" NE_BEGIN_DECLS #define NE_OK (0) /* Success */ #define NE_ERROR (1) /* Generic error; use ne_get_error(session) for message */ #define NE_LOOKUP (2) /* Server or proxy hostname lookup failed */ #define NE_AUTH (3) /* User authentication failed on server */ #define NE_PROXYAUTH (4) /* User authentication failed on proxy */ #define NE_CONNECT (5) /* Could not connect to server */ #define NE_TIMEOUT (6) /* Connection timed out */ #define NE_FAILED (7) /* The precondition failed */ #define NE_RETRY (8) /* Retry request (ne_end_request ONLY) */ #define NE_REDIRECT (9) /* See ne_redirect.h */ /* Opaque object representing a single HTTP request. */ typedef struct ne_request_s ne_request; /***** Request Handling *****/ /* Create a request in session 'sess', with given method and path. * 'path' must conform to the 'abs_path' grammar in RFC2396, with an * optional "? query" part, and MUST be URI-escaped by the caller. */ ne_request *ne_request_create(ne_session *sess, const char *method, const char *path); /* The request body will be taken from 'size' bytes of 'buffer'. */ void ne_set_request_body_buffer(ne_request *req, const char *buffer, size_t size); /* The request body will be taken from 'length' bytes read from the * file descriptor 'fd', starting from file offset 'offset'. */ void ne_set_request_body_fd(ne_request *req, int fd, ne_off_t offset, ne_off_t length); /* "Pull"-based request body provider: a callback which is invoked to * provide blocks of request body on demand. * * Before each time the body is provided, the callback will be called * once with buflen == 0. The body may have to be provided >1 time * per request (for authentication retries etc.). * * For a call with buflen == 0, the callback must return zero on success * or non-zero on error; the session error string must be set on error. * For a call with buflen > 0, the callback must return: * <0 : error, abort request; session error string must be set. * 0 : ignore 'buffer' contents, end of body. * 0 < x <= buflen : buffer contains x bytes of body data. */ typedef ssize_t (*ne_provide_body)(void *userdata, char *buffer, size_t buflen); /* Install a callback which is invoked as needed to provide the * request body, a block at a time. The total size of the request * body is 'length'; the callback must ensure that it returns no more * than 'length' bytes in total. */ void ne_set_request_body_provider(ne_request *req, ne_off_t length, ne_provide_body provider, void *userdata); /* Handling response bodies; two callbacks must be provided: * * 1) 'acceptance' callback: determines whether you want to handle the * response body given the response-status information, e.g., if you * only want 2xx responses, say so here. * * 2) 'reader' callback: passed blocks of the response-body as they * arrive, if the acceptance callback returned non-zero. */ /* 'acceptance' callback type. Return non-zero to accept the response, * else zero to ignore it. */ typedef int (*ne_accept_response)(void *userdata, ne_request *req, const ne_status *st); /* An 'acceptance' callback which only accepts 2xx-class responses. * Ignores userdata. */ int ne_accept_2xx(void *userdata, ne_request *req, const ne_status *st); /* An acceptance callback which accepts all responses. Ignores * userdata. */ int ne_accept_always(void *userdata, ne_request *req, const ne_status *st); /* Callback for reading a block of data. Returns zero on success, or * non-zero on error. If returning an error, the response will be * aborted and the callback will not be invoked again. The request * dispatch (or ne_read_response_block call) will fail with NE_ERROR; * the session error string should have been set by the callback. */ typedef int (*ne_block_reader)(void *userdata, const char *buf, size_t len); /* Add a response reader for the given request, with the given * acceptance function. userdata is passed as the first argument to * the acceptance + reader callbacks. * * The acceptance callback is called once each time the request is * sent: it may be sent >1 time because of authentication retries etc. * For each time the acceptance callback is called, if it returns * non-zero, blocks of the response body will be passed to the reader * callback as the response is read. After all the response body has * been read, the callback will be called with a 'len' argument of * zero. */ void ne_add_response_body_reader(ne_request *req, ne_accept_response accpt, ne_block_reader reader, void *userdata); /* Retrieve the value of the response header field with given name; * returns NULL if no response header with given name was found. The * return value is valid only until the next call to either * ne_request_destroy or ne_begin_request for this request. */ const char *ne_get_response_header(ne_request *req, const char *name); /* Iterator interface for response headers: if passed a NULL cursor, * returns the first header; if passed a non-NULL cursor pointer, * returns the next header. The return value is a cursor pointer: if * it is non-NULL, *name and *value are set to the name and value of * the header field. If the return value is NULL, no more headers are * found, *name and *value are undefined. * * The order in which response headers is returned is undefined. Both * the cursor and name/value pointers are valid only until the next * call to either ne_request_destroy or ne_begin_request for this * request. */ void *ne_response_header_iterate(ne_request *req, void *cursor, const char **name, const char **value); /* Adds a header to the request with given name and value. */ void ne_add_request_header(ne_request *req, const char *name, const char *value); /* Adds a header to the request with given name, using printf-like * format arguments for the value. */ void ne_print_request_header(ne_request *req, const char *name, const char *format, ...) ne_attribute((format(printf, 3, 4))); /* ne_request_dispatch: Sends the given request, and reads the * response. Returns: * - NE_OK if the request was sent and response read successfully * - NE_AUTH, NE_PROXYAUTH for a server or proxy server authentication error * - NE_CONNECT if connection could not be established * - NE_TIMEOUT if an timeout occurred sending or reading from the server * - NE_ERROR for other fatal dispatch errors * On any error, the session error string is set. On success or * authentication error, the actual response-status can be retrieved using * ne_get_status(). */ int ne_request_dispatch(ne_request *req); /* Returns a pointer to the response status information for the given * request; pointer is valid until request object is destroyed. */ const ne_status *ne_get_status(const ne_request *req) ne_attribute((const)); /* Returns pointer to session associated with request. */ ne_session *ne_get_session(const ne_request *req) ne_attribute((const)); /* Destroy memory associated with request pointer */ void ne_request_destroy(ne_request *req); /* "Caller-pulls" request interface. This is an ALTERNATIVE interface * to ne_request_dispatch: either use that, or do all this yourself: * * caller must call: * 1. ne_begin_request (fail if returns non-NE_OK) * 2. while(ne_read_response_block(...) > 0) ... loop ...; * (fail if ne_read_response_block returns <0) * 3. ne_end_request * * ne_end_request and ne_begin_request both return an NE_* code; if * ne_end_request returns NE_RETRY, you must restart the loop from (1) * above. */ int ne_begin_request(ne_request *req); int ne_end_request(ne_request *req); /* Read a block of the response into the passed buffer of size 'buflen'. * * Returns: * <0 - error, stop reading. * 0 - end of response * >0 - number of bytes read into buffer. */ ssize_t ne_read_response_block(ne_request *req, char *buffer, size_t buflen); /* Read response blocks until end of response; exactly equivalent to * calling ne_read_response_block() until it returns 0. Returns * non-zero on error. */ int ne_discard_response(ne_request *req); /* Read response blocks until end of response, writing content to the * given file descriptor. Returns NE_ERROR on error. */ int ne_read_response_to_fd(ne_request *req, int fd); /* Defined request flags: */ typedef enum ne_request_flag_e { NE_REQFLAG_EXPECT100 = 0, /* enable this flag to enable use of the * "Expect: 100-continue" for the * request. */ NE_REQFLAG_IDEMPOTENT, /* disable this flag if the request uses a * non-idempotent method such as POST. */ NE_REQFLAG_LAST /* enum sentinel value */ } ne_request_flag; /* Set a new value for a particular request flag. */ void ne_set_request_flag(ne_request *req, ne_request_flag flag, int value); /* Return 0 if the given flag is not set, >0 it is set, or -1 if the * flag is not supported. */ int ne_get_request_flag(ne_request *req, ne_request_flag flag); /**** Request hooks handling *****/ typedef void (*ne_free_hooks)(void *cookie); /* Hook called when a request is created; passed the request method, * and the string used as the Request-URI (note that this may be a * absolute URI if a proxy is in use, an absolute path, a "*", etc). * A create_request hook is called exactly once per request. */ typedef void (*ne_create_request_fn)(ne_request *req, void *userdata, const char *method, const char *requri); void ne_hook_create_request(ne_session *sess, ne_create_request_fn fn, void *userdata); /* Hook called before the request is sent. 'header' is the raw HTTP * header before the trailing CRLF is added; more headers can be added * here. A pre_send hook may be called >1 time per request if the * request is retried due to a post_send hook returning NE_RETRY. */ typedef void (*ne_pre_send_fn)(ne_request *req, void *userdata, ne_buffer *header); void ne_hook_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata); /* Hook called directly after the response headers have been read, but * before the resposnse body has been read. 'status' is the response * status-code. A post_header hook may be called >1 time per request * if the request is retried due to a post_send hook returning * NE_RETRY. */ typedef void (*ne_post_headers_fn)(ne_request *req, void *userdata, const ne_status *status); void ne_hook_post_headers(ne_session *sess, ne_post_headers_fn fn, void *userdata); /* Hook called after the request is dispatched (request sent, and * the entire response read). If an error occurred reading the response, * this hook will not run. May return: * NE_OK everything is okay * NE_RETRY try sending the request again. * anything else signifies an error, and the request is failed. The return * code is passed back the _dispatch caller, so the session error must * also be set appropriately (ne_set_error). */ typedef int (*ne_post_send_fn)(ne_request *req, void *userdata, const ne_status *status); void ne_hook_post_send(ne_session *sess, ne_post_send_fn fn, void *userdata); /* Hook called when the function is destroyed. */ typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata); void ne_hook_destroy_request(ne_session *sess, ne_destroy_req_fn fn, void *userdata); typedef void (*ne_destroy_sess_fn)(void *userdata); /* Hook called when the session is about to be destroyed. */ void ne_hook_destroy_session(ne_session *sess, ne_destroy_sess_fn fn, void *userdata); typedef void (*ne_close_conn_fn)(void *userdata); /* Hook called when the connection is closed; note that this hook * may be called *AFTER* the destroy_session hook. */ void ne_hook_close_conn(ne_session *sess, ne_close_conn_fn fn, void *userdata); /* The ne_unhook_* functions remove a hook registered with the given * session. If a hook is found which was registered with a given * function 'fn', and userdata pointer 'userdata', then it will be * removed from the hooks list. * * It is unsafe to use any of these functions from a hook function to * unregister itself, except for ne_unhook_destroy_request. */ void ne_unhook_create_request(ne_session *sess, ne_create_request_fn fn, void *userdata); void ne_unhook_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata); void ne_unhook_post_headers(ne_session *sess, ne_post_headers_fn fn, void *userdata); void ne_unhook_post_send(ne_session *sess, ne_post_send_fn fn, void *userdata); void ne_unhook_destroy_request(ne_session *sess, ne_destroy_req_fn fn, void *userdata); void ne_unhook_destroy_session(ne_session *sess, ne_destroy_sess_fn fn, void *userdata); void ne_unhook_close_conn(ne_session *sess, ne_close_conn_fn fn, void *userdata); /* Store an opaque context for the request, 'priv' is returned by a * call to ne_request_get_private with the same ID. */ void ne_set_request_private(ne_request *req, const char *id, void *priv); void *ne_get_request_private(ne_request *req, const char *id); NE_END_DECLS #endif /* NE_REQUEST_H */ cadaver-0.23.3/lib/neon/ne_socket.h0000664000076400007640000002733311247545311016471 0ustar jortonjorton/* socket handling interface Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_SOCKET_H #define NE_SOCKET_H #include #ifdef WIN32 #include /* for size_t */ #endif #include "ne_defs.h" #include "ne_ssl.h" /* for ne_ssl_context */ NE_BEGIN_DECLS #define NE_SOCK_ERROR (-1) /* Read/Write timed out */ #define NE_SOCK_TIMEOUT (-2) /* Socket was closed */ #define NE_SOCK_CLOSED (-3) /* Connection was reset (e.g. server crashed) */ #define NE_SOCK_RESET (-4) /* Secure connection was closed without proper SSL shutdown. */ #define NE_SOCK_TRUNC (-5) /* ne_socket represents a TCP socket. */ typedef struct ne_socket_s ne_socket; /* ne_sock_addr represents an address object. */ typedef struct ne_sock_addr_s ne_sock_addr; #ifndef NE_INET_ADDR_DEFINED typedef struct ne_inet_addr_s ne_inet_addr; #endif /* Perform process-global initialization of any libraries in use. * Returns non-zero on error. */ int ne_sock_init(void); /* Perform process-global shutdown of any libraries in use. This * function only has effect when it has been called an equal number of * times to ne_sock_init() for the process. */ void ne_sock_exit(void); /* Resolve the given hostname. 'flags' must be zero. Hex * string IPv6 addresses (e.g. `::1') may be enclosed in brackets * (e.g. `[::1]'). */ ne_sock_addr *ne_addr_resolve(const char *hostname, int flags); /* Returns zero if name resolution was successful, non-zero on * error. */ int ne_addr_result(const ne_sock_addr *addr); /* Returns the first network address associated with the 'addr' * object. Undefined behaviour if ne_addr_result returns non-zero for * 'addr'; otherwise, never returns NULL. */ const ne_inet_addr *ne_addr_first(ne_sock_addr *addr); /* Returns the next network address associated with the 'addr' object, * or NULL if there are no more. */ const ne_inet_addr *ne_addr_next(ne_sock_addr *addr); /* NB: the pointers returned by ne_addr_first and ne_addr_next are * valid until ne_addr_destroy is called for the corresponding * ne_sock_addr object. They must not be passed to ne_iaddr_free. */ /* If name resolution fails, copies the error string into 'buffer', * which is of size 'bufsiz'. 'buffer' is returned. */ char *ne_addr_error(const ne_sock_addr *addr, char *buffer, size_t bufsiz); /* Destroys an address object created by ne_addr_resolve. */ void ne_addr_destroy(ne_sock_addr *addr); /* Network address type; IPv4 or IPv6 */ typedef enum { ne_iaddr_ipv4 = 0, ne_iaddr_ipv6 } ne_iaddr_type; /* Create a network address object from raw byte representation (in * network byte order) of given type. 'raw' must be four bytes for an * IPv4 address, 16 bytes for an IPv6 address. May return NULL if * address type is not supported. */ ne_inet_addr *ne_iaddr_make(ne_iaddr_type type, const unsigned char *raw); /* Compare two network address objects i1 and i2; returns zero if they * are equivalent or non-zero otherwise. */ int ne_iaddr_cmp(const ne_inet_addr *i1, const ne_inet_addr *i2); /* Return the type of the given network address object. */ ne_iaddr_type ne_iaddr_typeof(const ne_inet_addr *ia); /* Print the string representation of network address 'ia' into the * buffer 'buffer', which is of length 'bufsiz'. Returns 'buffer'. */ char *ne_iaddr_print(const ne_inet_addr *ia, char *buffer, size_t bufsiz); /* Dump the raw byte representation (in network byte order) of address * 'ia' into the buffer 'buffer', which must be of a suitable length * (4 bytes for an IPv4 address, 16 bytes for an IPv6 address). * Returns 'buffer'. */ unsigned char *ne_iaddr_raw(const ne_inet_addr *ia, unsigned char *buffer); /* Perform the reverse name lookup on network address 'ia', placing * the returned name in the 'buf' buffer (of length 'bufsiz') if * successful. Returns zero on success, or non-zero on error. */ int ne_iaddr_reverse(const ne_inet_addr *ia, char *buf, size_t bufsiz); /* Convert network address string 'addr' (for example, "127.0.0.1") * into a network address object. Returns NULL on parse error. If * non-NULL, return value must be freed using ne_iaddr_free. */ ne_inet_addr *ne_iaddr_parse(const char *addr, ne_iaddr_type type); /* Destroy a network address object created using ne_iaddr_make or * ne_iaddr_parse. */ void ne_iaddr_free(ne_inet_addr *addr); /* Create a socket object; returns NULL on error. */ ne_socket *ne_sock_create(void); /* Specify an address to which the local end of the socket will be * bound during a subsequent ne_sock_connect() call. If the address * passed to ne_sock_connect() is of a different type (family) to * 'addr', 'addr' is ignored. Either 'addr' may be NULL, to use the * given port with unspecified address, or 'port' may be 0, to use the * given address with an unspecified port. * * (Note: This function is not equivalent to a BSD socket bind(), it * only takes effect during the _connect() call). */ void ne_sock_prebind(ne_socket *sock, const ne_inet_addr *addr, unsigned int port); /* Connect the socket to server at address 'addr' on port 'port'. * Returns zero on success, NE_SOCK_TIMEOUT if a timeout occurs when a * non-zero connect timeout is configured (and is supported), or * NE_SOCK_ERROR on failure. */ int ne_sock_connect(ne_socket *sock, const ne_inet_addr *addr, unsigned int port); /* Read up to 'count' bytes from socket into 'buffer'. Returns: * NE_SOCK_* on error, * >0 length of data read into buffer (may be less than 'count') */ ssize_t ne_sock_read(ne_socket *sock, char *buffer, size_t count); /* Read up to 'count' bytes into 'buffer', leaving the data available * in the socket buffer to be returned by a subsequent call to * ne_sock_read or ne_sock_peek. Returns: * NE_SOCK_* on error, * >0 length of data read into buffer. */ ssize_t ne_sock_peek(ne_socket *sock, char *buffer, size_t count); /* Block for up to 'n' seconds until data becomes available for reading * from the socket. Returns: * NE_SOCK_* on error, * NE_SOCK_TIMEOUT if no data arrives in 'n' seconds, * 0 if data arrived on the socket. */ int ne_sock_block(ne_socket *sock, int n); /* Write 'count' bytes of 'data' to the socket. Guarantees to either * write all the bytes or to fail. Returns 0 on success, or NE_SOCK_* * on error. */ int ne_sock_fullwrite(ne_socket *sock, const char *data, size_t count); /* I/O vector. */ struct ne_iovec { void *base; size_t len; }; /* Writes 'count' blocks described by 'vector' to the socket. * Guarantees to either write all the bytes or to fail. Count must be * greater than zero and smaller than the system-defined maximum * vector limit. Returns 0 on success, or NE_SOCK_* on error. */ int ne_sock_fullwritev(ne_socket *sock, const struct ne_iovec *vector, int count); /* Read an LF-terminated line into 'buffer', and NUL-terminate it. * At most 'len' bytes are read (including the NUL terminator). * Returns: * NE_SOCK_* on error, * >0 number of bytes read (including NUL terminator) */ ssize_t ne_sock_readline(ne_socket *sock, char *buffer, size_t len); /* Read exactly 'len' bytes into buffer, or fail; returns 0 on * success, NE_SOCK_* on error. */ ssize_t ne_sock_fullread(ne_socket *sock, char *buffer, size_t len); /* Accepts a connection from listening socket 'fd' and places the * socket in 'sock'. Returns zero on success or -1 on failure. */ int ne_sock_accept(ne_socket *sock, int fd); /* Returns the file descriptor used for socket 'sock'. */ int ne_sock_fd(const ne_socket *sock); /* Return address of peer, or NULL on error. The returned address * must be destroyed by caller using ne_iaddr_free. */ ne_inet_addr *ne_sock_peer(ne_socket *sock, unsigned int *port); /* Close the socket and destroy the socket object. Returns zero on * success, or an errno value if close() failed. */ int ne_sock_close(ne_socket *sock); /* Return current error string for socket. */ const char *ne_sock_error(const ne_socket *sock); /* Set the error string for the socket; takes printf-like format * string. */ void ne_sock_set_error(ne_socket *sock, const char *format, ...) ne_attribute((format (printf, 2, 3))); /* Set read timeout for socket, in seconds; must be a non-zero * positive integer. */ void ne_sock_read_timeout(ne_socket *sock, int timeout); /* Set connect timeout for socket, in seconds; must be a positive * integer. If a timeout of 'zero' is used then then no explicit * timeout handling will be used for ne_sock_connect(), and the * connect call will only timeout as dictated by the TCP stack. */ void ne_sock_connect_timeout(ne_socket *sock, int timeout); /* Negotiate an SSL connection on socket as an SSL server, using given * SSL context. */ int ne_sock_accept_ssl(ne_socket *sock, ne_ssl_context *ctx); /* Negotiate an SSL connection on socket as an SSL client, using given * SSL context. The 'userdata' parameter is associated with the * underlying SSL library's socket structure for use in callbacks. * Returns zero on success, or non-zero on error. */ int ne_sock_connect_ssl(ne_socket *sock, ne_ssl_context *ctx, void *userdata); /* Retrieve the session ID of the current SSL session. If 'buf' is * non-NULL, on success, copies at most *buflen bytes to 'buf' and * sets *buflen to the exact number of bytes copied. If 'buf' is * NULL, on success, sets *buflen to the length of the session ID. * Returns zero on success, non-zero on error. */ int ne_sock_sessid(ne_socket *sock, unsigned char *buf, size_t *buflen); /* Return human-readable name of SSL/TLS cipher used for connection, * or NULL if none. The format of this string is not intended to be * fixed or parseable, but is informational only. Return value is * NUL-terminated malloc-allocated string if not NULL, which must be * freed by the caller. */ char *ne_sock_cipher(ne_socket *sock); /* SOCKS proxy protocol version: */ enum ne_sock_sversion { NE_SOCK_SOCKSV4 = 0, NE_SOCK_SOCKSV4A, NE_SOCK_SOCKSV5 }; /* Given a socket 'sock' which is connected to a SOCKS proxy, initiate * a connection to a destination server using that proxy, specified * either by network address or hostname, at given port 'port'. * * If 'vers' is NE_SOCKS_V4, addr must be an IPv4 address; hostname * and password are ignored; username must be non-NULL. * * If 'vers' is NE_SOCKS_V4A, hostname must be non-NULL; addr is * ignored; password is ignored; username must be non-NULL. * * If 'vers' is NE_SOCKS_V5, addr may be NULL, in which case hostname * must be non-NULL. addr if non-NULL may be an IPv4 or IPv6 address; * username may be NULL, in which case password is ignored. If * username is non-NULL password must also be non-NULL. * * Returns 0 on success, or NE_SOCK_* on failure - in which case, the * socket error string is set. On failure, the socket must be closed * by the caller. */ int ne_sock_proxy(ne_socket *sock, enum ne_sock_sversion vers, const ne_inet_addr *addr, const char *hostname, unsigned int port, const char *username, const char *password); NE_END_DECLS #endif /* NE_SOCKET_H */ cadaver-0.23.3/lib/neon/ne_207.h0000664000076400007640000001050210356210727015477 0ustar jortonjorton/* WebDAV 207 multi-status response handling Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_207_H #define NE_207_H #include "ne_xml.h" #include "ne_request.h" /* for ne_request */ #include "ne_uri.h" /* for ne_uri */ NE_BEGIN_DECLS /* The defined state integer for the '{DAV:}prop' element. */ #define NE_207_STATE_PROP (50) /* This interface reserves the state integers 'x' where 0 < x < 100 */ #define NE_207_STATE_TOP (100) /* Handling of 207 multistatus XML documents. A "multistatus" * document is made up of a set of responses, each concerned with a * particular resource. Each response may have an associated result * status and failure description. A response is made up of a set of * propstats, each of which again may have an associated result status * and failure description. */ /* Start and end response callbacks trigger at the start and end of * each "response" within the multistatus body. 'uri' gives the URI * of the resource which is subject of this response. The return * value of a 'start_response' callback is passed as the 'response' * parameter to the corresponding 'end_response' parameter. */ typedef void *ne_207_start_response(void *userdata, const ne_uri *uri); typedef void ne_207_end_response(void *userdata, void *response, const ne_status *status, const char *description); /* Similarly, start and end callbacks for each propstat within the * response. The return value of the 'start_response' callback for * the response in which this propstat is contains is passed as the * 'response' parameter. The return value of each 'start_propstat' is * passed as the 'propstat' parameter' to the corresponding * 'end_propstat' callback. If the start_propstat callback returns * NULL, parsing is aborted (the XML parser error must be set by the * callback). */ typedef void *ne_207_start_propstat(void *userdata, void *response); typedef void ne_207_end_propstat(void *userdata, void *propstat, const ne_status *status, const char *description); typedef struct ne_207_parser_s ne_207_parser; /* Create 207 parser an add the handlers the the given parser's * handler stack. URI references in the 207 response will be resolved * relative to the base URI 'base'. */ ne_207_parser *ne_207_create(ne_xml_parser *parser, const ne_uri *base, void *userdata); /* Register response handling callbacks. */ void ne_207_set_response_handlers(ne_207_parser *p, ne_207_start_response *start, ne_207_end_response *end); /* Register propstat handling callbacks. */ void ne_207_set_propstat_handlers(ne_207_parser *p, ne_207_start_propstat *start, ne_207_end_propstat *end); /* Destroy the parser */ void ne_207_destroy(ne_207_parser *p); /* An acceptance function which only accepts 207 responses */ int ne_accept_207(void *userdata, ne_request *req, const ne_status *status); void *ne_207_get_current_propstat(ne_207_parser *p); void *ne_207_get_current_response(ne_207_parser *p); /* Dispatch request 'req', returning: * NE_ERROR: for a dispatch error, or a non-2xx response, or a * 207 response which contained a non-2xx propstat * NE_OK: for a 2xx response or a 207 response which contained * only 2xx-class propstats. * The request object is destroyed in both cases. */ int ne_simple_request(ne_session *sess, ne_request *req); NE_END_DECLS #endif /* NE_207_H */ cadaver-0.23.3/lib/neon/ne_request.c0000664000076400007640000014200411247552666016670 0ustar jortonjorton/* HTTP request/response handling Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* This is the HTTP client request/response implementation. * The goal of this code is to be modular and simple. */ #include "config.h" #include #include #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "ne_internal.h" #include "ne_alloc.h" #include "ne_request.h" #include "ne_string.h" /* for ne_buffer */ #include "ne_utils.h" #include "ne_socket.h" #include "ne_uri.h" #include "ne_private.h" #define SOCK_ERR(req, op, msg) do { ssize_t sret = (op); \ if (sret < 0) return aborted(req, msg, sret); } while (0) #define EOL "\r\n" struct body_reader { ne_block_reader handler; ne_accept_response accept_response; unsigned int use; void *userdata; struct body_reader *next; }; struct field { char *name, *value; size_t vlen; struct field *next; }; /* Maximum number of header fields per response: */ #define MAX_HEADER_FIELDS (100) /* Size of hash table; 43 is the smallest prime for which the common * header names hash uniquely using the *33 hash function. */ #define HH_HASHSIZE (43) /* Hash iteration step: *33 known to be a good hash for ASCII, see RSE. */ #define HH_ITERATE(hash, ch) (((hash)*33 + (unsigned char)(ch)) % HH_HASHSIZE) /* pre-calculated hash values for given header names: */ #define HH_HV_CONNECTION (0x14) #define HH_HV_PROXY_CONNECTION (0x1A) #define HH_HV_CONTENT_LENGTH (0x13) #define HH_HV_TRANSFER_ENCODING (0x07) struct ne_request_s { char *method, *uri; /* method and Request-URI */ ne_buffer *headers; /* request headers */ /* Request body. */ ne_provide_body body_cb; void *body_ud; /* Request body source: file or buffer (if not callback). */ union { struct { int fd; ne_off_t offset, length; ne_off_t remain; /* remaining bytes to send. */ } file; struct { /* length bytes @ buffer = whole body. * remain bytes @ pnt = remaining bytes to send */ const char *buffer, *pnt; size_t length, remain; } buf; } body; ne_off_t body_length; /* length of request body */ /* temporary store for response lines. */ char respbuf[NE_BUFSIZ]; /**** Response ***/ /* The transfer encoding types */ struct ne_response { enum { R_TILLEOF = 0, /* read till eof */ R_NO_BODY, /* implicitly no body (HEAD, 204, 304) */ R_CHUNKED, /* using chunked transfer-encoding */ R_CLENGTH /* using given content-length */ } mode; union { /* clen: used if mode == R_CLENGTH; total and bytes * remaining to be read of response body. */ struct { ne_off_t total, remain; } clen; /* chunk: used if mode == R_CHUNKED; total and bytes * remaining to be read of current chunk */ struct { size_t total, remain; } chunk; } body; ne_off_t progress; /* number of bytes read of response */ } resp; struct hook *private; /* response header fields */ struct field *response_headers[HH_HASHSIZE]; unsigned int current_index; /* response_headers cursor for iterator */ /* List of callbacks which are passed response body blocks */ struct body_reader *body_readers; /*** Miscellaneous ***/ unsigned int method_is_head; unsigned int can_persist; int flags[NE_REQFLAG_LAST]; ne_session *session; ne_status status; }; static int open_connection(ne_session *sess); /* Returns hash value for header 'name', converting it to lower-case * in-place. */ static inline unsigned int hash_and_lower(char *name) { char *pnt; unsigned int hash = 0; for (pnt = name; *pnt != '\0'; pnt++) { *pnt = ne_tolower(*pnt); hash = HH_ITERATE(hash,*pnt); } return hash; } /* Abort a request due to an non-recoverable HTTP protocol error, * whilst doing 'doing'. 'code', if non-zero, is the socket error * code, NE_SOCK_*, or if zero, is ignored. */ static int aborted(ne_request *req, const char *doing, ssize_t code) { ne_session *sess = req->session; int ret = NE_ERROR; NE_DEBUG(NE_DBG_HTTP, "Aborted request (%" NE_FMT_SSIZE_T "): %s\n", code, doing); switch(code) { case NE_SOCK_CLOSED: if (sess->nexthop->proxy != PROXY_NONE) { ne_set_error(sess, _("%s: connection was closed by proxy server"), doing); } else { ne_set_error(sess, _("%s: connection was closed by server"), doing); } break; case NE_SOCK_TIMEOUT: ne_set_error(sess, _("%s: connection timed out"), doing); ret = NE_TIMEOUT; break; case NE_SOCK_ERROR: case NE_SOCK_RESET: case NE_SOCK_TRUNC: ne_set_error(sess, "%s: %s", doing, ne_sock_error(sess->socket)); break; case 0: ne_set_error(sess, "%s", doing); break; } ne_close_connection(sess); return ret; } static void notify_status(ne_session *sess, ne_session_status status) { if (sess->notify_cb) { sess->notify_cb(sess->notify_ud, status, &sess->status); } } static void *get_private(const struct hook *hk, const char *id) { for (; hk != NULL; hk = hk->next) if (strcmp(hk->id, id) == 0) return hk->userdata; return NULL; } void *ne_get_request_private(ne_request *req, const char *id) { return get_private(req->private, id); } void *ne_get_session_private(ne_session *sess, const char *id) { return get_private(sess->private, id); } void ne_set_request_private(ne_request *req, const char *id, void *userdata) { struct hook *hk = ne_malloc(sizeof (struct hook)), *pos; if (req->private != NULL) { for (pos = req->private; pos->next != NULL; pos = pos->next) /* nullop */; pos->next = hk; } else { req->private = hk; } hk->id = id; hk->fn = NULL; hk->userdata = userdata; hk->next = NULL; } static ssize_t body_string_send(void *userdata, char *buffer, size_t count) { ne_request *req = userdata; if (count == 0) { req->body.buf.remain = req->body.buf.length; req->body.buf.pnt = req->body.buf.buffer; } else { /* if body_left == 0 we fall through and return 0. */ if (req->body.buf.remain < count) count = req->body.buf.remain; memcpy(buffer, req->body.buf.pnt, count); req->body.buf.pnt += count; req->body.buf.remain -= count; } return count; } static ssize_t body_fd_send(void *userdata, char *buffer, size_t count) { ne_request *req = userdata; if (count) { if (req->body.file.remain == 0) return 0; /* Casts here are necessary for LFS platforms for safe and * warning-free assignment/comparison between 32-bit size_t * and 64-bit off64_t: */ if ((ne_off_t)count > req->body.file.remain) count = (size_t)req->body.file.remain; return read(req->body.file.fd, buffer, count); } else { ne_off_t newoff; /* rewind for next send. */ newoff = ne_lseek(req->body.file.fd, req->body.file.offset, SEEK_SET); if (newoff == req->body.file.offset) { req->body.file.remain = req->body.file.length; return 0; } else { char err[200], offstr[20]; if (newoff == -1) { /* errno was set */ ne_strerror(errno, err, sizeof err); } else { strcpy(err, _("offset invalid")); } ne_snprintf(offstr, sizeof offstr, "%" FMT_NE_OFF_T, req->body.file.offset); ne_set_error(req->session, _("Could not seek to offset %s" " of request body file: %s"), offstr, err); return -1; } } } /* For accurate persistent connection handling, for any write() or * read() operation for a new request on an already-open connection, * an EOF or RST error MUST be treated as a persistent connection * timeout, and the request retried on a new connection. Once a * read() operation has succeeded, any subsequent error MUST be * treated as fatal. A 'retry' flag is used; retry=1 represents the * first case, retry=0 the latter. */ /* RETRY_RET() crafts a function return value given the 'retry' flag, * the socket error 'code', and the return value 'acode' from the * aborted() function. */ #define RETRY_RET(retry, code, acode) \ ((((code) == NE_SOCK_CLOSED || (code) == NE_SOCK_RESET || \ (code) == NE_SOCK_TRUNC) && retry) ? NE_RETRY : (acode)) /* Sends the request body; returns 0 on success or an NE_* error code. * If retry is non-zero; will return NE_RETRY on persistent connection * timeout. On error, the session error string is set and the * connection is closed. */ static int send_request_body(ne_request *req, int retry) { ne_session *const sess = req->session; char buffer[NE_BUFSIZ]; ssize_t bytes; NE_DEBUG(NE_DBG_HTTP, "Sending request body:\n"); req->session->status.sr.progress = 0; req->session->status.sr.total = req->body_length; notify_status(sess, ne_status_sending); /* tell the source to start again from the beginning. */ if (req->body_cb(req->body_ud, NULL, 0) != 0) { ne_close_connection(sess); return NE_ERROR; } while ((bytes = req->body_cb(req->body_ud, buffer, sizeof buffer)) > 0) { int ret = ne_sock_fullwrite(sess->socket, buffer, bytes); if (ret < 0) { int aret = aborted(req, _("Could not send request body"), ret); return RETRY_RET(retry, ret, aret); } NE_DEBUG(NE_DBG_HTTPBODY, "Body block (%" NE_FMT_SSIZE_T " bytes):\n[%.*s]\n", bytes, (int)bytes, buffer); /* invoke progress callback */ req->session->status.sr.progress += bytes; notify_status(sess, ne_status_sending); } if (bytes == 0) { return NE_OK; } else { NE_DEBUG(NE_DBG_HTTP, "Request body provider failed with " "%" NE_FMT_SSIZE_T "\n", bytes); ne_close_connection(sess); return NE_ERROR; } } /* Lob the User-Agent, connection and host headers in to the request * headers */ static void add_fixed_headers(ne_request *req) { ne_session *const sess = req->session; if (sess->user_agent) { ne_buffer_zappend(req->headers, sess->user_agent); } /* If persistent connections are disabled, just send Connection: * close; otherwise, send Connection: Keep-Alive to pre-1.1 origin * servers to try harder to get a persistent connection, except if * using a proxy as per 2068§19.7.1. Always add TE: trailers. */ if (!sess->flags[NE_SESSFLAG_PERSIST]) { ne_buffer_czappend(req->headers, "Connection: TE, close" EOL); } else if (!sess->is_http11 && !sess->any_proxy_http) { ne_buffer_czappend(req->headers, "Keep-Alive: " EOL "Connection: TE, Keep-Alive" EOL); } else if (!req->session->is_http11 && !sess->any_proxy_http) { ne_buffer_czappend(req->headers, "Keep-Alive: " EOL "Proxy-Connection: Keep-Alive" EOL "Connection: TE" EOL); } else { ne_buffer_czappend(req->headers, "Connection: TE" EOL); } ne_buffer_concat(req->headers, "TE: trailers" EOL "Host: ", req->session->server.hostport, EOL, NULL); } int ne_accept_always(void *userdata, ne_request *req, const ne_status *st) { return 1; } int ne_accept_2xx(void *userdata, ne_request *req, const ne_status *st) { return (st->klass == 2); } ne_request *ne_request_create(ne_session *sess, const char *method, const char *path) { ne_request *req = ne_calloc(sizeof *req); req->session = sess; req->headers = ne_buffer_create(); /* Presume the method is idempotent by default. */ req->flags[NE_REQFLAG_IDEMPOTENT] = 1; /* Expect-100 default follows the corresponding session flag. */ req->flags[NE_REQFLAG_EXPECT100] = sess->flags[NE_SESSFLAG_EXPECT100]; /* Add in the fixed headers */ add_fixed_headers(req); /* Set the standard stuff */ req->method = ne_strdup(method); req->method_is_head = (strcmp(method, "HEAD") == 0); /* Only use an absoluteURI here when we might be using an HTTP * proxy, and SSL is in use: some servers can't parse them. */ if (sess->any_proxy_http && !req->session->use_ssl && path[0] == '/') req->uri = ne_concat(req->session->scheme, "://", req->session->server.hostport, path, NULL); else req->uri = ne_strdup(path); { struct hook *hk; for (hk = sess->create_req_hooks; hk != NULL; hk = hk->next) { ne_create_request_fn fn = (ne_create_request_fn)hk->fn; fn(req, hk->userdata, method, req->uri); } } return req; } /* Set the request body length to 'length' */ static void set_body_length(ne_request *req, ne_off_t length) { req->body_length = length; ne_print_request_header(req, "Content-Length", "%" FMT_NE_OFF_T, length); } void ne_set_request_body_buffer(ne_request *req, const char *buffer, size_t size) { req->body.buf.buffer = buffer; req->body.buf.length = size; req->body_cb = body_string_send; req->body_ud = req; set_body_length(req, size); } void ne_set_request_body_provider(ne_request *req, ne_off_t bodysize, ne_provide_body provider, void *ud) { req->body_cb = provider; req->body_ud = ud; set_body_length(req, bodysize); } void ne_set_request_body_fd(ne_request *req, int fd, ne_off_t offset, ne_off_t length) { req->body.file.fd = fd; req->body.file.offset = offset; req->body.file.length = length; req->body_cb = body_fd_send; req->body_ud = req; set_body_length(req, length); } void ne_set_request_flag(ne_request *req, ne_request_flag flag, int value) { if (flag < NE_SESSFLAG_LAST) { req->flags[flag] = value; } } int ne_get_request_flag(ne_request *req, ne_request_flag flag) { if (flag < NE_REQFLAG_LAST) { return req->flags[flag]; } return -1; } void ne_add_request_header(ne_request *req, const char *name, const char *value) { ne_buffer_concat(req->headers, name, ": ", value, EOL, NULL); } void ne_print_request_header(ne_request *req, const char *name, const char *format, ...) { va_list params; char buf[NE_BUFSIZ]; va_start(params, format); ne_vsnprintf(buf, sizeof buf, format, params); va_end(params); ne_buffer_concat(req->headers, name, ": ", buf, EOL, NULL); } /* Returns the value of the response header 'name', for which the hash * value is 'h', or NULL if the header is not found. */ static inline char *get_response_header_hv(ne_request *req, unsigned int h, const char *name) { struct field *f; for (f = req->response_headers[h]; f; f = f->next) if (strcmp(f->name, name) == 0) return f->value; return NULL; } const char *ne_get_response_header(ne_request *req, const char *name) { char *lcname = ne_strdup(name); unsigned int hash = hash_and_lower(lcname); char *value = get_response_header_hv(req, hash, lcname); ne_free(lcname); return value; } /* The return value of the iterator function is a pointer to the * struct field of the previously returned header. */ void *ne_response_header_iterate(ne_request *req, void *iterator, const char **name, const char **value) { struct field *f = iterator; unsigned int n; if (f == NULL) { n = 0; } else if ((f = f->next) == NULL) { n = req->current_index + 1; } if (f == NULL) { while (n < HH_HASHSIZE && req->response_headers[n] == NULL) n++; if (n == HH_HASHSIZE) return NULL; /* no more headers */ f = req->response_headers[n]; req->current_index = n; } *name = f->name; *value = f->value; return f; } /* Removes the response header 'name', which has hash value 'hash'. */ static void remove_response_header(ne_request *req, const char *name, unsigned int hash) { struct field **ptr = req->response_headers + hash; while (*ptr) { struct field *const f = *ptr; if (strcmp(f->name, name) == 0) { *ptr = f->next; ne_free(f->name); ne_free(f->value); ne_free(f); return; } ptr = &f->next; } } /* Free all stored response headers. */ static void free_response_headers(ne_request *req) { int n; for (n = 0; n < HH_HASHSIZE; n++) { struct field **ptr = req->response_headers + n; while (*ptr) { struct field *const f = *ptr; *ptr = f->next; ne_free(f->name); ne_free(f->value); ne_free(f); } } } void ne_add_response_body_reader(ne_request *req, ne_accept_response acpt, ne_block_reader rdr, void *userdata) { struct body_reader *new = ne_malloc(sizeof *new); new->accept_response = acpt; new->handler = rdr; new->userdata = userdata; new->next = req->body_readers; req->body_readers = new; } void ne_request_destroy(ne_request *req) { struct body_reader *rdr, *next_rdr; struct hook *hk, *next_hk; ne_free(req->uri); ne_free(req->method); for (rdr = req->body_readers; rdr != NULL; rdr = next_rdr) { next_rdr = rdr->next; ne_free(rdr); } free_response_headers(req); ne_buffer_destroy(req->headers); NE_DEBUG(NE_DBG_HTTP, "Running destroy hooks.\n"); for (hk = req->session->destroy_req_hooks; hk; hk = next_hk) { ne_destroy_req_fn fn = (ne_destroy_req_fn)hk->fn; next_hk = hk->next; fn(req, hk->userdata); } for (hk = req->private; hk; hk = next_hk) { next_hk = hk->next; ne_free(hk); } if (req->status.reason_phrase) ne_free(req->status.reason_phrase); NE_DEBUG(NE_DBG_HTTP, "Request ends.\n"); ne_free(req); } /* Reads a block of the response into BUFFER, which is of size * *BUFLEN. Returns zero on success or non-zero on error. On * success, *BUFLEN is updated to be the number of bytes read into * BUFFER (which will be 0 to indicate the end of the repsonse). On * error, the connection is closed and the session error string is * set. */ static int read_response_block(ne_request *req, struct ne_response *resp, char *buffer, size_t *buflen) { ne_socket *const sock = req->session->socket; size_t willread; ssize_t readlen; switch (resp->mode) { case R_CHUNKED: /* Chunked transfer-encoding: chunk syntax is "SIZE CRLF CHUNK * CRLF SIZE CRLF CHUNK CRLF ..." followed by zero-length * chunk: "CHUNK CRLF 0 CRLF". resp.chunk.remain contains the * number of bytes left to read in the current chunk. */ if (resp->body.chunk.remain == 0) { unsigned long chunk_len; char *ptr; /* Read the chunk size line into a temporary buffer. */ SOCK_ERR(req, ne_sock_readline(sock, req->respbuf, sizeof req->respbuf), _("Could not read chunk size")); NE_DEBUG(NE_DBG_HTTP, "[chunk] < %s", req->respbuf); chunk_len = strtoul(req->respbuf, &ptr, 16); /* limit chunk size to <= UINT_MAX, so it will probably * fit in a size_t. */ if (ptr == req->respbuf || chunk_len == ULONG_MAX || chunk_len > UINT_MAX) { return aborted(req, _("Could not parse chunk size"), 0); } NE_DEBUG(NE_DBG_HTTP, "Got chunk size: %lu\n", chunk_len); resp->body.chunk.remain = chunk_len; } willread = resp->body.chunk.remain > *buflen ? *buflen : resp->body.chunk.remain; break; case R_CLENGTH: willread = resp->body.clen.remain > (off_t)*buflen ? *buflen : (size_t)resp->body.clen.remain; break; case R_TILLEOF: willread = *buflen; break; case R_NO_BODY: default: willread = 0; break; } if (willread == 0) { *buflen = 0; return 0; } NE_DEBUG(NE_DBG_HTTP, "Reading %" NE_FMT_SIZE_T " bytes of response body.\n", willread); readlen = ne_sock_read(sock, buffer, willread); /* EOF is only valid when response body is delimited by it. * Strictly, an SSL truncation should not be treated as an EOF in * any case, but SSL servers are just too buggy. */ if (resp->mode == R_TILLEOF && (readlen == NE_SOCK_CLOSED || readlen == NE_SOCK_TRUNC)) { NE_DEBUG(NE_DBG_HTTP, "Got EOF.\n"); req->can_persist = 0; readlen = 0; } else if (readlen < 0) { return aborted(req, _("Could not read response body"), readlen); } else { NE_DEBUG(NE_DBG_HTTP, "Got %" NE_FMT_SSIZE_T " bytes.\n", readlen); } /* safe to cast: readlen guaranteed to be >= 0 above */ *buflen = (size_t)readlen; NE_DEBUG(NE_DBG_HTTPBODY, "Read block (%" NE_FMT_SSIZE_T " bytes):\n[%.*s]\n", readlen, (int)readlen, buffer); if (resp->mode == R_CHUNKED) { resp->body.chunk.remain -= readlen; if (resp->body.chunk.remain == 0) { char crlfbuf[2]; /* If we've read a whole chunk, read a CRLF */ readlen = ne_sock_fullread(sock, crlfbuf, 2); if (readlen < 0) return aborted(req, _("Could not read chunk delimiter"), readlen); else if (crlfbuf[0] != '\r' || crlfbuf[1] != '\n') return aborted(req, _("Chunk delimiter was invalid"), 0); } } else if (resp->mode == R_CLENGTH) { resp->body.clen.remain -= readlen; } resp->progress += readlen; return NE_OK; } ssize_t ne_read_response_block(ne_request *req, char *buffer, size_t buflen) { struct body_reader *rdr; size_t readlen = buflen; struct ne_response *const resp = &req->resp; if (read_response_block(req, resp, buffer, &readlen)) return -1; if (readlen) { req->session->status.sr.progress += readlen; notify_status(req->session, ne_status_recving); } for (rdr = req->body_readers; rdr!=NULL; rdr=rdr->next) { if (rdr->use && rdr->handler(rdr->userdata, buffer, readlen) != 0) { ne_close_connection(req->session); return -1; } } return readlen; } /* Build the request string, returning the buffer. */ static ne_buffer *build_request(ne_request *req) { struct hook *hk; ne_buffer *buf = ne_buffer_create(); /* Add Request-Line and headers: */ ne_buffer_concat(buf, req->method, " ", req->uri, " HTTP/1.1" EOL, NULL); /* Add custom headers: */ ne_buffer_append(buf, req->headers->data, ne_buffer_size(req->headers)); if (req->body_length && req->flags[NE_REQFLAG_EXPECT100]) { ne_buffer_czappend(buf, "Expect: 100-continue\r\n"); } NE_DEBUG(NE_DBG_HTTP, "Running pre_send hooks\n"); for (hk = req->session->pre_send_hooks; hk!=NULL; hk = hk->next) { ne_pre_send_fn fn = (ne_pre_send_fn)hk->fn; fn(req, hk->userdata, buf); } ne_buffer_czappend(buf, "\r\n"); return buf; } #ifdef NE_DEBUGGING #define DEBUG_DUMP_REQUEST(x) dump_request(x) static void dump_request(const char *request) { if (ne_debug_mask & NE_DBG_HTTPPLAIN) { /* Display everything mode */ NE_DEBUG(NE_DBG_HTTP, "Sending request headers:\n%s", request); } else if (ne_debug_mask & NE_DBG_HTTP) { /* Blank out the Authorization paramaters */ char *reqdebug = ne_strdup(request), *pnt = reqdebug; while ((pnt = strstr(pnt, "Authorization: ")) != NULL) { for (pnt += 15; *pnt != '\r' && *pnt != '\0'; pnt++) { *pnt = 'x'; } } NE_DEBUG(NE_DBG_HTTP, "Sending request headers:\n%s", reqdebug); ne_free(reqdebug); } } #else #define DEBUG_DUMP_REQUEST(x) #endif /* DEBUGGING */ /* remove trailing EOL from 'buf', where strlen(buf) == *len. *len is * adjusted in accordance with any changes made to the string to * remain equal to strlen(buf). */ static inline void strip_eol(char *buf, ssize_t *len) { char *pnt = buf + *len - 1; while (pnt >= buf && (*pnt == '\r' || *pnt == '\n')) { *pnt-- = '\0'; (*len)--; } } /* Read and parse response status-line into 'status'. 'retry' is non-zero * if an NE_RETRY should be returned if an EOF is received. */ static int read_status_line(ne_request *req, ne_status *status, int retry) { char *buffer = req->respbuf; ssize_t ret; ret = ne_sock_readline(req->session->socket, buffer, sizeof req->respbuf); if (ret <= 0) { int aret = aborted(req, _("Could not read status line"), ret); return RETRY_RET(retry, ret, aret); } NE_DEBUG(NE_DBG_HTTP, "[status-line] < %s", buffer); strip_eol(buffer, &ret); if (status->reason_phrase) ne_free(status->reason_phrase); memset(status, 0, sizeof *status); /* Hack to allow ShoutCast-style servers, if requested. */ if (req->session->flags[NE_SESSFLAG_ICYPROTO] && strncmp(buffer, "ICY ", 4) == 0 && strlen(buffer) > 8 && buffer[7] == ' ') { status->code = atoi(buffer + 4); status->major_version = 1; status->minor_version = 0; status->reason_phrase = ne_strclean(ne_strdup(buffer + 8)); status->klass = buffer[4] - '0'; NE_DEBUG(NE_DBG_HTTP, "[status-line] ICY protocol; code %d\n", status->code); } else if (ne_parse_statusline(buffer, status)) { return aborted(req, _("Could not parse response status line"), 0); } return 0; } /* Discard a set of message headers. */ static int discard_headers(ne_request *req) { do { SOCK_ERR(req, ne_sock_readline(req->session->socket, req->respbuf, sizeof req->respbuf), _("Could not read interim response headers")); NE_DEBUG(NE_DBG_HTTP, "[discard] < %s", req->respbuf); } while (strcmp(req->respbuf, EOL) != 0); return NE_OK; } /* Send the request, and read the response Status-Line. Returns: * NE_RETRY connection closed by server; persistent connection * timeout * NE_OK success * NE_* error * On NE_RETRY and NE_* responses, the connection will have been * closed already. */ static int send_request(ne_request *req, const ne_buffer *request) { ne_session *const sess = req->session; ne_status *const status = &req->status; int sentbody = 0; /* zero until body has been sent. */ int ret, retry; /* retry non-zero whilst the request should be retried */ ssize_t sret; /* Send the Request-Line and headers */ NE_DEBUG(NE_DBG_HTTP, "Sending request-line and headers:\n"); /* Open the connection if necessary */ ret = open_connection(sess); if (ret) return ret; /* Allow retry if a persistent connection has been used. */ retry = sess->persisted; sret = ne_sock_fullwrite(req->session->socket, request->data, ne_buffer_size(request)); if (sret < 0) { int aret = aborted(req, _("Could not send request"), sret); return RETRY_RET(retry, sret, aret); } if (!req->flags[NE_REQFLAG_EXPECT100] && req->body_length > 0) { /* Send request body, if not using 100-continue. */ ret = send_request_body(req, retry); if (ret) { return ret; } } NE_DEBUG(NE_DBG_HTTP, "Request sent; retry is %d.\n", retry); /* Loop eating interim 1xx responses (RFC2616 says these MAY be * sent by the server, even if 100-continue is not used). */ while ((ret = read_status_line(req, status, retry)) == NE_OK && status->klass == 1) { NE_DEBUG(NE_DBG_HTTP, "Interim %d response.\n", status->code); retry = 0; /* successful read() => never retry now. */ /* Discard headers with the interim response. */ if ((ret = discard_headers(req)) != NE_OK) break; if (req->flags[NE_REQFLAG_EXPECT100] && (status->code == 100) && req->body_length > 0 && !sentbody) { /* Send the body after receiving the first 100 Continue */ if ((ret = send_request_body(req, 0)) != NE_OK) break; sentbody = 1; } } return ret; } /* Read a message header from sock into buf, which has size 'buflen'. * * Returns: * NE_RETRY: Success, read a header into buf. * NE_OK: End of headers reached. * NE_ERROR: Error (session error is set, connection closed). */ static int read_message_header(ne_request *req, char *buf, size_t buflen) { ssize_t n; ne_socket *sock = req->session->socket; n = ne_sock_readline(sock, buf, buflen); if (n <= 0) return aborted(req, _("Error reading response headers"), n); NE_DEBUG(NE_DBG_HTTP, "[hdr] %s", buf); strip_eol(buf, &n); if (n == 0) { NE_DEBUG(NE_DBG_HTTP, "End of headers.\n"); return NE_OK; } buf += n; buflen -= n; while (buflen > 0) { char ch; /* Collect any extra lines into buffer */ SOCK_ERR(req, ne_sock_peek(sock, &ch, 1), _("Error reading response headers")); if (ch != ' ' && ch != '\t') { /* No continuation of this header: stop reading. */ return NE_RETRY; } /* Otherwise, read the next line onto the end of 'buf'. */ n = ne_sock_readline(sock, buf, buflen); if (n <= 0) { return aborted(req, _("Error reading response headers"), n); } NE_DEBUG(NE_DBG_HTTP, "[cont] %s", buf); strip_eol(buf, &n); /* assert(buf[0] == ch), which implies len(buf) > 0. * Otherwise the TCP stack is lying, but we'll be paranoid. * This might be a \t, so replace it with a space to be * friendly to applications (2616 says we MAY do this). */ if (n) buf[0] = ' '; /* ready for the next header. */ buf += n; buflen -= n; } ne_set_error(req->session, _("Response header too long")); return NE_ERROR; } #define MAX_HEADER_LEN (8192) /* Add a respnose header field for the given request, using * precalculated hash value. */ static void add_response_header(ne_request *req, unsigned int hash, char *name, char *value) { struct field **nextf = &req->response_headers[hash]; size_t vlen = strlen(value); while (*nextf) { struct field *const f = *nextf; if (strcmp(f->name, name) == 0) { if (vlen + f->vlen < MAX_HEADER_LEN) { /* merge the header field */ f->value = ne_realloc(f->value, f->vlen + vlen + 3); memcpy(f->value + f->vlen, ", ", 2); memcpy(f->value + f->vlen + 2, value, vlen + 1); f->vlen += vlen + 2; } return; } nextf = &f->next; } (*nextf) = ne_malloc(sizeof **nextf); (*nextf)->name = ne_strdup(name); (*nextf)->value = ne_strdup(value); (*nextf)->vlen = vlen; (*nextf)->next = NULL; } /* Read response headers. Returns NE_* code, sets session error and * closes connection on error. */ static int read_response_headers(ne_request *req) { char hdr[MAX_HEADER_LEN]; int ret, count = 0; while ((ret = read_message_header(req, hdr, sizeof hdr)) == NE_RETRY && ++count < MAX_HEADER_FIELDS) { char *pnt; unsigned int hash = 0; /* Strip any trailing whitespace */ pnt = hdr + strlen(hdr) - 1; while (pnt > hdr && (*pnt == ' ' || *pnt == '\t')) *pnt-- = '\0'; /* Convert the header name to lower case and hash it. */ for (pnt = hdr; (*pnt != '\0' && *pnt != ':' && *pnt != ' ' && *pnt != '\t'); pnt++) { *pnt = ne_tolower(*pnt); hash = HH_ITERATE(hash,*pnt); } /* Skip over any whitespace before the colon. */ while (*pnt == ' ' || *pnt == '\t') *pnt++ = '\0'; /* ignore header lines which lack a ':'. */ if (*pnt != ':') continue; /* NUL-terminate at the colon (when no whitespace before) */ *pnt++ = '\0'; /* Skip any whitespace after the colon... */ while (*pnt == ' ' || *pnt == '\t') pnt++; /* pnt now points to the header value. */ NE_DEBUG(NE_DBG_HTTP, "Header Name: [%s], Value: [%s]\n", hdr, pnt); add_response_header(req, hash, hdr, pnt); } if (count == MAX_HEADER_FIELDS) ret = aborted( req, _("Response exceeded maximum number of header fields"), 0); return ret; } /* Perform any necessary DNS lookup for the host given by *info; * returns NE_ code with error string set on error. */ static int lookup_host(ne_session *sess, struct host_info *info) { NE_DEBUG(NE_DBG_HTTP, "Doing DNS lookup on %s...\n", info->hostname); sess->status.lu.hostname = info->hostname; notify_status(sess, ne_status_lookup); info->address = ne_addr_resolve(info->hostname, 0); if (ne_addr_result(info->address)) { char buf[256]; ne_set_error(sess, _("Could not resolve hostname `%s': %s"), info->hostname, ne_addr_error(info->address, buf, sizeof buf)); ne_addr_destroy(info->address); info->address = NULL; return NE_LOOKUP; } else { return NE_OK; } } int ne_begin_request(ne_request *req) { struct body_reader *rdr; ne_buffer *data; const ne_status *const st = &req->status; const char *value; struct hook *hk; int ret, forced_closure = 0; /* If a non-idempotent request is sent on a persisted connection, * then it is impossible to distinguish between a server failure * and a connection timeout if an EOF/RST is received. So don't * do that. */ if (!req->flags[NE_REQFLAG_IDEMPOTENT] && req->session->persisted && !req->session->flags[NE_SESSFLAG_CONNAUTH]) { NE_DEBUG(NE_DBG_HTTP, "req: Closing connection for non-idempotent " "request.\n"); ne_close_connection(req->session); } /* Build the request string, and send it */ data = build_request(req); DEBUG_DUMP_REQUEST(data->data); ret = send_request(req, data); /* Retry this once after a persistent connection timeout. */ if (ret == NE_RETRY) { NE_DEBUG(NE_DBG_HTTP, "Persistent connection timed out, retrying.\n"); ret = send_request(req, data); } ne_buffer_destroy(data); if (ret != NE_OK) return ret == NE_RETRY ? NE_ERROR : ret; /* Determine whether server claims HTTP/1.1 compliance. */ req->session->is_http11 = (st->major_version == 1 && st->minor_version > 0) || st->major_version > 1; /* Persistent connections supported implicitly in HTTP/1.1 */ if (req->session->is_http11) req->can_persist = 1; ne_set_error(req->session, "%d %s", st->code, st->reason_phrase); /* Empty the response header hash, in case this request was * retried: */ free_response_headers(req); /* Read the headers */ ret = read_response_headers(req); if (ret) return ret; /* check the Connection header */ value = get_response_header_hv(req, HH_HV_CONNECTION, "connection"); if (value) { char *vcopy = ne_strdup(value), *ptr = vcopy; do { char *token = ne_shave(ne_token(&ptr, ','), " \t"); unsigned int hash = hash_and_lower(token); if (strcmp(token, "close") == 0) { req->can_persist = 0; forced_closure = 1; } else if (strcmp(token, "keep-alive") == 0) { req->can_persist = 1; } else if (!req->session->is_http11 && strcmp(token, "connection")) { /* Strip the header per 2616§14.10, last para. Avoid * danger from "Connection: connection". */ remove_response_header(req, token, hash); } } while (ptr); ne_free(vcopy); } /* Support "Proxy-Connection: keep-alive" for compatibility with * some HTTP/1.0 proxies; it is risky to do this, because an * intermediary proxy may not support this HTTP/1.0 extension, but * will not strip the header either. Persistent connection * support is enabled based on the presence of this header if: * a) it is *necessary* to do so due to the use of a connection-auth * scheme, and * b) connection closure was not forced via "Connection: close". */ if (req->session->nexthop->proxy == PROXY_HTTP && !req->session->is_http11 && !forced_closure && req->session->flags[NE_SESSFLAG_CONNAUTH]) { value = get_response_header_hv(req, HH_HV_PROXY_CONNECTION, "proxy-connection"); if (value && ne_strcasecmp(value, "keep-alive") == 0) { NE_DEBUG(NE_DBG_HTTP, "req: Using persistent connection " "for HTTP/1.0 proxy requiring conn-auth hack.\n"); req->can_persist = 1; } } /* Decide which method determines the response message-length per * 2616§4.4 (multipart/byteranges is not supported): */ #ifdef NE_HAVE_SSL /* Special case for CONNECT handling: the response has no body, * and the connection can persist. */ if (req->session->in_connect && st->klass == 2) { req->resp.mode = R_NO_BODY; req->can_persist = 1; } else #endif /* HEAD requests and 204, 304 responses have no response body, * regardless of what headers are present. */ if (req->method_is_head || st->code == 204 || st->code == 304) { req->resp.mode = R_NO_BODY; } /* Broken intermediaries exist which use "transfer-encoding: identity" * to mean "no transfer-coding". So that case must be ignored. */ else if ((value = get_response_header_hv(req, HH_HV_TRANSFER_ENCODING, "transfer-encoding")) != NULL && ne_strcasecmp(value, "identity") != 0) { /* Otherwise, fail iff an unknown transfer-coding is used. */ if (ne_strcasecmp(value, "chunked") == 0) { req->resp.mode = R_CHUNKED; req->resp.body.chunk.remain = 0; } else { return aborted(req, _("Unknown transfer-coding in response"), 0); } } else if ((value = get_response_header_hv(req, HH_HV_CONTENT_LENGTH, "content-length")) != NULL) { char *endptr = NULL; ne_off_t len = ne_strtoff(value, &endptr, 10); if (*value && len != NE_OFFT_MAX && len >= 0 && endptr && *endptr == '\0') { req->resp.mode = R_CLENGTH; req->resp.body.clen.total = req->resp.body.clen.remain = len; } else { /* fail for an invalid content-length header. */ return aborted(req, _("Invalid Content-Length in response"), 0); } } else { req->resp.mode = R_TILLEOF; /* otherwise: read-till-eof mode */ } NE_DEBUG(NE_DBG_HTTP, "Running post_headers hooks\n"); for (hk = req->session->post_headers_hooks; hk != NULL; hk = hk->next) { ne_post_headers_fn fn = (ne_post_headers_fn)hk->fn; fn(req, hk->userdata, &req->status); } /* Prepare for reading the response entity-body. Call each of the * body readers and ask them whether they want to accept this * response or not. */ for (rdr = req->body_readers; rdr != NULL; rdr=rdr->next) { rdr->use = rdr->accept_response(rdr->userdata, req, st); } req->session->status.sr.progress = 0; req->session->status.sr.total = req->resp.mode == R_CLENGTH ? req->resp.body.clen.total : -1; notify_status(req->session, ne_status_recving); return NE_OK; } int ne_end_request(ne_request *req) { struct hook *hk; int ret; /* Read headers in chunked trailers */ if (req->resp.mode == R_CHUNKED) { ret = read_response_headers(req); if (ret) return ret; } else { ret = NE_OK; } NE_DEBUG(NE_DBG_HTTP, "Running post_send hooks\n"); for (hk = req->session->post_send_hooks; ret == NE_OK && hk != NULL; hk = hk->next) { ne_post_send_fn fn = (ne_post_send_fn)hk->fn; ret = fn(req, hk->userdata, &req->status); } /* Close the connection if persistent connections are disabled or * not supported by the server. */ if (!req->session->flags[NE_SESSFLAG_PERSIST] || !req->can_persist) ne_close_connection(req->session); else req->session->persisted = 1; return ret; } int ne_read_response_to_fd(ne_request *req, int fd) { ssize_t len; while ((len = ne_read_response_block(req, req->respbuf, sizeof req->respbuf)) > 0) { const char *block = req->respbuf; do { ssize_t ret = write(fd, block, len); if (ret == -1 && errno == EINTR) { continue; } else if (ret < 0) { char err[200]; ne_strerror(errno, err, sizeof err); ne_set_error(ne_get_session(req), _("Could not write to file: %s"), err); return NE_ERROR; } else { len -= ret; block += ret; } } while (len > 0); } return len == 0 ? NE_OK : NE_ERROR; } int ne_discard_response(ne_request *req) { ssize_t len; do { len = ne_read_response_block(req, req->respbuf, sizeof req->respbuf); } while (len > 0); return len == 0 ? NE_OK : NE_ERROR; } int ne_request_dispatch(ne_request *req) { int ret; do { ret = ne_begin_request(req); if (ret == NE_OK) ret = ne_discard_response(req); if (ret == NE_OK) ret = ne_end_request(req); } while (ret == NE_RETRY); NE_DEBUG(NE_DBG_HTTP | NE_DBG_FLUSH, "Request ends, status %d class %dxx, error line:\n%s\n", req->status.code, req->status.klass, req->session->error); return ret; } const ne_status *ne_get_status(const ne_request *req) { return &req->status; } ne_session *ne_get_session(const ne_request *req) { return req->session; } #ifdef NE_HAVE_SSL /* Create a CONNECT tunnel through the proxy server. * Returns HTTP_* */ static int proxy_tunnel(ne_session *sess) { /* Hack up an HTTP CONNECT request... */ ne_request *req; int ret = NE_OK; char ruri[200]; /* Can't use server.hostport here; Request-URI must include `:port' */ ne_snprintf(ruri, sizeof ruri, "%s:%u", sess->server.hostname, sess->server.port); req = ne_request_create(sess, "CONNECT", ruri); sess->in_connect = 1; ret = ne_request_dispatch(req); sess->in_connect = 0; sess->persisted = 0; /* don't treat this is a persistent connection. */ if (ret != NE_OK || !sess->connected || req->status.klass != 2) { char *err = ne_strdup(sess->error); ne_set_error(sess, _("Could not create SSL connection " "through proxy server: %s"), err); ne_free(err); if (ret == NE_OK) ret = NE_ERROR; } ne_request_destroy(req); return ret; } #endif /* Return the first resolved address for the given host. */ static const ne_inet_addr *resolve_first(struct host_info *host) { return host->network ? host->network : ne_addr_first(host->address); } /* Return the next resolved address for the given host or NULL if * there are no more addresses. */ static const ne_inet_addr *resolve_next(struct host_info *host) { return host->network ? NULL : ne_addr_next(host->address); } /* Make new TCP connection to server at 'host' of type 'name'. Note * that once a connection to a particular network address has * succeeded, that address will be used first for the next attempt to * connect. */ static int do_connect(ne_session *sess, struct host_info *host) { int ret; /* Resolve hostname if necessary. */ if (host->address == NULL && host->network == NULL) { ret = lookup_host(sess, host); if (ret) return ret; } if ((sess->socket = ne_sock_create()) == NULL) { ne_set_error(sess, _("Could not create socket")); return NE_ERROR; } if (sess->cotimeout) ne_sock_connect_timeout(sess->socket, sess->cotimeout); if (sess->local_addr) ne_sock_prebind(sess->socket, sess->local_addr, 0); if (host->current == NULL) host->current = resolve_first(host); sess->status.ci.hostname = host->hostname; do { sess->status.ci.address = host->current; notify_status(sess, ne_status_connecting); #ifdef NE_DEBUGGING if (ne_debug_mask & NE_DBG_HTTP) { char buf[150]; NE_DEBUG(NE_DBG_HTTP, "Connecting to %s\n", ne_iaddr_print(host->current, buf, sizeof buf)); } #endif ret = ne_sock_connect(sess->socket, host->current, host->port); } while (ret && /* try the next address... */ (host->current = resolve_next(host)) != NULL); if (ret) { const char *msg; if (host->proxy == PROXY_NONE) msg = _("Could not connect to server"); else msg = _("Could not connect to proxy server"); ne_set_error(sess, "%s: %s", msg, ne_sock_error(sess->socket)); ne_sock_close(sess->socket); return ret == NE_SOCK_TIMEOUT ? NE_TIMEOUT : NE_CONNECT; } if (sess->rdtimeout) ne_sock_read_timeout(sess->socket, sess->rdtimeout); notify_status(sess, ne_status_connected); sess->nexthop = host; sess->connected = 1; /* clear persistent connection flag. */ sess->persisted = 0; return NE_OK; } /* For a SOCKSv4 proxy only, the IP address of the origin server (in * addition to the proxy) must be known, and must be an IPv4 address. * Returns NE_*; connection closed and error string set on error. */ static int socks_origin_lookup(ne_session *sess) { const ne_inet_addr *ia; int ret; ret = lookup_host(sess, &sess->server); if (ret) { /* lookup_host already set the error string. */ ne_close_connection(sess); return ret; } /* Find the first IPv4 address available for the server. */ for (ia = ne_addr_first(sess->server.address); ia && ne_iaddr_typeof(ia) == ne_iaddr_ipv6; ia = ne_addr_next(sess->server.address)) { /* noop */ } /* ... if any */ if (ia == NULL) { ne_set_error(sess, _("Could not find IPv4 address of " "hostname %s for SOCKS v4 proxy"), sess->server.hostname); ne_close_connection(sess); return NE_LOOKUP; } sess->server.current = ia; return ret; } static int open_connection(ne_session *sess) { int ret; if (sess->connected) return NE_OK; if (!sess->proxies) { ret = do_connect(sess, &sess->server); if (ret) { sess->nexthop = NULL; return ret; } } else { struct host_info *hi; /* Attempt to re-use proxy to avoid iterating through * unnecessarily. */ if (sess->prev_proxy) ret = do_connect(sess, sess->prev_proxy); else ret = NE_ERROR; /* Otherwise, try everything - but omitting prev_proxy if that * has already been tried. */ for (hi = sess->proxies; hi && ret; hi = hi->next) { if (hi != sess->prev_proxy) ret = do_connect(sess, hi); } if (ret == NE_OK && sess->nexthop->proxy == PROXY_SOCKS) { /* Special-case for SOCKS v4 proxies, which require the * client to resolve the origin server IP address. */ if (sess->socks_ver == NE_SOCK_SOCKSV4) { ret = socks_origin_lookup(sess); } if (ret == NE_OK) { /* Perform the SOCKS handshake, instructing the proxy * to set up the connection to the origin server. */ ret = ne_sock_proxy(sess->socket, sess->socks_ver, sess->server.current, sess->server.hostname, sess->server.port, sess->socks_user, sess->socks_password); if (ret) { ne_set_error(sess, _("Could not establish connection from " "SOCKS proxy (%s:%u): %s"), sess->nexthop->hostname, sess->nexthop->port, ne_sock_error(sess->socket)); ne_close_connection(sess); } } } if (ret != NE_OK) { sess->nexthop = NULL; sess->prev_proxy = NULL; return ret; } /* Success - make this proxy stick. */ sess->prev_proxy = hi; } #ifdef NE_HAVE_SSL /* Negotiate SSL layer if required. */ if (sess->use_ssl && !sess->in_connect) { /* Set up CONNECT tunnel if using an HTTP proxy. */ if (sess->nexthop->proxy == PROXY_HTTP) ret = proxy_tunnel(sess); if (ret == NE_OK) { ret = ne__negotiate_ssl(sess); if (ret != NE_OK) ne_close_connection(sess); } } #endif return ret; } cadaver-0.23.3/lib/neon/ne_auth.c0000664000076400007640000014337511305555706016146 0ustar jortonjorton/* HTTP Authentication routines Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include /* for getpid() */ #endif #ifdef WIN32 #include /* for GetCurrentThreadId() etc */ #endif #ifdef HAVE_OPENSSL #include #elif defined(HAVE_GNUTLS) #include #endif #include #include #include "ne_md5.h" #include "ne_dates.h" #include "ne_request.h" #include "ne_auth.h" #include "ne_string.h" #include "ne_utils.h" #include "ne_alloc.h" #include "ne_uri.h" #include "ne_internal.h" #ifdef HAVE_GSSAPI #ifdef HAVE_GSSAPI_GSSAPI_H #include #ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H #include #endif #else #include #endif #endif #ifdef HAVE_SSPI #include "ne_sspi.h" #endif #ifdef HAVE_NTLM #include "ne_ntlm.h" #endif #define HOOK_SERVER_ID "http://webdav.org/neon/hooks/server-auth" #define HOOK_PROXY_ID "http://webdav.org/neon/hooks/proxy-auth" typedef enum { auth_alg_md5, auth_alg_md5_sess, auth_alg_unknown } auth_algorithm; /* Selected method of qop which the client is using */ typedef enum { auth_qop_none, auth_qop_auth } auth_qop; /* A callback/userdata pair registered by the application for * a particular set of protocols. */ struct auth_handler { unsigned protomask; ne_auth_creds creds; void *userdata; int attempt; /* number of invocations of this callback for * current request. */ struct auth_handler *next; }; /* A challenge */ struct auth_challenge { const struct auth_protocol *protocol; struct auth_handler *handler; const char *realm, *nonce, *opaque, *domain; unsigned int stale; /* if stale=true */ unsigned int got_qop; /* we were given a qop directive */ unsigned int qop_auth; /* "auth" token in qop attrib */ auth_algorithm alg; struct auth_challenge *next; }; static const struct auth_class { const char *id, *req_hdr, *resp_hdr, *resp_info_hdr; int status_code; /* Response status-code to trap. */ int fail_code; /* NE_* request to fail with. */ const char *error_noauth; /* Error message template use when * giving up authentication attempts. */ } ah_server_class = { HOOK_SERVER_ID, "Authorization", "WWW-Authenticate", "Authentication-Info", 401, NE_AUTH, N_("Could not authenticate to server: %s") }, ah_proxy_class = { HOOK_PROXY_ID, "Proxy-Authorization", "Proxy-Authenticate", "Proxy-Authentication-Info", 407, NE_PROXYAUTH, N_("Could not authenticate to proxy server: %s") }; /* Authentication session state. */ typedef struct { ne_session *sess; /* Which context will auth challenges be accepted? */ enum { AUTH_ANY, /* ignore nothing. */ AUTH_CONNECT, /* only in response to a CONNECT request. */ AUTH_NOTCONNECT /* only in non-CONNECT responsees */ } context; /* Protocol type for server/proxy auth. */ const struct auth_class *spec; /* The protocol used for this authentication session */ const struct auth_protocol *protocol; struct auth_handler *handlers; /*** Session details ***/ /* The username and password we are using to authenticate with */ char username[NE_ABUFSIZ]; /* This used for Basic auth */ char *basic; #ifdef HAVE_GSSAPI /* for the GSSAPI/Negotiate scheme: */ char *gssapi_token; gss_ctx_id_t gssctx; gss_name_t gssname; gss_OID gssmech; #endif #ifdef HAVE_SSPI /* This is used for SSPI (Negotiate/NTLM) auth */ char *sspi_token; void *sspi_context; #endif #ifdef HAVE_NTLM /* This is used for NTLM auth */ ne_ntlm_context *ntlm_context; #endif /* These all used for Digest auth */ char *realm; char *nonce; char *cnonce; char *opaque; char **domains; /* list of paths given as domain. */ size_t ndomains; /* size of domains array */ auth_qop qop; auth_algorithm alg; unsigned int nonce_count; /* The ASCII representation of the session's H(A1) value */ char h_a1[33]; /* Temporary store for half of the Request-Digest * (an optimisation - used in the response-digest calculation) */ struct ne_md5_ctx *stored_rdig; } auth_session; struct auth_request { /*** Per-request details. ***/ ne_request *request; /* the request object. */ /* The method and URI we are using for the current request */ const char *uri; const char *method; int attempt; /* number of times this request has been retries due * to auth challenges. */ }; /* Used if this protocol takes an unquoted non-name/value-pair * parameter in the challenge. */ #define AUTH_FLAG_OPAQUE_PARAM (0x0001) /* Used if this Authentication-Info may be sent for non-40[17] * response for this protocol. */ #define AUTH_FLAG_VERIFY_NON40x (0x0002) /* Used for broken the connection-based auth schemes. */ #define AUTH_FLAG_CONN_AUTH (0x0004) struct auth_protocol { unsigned id; /* public NE_AUTH_* id. */ int strength; /* protocol strength for sort order. */ const char *name; /* protocol name. */ /* Parse the authentication challenge; returns zero on success, or * non-zero if this challenge be handled. 'attempt' is the number * of times the request has been resent due to auth challenges. * On failure, challenge_error() should be used to append an error * message to the error buffer 'errmsg'. */ int (*challenge)(auth_session *sess, int attempt, struct auth_challenge *chall, ne_buffer **errmsg); /* Return the string to send in the -Authenticate request header: * (ne_malloc-allocated, NUL-terminated string) */ char *(*response)(auth_session *sess, struct auth_request *req); /* Parse a Authentication-Info response; returns NE_* error code * on failure; on failure, the session error string must be * set. */ int (*verify)(struct auth_request *req, auth_session *sess, const char *value); int flags; /* AUTH_FLAG_* flags */ }; /* Helper function to append an error to the buffer during challenge * handling. Pass printf-style string. *errmsg may be NULL and is * allocated if necessary. errmsg must be non-NULL. */ static void challenge_error(ne_buffer **errmsg, const char *fmt, ...) ne_attribute((format(printf, 2, 3))); /* Free the domains array, precondition sess->ndomains > 0. */ static void free_domains(auth_session *sess) { do { ne_free(sess->domains[sess->ndomains - 1]); } while (--sess->ndomains); ne_free(sess->domains); sess->domains = NULL; } static void clean_session(auth_session *sess) { if (sess->basic) ne_free(sess->basic); if (sess->nonce) ne_free(sess->nonce); if (sess->cnonce) ne_free(sess->cnonce); if (sess->opaque) ne_free(sess->opaque); if (sess->realm) ne_free(sess->realm); sess->realm = sess->basic = sess->cnonce = sess->nonce = sess->opaque = NULL; if (sess->stored_rdig) { ne_md5_destroy_ctx(sess->stored_rdig); sess->stored_rdig = NULL; } if (sess->ndomains) free_domains(sess); #ifdef HAVE_GSSAPI { unsigned int major; if (sess->gssctx != GSS_C_NO_CONTEXT) gss_delete_sec_context(&major, &sess->gssctx, GSS_C_NO_BUFFER); } if (sess->gssapi_token) ne_free(sess->gssapi_token); sess->gssapi_token = NULL; #endif #ifdef HAVE_SSPI if (sess->sspi_token) ne_free(sess->sspi_token); sess->sspi_token = NULL; ne_sspi_destroy_context(sess->sspi_context); sess->sspi_context = NULL; #endif #ifdef HAVE_NTLM if (sess->ntlm_context) { ne__ntlm_destroy_context(sess->ntlm_context); sess->ntlm_context = NULL; } #endif sess->protocol = NULL; } /* Returns client nonce string. */ static char *get_cnonce(void) { char ret[33]; unsigned char data[256]; struct ne_md5_ctx *hash; hash = ne_md5_create_ctx(); #ifdef HAVE_GNUTLS if (1) { gcry_create_nonce(data, sizeof data); ne_md5_process_bytes(data, sizeof data, hash); } else #elif defined(HAVE_OPENSSL) if (RAND_status() == 1 && RAND_pseudo_bytes(data, sizeof data) >= 0) { ne_md5_process_bytes(data, sizeof data, hash); } else #endif /* HAVE_OPENSSL */ { /* Fallback sources of random data: all bad, but no good sources * are available. */ /* Uninitialized stack data; yes, happy valgrinders, this is * supposed to be here. */ ne_md5_process_bytes(data, sizeof data, hash); { #ifdef HAVE_GETTIMEOFDAY struct timeval tv; if (gettimeofday(&tv, NULL) == 0) ne_md5_process_bytes(&tv, sizeof tv, hash); #else /* HAVE_GETTIMEOFDAY */ time_t t = time(NULL); ne_md5_process_bytes(&t, sizeof t, hash); #endif } { #ifdef WIN32 DWORD pid = GetCurrentThreadId(); #else pid_t pid = getpid(); #endif ne_md5_process_bytes(&pid, sizeof pid, hash); } } ne_md5_finish_ascii(hash, ret); ne_md5_destroy_ctx(hash); return ne_strdup(ret); } /* Callback to retrieve user credentials for given session on given * attempt (pre request) for given challenge. Password is written to * pwbuf (of size NE_ABUFSIZ. On error, challenge_error() is used * with errmsg. */ static int get_credentials(auth_session *sess, ne_buffer **errmsg, int attempt, struct auth_challenge *chall, char *pwbuf) { if (chall->handler->creds(chall->handler->userdata, sess->realm, chall->handler->attempt++, sess->username, pwbuf) == 0) { return 0; } else { challenge_error(errmsg, _("rejected %s challenge"), chall->protocol->name); return -1; } } /* Examine a Basic auth challenge. * Returns 0 if an valid challenge, else non-zero. */ static int basic_challenge(auth_session *sess, int attempt, struct auth_challenge *parms, ne_buffer **errmsg) { char *tmp, password[NE_ABUFSIZ]; /* Verify challenge... must have a realm */ if (parms->realm == NULL) { challenge_error(errmsg, _("missing realm in Basic challenge")); return -1; } clean_session(sess); sess->realm = ne_strdup(parms->realm); if (get_credentials(sess, errmsg, attempt, parms, password)) { /* Failed to get credentials */ return -1; } tmp = ne_concat(sess->username, ":", password, NULL); sess->basic = ne_base64((unsigned char *)tmp, strlen(tmp)); ne_free(tmp); /* Paranoia. */ memset(password, 0, sizeof password); return 0; } /* Add Basic authentication credentials to a request */ static char *request_basic(auth_session *sess, struct auth_request *req) { return ne_concat("Basic ", sess->basic, "\r\n", NULL); } #ifdef HAVE_GSSAPI /* Add GSSAPI authentication credentials to a request */ static char *request_negotiate(auth_session *sess, struct auth_request *req) { if (sess->gssapi_token) return ne_concat("Negotiate ", sess->gssapi_token, "\r\n", NULL); else return NULL; } /* Create an GSSAPI name for server HOSTNAME; returns non-zero on * error. */ static void get_gss_name(gss_name_t *server, const char *hostname) { unsigned int major, minor; gss_buffer_desc token; token.value = ne_concat("HTTP@", hostname, NULL); token.length = strlen(token.value); major = gss_import_name(&minor, &token, GSS_C_NT_HOSTBASED_SERVICE, server); ne_free(token.value); if (GSS_ERROR(major)) { NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: gss_import_name failed.\n"); *server = GSS_C_NO_NAME; } } /* Append GSSAPI error(s) for STATUS of type TYPE to BUF; prepending * ": " to each error if *FLAG is non-zero, setting *FLAG after an * error has been appended. */ static void make_gss_error(ne_buffer *buf, int *flag, unsigned int status, int type) { unsigned int major, minor; unsigned int context = 0; do { gss_buffer_desc msg; major = gss_display_status(&minor, status, type, GSS_C_NO_OID, &context, &msg); if (major == GSS_S_COMPLETE && msg.length) { if ((*flag)++) ne_buffer_append(buf, ": ", 2); ne_buffer_append(buf, msg.value, msg.length); } if (msg.length) gss_release_buffer(&minor, &msg); } while (context); } /* Continue a GSS-API Negotiate exchange, using input TOKEN if * non-NULL. Returns non-zero on error, in which case *errmsg is * guaranteed to be non-NULL (i.e. an error message is set). */ static int continue_negotiate(auth_session *sess, const char *token, ne_buffer **errmsg) { unsigned int major, minor; gss_buffer_desc input = GSS_C_EMPTY_BUFFER; gss_buffer_desc output = GSS_C_EMPTY_BUFFER; unsigned char *bintoken = NULL; int ret; if (token) { input.length = ne_unbase64(token, &bintoken); if (input.length == 0) { challenge_error(errmsg, _("invalid Negotiate token")); return -1; } input.value = bintoken; NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Continuation token [%s]\n", token); } else if (sess->gssctx != GSS_C_NO_CONTEXT) { NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Reset incomplete context.\n"); gss_delete_sec_context(&minor, &sess->gssctx, GSS_C_NO_BUFFER); } major = gss_init_sec_context(&minor, GSS_C_NO_CREDENTIAL, &sess->gssctx, sess->gssname, sess->gssmech, GSS_C_MUTUAL_FLAG, GSS_C_INDEFINITE, GSS_C_NO_CHANNEL_BINDINGS, &input, &sess->gssmech, &output, NULL, NULL); /* done with the input token. */ if (bintoken) ne_free(bintoken); if (GSS_ERROR(major)) { int flag = 0; challenge_error(errmsg, _("GSSAPI authentication error: ")); make_gss_error(*errmsg, &flag, major, GSS_C_GSS_CODE); make_gss_error(*errmsg, &flag, minor, GSS_C_MECH_CODE); return -1; } if (major == GSS_S_CONTINUE_NEEDED || major == GSS_S_COMPLETE) { NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: init_sec_context OK. (major=%d)\n", major); ret = 0; } else { challenge_error(errmsg, _("GSSAPI failure (code %u)"), major); ret = -1; } if (major != GSS_S_CONTINUE_NEEDED) { /* context no longer needed: destroy it */ gss_delete_sec_context(&minor, &sess->gssctx, GSS_C_NO_BUFFER); } if (output.length) { sess->gssapi_token = ne_base64(output.value, output.length); NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Output token: [%s]\n", sess->gssapi_token); gss_release_buffer(&minor, &output); } else { NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: No output token.\n"); } return ret; } /* Process a Negotiate challange CHALL in session SESS; returns zero * if challenge is accepted. */ static int negotiate_challenge(auth_session *sess, int attempt, struct auth_challenge *chall, ne_buffer **errmsg) { const char *token = chall->opaque; /* Respect an initial challenge - which must have no input token, * or a continuation - which must have an input token. */ if (attempt == 0 || token) { return continue_negotiate(sess, token, errmsg); } else { challenge_error(errmsg, _("ignoring empty Negotiate continuation")); return -1; } } /* Verify the header HDR in a Negotiate response. */ static int verify_negotiate_response(struct auth_request *req, auth_session *sess, const char *hdr) { char *duphdr = ne_strdup(hdr); char *sep, *ptr = strchr(duphdr, ' '); int ret; ne_buffer *errmsg = NULL; if (strncmp(hdr, "Negotiate", ptr - duphdr) != 0) { ne_set_error(sess->sess, _("Negotiate response verification failed: " "invalid response header token")); ne_free(duphdr); return NE_ERROR; } ptr++; if (strlen(ptr) == 0) { NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: No token in Negotiate response!\n"); ne_free(duphdr); return NE_OK; } if ((sep = strchr(ptr, ',')) != NULL) *sep = '\0'; if ((sep = strchr(ptr, ' ')) != NULL) *sep = '\0'; NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Negotiate response token [%s]\n", ptr); ret = continue_negotiate(sess, ptr, &errmsg); if (ret) { ne_set_error(sess->sess, _("Negotiate response verification failure: %s"), errmsg->data); } if (errmsg) ne_buffer_destroy(errmsg); ne_free(duphdr); return ret ? NE_ERROR : NE_OK; } #endif #ifdef HAVE_SSPI static char *request_sspi(auth_session *sess, struct auth_request *request) { return ne_concat(sess->protocol->name, " ", sess->sspi_token, "\r\n", NULL); } static int sspi_challenge(auth_session *sess, int attempt, struct auth_challenge *parms, ne_buffer **errmsg) { int ntlm = ne_strcasecmp(parms->protocol->name, "NTLM") == 0; int status; char *response = NULL; NE_DEBUG(NE_DBG_HTTPAUTH, "auth: SSPI challenge.\n"); if (!sess->sspi_context) { ne_uri uri = {0}; ne_fill_server_uri(sess->sess, &uri); status = ne_sspi_create_context(&sess->sspi_context, uri.host, ntlm); ne_uri_free(&uri); if (status) { return status; } } status = ne_sspi_authenticate(sess->sspi_context, parms->opaque, &response); if (status) { return status; } sess->sspi_token = response; NE_DEBUG(NE_DBG_HTTPAUTH, "auth: SSPI challenge [%s]\n", sess->sspi_token); return 0; } #endif /* Parse the "domain" challenge parameter and set the domains array up * in the session appropriately. */ static int parse_domain(auth_session *sess, const char *domain) { char *cp = ne_strdup(domain), *p = cp; ne_uri base; int invalid = 0; memset(&base, 0, sizeof base); ne_fill_server_uri(sess->sess, &base); do { char *token = ne_token(&p, ' '); ne_uri rel, absolute; if (ne_uri_parse(token, &rel) == 0) { /* Resolve relative to the Request-URI. */ base.path = "/"; ne_uri_resolve(&base, &rel, &absolute); /* Compare against the resolved path to check this URI has * the same (scheme, host, port) components; ignore it * otherwise: */ base.path = absolute.path; if (absolute.path && ne_uri_cmp(&absolute, &base) == 0) { sess->domains = ne_realloc(sess->domains, ++sess->ndomains * sizeof(*sess->domains)); sess->domains[sess->ndomains - 1] = absolute.path; NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Using domain %s from %s\n", absolute.path, token); absolute.path = NULL; } else { NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Ignoring domain %s\n", token); } ne_uri_free(&absolute); } else { invalid = 1; } ne_uri_free(&rel); } while (p && !invalid); if (invalid && sess->ndomains) { free_domains(sess); } ne_free(cp); base.path = NULL; ne_uri_free(&base); return invalid; } #ifdef HAVE_NTLM static char *request_ntlm(auth_session *sess, struct auth_request *request) { char *token = ne__ntlm_getRequestToken(sess->ntlm_context); if (token) { char *req = ne_concat(sess->protocol->name, " ", token, "\r\n", NULL); ne_free(token); return req; } else { return NULL; } } static int ntlm_challenge(auth_session *sess, int attempt, struct auth_challenge *parms, ne_buffer **errmsg) { int status; NE_DEBUG(NE_DBG_HTTPAUTH, "auth: NTLM challenge.\n"); if (!parms->opaque && (!sess->ntlm_context || (attempt > 1))) { char password[NE_ABUFSIZ]; if (get_credentials(sess, errmsg, attempt, parms, password)) { /* Failed to get credentials */ return -1; } if (sess->ntlm_context) { ne__ntlm_destroy_context(sess->ntlm_context); sess->ntlm_context = NULL; } sess->ntlm_context = ne__ntlm_create_context(sess->username, password); } status = ne__ntlm_authenticate(sess->ntlm_context, parms->opaque); if (status) { return status; } return 0; } #endif /* HAVE_NTLM */ /* Examine a digest challenge: return 0 if it is a valid Digest challenge, * else non-zero. */ static int digest_challenge(auth_session *sess, int attempt, struct auth_challenge *parms, ne_buffer **errmsg) { char password[NE_ABUFSIZ]; if (parms->alg == auth_alg_unknown) { challenge_error(errmsg, _("unknown algorithm in Digest challenge")); return -1; } else if (parms->alg == auth_alg_md5_sess && !parms->qop_auth) { challenge_error(errmsg, _("incompatible algorithm in Digest challenge")); return -1; } else if (parms->realm == NULL || parms->nonce == NULL) { challenge_error(errmsg, _("missing parameter in Digest challenge")); return -1; } else if (parms->stale && sess->realm == NULL) { challenge_error(errmsg, _("initial Digest challenge was stale")); return -1; } else if (parms->stale && (sess->alg != parms->alg || strcmp(sess->realm, parms->realm))) { /* With stale=true the realm and algorithm cannot change since these * require re-hashing H(A1) which defeats the point. */ challenge_error(errmsg, _("stale Digest challenge with new algorithm or realm")); return -1; } if (!parms->stale) { /* Non-stale challenge: clear session and request credentials. */ clean_session(sess); /* The domain paramater must be parsed after the session is * cleaned; ignore domain for proxy auth. */ if (parms->domain && sess->spec == &ah_server_class && parse_domain(sess, parms->domain)) { challenge_error(errmsg, _("could not parse domain in Digest challenge")); return -1; } sess->realm = ne_strdup(parms->realm); sess->alg = parms->alg; sess->cnonce = get_cnonce(); if (get_credentials(sess, errmsg, attempt, parms, password)) { /* Failed to get credentials */ return -1; } } else { /* Stale challenge: accept a new nonce or opaque. */ if (sess->nonce) ne_free(sess->nonce); if (sess->opaque && parms->opaque) ne_free(sess->opaque); } sess->nonce = ne_strdup(parms->nonce); if (parms->opaque) { sess->opaque = ne_strdup(parms->opaque); } if (parms->got_qop) { /* What type of qop are we to apply to the message? */ NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Got qop, using 2617-style.\n"); sess->nonce_count = 0; sess->qop = auth_qop_auth; } else { /* No qop at all/ */ sess->qop = auth_qop_none; } if (!parms->stale) { struct ne_md5_ctx *tmp; /* Calculate H(A1). * tmp = H(unq(username-value) ":" unq(realm-value) ":" passwd) */ tmp = ne_md5_create_ctx(); ne_md5_process_bytes(sess->username, strlen(sess->username), tmp); ne_md5_process_bytes(":", 1, tmp); ne_md5_process_bytes(sess->realm, strlen(sess->realm), tmp); ne_md5_process_bytes(":", 1, tmp); ne_md5_process_bytes(password, strlen(password), tmp); memset(password, 0, sizeof password); /* done with that. */ if (sess->alg == auth_alg_md5_sess) { struct ne_md5_ctx *a1; char tmp_md5_ascii[33]; /* Now we calculate the SESSION H(A1) * A1 = H(...above...) ":" unq(nonce-value) ":" unq(cnonce-value) */ ne_md5_finish_ascii(tmp, tmp_md5_ascii); a1 = ne_md5_create_ctx(); ne_md5_process_bytes(tmp_md5_ascii, 32, a1); ne_md5_process_bytes(":", 1, a1); ne_md5_process_bytes(sess->nonce, strlen(sess->nonce), a1); ne_md5_process_bytes(":", 1, a1); ne_md5_process_bytes(sess->cnonce, strlen(sess->cnonce), a1); ne_md5_finish_ascii(a1, sess->h_a1); ne_md5_destroy_ctx(a1); NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Session H(A1) is [%s]\n", sess->h_a1); } else { ne_md5_finish_ascii(tmp, sess->h_a1); NE_DEBUG(NE_DBG_HTTPAUTH, "auth: H(A1) is [%s]\n", sess->h_a1); } ne_md5_destroy_ctx(tmp); } NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Accepting digest challenge.\n"); return 0; } /* Returns non-zero if given Request-URI is inside the authentication * domain defined for the session. */ static int inside_domain(auth_session *sess, const char *req_uri) { int inside = 0; size_t n; ne_uri uri; /* Parse the Request-URI; it will be an absoluteURI if using a * proxy, and possibly '*'. */ if (strcmp(req_uri, "*") == 0 || ne_uri_parse(req_uri, &uri) != 0) { /* Presume outside the authentication domain. */ return 0; } for (n = 0; n < sess->ndomains && !inside; n++) { const char *d = sess->domains[n]; inside = strncmp(uri.path, d, strlen(d)) == 0; } NE_DEBUG(NE_DBG_HTTPAUTH, "auth: '%s' is inside auth domain: %d.\n", uri.path, inside); ne_uri_free(&uri); return inside; } /* Return Digest authentication credentials header value for the given * session. */ static char *request_digest(auth_session *sess, struct auth_request *req) { struct ne_md5_ctx *a2, *rdig; char a2_md5_ascii[33], rdig_md5_ascii[33]; char nc_value[9] = {0}; const char *qop_value = "auth"; /* qop-value */ ne_buffer *ret; /* Do not submit credentials if an auth domain is defined and this * request-uri fails outside it. */ if (sess->ndomains && !inside_domain(sess, req->uri)) { return NULL; } /* Increase the nonce-count */ if (sess->qop != auth_qop_none) { sess->nonce_count++; ne_snprintf(nc_value, 9, "%08x", sess->nonce_count); } /* Calculate H(A2). */ a2 = ne_md5_create_ctx(); ne_md5_process_bytes(req->method, strlen(req->method), a2); ne_md5_process_bytes(":", 1, a2); ne_md5_process_bytes(req->uri, strlen(req->uri), a2); ne_md5_finish_ascii(a2, a2_md5_ascii); ne_md5_destroy_ctx(a2); NE_DEBUG(NE_DBG_HTTPAUTH, "auth: H(A2): %s\n", a2_md5_ascii); /* Now, calculation of the Request-Digest. * The first section is the regardless of qop value * H(A1) ":" unq(nonce-value) ":" */ rdig = ne_md5_create_ctx(); /* Use the calculated H(A1) */ ne_md5_process_bytes(sess->h_a1, 32, rdig); ne_md5_process_bytes(":", 1, rdig); ne_md5_process_bytes(sess->nonce, strlen(sess->nonce), rdig); ne_md5_process_bytes(":", 1, rdig); if (sess->qop != auth_qop_none) { /* Add on: * nc-value ":" unq(cnonce-value) ":" unq(qop-value) ":" */ ne_md5_process_bytes(nc_value, 8, rdig); ne_md5_process_bytes(":", 1, rdig); ne_md5_process_bytes(sess->cnonce, strlen(sess->cnonce), rdig); ne_md5_process_bytes(":", 1, rdig); /* Store a copy of this structure (see note below) */ if (sess->stored_rdig) ne_md5_destroy_ctx(sess->stored_rdig); sess->stored_rdig = ne_md5_dup_ctx(rdig); ne_md5_process_bytes(qop_value, strlen(qop_value), rdig); ne_md5_process_bytes(":", 1, rdig); } /* And finally, H(A2) */ ne_md5_process_bytes(a2_md5_ascii, 32, rdig); ne_md5_finish_ascii(rdig, rdig_md5_ascii); ne_md5_destroy_ctx(rdig); ret = ne_buffer_create(); ne_buffer_concat(ret, "Digest username=\"", sess->username, "\", " "realm=\"", sess->realm, "\", " "nonce=\"", sess->nonce, "\", " "uri=\"", req->uri, "\", " "response=\"", rdig_md5_ascii, "\", " "algorithm=\"", sess->alg == auth_alg_md5 ? "MD5" : "MD5-sess", "\"", NULL); if (sess->opaque != NULL) { ne_buffer_concat(ret, ", opaque=\"", sess->opaque, "\"", NULL); } if (sess->qop != auth_qop_none) { /* Add in cnonce and nc-value fields */ ne_buffer_concat(ret, ", cnonce=\"", sess->cnonce, "\", " "nc=", nc_value, ", " "qop=\"", qop_value, "\"", NULL); } ne_buffer_zappend(ret, "\r\n"); return ne_buffer_finish(ret); } /* Parse line of comma-separated key-value pairs. If 'ischall' == 1, * then also return a leading space-separated token, as *value == * NULL. Otherwise, if return value is 0, *key and *value will be * non-NULL. If return value is non-zero, parsing has ended. If * 'sep' is non-NULL and ischall is 1, the separator character is * written to *sep when a challenge is parsed. */ static int tokenize(char **hdr, char **key, char **value, char *sep, int ischall) { char *pnt = *hdr; enum { BEFORE_EQ, AFTER_EQ, AFTER_EQ_QUOTED } state = BEFORE_EQ; if (**hdr == '\0') return 1; *key = NULL; do { switch (state) { case BEFORE_EQ: if (*pnt == '=') { if (*key == NULL) return -1; *pnt = '\0'; *value = pnt + 1; state = AFTER_EQ; } else if ((*pnt == ' ' || *pnt == ',') && ischall && *key != NULL) { *value = NULL; if (sep) *sep = *pnt; *pnt = '\0'; *hdr = pnt + 1; return 0; } else if (*key == NULL && strchr(" \r\n\t", *pnt) == NULL) { *key = pnt; } break; case AFTER_EQ: if (*pnt == ',') { *pnt = '\0'; *hdr = pnt + 1; return 0; } else if (*pnt == '\"') { state = AFTER_EQ_QUOTED; } break; case AFTER_EQ_QUOTED: if (*pnt == '\"') { state = AFTER_EQ; *pnt = '\0'; } break; } } while (*++pnt != '\0'); if (state == BEFORE_EQ && ischall && *key != NULL) { *value = NULL; if (sep) *sep = '\0'; } *hdr = pnt; /* End of string: */ return 0; } /* Pass this the value of the 'Authentication-Info:' header field, if * one is received. * Returns: * 0 if it gives a valid authentication for the server * non-zero otherwise (don't believe the response in this case!). */ static int verify_digest_response(struct auth_request *req, auth_session *sess, const char *value) { char *hdr, *pnt, *key, *val; auth_qop qop = auth_qop_none; char *nextnonce, *rspauth, *cnonce, *nc, *qop_value; unsigned int nonce_count; int ret = NE_OK; nextnonce = rspauth = cnonce = nc = qop_value = NULL; pnt = hdr = ne_strdup(value); NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Got Auth-Info header: %s\n", value); while (tokenize(&pnt, &key, &val, NULL, 0) == 0) { val = ne_shave(val, "\""); if (ne_strcasecmp(key, "qop") == 0) { qop_value = val; if (ne_strcasecmp(val, "auth") == 0) { qop = auth_qop_auth; } else { qop = auth_qop_none; } } else if (ne_strcasecmp(key, "nextnonce") == 0) { nextnonce = val; } else if (ne_strcasecmp(key, "rspauth") == 0) { rspauth = val; } else if (ne_strcasecmp(key, "cnonce") == 0) { cnonce = val; } else if (ne_strcasecmp(key, "nc") == 0) { nc = val; } } if (qop == auth_qop_none) { /* The 2069-style A-I header only has the entity and nextnonce * parameters. */ NE_DEBUG(NE_DBG_HTTPAUTH, "auth: 2069-style A-I header.\n"); } else if (!rspauth || !cnonce || !nc) { ret = NE_ERROR; ne_set_error(sess->sess, _("Digest mutual authentication failure: " "missing parameters")); } else if (strcmp(cnonce, sess->cnonce) != 0) { ret = NE_ERROR; ne_set_error(sess->sess, _("Digest mutual authentication failure: " "client nonce mismatch")); } else if (nc) { char *ptr; errno = 0; nonce_count = strtoul(nc, &ptr, 16); if (*ptr != '\0' || errno) { ret = NE_ERROR; ne_set_error(sess->sess, _("Digest mutual authentication failure: " "could not parse nonce count")); } else if (nonce_count != sess->nonce_count) { ret = NE_ERROR; ne_set_error(sess->sess, _("Digest mutual authentication failure: " "nonce count mismatch (%u not %u)"), nonce_count, sess->nonce_count); } } /* Finally, for qop=auth cases, if everything else is OK, verify * the response-digest field. */ if (qop == auth_qop_auth && ret == NE_OK) { struct ne_md5_ctx *a2; char a2_md5_ascii[33], rdig_md5_ascii[33]; /* Modified H(A2): */ a2 = ne_md5_create_ctx(); ne_md5_process_bytes(":", 1, a2); ne_md5_process_bytes(req->uri, strlen(req->uri), a2); ne_md5_finish_ascii(a2, a2_md5_ascii); ne_md5_destroy_ctx(a2); /* sess->stored_rdig contains digest-so-far of: * H(A1) ":" unq(nonce-value) */ /* Add in qop-value */ ne_md5_process_bytes(qop_value, strlen(qop_value), sess->stored_rdig); ne_md5_process_bytes(":", 1, sess->stored_rdig); /* Digest ":" H(A2) */ ne_md5_process_bytes(a2_md5_ascii, 32, sess->stored_rdig); /* All done */ ne_md5_finish_ascii(sess->stored_rdig, rdig_md5_ascii); ne_md5_destroy_ctx(sess->stored_rdig); sess->stored_rdig = NULL; /* And... do they match? */ ret = ne_strcasecmp(rdig_md5_ascii, rspauth) == 0 ? NE_OK : NE_ERROR; NE_DEBUG(NE_DBG_HTTPAUTH, "auth: response-digest match: %s " "(expected [%s] vs actual [%s])\n", ret == NE_OK ? "yes" : "no", rdig_md5_ascii, rspauth); if (ret) { ne_set_error(sess->sess, _("Digest mutual authentication failure: " "request-digest mismatch")); } } /* Check for a nextnonce */ if (nextnonce != NULL) { NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Found nextnonce of [%s].\n", nextnonce); ne_free(sess->nonce); sess->nonce = ne_strdup(nextnonce); sess->nonce_count = 0; } ne_free(hdr); return ret; } static const struct auth_protocol protocols[] = { { NE_AUTH_BASIC, 10, "Basic", basic_challenge, request_basic, NULL, 0 }, { NE_AUTH_DIGEST, 20, "Digest", digest_challenge, request_digest, verify_digest_response, 0 }, #ifdef HAVE_GSSAPI { NE_AUTH_GSSAPI, 30, "Negotiate", negotiate_challenge, request_negotiate, verify_negotiate_response, AUTH_FLAG_OPAQUE_PARAM|AUTH_FLAG_VERIFY_NON40x|AUTH_FLAG_CONN_AUTH }, #endif #ifdef HAVE_SSPI { NE_AUTH_NTLM, 30, "NTLM", sspi_challenge, request_sspi, NULL, AUTH_FLAG_OPAQUE_PARAM|AUTH_FLAG_VERIFY_NON40x|AUTH_FLAG_CONN_AUTH }, { NE_AUTH_GSSAPI, 30, "Negotiate", sspi_challenge, request_sspi, NULL, AUTH_FLAG_OPAQUE_PARAM|AUTH_FLAG_VERIFY_NON40x|AUTH_FLAG_CONN_AUTH }, #endif #ifdef HAVE_NTLM { NE_AUTH_NTLM, 30, "NTLM", ntlm_challenge, request_ntlm, NULL, AUTH_FLAG_OPAQUE_PARAM|AUTH_FLAG_VERIFY_NON40x|AUTH_FLAG_CONN_AUTH }, #endif { 0 } }; /* Insert a new auth challenge for protocol 'proto' in list of * challenges 'list'. The challenge list is kept in sorted order of * strength, with highest strength first. */ static struct auth_challenge *insert_challenge(struct auth_challenge **list, const struct auth_protocol *proto) { struct auth_challenge *ret = ne_calloc(sizeof *ret); struct auth_challenge *chall, *prev; for (chall = *list, prev = NULL; chall != NULL; prev = chall, chall = chall->next) { if (proto->strength > chall->protocol->strength) { break; } } if (prev) { ret->next = prev->next; prev->next = ret; } else { ret->next = *list; *list = ret; } ret->protocol = proto; return ret; } static void challenge_error(ne_buffer **errbuf, const char *fmt, ...) { char err[128]; va_list ap; size_t len; va_start(ap, fmt); len = ne_vsnprintf(err, sizeof err, fmt, ap); va_end(ap); if (*errbuf == NULL) { *errbuf = ne_buffer_create(); ne_buffer_append(*errbuf, err, len); } else { ne_buffer_concat(*errbuf, ", ", err, NULL); } } /* Passed the value of a "(Proxy,WWW)-Authenticate: " header field. * Returns 0 if valid challenge was accepted; non-zero if no valid * challenge was found. */ static int auth_challenge(auth_session *sess, int attempt, const char *value) { char *pnt, *key, *val, *hdr, sep; struct auth_challenge *chall = NULL, *challenges = NULL; ne_buffer *errmsg = NULL; pnt = hdr = ne_strdup(value); /* The header value may be made up of one or more challenges. We * split it down into attribute-value pairs, then search for * schemes in the pair keys. */ while (!tokenize(&pnt, &key, &val, &sep, 1)) { if (val == NULL) { const struct auth_protocol *proto = NULL; struct auth_handler *hdl; size_t n; for (hdl = sess->handlers; hdl; hdl = hdl->next) { for (n = 0; protocols[n].id; n++) { if (protocols[n].id & hdl->protomask && ne_strcasecmp(key, protocols[n].name) == 0) { proto = &protocols[n]; break; } } if (proto) break; } if (proto == NULL) { /* Ignore this challenge. */ chall = NULL; challenge_error(&errmsg, _("ignored %s challenge"), key); continue; } NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Got '%s' challenge.\n", proto->name); chall = insert_challenge(&challenges, proto); chall->handler = hdl; if ((proto->flags & AUTH_FLAG_OPAQUE_PARAM) && sep == ' ') { /* Cope with the fact that the unquoted base64 * paramater token doesn't match the 2617 auth-param * grammar: */ chall->opaque = ne_shave(ne_token(&pnt, ','), " \t"); NE_DEBUG(NE_DBG_HTTPAUTH, "auth: %s opaque parameter '%s'\n", proto->name, chall->opaque); if (!pnt) break; /* stop parsing at end-of-string. */ } continue; } else if (chall == NULL) { /* Ignore pairs for an unknown challenge. */ NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Ignored parameter: %s = %s\n", key, val); continue; } /* Strip quotes off value. */ val = ne_shave(val, "\"'"); if (ne_strcasecmp(key, "realm") == 0) { chall->realm = val; } else if (ne_strcasecmp(key, "nonce") == 0) { chall->nonce = val; } else if (ne_strcasecmp(key, "opaque") == 0) { chall->opaque = val; } else if (ne_strcasecmp(key, "stale") == 0) { /* Truth value */ chall->stale = (ne_strcasecmp(val, "true") == 0); } else if (ne_strcasecmp(key, "algorithm") == 0) { if (ne_strcasecmp(val, "md5") == 0) { chall->alg = auth_alg_md5; } else if (ne_strcasecmp(val, "md5-sess") == 0) { chall->alg = auth_alg_md5_sess; } else { chall->alg = auth_alg_unknown; } } else if (ne_strcasecmp(key, "qop") == 0) { /* iterate over each token in the value */ do { const char *tok = ne_shave(ne_token(&val, ','), " \t"); if (ne_strcasecmp(tok, "auth") == 0) { chall->qop_auth = 1; } } while (val); chall->got_qop = chall->qop_auth; } else if (ne_strcasecmp(key, "domain") == 0) { chall->domain = val; } } sess->protocol = NULL; /* Iterate through the challenge list (which is sorted from * strongest to weakest) attempting to accept each one. */ for (chall = challenges; chall != NULL; chall = chall->next) { NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Trying %s challenge...\n", chall->protocol->name); if (chall->protocol->challenge(sess, attempt, chall, &errmsg) == 0) { NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Accepted %s challenge.\n", chall->protocol->name); sess->protocol = chall->protocol; break; } } if (!sess->protocol) { NE_DEBUG(NE_DBG_HTTPAUTH, "auth: No challenges accepted.\n"); ne_set_error(sess->sess, _(sess->spec->error_noauth), errmsg ? errmsg->data : _("could not parse challenge")); } while (challenges != NULL) { chall = challenges->next; ne_free(challenges); challenges = chall; } ne_free(hdr); if (errmsg) ne_buffer_destroy(errmsg); return !(sess->protocol != NULL); } static void ah_create(ne_request *req, void *session, const char *method, const char *uri) { auth_session *sess = session; int is_connect = strcmp(method, "CONNECT") == 0; if (sess->context == AUTH_ANY || (is_connect && sess->context == AUTH_CONNECT) || (!is_connect && sess->context == AUTH_NOTCONNECT)) { struct auth_request *areq = ne_calloc(sizeof *areq); struct auth_handler *hdl; NE_DEBUG(NE_DBG_HTTPAUTH, "ah_create, for %s\n", sess->spec->resp_hdr); areq->method = method; areq->uri = uri; areq->request = req; ne_set_request_private(req, sess->spec->id, areq); /* For each new request, reset the attempt counter in every * registered handler. */ for (hdl = sess->handlers; hdl; hdl = hdl->next) { hdl->attempt = 0; } } } static void ah_pre_send(ne_request *r, void *cookie, ne_buffer *request) { auth_session *sess = cookie; struct auth_request *req = ne_get_request_private(r, sess->spec->id); if (sess->protocol && req) { char *value; NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Sending '%s' response.\n", sess->protocol->name); value = sess->protocol->response(sess, req); if (value != NULL) { ne_buffer_concat(request, sess->spec->req_hdr, ": ", value, NULL); ne_free(value); } } } static int ah_post_send(ne_request *req, void *cookie, const ne_status *status) { auth_session *sess = cookie; struct auth_request *areq = ne_get_request_private(req, sess->spec->id); const char *auth_hdr, *auth_info_hdr; int ret = NE_OK; if (!areq) return NE_OK; auth_hdr = ne_get_response_header(req, sess->spec->resp_hdr); auth_info_hdr = ne_get_response_header(req, sess->spec->resp_info_hdr); if (sess->context == AUTH_CONNECT && status->code == 401 && !auth_hdr) { /* Some broken proxies issue a 401 as a proxy auth challenge * to a CONNECT request; handle this here. */ auth_hdr = ne_get_response_header(req, "WWW-Authenticate"); auth_info_hdr = NULL; } #ifdef HAVE_GSSAPI /* whatever happens: forget the GSSAPI token cached thus far */ if (sess->gssapi_token) { ne_free(sess->gssapi_token); sess->gssapi_token = NULL; } #endif NE_DEBUG(NE_DBG_HTTPAUTH, "ah_post_send (#%d), code is %d (want %d), %s is %s\n", areq->attempt, status->code, sess->spec->status_code, sess->spec->resp_hdr, auth_hdr ? auth_hdr : "(none)"); if (auth_info_hdr && sess->protocol && sess->protocol->verify && (sess->protocol->flags & AUTH_FLAG_VERIFY_NON40x) == 0) { ret = sess->protocol->verify(areq, sess, auth_info_hdr); } else if (sess->protocol && sess->protocol->verify && (sess->protocol->flags & AUTH_FLAG_VERIFY_NON40x) && (status->klass == 2 || status->klass == 3) && auth_hdr) { ret = sess->protocol->verify(areq, sess, auth_hdr); } else if ((status->code == sess->spec->status_code || (status->code == 401 && sess->context == AUTH_CONNECT)) && auth_hdr) { /* note above: allow a 401 in response to a CONNECT request * from a proxy since some buggy proxies send that. */ NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Got challenge (code %d).\n", status->code); if (!auth_challenge(sess, areq->attempt++, auth_hdr)) { ret = NE_RETRY; } else { clean_session(sess); ret = sess->spec->fail_code; } /* Set or clear the conn-auth flag according to whether this * was an accepted challenge for a borked protocol. */ ne_set_session_flag(sess->sess, NE_SESSFLAG_CONNAUTH, sess->protocol && (sess->protocol->flags & AUTH_FLAG_CONN_AUTH)); } #ifdef HAVE_SSPI else if (sess->sspi_context) { ne_sspi_clear_context(sess->sspi_context); } #endif return ret; } static void ah_destroy(ne_request *req, void *session) { auth_session *sess = session; struct auth_request *areq = ne_get_request_private(req, sess->spec->id); if (areq) { ne_free(areq); } } static void free_auth(void *cookie) { auth_session *sess = cookie; struct auth_handler *hdl, *next; #ifdef HAVE_GSSAPI if (sess->gssname != GSS_C_NO_NAME) { unsigned int major; gss_release_name(&major, &sess->gssname); } #endif for (hdl = sess->handlers; hdl; hdl = next) { next = hdl->next; ne_free(hdl); } clean_session(sess); ne_free(sess); } static void auth_register(ne_session *sess, int isproxy, unsigned protomask, const struct auth_class *ahc, const char *id, ne_auth_creds creds, void *userdata) { auth_session *ahs; struct auth_handler **hdl; /* Handle the _ALL and _DEFAULT protocol masks: */ if (protomask == NE_AUTH_ALL) { protomask |= NE_AUTH_BASIC | NE_AUTH_DIGEST | NE_AUTH_NEGOTIATE; } else if (protomask == NE_AUTH_DEFAULT) { protomask |= NE_AUTH_BASIC | NE_AUTH_DIGEST; if (strcmp(ne_get_scheme(sess), "https") == 0 || isproxy) { protomask |= NE_AUTH_NEGOTIATE; } } if ((protomask & NE_AUTH_NEGOTIATE) == NE_AUTH_NEGOTIATE) { /* Map NEGOTIATE to NTLM | GSSAPI. */ protomask |= NE_AUTH_GSSAPI | NE_AUTH_NTLM; } ahs = ne_get_session_private(sess, id); if (ahs == NULL) { ahs = ne_calloc(sizeof *ahs); ahs->sess = sess; ahs->spec = ahc; if (strcmp(ne_get_scheme(sess), "https") == 0) { ahs->context = isproxy ? AUTH_CONNECT : AUTH_NOTCONNECT; } else { ahs->context = AUTH_ANY; } /* Register hooks */ ne_hook_create_request(sess, ah_create, ahs); ne_hook_pre_send(sess, ah_pre_send, ahs); ne_hook_post_send(sess, ah_post_send, ahs); ne_hook_destroy_request(sess, ah_destroy, ahs); ne_hook_destroy_session(sess, free_auth, ahs); ne_set_session_private(sess, id, ahs); } #ifdef HAVE_GSSAPI if ((protomask & NE_AUTH_GSSAPI) && ahs->gssname == GSS_C_NO_NAME) { ne_uri uri = {0}; if (isproxy) ne_fill_proxy_uri(sess, &uri); else ne_fill_server_uri(sess, &uri); get_gss_name(&ahs->gssname, uri.host); ne_uri_free(&uri); } #endif /* Find the end of the handler list, and add a new one. */ hdl = &ahs->handlers; while (*hdl) hdl = &(*hdl)->next; *hdl = ne_malloc(sizeof **hdl); (*hdl)->protomask = protomask; (*hdl)->creds = creds; (*hdl)->userdata = userdata; (*hdl)->next = NULL; (*hdl)->attempt = 0; } void ne_set_server_auth(ne_session *sess, ne_auth_creds creds, void *userdata) { auth_register(sess, 0, NE_AUTH_DEFAULT, &ah_server_class, HOOK_SERVER_ID, creds, userdata); } void ne_set_proxy_auth(ne_session *sess, ne_auth_creds creds, void *userdata) { auth_register(sess, 1, NE_AUTH_DEFAULT, &ah_proxy_class, HOOK_PROXY_ID, creds, userdata); } void ne_add_server_auth(ne_session *sess, unsigned protocol, ne_auth_creds creds, void *userdata) { auth_register(sess, 0, protocol, &ah_server_class, HOOK_SERVER_ID, creds, userdata); } void ne_add_proxy_auth(ne_session *sess, unsigned protocol, ne_auth_creds creds, void *userdata) { auth_register(sess, 1, protocol, &ah_proxy_class, HOOK_PROXY_ID, creds, userdata); } void ne_forget_auth(ne_session *sess) { auth_session *as; if ((as = ne_get_session_private(sess, HOOK_SERVER_ID)) != NULL) clean_session(as); if ((as = ne_get_session_private(sess, HOOK_PROXY_ID)) != NULL) clean_session(as); } cadaver-0.23.3/lib/neon/ne_locks.h0000664000076400007640000001426510356210727016314 0ustar jortonjorton/* WebDAV Class 2 locking operations Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_LOCKS_H #define NE_LOCKS_H #include "ne_request.h" /* for ne_session + ne_request */ #include "ne_uri.h" /* for ne_uri */ NE_BEGIN_DECLS /* The scope of a lock */ enum ne_lock_scope { ne_lockscope_exclusive, ne_lockscope_shared }; /* Lock type. Only write locks are defined in RFC2518. */ enum ne_lock_type { ne_locktype_write }; /* A lock object. */ struct ne_lock { ne_uri uri; int depth; /* the depth of the lock (NE_DEPTH_*). */ enum ne_lock_type type; enum ne_lock_scope scope; char *token; /* the lock token: uniquely identifies this lock. */ char *owner; /* string describing the owner of the lock. */ long timeout; /* timeout in seconds. (or NE_TIMEOUT_*) */ }; /* NB: struct ne_lock Would be typedef'ed to ne_lock except lock is * a verb and a noun, so we already have ne_lock the function. Damn * the English language. */ #define NE_TIMEOUT_INFINITE -1 #define NE_TIMEOUT_INVALID -2 /* Create a depth zero, exclusive write lock, with default timeout * (allowing a server to pick a default). token, owner and uri are * unset. */ struct ne_lock *ne_lock_create(void); /* HINT: to initialize uri host/port/scheme for the lock's URI, use * ne_fill_server_uri from ne_session.h. */ /* Deep-copy a lock structure: strdup's any of path, token, owner, * hostport which are set. */ struct ne_lock *ne_lock_copy(const struct ne_lock *lock); /* Free a lock structure; free's any of any of the URI, token and * owner which are set, but not the lock object itself. */ void ne_lock_free(struct ne_lock *lock); /* Like ne_lock_free; but free's the lock object itself too. */ void ne_lock_destroy(struct ne_lock *lock); /* ne_lock_store: an opaque type which is used to store a set of lock * objects. */ typedef struct ne_lock_store_s ne_lock_store; /* Create a lock store. */ ne_lock_store *ne_lockstore_create(void); /* Register the lock store 'store' with the HTTP session 'sess': any * operations made using 'sess' which operate on a locked resource, * can use the locks from 'store' if needed. */ void ne_lockstore_register(ne_lock_store *store, ne_session *sess); /* Destroy a lock store, free'ing any locks remaining inside. */ void ne_lockstore_destroy(ne_lock_store *store); /* Add a lock to the store: the store then "owns" the lock object, and * you must not free it. The lock MUST have all of: * - a completed URI structure: scheme, host, port, and path all set * - a valid lock token * - a valid depth */ void ne_lockstore_add(ne_lock_store *store, struct ne_lock *lock); /* Remove given lock object from store: 'lock' MUST point to a lock * object which is known to be in the store. */ void ne_lockstore_remove(ne_lock_store *store, struct ne_lock *lock); /* Returns the first lock in the lock store, or NULL if the store is * empty. */ struct ne_lock *ne_lockstore_first(ne_lock_store *store); /* After ne_lockstore_first has been called; returns the next lock in * the lock store, or NULL if there are no more locks stored. * Behaviour is undefined if ne_lockstore_first has not been called on * 'store' since the store was created, or the last time this function * returned NULL for the store.. */ struct ne_lock *ne_lockstore_next(ne_lock_store *store); /* Find a lock in the store for the given server, and with the given * path. */ struct ne_lock *ne_lockstore_findbyuri(ne_lock_store *store, const ne_uri *uri); /* Issue a LOCK request for the given lock. Requires that the uri, * depth, type, scope, and timeout members of 'lock' are filled in. * owner and token must be malloc-allocated if not NULL; and may be * free()d by this function. On successful return, lock->token will * contain the lock token. */ int ne_lock(ne_session *sess, struct ne_lock *lock); /* Issue an UNLOCK request for the given lock */ int ne_unlock(ne_session *sess, const struct ne_lock *lock); /* Refresh a lock. Updates lock->timeout appropriately. */ int ne_lock_refresh(ne_session *sess, struct ne_lock *lock); /* Callback for lock discovery. If 'lock' is NULL, something went * wrong performing lockdiscovery for the resource, look at 'status' * for the details. * * If lock is non-NULL, at least lock->uri and lock->token will be * filled in; and status will be NULL. */ typedef void (*ne_lock_result)(void *userdata, const struct ne_lock *lock, const ne_uri *uri, const ne_status *status); /* Perform lock discovery on the given path. 'result' is called with * the results (possibly >1 times). */ int ne_lock_discover(ne_session *sess, const char *path, ne_lock_result result, void *userdata); /* The ne_lock_using_* functions should be used before dispatching a * request which modify resources. If a lock store has been * registered with the session associated with the request, and locks * are present in the lock store which cover the resources which are * being modified by the request, then the appropriate lock tokens are * submitted in the request headers. */ /* Indicate that request 'req' will modify the resource at 'path', and * is an operation of given 'depth'. */ void ne_lock_using_resource(ne_request *req, const char *path, int depth); /* Indicate that request 'req' will modify the parent collection of * the resource found at 'path' (for instance when removing the * resource from the collection). */ void ne_lock_using_parent(ne_request *req, const char *path); NE_END_DECLS #endif /* NE_LOCKS_H */ cadaver-0.23.3/lib/neon/ne_i18n.h0000664000076400007640000000373010357474464015766 0ustar jortonjorton/* Internationalization of neon Copyright (C) 2005-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_I18N_H #define NE_I18N_H #include "ne_defs.h" NE_BEGIN_DECLS /* Initialize translated error messages within neon. If 'encoding' is * non-NULL, it specifies the character encoding for the generated * translated strings. If it is NULL, the appropriate character * encoding for the locale will be used. * * This call is only strictly necessary if either: * * a) neon has been installed into a different prefix than the * gettext() implementation on which it depends for i18n purposes, or * * b) the caller requires that translated messages are in a particular * character encoding. * * If ne_i18n_init() is never called, the message catalogs will not be * found if case (a) applies (and so English error messages will be * used), and will use the default character encoding specified by the * process locale. The library will otherwise operate correctly. * * Note that the encoding used is a process-global setting and so * results may be unexpected if other users of neon within the process * call ne_i18n_init() with a different encoding parameter. */ void ne_i18n_init(const char *encoding); NE_END_DECLS #endif /* NE_I18N_H */ cadaver-0.23.3/lib/neon/ne_sspi.h0000664000076400007640000000270310373622172016151 0ustar jortonjorton/* Microsoft SSPI based authentication routines Copyright (C) 2004-2005, Vladimir Berezniker @ http://public.xdi.org/=vmpn This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_SSPI_H #define NE_SSPI_H /* Win32 SSPI-based authentication interfaces. PRIVATE TO NEON -- NOT * PART OF THE EXTERNAL API. */ #ifdef HAVE_SSPI #include #define SECURITY_WIN32 #include int ne_sspi_init(void); int ne_sspi_deinit(void); int ne_sspi_create_context(void **context, char * serverName, int ntlm); int ne_sspi_destroy_context(void *context); int ne_sspi_clear_context(void *context); int ne_sspi_authenticate(void *context, const char *base64Token, char **responseToken); #endif /* HAVE_SSPI */ #endif /* NE_SSPI_H */ cadaver-0.23.3/lib/neon/ne_redirect.c0000664000076400007640000000713510642222434016767 0ustar jortonjorton/* HTTP-redirect support Copyright (C) 1999-2007, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "ne_session.h" #include "ne_request.h" #include "ne_alloc.h" #include "ne_uri.h" #include "ne_redirect.h" #include "ne_internal.h" #include "ne_string.h" #define REDIRECT_ID "http://www.webdav.org/neon/hooks/http-redirect" struct redirect { char *requri; int valid; /* non-zero if .uri contains a redirect */ ne_uri uri; ne_session *sess; }; static void create(ne_request *req, void *session, const char *method, const char *uri) { struct redirect *red = session; if (red->requri) ne_free(red->requri); red->requri = ne_strdup(uri); } #define REDIR(n) ((n) == 301 || (n) == 302 || (n) == 303 || \ (n) == 307) static int post_send(ne_request *req, void *private, const ne_status *status) { struct redirect *red = private; const char *location = ne_get_response_header(req, "Location"); ne_buffer *path = NULL; int ret; /* Don't do anything for non-redirect status or no Location header. */ if (!REDIR(status->code) || location == NULL) return NE_OK; if (strstr(location, "://") == NULL && location[0] != '/') { char *pnt; path = ne_buffer_create(); ne_buffer_zappend(path, red->requri); pnt = strrchr(path->data, '/'); if (pnt && pnt[1] != '\0') { /* Chop off last path segment. */ pnt[1] = '\0'; ne_buffer_altered(path); } ne_buffer_zappend(path, location); location = path->data; } /* free last uri. */ ne_uri_free(&red->uri); /* Parse the Location header */ if (ne_uri_parse(location, &red->uri) || red->uri.path == NULL) { red->valid = 0; ne_set_error(red->sess, _("Could not parse redirect destination URL")); ret = NE_ERROR; } else { /* got a valid redirect. */ red->valid = 1; ret = NE_REDIRECT; if (!red->uri.host) { /* Not an absoluteURI: breaks 2616 but everybody does it. */ ne_fill_server_uri(red->sess, &red->uri); } } if (path) ne_buffer_destroy(path); return ret; } static void free_redirect(void *cookie) { struct redirect *red = cookie; ne_uri_free(&red->uri); if (red->requri) ne_free(red->requri); ne_free(red); } void ne_redirect_register(ne_session *sess) { struct redirect *red = ne_calloc(sizeof *red); red->sess = sess; ne_hook_create_request(sess, create, red); ne_hook_post_send(sess, post_send, red); ne_hook_destroy_session(sess, free_redirect, red); ne_set_session_private(sess, REDIRECT_ID, red); } const ne_uri *ne_redirect_location(ne_session *sess) { struct redirect *red = ne_get_session_private(sess, REDIRECT_ID); if (red && red->valid) return &red->uri; else return NULL; } cadaver-0.23.3/lib/neon/neon.vers0000664000076400007640000000053311247545311016177 0ustar jortonjorton# GNU linker version script for neon. # All symbols in <= 0.28.x use default unversioned. NEON_0_29 { ne_iaddr_raw; ne_sock_writev; ne_sock_fullwritev; ne_sock_set_error; ne_sock_proxy; ne_session_system_proxy; ne_session_socks_proxy; ne_acl3744_set; ne_buffer_qappend; ne_strnqdup; ne_iaddr_parse; }; cadaver-0.23.3/lib/neon/Makefile.in0000664000076400007640000001621611247233022016402 0ustar jortonjorton# # neon source directory Makefile # # Use the NEON_NORMAL_BUILD or NEON_LIBTOOL_BUILD autoconf # macros to set up this Makefile correctly. # SHELL = @SHELL@ # Installation paths prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ # Build paths VPATH = @srcdir@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Toolchain settings. CC = @CC@ AR = @AR@ RANLIB = @RANLIB@ LIBTOOL = @LIBTOOL@ # Flags CPPFLAGS = @DEFS@ @CPPFLAGS@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ # Note: don't substitute @LIBS@ in here; during a bundled # build of this directory, @LIBS@ may include -lneon. LIBS = @NEON_LIBS@ @NEON_LTLIBS@ COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) LT_COMPILE = $(LIBTOOL) --quiet --mode=compile $(COMPILE) LINK = $(LIBTOOL) --quiet --mode=link $(CC) -no-undefined $(LDFLAGS) NEON_BASEOBJS = ne_request.@NEON_OBJEXT@ ne_session.@NEON_OBJEXT@ \ ne_basic.@NEON_OBJEXT@ ne_string.@NEON_OBJEXT@ \ ne_uri.@NEON_OBJEXT@ ne_dates.@NEON_OBJEXT@ \ ne_alloc.@NEON_OBJEXT@ ne_md5.@NEON_OBJEXT@ \ ne_utils.@NEON_OBJEXT@ ne_socket.@NEON_OBJEXT@ \ ne_auth.@NEON_OBJEXT@ ne_redirect.@NEON_OBJEXT@ \ ne_compress.@NEON_OBJEXT@ ne_i18n.@NEON_OBJEXT@ \ ne_pkcs11.@NEON_OBJEXT@ ne_socks.@NEON_OBJEXT@ \ ne_ntlm.@NEON_OBJEXT@ NEON_DAVOBJS = $(NEON_BASEOBJS) \ ne_207.@NEON_OBJEXT@ ne_xml.@NEON_OBJEXT@ \ ne_props.@NEON_OBJEXT@ ne_locks.@NEON_OBJEXT@ \ ne_xmlreq.@NEON_OBJEXT@ OBJECTS = @NEONOBJS@ @NEON_EXTRAOBJS@ .SUFFIXES: .SUFFIXES: .c .lo .o NEON_TARGET = @NEON_TARGET@ # Thanks to gettext for this neat trick. all: all-@NEON_BUILD_BUNDLED@ all-yes: $(NEON_TARGET) all-no: @echo "Bundled neon build not being used." .c.lo: $(LT_COMPILE) -c $< -o $@ .c.o: $(COMPILE) -c $< -o $@ libneon.la: $(OBJECTS) $(LINK) -rpath $(libdir) $(NEON_LINK_FLAGS) -o $@ $(OBJECTS) $(LIBS) libneon.a: $(OBJECTS) @rm -f $@ $(AR) cru $@ $(OBJECTS) $(RANLIB) $@ clean: rm -f $(NEON_TARGET) *.o *.lo *.bbg *.bb *.gc* rm -rf .libs c++.c: find . -name ne_\*.h -print | sed 's/.*/#include "&"/;/ne_priv/d' > $@ echo "int main(void) {}" >> $@ check-c++: c++.c c++ -I. c++.c check-incl: @for f in ne_*.h; do \ echo Checking $$f...; \ echo "#include \"$$f\"" > checkincl.c; \ $(COMPILE) -c checkincl.c -o checkincl.o || exit 1; done # Update generated dependencies below; requires cc -MM as in gcc. update-deps: for f in `echo $(OBJECTS) | sed 's/\\.@NEON_OBJEXT@/.c/g;s/ne_openssl.c//;s/ne_gnutls.c//;s/ne_pkcs11.c//;s/ne_stubssl.c//'`; do \ $(CC) $(CPPFLAGS) -MM -c $$f; \ done | sed 's, \.\./, $$(top_builddir)/,g;s, /[^ ]*.h,,g;/^ .$$/d;s/\.o: /.@NEON''_OBJEXT@: /' > new-deps sed '/[-]--CUT---/q' Makefile.in > Makefile.new cat Makefile.new new-deps > Makefile.in rm new-deps Makefile.new ne_openssl.@NEON_OBJEXT@: ne_openssl.c $(top_builddir)/config.h ne_ssl.h ne_defs.h ne_string.h \ ne_alloc.h ne_session.h ne_uri.h ne_socket.h ne_internal.h ne_private.h \ ne_request.h ne_utils.h ne_pkcs11.h ne_privssl.h ne_stubssl.@NEON_OBJEXT@: ne_stubssl.c $(top_builddir)/config.h ne_ssl.h ne_defs.h ne_session.h \ ne_uri.h ne_socket.h ne_pkcs11.@NEON_OBJEXT@: ne_pkcs11.c $(top_builddir)/config.h ne_pkcs11.h ne_defs.h ne_session.h \ ne_ssl.h ne_uri.h ne_socket.h ne_internal.h ne_privssl.h \ ne_alloc.h ne_private.h ne_request.h ne_utils.h ne_string.h ne_gnutls.@NEON_OBJEXT@: ne_gnutls.c $(top_builddir)/config.h ne_ssl.h ne_defs.h \ ne_string.h ne_alloc.h ne_session.h ne_uri.h ne_socket.h ne_internal.h \ ne_private.h ne_request.h ne_utils.h ne_privssl.h #### ---CUT--- DO NOT REMOVE THIS LINE. Generated dependencies follow. #### ne_request.@NEON_OBJEXT@: ne_request.c $(top_builddir)/config.h ne_internal.h ne_defs.h ne_alloc.h \ ne_request.h ne_utils.h ne_string.h ne_session.h ne_ssl.h ne_uri.h \ ne_socket.h ne_private.h ne_session.@NEON_OBJEXT@: ne_session.c $(top_builddir)/config.h ne_session.h ne_ssl.h ne_defs.h \ ne_uri.h ne_socket.h ne_alloc.h ne_utils.h ne_internal.h ne_string.h \ ne_dates.h ne_private.h ne_request.h ne_basic.@NEON_OBJEXT@: ne_basic.c $(top_builddir)/config.h ne_request.h ne_utils.h ne_defs.h \ ne_string.h ne_alloc.h ne_session.h ne_ssl.h ne_uri.h ne_socket.h \ ne_basic.h ne_207.h ne_xml.h ne_locks.h ne_dates.h ne_internal.h ne_string.@NEON_OBJEXT@: ne_string.c $(top_builddir)/config.h ne_alloc.h ne_defs.h ne_string.h ne_uri.@NEON_OBJEXT@: ne_uri.c $(top_builddir)/config.h ne_string.h ne_defs.h ne_alloc.h ne_uri.h ne_dates.@NEON_OBJEXT@: ne_dates.c $(top_builddir)/config.h ne_alloc.h ne_defs.h ne_dates.h \ ne_string.h ne_alloc.@NEON_OBJEXT@: ne_alloc.c $(top_builddir)/config.h ne_alloc.h ne_defs.h ne_md5.@NEON_OBJEXT@: ne_md5.c $(top_builddir)/config.h ne_md5.h ne_defs.h ne_string.h ne_alloc.h ne_utils.@NEON_OBJEXT@: ne_utils.c $(top_builddir)/config.h ne_utils.h ne_defs.h ne_string.h \ ne_alloc.h ne_dates.h ne_socket.@NEON_OBJEXT@: ne_socket.c $(top_builddir)/config.h ne_privssl.h ne_ssl.h ne_defs.h \ ne_socket.h ne_internal.h ne_utils.h ne_string.h ne_alloc.h ne_sspi.h ne_auth.@NEON_OBJEXT@: ne_auth.c $(top_builddir)/config.h ne_md5.h ne_defs.h ne_dates.h \ ne_request.h ne_utils.h ne_string.h ne_alloc.h ne_session.h ne_ssl.h \ ne_uri.h ne_socket.h ne_auth.h ne_internal.h ne_redirect.@NEON_OBJEXT@: ne_redirect.c $(top_builddir)/config.h ne_session.h ne_ssl.h ne_defs.h \ ne_uri.h ne_socket.h ne_request.h ne_utils.h ne_string.h ne_alloc.h \ ne_redirect.h ne_internal.h ne_compress.@NEON_OBJEXT@: ne_compress.c $(top_builddir)/config.h ne_request.h ne_utils.h \ ne_defs.h ne_string.h ne_alloc.h ne_session.h ne_ssl.h ne_uri.h \ ne_socket.h ne_compress.h ne_internal.h ne_i18n.@NEON_OBJEXT@: ne_i18n.c $(top_builddir)/config.h ne_i18n.h ne_defs.h ne_socks.@NEON_OBJEXT@: ne_socks.c $(top_builddir)/config.h ne_internal.h ne_defs.h ne_string.h \ ne_alloc.h ne_socket.h ne_ssl.h ne_utils.h ne_207.@NEON_OBJEXT@: ne_207.c $(top_builddir)/config.h ne_alloc.h ne_defs.h ne_utils.h ne_xml.h \ ne_207.h ne_request.h ne_string.h ne_session.h ne_ssl.h ne_uri.h \ ne_socket.h ne_basic.h ne_internal.h ne_xml.@NEON_OBJEXT@: ne_xml.c $(top_builddir)/config.h ne_internal.h ne_defs.h ne_alloc.h \ ne_xml.h ne_utils.h ne_string.h ne_props.@NEON_OBJEXT@: ne_props.c $(top_builddir)/config.h ne_alloc.h ne_defs.h ne_xml.h \ ne_props.h ne_request.h ne_utils.h ne_string.h ne_session.h ne_ssl.h \ ne_uri.h ne_socket.h ne_207.h ne_basic.h ne_locks.h ne_internal.h ne_locks.@NEON_OBJEXT@: ne_locks.c $(top_builddir)/config.h ne_alloc.h ne_defs.h ne_request.h \ ne_utils.h ne_string.h ne_session.h ne_ssl.h ne_uri.h ne_socket.h \ ne_xml.h ne_locks.h ne_basic.h ne_props.h ne_207.h ne_internal.h \ ne_xmlreq.h ne_xmlreq.@NEON_OBJEXT@: ne_xmlreq.c $(top_builddir)/config.h ne_internal.h ne_defs.h ne_xmlreq.h \ ne_request.h ne_utils.h ne_string.h ne_alloc.h ne_session.h ne_ssl.h \ ne_uri.h ne_socket.h ne_xml.h ne_basic.h ne_oldacl.@NEON_OBJEXT@: ne_oldacl.c $(top_builddir)/config.h ne_request.h ne_utils.h ne_defs.h \ ne_string.h ne_alloc.h ne_session.h ne_ssl.h ne_uri.h ne_socket.h \ ne_locks.h ne_acl.h ne_xml.h ne_acl3744.@NEON_OBJEXT@: ne_acl3744.c $(top_builddir)/config.h ne_request.h ne_utils.h ne_defs.h \ ne_string.h ne_alloc.h ne_session.h ne_ssl.h ne_uri.h ne_socket.h \ ne_locks.h ne_acl.h ne_xml.h cadaver-0.23.3/lib/neon/ChangeLog0000664000076400007640000055317210127601723016121 0ustar jortonjortonSun Sep 12 19:21:30 2004 Joe Orton * ne_locks.c (ne_lock_refresh): Fix to pass correct userdata to callbacks, and do call lk_cdata. Sun Sep 12 18:53:15 2004 Joe Orton * Makefile.in (libneon.a): Remove the archive first, avoiding strange problems when build $(OBJECTS) change. Sun Sep 12 18:40:50 2004 Joe Orton * ne_utils.h: Add NE_FEATURE_SOCKS. * ne_utils.c (ne_has_support): Add NE_FEATURE_SOCKS. (version_string): Use NE_HAVE_SOCKS, add NE_HAVE_IDNA. * ne_socket.c (ne_sock_init): Use NE_HAVE_SOCKS. Sun Sep 12 17:29:54 2004 Joe Orton * ne_utils.c (version_string): Declare as array rather than pointer; include "IPv6" component as necessary Sun Sep 12 15:51:38 2004 Joe Orton * ne_socket.c (ne_iaddr_typeof): New function. Sun Sep 12 12:00:10 2004 Joe Orton * ne_defs.h (ne_attribute_malloc): New macro. * ne_alloc.h: Use it to avoid warnings with older GCCs. Wed Aug 25 21:03:40 2004 Joe Orton * ne_string.h (split_string, split_string_c, pair_string, split_string_free, pair_string_free): Remove obsolete interfaces. Wed Aug 25 21:01:03 2004 Joe Orton * ne_cookies.c, ne_cookies.h: Drop cookies support: used old spec revision and wasn't very complete anyway. Wed Aug 25 20:40:26 2004 Joe Orton * ne_socket.c: Remove ne_read, ne_write macros and just use recv and send; remove unused SOCK_ERR macro. Wed Aug 25 20:27:43 2004 Joe Orton * ne_xml.c (declare_nspaces): Drop rejection of names including a colon to prevent breaking SVN deployments. Wed Aug 25 19:45:20 2004 Joe Orton * ne_socket.c (readable_raw): Use poll where available. (ne_sock_connect): Fail if not using poll and fd returned by socket() is greater than FD_SETSIZE. Wed Aug 25 18:40:28 2004 Joe Orton * ne_xml.h (ne_xml_parse): Clarify that a len=0 call is required to signify end-of-document. Wed Aug 25 18:37:13 2004 Joe Orton * ne_request.c (resolve_first, resolve_next): New functions. (lookup_host): Use them to allow user-forced addresses. * ne_session.c (ne_set_addrlist): New function. * ne_private.h (struct ne_session_s): Add addrlist, numaddrs, curaddr fields. Wed Aug 25 18:25:31 2004 Joe Orton * ne_xml.c (struct ne_xml_parser_s): Add bom_pos field. (ne_xml_parse): Skip over the UTF-8 Byte Order Mark since the XML parsers do not support it yet. Wed Jul 7 16:07:44 2004 Joe Orton * ne_request.c (do_connect): Fix ne_conn_connected status call (Shameek Basu). Mon Jul 5 18:40:35 2004 Joe Orton * ne_basic.c (ne_content_type_handler): Use us-ascii as default charset for text/xml, as per RFC3280. Mon Jul 5 10:56:19 2004 Joe Orton * ne_compress.c (struct ne_decompress_s): Add acceptor field. (gz_acceptor): New function. (ne_decompress_reader): Fix to pass the user-supplied userdata pointer to the user-supplied acceptor callback, via gz_acceptor. Mon Jul 5 10:52:40 2004 Joe Orton * ne_compress.c (do_inflate): Don't invoke the reader callback if no bytes where produced by inflate(). (process_footer): Call the reader callback with size=0 to indicate end-of-response for a good checksum match. Sat Jul 3 14:33:56 2004 Joe Orton * ne_auth.c (auth_challenge): Fix to set got_qop in challenge correctly (Hideaki Takahashi). Mon May 17 15:03:54 2004 Joe Orton * ne_socket.h (ne_addr_resolve): Clarify that 'flags' must be passed as zero for forwards-compat. Sun May 2 21:14:14 2004 Joe Orton Fix buffer overflow in RFC1036 date parser, CVE CAN-2004-0389. * ne_dates.c (RFC1036_FORMAT): Specify maximum field with for day name. (ne_rfc1123_parse, ne_rfc1036_parse, ne_asctime_parse): Make thread-safe; remove static buffers. Sun May 2 16:59:39 2004 Joe Orton * ne_dates.c [RFC1123_TEST] (main): Remove embedded test cases. Sun May 2 13:18:29 2004 Joe Orton * Makefile.in (LINK): Add -no-undefined. Fri Apr 16 22:53:59 2004 Joe Orton * ne_xml.c (declare_nspaces, expand_qname): Don't try to include document context in error strings. Fri Apr 16 11:44:34 2004 Joe Orton * Makefile.in (LIBS): Include NEON_LTLIBS. Wed Apr 14 10:39:53 2004 Joe Orton Fix format string vulnerabilities, CVE CAN-2004-0179: * ne_207.c (ne_simple_request): Avoid format string vulnerabilities. * ne_xml.c (ne_xml_set_error): Likewise. * ne_props.c (propfind): Likewise. * ne_locks.c (ne_lock, ne_lock_refresh): Likewise. Wed Apr 14 10:33:46 2004 Joe Orton * ne_auth.c (ah_post_send): Avoid false positives from gcc -Wformat-security. Tue Apr 13 20:51:41 2004 Joe Orton * ne_auth.c: Conditionally include gssapi_generic.h. Thu Apr 8 13:40:03 2004 Joe Orton * ne_props.h: Don't use an anonymous enum for the proppatch operation type, as some C++ compilers don't like it. Wed Apr 7 13:50:10 2004 Joe Orton * ne_request.c (add_fixed_headers): Don't both sending Keep-Alive header if persistent connections are disabled. Wed Apr 7 13:47:46 2004 Joe Orton * ne_auth.c (auth_challenge): Allow Negotiate challenges from a proxy. Wed Apr 7 13:36:55 2004 Joe Orton * ne_auth.c (clean_session): Remove redundant assignment of GSS_C_NO_CONTEXT; gss_delete_sec_context already does this. Wed Apr 7 13:33:10 2004 Joe Orton * ne_auth.c (get_gss_name): Handle failure case internally. (auth_register): Updated accordingly. Wed Apr 7 13:15:57 2004 Joe Orton * ne_request.c: Use strtoq to print off_t's where necessary. Wed Apr 7 11:14:24 2004 Joe Orton * ne_auth.c (get_gss_name): Take a hostname string. (auth_register): Pass proxy or server hostname to get_gss_name as appropriate. Wed Apr 7 11:09:50 2004 Joe Orton * ne_auth.c (continue_negotiate): If given no input token, and the gssctx is not in the initial state, reset it. Mon Mar 29 17:06:49 2004 Joe Orton * ne_auth.c: Adjust to cope with GSSAPI continuation: (struct auth_session_s): Store GSSAPI context, name and mechanism. (get_gss_name): Take an ne_session. (continue_negotiate): Renamed from gssapi_challenge; take input token, handle GSS_S_CONTINUE_NEEDED return value. (verify_digest_response): Renamed from verify_response. (verify_negotiate_response): New function. (auth_challenge): Cope with Negotiate responses which gratuitously break the auth-param grammar. (ah_post_send): Handle Negotiate responses. (free_auth, clean_session): Free persisted GSSAPI objects. (auth_register): Initialize GSSAPI objects. Sun Mar 28 03:03:17 2004 Joe Orton * ne_auth.c (get_gss_name): Don't leak token.value. Sun Mar 28 02:59:58 2004 Joe Orton * ne_auth.c (get_cnonce): Only use RAND_pseudo_bytes() if the PRNG is seeded. Sun Mar 28 02:47:20 2004 Joe Orton * ne_auth.c (gssapi_challenge, get_gss_name): Simplify. Sun Mar 28 02:35:48 2004 Joe Orton * ne_auth.c (request_gssapi, get_gss_name, auth_challenge): Implement the Negotiate protocol rather than the obsoleted GSS-Negotiate. (make_gss_error): New function. (gssapi_challenge): Use it for better error handling (set session error string); fix memory leaks. Don't delegate credentials. Sat Mar 27 20:49:24 2004 Joe Orton * ne_auth.c (ah_post_send): Clear auth header collector buffers after each request. Fri Mar 26 12:16:15 2004 Joe Orton * ne_socket.c (init_ssl): Just initialize the SSL library; delay seeding PRNG until really necessary (performance fix). (seed_ssl_prng): Split from init_ssl. (ne_sock_connect_ssl): Call seed_ssl_prng(). (ne_sock_init): Adjust since init_ssl() can't fail. Fri Mar 26 12:01:38 2004 Joe Orton * ne_utils.c: Include zlib.h before ne_*.h to fix issues on platforms where zconf.h does "#define const". Thu Mar 11 23:38:01 2004 Joe Orton * ne_openssl.c (provide_client_cert): Avoid malloc(0) when server sends no CA names in CertificateRequest. (ne_ssl_cert_write): Be paranoid and clear the OpenSSL error stack on write failures. Sun Mar 7 11:17:04 2004 Joe Orton * Makefile.in (CFLAGS): Don't use NEON_CFLAGS. Mon Feb 23 23:03:08 2004 Joe Orton * ne_string.c (ne_vsnprintf, ne_snprintf): New functions. Sun Feb 22 23:34:47 2004 Joe Orton * ne_private.h (struct ne_session_s): Remove expect100_works field. * ne_request.c (ne_set_request_expect100): New function. (ne_begin_request): Remove req->use_expect100 manipulation. (send_request): Handle enabling 100continue without a request body. * ne_session.c (ne_set_expect100): Removed function. Sun Feb 22 20:17:04 2004 Joe Orton * ne_socket.c (error_ossl): Check for ERR_reason_error_string returning NULL. Sun Feb 22 17:54:43 2004 Joe Orton * ne_socket.c: Don't disable getaddrinfo support here. Sun Feb 22 17:40:07 2004 Joe Orton * ne_utils.h (min): Remove definition to... * ne_uri.c (min): ...here. Sun Feb 22 17:31:35 2004 Joe Orton * ne_props.h: Give the 'type' enum a tag name. Sun Feb 22 17:27:28 2004 Joe Orton * ne_207.c (end_element): Strip whitespace from cdata. Sun Feb 22 16:27:58 2004 Joe Orton * ne_auth.c (struct auth_request): Make auth_hdr, auth_info_hdr fields into ne_buffer *'s. (ah_collect_header): New function. (ah_create): Create ne_buffers for auth_{,info_}hdr; use ah_collect_header rather than ne_duplicate_header to fix handling of multiple auth challenge headers. (ah_post_send): Adjust for char * -> ne_buffer *. (tokenize): Recognize a challenge scheme which is terminated with a comma (i.e. with no challange parameters). (auth_challenge): Fix handling of unrecognized challenges. (ah_destroy): Destroy ne_buffers. Sun Feb 22 15:04:46 2004 Joe Orton * ne_request.c (ne_set_request_body_provider64): New function. Sun Feb 15 13:37:03 2004 Joe Orton * ne_ssl.h: Define that ne_ssl_readable_dname returns UTF-8 encoded strings. * ne_openssl.c (ne_ssl_readable_dname): Convert dname strings to UTF-8, or use "???". Sat Feb 14 21:57:25 2004 Joe Orton * ne_xml.c (invalid_ncname_ch1): New macro. (declare_nspaces): Use it, to reject some more invalid namespace prefixes; also check for a colon anywhere in the NCName. (expand_qname): Likewise for the element name. Mon Feb 9 21:38:03 2004 Joe Orton * ne_dates.c [WIN32] (GMTOFF): Use gmt_to_local_win32; (gmt_to_local_win32): New function, from Jiang Lei. Mon Jan 26 14:38:05 2004 Joe Orton * ne_socket.c (ne_sock_connect_ssl): Check that OpenSSL version matches between library at run-time and headers at compile-time. Sat Jan 24 17:49:27 2004 Joe Orton * ne_dates.c (HAVE_STRUCT_TM___TM_GMTOFF): Alternative GMTOFF() macro. Sat Jan 24 16:49:30 2004 Joe Orton * ne_auth.c (basic_challenge): Cast first parameter to ne_base64 to unsigned char * to fix warnings with some compilers. Sat Jan 3 13:17:36 2004 Joe Orton * ne_request.h (ne_set_request_body_fd64): Define conditional on NE_LFS. * ne_request.c (ne_set_request_body_fd64): Likewise. Thu Jan 1 18:01:45 2004 Joe Orton * ne_request.c: Use NE_HAVE_LFS not _LARGEFILE64_SOURCE in conditional support for off64_t. Thu Jan 1 17:38:55 2004 Joe Orton * ne_request.h [_LARGEFILE64_SOURCE] (ne_set_request_body_fd64): New function. * ne_request.c: Define ne_lseek, ne_off_t, ne_strtoff, NE_OFFT_MAX, FMT_NE_OFF_T appropriately for _LARGEFILE64_SOURCE or otherwise. (struct ne_request_s): Use ne_off_t in place of off_t throughout. (body_fd_send): Use ne_lseek; reset 'remain' after seeking. (clength_hdr_handler): Use ne_off_t, ne_strtoff and NE_OFFT_MAX. (set_body_length): Take an ne_off_t length parameter; use FMT_NE_OFF_T to print it. (ne_set_request_body_fd64): New function. * ne_utils.h (NE_FEATURE_LFS): New feature. * ne_utils.c (ne_has_support): Support NE_FEATURE_LFS. Mon Nov 24 20:13:14 2003 Joe Orton * ne_request.c (struct ne_response): Split handling for chunked vs clength-delimited responses into a union. Use off_t for storing whole-length-of-response values. (read_response_block, ne_read_response_block): Update accordingly. (ne_begin_request): Remove unnecessary variable assignments. Sun Nov 23 16:03:22 2003 Joe Orton * ne_request.h (ne_set_request_body_fd): Take offset and length arguments, return void. (ne_set_request_body_provider): Take off_t length argument. * ne_request.c (struct ne_request_s): Store current position within buffer/file used as request body source. Store request body lengths using off_t type. (body_string_send): Adjust for renamed fields. (body_fd_send): Seek to requested offset; don't read past requested body length. (set_body_length): Renamed from set_body_size. * ne_basic.c (ne_put): Determine file size here; adjust for new ne_set_request_body_fd API. Sun Nov 23 15:05:12 2003 Joe Orton * ne_basic.c, ne_basic.h: Remove two-functions-in-one, ne_put_if_unmodified. Fri Nov 14 14:05:32 2003 Joe Orton * ne_utils.c (ne_has_support): Add NE_FEATURE_IDNA. Fri Nov 14 13:11:49 2003 Joe Orton * ne_session.c (set_hostinfo): [NE_HAVE_LIBIDN]: Use string from IDNA ToAscii operation on provided hostname if successful. Fri Nov 14 11:23:16 2003 Joe Orton All files: replace use of NEON_NODAV with NE_HAVE_DAV, NEON_SSL with NE_HAVE_SSL, NEON_ZLIB with NE_HAVE_ZLIB. Use NE_HAVE_DAV not USE_DAV_LOCKS. * ne_utils.c (ne_has_support): New feature detection interface, replaces ne_supports_ssl. Thu Nov 13 20:38:28 2003 Joe Orton * ne_request.c (ne_begin_request): Presume a 205 response has no message-body too; RFC2616 compliance fix. Thu Nov 13 20:31:07 2003 Joe Orton * ne_auth.c (ah_post_send): Treat a 401 response to a CONNECT request as a valid proxy auth challenge, to work around buggy proxies. Tue Nov 11 21:13:18 2003 Joe Orton Place library-internal symbols in the "ne__" namespace. * ne_request.c (ne__pull_request_body): Renamed from ne_pull_request_body; all callers updated. * ne_session.c (ne__negotiate_ssl): Renamed from ne_negotiate_ssl; all callers updated. Tue Nov 11 21:08:54 2003 Joe Orton * ne_alloc.h: Mark all allocation functions as having 'malloc' attribute for GCC. Tue Nov 11 20:36:12 2003 Joe Orton * ne_xml.h (ne_xml_failure): Replaces ne_xml_valid, inverted and more useful return value. * ne_xml.c (struct ne_xml_parser_s): Replace 'valid' field with 'failure', with inverted logic. (start_element, end_element, char_data): Check failure flag appropriately. Set failure flag to return value of callback. Set failure flag to positive integer on a parse error. (ne_xml_create): Don't initialize failure flag. (ne_xml_parse): Check/set failure flag appropriately. (sax_error): Only set an error string (and the error flag) if failure is zero. * ne_207.c (ne_simple_request): Adjust to use ne_xml_failure. * ne_locks.c (ne_lock, ne_lock_refresh): Likewise. * ne_props.c (propfind): Likewise. Wed Oct 22 22:19:19 2003 Joe Orton * ne_request.c (read_response_block): Treat an EOF without clean SSL closure as a valid request body delimiter in any case. Wed Oct 22 21:44:48 2003 Joe Orton * ne_defs.h (ne_attribute): New macro. * ne_request.h, ne_session.h, ne_utils.h: Use ne_attribute instead of littering #ifdef __GNUC__ and __attribute__ everywhere. Tue Oct 21 20:03:47 2003 Joe Orton Fix various strict signedness bugs: * ne_auth.c (auth_session): Make nonce_count argument unsigned. (get_cnonce): Use unsigned data buffer. (get_gss_name, gssapi_challenge): Use unsigned integers for status variables. (request_digest): Print nonce count as unsigned. (verify_response): Make nonce_count unsigned. Tue Oct 7 20:52:06 2003 Joe Orton When using SSL via a proxy, don't leak server auth credentials to the proxy, and vice versa. * ne_auth.c (auth_session): Add context field. (ah_create): Ignore challenges in a bad context. (ah_pre_send, ah_destroy): Check that the request-private cookie is not NULL. (auth_register): Take an isproxy flag; set context field appropriately in session structure. (ne_set_server_auth, ne_set_proxy_auth): Adjust accordingly. Tue Oct 7 19:58:52 2003 Joe Orton * ne_openssl.c (ne_negotiate_ssl): If the returned cert chain was NULL, try and create one from the peer certificate alone (fix for use of SSLv2 connections). Mon Sep 29 21:57:40 2003 Joe Orton * ne_auth.c [WIN32]: Include windows.h to fix non-SSL build. Thu Sep 25 20:05:18 2003 Joe Orton * ne_xml.c (ne_xml_create): Specify an initial error string. Sun Sep 21 23:00:10 2003 Joe Orton * ne_cookies.c (set_cookie_hdl): Strip whitespace around cookie name and value. Sun Sep 14 10:50:01 2003 Joe Orton * ne_socket.c (ne_addr_resolve): Use result of autoconf test for working AI_ADDRCONFIG support. Sat Sep 6 12:05:00 2003 Joe Orton * ne_openssl.c (check_identity): Take an optional server address argument; check identity against IPaddress extension too if given. (check_certificate): Optionally pass server address to check_identity. (populate_cert): Adjust accordingly. Thu Sep 4 21:41:38 2003 Joe Orton * ne_socket.c (ne_sock_init): Succeed even if PRNG was not seeded. Thu Sep 4 21:33:34 2003 Joe Orton * ne_session.c (ne_set_useragent): Build and store the entire User-Agent header field in sess->user_agent. * ne_request.c (add_fixed_headers): Adjust accordingly; avoid unnecessary calls to ne_buffer_*. Thu Sep 4 21:27:34 2003 Joe Orton * ne_socket.c: Include netinet/tcp.h. (ne_sock_connect): Disable the Nagle algorithm; thanks to Jim Whitehead and Teng Xu for the analysis. Thu Sep 4 11:24:04 2003 Joe Orton * ne_defs.h: Define ssize_t here for Win32. * ne_socket.h: Don't define ssize_t here. Tue Sep 2 20:20:16 2003 Joe Orton * ne_auth.c (auth_challenge): Update to use ne_token not split_string, patch by Tom Lee . Wed Jul 30 21:54:38 2003 Joe Orton * ne_cookies.c (set_cookie_hdl): Fix NULL pointer dereference; thanks to Markus Mueller . Fri Jul 25 11:05:52 2003 Joe Orton * ne_request.c (do_connect): On failure to connect, set error string and call ne_sock_close directly rather than using aborted(); fix leak of socket structure. Wed Jul 23 23:20:42 2003 Joe Orton Fix SEGV if inflateInit2 fails with Z_MEM_ERROR etc. * ne_compress.c (set_zlib_error): New function. (do_inflate, gz_reader): Use it. Wed Jul 23 22:50:50 2003 Joe Orton Add support for GSS-Negotiate; patch from Risko Gergely and Burjan Gabor: * ne_auth.c [HAVE_GSSAPI]: Include gssapi.h. (auth_scheme): Add auth_scheme_gssapi. (auth_session): Add gssapi_token. (clean_session): Free gssapi_token. (request_gssapi, get_gss_name, gssapi_challenge): New functions. (tokenize): Handle challenge with single token. (auth_challenge): Accept and process a GSS-Negotiate challenge. (ah_pre_send): Send GSS-Negotiate handshake. Wed Jul 23 22:46:28 2003 Joe Orton * ne_207.c (ne_207_set_response_handlers, ne_207_set_propstat_handlers): Fix to match declarations (thanks to Diego Tártara). Fri Jun 27 20:30:45 2003 Joe Orton * ne_openssl.c [OPENSSL_VERSION_NUMBER < 0x0090700fL]: Fix build against OpenSSL < 0.9.7. Sun Jun 22 23:07:45 2003 Joe Orton * ne_session.c (ne_session_destroy): Replace unnecessary use of NE_FREE with ne_free. (set_hostinfo): Don't free hostport/hostinfo here. (ne_session_proxy): Free existing proxy hostname here if necessary. Sat Jun 21 12:58:25 2003 Joe Orton * ne_request.c (ne_begin_request): Set or clear is_http11 flag for each request. Wed Jun 18 20:54:44 2003 Joe Orton * ne_socket.c: Add AI_ADDRCONFIG support; [USE_CHECK_IPV6]: Define only if __linux__. (init_ipv6) [USE_CHECK_IPV6]: New conditional. (ne_addr_resolve) [USE_ADDRCONFIG]: Use AI_ADDRCONFIG. Wed Jun 18 20:03:13 2003 Joe Orton * ne_socket.c (ne_sock_create): New function (renamed from create_sock). (ne_sock_connect): Take an ne_socket *, return int. (ne_sock_accept): Likewise. (ne_sock_close): Only call ne_close if fd is non-negative. * ne_request.c (aborted): Handle NE_SOCK_* errors specially. (do_connect): Adapt for ne_sock_create/connect interface. Set sess->connected here on success. (open_connection): Don't set sess->connected here. Sun Jun 15 12:14:22 2003 Joe Orton * ne_ssl.h (ne_ssl_cert_digest): Pass digest as a pointer rather than an array. Sun Jun 15 11:00:09 2003 Joe Orton * ne_stubssl.c (ne_ssl_cert_cmp): Add stub. Wed May 28 21:37:27 2003 Joe Orton * ne_openssl.c (ne_ssl_context_create): Enable workarounds in OpenSSL for better interop with buggy SSL servers. Fri May 23 23:13:30 2003 Joe Orton * ne_stubssl.c (ne_ssl_set_clicert): Add stub. Sat May 10 17:05:26 2003 Joe Orton * ne_xml.c: Rename struct ne_xml_handler to struct handler. Thu May 8 20:55:46 2003 Joe Orton * ne_openssl.c (ne_ssl_clicert_read): Pass "b" to fopen. Tue May 6 22:08:08 2003 Joe Orton * ne_openssl.c (check_certificate): Re-order verify failure handling to allow caller to set a custom session error string. Tue May 6 20:21:27 2003 Joe Orton * ne_md5.c (md5_stream): Restore. Sat Apr 26 19:21:03 2003 Joe Orton * ne_request.c (te_hdr_handler): Treat presence of any T-E response header as implying the response is chunked, regardless of value. Sat Apr 26 18:11:24 2003 Joe Orton * ne_xml.c: Rename struct ne_xml_nspace to struct namespace. Wed Apr 23 22:19:29 2003 Joe Orton * ne_openssl.c (ne_ssl_cert_export): Don't bother checking for i2d_X509() failure; no OpenSSL code ever checks, so everyone's doomed if it really can fail. Wed Apr 23 22:01:23 2003 Joe Orton * ne_openssl.c (ne_ssl_cert_import, ne_ssl_cert_export, ne_ssl_cert_write): Clear OpenSSL error stack on errors. Wed Apr 23 18:23:53 2003 Joe Orton * ne_stubssl.c (ne_ssl_cert_write, ne_ssl_cert_import, ne_ssl_cert_export): Add stubs. Wed Apr 23 14:05:32 2003 Joe Orton * ne_openssl.c (ne_ssl_cert_write): New function. Tue Apr 22 23:21:22 2003 Joe Orton * ne_string.c (ne_unbase64): Optimise out some redundant branches. Tue Apr 22 20:24:44 2003 Joe Orton * ne_openssl.c (ne_ssl_cert_export, ne_ssl_cert_import, ne_ssl_cert_cmp): New functions. Tue Apr 22 18:31:55 2003 Joe Orton * ne_string.c (ne_unbase64): New function. Tue Apr 22 15:53:41 2003 Joe Orton * ne_string.c (ne_base64): Fix encoding binary data; take unsigned argument. Tue Apr 22 13:07:48 2003 Joe Orton * ne_stubssl.c (ne_ssl_cert_validity): Add stub. Tue Apr 22 09:22:26 2003 Joe Orton * ne_openssl.c (ne_ssl_cert_validity): New function. (asn1time_to_string): Format into a fixed-size buffer. Tue Apr 22 08:38:30 2003 Joe Orton * ne_locks.c (ne_lock_discover, ne_lock): Don't leak the cdata buffer. * ne_props.c (ne_propfind_destroy): Don't leak the value buffer. Mon Apr 21 23:52:25 2003 Joe Orton * ne_xml.c (ne_xml_destroy): Free root element. Mon Apr 21 23:46:17 2003 Joe Orton * ne_openssl.c (dup_client_cert): Set decrypted state; dup the friendly name. (ne_ssl_clicert_free): Free friendly name. Mon Apr 21 19:44:55 2003 Joe Orton * ne_md5.h (ne_md5_buffer, ne_md5_stream): Remove unused functions. Mon Apr 21 18:17:14 2003 Joe Orton * ne_locks.c, ne_207.c: s/NE_ELM_/ELM_/ since no element ids are exported. Mon Apr 21 16:38:14 2003 Joe Orton Redesign the XML interface: have startelm callback map {nspace, name} onto a state integer or decline. Remove "valid"/"invalid"; don't abort the parse if no handler accepts an element. Push cdata accumulation down into the caller; drop collect mode, stripws mode. * ne_xml.h (ne_xml_elmid, struct ne_xml_elm): Removed. (ne_xml_startelm_cb): Return a state/acceptance integer, take a state integer, nspace, name and atts. (ne_xml_endelm_cb, ne_xml_cdata_cb): Take a state integer. (ne_xml_push_mixed_handler): Removed. (ne_xml_push_handler): Removed element list argument. (struct ne_xml_idmap, ne_xml_mapid): New interface. * ne_xml.c (struct element): Replaces ne_xml_state. Add name, nspace, state fields. (friendly_name, find_handler, parse_element, ne_xml_push_mixed_handler, push_handler): Removed functions. (declare_nspaces, expand_qname): Factored out from find_handler and parse_element. (start_element): Use expand_qname, declare_nspaces. Find appropriate handler here. Guarantee not to pass a NULL atts array to the start-element callback. Drop collect mode. (end_element): Drop collect mode (ne_xml_push_handler): Fold push_handler back in. (ne_xml_mapid): New function. * ne_207.h (NE_ELM_*): Don't export element id. (NE_207_STATE_PROP, NE_207_STATE_TOP): Export state integers. * ne_207.c (struct ne_207_parser_s): Add cdata field. (map207): Replace element list with idmap array. (can_handle): New function, replacing check_context logic. (start_element): Determine new state integer; only accept the element in valid states. Clear cdata. (end_element): Use state rather than element id. Do nothing for end of 'response' element if element is incomplete. (ne_207_create): Create cdata buffer. (ne_207_destroy): Destroy cdata buffer. (ne_207_ignore_unknown): Removed function. (ne_simple_request): Don't call ne_207_ignore_unknown. * ne_props.h (NE_PROPS_STATE_TOP): Define state. * ne_props.c (struct ne_propfind_handler_s): Add value and depth fields. (ELM_flatprop): Define state. (flat_elms): Removed array. (chardata): Append to value field when in ELM_flatprop state. (startelm): Decline everything other than elements within the 'prop' state. Collect flatprop contents. (endelm): Collect flatprop contents. * ne_locks.c (struct discover_ctx, struct lock_ctx): Store cdata. (element_map): Replace element list with idmap array. (can_accept): Replaces check_context callback. (ld_startelm, lk_cdata, ld_cdata): New functions. Mon Apr 14 00:04:20 2003 Joe Orton * ne_207.h (ne_207_start_response, ne_207_end_response, ne_207_start_propstat, ne_207_end_propstat): Use ANSI-style function pointers in typedefs. * ne_207.c (struct ne_207_parser_s): Updated accordingly. Mon Apr 14 00:02:10 2003 Joe Orton * ne_request.c (read_response_block): Better error messages for invalid chunks, don't use strncmp for a two-character comparison. Mon Apr 7 22:26:50 2003 Joe Orton * ne_stubssl.c (ne_ssl_cert_identity): New function. Mon Apr 7 22:16:16 2003 Joe Orton * ne_openssl.c (struct ne_ssl_certificate_s): Add identity field. (check_identity): Add optional identity argument. (populate_cert): Retrieve cert identity using check_identity. (check_certificate): Pass extra NULL to check_identity. (ne_ssl_cert_identity): New function. (ne_ssl_cert_free): Free the identity field. Mon Apr 7 21:29:54 2003 Joe Orton * ne_openssl.c (check_identity): Take a string hostname rather than a session object. (check_certificate): Adjust accordingly. Sun Apr 6 21:26:05 2003 Joe Orton * ne_string.h (NE_HEX2ASC): Cast result to char to avoid warnings with some compilers. Sun Apr 6 20:11:42 2003 Joe Orton * ne_openssl.c (ne_ssl_readable_dname): Include commonName or emailAddress in returned string if either is the only attribute. Sun Mar 30 10:54:20 2003 Joe Orton Split decryption of client certs into two steps * ne_openssl.c (ne_ssl_clicert_encrypted, ne_ssl_clicert_decrypt): New functions. (ne_ssl_client_cert_s): Add p12 and decrypted fields. (find_friendly_name): New function. (get_friendly_name): Removed function. (ne_ssl_clicert_read): Drop password callback; on decrypt failure, extract friendly name and set decrypted state of clicert. Sun Mar 30 10:54:01 2003 Joe Orton * ne_stubssl.c (ne_ssl_clicert_encrypted, ne_ssl_clicert_decrypt): New stubs. (ne_ssl_clicert_read): Adjusted for API change. Sat Mar 29 14:23:37 2003 Joe Orton * ne_openssl.c (ne_ssl_dname_cmp): New function. * ne_stubssl.c (ne_ssl_dname_cmp): New function. Sat Mar 29 13:52:47 2003 Joe Orton * ne_openssl.c (struct ne_ssl_client_cert_s): Add 'friendly_name' field. (get_friendly_name, ne_ssl_clicert_name): New functions. (ne_ssl_clicert_read): Store the cert's friendly name. * ne_stubssl.c (ne_ssl_clicert_name): New function. Sat Mar 29 13:16:14 2003 Joe Orton * ne_openssl.c (ne_ssl_clicert_owner): New function. Fri Mar 28 22:12:57 2003 Joe Orton * ne_stubssl.c (ne_ssl_cert_digest): New function. * ne_openssl.c (ne_ssl_cert_digest): New function. Wed Mar 26 20:41:57 2003 Joe Orton * ne_session.c (ne_ssl_trust_cert) [NEON_SSL]: Only build when SSL support is present. Wed Mar 26 20:01:00 2003 Joe Orton Begin abstraction of SSL layer to better isolate SSL-library-specific code, and to improve certificate handling interface. Drop support for PEM-encoded client certificates. * ne_session.h (ne_ssl_trust_cert): Replaces ne_ssl_load_ca, in conjunction with ne_ssl_load_cert. (ne_ssl_trust_default_ca): Replaces ne_ssl_load_default_ca. (ne_ssl_keypw_prompt): Removed function, no longer needed. (ne_ssl_set_clicert): Replaces ne_ssl_load_pkcs12, in conjunction with ne_ssl_clicert_read. (ne_ssl_provide_clicert): Replaces ne_ssl_provide_ccert, callback type changed. * ne_openssl.c: New file; much code moved from ne_session.c. * ne_privssl.h: New file, private interface between ne_socket.c and ne_openssl.c. * ne_ssl.h: New file. * ne_private.h (struct ne_session_s): Store pointers to ne_ssl_client_cert etc opaque objects, not OpenSSL structures. * ne_session.c: Most of ne_ssl_* moved to ne_openssl.c. (ne_session_create, ne_session_destroy): Use ne_ssl_cert_* etc to manage cert objects. * ne_socket.c (struct ne_socket_s): Replace SSL *, SSL_CTX * pointers with an ne_ssl_socket * pointer. (readable_ossl, error_ossl, read_ossl, write_ossl, ne_sock_close): Compensate for above change. (ne_sock_use_ssl): Removed function. (ne_sock_switch_ssl): Pass in SSL * as void for time being. (ne_sock_connect_ssl): Renamed and cleaned up version of ne_sock_use_ssl_os. (ne_sock_sslsock): New function. * Makefile.in: Add deps for ne_openssl.c. Sun Mar 23 13:02:58 2003 Joe Orton * ne_session.c (ne_set_useragent): Use ne_malloc. Sat Mar 22 21:06:45 2003 Joe Orton * ne_socket.c (raw_connect): Fill in sin6_family or sin_family since AIX 4.3 fails to do so. Wed Mar 19 20:44:11 2003 Joe Orton * ne_session.c [NEON_SSL] (free_client_cert): Build conditional on NEON_SSL. Mon Mar 17 20:33:32 2003 Joe Orton * ne_socket.c: Include netdb.h conditional on HAVE_NETDB_H. (fix build for older versions of CygWin). Sun Mar 16 23:30:20 2003 Joe Orton * ne_session.c (check_identity): Fix leak of subject alt. name structures. Sun Mar 16 19:21:22 2003 Joe Orton * ne_session.c (free_client_cert): New function. (ne_session_destroy, ne_ssl_load_pem, ne_ssl_load_pkcs12): Call it; prevent memory leak if ne_ssl_load_{pem,pkcs12} are called >1 per session. Sun Mar 16 18:00:34 2003 Joe Orton * ne_session.c (provide_client_cert): Free peer certificate after use. (ne_session_destroy): Free client cert and key if present. Sun Mar 16 14:23:05 2003 Joe Orton * ne_xml.c [HAVE_EXPAT]: Include xmlparse.h for bundled expat build. * ne_utils.c: Only include expat.h if HAVE_XMLPARSE_H is not defined. Wed Mar 12 15:04:13 2003 Joe Orton * ne_redirect.c (struct redirect): Add 'valid' field. (post_send): Set and clear 'valid' to keep track of whether stored URI is valid. (ne_redirect_location): Return NULL if stored URI is not valid. Wed Mar 12 14:52:49 2003 Joe Orton * ne_uri.c (ne_uri_free): Zero-initialize structure after free'ing. Tue Mar 11 22:01:11 2003 Joe Orton * ne_redirect.c (ne_redirect_location): Return NULL if no redirect session is registered, rather than SEGV; Ralf Mattes . Sun Mar 9 16:33:24 2003 Joe Orton Fix a memory leak if an XML parse error occurs during a PROPFIND response: * ne_props.c (ne_propfind_current_private): Return NULL if no propset is being processed. (free_propset): Free propset href here. (end_response): Don't free propset href here. Set current field of handler to NULL after free'ing propset. (ne_propfind_destroy): Free current propset if one was being processed. Sun Mar 9 11:53:58 2003 Joe Orton * ne_207.c (ne_207_destroy): Fix possible leak of reason_phrase string. Sun Mar 9 11:01:15 2003 Joe Orton * ne_utils.c (ne_parse_statusline): Use ne_strclean. * ne_session.c (ne_get_error): Use ne_strclean. Sun Mar 9 10:53:52 2003 Joe Orton * ne_xml.c: Remove broken "UTF-8 decoding" support used for libxml 1.x. Sun Mar 9 09:55:26 2003 Joe Orton * ne_xml.c: Drop support for expat < 1.95.0 and libxml 1.x. * ne_utils.c (version_string): Include expat version string. Sun Mar 9 09:54:00 2003 Joe Orton * ne_socket.c: Don't declare h_errno on Win32 either. Sun Mar 9 08:49:40 2003 Joe Orton * ne_string.c (do_concat) [HAVE_STPCPY]: Use stpcpy rather than strlen/memcpy, when available. Mon Mar 3 22:17:04 2003 Joe Orton * ne_socket.c [!USE_GETADDRINFO && !HAVE_DECL_H_ERRNO): Declare h_errno (fix build on SCO OpenServer 5.0). Sat Mar 1 21:22:19 2003 Joe Orton * ne_redirect.c (free_redirect): Fix once-per-session memory leak. Sat Mar 1 20:23:47 2003 Joe Orton Add implemention of simple memory leak tracking, for testing purposes. * ne_alloc.c [NEON_MEMLEAK] (tracking_malloc, ne_free_ml, ne_malloc_ml, ne_calloc_ml, ne_realloc_ml, ne_strdup_ml, ne_strndup_ml, ne_memleak_dump): New functions. * memleak.h: New header. Sat Mar 1 13:44:26 2003 Joe Orton First step towards automated memory leak tests. * ne_alloc.c (ne_free): New function. * All files: replace use of free() with ne_free(). Sat Mar 1 09:48:39 2003 Joe Orton * ne_uri.c (ne_path_unescape): Fix memory leak on invalid URI. Sat Mar 1 08:03:18 2003 Joe Orton * ne_string.c (ne_strclean): New function. Wed Feb 26 21:45:12 2003 Joe Orton * ne_request.c (ne_begin_request, proxy_tunnel, open_connection) [NEON_SSL] Don't build CONNECT tunnel support code if SSL is not supported. Wed Feb 26 21:44:18 2003 Joe Orton * ne_utils.c (ne_debug_init): Allow ne_debug_init(NULL, 0) to turn off debugging. Fix to produce debug output if the any of the specified "channels" are active, not all. (also fixing NE_DBG_FLUSH support). Tue Feb 25 23:12:31 2003 Joe Orton * ne_compress.c (process_footer): Mention number of extra bytes in error message for oversized footer. Sun Feb 23 21:19:20 2003 Joe Orton * ne_auth.c (verify_response): Fix to parse nonce count as hex string rather than decimal; fix verification of >9 responses. Thu Feb 13 20:35:45 2003 Joe Orton * ne_session.c (ne_set_useragent): Fix to append "neon/x.y.z" to application-supplied token rather prepend. Thu Feb 13 09:06:22 2003 Joe Orton * ne_request.c (open_connection): Fix for CONNECT tunnelling (regression since 0.23.x), thanks to Nathan Hand . Mon Feb 3 22:10:54 2003 Joe Orton Implement Daniel Stenberg's trick to avoid the slow AF_UNSPEC lookups on Linux: * ne_socket.c (init_ipv6, ipv6_disabled): New function and global. (ne_sock_init): Call init_ipv6. (ne_addr_resolve) [USE_GETADDRINFO]: Pass AF_INET in hints if ipv6_disabled is set. Mon Feb 3 20:55:47 2003 Joe Orton * ne_socket.c [__hpux && USE_GETADDRINFO]: Undefine USE_GETADDRINFO to work around broken implementation in HP-UX 11.11. Mon Jan 27 21:39:31 2003 Joe Orton * ne_socket.c (write_raw): Fix for handling EINTR during write(), from Sergey N Ushakov. Thu Jan 16 21:59:03 2003 Joe Orton Allow _init after _finish to succeed: Sergey N Ushakov. * ne_socket.c (init_result): New global variable. (ne_sock_init): Use init_result global rather than result. (ne_sock_finish): Clear init_result. Fri Dec 27 17:03:17 2002 Joe Orton * ne_request.c (build_request): Remove redundant call to ne_buffer_clear. Fri Dec 27 14:38:08 2002 Joe Orton * ne_request.c (ne_request_create): strdup the method string. (ne_request_destroy): free the method. Mon Dec 23 17:04:32 2002 Joe Orton * ne_socket.c (ne_write, ne_read, ne_close, ne_errno): Renamed macros from NEON_WRITE, NEON_READ, NEON_CLOSE, NEON_ERRNO. All callers changed. Mon Dec 23 16:58:43 2002 Joe Orton Add proper Win32 socket error handling, merged efforts of Johan Lindh and Sergey N Ushakov : * ne_socket.c (ne_errno, NE_ISINTR, NE_ISRESET, NE_ISCLOSED): New macros. [WIN32] (print_error): New function. (set_strerror) [WIN32]: Use print_error. (readable_raw, read_raw, write_raw): Use new error handling macros. (ne_addr_resolve) [WIN32]: Use WSAGetLastError() rather than h_errno. (ne_addr_error) [WIN32]: Use print_error. Tue Dec 10 21:41:26 2002 Joe Orton * ne_socket.c (ne_iaddr_print): Renamed from ne_addr_print for consistency with other ne_iaddr_ functions. Sun Dec 8 20:08:31 2002 Joe Orton * ne_auth.c (get_cnonce): Use GetCurrentThreadId() on Win32. Sun Nov 24 18:45:32 2002 Joe Orton * ne_auth.c: Remove qop_values and algorithm_names arrays. (request_digest): Inlined qop, algorithm name lookups accordingly. Sun Nov 24 16:45:39 2002 Joe Orton * ne_auth.h: Renamed ne_request_auth typedef to ne_auth_creds. * ne_auth.c (auth_session): Renamed reqcreds, recreds_ud fields to creds, userdata. (auth_register, ne_set_proxy_auth, ne_set_server_auth): Update for ne_request_auth rename. Fri Nov 22 17:39:35 2002 Joe Orton * ne_auth.c (auth_challenge): Fix support for RFC2617-style digest auth; notice the qop= parameter in challenge. Fix leak of parsed qop array. Fri Nov 22 17:08:01 2002 Joe Orton * ne_auth.c (get_cnonce): Rewrite to use either pseudo-random data from the SSL library (if available), or really-not-random data from gettimeofday/getpid otherwise. Sun Nov 17 22:13:49 2002 Joe Orton * ne_socket.c (ne_addr_print) [USE_GETADDRINFO]: Use the SACAST() macro. Sun Nov 17 19:29:23 2002 Joe Orton * ne_socket.c (ne_sock_connect): Make address argument const. (raw_connect): Make address argument const; adjust to use a copy of the sockaddr structure, which is correct anyway. (ne_addr_first, ne_addr_next): Make return pointer const. * ne_private.h (struct host_info): Store current address as const. Sun Nov 17 19:03:01 2002 Joe Orton * ne_socket.c (ne_register_progress): Removed function. * ne_socket.h (ne_block_reader, ne_progress, ne_register_progress): Removed. * ne_request.c (do_connect): Don't call ne_register_progress. * ne_request.h: Add ne_block_reader typedef. * ne_session.h: Include sys/types.h; add ne_progress typedef. Sun Nov 17 18:59:29 2002 Joe Orton * ne_socket.c (ne_iaddr_make, ne_iaddr_cmp, ne_iaddr_free): New functions. Mon Nov 11 19:51:24 2002 Joe Orton Allow discovery of document encoding. * ne_xml.c [HAVE_EXPAT]: (struct ne_xml_parser_s): Add encoding field. (decl_handler): New function. (ne_xml_doc_encoding): New function. Mon Nov 11 19:48:43 2002 Joe Orton * ne_xml.c (sax_handler): Use sax_error for fatal error callback. Fri Oct 11 23:50:01 2002 Joe Orton * ne_private.h (struct ne_session_s): Change 'connected' to be a simple boolean flag. * ne_session.c (ne_close_connection): Treat 'connected' as a boolean. * ne_request.c (open_connection): Greatly simplified. Fri Oct 11 00:46:52 2002 Joe Orton * ne_props.c (end_propstat): Fix NULL pointer dereference if no status object is given. Tue Oct 8 20:10:24 2002 Joe Orton * ne_xml.c (ne_xml_create) [!HAVE_EXPAT]: Set 'replaceEntities' flag in created parser so that entities are dereferenced in attribute values. Mon Oct 7 22:08:46 2002 Joe Orton * ne_socket.c (init_ssl): Attempt to seed PRNG using EGD socket at path EGD_PATH or a set of predetermined locations if EGD_PATH is not defined. No longer try $EGDSOCKET or $HOME/.entropy. Mon Oct 7 21:32:33 2002 Joe Orton * ne_auth.c (register_hooks): Removed function. (auth_register): Fold in register_hooks. Tue Sep 24 21:24:44 2002 Joe Orton * ne_request.c (ne_request_create): Pass Request-URI to create_request hooks. Tue Sep 24 20:42:45 2002 Joe Orton * ne_socket.c [__hpux]: Define _XOPEN_SOURCE_EXTENDED to 1, to pick up h_errno definition on HP-UX 10.20. Wed Sep 18 21:46:28 2002 Joe Orton * ne_compress.c (struct ne_decompress_s): Add zstrinit field. (gz_reader): Set zstrinit after inflateInit2 succeeds. (ne_decompress_destroy): Only call inflateEnd if zstrinit is set. Wed Sep 18 19:56:00 2002 Joe Orton * ne_auth.c: Remove incomplete domain support. Tue Sep 17 21:05:11 2002 Joe Orton Fix rejection of server certificates which have commonName as the least specific attribute. * ne_session.c (check_identity): Don't ignore commonName if it is the least specific attribute. Tue Sep 10 21:08:18 2002 Joe Orton * ne_request.c (lookup_host): Destroy cached address if resolve fails; fix segfault if a second request in the session is dispatched after the DNS lookup fails on the first. Mon Sep 9 22:26:03 2002 Joe Orton * ne_request.c (RETRY_RET): Treat SSL truncation as a legitimate persistent connection timeout. Fri Aug 30 21:58:45 2002 Joe Orton * ne_request.c (read_response_block): Clear can_persist flag if an EOF was read (fix for read-till-EOF response terminated by an unclean SSL shutdown). Mon Aug 26 18:05:00 2002 Joe Orton * ne_socket.c: Fix HAVE_LIMITS check (Blair Zajac). Sun Aug 25 23:29:06 2002 Joe Orton * ne_request.c (do_connect): Add debug message for connection attempt. Sun Aug 25 22:54:04 2002 Joe Orton * ne_socket.h (ne_addr_print): Make address argument const. Sun Aug 25 11:52:32 2002 Joe Orton * ne_socket.c (ne_addr_print): New function. Sun Aug 25 10:09:10 2002 Joe Orton Fix interop with Tomcat/3.2 SSL server, which performs an unclean shutdown on an HTTP/1.0 response without a C-L header. * ne_request.c (read_response_block): Ignore SSL connection truncation for a read-till-EOF response, where no reseponse content has been read yet. (ne_read_response_block): Always increase 'total' counter. Sun Aug 25 08:47:41 2002 Joe Orton * ne_request.c (aborted): Handle code=0 case specifically, and NE_SOCK_* as default. Sun Aug 25 08:24:48 2002 Joe Orton * ne_socket.h: Add `NE_SOCK_TRUNC' return value. * ne_socket.c (error_ossl): Return NE_SOCK_TRUNC when an EOF is received without a close_notify. Sat Aug 24 17:37:14 2002 Joe Orton * ne_socket.h (ne_inet_addr): New type. (ne_addr_first, ne_addr_next): New public interface. (ne_sock_connect): Change first parameter to ne_inet_addr. * ne_socket.c: Predefine ne_inet_addr for ne_socket.h, replacing ne_raw_addr. (ne_addr_first, ne_addr_first): Renamed from addr_first, addr_next; return type now ne_inet_addr; made public. (ne_sock_connect): Fold in make_socket() macro; just connect to single IP address passed in. * ne_private.h (struct host_info): Renamed 'addr' to 'address', dded 'current' field, removed 'resolved' field. * ne_request.c (lookup_host): Adjust for addr->address rename. (ne_begin_request): Call lookup_host if 'address' is NULL in host_info structure, don't use 'resolved' flag. (do_connect): Replaces init_socket; factor more code out from open_connection. Loop over available addresses until an ne_sock_connect call succeeds. (open_connection): Moved code into do_connect. * ne_session.c (ne_session_destroy): Adjust for addr->address rename. Sat Aug 24 13:45:26 2002 Joe Orton * ne_string.c (count_concat, do_concat): Compact into while() loops. Sat Aug 24 13:36:04 2002 Joe Orton * ne_private.h (VERSION_PRE11): Removed macro. (struct ne_session_s): Add is_http11 field; removed version_major, version_minor fields. * ne_request.c (add_fixed_headers): Use is_http11 flag rather than VERSION_PRE11 macro. (ne_begin_request): Set and use is_http11 flag. * ne_session.c (ne_version_pre_http11): Use is_http11 flag. (ne_session_create): Don't set version_major, version_minor fields. Sat Aug 24 09:00:13 2002 Joe Orton * ne_request.c (struct ne_request_s): Removed abs_path field. (ne_set_request_uri): Removed function. (ne_request_create): Set req->uri to be the actual Request-URI. Don't use an absoluteURI in Request-URI if using SSL via a proxy tunnel, or if passed-in path does not begin with a '/'. (build_request): Use pre-determined Request-URI. (proxy_tunnel): Pass true Request-URI to ne_request_create. (ne_request_destroy): Don't free abs_path. Sat Aug 24 00:37:25 2002 Joe Orton * ne_request.c (aborted): Fix handling of _CLOSED and _TIMEOUT socket errors, and of non-socket errors. Presume ne_sock_error cannot return NULL. Sat Aug 24 00:07:33 2002 Joe Orton * ne_cookies.c (set_cookie_hdl): Ensure that each cookie field is safe to free(). Fri Aug 23 23:46:58 2002 Joe Orton * ne_request.c (aborted): Close the connection after setting the session error, otherwise the socket error is lost. Fri Aug 23 22:50:30 2002 Joe Orton * ne_socket.c (ne_sock_init): Set SIGPIPE disposition before SSL library initalization, so it happens even if SSL library initialization fails. Fri Aug 23 22:03:26 2002 Joe Orton * ne_socket.c [USE_GETADDRINFO] (make_socket): Pass SOCK_STREAM to socket() rather than ai_socktype: on RHL6.2, ai_socktype is returned as zero. Wed Aug 21 18:06:36 2002 Joe Orton * ne_socket.c: Reinstate stdlib.h include. * ne_socket.h: Reinstate sys/socket.h include. Wed Aug 21 12:58:47 2002 Joe Orton * ne_socket.c (ne_addr_resolve): Accept IPv6 addresses enclosed in square brackets. Wed Aug 21 09:37:24 2002 Joe Orton * ne_uri.c (ne_uri_parse): Parse literal IPv6 address using the RFC2732 `[address]' syntax. Mon Aug 19 17:18:45 2002 Joe Orton * ne_socket.c (ne_addr_error): Override a horribly generic error message from gai_strerror(). Mon Aug 19 16:24:37 2002 Joe Orton * ne_socket.h: Remove netinet/in.h etc includes. (ne_sock_addr): Add new opaque type. (ne_addr_resolve, ne_addr_result, ne_addr_error, ne_addr_destroy): New functions. (ne_sock_connect): Changes address argument to `ne_sock_addr *'. (ne_name_lookup): Removed function. * ne_socket.c: Added netinet/in.h etc includes. (ne_sock_addr, ne_raw_addr): Define types. (make_socket): New macro. (ne_addr_resolve): Replace ne_name_lookup; store results (multiple addresses if returned) in returned ne_sock_addr object. Use getaddrinfo() if available. (raw_connect, addr_first, addr_next, ne_addr_result, ne_addr_error, ne_addr_destroy): New functions. (ne_sock_connect): Re-implement to loop through available addresses until a connect() succeeds; use make_socket, raw_connect auxiliaries. * ne_private.h (struct host_info): Store an ne_sock_addr pointer. * ne_request.c (lookup_host): Use new ne_addr_* interface. * ne_session.c (ne_session_destroy): Destroy address objects. Mon Aug 19 00:19:49 2002 Joe Orton * ne_socket.c: Move prng_seeded inside ifdef NEON_SSL region to prevent unused variable warning for non-SSL build. Sun Aug 18 23:21:21 2002 Joe Orton * ne_string.h (ne_strerror): Return buffer. Sun Aug 18 23:17:56 2002 Joe Orton * ne_socket.c (set_error): Use ne_strnzcpy. Sun Aug 18 23:14:07 2002 Joe Orton * ne_string.c (ne_strerror): Use ne_strnzcpy. Sun Aug 18 23:11:45 2002 Joe Orton * ne_string.h (ne_strnzcpy): New macro. Sun Aug 18 22:48:27 2002 Joe Orton * ne_socket.c (ne_sock_init): Check directly for SIGPIPE definition rather than HAVE_SIGPIPE. Sun Aug 18 13:49:49 2002 Joe Orton * ne_session.c (set_hostport): Use %u for printing unsigned int. Sun Aug 18 13:47:43 2002 Joe Orton * ne_utils.h (NE_DBG_SSL): New constant. * ne_session.c [NEON_SSL] (everywhere): Use NE_DBG_SSL channel for debugging messages. Sun Aug 18 08:17:19 2002 Joe Orton * ne_session.c (match_hostname): Fix to use case-insensitive string comparison. Sun Aug 18 08:10:12 2002 Joe Orton * ne_session.c (check_identity): Check the commonName if no alt. names of DNS type were found. Sun Aug 18 07:39:35 2002 Joe Orton * ne_session.c (check_identity): Use the most specific commonName attribute found, not the first. (for RFC2818 compliance) Sun Aug 18 01:54:53 2002 Joe Orton * ne_session.c (match_hostname): Invert return value. (check_identity): New function; split out commonName check from check_certificate, check subjectAltName extension instead if present. (check_certificate): Use check_identity. Sat Aug 17 19:59:21 2002 Joe Orton * ne_session.c (check_certificate): Extend debugging code to dump the whole certificate chain, but #if 0 it by default. Mon Aug 12 12:04:51 2002 Joe Orton * ne_request.c (aborted): Use NE_FMT_SSIZE_T to print ssize_t value. Mon Aug 12 11:08:35 2002 Joe Orton Support PRNG seeding via EGD to make SSL work on platforms which lack /dev/random: * ne_socket.c (init_ssl): New function. (ne_sock_init): Call init_ssl, set prng_seeded global on success. (ne_sock_use_ssl_os): Fail early if prng_seeded is not set, and RAND_status returns false. Tue Aug 6 07:18:30 2002 Joe Orton * ne_socket.c (ne_sock_use_ssl_os): Remove goto-based error handling. Don't call SSL_shutdown after SSL_connect fails. Mon Aug 5 23:18:55 2002 Joe Orton * ne_session.c (ne_ssl_keypw_prompt): Don't set SSL_CTX default password callbacks, since these are never invoked. Implement once, stub for !NEON_SSL is no longer needed. Mon Aug 5 21:01:54 2002 Joe Orton * ne_session.c (ne_ssl_load_pem): Pass private key prompt callback to PEM_read_X509, PEM_read_PrivateKey (patch by Daniel Berlin). Also handle errors properly; call ERR_get_error() to pop the errors of the error stack. Mon Aug 5 20:15:10 2002 Joe Orton * ne_session.c (provide_client_cert): Increase reference count on key and certificate, to prevent them being free'd too early. Sun Aug 4 22:35:27 2002 Joe Orton Fix `retry_after_abort' test in request.c: * ne_request.c (send_request): Don't use the 'persisted' flag until after a new connection has been opened, when it may have been reset. Sun Aug 4 17:26:37 2002 Joe Orton * ne_request.c (struct ne_request_s): Remove reqbuf field. (ne_request_create, ne_request_destroy): Don't (de)allocate reqbuf. (build_request): Allocate the returned buffer internally. (ne_begin_request): Destroy the buffer after use. Sun Aug 4 15:36:01 2002 Joe Orton * ne_session.c (ne_ssl_load_pem): Close file after use. Sun Aug 4 12:55:49 2002 Joe Orton Factor out EPIPE, ECONNRESET handling from write_raw: * ne_socket.c (MAP_ERR): New macro. (write_raw, error_ossl): Use MAP_ERR. Sun Aug 4 12:25:34 2002 Joe Orton * ne_socket.c (ne_sock_switch_ssl): New function. Sun Aug 4 12:24:23 2002 Joe Orton * ne_socket.c (ne_sock_switch_ssl): New function, really just for test suite. Sat Aug 3 22:11:33 2002 Joe Orton * ne_auth.c (ne_forget_auth): Fix segfault if either server or proxy auth is not in use. Sat Aug 3 22:06:32 2002 Joe Orton * ne_redirect.c (create, post_send, ne_redirect_register, ne_redirect_location): Updated for new hook interface. Sat Aug 3 19:02:33 2002 Joe Orton Adjustment of hook interface and use: fixing a design flaw causing a segfault in the auth hooks when two requests are used concurrently for a single session during a CONNECT tunnel. * ne_request.h, ne_session.h: (ne_get_request_private, ne_get_session_private): Replace ne_request_hook_private, ne_session_hook_private. (ne_set_session_private, ne_set_request_private): Replace ne_hook_session_accessor, ne_hook_request_accessor. * ne_request.h (ne_create_request_fn, ne_pre_send_fn, ne_post_send_fn): Add ne_request pointer as first argument. (ne_hook_destroy_request): Take ne_destroy_req_fn function. (ne_hook_destroy_session): Take ne_destroy_sess_fn function. * ne_request.c (struct ne_request_s): Renamed `accessor_hooks' field to `private'. (get_private): Renamed from call_access; don't invoke function. (ne_null_accessor): Removed function. * ne_auth.c (struct auth_class): Store hook id. (auth_session): Remove auth_request pointer. (ah_create): Store auth_request pointer as request-private data. (ah_pre_send, ah_post_send, ah_destroy): Retrieve auth_request pointer from request-private data. (register_hooks, ne_forget_auth): Use ne_{get,set}_session_private. * ne_locks.c (struct lh_req_cookie): New structure. (struct ne_lock_store_s): Remove submit_locks field. (lk_create, lk_pre_send, submit_lock, ne_lock_using_resource, ne_lock_using_parent, lk_destroy): Adjust to use lh_req_cookie pointer as request-private data. * ne_cookies.c (create, pre_send): Adjust for hook prototype changes. Wed Jul 31 23:46:17 2002 Joe Orton * ne_socket.c [NEON_SSL]: Include limits.h for INT_MAX definition. Mon Jul 29 20:55:57 2002 Joe Orton * ne_auth.c (struct auth_class): New structure; abstracts out proxy/server generic auth handling more cleanly. (ah_server_class, ah_proxy_class): Declare variables. (auth_session): Reference an auth_class structure. (auth_register): Replaces auth_create. (ne_set_server_auth, ne_set_proxy_auth): Simplify, use auth_register. (everywhere): Reference req_hdr etc via ->spec-> reference. Sun Jul 28 12:29:23 2002 Joe Orton * ne_request.c (proxy_tunnel): Reset 'persisted' flag, so that a newly tunnelled connection is not treated as persistent. Sun Jul 28 12:26:49 2002 Joe Orton * ne_string.h (CONCAT2, CONCAT3, CONCAT4): Removed macros. Thu Jul 25 23:16:00 2002 Joe Orton * ne_request.c (send_request): Don't clear retry until a status-line has been read. Thu Jul 25 00:03:17 2002 Joe Orton * ne_auth.c (basic_challenge, request_basic): Use ne_concat not the CONCAT? macros. * ne_basic.c (ne_mkcol): Use ne_concat not the CONCAT2 macro. Wed Jul 24 00:16:39 2002 Joe Orton * ne_string.c (count_concat, do_concat): Factored out from ne_buffer_concat. (ne_buffer_concat): Rewrite to use count_concat, do_concat. (ne_concat): New (resurrected) function. Thu Jul 18 21:52:12 2002 Joe Orton * ne_request.c (proxy_tunnel): Don't use server.hostport in Request-URI; always include `:port' even if default port is used; fix CONNECT through Inktomi Traffic-Server. Thu Jul 18 21:33:43 2002 Joe Orton * ne_request.c (aborted, ne_set_request_body_fd): Use ne_strerror. * ne_session.c (ne_ssl_load_pem, ne_ssl_load_pkcs12): Use ne_strerror. * ne_basic.c (get_to_fd): Use ne_strerror. Thu Jul 18 20:19:30 2002 Joe Orton * ne_string.c (ne_strerror): New function. * ne_socket.c (set_strerror): Move portability logic to ne_strerror; just use that here. Thu Jul 18 20:00:46 2002 Joe Orton * ne_socket.c (read_raw, write_raw): Don't re-evaluate 'errno', per Ulrich Drepper's advice. Wed Jul 17 23:47:01 2002 Joe Orton * ne_socket.c (struct ne_socket_s): Store buffer for error string. (set_error, set_strerror): New macros. (everywhere): Use set_error, set_strerror or ne_snprintf to set the socket error string. Wed Jul 17 23:19:18 2002 Joe Orton * ne_utils.c (ne_version_match): Fix inverted minor version test. Sun Jul 14 20:13:59 2002 Joe Orton * ne_uri.h (ne_uri): Store port as unsigned. * ne_uri.c (ne_uri_defaultport): Return unsigned int, and zero for undefined port. Sun Jul 14 20:07:35 2002 Joe Orton * ne_session.c (ne_session_proxy): Take port parameter as unsigned int, as per ne_session_create. Sun Jul 14 20:03:21 2002 Joe Orton * ne_request.c (strip_eol): Take ssize_t 'len' parameter. (read_message_header): Use ssize_t for 'n'. Sun Jul 14 12:45:40 2002 Joe Orton * ne_socket.c (ne_sock_use_ssl_os): Unconditionally enable SSL_MODE_AUTO_RETRY now OpenSSL 0.9.6 is required. Sun Jul 14 12:15:40 2002 Joe Orton * ne_xml.h (NE_XML_MEDIA_TYPE): New definition. * ne_acl.c (ne_acl_set), * ne_props.c (ne_proppatch, propfind): Use NE_XML_MEDIA_TYPE, rather than hard-coding the incorrect "text/xml" media type. Sun Jul 14 10:53:33 2002 Joe Orton * ne_utils.c (ne_version_match): Replace ne_version_minimum. Sat Jul 13 11:40:37 2002 Joe Orton * ne_session.c (ne_negotiate_ssl): Include socket error string in session error if SSL negotiation fails. Sat Jul 13 11:27:50 2002 Joe Orton * ne_socket.c (error_ossl): New function. (ERROR_SSL_STRING): Removed macro. (CAST2INT): New macro; safety harness for OpenSSL compatibility. (read_ossl, write_ossl): Use error_ossl, CAST2INT. (ne_sock_use_ssl_os): Use error_ssl. Sat Jul 13 11:16:07 2002 Joe Orton * ne_socket.c: Define ECONNRESET as WSAECONNRESET on Win32. Sat Jul 13 10:10:03 2002 Joe Orton * ne_private.h (struct ne_session_s): Replace 'reqcount' with 'persisted' flag. * ne_request.c (ne_end_request): Set 'persisted' flag if connection is left open. (send_request): Adjust to allow retry if 'persisted' flag is set. (init_socket): Clear 'persisted' flag here... (open_connection): ... rather than here. Wed Jul 10 22:51:39 2002 Joe Orton * ne_request.c (RETRY_RET): Retry on an NE_SOCK_RESET too. (send_request): Fix to only retry if not on the first request on a connection (close_not_retried test). Sun Jul 7 20:49:09 2002 Joe Orton * ne_socket.h: Add NE_SOCK_RESET return value; improve comments. * ne_socket.c (read_raw, write_raw): Return NE_SOCK_RESET if an ECONNRESET error is received when reading or writing. Sat Jul 6 13:30:15 2002 Joe Orton * ne_request.c (read_status_line, discard_headers): New functions, split out from send_request. (send_request_body): Move debugging here from send_request. (RETRY_RET): Renamed from CAN_RETRY. (send_request): Simplify: remove complex 100-continue graceful failure logic; use read_status_line, discard_headers, RETRY_RET. Fix to only send request body once (expect_100_once test case). Fix to not return NE_RETRY if reading status-line other than the first fails (fail_eof_continued test case). Fri Jul 5 21:47:49 2002 Joe Orton * ne_request.c (build_request): Fix from previous commit: clear the buffer before building the request. Fri Jul 5 21:00:20 2002 Joe Orton * ne_request.c (build_request): Fold Host header and Request-Line into single ne_buffer_concat call. Don't set req->use_expect100 here. Fold an if/else into an ?:. Optimise to use ne_buffer_append to add 100-continue, user-supplied headers, and trailing EOL, since they all have known lengths. (send_request): Take request data as argument. (ne_begin_request): Call build_request here; pass to send_request. Move Expect100 logic here. Fri Jul 5 17:12:56 2002 Joe Orton * ne_basic.c (ne_read_file): Removed function. Fri Jul 5 17:10:11 2002 Joe Orton * ne_compress.c (process_footer): Take unsigned char buffer. Store calculated CRC in a uLong. (do_inflate, gz_reader): Cast buffers to unsigned char for strict compatibility with zlib interface. Wed Jul 3 19:21:17 2002 Joe Orton * ne_request.c (struct ne_request_s): Use a fixed char array for respbuf field. (ne_request_create, ne_request_destroy): Don't allocate respbuf dynamically. (send_request): Move 'buffer' to appropriate scope. (ne_request_dispatch): Remove 'buffer'; read into respbuf. Tue Jul 2 08:35:05 2002 Joe Orton * ne_request.c (proxy_tunnel): Remove redundant sess->connected assignment. Sun Jun 30 21:04:50 2002 Joe Orton * ne_request.c (ne_begin_request): Only set host->resolved if lookup is successful. Sun Jun 30 18:25:51 2002 Joe Orton * ne_request.c (SOCK_ERR): New macro. (struct ne_request_s): Remove 'forced_close' field. (aborted): Renamed from set_sockerr; also closes connection and prints message in debug log. (send_request_body): Don't use set_sockerr or set forced_close. (read_response_block, read_message_header): Use SOCK_ERR; adjust to use aborted(). (ne_read_response_block, read_response_headers): Don't set forced_close. (CAN_RETRY): New macro. (send_request): Adjust to use CAN_RETRY(); use aborted() to make sure connection is closed in error cases. (ne_begin_request): Don't close connection here in error cases; don't use forced_close. (open_connection): Adjust to use aborted() not set_sockerr(). Sun Jun 30 17:26:41 2002 Joe Orton * ne_session.c (ne_close_connection): Clarify debug messages. Sun Jun 30 14:36:11 2002 Joe Orton * ne_request.c (read_response_block): Fail on chunk size lines which contain no valid chunk size digits. Sun Jun 30 12:35:35 2002 Joe Orton * ne_session.c (ne_negotiate_ssl): Use ne_get_session rather than req->session. * ne_request.c (struct header_handler, struct body_reader, struct ne_request_s): Moved from ne_private.h. Sun Jun 30 12:13:58 2002 Joe Orton Cleanup of response handling: * ne_private.h (struct ne_response): Replace 'is_chunked' field with 'mode' enum. * ne_request.c (te_hdr_handler): Set mode. (connection_hdr_handler): Reset can_persist for 'close'. (clength_hdr_handler): New function. (ne_request_create): Use clength_hdr_handler to parse Content-Length header. (read_response_block, ne_read_response_block): Adapt for 'mode' enum; simplify. (normalize_response_length): Removed function. (ne_begin_request): Fold in normalize_response_length logic. (ne_end_request): Simplify logic. Sun Jun 30 11:08:26 2002 Joe Orton * ne_session.c: Remove X509_NAME workaround in favour of a neon.mak change. Tue Jun 25 23:14:34 2002 Joe Orton * ne_session.c: Undefine X509_NAME if it is defined (by a Windows header). Tue Jun 25 22:51:15 2002 Joe Orton * ne_socket.c: Rename READ_BUFFER to RDBUFSIZ. Tue Jun 25 21:07:13 2002 Joe Orton * ne_private.h (struct host_info): Store port as unsigned int. * ne_session.c (set_hostport, set_hostinfo, ne_session_create): Take port argument as unsigned int. * ne_socket.c (ne_sock_connect): Take port argument as unsigned int. Tue Jun 25 20:59:14 2002 Joe Orton * ne_utils.h [__GNUCC__] (NE_DEBUG): Remove implementation using GNU C extensions. Sun Jun 23 22:47:52 2002 Joe Orton * ne_request.c (set_request_uri): Renamed from ne_set_request_uri; made static. (ne_request_create): Update accordingly. * ne_private.h (ne_set_request_uri): Removed prototype. Sun Jun 23 15:40:57 2002 Joe Orton * ne_request.c (send_request, ne_request_destroy): Free reason_phrase now it is malloc-allocated. Sun Jun 23 14:59:04 2002 Joe Orton Simplify given loss of const qualifier on ne_status.reason_phrase: * ne_props.c (struct propstat): Remove r_phrase field. (end_propstat, free_propset): Use status.reason_phrase not r_phrase field. Sun Jun 23 14:42:22 2002 Joe Orton * ne_207.h (ne_207_end_response, ne_207_end_propstat): Remove status_line parameter from callbacks. * ne_207.c (struct ne_207_parser_s): Remove status_line field. (end_element): Don't store status_line. (handle_error): Drop status_line argument, recreate dummy status line from status object. (end_response, end_propstat): Drop status_line arguments. * ne_props.c (end_propstat, end_response): Drop status_line arguments. Sun Jun 23 14:39:00 2002 Joe Orton * ne_utils.h (ne_status): Remove const qualifier from 'reason_phrase' field. * ne_utils.c (ne_parse_statusline): strdup the reason_phrase on successful return. Sun Jun 23 11:39:24 2002 Joe Orton * ne_compress.c (struct ne_decompress_s): Replace footer union with buffer. (BUF2UINT): New macro. (process_footer): Convert footer to integer in a portable manner, using BUF2UINT. Sun Jun 23 09:05:25 2002 Joe Orton * ne_compress.c (ne_decompress_s): Use unsigned int for 32-bit integers, not uLong (fix for 64-bit platforms). Wed Jun 19 18:46:40 2002 Joe Orton * ne_session.c (ne_session_destroy): Don't leak the proxy hostname. Sun Jun 16 14:09:31 2002 Joe Orton * ne_request.c (read_response_block): Use NE_FMT_SSIZE_T rather than %d, cast field precision argument to int. (ne_pull_request_body): Use ssize_t for store callback return value, use NE_FMT_SSIZE_T rather than %d, cast field precision argument to int. Sun Jun 16 12:15:19 2002 Joe Orton * ne_session.c (ne_negotiate_ssl): Don't leak peer certificate in error cases. Fix spelling mistake in error message. Sun Jun 16 11:23:23 2002 Joe Orton * ne_request.c (open_connection): When SSL negotation fails after doing CONNECT request, use ne_close_connection so that sess->connection is reset to 0, and ne_sock_close isn't called twice for the socket. Wed Jun 12 23:22:20 2002 Joe Orton * ne_props.c (ne_proppatch): Add missing call to ne_lock_using_resource. Mon Jun 10 20:45:27 2002 Joe Orton * ne_auth.c (verify_response): Remove redundant prototype, fix sscanf format string to use signed integer. Mon Jun 10 20:13:57 2002 Joe Orton * ne_compress.c (do_inflate): Continue calling inflate() whilst unconsumed input remains: fix from Justin Erenkrantz . Mon Jun 10 19:53:59 2002 Joe Orton * ne_socket.c (ne_sock_readline): If a complete line is found in the buffer, avoid the memmove() and simply copy the line directly out of the buffer. Sun Jun 9 11:39:20 2002 Joe Orton * ne_redirect.c (post_send): Perform simple relative URI resolution. Tue Jun 4 16:51:54 2002 Joe Orton * ne_uri.c (ne_path_parent): Simplify. Mon Jun 3 17:50:27 2002 Joe Orton * ne_cookies.c (set_cookie_hdl): Avoid free'ing cookie name/value, thanks to Dan Mullen. Mon Jun 3 17:45:33 2002 Joe Orton * ne_string.c (ne_base64): Use size_t for outlen. Mon Jun 3 17:42:34 2002 Joe Orton * ne_utils.h, ne_socket.h [WIN32]: Move ssize_t definition to ne_socket.h. Mon Jun 3 17:27:21 2002 Joe Orton * ne_request.c (read_response_block): Use correct types for passing to/from ne_sock_*. Mon Jun 3 11:32:20 2002 Joe Orton * ne_compress.c (ne_decompress_destroy): Don't fail if response reader callback is never invoked. Sun Jun 2 12:51:35 2002 Joe Orton * ne_socket.c (read_ossl, read_raw): Call readable_{ossl,raw} function here. (ne_sock_read, ne_sock_peek, ne_sock_readline): Remove explicit calls to ops->readable before ops->read. Thu May 30 22:00:07 2002 Joe Orton * ne_socket.c (ne_sock_readline): Optimise to use socket read buffer directly, and use ->read (and ->readable) functions. Tue May 28 17:00:34 2002 Joe Orton * ne_session.c (ne_session_destroy): Don't free proxy.hostport, since it's no longer set. Sun May 26 19:11:46 2002 Joe Orton * ne_xml.c: #error if no expat header is configured; flatten nested #if's, include libxml/xmlversion.h if present. Sun May 26 19:09:04 2002 Joe Orton * ne_utils.c: Include libxml/xmlversion.h if present. Sun May 26 11:55:30 2002 Joe Orton * ne_session.c (set_hostport): Renamed from get_hostport: set host_info field directly; take defaultport argument. (set_hostinfo): Don't use get_hostport. (ne_session_create): Use set_hostinfo and set_hostport; pass in default port correctly for http:/https:. Thu May 23 19:44:44 2002 Joe Orton * ne_xml.c (resolve_nspace): Split out from parse_element. (ne_xml_get_attr): Take parser object, and optional namespace; resolve the namespace if necessary. (parse_element): Use resolve_nspace. * ne_props.c (startelm): Use new ne_xml_get_attr interface. Wed May 22 22:29:05 2002 Joe Orton * ne_dates.c: Renamed HAVE_TM_GMTOFF to HAVE_STRUCT_TM_TM_GMTOFF from use of AC_CHECK_MEMBERS. Tue May 21 21:21:31 2002 Joe Orton * ne_redirect.c (ne_redirect_register): Drop confirm, notify, userdata arguments. (struct redirect): Drop most fields; add a uri structure. (auto_redirect): Removed function. (post_send): Remove functionality which retries a request with a different URI to automatically follow redirects. Qualify the URI if non-absolute. (create): Remove now redundant code. (ne_redirect_location): Return an ne_uri object. Sun May 19 18:53:22 2002 Joe Orton * ne_session.c (ne_set_useragent): Use strcat/malloc/strcpy directly, rather than CONCAT2; allow compiler optimisations. (AGENT): Renamed from NEON_USERAGENT, append space. Sun May 19 17:31:43 2002 Joe Orton Move everything exported by ne_socket.h into ne_*/NE_* namespace; purge inappropriate and unused interfaces. Renaming done by Olof Oberg. * ne_socket.h: (SOCK_FULL): Removed constant. (sock_call_progress, sock_transfer, sock_sendline, sock_send_string, sock_readfile_blocked): Removed functions. (NE_SOCK_ERROR, NE_SOCK_TIMEOUT, NE_SOCK_CLOSED): Renamed constants. (ne_progress, ne_block_reader): Renamed types. (ne_register_progress, ne_sock_init, ne_sock_exit, ne_sock_read, ne_sock_peek, ne_sock_block, ne_sock_fullwrite, ne_sock_readline, ne_sock_connect, ne_sock_accept, ne_sock_fd, ne_sock_error, ne_sock_read_timeout, ne_name_lookup, ne_service_lookup, ne_sock_use_ssl, ne_sock_use_ssl_os): Renamed functions. * ne_private.h, ne_request.c, ne_session.c: Update accordingly. * ne_request.c (build_request): Return the ne_buffer pointer. (send_request): Remove redundant strlen(), use known buffer length. * ne_request.h: Drop ne_block_reader definition. Sun May 19 13:32:12 2002 Joe Orton * ne_request.c (ne_get_session, ne_get_request): Take const request pointer. Sun May 19 13:21:17 2002 Joe Orton * ne_string.c (ne_buffer_ncreate): Renamed from ne_buffer_create_sized. * ne_session.c (check_certificate, provide_client_cert): Update accordingly. * ne_request.c (ne_request_create): Update accordingly. Sun May 19 13:12:14 2002 Joe Orton * ne_string.c (ne_token): Drop quotes parameter. (ne_qtoken): Split out from ne_token. * ne_basic.c (dav_hdr_handler, ne_content_type_handler): Use ne_qtoken. * ne_compress.c (find_token): Removed function. (gz_reader): Compare header value directly against "gzip", remove a stale comment. Sun May 19 09:45:28 2002 Joe Orton * ne_socket.h (sock_fullread): Return ssize_t; takes buflen as size_t. (sock_read, sock_peek): Fix prototypes to match actual definition. * ne_socket.c (write_raw): Return ssize_t. Sat May 18 14:53:45 2002 Joe Orton * ne_string.h (ne_buffer): Remove separate struct ne_buffer_s definition. * ne_string.c (ne_buffer_create_sized): Don't use struct ne_buffer_s. Sun May 12 11:33:02 2002 Joe Orton * ne_string.c (ne_base64): Moved from base64.c. * base64.c, base64.h: Removed files. * Makefile.in: Updated accordingly. * ne_auth.c: Don't include base64.h. Sun May 12 11:26:05 2002 Joe Orton * ne_string.h (ne_utf8_decode, ne_utf8_encode): Removed functions. Sat May 11 15:42:24 2002 Joe Orton As part of patch from Olof Oberg : * ne_request.h (ne_destroy_fn): Renamed from typo'ed ne_destory_fn. * ne_request.c (ne_request_destroy, ne_hook_destroy_request, ne_hook_destroy_session): Update accordingly. * ne_session.c (ne_session_destroy): Update accordingly. Thu May 9 21:44:15 2002 Joe Orton Major improvements to socket layer to incorporate socket read buffering and rewrite sock_readline, and add an abstraction layer to simplify SSL support. Grunt work by Jeff Johnson * ne_socket.c (struct iofns): New type. (struct nsocket_s): Store 'ops' pointer to I/O functions in use for the socket. Add buffer, bufpos, bufavail fields for read buffering. (sock_block, sock_read, sock_peek): Reimplement to add read buffer, simplify to use I/O functions abstraction. (readable_raw, read_raw, write_raw, readable_ossl, read_ossl, write_ossl): Factored out from sock_read/fullwrite, avoiding in-lined ifdefs. (sock_fullwrite): Just use ops->write. (sock_readline): Simplify greatly to exploit read-buffering, return ssize_t. (sock_fullread): Simplify, removing unnecessary local variables, return ssize_t. (create_sock, sock_enable_ssl_os): Set ops pointer. Wed May 8 11:54:48 2002 Joe Orton * ne_socket.c (sock_name_lookup): Avoid casts; use INADDR_NONE. [!INADDR_NONE]: Define to (unsigned long) -1. Wed May 1 22:19:18 2002 Joe Orton * ne_locks.h (ne_lock): Document that ->token and ->owner fields must be malloc-allocated if non-NULL. Wed May 1 22:15:41 2002 Joe Orton * ne_locks.c (get_ltoken_hdr): New function. (ne_lock): Correctly parse Coded-URL from Lock-Token response header. Wed May 1 22:03:08 2002 Joe Orton * ne_redirect.c (post_send): Adjust for ne_uri_parse handling of unspecified port. Wed May 1 22:00:50 2002 Joe Orton * ne_session.c (provide_client_cert): Fail if peer certificate not known when client cert requested. Wed May 1 21:58:35 2002 Joe Orton * ne_session.h (ne_ssl_provide_fn): Adjust callback typedef to return void. Wed May 1 21:52:40 2002 Joe Orton * ne_request.h: Remove NE_SERVERAUTH and NE_AUTHPROXY; fix NE_PROXYAUTH description. Wed May 1 21:32:54 2002 Joe Orton * ne_uri.c (ne_uri_parse): For consistency, port field is 0 if unspecified. Tue Apr 30 10:05:48 2002 Joe Orton * ne_string.c (shave_string): Removed function. Tue Apr 23 21:19:53 2002 Joe Orton * ne_props.c (start_propstat, startelm): Use ne_realloc not realloc (thanks to Jeff Johnson). Tue Apr 23 20:55:56 2002 Joe Orton * ne_xml.c: Include parser.h or libxml/parser.h, depending on which is found. Mon Apr 15 00:37:43 2002 Joe Orton * ne_request.c (build_request, send_request): Simplify logic. Sun Apr 14 16:59:50 2002 Joe Orton * ne_props.c: Remove unused accidental 'propstat' global. (struct propstat): Add r_phrase field. (end_propstat): Dup the reason_phrase string. (free_propset): Free the reason_phrase. Avoid another possible free(NULL) call. Sun Apr 14 12:00:54 2002 Joe Orton * ne_basic.c (ne_content_type_handler): For text/* media types, use default charset of ISO-8859-1. Sat Apr 13 23:11:07 2002 Joe Orton * ne_utils.h: Include trio.h if NEON_TRIO is defined. Sun Apr 7 17:38:14 2002 Joe Orton * ne_request.c (read_response_headers): Don't zero-initialize hdr. Sun Apr 7 17:15:23 2002 Joe Orton * ne_request.c (read_response_headers): Ignore whitespace between header name and colon, simplify logic a little. Sun Apr 7 14:09:07 2002 Joe Orton * ne_session.c (ne_ssl_readable_dname): New function. Sun Apr 7 12:32:25 2002 Joe Orton * ne_string.c (ne_buffer_destroy): Remove redundant check for data pointer being NULL. Wed Apr 3 19:44:59 2002 Joe Orton Optimisation/simplification of header name hashing. * ne_request.c (hash_and_lower): Renamed from hdr_hash; convert string to lower-case in-place too. (lower_string): Removed function. (ne_add_response_header_handler): Use hash_and_lower rather than lower_string. (HH_ITERATE): Change parameter name to 'ch'. Fri Mar 29 23:00:57 2002 Joe Orton * ne_uri.c (ne_uri_parse): Minor optimisation. Mon Mar 25 21:45:36 2002 Joe Orton Pass a lock context around during LOCK processing; search for the correct element in the response body. * ne_locks.c (ne_lock_create): Don't take a path argument. (ne_unlock): Constify lock parameter. (discover_results): Don't parse out href here... (ld_create): do it here instead; renamed from create_private. (lk_startelm): New function. (lk_endelm): Renamed from end_element_lock. (ne_lock): Require a Lock-Token response header; pass lock context to callbacks. Copy lock back out. Mon Mar 25 21:35:42 2002 Joe Orton * ne_session.h (NE_SSL_FAILMASK): New constant. (NE_SSL_*): Shift right one bit. Mon Mar 25 21:21:18 2002 Joe Orton * ne_session.c (ne_close_connection): Return void. Mon Mar 25 20:09:33 2002 Joe Orton * ne_props.c (free_propset): Avoid free(NULL). Mon Mar 11 19:59:04 2002 Joe Orton * ne_locks.c (ne_lock_using_parent): Iterate over the lock list by hand: check for infinite depth locks with cover the parent too (fixing if_covered_child test). Mon Mar 11 19:25:44 2002 Joe Orton * ne_request.c (ne_request_dispatch): Move variable to scope in which is is used. Sun Mar 10 22:04:58 2002 Joe Orton * Makefile.in (NEON_BASEOBJS): Always build ne_compress.o. Sun Mar 10 22:01:54 2002 Joe Orton * ne_compress.c [!NEON_ZLIB] (ne_decompress_reader, ne_decompress_destroy): Add stubs. Sun Mar 10 21:42:11 2002 Joe Orton * ne_locks.c (struct discover_ctx): Store an ne_session pointer. (discover_results): If lock URI is not an absoluteURI, qualify it using the server host/port/scheme from the session. Don't leak the lock object. (create_private): Simplify, use ne_lock_create. Thu Mar 7 20:08:07 2002 Joe Orton * ne_uri.c (ne_uri_defaultport): Fix default port number for https scheme. Wed Mar 6 21:22:23 2002 Joe Orton * ne_locks.c (lk_pre_send): Use an absoluteURI in the If: header. Wed Mar 6 21:15:00 2002 Joe Orton * ne_uri.c (ne_uri_unparse): New function. Tue Mar 5 22:57:00 2002 Joe Orton * ne_uri.c (ne_uri_cmp): Compare hostnames and schemes case-insensitively, and compare empty abspath and "/" as equivalent, as per RFC 2616. Tue Mar 5 20:53:54 2002 Joe Orton * ne_uri.c (ne_uri_defaultport): New function. Mon Mar 4 21:10:29 2002 Joe Orton * ne_uri.h (ne_uri): Renamed from struct uri. * ne_uri.c (ne_path_parent): Renamed from uri_parent. (ne_path_has_trailing_slash): Renamed from uri_has_trailing_slash. (uri_abspath, uri_absolute): Removed. (ne_uri_parse): Renamed from uri_parse, don't take a 'defaults' parameter. (ne_uri_free): Renamed from uri_free. (ne_path_unescape): Renamed from uri_unescape. (ne_path_escape): Renamed from uri_abspath_escape. (ne_uri_cmp): Renamed from uri_cmp. (ne_path_compare): Renamed from uri_compare. (ne_path_childof): Renamed from uri_childof. * ne_basic.c, ne_locks.c, ne_uri.c, ne_redirect.c, ne_session.c, ne_session.h: all callers changed. Mon Mar 4 01:03:23 2002 Joe Orton * ne_request.c (strip_eol): Fix potential segfault. Mon Mar 4 00:38:10 2002 Joe Orton * ne_locks.c (insert_lock): New function. (ne_lockstore_add, submit_lock): use insert_lock. Mon Mar 4 00:33:39 2002 Joe Orton * ne_locks.c (ne_lockstore_remove): Free list item. Mon Mar 4 00:31:08 2002 Joe Orton * ne_locks.c (free_list): Really destroy the lock. (ne_lock_free): Don't free the lock object itself. Mon Mar 4 00:17:18 2002 Joe Orton * ne_request.c (ne_request_destroy): Free accessor hook list. Sun Mar 3 20:35:09 2002 Joe Orton Changes to lock interface; replacing "lock session" with a lock store, which can be registered with an ne_session. Lock objects now store URI as complete URI structure. * ne_locks.h (struct ne_lock): Store URI as complete URI structure. Remove next/prev fields. (ne_lock_store): New type. * ne_locks.c (struct lock_list): New type. (struct ne_lock_store_s): Replaces ne_lock_session_s; store lock_list pointers for stored locks, cursor, and locks to submit. (ne_lock_create): New function. (lk_create): Renamed from create. (lk_pre_send): Renamed from pre_send; adjust for lock list type and to use URI path. (free_list): New function; split out from old 'destroy'. (lk_destroy): Renamed from destroy; use free_list. (ne_lockstore_create, ne_lockstore_destroy, ne_lockstore_first, ne_lockstore_next): New functions. (ne_lockstore_register): Most of old ne_lock_register. (submit_lock): Adjusted for lock_list type. (ne_lockstore_findbyuri): Renamed from ne_lock_find; use full URI structure. (ne_lock_using_resource, ne_lock_using_parent): Adjusted for lock_list/full URI changes. (ne_lock_iterate): Removed function. (ne_lockstore_add, ne_lockstore_remove): Renamed from ne_lock_add, ne_lock_copy; adjusted for lock_list/full URI. (ne_lock_copy): Adjusted for full URI. (ne_lock_create, ne_lock_destroy): New function. (ne_lock, ne_lock_refresh, ne_unlock): Adjusted for full URI. Sun Mar 3 15:23:40 2002 Joe Orton * ne_uri.c (uri_cmp): New function. Sun Mar 3 11:01:30 2002 Joe Orton * ne_session.c (ne_fill_server_uri): New function. Mon Feb 25 21:25:27 2002 Joe Orton * ne_utils.c (version_string): Add zlib version. Mon Feb 25 20:49:07 2002 Joe Orton * (everywhere): Replace use of snprintf, vsnprintf with ne_snprintf, ne_vsnprintf so that trio replacements are used when appropriate. * ne_dates.h: Pick up ne_utils.h for ne_{v,}snprintf defines. Sun Feb 24 11:23:05 2002 Joe Orton * ne_utils.h: Define ne_snprintf, ne_vsnprintf for trio or non-trio builds. Sun Feb 24 11:20:42 2002 Joe Orton * Makefile.in (check-incl): Add target to check that each header file can be included standalone. Sun Feb 24 11:17:54 2002 Joe Orton * ne_xml.h: Add missing sys/types.h include. Sun Feb 24 11:12:22 2002 Joe Orton * ne_utils.h: Remove HTTP_QUOTES, HTTP_WHITESPACE globals. * ne_cookies.c (set_cookie_hdl): Don't use HTTP_QUOTES, HTTP_WHITESPACE globals. Wed Feb 20 19:32:48 2002 Joe Orton * ne_request.c (set_sockerr, ne_set_request_body_fd, send_request): Use ne_set_error rather than accessing session error directly. Tue Feb 19 21:34:59 2002 Joe Orton * ne_utils.c (version_string) [NEON_SOCKS]: Mention SOCKSv5 support. * ne_socket.c (sock_init) [NEON_SOCKS]: Call SOCKSinit. Tue Feb 19 19:21:07 2002 Joe Orton * ne_request.c (open_connection): Remove notify_status call duplicated with ne_negotiate_ssl. Tue Feb 19 19:16:44 2002 Joe Orton * ne_socket.c (sock_get_version): Removed function. Tue Feb 19 19:12:52 2002 Joe Orton * ne_session.c (ne_ssl_provide_ccert): Moved outside ifdef NEON_SSL. [!NEON_SSL] (ne_ssl_load_pem, ne_ssl_load_pkcs12, ne_ssl_keypw_prompt): Added stubs. Sun Feb 17 21:15:34 2002 Joe Orton * ne_session.c (ne_session_create, ne_session_destroy): Only use the SSL context is SSL is being used for the session. Sun Feb 17 20:19:05 2002 Joe Orton Add back client certificate support, much improved. * ne_private.h (struct ne_session_s): Add client cert/key fields, provider, privkey password callbacks. * ne_socket.c (sock_init): Call PKCS12_PBE_add. (sock_enable_ssl_os): Add optional 'appdata' argument. (sock_enable_ssl): Adjust accordingly. * ne_session.c (provide_client_cert, privkey_prompt, ne_ssl_keypw_prompt, ne_ssl_load_pkcs12, ne_ssl_load_pem, ne_ssl_provide_ccert): New functions. (ne_negotiate_ssl): Pass session as appdata to sock_enable_ssl_os. Sun Feb 17 12:32:34 2002 Joe Orton * ne_session.c (make_dname): New function. (check_certificate): Use make_dname. Sun Feb 17 11:29:10 2002 Joe Orton * ne_basic.c (struct get_context): Remove unused 'progress' field, add 'session' field. (get_to_fd, content_range_hdr_handler, clength_hdr_handler): Set session error directly. (clength_hdr_handler): Also fix check for expected range. (everywhere): Initialize session field, don't set session error; use NE_FMT_OFF_T to print off_t's rather than casting to long int. Sat Feb 16 23:24:10 2002 Joe Orton * ne_xml.h (NE_XML_STRIPWS): New element flag. * ne_xml.c (start_element): Clear cdata buffer if not in mixed mode. (char_data): Only strip leading whitespace if NE_XML_STRIPWS is set for the element. Sat Feb 16 14:52:59 2002 Joe Orton * ne_compress.c (enum state): New state NE_Z_AFTER_DATA. (struct ne_decompress_s): Add fields for storing and parsing stream footer; add checksum field for storing current crc. (process_footer): New function. (do_inflate): Compute checksum. Switch to AFTER_DATA state and process footer after reading DEFLATE data. (gz_reader): Fail on trailing content. Handle AFTER_DATA state. (ne_decompress_destroy): Return error if final state was not PASSTHROUGH, or FINISHED. (ne_decompress_reader): Initialize crc. Sat Feb 16 14:26:54 2002 Joe Orton * ne_compress.c (ne_decompress_destroy): Fix potential segfault with use-after-free. Thu Feb 14 16:50:40 2002 Joe Orton * ne_request.c (read_response_headers): Ignore header lines without a ':', rather than failing the request. Tue Feb 12 20:17:49 2002 Joe Orton * ne_request.c (read_response_block): Read chunk size as unsigned using strtoul; check that it fits within an unsigned int (and hence, probably a size_t). Tue Feb 12 20:15:13 2002 Joe Orton * ne_string.h (STRIP_EOL): Removed macro. Mon Feb 11 22:11:03 2002 Joe Orton * ne_session.c (match_hostname): Match fully-qualified hostnames against commonName with leading "*." wildcard. Mon Feb 11 20:47:28 2002 Joe Orton * ne_session.c (match_hostname): New function. (check_certificate): Use it. Sun Feb 10 00:50:49 2002 Joe Orton * ne_request.c (lookup_host): Set error string on lookup failure. Sun Feb 10 00:34:42 2002 Joe Orton * ne_request.c (strip_eol): New function; more efficient STRIP_EOL. (send_request): Use strip_eol. (read_message_header): Use strip_eol, simplify, remove redundant variables. Sat Feb 9 21:02:31 2002 Joe Orton * ne_session.c (ne_set_error): Drop STRIP_EOL call. Sat Feb 9 21:01:01 2002 Joe Orton * ne_session.c (ne_set_error): Take printf-style format string + varargs list. Sat Feb 9 16:15:09 2002 Joe Orton * ne_socket.h (SOCKET_READ_TIMEOUT): Moved to ne_socket.c. * ne_socket.c (struct nsocket_s): Add rdtimeout field. (create_sock): Initialize rdtimeout to SOCKET_READ_TIMEOUT. (sock_read, sock_recv): Use ->rdtimeout field for read timeout. (sock_set_read_timeout): New function. * ne_private.h (struct ne_session_s): Add rdtimeout field. * ne_session.c (ne_set_read_timeout): New function. * ne_request.c (init_socket): New function. (open_connection): Use init_socket. Sat Feb 9 15:11:59 2002 Joe Orton * ne_session.c (ne_session_destroy): Don't leak the server cert. Sat Feb 9 09:59:11 2002 Joe Orton * ne_session.c (check_certificate): Only call verification callback once per certificate; watch for the server cert changing and fail if it does. Wed Feb 6 20:28:27 2002 Joe Orton * ne_session.c (check_certificate): Only call verification callback if failures is non-zero. (ne_ssl_load_ca): Renamed from ne_ssl_add_ca. (ne_ssl_load_default_ca): New function. Wed Feb 6 20:21:29 2002 Joe Orton * ne_socket.c (sock_init): Cache and return result of initialization. Wed Feb 6 01:12:20 2002 Joe Orton * ne_session.c (check_certificate): Ignore cert validity errors from OpenSSL since these are duplicated. Wed Feb 6 01:08:57 2002 Joe Orton * ne_session.c (ne_negotiate_ssl): Fix for invalidating cached SSL_SESSION. Wed Feb 6 01:03:37 2002 Joe Orton * ne_session.c [!NEON_SSL] (STUB): New function. (ne_negotiate_ssl, ne_ssl_add_ca): Implement using STUB. Tue Feb 5 19:56:43 2002 Joe Orton * ne_session.h (ne_ssl_certificate): New type. * ne_session.c (ne_session_create) [NEON_SSL]: Create the SSL_CTX structure. (ne_ssl_get_context): Return the SSL_CTX rather than setting it. (ne_session_destroy): Free the SSL_CTX. (asn1time_to_string): Function moved in from sslcerts.c. (check_certificate): Use OpenSSL's internal validity result. Pass back an ne_ssl_certificate to the verification function; including validity dates. (ne_ssl_add_ca): New function, registers CA certs. Sat Feb 2 14:05:26 2002 Joe Orton * ne_socket.c (sock_enable_ssl_os): Take an optional SSL_SESSION argument. * ne_private.h (struct ne_session_s): Add an SSL_SESSION field. * ne_session.c (ne_negotiate_ssl): Pass stored SSL session to sock_enable_ssl_os, cache session after successful negotiation. (ne_session_destroy): Free cached session. Sat Feb 2 10:45:46 2002 Joe Orton * ne_socket.c, ne_utils.c: Globally replace ENABLE_SSL cpp symbol with NEON_SSL. Sat Feb 2 09:43:27 2002 Joe Orton * ne_session.c (check_certificate): Use 1K on-stack buffer. Sat Feb 2 08:27:08 2002 Joe Orton * ne_private.h (struct host_info): Add 'resolved' flag. (struct ne_session_s): Add scheme field, rename have_proxy to use_proxy, remove proxy_decider. (struct ne_request_s): Remove use_proxy field. * ne_request.c (set_sockerr, ne_set_request_uri, build_request, open_connection): Use session->use_proxy field to determine whether proxy is used. (ne_request_create): Drop use of proxy_decider callback. (lookup_host): Moved here from ne_session.c. (ne_begin_request): Lookup server/proxy hostname if not already resolved. * ne_session.c (ne_session_create): Moved within file; takes scheme, and server hostname, port as arguments. (ne_ssl_enable, ne_session_decide_proxy, ne_session_server): Removed functions. (ne_get_scheme): Simply return scheme field. Fri Feb 1 23:12:38 2002 Joe Orton * ne_request.c (add_fixed_headers): Remove last traces of TLS upgrade support. Thu Jan 31 20:50:12 2002 Joe Orton * ne_private.h (struct ne_session_s): Rename use_secure to use_ssl; removed nssl_context, added SSL_CTX, server cert, verify callback pointers. * ne_request.c (send_request): Remove support for TLS upgrade. (open_connection): Use ne_negotiate_ssl; close socket properly if negotiation fails. * ne_session.c (ne_session_destroy): Free SSL_CTX stored in session. (ne_ssl_set_context, ne_ssl_set_verify, verify_err, getx509field, check_context, ne_negotiate_ssl, ne_ssl_server_cert): New functions. (ne_set_secure_context, ne_set_request_secure_upgrade, ne_set_accept_secure_upgrade): Removed functions. (ne_ssl_enable): Renamed from ne_set_secure. * ne_socket.c (struct nssl_context_s): Removed type. (sock_create_ssl_context, sock_destroy_ssl_context, sock_disable_*, key_prompt_cb, sock_set_key_prompt, sock_set_client_cert): Removed functions. (sock_enable_ssl_os): Renamed from sock_make_secure; take an SSL_CTX pointer, and optionally pass out the SSL structure. (sock_enable_ssl): New function. Wed Jan 30 19:47:42 2002 Joe Orton * ne_string.c (ne_buffer_concat, ne_buffer_zappend, ne_buffer_append, ne_buffer_grow): Don't return success value, presume universe ends at OOM. Sat Jan 26 10:57:42 2002 Joe Orton * ne_compress.c: Renamed enum state constants to have prefix NE_Z_, to avoid conflict with Windows headers (Branko Èibej). Mon Jan 14 20:26:31 2002 Joe Orton * ne_string.c (ne_concat): Removed function - it didn't work, and it wasn't used. Mon Jan 14 02:09:38 2002 Joe Orton * ne_basic.c (ne_content_type_handler): Parse charset parameter. Sun Jan 13 14:29:00 2002 Joe Orton * ne_basic.c (ne_content_type_handler): Remove trailing '/' from parsed type, fix search for parms separator (Greg Stein). Sun Jan 13 12:07:51 2002 Joe Orton * ne_207.c (ne_simple_request): Drop unused Content-Type handling. Thu Jan 10 00:39:17 2002 Joe Orton * ne_request.c (hdr_hash): Mark as inline. Tue Jan 8 22:03:42 2002 Joe Orton * ne_locks.c (add_timeout_header): New function. (ne_lock, ne_lock_refresh): Send a Timeout header if lock->timeout is set. Mon Jan 7 21:48:38 2002 Joe Orton * ne_locks.c (parse_timeout): Fix parsing lock timeout (Arun Garg). Mon Dec 17 22:46:36 2001 Joe Orton * ne_private.h (struct ne_session_s): Make expect100_works a plain integer (rather than a bitfield). Sun Dec 9 14:04:27 2001 Joe Orton * ne_string.c (ne_buffer_grow, ne_buffer_create_sized): Don't zero-fill new memory. (ne_buffer_concat): Zero terminate the string as _grow doesn't do it. Sun Dec 9 13:31:55 2001 Joe Orton * ne_string.c (ne_buffer_zappend): Minor optimisation; implement using ne_buffer_append. Sun Dec 9 13:18:35 2001 Joe Orton * ne_string.c (ne_buffer_concat): Optimise to use time O(n) [n == total string length). Sun Dec 9 11:57:56 2001 Joe Orton * Makefile.in (NEON_DAVOBJS): Remove ne_acl.o. Sat Dec 8 01:11:30 2001 Joe Orton * ne_request.c (ne_pull_request_body): Use NE_FMT_SIZE_T in debugging message; cast size_t to int to avoid GCC warning for field size parameter. (set_body_size): Use NE_FMT_SIZE_T. * ne_xml.c (ne_xml_parse): Similarly. Mon Dec 3 19:56:07 2001 Joe Orton * ne_session.c (ne_session_destroy): Return void. Sat Dec 1 18:37:43 2001 Joe Orton * ne_auth.c (ah_create): Reset attempt counter here... (ah_post_send): ...rather than here. Tue Nov 27 21:26:01 2001 Joe Orton * ne_request.c (send_with_progress): Actually call the callback; fix for correct sock_fullwrite return codes. Tue Nov 27 20:20:40 2001 Joe Orton * ne_private.h (VERSION_PRE11): Define macro; as ne_version_pre_http11. * ne_session.c (ne_version_pre_http11): Use VERSION_PRE11. * ne_request.c (add_fixed_headers, build_request, ne_end_request): Use VERSION_PRE11. Sun Nov 18 19:32:56 2001 Joe Orton * ne_locks.c (discover_results): Check status is 2xx before invoking callback; pass NULL lock and non-NULL status pointer in failure cases. (create_private): Initialize lock to some "value unspecified" defaults. Sun Nov 18 19:25:10 2001 Joe Orton * ne_auth.c (auth_session): Rename 'tries' field to 'attempt'. (get_credentials, ah_pre_send, ah_post_send): Increment attempt counter only when requesting credentials; reset it to zero when no auth failure is signaled. Sun Nov 18 15:49:00 2001 Joe Orton * ne_auth.h (ne_request_auth): Pass username and password as buffers of size NE_ABUFSIZ to callback. Add 'attempt' argument. * ne_auth.c (auth_session): Store username in buffer. (get_credentials, basic_challenge, digest_challenge): Updated for callback prototype changes. (ah_post_send): Request credentials, and retry authentication until callback returns non-zero. Mon Nov 12 20:57:56 2001 Joe Orton * ne_basic.c (get_to_fd): Really cope with short writes (thanks to rado ). Sun Nov 4 15:09:03 2001 Joe Orton * ne_props.h: Define NE_ELM_PROPS_UNUSED for picking element ids for use with the propfind XML parser. Sat Nov 3 19:06:04 2001 Joe Orton * ne_props.c (NSPACE): New macro. (set_body, pnamecmp, startelm, free_propset): Handle property having NULL nspace element in propfind code. Sun Oct 28 22:04:49 2001 Joe Orton * ne_xml.c (parse_element): Prevent false matches of found prefix "abcde" against stored prefix "abcdeFGH". Compare case-sensitively. Fri Oct 26 20:28:03 2001 Joe Orton * ne_request.c (send_request): Fix case where persistent connection times out, and improve error handling. Thu Oct 25 20:42:24 2001 Joe Orton * ne_props.c (ne_proppatch): Really handle properties with a NULL namespace correctly; use the "D:" prefix for elements in the "DAV:" namespace; allow properties to have no namespace. Tue Oct 16 08:54:46 2001 Joe Orton * ne_xml.c (parse_element): Fail the parse if a namespace prefix definition is given with an empty value. Tue Oct 16 08:52:40 2001 Joe Orton * ne_props.h, ne_207.h: Move ne_propname definition into ne_props.h. Tue Oct 16 08:49:42 2001 Joe Orton * ne_props.c (ne_proppatch): Handle properties with a NULL nspace field correctly. Sun Oct 7 19:31:06 2001 Joe Orton * ne_acl.c (ne_acl_set) [USE_DAV_LOCKS]: Notify use of resource to locking code. Sun Oct 7 17:45:01 2001 Joe Orton * ne_acl.c, ne_acl.h: New files, contributed by Arun Garg . * Makefile.in: Add ne_acl.* to build. Sun Oct 7 16:10:05 2001 Joe Orton * ne_private (struct ne_session_s): Add 'reqcount' field. * ne_request.c (send_request): Refactor slightly; don't loop, but return NE_RETRY when appropriate. Increment reqcount. (ne_begin_request): Loop if send_request returns NE_RETRY. (open_connection): Reset reqcount field. Tue Oct 2 21:11:39 2001 Joe Orton * ne_dates.c (GMTOFF): New macro. (ne_iso8601_parse, ne_rfc1123_parse, ne_rfc1036_parse, ne_asctime_parse): Use new macro, fix up date handling on some platforms. Sat Sep 29 14:20:47 2001 Joe Orton * ne_compress.c (gz_reader): Fix tests 4 and 7: don't try to inflate after reading header if no bytes are left in the buffer. Sat Sep 29 14:04:11 2001 Joe Orton * ne_compress.c: Fix API; return an opaque object which must be destroyed later. (ne_decompress_reader): Renamed from ne_gzip_response_body_reader. Doesn't need the session object passed in any more. (ne_decompress_destroy): Merge of co_destroy, co_post_end. Sat Sep 29 13:50:43 2001 Joe Orton * ne_request.c (ne_get_session): New function. Sat Sep 29 12:52:31 2001 Joe Orton * ne_compress.c (parse_header): Bail if flags are set to something unexpected. Sat Sep 29 11:15:30 2001 Joe Orton * ne_compress.c, ne_compress.h: New files. * Makefile.in: Add deps for ne_compress. Thu Sep 27 09:05:24 2001 Joe Orton * ne_redirect.c: Adapted for new hooks interface. * ne_cookies.c: Adapted for new hooks interface. (ne_cookie_register): New function. Thu Sep 27 09:01:03 2001 Joe Orton * ne_auth.c, ne_locks.c: Adapted for new hooks interface. Store pointer to per-request object in the per-session object. Thu Sep 27 08:48:16 2001 Joe Orton Re-write hooks interface to register callbacks individually rather than as a block. Inspired by the Apache 2.0/APR hooks interface. * ne_private.h (struct hook): Store a callback, userdata, id. (struct hook_request): Removed. (struct ne_session_s): Store hooks lists for create_req, pre_send, post_send, destroy_req, destroy_sess, accessor. (struct ne_request_s): Store accessor hooks list. * ne_request.c (ne_add_hooks): Removed. (ne_hook_create_request, ne_hook_pre_send, ne_hook_post_send, ne_hook_destroy_request, ne_hook_destroy_session, ne_hook_session_accessor, ne_hook_request_accessor, ne_null_accessor, call_access, add_hook): New functions. (ne_request_create, ne_request_destroy, build_request, ne_end_request): Adapt for new interface. * ne_session.c (destroy_hooks): New function. (ne_session_destroy): Use it to destroy hooks lists appropriately. Tue Sep 25 07:46:32 2001 Joe Orton * ne_xml.c: Only decode UTF-8 for parsers other than libxml 1.x. Tue Sep 25 07:33:09 2001 Mo DeJong * src/ne_socket.c: Include instead of . (sock_init): Only use signal() to ignore SIGPIPE if both HAVE_SIGNAL and HAVE_SIGPIPE are defined. Tue Sep 25 07:09:53 2001 Mo DeJong * ne_socket.c (sock_init): Declare local variables before invoking any instructions since that is not valid C code. Sun Sep 23 10:30:54 2001 Joe Orton * ne_auth.c (struct auth_challenge): Make members const. (clean_session): Free the realm string. (basic_challenge, digest_challenge): strdup the realm string. (request_digest): opaque is no longer stored quoted. (tokenize): New function. (verify_response, auth_challenge): Rejig to use tokenize(). Sat Sep 22 20:17:00 2001 Joe Orton * ne_string.c (ne_shave): Fix possible memory corruption when result should be the empty string. Thu Sep 20 21:27:57 2001 Joe Orton * ne_request.c (ne_pull_request_body): Add debugging dump of body blocks. Thu Sep 20 21:23:43 2001 Joe Orton * ne_private.h: Remove obsolete 'if_locks' member from struct ne_request_s. Tue Sep 18 23:35:30 2001 Joe Orton * ne_basic.c (ne_get_range): Handle write errors too. Tue Sep 18 22:14:49 2001 Joe Orton * ne_xml.h (ne_xml_validate_cb): Take userdata parameter. * ne_xml.c (find_handler): Pass validate callback the handler's userdata. * ne_207.c, ne_props.c, ne_locks.c: All users changed. Tue Sep 18 21:49:14 2001 Joe Orton * ne_locks.c (ne_lock_refresh): New function. Tue Sep 18 21:17:29 2001 Joe Orton * ne_basic.c (copy_or_move): Take a depth parameter, add depth header, for COPY requests. (ne_copy): Take depth parameter, pass through. (ne_move): Adjusted accordingly. Mon Sep 17 23:29:58 2001 Joe Orton * ne_utils.c (ne_debug_init): Set debug stream to be unbuffered if setvbuf() is available. Mon Aug 27 00:36:37 2001 Joe Orton * ne_207.c (start_element, end_element): Remember when context is valid for a , and only invoke callback then. Sun Aug 26 22:30:39 2001 Joe Orton * ne_basic.c (ne_get_range): Better error handling. Cope with Apache's 416 problem. Sun Aug 26 18:58:47 2001 Joe Orton * ne_auth.c: Store unquoted challenge parameters in session object, prevent having to unquote/free them >1 times. Sun Aug 26 18:57:51 2001 Joe Orton * ne_socket.c (sock_init): Do nothing on any calls after first. Sun Aug 26 12:45:04 2001 Joe Orton * ne_basic.c (server_hdr_handler): Remove function. (ne_options): Don't add server_hdr_handler. Tue Jul 17 11:25:06 2001 Joe Orton * ne_socket.c (sock_init): Set signal dispostion for SIGPIPE to ignore. Sat Jun 30 12:11:44 2001 Joe Orton * ne_utils.c (ne_supports_ssl): New function. Tue Jun 19 21:57:49 2001 Joe Orton * ne_dates.c (ne_iso8601_parse): Fix month off-by-one bug, use separate vars for offsets. (ne_rfc1036_parse): Fix Y2K bug, parsing problem. Tue Jun 19 21:57:42 2001 Joe Orton * ne_dates.c (ne_iso8601_parse): New function. Sun Jun 10 15:39:40 2001 Joe Orton * ne_request.c (send_with_progress): New function. (send_request_body): Use send_with_progress to trigger progress callbacks if necessary. Sat Jun 9 15:42:33 2001 Joe Orton * ne_string.h: Bring back NE_ASC2HEX/HEX2ASC. * ne_md5.c: Use them. Sat Jun 9 15:42:08 2001 Joe Orton * ne_xml.h: Include ne_defs.h. Fri Jun 8 23:02:49 2001 Joe Orton * ne_socket.h, ne_socket.c: Update for includes (Mo DeJong). Fri Jun 8 21:34:00 2001 Joe Orton * ne_basic.c (dav_hdr_handler): Use ne_token. Sat Jun 2 14:37:07 2001 Joe Orton * ne_private.h: Renamed from http_private.h. Sat Jun 2 14:35:23 2001 Joe Orton * ne_auth.c, ne_auth.h: Renamed from http_auth.c, ne_auth.h. Sat Jun 2 14:35:02 2001 Joe Orton * ne_cookies.c, ne_cookies.h: Renamed from http_cookies.c, http_cookies.h. Sat Jun 2 14:34:51 2001 Joe Orton * ne_dates.c, ne_dates.h: Renamed from dates.c, dates.h Sat Jun 2 14:22:49 2001 Joe Orton * ne_redirect.c, ne_redirect.h: Renamed from http_redirect.c, http_redirec.h. Big rename... s/http_/ne_g/ Sat Jun 2 12:54:51 2001 Joe Orton * ne_md5.c (md5_process_block): Fix for word alignment issue on Sparc from Kai Sommerfeld. Wed May 30 23:15:31 2001 Joe Orton * ne_basic.c (ne_put, ne_get, ne_put_if_unmodified, ne_get_range, ne_post): Take an integer fd rather than FILE * stream. (get_to_fd): Write to fd rather than stream. Wed May 30 23:08:55 2001 Joe Orton * ne_i18n.h, ne_i18n.c: Renamed from neon_i18n.h, neon_i18n.c. * *.c: All changed accordingly. Wed May 30 23:02:47 2001 Joe Orton * ne_defs.h: Renamed from neon_defs.h. * *.h: All changed accordingly. Wed May 30 22:58:57 2001 Joe Orton * ne_md5.c, ne_md5.h: Renamed from md5.c, neon_md5.h Wed May 30 22:55:19 2001 Joe Orton * ne_utils.h: In-line ne_debug for GCC which can cope with varargs preprocessor macros. Wed May 30 00:43:05 2001 Joe Orton * http_auth.c (ah_use_body): Removed function. (digest_body): New function. (request_digest): Use ne_pull_request_body to find the MD5 digest of the request body, when necessary. Wed May 30 00:30:52 2001 Joe Orton * http_redirect.c: Store Request-URI, session pointer, and method string in redirect object. Avoid looking inside ne_request/ne_session internals. Wed May 30 00:04:30 2001 Joe Orton * ne_request.c: Re-implement request body handling in terms of a callback which provides the request body blocks on demand. Remove 'use_body' hook, in favour of the hooks calling ne_pull_request_body when necessary. (ne_pull_request_body, body_fd_send, body_string_send): New functions. (send_request_body): Re-implemented using ne_pull_request_body. (run_set_body_hooks): Removed function. (ne_set_request_body_fd): Replacement for ne_set_request_body_stream, using a raw fd rather than a FILE *. Tue May 29 22:39:39 2001 Joe Orton * dav_basic.h, dav_basic.h: Removed. Tue May 29 22:38:54 2001 Joe Orton * ne_207.c (ne_simple_request, etc): Copied in from dav_basic.c. Tue May 29 22:12:23 2001 Joe Orton * ne_locks.c, ne_locks.h, ne_props.c, ne_props.h, ne_207.c, ne_207.h: Big rename. dav_* -> ne_*, and so on. Tue May 29 22:06:24 2001 Joe Orton * ne_basic.c (ne_add_depth_header): Moved from dav_basic.c. Tue May 29 21:55:30 2001 Joe Orton * ne_props.c, ne_props.h: Renamed from dav_props.c, dav_props.h. Tue May 29 21:43:15 2001 Joe Orton * ne_207.c, ne_207.h: Renamed from dav_207.c, dav_207.h. Tue May 29 21:22:25 2001 Joe Orton * ne_locks.c, ne_locks.h: Renamed from dav_locks.c, dav_locks.h. Tue May 29 21:21:44 2001 Joe Orton * ne_socket.c (sock_fullwrite): Cast return value of SSL_write to size_t to prevent comparison of signed with unsigned. Tue May 29 21:05:27 2001 Joe Orton * ne_basic.c [!NEON_NODAV]: Move ne_copy, ne_mkcol, ne_move, ne_delete in here. Tue May 29 20:12:50 2001 Joe Orton * ne_uri.c, ne_uri.h: Renamed from uri.c, uri.h. Tue May 29 19:17:09 2001 Joe Orton * ne_socket.c, ne_socket.h: Renamed from socket.c, nsocket.h. Tue May 29 18:58:51 2001 Joe Orton * ne_basic.c (ne_mkcol, ne_copy, ne_move, ne_delete): Renamed from dav_*. Tue May 29 17:58:09 2001 Joe Orton * ne_basic.c (copy_or_move, dav_copy, dav_move, dav_delete, dav_mkcol): Copied in from dav_basic.c. Tue May 29 17:55:33 2001 Joe Orton * ne_basic.c, ne_basic.h: Renamed from http_basic.c, http_basic.h. Tue May 29 17:47:50 2001 Joe Orton * http_auth.c (ah_create, ah_pre_send): Add the response body handler in pre_send, and only if qop=auth-int. Wed May 16 20:54:51 2001 Joe Orton * ne_request.c (ne_get_request_headers): Removed function. Sat May 12 18:48:46 2001 Joe Orton * ne_request.c (read_message_header, read_response_headers): Use a fixed-size char * buffer argument rather than an ne_buffer. Append directly to it when header-folding. Mon May 7 10:42:38 2001 Joe Orton * ne_string.c (ne_token): Use an optimized search (strchr) if quotes is NULL. Mon May 7 01:33:48 2001 Joe Orton * http_auth.c (basic_challenge, get_cnonce): Updated for ne_base64 change. Mon May 7 01:32:22 2001 Joe Orton * base64.c (ne_base64): Take length parameter. [BASE64_TEST] (main): Remove function, obsoleted by test code. Wed May 2 12:06:59 2001 Joe Orton * ne_string.c, ne_string.h (ne_token, ne_shave): New functions, destined to replace split_string, shave_string, etc. * ne_string.c [SPLIT_STRING_TEST, PAIR_STRING_TEST] (main): Remove tests, functions are obsolete. Tue May 1 22:14:14 2001 Joe Orton * dates.c (ne_httpdate_parse): Moved from ne_utils.c. Tue May 1 21:55:45 2001 Joe Orton * ne_utils.c, ne_utils.h: Renamed from http_utils.c, http_utils.h. Big rename. http_* -> ne_*. neon_* -> ne_*. DEBUG() -> NE_DEBUG(). DEBUG_* -> NE_DBG_*. Tue May 1 21:35:10 2001 Joe Orton * ne_request.c: Updated for ne_buffer changes. Tue May 1 21:28:58 2001 Joe Orton * ne_string.h (ne_buffer_size): Implement as macro. * ne_string.c (ne_buffer_size): Remove function. Tue May 1 21:23:47 2001 Joe Orton * ne_string.c, ne_string.h: Make ne_buffer a transparent type, and no longer be an implicit pointer type. (ne_buffer_*): All changed. (ne_buffer_data, NE_BUFFER_CAST): Removed. Tue May 1 21:17:40 2001 Joe Orton * ne_string.c, ne_string.h: Renamed sbuffer -> ne_buffer. Implicit pointer removed ne_buffer type. Tue May 1 21:12:15 2001 Joe Orton * ne_string.c, ne_string.h: Renamed from string_utils.c, string_utils.h (CVS copy'n'delete). Tue May 1 20:49:46 2001 Joe Orton * md5.c (ASC2HEX, HEX2ASC): Moved here from string_utils.h. * string_utils.h: As above. Tue May 1 20:47:20 2001 Joe Orton * http_request.c, http_request.h: Removed files. * ne_request.c, ne_request.h: Copied from old http_request.[ch]. Renamed http_* -> ne_*. Tue May 1 20:43:11 2001 Joe Orton * hip_xml.c renamed to ne_xml.c, hip_xml.h renamed to ne_xml.h: CVS repository copy'n'delete. Tue May 1 20:41:03 2001 Joe Orton * hip_xml.c, hip_xml.h: Big rename. hip_xml_* -> ne_xml_*. Tue May 1 20:37:13 2001 Joe Orton * http_basic.c, http_basic.h: Big rename. http_* -> ne_*. Tue May 1 19:59:01 2001 Joe Orton * ne_session.c: Renamed http_* to ne_*. Tue May 1 19:55:47 2001 Joe Orton * ne_alloc.h (NE_FREE): Renamed from HTTP_FREE() in http_utils.h Tue May 1 19:54:42 2001 Joe Orton * socket.c (sock_make_secure): Set SSL_MODE_AUTO_RETRY when available. Mon Apr 30 00:36:34 2001 Joe Orton * ne_session.[ch]: New files, split down from http_request.[ch]. Sun Apr 29 15:02:23 2001 Joe Orton * uri.c [URITEST] (main): Remove, obsoleted by new test suite. Sun Apr 29 15:01:30 2001 Joe Orton * uri.c (uri_has_trailing_slash): Return false if uri is "". Sun Apr 29 13:53:41 2001 Joe Orton * dates.c (ne_asctime_parse, ne_rfc1123_date, ne_rfc1036_parse): Set tm_isdst to -1 in struct tm. Sun Apr 29 13:28:26 2001 Joe Orton * http_utils.c (http_parse_statusline): Skip leading whitespace. (Johan Lindh). (http_parse_statusline): Ensure status-code is not more than three digits. Sun Apr 29 13:26:47 2001 Joe Orton * http_request.c (build_request): Don't add "Content-Length: 0" header if no body: Squid 2.3-STABLE1 doesn't like this. Sun Apr 29 13:25:16 2001 Joe Orton * http_auth.c (everywhere): Renamed md5_* -> ne_md5_*. Sun Apr 29 13:24:12 2001 Joe Orton * md5.c: Renamed md5_* -> ne_md5_*. (ne_ascii_to_md5, ne_md5_to_ascii): Moved from string_utils.c. Thu Apr 26 22:39:05 2001 Joe Orton * uri.c (uri_parse): A zero-length URI is invalid. Wed Apr 25 23:11:51 2001 Joe Orton * dav_props.c (startelm): Check for xml:lang attribute and store as prop->lang. (dav_propset_lang): New function. (free_propset): Free lang. Wed Apr 25 23:08:52 2001 Joe Orton * hip_xml.c (hip_xml_get_attr): New function. Sun Apr 22 21:48:06 2001 Joe Orton * uri.c (uri_parse): Skip a userinfo@ segment if present (Johan Lindh ). Wed Apr 18 13:29:46 2001 Joe Orton * dav_locks.c (dav_lock_copy): Allow owner to be NULL. Tue Apr 17 22:57:50 2001 Joe Orton * ne_alloc.h, dav_locks.h: Add C++ inclusion safety. Tue Apr 17 22:56:50 2001 Joe Orton * uri.c (uri_parse): Correctly handle URIs with no scheme or hostport segments (i.e. just a path). Tue Apr 10 00:29:25 2001 Joe Orton * socket.c [HAVE_SOCKS_H]: Include socks.h for SOCKSv5 support. Wed Apr 4 21:41:47 2001 Joe Orton * http_utils.h [WIN32]: Define ssize_t (Kai). Tue Apr 3 21:03:28 2001 Joe Orton * dav_locks.c (dav_lock_discover): Cope with below API change. Tue Apr 3 20:43:50 2001 Joe Orton * dav_props.c (propfind): Register the flat element handler here, to pick up *any* properties and store them as 'flat' if they are not handled by a handler further down the stack. (make_elms, free_elms, dav_propfind_set_flat, dav_propfind_set_complex): Removed functions. (dav_propfind_named): Take the list of property names, and call set_body here. (dav_propfind_set_private): New function. Tue Apr 3 09:33:09 2001 Joe Orton * http_auth.h: Added C++ inclusion safety. (Kai Sommerfeld) Mon Apr 2 02:39:18 2001 Joe Orton * hip_xml.c (sax_error): Add parse error callback for libxml. Mon Apr 2 02:23:06 2001 Joe Orton * http_redirect.c (post_send): Clean up and fix logic. Only check for confirmation for same-server redirects. Mon Apr 2 02:13:48 2001 Joe Orton * http_redirect.c (http_redirect_location): New function. (destroy): Removed function. (create): Free location. (post_send): Only call notify callback for followed redirects. Mon Apr 2 01:55:27 2001 Joe Orton * http_request.c (http_set_request_uri): Allow using the '*' URI even when using a proxy server. Mon Apr 2 01:32:06 2001 Joe Orton * http_redirect.c (post_send): Give up on trying to follow a redirect to another server. Return HTTP_REDIRECT on such a redirect. * http_redirect.c (post_send): Fix leaks of URI object (Kai Sommerfeld). Mon Apr 2 01:08:33 2001 Joe Orton * http_request.c (read_response_headers): Don't read more than 100 response headers. Mon Apr 2 00:54:43 2001 Joe Orton * http_request.c (http_request_dispatch): Remove mapping of auth status codes to return values, the hook does it now. Mon Apr 2 00:53:20 2001 Joe Orton * http_request.c (http_set_request_uri): New function, split out from http_request_create. (http_request_create): Use it. Mon Apr 2 00:51:23 2001 Joe Orton * http_auth.c (http_set_proxy_auth, http_set_server_auth): Add failure codes. (ah_post_send): Return failure code if authentication fails. Mon Apr 2 00:19:17 2001 Joe Orton * http_utils.c: Pick up xmlversion.h from libxml2. (neon_version_string): Include libxml2 version string if defined. Sun Apr 1 21:40:00 2001 Joe Orton * http_basic.c (http_get_range): Fix total length calculation. (Johan Lindh ). (clength_hdr_handler): Use range->total. Sun Apr 1 21:26:09 2001 Joe Orton * hip_xml.c: Add expat2 support (Sam TH ). Sun Apr 1 21:07:19 2001 Joe Orton * string_utils.h (CONCAT2, CONCAT3, CONCAT4): Use ne_malloc. Sun Apr 1 20:59:09 2001 Joe Orton * dav_props.c (propfind, dav_proppatch): As below. Sun Apr 1 20:32:29 2001 Joe Orton * http_basic.c (http_post): Changed as per http_set_request_body_buffer change. * dav_locks.c (dav_lock): Likewise. Sun Apr 1 20:31:06 2001 Joe Orton * http_request.c (http_set_request_body_buffer): Pass in size parameter too. (send_request_body): Use sized rather than NUL-terminated buffer. Sun Apr 1 20:12:51 2001 Joe Orton * http_private.h: Added 'body_callback' request body type, and body_cb, body_ud fields to http_req. * http_request.c (http_set_request_body_provider): New function. (set_body_size): New function, factored out from old http_set_request_body_*. (http_set_request_body_stream, http_set_request_body_buffer): Use it. Sun Apr 1 19:56:17 2001 Joe Orton * dav_props.c: Replaced 'uri' and 'depth' fields in propfind handler object with an 'http_req' pointer. (dav_propfind_create): Create the request object here, and set the depth header. (propfind): Changed accordingly. (dav_propfind_destroy): Destroy request object too. * dav_props.c (dav_propfind_get_request): New function. Fri Mar 30 16:50:51 2001 Joe Orton * hip_xml.c (start_element): Quote attributes in collect (Kai Sommerfeld). Fri Mar 30 16:36:08 2001 Joe Orton * http_basic.c (http_put_if_unmodified): Changed as below. Thu Mar 22 14:05:52 2001 Joe Orton * http_utils.c (http_dateparse): Changed as below. * http_auth.c (get_conce, basic_challenge): Likewise. Thu Mar 22 14:04:54 2001 Joe Orton * dates.c (ne_rfc1123_date, ne_rfc1123_date, ne_asctime_parse, ne_rfc1036_parse): Added ne_ prefix. Thu Mar 22 14:03:12 2001 Joe Orton * base64.c (ne_base64): Renamed from base64. Tue Mar 20 20:34:44 2001 Joe Orton * dav_props.c (make_elms): Don't request UTF-8 decoding of property values. Tue Mar 20 20:33:39 2001 Joe Orton * string_utils.c (ne_utf8_decode): New function. Mon Mar 19 22:08:45 2001 Joe Orton * http_basic.c (get_callback): Removed function. (http_get, http_read_file, http_post): Use callbacks directly rather than indirectly through get_callback. Mon Mar 19 21:55:19 2001 Joe Orton * http_request.c (notify_status, http_set_status, http_set_progress): New functions: request status and progress callbacks. (open_connection, lookup_host): Use notify_status to trigger status callbacks, and register socket progress callbacks. Mon Mar 19 21:53:07 2001 Joe Orton * socket.c (sock_register_notify): Removed function. (sock_connect_u): Renamed to sock_connect. (sock_register_progress): Per-socket progress callbacks rather than global ones. (sock_call_progress): Take socket argument. (all callers changed). Mon Mar 19 21:52:50 2001 Joe Orton * socket.c (sock_get_version): New function. Mon Mar 19 13:59:21 2001 Joe Orton * dav_props.c (propfind): Destroy the handler. Mon Mar 19 13:36:55 2001 Joe Orton * dav_props.c (dav_propnames): New function. Wed Mar 14 22:42:12 2001 Joe Orton * http_request.h (http_begin_request, http_end_request, http_read_response_block): New functions. (http_request_dispatch): Reimplemented using new caller-pulls interface. Wed Mar 14 22:20:38 2001 Joe Orton * http_auth.c (ah_post_send): If authentication fails (i.e. bad credentials), clean the session details. Wed Mar 14 20:46:55 2001 Joe Orton * http_auth.c: Retry the request simply if it has not been tried before with authentication details, otherwise, fail on 40[17]. Wed Mar 14 20:12:52 2001 Joe Orton * http_request.c (open_connection): Make sure to close the connection, and return HTTP_CONNECT if the SSL negotiation fails. Tue Mar 6 18:37:43 2001 Joe Orton * ne_alloc.c (ne_strndup): Allocate n+1 bytes not 'n' (Kai Sommerfeld). Mon Mar 5 01:05:31 2001 Joe Orton * http_request.c: Moved local sbuffer variables of http_request_dispatch into http_req members 'reqbuf' and 'respbuf'. (build_request): Return a const char * of the request. (send_request): Call build_request directly, use req->respbuf. (http_request_dispatch): Don't call build_request. Removed 'goto' exception handling (hoorah). (http_request_create, http_request_destroy): Create and destroy reqbuf and respbuf here. Mon Mar 5 00:43:40 2001 Joe Orton * http_request.c (http_set_request_body_stream): Set req->body_size and Content-Length header here: return success value. (http_set_request_body_buffer): Likewise (but no return value). (get_request_bodysize): Removed function. (build_request): Add Content-Length: 0 header if no request body. Mon Mar 5 00:27:24 2001 Joe Orton * http_auth.c (http_forget_auth): New function. Mon Mar 5 00:25:15 2001 Joe Orton * http_request.c (http_request_hook_private): Renamed from http_get_hook_private. (http_session_hook_private): New function. * dav_locks.c (dav_lock_using_resource, dav_lock_using_parent): Renamed simiarly. Sun Mar 4 23:12:12 2001 Joe Orton * http_auth.c: Moved per-request state into struct auth_request. (request_digest): Take struct auth_request argument. (free_auth): New function. (http_add_hooks): Pass free_auth as cleanup function for auth session. Sun Mar 4 23:08:46 2001 Joe Orton * http_redirect.c (auto_redirect): Auto-redirect OPTIONS requests. (free_redirect): New function. (http_redirect_register): Pass cleanup function. Sun Mar 4 23:07:01 2001 Joe Orton * dav_locks.c (dav_lock_unregister): Removed function. (free_locks): New function. (dav_lock_register): Pass free_locks as cleanup function for hooks. Sun Mar 4 22:54:57 2001 Joe Orton * http_request.h (http_add_hooks): Added fourth argument to register a cleanup function for the cookie. Sun Mar 4 19:53:03 2001 Joe Orton * http_auth.c (request_digest): Use an sbuffer to create the header value. Sun Mar 4 19:44:18 2001 Joe Orton * http_auth.c: Remove namespace protection for private functions. s/http_auth/auth/g. Sun Mar 4 19:39:13 2001 Joe Orton * http_auth.c (ah_pre_send): Increase attempt counter here, ... (ah_post_send): instead of here. Sun Mar 4 18:40:03 2001 Joe Orton * http_request.c (http_request_dispatch): Simplify post_send hook invocation: run them until one doesn't return HTTP_OK. Don't run pre_send hooks here. Loop while a hook returns HTTP_RETRY. (build_request): Run pre_send hooks here. * http_request.c (read_response_body): Call normalize_response_length here. Sun Mar 4 18:12:26 2001 Joe Orton Re-implemented HTTP authentication using generic hooks interface. * http_auth.c: Added http_auth.h. (http_auth_init, http_auth_set_creds_cb, http_auth_new_request, http_auth_request_header): Removed functions, merged into new hooks code. (ah_create, ah_post_send, ah_pre_send, ah_use_body, ah_destroy): New functions. (auth_body_reader, http_set_server_auth, http_set_proxy_auth): Moved over from http_request.c and redone for hooks interface. * http_request.c (http_set_server_auth, http_set_proxy_auth, give_creds, auth_body_reader): Moved to http_auth.c. (http_accept_always): Renamed from always_accept_response and made public. (http_request_create, build_request, http_request_dispatch): Removed authentication code. Tue Feb 27 19:49:42 2001 Joe Orton * dav_props.c (set_body): Remove UTF-8 encoding again. Mon Feb 26 22:38:41 2001 Joe Orton Patch from Kai Sommerfeld to remove URI escaping from inside neon. * dav_207.c (end_element): Don't unescape href elements. * http_request.c (http_request_create): Don't escape Request-URI. * dav_basic.c (copy_or_move): Don't escape destination URI. Mon Feb 26 21:44:56 2001 Joe Orton * dav_props.c (set_body): UTF-8 encode the property name and value. (make_elms): Request UTF-8 decoding of property values. Mon Feb 26 21:40:14 2001 Joe Orton * hip_xml.c: Do perform UTF-8 decoding when using libxml. (char_data): Fix UTF-8 decoding bug where the byte after a multi-byte encoded sequence would be skipped. Sun Feb 25 20:04:05 2001 Joe Orton * string_utils.c (ne_utf8_encode): New function. Sun Feb 25 19:52:01 2001 Joe Orton * ne_alloc.c (ne_realloc): New function. Sun Feb 25 17:00:32 2001 Joe Orton * Makefile.in (all): Rename NEON_IS_BUNDLED to NEON_BUILD_BUNDLED. Sun Feb 25 16:52:43 2001 Joe Orton * Makefile.in (all): Build according to NEON_IS_BUNDLED. Fri Feb 23 23:38:10 2001 Joe Orton * Makefile.in: Fix deps: neon_config.h has gone. Fri Feb 23 22:57:47 2001 Joe Orton * dav_props.c (dav_simple_propfind): Support a NULL 'props' argument to do an allprop request, as per the advertising literature. Register a catch-all handler in this case. Fri Feb 23 22:16:42 2001 Joe Orton * http_request.c (http_session_destroy): Free up hooks list. Thu Feb 22 21:54:36 2001 Joe Orton * http_request.h (http_add_hooks): Make request_hooks 'const'. Thu Feb 15 08:36:56 2001 Joe Orton * http_request.c (read_response_body): Accept SOCK_CLOSED as end-of-response if we don't have a Content-Length (and not chunked). (Kai Sommerfeld). Thu Feb 15 08:36:23 2001 Joe Orton * http_request.c (add_fixed_headers): Don't add the Host header here. (http_request_dispatch): Add it here instead. * http_request.c (set_hostinfo): Dup the hostname. (http_session_destroy): Free the hostname. (Kai Sommerfeld). Thu Feb 15 08:35:49 2001 Joe Orton * http_private.h: Make hostname in struct host_info char *. (Kai Sommerfeld). Thu Feb 15 08:08:50 2001 Joe Orton * http_redirect.h: Add C++ header-inclusion safety macros (Kai Sommerfeld ). Wed Feb 14 23:37:57 2001 Joe Orton * http_request.c (read_response_body): Use a size_t for readlen, as read_response_block requires. Wed Feb 14 23:25:44 2001 Joe Orton * http_auth.c (request_digest): Fix incorrect signed-ness of buffer. Wed Feb 14 23:22:13 2001 Joe Orton * uri.h, string_utils.h: Comment-out tokens after #endif. Sun Feb 4 14:36:11 2001 Joe Orton * http_redirect.c (post_send): Prototype change. Sun Feb 4 14:31:42 2001 Joe Orton * socket.c: Added key_prompt, key_userdata, key_file to nssl_context. (sock_set_key_prompt, key_prompt_cb): New functions. (sock_make_secure): Set ctx->key_file to private key filename. Sun Feb 4 13:31:44 2001 Joe Orton * http_request.h: Make http_status argument of post_send a const pointer. Sun Feb 4 10:38:12 2001 Joe Orton * http_request.c (set_sockerr): Only use the socket error if it is NULL, else print generic "something went wrong"-type error message. Sun Feb 4 10:29:37 2001 Joe Orton * socket.c (sock_set_client_cert): Call SSL_CTX_check_private_key to ensure that the cert and private key match. Sun Feb 4 10:28:02 2001 Joe Orton * socket.c (sock_make_secure): In error cases after SSL_connect succeeds, call SSL_shutdown and assign sock->ssl = NULL before returning. Sat Feb 3 18:33:56 2001 Joe Orton * socket.c (sock_close): Call SSL_shutdown before close()'ing the fd. Sat Feb 3 18:30:48 2001 Joe Orton * socket.c: Store an default SSL_CTX in nsocket, to be used when no nssl_context is supplied. (create_socket): Create default SSL_CTX (sock_close): Free it here. (sock_make_secure): Use it here. Sat Feb 3 15:52:15 2001 Joe Orton * socket.c (sock_set_client_cert): New function. Sat Feb 3 15:48:51 2001 Joe Orton * socket.c: Rejig of nssl_context handling. An nssl_context is now really a wrapper for an SSL_CTX. (sock_create_ssl_context): Create the SSL_CTX here. (sock_disable_tlsv1, sock_disable_sslv2, sock_disable_sslv3): Set the SSL_CTX option directly. (sock_make_secure): Create an SSL_CTX if no nssl_context is supplied, otherwise use SSL_CTX from nssl_context. Sun Jan 28 13:52:03 2001 Joe Orton * http_utils.c (neon_version_minimum): New function. Sun Jan 28 10:37:28 2001 Joe Orton * neon_config.h.in: Removed file. * http_request.c, http_utils.c: Don't include neon_config.h. Sat Jan 27 22:52:37 2001 Joe Orton * socket.c: Use closesocket() as NEON_CLOSE (Markus Fleck ). Sat Jan 27 22:35:16 2001 Joe Orton * hip_xml.c: Add 'char_data' as libxml cdataBlock handler. Tue Jan 23 23:17:00 2001 Joe Orton * neon_config.h.in: Renamed from neon_config.h. Define NEON_VERSION_MAJOR and NEON_VERSION_MINOR too: all picked up from the NEON_VERSIONS macro. Sun Jan 21 22:07:34 2001 Joe Orton * string_utils.c (ne_concat): New function. Thu Jan 18 22:25:34 2001 Joe Orton * ne_alloc.h: Added ne_oom_callback. * ne_alloc.c: Added DO_MALLOC macro to do the malloc and oom callback test. (ne_malloc): Use DO_MALLOC. (ne_strdup, ne_calloc, ne_strndup): Reimplement using DO_MALLOC rather than calling ne_malloc(). Tue Jan 16 20:16:35 2001 Joe Orton * neon_config.h: Bumped version to 0.10.1. Tue Jan 16 20:14:40 2001 Joe Orton * http_request.c (http_session_create): Default expect-100 support to OFF. Mon Jan 15 22:59:33 2001 Joe Orton * neon_config.h: Bumped version to 0.10.0. Mon Jan 15 22:58:04 2001 Joe Orton * dav_basic.c (dav_simple_request): Use dav_207_ignore_unknown. Sun Jan 14 22:52:31 2001 Joe Orton * dav_props.c (propfind): Call dav_207_ignore_unknown. Sun Jan 14 22:49:06 2001 Joe Orton * dav_207.c: Don't handle unknown elements in normal handler. (ignore_cc, dav_207_ignore_unknown): New functions, for ignoring any unknown elements in the parse. Sun Jan 14 21:53:00 2001 Joe Orton * hip_xml.c: Renamed 'handlers' back to top_handlers. (push_handler): Now, p->root->handlers points to BASE of stack, p->top_handlers points to TOP of stack. (hip_xml_destroy): Changed to start from new BASE of stack. Sun Jan 14 10:50:09 2001 Joe Orton * http_request.c (http_session_server): Do perform the DNS lookup if we have a proxy_decider function, since that means we MIGHT need to know the IP address of the origin server. (http_request_create): Pass the real scheme back to the proxy decider callback. Wed Jan 10 22:43:16 2001 Joe Orton * Makefile.in: Rename OBJ_EXT to NEON_OBJEXT. Remove NEON_INTERFACE_VERSION, use NEON_LINK_FLAGS instead. Wed Jan 10 22:02:02 2001 Joe Orton * dav_locks.c (create_private): New function. (dav_lock_discover): Switch to using new dav_propfind_set_complex API. Wed Jan 10 21:59:36 2001 Joe Orton * dav_props.h (dav_propfind_set_complex): Switch the 'sizeof_private' argument for a callback 'creator': the return value of this callback is used as the 'private' field for the current resource. Mon Jan 8 22:09:55 2001 Joe Orton * dav_locks.h (dav_lock_result): Re-order arguments. Make lock object const. * dav_locks.c (dav_lock_copy): New function. (discover_results): Set lock->uri given href for current results. Free lock object after passing to results. Sun Jan 7 21:55:14 2001 Joe Orton * dav_locks.c (dav_lock): Destroy XML parser after use. Remove handling of Lock-Token header: it wasn't used and it leaked. Sun Jan 7 19:58:29 2001 Joe Orton * dav_props.c (free_propset): Free the property values, and the result set URI too. Sun Jan 7 16:58:19 2001 Joe Orton * http_request.c (read_response_block): Fix handling of SOCK_CLOSED from sock_read as end-of-connection. Sat Jan 6 15:02:57 2001 Joe Orton * hip_xml.c (struct hip_xml_parser): Renamed 'top_handlers' to 'handlers' in hip_xml_parser. (push_handler): New function. (hip_xml_push_handler, hip_xml_push_mixed_handler): Use push_handler. * hip_xml.c (find_handler): Begin the search for a new handler from the handler of the current (parent) element, and work up the stack. Sat Jan 6 11:15:17 2001 Joe Orton * hip_xml.c (find_handler): Display error message for unknown XML element as 'elmname (in nspace)' rather than 'nspace:elmname' since the latter produces confusing errors like 'DAV::displayname'. Wed Jan 3 21:34:44 2001 Joe Orton * Makefile.in: Hard-code top_builddir as '..' (possibly wrong, but true for all neon apps so far). Remove INCLUDES, now unused. Add top_srcdir. Fri Dec 22 22:51:27 2000 Joe Orton * dav_props.c: Added 'has_props' field to propfind_handler struct. (set_body): Only add leading 'prop' element if has_props is not set. Set has_props. Don't add trailing element here. (dav_propfind_named): ... add it here instead. (dav_propfind_set_complex, dav_propfind_set_flat): New set_body interface. Fri Dec 22 21:10:39 2000 Joe Orton * socket.c (sock_transfer): Don't use NEON_READ here, this is for reading from a non-socket fd. Wed Dec 20 00:19:34 2000 Joe Orton * neon_config.h: Bumped version to 0.9.1. Wed Dec 20 00:19:09 2000 Joe Orton * dav_props.c (free_propset): Don't free the private structure, make this the caller's responsibility. Wed Dec 20 00:12:36 2000 Joe Orton * dav_props.c (end_propstat): Rename propstat argument to 'pstat_v' to kill warnings. Tue Dec 19 23:42:39 2000 Joe Orton * dav_props.c (start_response): Zero-out the private structure on creation. Tue Dec 19 22:54:06 2000 Joe Orton * http_request.c (read_response_block): Rename local variable 'socket' to 'sock'. Tue Dec 19 22:52:56 2000 Joe Orton * http_request.h: Rename argument from 'stat' in post_send definition. Tue Dec 19 22:52:32 2000 Joe Orton * http_utils.h: Add 'const' to char * argument. Tue Dec 19 22:19:28 2000 Joe Orton * neon_config.h: Bumped version to 0.9.0. Tue Dec 19 22:12:19 2000 Joe Orton * Makefile.in: New file. Tue Dec 19 22:07:50 2000 Joe Orton * Makefile.incl: Removed file. Tue Dec 19 22:06:06 2000 Joe Orton * dav_locks.c (dav_lock_discover): New callback-based lock discovery interface. Re-implemented using new propfind interface. Tue Dec 19 21:22:43 2000 Joe Orton * dav_props.h: Replace old dav_propfind_* interface with better one. (dav_simple_propfind): Renamed from dav_get_props. (dav_propfind_current_private, dav_propfind_set_complex, dav_propfind_set_flat): New functions. (dav_propfind_get_current_resource): Removed function. (dav_propfind_named, dav_propfind_allprop): Change second argument to be the results callback. * dav_props.c: Replace implementatino of old interface with new one. (dav_simple_propfind): Re-implemented on top of new all-singing all-dancing dav_propfind_* interface. Sun Dec 17 18:24:50 2000 Joe Orton * dav_props.c: Add dav_get_props, and all its auxiliaries. Sun Dec 17 15:43:55 2000 Joe Orton * dav_props.c (propfind): Destroy the request after calling http_get_status. Sun Dec 17 18:04:58 2000 Joe Orton * hip_xml.c (find_handler): Allow using NULL as name and nspace in HIP_ELM_unknown elements. Sun Dec 17 18:03:03 2000 Joe Orton * dav_207.c (check_context): Don't handle the unknown element when it is a child of the prop element, this prevents handling allprop responses. Thu Dec 14 21:48:06 2000 Joe Orton * neon_config.h: Bumped version to 0.8.0. Thu Dec 14 21:43:31 2000 Joe Orton * dav_basic.c, dav_locks.c, dav_props.c (everywhere): Changed to new response-status interface, and _class->klass change. Thu Dec 14 21:37:38 2000 Joe Orton * http_request.c (http_get_status): Add new response-status interface. Thu Dec 14 21:30:25 2000 Joe Orton * http_basic.c (everywhere): Use new status interface. Thu Dec 14 21:25:03 2000 Joe Orton * http_private.h: Made http_status pointer in http_req a declared object. * http_request.h: Removed passing status pointer to http_request_dispatch. * http_request.c (everywhere): Removed passing extra http_status * to auxiliaries, use req->status instead. Renamed '_class' to 'klass' everywhere. Thu Dec 14 21:15:54 2000 Joe Orton * http_utils.h: Renamed '_class' member of http_status to 'klass'. (http_parse_statusline): Change accordingly. Wed Dec 13 23:00:23 2000 Joe Orton * socket.c: Changes for pre-BONE BeOS (David Reid ). Wed Dec 13 21:29:36 2000 Joe Orton * uri.c (ESCAPE): Explicitly cast the character to const unsigned int. (uri_abspath_escape): Make 'pnt' a normal const char *. Wed Dec 13 21:17:31 2000 Joe Orton * http_request.c: Remove netinet/in.h include, add limits.h include. (Peter Boos) (read_response_block): Make readlen a size_t (David Reid). Wed Dec 13 21:08:08 2000 Joe Orton * ne_alloc.h [WIN32]: Include stdlib.h. (Peter Boos) Wed Dec 13 20:54:27 2000 Joe Orton Patches from Peter Boos and David Reid for Win32 and BeOS changes respectively: * socket.c: Add NEON_READ, NEON_WRITE, NEON_CLOSE macros to use send/recv/closesocket for BeOS, send/recv/close for Win32, write/read/close otherwise. Include WinSock2.h in Windows. Add arpa/inet.h check. (sock_read, sock_write): Use the NEON_ macros. (sock_connect, sock_close): Use NEON_CLOSE. (sock_init): Winsock initialization. (sock_exit) Winsock cleanup. (sock_fullwrite): Use size_t rather than ssize_t for 'sent'. (sock_connect, sock_connect_u): Make 'port' parameter an unsigned short int. Wed Dec 13 20:42:18 2000 Joe Orton * http_basic.c (clength_hdr_handler): Use an off_t for len, to avoid comparison with size_t. Wed Dec 13 20:38:59 2000 Joe Orton * hip_xml.c (char_data): Use an 'int' for wslen, avoid comparison between size_t (which is signed) and int (which [is|might be?] unsigned). Wed Dec 13 20:29:12 2000 Joe Orton * nsocket.h [WIN32]: Use Windows headers rather than Unixy ones. (sock_exit): New function. Wed Dec 13 20:21:22 2000 Joe Orton * string_utils.c, string_utils.h, uri.h: Includes change (Peter Boos). Wed Dec 13 20:20:09 2000 Joe Orton * http_auth.c (http_auth_response_body): Don't make inline. Includes change. (both by Peter Boos). Wed Dec 13 20:18:38 2000 Joe Orton * uri.c (uri_unescape): Cast strtol return to (char). Includes change as below (both by Peter Boos). Wed Dec 13 20:07:38 2000 Joe Orton * base64.c, dates.c, dates.h, dav_207.c, dav_207.h, dav_basic.h, dav_locks.h, hip_xml.h, http_auth.h, http_basic.h, http_cookies.c, http_redirect.c, http_redirect.h, http_request.h, http_utils.c, md5.c, ne_alloc.c: Use #include "..." rather than #include <...> for neon headers. (Peter Boos ). Thu Dec 7 21:45:02 2000 Joe Orton * socket.c (sock_read): Return zero immediately if a zero count parameter is passed, following SUSv2 semantics. Thu Dec 7 21:41:36 2000 Joe Orton * nsocket.h (sock_readfile_blocked): Define an interface, allow taking -1 as the length parameter. Only return SOCK_CLOSED if length == -1 is NOT passed. Sun Nov 26 09:46:53 2000 Joe Orton * nsocket.h: Fix use of 'socket' in function prototypes. Sun Nov 19 00:29:48 2000 Joe Orton * nsocket.h: Increase read timeout to 120 seconds. Sun Nov 5 14:42:46 2000 Joe Orton * dav_locks.c: Fix element id's (fixes segfault when using locks). Thu Oct 26 22:28:17 2000 Joe Orton * socket.c (sock_peek): Return SOCK_CLOSED if recv() returns zero. Thu Oct 26 22:24:14 2000 Joe Orton * socket.c (sock_block): Return "got data" if SSL_pending indicates data pending. Otherwise select on socket as normal. Thu Oct 26 22:15:14 2000 Joe Orton * socket.c (sock_readline, sock_peek): Check whether SSL connection has been closed if SSL_peek returns 0 (thanks to Jeff Costlow ). Thu Oct 14 19:57:31 2000 Joe Orton * Makefile.incl: Fix spurius backslash at line 69 (thanks to Dirk Bergstrom ). Sat Oct 14 19:51:44 2000 Joe Orton * dav_basic.c (copy_or_move): Use http_get_scheme rather than hard-coding "http". 2000-10-02 Joe Orton * http_request.c (http_get_scheme): New function. Tue Oct 10 19:56:42 2000 Joe Orton * neon_config.h: Bumped version to 0.7.5. Sat Oct 7 19:26:58 2000 Joe Orton * neon_config.h: Bumped version to 0.7.4. Sat Oct 7 19:19:37 2000 Joe Orton * http_auth.c (request_digest): Quote algorithm and qop parameters in digest header. Sat Oct 7 19:15:29 2000 Joe Orton * socket.c (sock_connect_u): Don't leak the fd if connect fails (David Sloat). Sat Sep 16 16:49:57 2000 Joe Orton * hip_xml.h: Add 'HIP_ELM_UNUSED', defining lowest element ID which should be used. * hip_xml.c, hip_xml.h (hip_xml_push_handler, hip_xml_push_mixed_handler): Renamed from hip_xml_add_handler / hip_xml_add_mixed_handler to reflect stack-like usage of handlers. 'handlers' field of hip_xml_parser renamed to top_handler for same reason (globally search'n'replaced). * hip_xml.h: Documentation update. Thu Sep 14 22:37:33 2000 Joe Orton * http_auth.c (request_digest): Quote qop= value, fixes IIS5 interop. Thu Sep 14 00:40:04 2000 Joe Orton * socket.c (sock_connect_u): If connect() fails, close the socket before returning: thanks to David Sloat . Tue Sep 12 20:08:40 2000 Joe Orton * http_request.c (read_response_headers): Remove redundant tolower(). Tue Sep 12 00:41:39 2000 Joe Orton * neon_config.h: Bumped version to 0.7.3. Mon Sep 11 15:31:13 2000 Joe Orton * http_request.c, http_auth.c: Include snprintf.h if HAVE_SNPRINTF_H is defined. Fri Sep 8 10:46:53 2000 Joe Orton * neon_config.h: Bumped version to 0.7.2. Fri Sep 8 10:44:42 2000 Joe Orton * socket.c (sock_block): Return immediately if this is an SSL socket. Thu Sep 7 00:31:12 2000 Joe Orton * hip_xml.h: Correct order of hip_xml_validate_cb arguments in prototype (thanks to Greg Stein). Thu Sep 7 00:27:29 2000 Joe Orton * dav_props.c (propfind): Don't destroy the handler after use. (dav_propfind_destroy): New function. Thu Sep 7 00:08:45 2000 Joe Orton * Makefile.incl: Added targets for ne_alloc.o, string_utils.o, uri.o, base64.o. Tue Aug 15 21:53:53 2000 Joe Orton * neon_config.h: Bumped version to 0.7.1. Tue Aug 15 21:16:34 2000 Joe Orton * http_request.c (http_request_create): Only add authentication response body callbacks if a supply-credentials callback has been set for the session. (http_request_dispatch): Similarly for response header callbacks. Mon Aug 14 09:28:38 2000 Joe Orton * neon_config.h: Bumped version to 0.7.0. Mon Aug 14 09:23:54 2000 Joe Orton * string_utils.h (SBUFFER_CAST): New macro. Mon Aug 14 09:13:05 2000 Joe Orton * http_private.h: Use a hash table for storing response header handlers. Added response header 'catchers', which are passed ALL response headers. * http_request.c (http_add_response_header_handler): Place the handler in the correct hash bucket. (hdr_hash): New function. (http_add_response_header_catcher): New function. (http_request_destroy): Destroy the header catchers, and iterate over the hash table to destroy the handlers. (read_response_headers): Optimisation: hash and search for ':' in a single loop. Remove another local variable. Iterate through catchers too. Sun Aug 13 15:57:35 2000 Joe Orton * neon_config.h: Bumped version to 0.6.1. Sun Aug 13 15:50:42 2000 Joe Orton * http_request.c (send_request): Only go through the loop at most twice. Sun Aug 13 15:49:52 2000 Joe Orton * http_redirect.c (destroy): Don't free the redirect structure. Sat Aug 12 17:10:32 2000 Joe Orton * neon_config.h: Bumped version to 0.6.0. Sat Aug 12 16:48:47 2000 Joe Orton * http_request.c (http_session_decide_proxy): New function. (http_request_create): Call proxy "decider callback" to determine whether to use the proxy server for a given request or not. Sat Aug 12 16:39:10 2000 Joe Orton * Makefile.incl: Updated for http_private.h and http_redirect.[ch]. Sat Aug 12 16:36:49 2000 Joe Orton * http_request.c: Removed data structure definitions. * http_private.h: New file, contains data structure definitions. Interface NOT exported. Sat Aug 12 16:31:32 2000 Joe Orton * http_redirect.c (destroy): No return value. Sat Aug 12 16:04:02 2000 Joe Orton * http_redirect.[ch]: First cut at HTTP redirect handling. Sat Aug 12 11:05:13 2000 Joe Orton * neon_config.h: Bumped version to 0.5.1. Sat Aug 12 02:04:15 2000 Joe Orton * dav_locks.c (dav_lock_using_resource, dav_lock_using_parent): Prevent segfault if locking is not in use. Fri Aug 11 17:19:06 2000 Joe Orton * neon_config.h: Bumped version to 0.5.0. Fri Aug 11 16:31:23 2000 Joe Orton * http_request.c (read_message_header): Take a buffer for storing continuation lines. (read_response_headers): No need to strip EOL since read_message_header does this already. Use one less variable. Fri Aug 4 22:12:04 2000 Joe Orton * http_request.c (send_request): Don't retry sending the request more than once. Wed Aug 2 11:08:31 2000 Joe Orton * ne_alloc.[ch]: Renamed from xalloc.[ch]. Wed Aug 2 02:15:32 2000 Joe Orton * socket.c (sock_transfer): Return SOCK_CLOSED, or set sock->error appropriately on read failure. Tue Aug 1 13:04:27 2000 Joe Orton * socket.c, nsocket.h (sock_progress, sock_call_progress, sock_transfer, sock_readfile_blocked): Use 'off_t' not 'size_t' as file size type. Fri Jul 28 13:32:37 2000 Joe Orton * neon_config.h: Bumped version to 0.4.2. Fri Jul 28 13:31:38 2000 Joe Orton * http_request.c (send_request): Fix sending request body after getting 100-continue response. Fri Jul 28 11:26:47 2000 Joe Orton * neon_config.h: Bumped version to 0.4.1. Fri Jul 28 10:32:34 2000 Joe Orton * neon_config.h: Bumped version to 0.4.0. Fri Jul 28 10:28:21 2000 Joe Orton * http_basic.[ch] (http_post): New function, from Sander Alberink . Thu Jul 27 18:55:49 2000 Joe Orton * http_utils.c (neon_debug): No conditional compilation for function body: compile it all regardless of whether debugging is enabled or not, to allow applications to be debugged regardless of whether debugging is compiled into the library or not. Thu Jul 27 16:59:26 2000 Joe Orton * http_basic.c (clength_hdr_handler): Cast off_t to long int for printing. Tue Jul 25 18:14:15 2000 Joe Orton * http_request.c (read_message_header): Iterate over header handler list before placing zero-terminator at ':': if a handler has a NULL name field, pass it the entire header value. Tue Jul 25 18:00:49 2000 Joe Orton * http_request.c (http_get_request_headers): New function. Mon Jul 24 16:55:29 2000 Joe Orton * neon_config.h: Bumped version to 0.3.9. Mon Jul 24 16:54:33 2000 Joe Orton * http_basic.h: Use 'off_t' in http_content_range. * http_basic.c (http_get_range): Cast range values to (long int) to prevent compiler warnings. Thu Jul 20 20:03:30 2000 Joe Orton * http_request.[ch], socket.c, http_basic.c: Include nsocket.h not socket.h. Thu Jul 20 20:02:20 2000 Joe Orton * http_utils.c (version_string): Indicate which XML parser is supported. Thu Jul 20 20:01:12 2000 Joe Orton * nsocket.h: Renamed from socket.h. Thu Jul 20 15:02:35 2000 Joe Orton * http_utils.c, socket.c, http_request.c: SSL_ENABLE renamaed to ENABLE_SSL. Thu Jul 20 12:20:13 2000 Joe Orton * md5.c, http_auth.h: Include neon_md5.h. Thu Jul 20 12:19:23 2000 Joe Orton * neon_md5.h: Renamed from md5.h. Wed Jul 19 22:33:46 2000 Joe Orton * dav_basic.c (dav_simple_request): Don't leak ctype.value. Wed Jul 19 22:32:03 2000 Joe Orton * dav_207.c (check_context): Accept unknown elements. Wed Jul 19 22:31:10 2000 Joe Orton * dav_locks.c (dav_lock_iterate): Allow passing func as NULL. Wed Jul 19 22:26:13 2000 Joe Orton * socket.h (SOCKET_READ_TIMEOUT): Increase to 60. Wed Jul 19 22:25:51 2000 Joe Orton * dav_locks.h: Include http_request.h. Mon Jul 17 11:41:16 2000 Joe Orton * dates.c (asctime_parse, rfc1036_parse): Actually pass the string to sscanf (thanks to lclint). (rfc1123_date): Check for gmtime() returning NULL. Mon Jul 17 09:16:43 2000 Joe Orton * neon_config.h: Bumped version to 0.3.1. Mon Jul 17 09:07:58 2000 Joe Orton * dav_locks.c: Include limits.h: thanks to Paul D'Anna. Sun Jul 16 18:47:15 2000 Joe Orton * neon_config.h: Bumped version to 0.3.0. Sun Jul 16 16:44:25 2000 Joe Orton * neon_i18n.c (neon_i18n_init) [ENABLE_NLS && NEON_IS_LIBRARY]: New compilation conditions. Sun Jul 16 16:41:12 2000 Joe Orton * neon_i18n.c: New file. Sun Jul 16 16:15:02 2000 Joe Orton * string_utils.c (sbuffer_*): Change to assert postcondition (buf->used == strlen(buf->data) + 1). (sbuffer_append): Fix brokenness. Sun Jul 16 16:11:05 2000 Joe Orton * socket.c (sock_transfer): Increase sum length written correctly. Sun Jul 16 16:10:23 2000 Joe Orton * http_request.c (http_get_hook_private): New function. Sun Jul 16 16:07:11 2000 Joe Orton * hip_xml.c (find_handler): Call validate_cb for any handler which recognizes the element. Allow return codes HIP_XML_{VALID,INVALID,DECLINE} from validate_cb. If DECLINE is returned, continue searching handlers until one returns (IN)VALID. (start_element): Don't call validate_cb. * hip_xml.c (start_element, end_element): In collect mode, don't print namespace prefix if present. Sun Jul 16 15:30:19 2000 Joe Orton * dav_locks.[ch]: New file, code mainly taken from cadaver and adapted for neon HTTP request/response handling. Sun Jul 16 15:28:25 2000 Joe Orton * dav_basic.c (copy_or_move, dav_move, dav_copy): Pass overwrite as parameter. Sun Jul 16 15:26:24 2000 Joe Orton * uri.c (uri_compare): Fixed to only return equal if *shorter* string has no trailing slash. Sat Jul 15 20:14:07 2000 Joe Orton * dav_207.c (dav_207_get_current_response, dav_207_get_current_propstat): New functions. * dav_props.c (dav_propfind_get_current_resource): Implement using dav_207_get_current_response. Sat Jul 15 17:36:37 2000 Joe Orton * xalloc.c (xcalloc): New function. Sat Jul 15 14:11:14 2000 Joe Orton * http_utils.[ch] and elsewhere: Replace 'class' field of http_status with '_class' to be C++-safe. (patch from Tom Bednarz). Thu Jul 6 18:48:52 2000 Joe Orton * dav_basic.c (copy_or_move): Escape the destination URI. Thu Jul 6 18:45:51 2000 Joe Orton * dav_props.c (end_response): Added description parameter. Thu Jul 6 18:43:14 2000 Joe Orton * dav_207.[ch] (end_element): Fix handling of responsedescription. Add "description" parameter to dav_207_end_response callback, and pass the contents of responsedescription. * dav_basic.c (handle_error, end_response, end_propstat): Pass description and add to error string when present. Tue Jul 4 11:43:03 2000 Joe Orton * dav_basic.c, dav_props.c, http_basic.c: Use http_{add,print}_request_header rather than http_get_request_header. Tue Jul 4 11:41:00 2000 Joe Orton * http_request.[ch] (http_add_request_header, http_print_request_header): New functions. (http_get_request_header): Removed function. Mon Jul 3 21:50:40 2000 Joe Orton * http_request.c: Add basic support for TLS upgrade (RFC2817). (http_set_request_secure_upgrade, http_set_accept_secure_upgrade): New functions. (send_request): If upgrade is requested, and a 101 response is received, negotiate the TLS connection. (add_fixed_headers): Add Upgrade header if necessary. Mon Jul 3 21:46:00 2000 Joe Orton * http_request.c (send_request): Don't go into an infinite loop. (read_message_header): Simplyify checking for end-of-line. Tue Jun 13 00:29:42 2000 Joe Orton * http_request.c (http_session_proxy, http_session_server): Allow calling >1 time per session, to switch servers. (send_request): Only retry sending request once. Mon Jun 12 21:50:41 2000 Joe Orton * http_request.c (http_add_hooks): New function. Mon Jun 12 21:37:24 2000 Joe Orton * http_cookies.[ch]: Added basic cookies support. Mon Jun 12 21:33:33 2000 Joe Orton * socket.c (sock_create_ssl_context, sock_destroy_ssl_context, sock_disable_tlsv1, sock_disable_sslv2, sock_disable_sslv3, sock_make_secure): Added nssl_context handling. Mon Jun 12 21:29:52 2000 Joe Orton * http_request.c (http_request_dispatch, http_request_create, http_request_destroy, http_set_request_body_buffer, http_set_request_body_stream): Added hook support. Mon Jun 12 21:04:00 2000 Joe Orton * http_request.c (http_set_secure): Store an nssl_context. (open_connection): Give the nssl_context. Sun Jun 11 16:37:52 2000 Joe Orton * sslcerts.c: Import of SSL support from mutt, relicensed under the LGPL for use in neon by the author, Tommi Komulainen . Sun Jun 11 11:30:16 2000 Joe Orton * http_request.c (set_sockerr): Updated to use sock_get_error. Sun Jun 11 11:29:29 2000 Joe Orton * uri.c (uri_parse): Allow scheme to be omitted. Fri Jun 9 20:39:24 2000 Joe Orton * socket.c (sock_get_error): New function. (sock_*): Set sock->error and SOCK_ERROR on error. Mon May 29 16:32:46 2000 Joe Orton * uri.c (uri_abspath_escape): Allocate the exact amount of memory needed. Mon May 29 15:53:33 2000 Joe Orton * dav_basic.c (dav_simple_request): Correct invalid XML logic. Mon May 29 15:52:08 2000 Joe Orton * socket.c (create_sock, sock_accept, sock_get_fd): New functions. (sock_connect_u): Use create_sock. Sun May 28 21:00:37 2000 Joe Orton * http_utils.c (neon_version_string): New function. Sun May 28 19:36:45 2000 Joe Orton * socket.c (sock_connect_u): Zero out allocated nsocket object. Thu May 25 01:27:04 2000 Joe Orton * *.h: Include other neon headers with . Thu May 25 01:02:12 2000 Joe Orton * dav_props.c: Include stdlib.h for 'free'. Wed May 24 20:15:08 2000 Joe Orton * http_request.c (read_message_header): Return HTTP_RETRY if more headers to read, HTTP_OK on end-of-headers. (read_response_headers): Changed accordingly. Wed May 24 19:56:29 2000 Joe Orton * http_request.c (send_request_body): Return a SOCK_* code. (send_request): Re-send request if socket has been closed (due to persistent connection timeout). Wed May 24 19:00:01 2000 Joe Orton * hip_xml.c (find_element): Fix unknown element handling. Tue May 23 19:12:26 2000 Joe Orton * dav_props.c (propfind): Destroy the request body sbuffer after use. Tue May 23 15:43:42 2000 Joe Orton * socket.c (sock_make_secure) [SSL_ENABLE]: Conditionally compile SSL code. [!SSL_ENABLE]: Return failure. (sock_close) [SSL_ENABLE]: Conditionally compile SSL code. Tue May 23 15:37:53 2000 Joe Orton * http_request.c (http_session_create): Renamed from http_session_init. (http_session_destroy): Renamed frmo http_session_finish. Sun May 21 23:50:58 2000 Joe Orton * http_request.c (lookup_host): Use sock_name_lookup. Sun May 21 23:40:39 2000 Joe Orton * http_request.c (http_request_create): Allow passing NULL uri (internal use only). (http_set_secure): New function. (read_response_block, read_message_headers): Redone for new socket API. (build_request): Moved http_auth_new_request calls here (from http_request_dispatch). (send_request): Always call open_connection before sending the request. (read_message_header, read_response_headers): Looser check for empty line. (normalize_response_length): Set response body length to zero on 2xx class response whilst in CONNECT, if no other response body length is given. (http_request_dispatch): Don't close the connection on a HTTP/1.0 2xx class response after a CONNECT request. (proxy_tunnel): New function. (open_connection): Use an SSL connection where appropriate. Use proxy_tunnel for tunnelling through a proxy. Sun May 21 01:35:40 2000 Joe Orton * src/socket.c: Added 'nsocket' ADT for handling sockets. (sock_*): All changed to take 'nsocket *' argument rather than integer file descriptor. Added 'sock_secure_details' to sock_status enum. (sock_make_secure, sock_init): New function. (sock_peek): Renamed from sock_recv. (send_file_*, recv_file_*): Removed functions. (sock_name_lookup): Renamed from host_lookup. (sock_service_lookup): Renamed from get_tcp_port. (sock_block, sock_read, sock_fullwrite, sock_peek, sock_readline): Added SSL support. (sock_transfer): Use sock_fullwrite and sock_read. Sun May 21 01:25:03 2000 Joe Orton * http_request.c (http_request_destroy): Free header handlers and body readers. Sun May 21 01:24:30 2000 Joe Orton * dav_props.h: Removed obsolte got_property callback type. Sun May 21 01:23:59 2000 Joe Orton * dav_props.c (propfind): Free handler object after use. Sun May 21 01:23:12 2000 Joe Orton * dav_207.c (dav_207_destroy): Don't try to free the 'response' field. Sat May 20 21:45:32 2000 Joe Orton * http_request.c: Changed 'te' enum of struct http_response to 'is_chunked' boolean. Sun May 14 01:00:42 2000 Joe Orton * dav_props.c (propfind): Return error on parse error. Sun May 14 00:40:50 2000 Joe Orton * neon_config.h (NEON_VERSION): Bumped to 0.2.0. Sat May 13 23:31:28 2000 Joe Orton * neon_defs.h (BEGIN_NEON_DECLS, END_NEON_DECLS): Added C++ safety macros. * *.h: Surround with C++ safety macros. Sat May 13 22:36:06 2000 Joe Orton * hip_xml.c (hip_xml_destroy): Free handlers. Sat May 13 21:12:14 2000 Joe Orton * hip_xml.c (hip_xml_valid): Reversed return value. Sat May 13 21:11:17 2000 Joe Orton * http_utils.c: Renamed http_debug_mask to neon_debug_mask, similarly neon_debug_stream. (neon_debug_init): Renamed from http_debug_init. Sat May 13 19:24:40 2000 Joe Orton * http_utils.c: Initialize http_debug_mask to zero. (http_debug_init): New function. * http_utils.h: Fixed #ifdef DEBUGGING. Only define relevant DEBUG_* constants. Sat May 13 19:23:34 2000 Joe Orton * neon_config.h: New file. * http_request.c: Include neon_config.h for NEON_VERSION. Sat May 13 18:28:05 2000 Joe Orton * dav_props.c (dav_propfind_create): Create a hip_xml_parser, a 207 parser, register start+end response handlers with 207 layer. (propfind): Fix allprop (Michael Sobolev). * dav_basic.c (dav_simple_request): Create and destroy hip_xml_parser and 207 parser appropriately. Sat May 13 18:24:49 2000 Joe Orton * dav_207.c: Now takes an externally-declared hip_xml parser pointer. (dav_207_create, dav_207_destroy): New functions. (dav_207_init, dav_207_init_with_handler, dav_207_parse, dav_207_error, dav_207_finish): Removed functions. Sat May 13 17:32:45 2000 Joe Orton * hip_xml.[ch]: Rewritten to use opaque hip_xml_parser pointer. struct hip_xml_handler and struct hip_xml_state removed from external interface. struct hip_xml_elm * passed to startelm_cb and endelm_cb. (hip_xml_add_handler, hip_xml_valid, hip_xml_create, hip_xml_destroy, hip_xml_set_error, hip_xml_get_error): New functions. (hip_xml_init, hip_xml_destroy): Removed functions. Sat May 13 13:43:56 2000 Joe Orton * neon.h: Removed. Sat May 13 13:42:20 2000 Joe Orton * string_utils.h: Don't include config.h. (CONCAT*): Don't use xmalloc, use malloc and abort manually. Sat May 13 13:32:46 2000 Joe Orton * http_utils.h, dates.h, http_basic.h: Don't include config.h Sat May 13 13:31:37 2000 Joe Orton * hip_xml.[ch], dav_207.c: Use HIP_ERR_SIZE for size of parser error string. Sat May 13 13:30:40 2000 Joe Orton * Makefile.incl: Use obj_ext for object file extension. Thu May 11 18:21:53 2000 Joe Orton * neon.h: Bumped version to 0.1.1. Thu May 11 18:16:08 2000 Joe Orton * http_basic.c (get_to_fd): Fix short writes. Wed May 10 19:22:01 2000 Joe Orton * neon.h: Bumped version to 0.1.0. Wed May 10 17:46:48 2000 Joe Orton * uri.c (uri_parse, uri_free): New functions. Wed May 10 17:43:37 2000 Joe Orton * http_basic.c (get_to_fd, http_get): Set error appropriately if fwrite() fails. Wed May 10 14:25:38 2000 Joe Orton * http_utils.c (http_debug): New function. Wed May 10 14:25:08 2000 Joe Orton * http_basic.c (get_callback): Call sock_call_progress. Wed May 10 14:24:20 2000 Joe Orton * socket.c (sock_call_progress): New function. (many places): Use it. Wed May 10 14:22:48 2000 Joe Orton * uri.c (uri_has_trailing_slash): Moved from being inline. Tue May 9 23:34:25 2000 Joe Orton * dav_props.c: Use handler as userdata for 207 callbacks, unified handler and context structures. (start_prop, end_prop, start_propelm, end_propelm): Removed functions. (dav_propfind_get_current_resource): New function. Tue May 9 23:29:44 2000 Joe Orton * xalloc.[ch]: New files. Tue May 9 23:05:47 2000 Joe Orton * dav_207.[ch]: Removed property and property element callbacks. Tue May 9 23:01:00 2000 Joe Orton * dav_207.c: Use separate name/namespace for element names. (dav_207_init_with_handler): New function. (end_element): Unescape URI in href element. Tue May 9 19:54:07 2000 Joe Orton * dav_props.c (dav_propfind_allprop, dav_propfind_named, propfind, start_response, end_response, start_prop, end_prop, start_propelm, end_propelm): New functions; PROPFIND support. Tue May 9 19:45:17 2000 Joe Orton * http_request.c (build_request): Renamed from make_request. Tue May 9 19:36:01 2000 Joe Orton * socket.[ch]: Added sock_block_reader. Tue May 9 15:52:56 2000 Joe Orton * uri.c (uri_childof): Return false when parent is the same length as child. Sun May 7 15:07:49 2000 Joe Orton * dav_207.c: Separated element namespace/names. Tue May 2 16:40:59 2000 Joe Orton * hip_xml.[ch]: Added HIP_XML_UTF8DECODE flag. Tue May 2 16:16:57 2000 Joe Orton * hip_xml.[ch]: Separate element name and namespace. Mon May 1 00:21:24 2000 Joe Orton * dav_207.c (dav_accept_207): Moved function from dav_basic.c. * dav_basic.c (dav_accept_207, dav_parse_xml_block): Removed functions. Sun Apr 30 22:47:47 2000 Joe Orton * dav_props.[ch]: Renamed dav_proppatch_item to dav_proppatch_operation. Sun Apr 30 22:45:04 2000 Joe Orton * hip_xml.c (start_element): Clearer error message. Sun Apr 30 19:12:07 2000 Joe Orton * http_basic.c (http_content_type_handler, dav_hdr_handler): New functions. (http_options): Handle DAV header. Sun Apr 30 18:08:53 2000 Joe Orton * dav_props.c (dav_proppatch): New function. Sun Apr 30 18:05:55 2000 Joe Orton * dav_basic.c (handle_error): New function. (end_response, end_propstat): Use it. (dav_simple_request): Don't return the 207 error string if we get all 2xx class status elements. Sun Apr 30 16:56:41 2000 Joe Orton * dav_basic.c (dav_add_depth_header): New function. Sun Apr 30 14:49:06 2000 Joe Orton * dav_207.c (start_element): Unknown element is only a property if the parent is DAV:propstat. Sun Apr 30 14:43:28 2000 Joe Orton * dav_basic.c (end_response, end_propstat): Only write error line if we have status information and the status is not a 424. Sun Apr 30 14:28:23 2000 Joe Orton * dav_basic.h: Added DAV_DEPTH_*. Sun Apr 30 12:47:50 2000 Joe Orton * dav_207.c (check_context): Allow (and ignore) unknown elements anywhere other than as the root. Sun Apr 30 12:35:39 2000 Joe Orton * string_utils.h (ASC2HEX, HEX2ASC): New macros. Sun Apr 30 12:34:37 2000 Joe Orton * http_auth.c [STANDALONE]: Removed. (everywhere): Switch to using md5_to_ascii rather than md5_hexify. Sun Apr 30 12:32:35 2000 Joe Orton * http_request.c (read_response_block): Fixed to return errors properly and block length to parameter. (read_response_body): Changed accordingly. Sun Apr 30 12:29:45 2000 Joe Orton * hip_xml.c (friendly_name): New function, was PRETTY_NAME macro. (start_element, end_element): Fix COLLECT handling. (hip_xml_parse): Only write parse error if the document has not already been marked invalid. Sun Apr 30 12:28:36 2000 Joe Orton * dav_basic.c (dav_simple_request): Rewritten for new 207 interface. (start_response, end_response, end_propstat): New functions. Sun Apr 30 12:27:52 2000 Joe Orton * dav_207.c (dav_207_error): Return the parser error. Sat Apr 29 14:46:48 2000 Joe Orton * socket.c (sock_register_progress, sock_register_notify): New functions. (everywhere): Use progress + notify callbacks rather than fe_*. Sat Apr 29 14:15:23 2000 Joe Orton * string_utils.c (md5_to_ascii, ascii_to_md5): New functions. Sat Apr 29 13:55:39 2000 Joe Orton * hip_xml.c (hip_xml_init): abort() on out-of-memory. Sat Apr 29 12:56:11 2000 Joe Orton * neon_i18n.h: New file. Sat Apr 29 12:55:24 2000 Joe Orton * dav_207.[ch]: Re-implemented with sensible interface. Fri Apr 28 14:56:01 2000 Joe Orton * http_auth.c (http_auth_request_header): Renamed from http_auth_request. * http_request.c (make_request): As above. Thu Apr 13 11:52:14 2000 Joe Orton * http_basic.c (http_put): Switched URI and stream arguments. Thu Apr 13 09:51:21 2000 Joe Orton * http_request.c: Added user_agent field to session structure. (http_set_useragent): New function. (add_fixed_headers): Only set user-agent if sess->user_agent is set. Thu Apr 13 09:49:32 2000 Joe Orton * http_request.c (lookup_host): New function, split from set_hostinfo. (set_hostinfo): Doesn't perform DNS lookup. (http_session_server): Don't do a DNS lookup if we have a proxy. Wed Apr 12 22:32:21 2000 Joe Orton * http_request.c (http_request_dispatch, http_request_create): Store auth header values in local variables rather than request structure. (http_request_create): Don't leak everything on error. Handle http_auth_challenge return value. Wed Apr 12 22:30:06 2000 Joe Orton * http_basic.c (http_options): Pass server capabilites object, parse Server header to detect Apache/1.3.6 and before, indicating broken 100-continue support. (server_hdr_handler): New function. Mon Apr 10 17:42:07 2000 Joe Orton * socket.c: Use 'int' for return values. Mon Apr 10 17:41:40 2000 Joe Orton * http_auth.c (is_in_domain): Dummy implementation. Mon Apr 10 17:40:21 2000 Joe Orton * http_request.c: Handle read() returning 0 when it shouldn't. i18n'ized error messages. Mon Apr 10 14:45:09 2000 Joe Orton * dates.[ch], md5.[ch], base64.[ch]: Imported date handling utilities, MD5 checksum functions, and text->base64 converter. Mon Apr 10 14:44:08 2000 Joe Orton * Makefile.incl: Dependancies updated for socket.[ch]. Mon Apr 10 14:43:36 2000 Joe Orton * dav_207.c: Replaced malloc() calls with xmalloc() calls. Mon Apr 10 14:42:35 2000 Joe Orton * http_auth.c, uri.c, string_utils.h: Replaced malloc() calls with xmalloc() calls. Mon Apr 10 14:41:40 2000 Joe Orton * socket.[ch]: Imported socket handling utilities. Mon Apr 10 14:36:03 2000 Joe Orton * string_utils.h (CONCAT*): Use xmalloc. Mon Apr 10 13:52:17 2000 Joe Orton * http_request.c (set_sockerr): Added handling for socket errors. Sat Apr 8 13:49:07 2000 Joe Orton * string_utils.[ch]: Imported string utilites. Sat Apr 8 00:26:06 2000 Joe Orton * http_request.c (http_set_persist, http_set_expect100): New functions. Sat Apr 8 00:25:37 2000 Joe Orton * http_basic.c (http_options): New function. Fri Apr 7 13:01:35 2000 Joe Orton * neon.h: New file. Fri Apr 7 12:59:40 2000 Joe Orton * http_request.c (normalize_response_length, read_response_body): New functions. (http_add_response_body_reader): Take a callback to determine whether the body reader wants to read the response body. Fri Apr 7 11:46:41 2000 Joe Orton * http_request.c (http_set_server_auth, http_set_proxy_auth): New functions. (give_creds): Use supplied callbacks for authentication. (get_request_bodysize): Send Content-Length: 0 if no entity-body is being sent with a request. (te_hdr_handler, connection_hdr_handler): New functions. (make_request): Don't use Expect: 100-continue if server is not HTTP/1.1 compliant. (read_message_header): Only read until HTTP_MAXIMUM_HEADER_LENGTH bytes of header have been read. (read_response_headers): No hard-coded header handling. (http_request_create): Set req->method_is_head here. Thu Apr 6 14:39:28 2000 Joe Orton * hip_xml.c [HIP_XML_DECODE_UTF8] (decode_utf8_double): New function. (char_data) [HIP_XML_DECODE_UTF8]: Decode UTF-8. Tue Mar 28 13:54:51 2000 Joe Orton * Makefile.incl: Imported makefile fragment. Tue Mar 28 13:54:09 2000 Joe Orton * http_request.[ch] (http_get_error): New function. Thu Mar 23 18:48:42 2000 Joe Orton * hip_xml.[ch]: Imported generic XML parsing layer. * dav_207.[ch]: Imported generic WebDAV 207 response handling. * dav_basic.[ch]: Imported/implemented DAV response handling and basic Class 1 namespace methods. Thu Mar 23 18:46:14 2000 Joe Orton * http_request.c (add_hooks, run_hooks, http_add_destroy_hook): Adding hooks support. (add_fixed_headers): Send TE token in Connection header. Only send Keep-Alive header & token to pre-1.1 origin servers (i.e., not proxies). Thu Mar 23 12:49:01 2000 Joe Orton * http_auth.[ch], uri.[ch]: Imported HTTP authentication and URI handling modules. Thu Mar 23 12:47:05 2000 Joe Orton * http_utils.c: Imported HTTP utility functions. Thu Mar 23 12:44:38 2000 Joe Orton * http_request.[ch]: Implemented modular HTTP request handling. * http_basic.[ch]: Implemented basic HTTP methods GET, PUT, and PUT with If-Unmodified. cadaver-0.23.3/lib/neon/ne_gnutls.c0000664000076400007640000011633511305557331016511 0ustar jortonjorton/* neon SSL/TLS support using GNU TLS Copyright (C) 2002-2009, Joe Orton Copyright (C) 2004, Aleix Conchillo Flaque This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include #include #ifdef NE_HAVE_TS_SSL #include #include #include GCRY_THREAD_OPTION_PTHREAD_IMPL; #else #include #endif #ifdef HAVE_ICONV #include #endif #include "ne_ssl.h" #include "ne_string.h" #include "ne_session.h" #include "ne_internal.h" #include "ne_private.h" #include "ne_privssl.h" #if LIBGNUTLS_VERSION_NUMBER >= 0x020302 /* The GnuTLS DN functions in 2.3.2 and later allow a simpler DN * abstraction to be used. */ #define HAVE_NEW_DN_API #endif struct ne_ssl_dname_s { #ifdef HAVE_NEW_DN_API gnutls_x509_dn_t dn; #else int subject; /* non-zero if this is the subject DN object */ gnutls_x509_crt cert; #endif }; struct ne_ssl_certificate_s { ne_ssl_dname subj_dn, issuer_dn; gnutls_x509_crt subject; ne_ssl_certificate *issuer; char *identity; }; struct ne_ssl_client_cert_s { gnutls_pkcs12 p12; int decrypted; /* non-zero if successfully decrypted. */ int keyless; ne_ssl_certificate cert; gnutls_x509_privkey pkey; char *friendly_name; }; /* Returns the highest used index in subject (or issuer) DN of * certificate CERT for OID, or -1 if no RDNs are present in the DN * using that OID. */ static int oid_find_highest_index(gnutls_x509_crt cert, int subject, const char *oid) { int ret, idx = -1; do { size_t len = 0; if (subject) ret = gnutls_x509_crt_get_dn_by_oid(cert, oid, ++idx, 0, NULL, &len); else ret = gnutls_x509_crt_get_issuer_dn_by_oid(cert, oid, ++idx, 0, NULL, &len); } while (ret == GNUTLS_E_SHORT_MEMORY_BUFFER); return idx - 1; } #ifdef HAVE_GNUTLS_X509_DN_GET_RDN_AVA /* New-style RDN handling introduced in GnuTLS 1.7.x. */ #ifdef HAVE_ICONV static void convert_dirstring(ne_buffer *buf, const char *charset, gnutls_datum *data) { iconv_t id = iconv_open("UTF-8", charset); size_t inlen = data->size, outlen = buf->length - buf->used; char *inbuf = (char *)data->data; char *outbuf = buf->data + buf->used - 1; if (id == (iconv_t)-1) { char err[128], err2[128]; ne_snprintf(err, sizeof err, "[unprintable in %s: %s]", charset, ne_strerror(errno, err2, sizeof err2)); ne_buffer_zappend(buf, err); return; } ne_buffer_grow(buf, buf->used + 64); while (inlen && outlen && iconv(id, &inbuf, &inlen, &outbuf, &outlen) == 0) ; iconv_close(id); buf->used += buf->length - buf->used - outlen; buf->data[buf->used - 1] = '\0'; } #endif /* From section 11.13 of the Dubuisson ASN.1 bible: */ #define TAG_UTF8 (12) #define TAG_PRINTABLE (19) #define TAG_T61 (20) #define TAG_IA5 (22) #define TAG_VISIBLE (26) #define TAG_UNIVERSAL (28) #define TAG_BMP (30) static void append_dirstring(ne_buffer *buf, gnutls_datum *data, unsigned long tag) { switch (tag) { case TAG_UTF8: case TAG_IA5: case TAG_PRINTABLE: case TAG_VISIBLE: ne_buffer_append(buf, (char *)data->data, data->size); break; #ifdef HAVE_ICONV case TAG_T61: convert_dirstring(buf, "ISO-8859-1", data); break; case TAG_BMP: convert_dirstring(buf, "UCS-2BE", data); break; #endif default: { char tmp[128]; ne_snprintf(tmp, sizeof tmp, _("[unprintable:#%lu]"), tag); ne_buffer_zappend(buf, tmp); } break; } } /* OIDs to not include in readable DNs by default: */ #define OID_emailAddress "1.2.840.113549.1.9.1" #define OID_commonName "2.5.4.3" #define CMPOID(a,o) ((a)->oid.size == sizeof(o) \ && memcmp((a)->oid.data, o, strlen(o)) == 0) char *ne_ssl_readable_dname(const ne_ssl_dname *name) { gnutls_x509_dn_t dn; int ret, rdn = 0, flag = 0; ne_buffer *buf; gnutls_x509_ava_st val; #ifdef HAVE_NEW_DN_API dn = name->dn; #else if (name->subject) ret = gnutls_x509_crt_get_subject(name->cert, &dn); else ret = gnutls_x509_crt_get_issuer(name->cert, &dn); if (ret) return ne_strdup(_("[unprintable]")); #endif /* HAVE_NEW_DN_API */ buf = ne_buffer_create(); /* Find the highest rdn... */ while (gnutls_x509_dn_get_rdn_ava(dn, rdn++, 0, &val) == 0) ; /* ..then iterate back to the first: */ while (--rdn >= 0) { int ava = 0; /* Iterate through all AVAs for multivalued AVAs; better than * ne_openssl can do! */ do { ret = gnutls_x509_dn_get_rdn_ava(dn, rdn, ava, &val); /* If the *only* attribute to append is the common name or * email address, use it; otherwise skip those * attributes. */ if (ret == 0 && val.value.size > 0 && ((!CMPOID(&val, OID_emailAddress) && !CMPOID(&val, OID_commonName)) || (buf->used == 1 && rdn == 0))) { flag = 1; if (buf->used > 1) ne_buffer_append(buf, ", ", 2); append_dirstring(buf, &val.value, val.value_tag); } ava++; } while (ret == 0); } return ne_buffer_finish(buf); } #else /* !HAVE_GNUTLS_X509_DN_GET_RDN_AVA */ /* Appends the value of RDN with given oid from certitifcate x5 * subject (if subject is non-zero), or issuer DN to buffer 'buf': */ static void append_rdn(ne_buffer *buf, gnutls_x509_crt x5, int subject, const char *oid) { int idx, top, ret; char rdn[50]; top = oid_find_highest_index(x5, subject, oid); for (idx = top; idx >= 0; idx--) { size_t rdnlen = sizeof rdn; if (subject) ret = gnutls_x509_crt_get_dn_by_oid(x5, oid, idx, 0, rdn, &rdnlen); else ret = gnutls_x509_crt_get_issuer_dn_by_oid(x5, oid, idx, 0, rdn, &rdnlen); if (ret < 0) return; if (buf->used > 1) { ne_buffer_append(buf, ", ", 2); } ne_buffer_append(buf, rdn, rdnlen); } } char *ne_ssl_readable_dname(const ne_ssl_dname *name) { ne_buffer *buf = ne_buffer_create(); int ret, idx = 0; do { char oid[32] = {0}; size_t oidlen = sizeof oid; ret = name->subject ? gnutls_x509_crt_get_dn_oid(name->cert, idx, oid, &oidlen) : gnutls_x509_crt_get_issuer_dn_oid(name->cert, idx, oid, &oidlen); if (ret == 0) { append_rdn(buf, name->cert, name->subject, oid); idx++; } } while (ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE); return ne_buffer_finish(buf); } #endif /* HAVE_GNUTLS_X509_DN_GET_RDN_AVA */ int ne_ssl_dname_cmp(const ne_ssl_dname *dn1, const ne_ssl_dname *dn2) { char c1[1024], c2[1024]; size_t s1 = sizeof c1, s2 = sizeof c2; #ifdef HAVE_NEW_DN_API if (gnutls_x509_dn_export(dn1->dn, GNUTLS_X509_FMT_DER, c1, &s1)) return 1; if (gnutls_x509_dn_export(dn2->dn, GNUTLS_X509_FMT_DER, c2, &s2)) return -1; #else int ret; if (dn1->subject) ret = gnutls_x509_crt_get_dn(dn1->cert, c1, &s1); else ret = gnutls_x509_crt_get_issuer_dn(dn1->cert, c1, &s1); if (ret) return 1; if (dn2->subject) ret = gnutls_x509_crt_get_dn(dn2->cert, c2, &s2); else ret = gnutls_x509_crt_get_issuer_dn(dn2->cert, c2, &s2); if (ret) return -1; #endif /* HAVE_NEW_DN_API */ if (s1 != s2) return s2 - s1; return memcmp(c1, c2, s1); } void ne_ssl_clicert_free(ne_ssl_client_cert *cc) { if (cc->p12) gnutls_pkcs12_deinit(cc->p12); if (cc->decrypted) { if (cc->cert.identity) ne_free(cc->cert.identity); if (cc->pkey) gnutls_x509_privkey_deinit(cc->pkey); if (cc->cert.subject) gnutls_x509_crt_deinit(cc->cert.subject); } if (cc->friendly_name) ne_free(cc->friendly_name); ne_free(cc); } void ne_ssl_cert_validity_time(const ne_ssl_certificate *cert, time_t *from, time_t *until) { if (from) { *from = gnutls_x509_crt_get_activation_time(cert->subject); } if (until) { *until = gnutls_x509_crt_get_expiration_time(cert->subject); } } /* Check certificate identity. Returns zero if identity matches; 1 if * identity does not match, or <0 if the certificate had no identity. * If 'identity' is non-NULL, store the malloc-allocated identity in * *identity. If 'server' is non-NULL, it must be the network address * of the server in use, and identity must be NULL. */ static int check_identity(const ne_uri *server, gnutls_x509_crt cert, char **identity) { char name[255]; unsigned int critical; int ret, seq = 0; int match = 0, found = 0; size_t len; const char *hostname; hostname = server ? server->host : ""; do { len = sizeof name - 1; ret = gnutls_x509_crt_get_subject_alt_name(cert, seq, name, &len, &critical); switch (ret) { case GNUTLS_SAN_DNSNAME: name[len] = '\0'; if (identity && !found) *identity = ne_strdup(name); match = ne__ssl_match_hostname(name, len, hostname); found = 1; break; case GNUTLS_SAN_IPADDRESS: { ne_inet_addr *ia; if (len == 4) ia = ne_iaddr_make(ne_iaddr_ipv4, (unsigned char *)name); else if (len == 16) ia = ne_iaddr_make(ne_iaddr_ipv6, (unsigned char *)name); else ia = NULL; if (ia) { char buf[128]; match = strcmp(hostname, ne_iaddr_print(ia, buf, sizeof buf)) == 0; if (identity) *identity = ne_strdup(buf); found = 1; ne_iaddr_free(ia); } else { NE_DEBUG(NE_DBG_SSL, "iPAddress name with unsupported " "address type (length %" NE_FMT_SIZE_T "), skipped.\n", len); } } break; case GNUTLS_SAN_URI: { ne_uri uri; name[len] = '\0'; if (ne_uri_parse(name, &uri) == 0 && uri.host && uri.scheme) { ne_uri tmp; if (identity && !found) *identity = ne_strdup(name); found = 1; if (server) { /* For comparison purposes, all that matters is * host, scheme and port; ignore the rest. */ memset(&tmp, 0, sizeof tmp); tmp.host = uri.host; tmp.scheme = uri.scheme; tmp.port = uri.port; match = ne_uri_cmp(server, &tmp) == 0; } } ne_uri_free(&uri); } break; default: break; } seq++; } while (!match && ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE); /* Check against the commonName if no DNS alt. names were found, * as per RFC3280. */ if (!found) { seq = oid_find_highest_index(cert, 1, GNUTLS_OID_X520_COMMON_NAME); if (seq >= 0) { len = sizeof name; name[0] = '\0'; ret = gnutls_x509_crt_get_dn_by_oid(cert, GNUTLS_OID_X520_COMMON_NAME, seq, 0, name, &len); if (ret == 0) { if (identity) *identity = ne_strdup(name); match = ne__ssl_match_hostname(name, len, hostname); } } else { return -1; } } if (*hostname) NE_DEBUG(NE_DBG_SSL, "ssl: Identity match for '%s': %s\n", hostname, match ? "good" : "bad"); return match ? 0 : 1; } /* Populate an ne_ssl_certificate structure from an X509 object. Note * that x5 is owned by returned cert object and must not be otherwise * freed by the caller. */ static ne_ssl_certificate *populate_cert(ne_ssl_certificate *cert, gnutls_x509_crt x5) { #ifdef HAVE_NEW_DN_API gnutls_x509_crt_get_subject(x5, &cert->subj_dn.dn); gnutls_x509_crt_get_issuer(x5, &cert->issuer_dn.dn); #else cert->subj_dn.cert = x5; cert->subj_dn.subject = 1; cert->issuer_dn.cert = x5; cert->issuer_dn.subject = 0; #endif cert->issuer = NULL; cert->subject = x5; cert->identity = NULL; check_identity(NULL, x5, &cert->identity); return cert; } /* Returns a copy certificate of certificate SRC. */ static gnutls_x509_crt x509_crt_copy(gnutls_x509_crt src) { int ret; size_t size; gnutls_datum tmp; gnutls_x509_crt dest; if (gnutls_x509_crt_init(&dest) != 0) { return NULL; } if (gnutls_x509_crt_export(src, GNUTLS_X509_FMT_DER, NULL, &size) != GNUTLS_E_SHORT_MEMORY_BUFFER) { gnutls_x509_crt_deinit(dest); return NULL; } tmp.data = ne_malloc(size); ret = gnutls_x509_crt_export(src, GNUTLS_X509_FMT_DER, tmp.data, &size); if (ret == 0) { tmp.size = size; ret = gnutls_x509_crt_import(dest, &tmp, GNUTLS_X509_FMT_DER); } if (ret) { gnutls_x509_crt_deinit(dest); dest = NULL; } ne_free(tmp.data); return dest; } /* Duplicate a client certificate, which must be in the decrypted state. */ static ne_ssl_client_cert *dup_client_cert(const ne_ssl_client_cert *cc) { int ret; ne_ssl_client_cert *newcc = ne_calloc(sizeof *newcc); newcc->decrypted = 1; if (cc->keyless) { newcc->keyless = 1; } else { ret = gnutls_x509_privkey_init(&newcc->pkey); if (ret != 0) goto dup_error; ret = gnutls_x509_privkey_cpy(newcc->pkey, cc->pkey); if (ret != 0) goto dup_error; } newcc->cert.subject = x509_crt_copy(cc->cert.subject); if (!newcc->cert.subject) goto dup_error; if (cc->friendly_name) newcc->friendly_name = ne_strdup(cc->friendly_name); populate_cert(&newcc->cert, newcc->cert.subject); return newcc; dup_error: if (newcc->pkey) gnutls_x509_privkey_deinit(newcc->pkey); if (newcc->cert.subject) gnutls_x509_crt_deinit(newcc->cert.subject); ne_free(newcc); return NULL; } /* Callback invoked when the SSL server requests a client certificate. */ static int provide_client_cert(gnutls_session session, const gnutls_datum *req_ca_rdn, int nreqs, const gnutls_pk_algorithm *sign_algos, int sign_algos_length, gnutls_retr_st *st) { ne_session *sess = gnutls_session_get_ptr(session); if (!sess) { return GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER; } NE_DEBUG(NE_DBG_SSL, "ssl: Client cert provider callback; %d CA names.\n", nreqs); if (!sess->client_cert && sess->ssl_provide_fn) { #ifdef HAVE_NEW_DN_API const ne_ssl_dname **dns; ne_ssl_dname *dnarray; unsigned dncount = 0; int n; dns = ne_malloc(nreqs * sizeof(ne_ssl_dname *)); dnarray = ne_calloc(nreqs * sizeof(ne_ssl_dname)); for (n = 0; n < nreqs; n++) { gnutls_x509_dn_t dn; if (gnutls_x509_dn_init(&dn) == 0) { dnarray[n].dn = dn; if (gnutls_x509_dn_import(dn, &req_ca_rdn[n]) == 0) { dns[dncount++] = &dnarray[n]; } else { gnutls_x509_dn_deinit(dn); } } } NE_DEBUG(NE_DBG_SSL, "ssl: Mapped %d CA names to %u DN objects.\n", nreqs, dncount); sess->ssl_provide_fn(sess->ssl_provide_ud, sess, dns, dncount); for (n = 0; n < nreqs; n++) { if (dnarray[n].dn) { gnutls_x509_dn_deinit(dnarray[n].dn); } } ne_free(dns); ne_free(dnarray); #else /* HAVE_NEW_DN_API */ /* Nothing to do here other than pretend no CA names were * given, and hope the caller can cope. */ sess->ssl_provide_fn(sess->ssl_provide_ud, sess, NULL, 0); #endif } if (sess->client_cert) { gnutls_certificate_type type = gnutls_certificate_type_get(session); if (type == GNUTLS_CRT_X509) { NE_DEBUG(NE_DBG_SSL, "Supplying client certificate.\n"); st->type = type; st->ncerts = 1; st->cert.x509 = &sess->client_cert->cert.subject; st->key.x509 = sess->client_cert->pkey; /* tell GNU TLS not to deallocate the certs. */ st->deinit_all = 0; } else { return GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE; } } else { NE_DEBUG(NE_DBG_SSL, "No client certificate supplied.\n"); sess->ssl_cc_requested = 1; return GNUTLS_E_NO_CERTIFICATE_FOUND; } return 0; } void ne_ssl_set_clicert(ne_session *sess, const ne_ssl_client_cert *cc) { sess->client_cert = dup_client_cert(cc); } ne_ssl_context *ne_ssl_context_create(int flags) { ne_ssl_context *ctx = ne_calloc(sizeof *ctx); gnutls_certificate_allocate_credentials(&ctx->cred); if (flags == NE_SSL_CTX_CLIENT) { gnutls_certificate_client_set_retrieve_function(ctx->cred, provide_client_cert); } gnutls_certificate_set_verify_flags(ctx->cred, GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT); return ctx; } int ne_ssl_context_keypair(ne_ssl_context *ctx, const char *cert, const char *key) { gnutls_certificate_set_x509_key_file(ctx->cred, cert, key, GNUTLS_X509_FMT_PEM); return 0; } int ne_ssl_context_set_verify(ne_ssl_context *ctx, int required, const char *ca_names, const char *verify_cas) { ctx->verify = required; if (verify_cas) { gnutls_certificate_set_x509_trust_file(ctx->cred, verify_cas, GNUTLS_X509_FMT_PEM); } /* gnutls_certificate_send_x509_rdn_sequence in gnutls >= 1.2 can * be used to *suppress* sending the CA names, but not control it, * it seems. */ return 0; } void ne_ssl_context_set_flag(ne_ssl_context *ctx, int flag, int value) { /* SSLv2 not supported. */ } void ne_ssl_context_destroy(ne_ssl_context *ctx) { gnutls_certificate_free_credentials(ctx->cred); if (ctx->cache.client.data) { ne_free(ctx->cache.client.data); } else if (ctx->cache.server.key.data) { gnutls_free(ctx->cache.server.key.data); gnutls_free(ctx->cache.server.data.data); } ne_free(ctx); } #ifdef HAVE_GNUTLS_CERTIFICATE_GET_X509_CAS /* Return the issuer of the given certificate, or NULL if none can be * found. */ static gnutls_x509_crt find_issuer(gnutls_x509_crt *ca_list, unsigned int num_cas, gnutls_x509_crt cert) { unsigned int n; for (n = 0; n < num_cas; n++) { if (gnutls_x509_crt_check_issuer(cert, ca_list[n]) == 1) return ca_list[n]; } return NULL; } #endif /* Return the certificate chain sent by the peer, or NULL on error. */ static ne_ssl_certificate *make_peers_chain(gnutls_session sock, gnutls_certificate_credentials crd) { ne_ssl_certificate *current = NULL, *top = NULL; const gnutls_datum *certs; unsigned int n, count; ne_ssl_certificate *cert; certs = gnutls_certificate_get_peers(sock, &count); if (!certs) { return NULL; } NE_DEBUG(NE_DBG_SSL, "ssl: Got %u certs in peer chain.\n", count); for (n = 0; n < count; n++) { gnutls_x509_crt x5; if (gnutls_x509_crt_init(&x5) || gnutls_x509_crt_import(x5, &certs[n], GNUTLS_X509_FMT_DER)) { if (top) { ne_ssl_cert_free(top); } return NULL; } cert = populate_cert(ne_calloc(sizeof *cert), x5); if (top == NULL) { current = top = cert; } else { current->issuer = cert; current = cert; } } #ifdef HAVE_GNUTLS_CERTIFICATE_GET_X509_CAS /* GnuTLS only returns the peers which were *sent* by the server * in the Certificate list during the handshake. Fill in the * complete chain manually against the certs we trust: */ if (current->issuer == NULL) { gnutls_x509_crt issuer; gnutls_x509_crt *ca_list; unsigned int num_cas; gnutls_certificate_get_x509_cas(crd, &ca_list, &num_cas); do { /* Look up the issuer. */ issuer = find_issuer(ca_list, num_cas, current->subject); if (issuer) { issuer = x509_crt_copy(issuer); cert = populate_cert(ne_calloc(sizeof *cert), issuer); /* Check that the issuer does not match the current * cert. */ if (ne_ssl_cert_cmp(current, cert)) { current = current->issuer = cert; } else { ne_ssl_cert_free(cert); issuer = NULL; } } } while (issuer); } #endif return top; } /* Map from GnuTLS verify failure mask *status to NE_SSL_* failure * bitmask, which is returned. *status is modified, removing all * mapped bits. */ static int map_verify_failures(unsigned int *status) { static const struct { gnutls_certificate_status_t from; int to; } map[] = { { GNUTLS_CERT_REVOKED, NE_SSL_REVOKED }, #if LIBGNUTLS_VERSION_NUMBER >= 0x020800 { GNUTLS_CERT_NOT_ACTIVATED, NE_SSL_NOTYETVALID }, { GNUTLS_CERT_EXPIRED, NE_SSL_EXPIRED }, #endif { GNUTLS_CERT_INVALID|GNUTLS_CERT_SIGNER_NOT_FOUND, NE_SSL_UNTRUSTED }, { GNUTLS_CERT_INVALID|GNUTLS_CERT_SIGNER_NOT_CA, NE_SSL_UNTRUSTED } }; size_t n; int ret = 0; for (n = 0; n < sizeof(map)/sizeof(map[0]); n++) { if ((*status & map[n].from) == map[n].from) { *status &= ~map[n].from; ret |= map[n].to; } } return ret; } /* Return a malloc-allocated human-readable error string describing * GnuTLS verification error bitmask 'status'; return value must be * freed by the caller. */ static char *verify_error_string(unsigned int status) { ne_buffer *buf = ne_buffer_create(); /* sorry, i18n-ers */ if (status & GNUTLS_CERT_INSECURE_ALGORITHM) { ne_buffer_zappend(buf, _("signed using insecure algorithm")); } else { ne_buffer_snprintf(buf, 64, _("unrecognized errors (%u)"), status); } return ne_buffer_finish(buf); } /* Return NE_SSL_* failure bits after checking chain expiry. */ static int check_chain_expiry(ne_ssl_certificate *chain) { time_t before, after, now = time(NULL); ne_ssl_certificate *cert; int failures = 0; /* Check that all certs within the chain are inside their defined * validity period. Note that the errors flagged for the server * cert are different from the generic error for issues higher up * the chain. */ for (cert = chain; cert; cert = cert->issuer) { before = gnutls_x509_crt_get_activation_time(cert->subject); after = gnutls_x509_crt_get_expiration_time(cert->subject); if (now < before) failures |= (cert == chain) ? NE_SSL_NOTYETVALID : NE_SSL_BADCHAIN; else if (now > after) failures |= (cert == chain) ? NE_SSL_EXPIRED : NE_SSL_BADCHAIN; } return failures; } /* Verifies an SSL server certificate. */ static int check_certificate(ne_session *sess, gnutls_session sock, ne_ssl_certificate *chain) { int ret, failures; ne_uri server; unsigned int status; memset(&server, 0, sizeof server); ne_fill_server_uri(sess, &server); ret = check_identity(&server, chain->subject, NULL); ne_uri_free(&server); if (ret < 0) { ne_set_error(sess, _("Server certificate was missing commonName " "attribute in subject name")); return NE_ERROR; } else if (ret > 0) { failures |= NE_SSL_IDMISMATCH; } failures |= check_chain_expiry(chain); ret = gnutls_certificate_verify_peers2(sock, &status); NE_DEBUG(NE_DBG_SSL, "ssl: Verify peers returned %d, status=%u\n", ret, status); if (ret != GNUTLS_E_SUCCESS) { ne_set_error(sess, _("Could not verify server certificate: %s"), gnutls_strerror(ret)); return NE_ERROR; } failures |= map_verify_failures(&status); NE_DEBUG(NE_DBG_SSL, "ssl: Verification failures = %d (status = %u).\n", failures, status); if (status && status != GNUTLS_CERT_INVALID) { char *errstr = verify_error_string(status); ne_set_error(sess, _("Certificate verification error: %s"), errstr); ne_free(errstr); return NE_ERROR; } if (failures == 0) { ret = NE_OK; } else { ne__ssl_set_verify_err(sess, failures); ret = NE_ERROR; if (sess->ssl_verify_fn && sess->ssl_verify_fn(sess->ssl_verify_ud, failures, chain) == 0) ret = NE_OK; } return ret; } /* Negotiate an SSL connection. */ int ne__negotiate_ssl(ne_session *sess) { ne_ssl_context *const ctx = sess->ssl_context; ne_ssl_certificate *chain; gnutls_session sock; NE_DEBUG(NE_DBG_SSL, "Negotiating SSL connection.\n"); /* Pass through the hostname if SNI is enabled. */ ctx->hostname = sess->flags[NE_SESSFLAG_TLS_SNI] ? sess->server.hostname : NULL; if (ne_sock_connect_ssl(sess->socket, ctx, sess)) { if (sess->ssl_cc_requested) { ne_set_error(sess, _("SSL handshake failed, " "client certificate was requested: %s"), ne_sock_error(sess->socket)); } else { ne_set_error(sess, _("SSL handshake failed: %s"), ne_sock_error(sess->socket)); } return NE_ERROR; } sock = ne__sock_sslsock(sess->socket); chain = make_peers_chain(sock, ctx->cred); if (chain == NULL) { ne_set_error(sess, _("Server did not send certificate chain")); return NE_ERROR; } if (sess->server_cert && ne_ssl_cert_cmp(sess->server_cert, chain) == 0) { /* Same cert as last time; presume OK. This is not optimal as * make_peers_chain() has already gone through and done the * expensive DER parsing stuff for the whole chain by now. */ ne_ssl_cert_free(chain); return NE_OK; } if (check_certificate(sess, sock, chain)) { ne_ssl_cert_free(chain); return NE_ERROR; } sess->server_cert = chain; return NE_OK; } const ne_ssl_dname *ne_ssl_cert_issuer(const ne_ssl_certificate *cert) { return &cert->issuer_dn; } const ne_ssl_dname *ne_ssl_cert_subject(const ne_ssl_certificate *cert) { return &cert->subj_dn; } const ne_ssl_certificate *ne_ssl_cert_signedby(const ne_ssl_certificate *cert) { return cert->issuer; } const char *ne_ssl_cert_identity(const ne_ssl_certificate *cert) { return cert->identity; } void ne_ssl_context_trustcert(ne_ssl_context *ctx, const ne_ssl_certificate *cert) { gnutls_x509_crt certs = cert->subject; gnutls_certificate_set_x509_trust(ctx->cred, &certs, 1); } void ne_ssl_trust_default_ca(ne_session *sess) { #ifdef NE_SSL_CA_BUNDLE gnutls_certificate_set_x509_trust_file(sess->ssl_context->cred, NE_SSL_CA_BUNDLE, GNUTLS_X509_FMT_PEM); #endif } /* Read the contents of file FILENAME into *DATUM. */ static int read_to_datum(const char *filename, gnutls_datum *datum) { FILE *f = fopen(filename, "r"); ne_buffer *buf; char tmp[4192]; size_t len; if (!f) { return -1; } buf = ne_buffer_ncreate(8192); while ((len = fread(tmp, 1, sizeof tmp, f)) > 0) { ne_buffer_append(buf, tmp, len); } if (!feof(f)) { fclose(f); ne_buffer_destroy(buf); return -1; } fclose(f); datum->size = ne_buffer_size(buf); datum->data = (unsigned char *)ne_buffer_finish(buf); return 0; } /* Parses a PKCS#12 structure and loads the certificate, private key * and friendly name if possible. Returns zero on success, non-zero * on error. */ static int pkcs12_parse(gnutls_pkcs12 p12, gnutls_x509_privkey *pkey, gnutls_x509_crt *x5, char **friendly_name, const char *password) { gnutls_pkcs12_bag bag = NULL; int i, j, ret = 0; for (i = 0; ret == 0; ++i) { if (bag) gnutls_pkcs12_bag_deinit(bag); ret = gnutls_pkcs12_bag_init(&bag); if (ret < 0) continue; ret = gnutls_pkcs12_get_bag(p12, i, bag); if (ret < 0) continue; gnutls_pkcs12_bag_decrypt(bag, password); for (j = 0; ret == 0 && j < gnutls_pkcs12_bag_get_count(bag); ++j) { gnutls_pkcs12_bag_type type; gnutls_datum data; if (friendly_name && *friendly_name == NULL) { char *name = NULL; gnutls_pkcs12_bag_get_friendly_name(bag, j, &name); if (name) { if (name[0] == '.') name++; /* weird GnuTLS bug? */ *friendly_name = ne_strdup(name); } } type = gnutls_pkcs12_bag_get_type(bag, j); switch (type) { case GNUTLS_BAG_PKCS8_KEY: case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: /* Ignore any but the first key encountered; really * need to match up keyids. */ if (*pkey) break; gnutls_x509_privkey_init(pkey); ret = gnutls_pkcs12_bag_get_data(bag, j, &data); if (ret < 0) continue; ret = gnutls_x509_privkey_import_pkcs8(*pkey, &data, GNUTLS_X509_FMT_DER, password, 0); if (ret < 0) continue; break; case GNUTLS_BAG_CERTIFICATE: /* Ignore any but the first cert encountered; again, * really need to match up keyids. */ if (*x5) break; gnutls_x509_crt_init(x5); ret = gnutls_pkcs12_bag_get_data(bag, j, &data); if (ret < 0) continue; ret = gnutls_x509_crt_import(*x5, &data, GNUTLS_X509_FMT_DER); if (ret < 0) continue; break; default: break; } } } /* Make sure last bag is freed */ if (bag) gnutls_pkcs12_bag_deinit(bag); /* Free in case of error */ if (ret < 0 && ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { if (*x5) gnutls_x509_crt_deinit(*x5); if (*pkey) gnutls_x509_privkey_deinit(*pkey); if (friendly_name && *friendly_name) ne_free(*friendly_name); } if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) ret = 0; return ret; } ne_ssl_client_cert *ne_ssl_clicert_read(const char *filename) { int ret; gnutls_datum data; gnutls_pkcs12 p12; ne_ssl_client_cert *cc; char *friendly_name = NULL; gnutls_x509_crt cert = NULL; gnutls_x509_privkey pkey = NULL; if (read_to_datum(filename, &data)) return NULL; if (gnutls_pkcs12_init(&p12) != 0) { return NULL; } ret = gnutls_pkcs12_import(p12, &data, GNUTLS_X509_FMT_DER, 0); ne_free(data.data); if (ret < 0) { gnutls_pkcs12_deinit(p12); return NULL; } if (gnutls_pkcs12_verify_mac(p12, "") == 0) { if (pkcs12_parse(p12, &pkey, &cert, &friendly_name, "") != 0 || !cert || !pkey) { gnutls_pkcs12_deinit(p12); return NULL; } cc = ne_calloc(sizeof *cc); cc->pkey = pkey; cc->decrypted = 1; cc->friendly_name = friendly_name; populate_cert(&cc->cert, cert); gnutls_pkcs12_deinit(p12); cc->p12 = NULL; return cc; } else { /* TODO: calling pkcs12_parse() here to find the friendly_name * seems to break horribly. */ cc = ne_calloc(sizeof *cc); cc->p12 = p12; return cc; } } ne_ssl_client_cert *ne__ssl_clicert_exkey_import(const unsigned char *der, size_t der_len) { ne_ssl_client_cert *cc; gnutls_x509_crt x5; gnutls_datum datum; datum.data = (unsigned char *)der; datum.size = der_len; if (gnutls_x509_crt_init(&x5) || gnutls_x509_crt_import(x5, &datum, GNUTLS_X509_FMT_DER)) { NE_DEBUG(NE_DBG_SSL, "ssl: crt_import failed.\n"); return NULL; } cc = ne_calloc(sizeof *cc); cc->keyless = 1; cc->decrypted = 1; populate_cert(&cc->cert, x5); return cc; } int ne_ssl_clicert_encrypted(const ne_ssl_client_cert *cc) { return !cc->decrypted; } int ne_ssl_clicert_decrypt(ne_ssl_client_cert *cc, const char *password) { int ret; gnutls_x509_crt cert = NULL; gnutls_x509_privkey pkey = NULL; if (gnutls_pkcs12_verify_mac(cc->p12, password) != 0) { return -1; } ret = pkcs12_parse(cc->p12, &pkey, &cert, NULL, password); if (ret < 0) return ret; if (!cert || (!pkey && !cc->keyless)) { if (cert) gnutls_x509_crt_deinit(cert); if (pkey) gnutls_x509_privkey_deinit(pkey); return -1; } gnutls_pkcs12_deinit(cc->p12); populate_cert(&cc->cert, cert); cc->pkey = pkey; cc->decrypted = 1; cc->p12 = NULL; return 0; } const ne_ssl_certificate *ne_ssl_clicert_owner(const ne_ssl_client_cert *cc) { return &cc->cert; } const char *ne_ssl_clicert_name(const ne_ssl_client_cert *ccert) { return ccert->friendly_name; } ne_ssl_certificate *ne_ssl_cert_read(const char *filename) { int ret; gnutls_datum data; gnutls_x509_crt x5; if (read_to_datum(filename, &data)) return NULL; if (gnutls_x509_crt_init(&x5) != 0) return NULL; ret = gnutls_x509_crt_import(x5, &data, GNUTLS_X509_FMT_PEM); ne_free(data.data); if (ret < 0) { gnutls_x509_crt_deinit(x5); return NULL; } return populate_cert(ne_calloc(sizeof(struct ne_ssl_certificate_s)), x5); } int ne_ssl_cert_write(const ne_ssl_certificate *cert, const char *filename) { unsigned char buffer[10*1024]; size_t len = sizeof buffer; FILE *fp = fopen(filename, "w"); if (fp == NULL) return -1; if (gnutls_x509_crt_export(cert->subject, GNUTLS_X509_FMT_PEM, buffer, &len) < 0) { fclose(fp); return -1; } if (fwrite(buffer, len, 1, fp) != 1) { fclose(fp); return -1; } if (fclose(fp) != 0) return -1; return 0; } void ne_ssl_cert_free(ne_ssl_certificate *cert) { gnutls_x509_crt_deinit(cert->subject); if (cert->identity) ne_free(cert->identity); if (cert->issuer) ne_ssl_cert_free(cert->issuer); ne_free(cert); } int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, const ne_ssl_certificate *c2) { char digest1[NE_SSL_DIGESTLEN], digest2[NE_SSL_DIGESTLEN]; if (ne_ssl_cert_digest(c1, digest1) || ne_ssl_cert_digest(c2, digest2)) { return -1; } return strcmp(digest1, digest2); } /* The certificate import/export format is the base64 encoding of the * raw DER; PEM without the newlines and wrapping. */ ne_ssl_certificate *ne_ssl_cert_import(const char *data) { int ret; size_t len; unsigned char *der; gnutls_datum buffer = { NULL, 0 }; gnutls_x509_crt x5; if (gnutls_x509_crt_init(&x5) != 0) return NULL; /* decode the base64 to get the raw DER representation */ len = ne_unbase64(data, &der); if (len == 0) return NULL; buffer.data = der; buffer.size = len; ret = gnutls_x509_crt_import(x5, &buffer, GNUTLS_X509_FMT_DER); ne_free(der); if (ret < 0) { gnutls_x509_crt_deinit(x5); return NULL; } return populate_cert(ne_calloc(sizeof(struct ne_ssl_certificate_s)), x5); } char *ne_ssl_cert_export(const ne_ssl_certificate *cert) { unsigned char *der; size_t len = 0; char *ret; /* find the length of the DER encoding. */ if (gnutls_x509_crt_export(cert->subject, GNUTLS_X509_FMT_DER, NULL, &len) != GNUTLS_E_SHORT_MEMORY_BUFFER) { return NULL; } der = ne_malloc(len); if (gnutls_x509_crt_export(cert->subject, GNUTLS_X509_FMT_DER, der, &len)) { ne_free(der); return NULL; } ret = ne_base64(der, len); ne_free(der); return ret; } int ne_ssl_cert_digest(const ne_ssl_certificate *cert, char *digest) { char sha1[20], *p; int j; size_t len = sizeof sha1; if (gnutls_x509_crt_get_fingerprint(cert->subject, GNUTLS_DIG_SHA, sha1, &len) < 0) return -1; for (j = 0, p = digest; j < 20; j++) { *p++ = NE_HEX2ASC((sha1[j] >> 4) & 0x0f); *p++ = NE_HEX2ASC(sha1[j] & 0x0f); *p++ = ':'; } *--p = '\0'; return 0; } int ne__ssl_init(void) { #ifdef NE_HAVE_TS_SSL gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #endif gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0); return gnutls_global_init(); } void ne__ssl_exit(void) { /* No way to unregister the thread callbacks. Doomed. */ #if LIBGNUTLS_VERSION_MAJOR > 1 || LIBGNUTLS_VERSION_MINOR > 3 \ || (LIBGNUTLS_VERSION_MINOR == 3 && LIBGNUTLS_VERSION_PATCH >= 3) /* It's safe to call gnutls_global_deinit() here only with * gnutls >= 1.3., since older versions don't refcount and * doing so would prevent any other use of gnutls within * the process. */ gnutls_global_deinit(); #endif } cadaver-0.23.3/lib/neon/ne_private.h0000664000076400007640000001144411247475573016663 0ustar jortonjorton/* HTTP Request Handling Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* THIS IS NOT A PUBLIC INTERFACE. You CANNOT include this header file * from an application. */ #ifndef NE_PRIVATE_H #define NE_PRIVATE_H #include "ne_request.h" #include "ne_socket.h" #include "ne_ssl.h" struct host_info { /* Type of host represented: */ enum proxy_type { PROXY_NONE = 0, PROXY_HTTP, /* an HTTP proxy */ PROXY_SOCKS /* a SOCKS proxy */ } proxy; unsigned int port; /* If hostname is non-NULL, host is identified by this hostname. */ char *hostname, *hostport; /* If address is non-NULL, the result of resolving ->hostname. */ ne_sock_addr *address; /* If current non-NULL, current network address used in ->address. */ const ne_inet_addr *current; /* If override is non-NULL, the host is identified by this network * address. */ const ne_inet_addr *network; struct host_info *next; }; /* Store every registered callback in a generic container, and cast * the function pointer when calling it. */ struct hook { void (*fn)(void); void *userdata; const char *id; /* non-NULL for accessors. */ struct hook *next; }; #define HAVE_HOOK(st,func) (st->hook->hooks->func != NULL) #define HOOK_FUNC(st, func) (*st->hook->hooks->func) /* Session support. */ struct ne_session_s { /* Connection information */ ne_socket *socket; /* non-zero if connection has been established. */ int connected; /* non-zero if connection has persisted beyond one request. */ int persisted; int is_http11; /* >0 if connected server is known to be * HTTP/1.1 compliant. */ char *scheme; /* Server host details. */ struct host_info server; /* Proxy host details, or NULL if not using a proxy. */ struct host_info *proxies; /* Most recently used proxy server. */ struct host_info *prev_proxy; /* Pointer to the active .server or .proxies as appropriate: */ struct host_info *nexthop; /* Local address to which sockets should be bound. */ const ne_inet_addr *local_addr; /* Settings */ int use_ssl; /* whether a secure connection is required */ int in_connect; /* doing a proxy CONNECT */ int any_proxy_http; /* whether any configured proxy is an HTTP proxy */ enum ne_sock_sversion socks_ver; char *socks_user, *socks_password; int flags[NE_SESSFLAG_LAST]; ne_progress progress_cb; void *progress_ud; ne_notify_status notify_cb; void *notify_ud; int rdtimeout, cotimeout; /* read, connect timeouts. */ struct hook *create_req_hooks, *pre_send_hooks, *post_send_hooks, *post_headers_hooks, *destroy_req_hooks, *destroy_sess_hooks, *close_conn_hooks, *private; char *user_agent; /* full User-Agent: header field */ #ifdef NE_HAVE_SSL ne_ssl_client_cert *client_cert; ne_ssl_certificate *server_cert; ne_ssl_context *ssl_context; int ssl_cc_requested; /* set to non-zero if a client cert was * requested during initial handshake, but * none could be provided. */ #endif /* Server cert verification callback: */ ne_ssl_verify_fn ssl_verify_fn; void *ssl_verify_ud; /* Client cert provider callback: */ ne_ssl_provide_fn ssl_provide_fn; void *ssl_provide_ud; ne_session_status_info status; /* Error string */ char error[512]; }; /* Pushes block of 'count' bytes at 'buf'. Returns non-zero on * error. */ typedef int (*ne_push_fn)(void *userdata, const char *buf, size_t count); /* Do the SSL negotiation. */ NE_PRIVATE int ne__negotiate_ssl(ne_session *sess); /* Set the session error appropriate for SSL verification failures. */ NE_PRIVATE void ne__ssl_set_verify_err(ne_session *sess, int failures); /* Return non-zero if hostname from certificate (cn) matches hostname * used for session (hostname); follows RFC2818 logic. */ NE_PRIVATE int ne__ssl_match_hostname(const char *cn, size_t cnlen, const char *hostname); #endif /* HTTP_PRIVATE_H */ cadaver-0.23.3/lib/neon/ne_utils.c0000664000076400007640000001251510403252053016317 0ustar jortonjorton/* HTTP utility functions Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #include #include /* isdigit() for ne_parse_statusline */ #ifdef NE_HAVE_ZLIB #include #endif #ifdef HAVE_OPENSSL #include #endif #ifdef HAVE_GNUTLS #include #endif /* libxml2: pick up the version string. */ #if defined(HAVE_LIBXML) #include #elif defined(HAVE_EXPAT) && !defined(HAVE_XMLPARSE_H) #include #endif #include "ne_utils.h" #include "ne_string.h" /* for ne_strdup */ #include "ne_dates.h" int ne_debug_mask = 0; FILE *ne_debug_stream = NULL; void ne_debug_init(FILE *stream, int mask) { ne_debug_stream = stream; ne_debug_mask = mask; #if defined(HAVE_SETVBUF) && defined(_IONBF) /* If possible, turn off buffering on the debug log. this is very * helpful if debugging segfaults. */ if (stream) setvbuf(stream, NULL, _IONBF, 0); #endif } void ne_debug(int ch, const char *template, ...) { va_list params; if ((ch & ne_debug_mask) == 0) return; fflush(stdout); va_start(params, template); vfprintf(ne_debug_stream, template, params); va_end(params); if ((ch & NE_DBG_FLUSH) == NE_DBG_FLUSH) fflush(ne_debug_stream); } #define NE_STRINGIFY(x) # x #define NE_EXPAT_VER(x,y,z) NE_STRINGIFY(x) "." NE_STRINGIFY(y) "." NE_STRINGIFY(z) static const char version_string[] = "neon " NEON_VERSION ": " #ifdef NEON_IS_LIBRARY "Library build" #else "Bundled build" #endif #ifdef NE_HAVE_IPV6 ", IPv6" #endif #ifdef HAVE_EXPAT ", Expat" /* expat >=1.95.2 exported the version */ #ifdef XML_MAJOR_VERSION " " NE_EXPAT_VER(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION) #endif #else /* !HAVE_EXPAT */ #ifdef HAVE_LIBXML ", libxml " LIBXML_DOTTED_VERSION #endif /* HAVE_LIBXML */ #endif /* !HAVE_EXPAT */ #if defined(NE_HAVE_ZLIB) && defined(ZLIB_VERSION) ", zlib " ZLIB_VERSION #endif /* NE_HAVE_ZLIB && ... */ #ifdef NE_HAVE_SOCKS ", SOCKSv5" #endif #ifdef HAVE_OPENSSL #ifdef OPENSSL_VERSION_TEXT ", " OPENSSL_VERSION_TEXT #else "OpenSSL (unknown version)" #endif /* OPENSSL_VERSION_TEXT */ #endif /* HAVE_OPENSSL */ #ifdef HAVE_GNUTLS ", GNU TLS " LIBGNUTLS_VERSION #endif /* HAVE_GNUTLS */ "." ; const char *ne_version_string(void) { return version_string; } int ne_version_match(int major, int minor) { return NE_VERSION_MAJOR != major || NE_VERSION_MINOR < minor || (NE_VERSION_MAJOR == 0 && NE_VERSION_MINOR != minor); } int ne_has_support(int feature) { switch (feature) { #if defined(NE_HAVE_SSL) || defined(NE_HAVE_ZLIB) || defined(NE_HAVE_IPV6) \ || defined(NE_HAVE_SOCKS) || defined(NE_HAVE_LFS) \ || defined(NE_HAVE_TS_SSL) || defined(NE_HAVE_I18N) #ifdef NE_HAVE_SSL case NE_FEATURE_SSL: #endif #ifdef NE_HAVE_ZLIB case NE_FEATURE_ZLIB: #endif #ifdef NE_HAVE_IPV6 case NE_FEATURE_IPV6: #endif #ifdef NE_HAVE_SOCKS case NE_FEATURE_SOCKS: #endif #ifdef NE_HAVE_LFS case NE_FEATURE_LFS: #endif #ifdef NE_HAVE_TS_SSL case NE_FEATURE_TS_SSL: #endif #ifdef NE_HAVE_I18N case NE_FEATURE_I18N: #endif return 1; #endif /* NE_HAVE_* */ default: return 0; } } int ne_parse_statusline(const char *status_line, ne_status *st) { const char *part; int major, minor, status_code, klass; /* skip leading garbage if any. */ part = strstr(status_line, "HTTP/"); if (part == NULL) return -1; minor = major = 0; /* Parse version string, skipping leading zeroes. */ for (part += 5; *part != '\0' && isdigit(*part); part++) major = major*10 + (*part-'0'); if (*part++ != '.') return -1; for (;*part != '\0' && isdigit(*part); part++) minor = minor*10 + (*part-'0'); if (*part != ' ') return -1; /* Skip any spaces */ for (; *part == ' '; part++) /* noop */; /* Parse the Status-Code; part now points at the first Y in * "HTTP/x.x YYY". */ if (!isdigit(part[0]) || !isdigit(part[1]) || !isdigit(part[2]) || (part[3] != '\0' && part[3] != ' ')) return -1; status_code = 100*(part[0]-'0') + 10*(part[1]-'0') + (part[2]-'0'); klass = part[0]-'0'; /* Skip whitespace between status-code and reason-phrase */ for (part+=3; *part == ' ' || *part == '\t'; part++) /* noop */; /* part now may be pointing to \0 if reason phrase is blank */ /* Fill in the results */ st->major_version = major; st->minor_version = minor; st->reason_phrase = ne_strclean(ne_strdup(part)); st->code = status_code; st->klass = klass; return 0; } cadaver-0.23.3/lib/neon/ne_md5.h0000664000076400007640000000752010646613101015655 0ustar jortonjorton/* Declaration of functions and data types used for MD5 sum computing library functions. Copyright (C) 2006, Joe Orton Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef NE_MD5_H #define NE_MD5_H 1 #include #include "ne_defs.h" NE_BEGIN_DECLS /* * The following three functions are build up the low level used in * the functions `md5_stream' and `md5_buffer'. */ struct ne_md5_ctx; /* Create structure containing state of computation. */ extern struct ne_md5_ctx *ne_md5_create_ctx(void); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void ne_md5_process_block(const void *buffer, size_t len, struct ne_md5_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void ne_md5_process_bytes(const void *buffer, size_t len, struct ne_md5_ctx *ctx); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *ne_md5_finish_ctx(struct ne_md5_ctx *ctx, void *resbuf); /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *ne_md5_read_ctx(const struct ne_md5_ctx *ctx, void *resbuf); /* Take a copy of the state structure. */ extern struct ne_md5_ctx *ne_md5_dup_ctx(struct ne_md5_ctx *ctx); /* Re-initialize the context structure. */ extern void ne_md5_reset_ctx(struct ne_md5_ctx *ctx); /* Destroy the context structure. */ extern void ne_md5_destroy_ctx(struct ne_md5_ctx *ctx); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ extern int ne_md5_stream(FILE *stream, void *resblock); /* Process the remaining bytes in the buffer and put ASCII representation of the resulting message digest from CTX in the first 33 bytes of BUFFER, including a trailing NUL terminator byte. Returns pointer to buffer. */ char *ne_md5_finish_ascii(struct ne_md5_ctx *ctx, char buffer[33]); /* MD5 ascii->binary conversion */ void ne_md5_to_ascii(const unsigned char md5_buf[16], char *buffer); void ne_ascii_to_md5(const char *buffer, unsigned char md5_buf[16]); NE_END_DECLS #endif /* NE_MD5_H */ cadaver-0.23.3/lib/neon/ne_internal.h0000664000076400007640000000431310517466031017006 0ustar jortonjorton/* Global interfaces private to neon. Copyright (C) 2005-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* NOTE WELL: The interfaces defined in this file are internal to neon * and MUST NOT be used by neon-based applications. */ #ifndef NE_INTERNAL_H #define NE_INTERNAL_H 1 #include "config.h" #ifdef HAVE_SYS_LIMITS_H #include #endif #ifdef HAVE_LIMITS_H #include /* for UINT_MAX etc */ #endif #include "ne_defs.h" #undef _ #ifdef NE_HAVE_I18N #include #define _(str) dgettext(PACKAGE_NAME, str) #else #define _(str) (str) #endif /* NE_ENABLE_NLS */ #define N_(str) (str) #if !defined(LONG_LONG_MAX) && defined(LLONG_MAX) #define LONG_LONG_MAX LLONG_MAX #elif !defined(LONG_LONG_MAX) && defined(LONGLONG_MAX) #define LONG_LONG_MAX LONGLONG_MAX #endif #if defined(NE_LFS) #define ne_lseek lseek64 #define FMT_NE_OFF_T NE_FMT_OFF64_T #define NE_OFFT_MAX LONG_LONG_MAX #ifdef HAVE_STRTOLL #define ne_strtoff strtoll #else #define ne_strtoff strtoq #endif #else /* !NE_LFS */ #define ne_lseek lseek #define FMT_NE_OFF_T NE_FMT_OFF_T #if defined(SIZEOF_LONG_LONG) && defined(LONG_LONG_MAX) \ && SIZEOF_OFF_T == SIZEOF_LONG_LONG #define NE_OFFT_MAX LONG_LONG_MAX #else #define NE_OFFT_MAX LONG_MAX #endif #if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_STRTOLL) #define ne_strtoff strtoll #elif SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_STRTOQ) #define ne_strtoff strtoq #else #define ne_strtoff strtol #endif #endif /* NE_LFS */ #endif /* NE_INTERNAL_H */ cadaver-0.23.3/lib/neon/ne_md5.c0000664000076400007640000003321510725347163015662 0ustar jortonjorton/* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Ulrich Drepper , 1995. */ #include "config.h" #include #include #include #ifdef HAVE_LIMITS_H # include #endif #include "ne_md5.h" #include "ne_string.h" /* for NE_ASC2HEX */ #define md5_process_block ne_md5_process_block #define md5_process_bytes ne_md5_process_bytes #define md5_finish_ctx ne_md5_finish_ctx #define md5_read_ctx ne_md5_read_ctx #define md5_stream ne_md5_stream #define md5_ctx ne_md5_ctx #ifdef WORDS_BIGENDIAN # define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else # define SWAP(n) (n) #endif #if SIZEOF_INT == 4 typedef unsigned int md5_uint32; #elif SIZEOF_LONG == 4 typedef unsigned long md5_uint32; #else # error "Cannot determine unsigned 32-bit data type." #endif /* Structure to save state of computation between the single steps. */ struct md5_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128]; }; /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ static void md5_init_ctx (struct md5_ctx *ctx) { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } struct ne_md5_ctx * ne_md5_create_ctx(void) { struct md5_ctx *ctx = ne_malloc(sizeof *ctx); md5_init_ctx(ctx); return ctx; } extern void ne_md5_reset_ctx(struct ne_md5_ctx *ctx) { md5_init_ctx(ctx); } struct ne_md5_ctx * ne_md5_dup_ctx(struct ne_md5_ctx *ctx) { return memcpy(ne_malloc(sizeof *ctx), ctx, sizeof *ctx); } void ne_md5_destroy_ctx(struct ne_md5_ctx *ctx) { ne_free(ctx); } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) { ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); return md5_read_ctx (ctx, resbuf); } /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int md5_stream (FILE *stream, void *resblock) { /* Important: BLOCKSIZE must be a multiple of 64. */ #define BLOCKSIZE 4096 struct md5_ctx ctx; char buffer[BLOCKSIZE + 72]; size_t sum; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Iterate over full file contents. */ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ do { n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); sum += n; } while (sum < BLOCKSIZE && n != 0); if (n == 0 && ferror (stream)) return 1; /* If end of file is reached, end the loop. */ if (n == 0) break; /* Process buffer with BLOCKSIZE bytes. Note that BLOCKSIZE % 64 == 0 */ md5_process_block (buffer, BLOCKSIZE, &ctx); } /* Add the last bytes if necessary. */ if (sum > 0) md5_process_bytes (buffer, sum, &ctx); /* Construct result in desired memory. */ md5_finish_ctx (&ctx, resblock); return 0; } void md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; if (left_over + add > 64) { md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], (left_over + add) & 63); ctx->buflen = (left_over + add) & 63; } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ if (len > 64) { md5_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } /* Move remaining bytes in internal buffer. */ if (len > 0) { memcpy (ctx->buffer, buffer, len); ctx->buflen = len; } } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ /* #define FF(b, c, d) ((b & c) | (~b & d)) */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ void md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) { md5_uint32 correct_words[16]; const unsigned char *words = buffer; const unsigned char *endp = words + len; md5_uint32 A = ctx->A; md5_uint32 B = ctx->B; md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; md5_uint32 B_save = B; md5_uint32 C_save = C; md5_uint32 D_save = D; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s, T) \ do \ { \ md5_uint32 WORD_ = (md5_uint32)words[0] | ((md5_uint32)words[1] << 8) \ | ((md5_uint32)words[2] << 16) | ((md5_uint32)words[3] << 24); \ a += FF (b, c, d) + (*cwp++ = WORD_) + T; \ words += 4; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; ctx->D = D; } /* Writes the ASCII representation of the MD5 digest into the * given buffer, which must be at least 33 characters long. */ void ne_md5_to_ascii(const unsigned char md5_buf[16], char *buffer) { int count; for (count = 0; count<16; count++) { buffer[count*2] = NE_HEX2ASC(md5_buf[count] >> 4); buffer[count*2+1] = NE_HEX2ASC(md5_buf[count] & 0x0f); } buffer[32] = '\0'; } /* Reads the ASCII representation of an MD5 digest. The buffer must * be at least 32 characters long. */ void ne_ascii_to_md5(const char *buffer, unsigned char md5_buf[16]) { int count; for (count = 0; count<16; count++) { md5_buf[count] = ((NE_ASC2HEX(buffer[count*2])) << 4) | NE_ASC2HEX(buffer[count*2+1]); } } char *ne_md5_finish_ascii(struct ne_md5_ctx *ctx, char buffer[33]) { md5_uint32 result[4]; ne_md5_finish_ctx(ctx, (void *)result); ne_md5_to_ascii((void *)result, buffer); return buffer; } cadaver-0.23.3/lib/neon/ne_xml.h0000664000076400007640000001522610646621220015773 0ustar jortonjorton/* neon XML parser interface Copyright (C) 1999-2007, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_XML_H #define NE_XML_H #include /* for size_t */ #include "ne_defs.h" NE_BEGIN_DECLS /* The neon XML interface filters a streamed XML tree through a stack * of SAX "handlers". A handler is made up of three callbacks * (start-element, char-data, end-element). Each start-element event * is passed to each handler in the stack in turn until one until one * accepts the element. This handler then receives subsequent * char-data and end-element events for the element. * * For each new start-element event, the search up the handler stack * begins with the handler for the parent element (for the root * element, at the base of the stack). * * For each accepted element, a "state" integer is stored, which is * passed to the corresponding char-data and end-element callbacks for * the element. This integer is also passed to the start-element * callback of child elements so they can determine context. * * If no handler in the stack accepts a particular element, it (and * its children, if any) is ignored. */ #define NE_XML_DECLINE (0) #define NE_XML_ABORT (-1) /* A start-element callback for element with given namespace/name. * The callback may return: * <0 => abort the parse (NE_XML_ABORT) * 0 => decline this element (NE_XML_DECLINE) * >0 => accept this element; value is state for this element. * * The 'parent' integer is the state returned by the handler of the * parent element. The attributes array gives name/value pairs * in atts[n] and atts[n+1] from n=0 up to atts[n]==NULL. */ typedef int ne_xml_startelm_cb(void *userdata, int parent, const char *nspace, const char *name, const char **atts); /* state for the root element */ #define NE_XML_STATEROOT (0) /* Character data callback; may return non-zero to abort the parse. */ typedef int ne_xml_cdata_cb(void *userdata, int state, const char *cdata, size_t len); /* End element callback; may return non-zero to abort the parse. */ typedef int ne_xml_endelm_cb(void *userdata, int state, const char *nspace, const char *name); typedef struct ne_xml_parser_s ne_xml_parser; /* Create an XML parser. */ ne_xml_parser *ne_xml_create(void); /* Push a new handler on the stack of parser 'p'. 'cdata' and/or * 'endelm' may be NULL; startelm must be non-NULL. */ void ne_xml_push_handler(ne_xml_parser *p, ne_xml_startelm_cb *startelm, ne_xml_cdata_cb *cdata, ne_xml_endelm_cb *endelm, void *userdata); /* ne_xml_failed returns non-zero if there was an error during * parsing, or zero if the parse completed successfully. The return * value is equal to that of the last ne_xml_parse() call for this * parser object. */ int ne_xml_failed(ne_xml_parser *p); /* Set error string for parser. (The string may be truncated * internally). */ void ne_xml_set_error(ne_xml_parser *p, const char *msg); /* Return the error string (and never NULL). After ne_xml_failed * returns >0, this will describe the parse error. Otherwise it will * be a default error string. */ const char *ne_xml_get_error(ne_xml_parser *p); /* Parse the given block of input of length len. Parser must be * called with len=0 to signify the end of the document (for that * case, the block argument is ignored). Returns zero on success, or * non-zero on error: for an XML syntax error, a positive number is * returned; if parsing is aborted by a caller-supplied callback, that * callback's return value is returned. */ int ne_xml_parse(ne_xml_parser *p, const char *block, size_t len); /* As ne_xml_parse, casting (ne_xml_parser *)userdata internally. * (This function can be passed to ne_add_response_body_reader) */ int ne_xml_parse_v(void *userdata, const char *block, size_t len); /* Return current line of document during parsing or after parsing is * complete. */ int ne_xml_currentline(ne_xml_parser *p); /* From a start_element callback which was passed 'attrs' using given * parser, return attribute of given name and namespace. If nspace is * NULL, no namespace resolution is performed. Note that this call is * context-specific; if called outside a start_element callback, * behaviour is undefined. */ const char *ne_xml_get_attr(ne_xml_parser *parser, const char **attrs, const char *nspace, const char *name); /* From a start_element callback, resolve a given XML Namespace * prefix, if defined. Given a non-NULL prefix, returns the namespace * URI which corresponds to the prefix 'prefix' (of length 'length'), * or NULL if no such namespace prefix is defined. Given a NULL * prefix, returns the default namespace URI or the empty string if * none is defined. Note that this call is context-specific; if * called outside a start_element callback, behaviour is undefined. */ const char *ne_xml_resolve_nspace(ne_xml_parser *parser, const char *prefix, size_t length); /* Return the encoding of the document being parsed. May return NULL * if no encoding is defined or if the XML declaration has not yet * been parsed. */ const char *ne_xml_doc_encoding(const ne_xml_parser *p); /* Destroy the parser object. */ void ne_xml_destroy(ne_xml_parser *p); /* A utility interface for mapping {nspace, name} onto an integer. */ struct ne_xml_idmap { const char *nspace, *name; int id; }; /* Return the size of an idmap array */ #define NE_XML_MAPLEN(map) (sizeof(map) / sizeof(struct ne_xml_idmap)) /* Return the 'id' corresponding to {nspace, name}, or zero. */ int ne_xml_mapid(const struct ne_xml_idmap map[], size_t maplen, const char *nspace, const char *name); /* media type, appropriate for adding to a Content-Type header */ #define NE_XML_MEDIA_TYPE "application/xml" NE_END_DECLS #endif /* NE_XML_H */ cadaver-0.23.3/lib/neon/ne_session.c0000664000076400007640000004474111271032644016656 0ustar jortonjorton/* HTTP session handling Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_LIBPROXY #include #endif #include "ne_session.h" #include "ne_alloc.h" #include "ne_utils.h" #include "ne_internal.h" #include "ne_string.h" #include "ne_dates.h" #include "ne_private.h" /* Destroy a a list of hooks. */ static void destroy_hooks(struct hook *hooks) { struct hook *nexthk; while (hooks) { nexthk = hooks->next; ne_free(hooks); hooks = nexthk; } } static void free_hostinfo(struct host_info *hi) { if (hi->hostname) ne_free(hi->hostname); if (hi->hostport) ne_free(hi->hostport); if (hi->address) ne_addr_destroy(hi->address); } /* Destroy the sess->proxies array. */ static void free_proxies(ne_session *sess) { struct host_info *hi, *nexthi; for (hi = sess->proxies; hi; hi = nexthi) { nexthi = hi->next; free_hostinfo(hi); ne_free(hi); } sess->any_proxy_http = 0; } void ne_session_destroy(ne_session *sess) { struct hook *hk; NE_DEBUG(NE_DBG_HTTP, "sess: Destroying session.\n"); /* Run the destroy hooks. */ for (hk = sess->destroy_sess_hooks; hk != NULL; hk = hk->next) { ne_destroy_sess_fn fn = (ne_destroy_sess_fn)hk->fn; fn(hk->userdata); } /* Close the connection; note that the notifier callback could * still be invoked here. */ if (sess->connected) { ne_close_connection(sess); } destroy_hooks(sess->create_req_hooks); destroy_hooks(sess->pre_send_hooks); destroy_hooks(sess->post_headers_hooks); destroy_hooks(sess->post_send_hooks); destroy_hooks(sess->destroy_req_hooks); destroy_hooks(sess->destroy_sess_hooks); destroy_hooks(sess->close_conn_hooks); destroy_hooks(sess->private); ne_free(sess->scheme); free_hostinfo(&sess->server); free_proxies(sess); if (sess->user_agent) ne_free(sess->user_agent); if (sess->socks_user) ne_free(sess->socks_user); if (sess->socks_password) ne_free(sess->socks_password); #ifdef NE_HAVE_SSL if (sess->ssl_context) ne_ssl_context_destroy(sess->ssl_context); if (sess->server_cert) ne_ssl_cert_free(sess->server_cert); if (sess->client_cert) ne_ssl_clicert_free(sess->client_cert); #endif ne_free(sess); } int ne_version_pre_http11(ne_session *s) { return !s->is_http11; } /* Stores the "hostname[:port]" segment */ static void set_hostport(struct host_info *host, unsigned int defaultport) { size_t len = strlen(host->hostname); host->hostport = ne_malloc(len + 10); strcpy(host->hostport, host->hostname); if (host->port != defaultport) ne_snprintf(host->hostport + len, 9, ":%u", host->port); } /* Stores the hostname/port in *info, setting up the "hostport" * segment correctly. */ static void set_hostinfo(struct host_info *hi, enum proxy_type type, const char *hostname, unsigned int port) { hi->hostname = ne_strdup(hostname); hi->port = port; hi->proxy = type; } ne_session *ne_session_create(const char *scheme, const char *hostname, unsigned int port) { ne_session *sess = ne_calloc(sizeof *sess); NE_DEBUG(NE_DBG_HTTP, "HTTP session to %s://%s:%d begins.\n", scheme, hostname, port); strcpy(sess->error, "Unknown error."); /* use SSL if scheme is https */ sess->use_ssl = !strcmp(scheme, "https"); /* set the hostname/port */ set_hostinfo(&sess->server, PROXY_NONE, hostname, port); set_hostport(&sess->server, sess->use_ssl?443:80); #ifdef NE_HAVE_SSL if (sess->use_ssl) { ne_inet_addr *ia; sess->ssl_context = ne_ssl_context_create(0); sess->flags[NE_SESSFLAG_SSLv2] = 1; /* If the hostname parses as an IP address, don't * enable SNI by default. */ ia = ne_iaddr_parse(hostname, ne_iaddr_ipv4); if (ia == NULL) ia = ne_iaddr_parse(hostname, ne_iaddr_ipv6); if (ia) { sess->flags[NE_SESSFLAG_TLS_SNI] = 1; ne_iaddr_free(ia); } NE_DEBUG(NE_DBG_SSL, "ssl: SNI %s by default.\n", sess->flags[NE_SESSFLAG_TLS_SNI] ? "enabled" : "disabled"); } #endif sess->scheme = ne_strdup(scheme); /* Set flags which default to on: */ sess->flags[NE_SESSFLAG_PERSIST] = 1; return sess; } void ne_session_proxy(ne_session *sess, const char *hostname, unsigned int port) { free_proxies(sess); sess->proxies = ne_calloc(sizeof *sess->proxies); sess->any_proxy_http = 1; set_hostinfo(sess->proxies, PROXY_HTTP, hostname, port); } void ne_session_socks_proxy(ne_session *sess, enum ne_sock_sversion vers, const char *hostname, unsigned int port, const char *username, const char *password) { free_proxies(sess); sess->proxies = ne_calloc(sizeof *sess->proxies); set_hostinfo(sess->proxies, PROXY_SOCKS, hostname, port); sess->socks_ver = vers; if (username) sess->socks_user = ne_strdup(username); if (password) sess->socks_password = ne_strdup(password); } void ne_session_system_proxy(ne_session *sess, unsigned int flags) { #ifdef HAVE_LIBPROXY pxProxyFactory *pxf = px_proxy_factory_new(); struct host_info *hi, **lasthi; char *url, **proxies; ne_uri uri; unsigned n; free_proxies(sess); /* Create URI for session to pass off to libproxy */ memset(&uri, 0, sizeof uri); ne_fill_server_uri(sess, &uri); uri.path = "/"; /* make valid URI structure. */ url = ne_uri_unparse(&uri); uri.path = NULL; /* Get list of pseudo-URIs from libproxy: */ proxies = px_proxy_factory_get_proxies(pxf, url); for (n = 0, lasthi = &sess->proxies; proxies[n]; n++) { enum proxy_type ptype; ne_uri_free(&uri); NE_DEBUG(NE_DBG_HTTP, "sess: libproxy #%u=%s\n", n, proxies[n]); if (ne_uri_parse(proxies[n], &uri)) continue; if (!uri.scheme) continue; if (ne_strcasecmp(uri.scheme, "http") == 0) ptype = PROXY_HTTP; else if (ne_strcasecmp(uri.scheme, "socks") == 0) ptype = PROXY_SOCKS; else if (ne_strcasecmp(uri.scheme, "direct") == 0) ptype = PROXY_NONE; else continue; /* Hostname/port required for http/socks schemes. */ if (ptype != PROXY_NONE && !(uri.host && uri.port)) continue; /* Do nothing if libproxy returned only a single "direct://" * entry -- a single "direct" (noop) proxy is equivalent to * having none. */ if (n == 0 && proxies[1] == NULL && ptype == PROXY_NONE) break; NE_DEBUG(NE_DBG_HTTP, "sess: Got proxy %s://%s:%d\n", uri.scheme, uri.host ? uri.host : "(none)", uri.port); hi = *lasthi = ne_calloc(sizeof *hi); if (ptype == PROXY_NONE) { /* A "direct" URI requires an attempt to connect directly to * the origin server, so dup the server details. */ set_hostinfo(hi, ptype, sess->server.hostname, sess->server.port); } else { /* SOCKS/HTTP proxy. */ set_hostinfo(hi, ptype, uri.host, uri.port); if (ptype == PROXY_HTTP) sess->any_proxy_http = 1; else if (ptype == PROXY_SOCKS) sess->socks_ver = NE_SOCK_SOCKSV5; } lasthi = &hi->next; } /* Free up the proxies array: */ for (n = 0; proxies[n]; n++) free(proxies[n]); free(proxies[n]); ne_free(url); ne_uri_free(&uri); px_proxy_factory_free(pxf); #endif } void ne_set_addrlist(ne_session *sess, const ne_inet_addr **addrs, size_t n) { struct host_info *hi, **lasthi; size_t i; free_proxies(sess); lasthi = &sess->proxies; for (i = 0; i < n; i++) { *lasthi = hi = ne_calloc(sizeof *hi); hi->proxy = PROXY_NONE; hi->network = addrs[i]; hi->port = sess->server.port; lasthi = &hi->next; } } void ne_set_localaddr(ne_session *sess, const ne_inet_addr *addr) { sess->local_addr = addr; } void ne_set_error(ne_session *sess, const char *format, ...) { va_list params; va_start(params, format); ne_vsnprintf(sess->error, sizeof sess->error, format, params); va_end(params); } void ne_set_session_flag(ne_session *sess, ne_session_flag flag, int value) { if (flag < NE_SESSFLAG_LAST) { sess->flags[flag] = value; #ifdef NE_HAVE_SSL if (flag == NE_SESSFLAG_SSLv2 && sess->ssl_context) { ne_ssl_context_set_flag(sess->ssl_context, NE_SSL_CTX_SSLv2, value); } #endif } } int ne_get_session_flag(ne_session *sess, ne_session_flag flag) { if (flag < NE_SESSFLAG_LAST) { return sess->flags[flag]; } return -1; } static void progress_notifier(void *userdata, ne_session_status status, const ne_session_status_info *info) { ne_session *sess = userdata; if (status == ne_status_sending || status == ne_status_recving) { sess->progress_cb(sess->progress_ud, info->sr.progress, info->sr.total); } } void ne_set_progress(ne_session *sess, ne_progress progress, void *userdata) { if (progress) { sess->progress_cb = progress; sess->progress_ud = userdata; ne_set_notifier(sess, progress_notifier, sess); } else { ne_set_notifier(sess, NULL, NULL); } } void ne_set_notifier(ne_session *sess, ne_notify_status status, void *userdata) { sess->notify_cb = status; sess->notify_ud = userdata; } void ne_set_read_timeout(ne_session *sess, int timeout) { sess->rdtimeout = timeout; } void ne_set_connect_timeout(ne_session *sess, int timeout) { sess->cotimeout = timeout; } #define UAHDR "User-Agent: " #define AGENT " neon/" NEON_VERSION "\r\n" void ne_set_useragent(ne_session *sess, const char *token) { if (sess->user_agent) ne_free(sess->user_agent); sess->user_agent = ne_malloc(strlen(UAHDR) + strlen(AGENT) + strlen(token) + 1); #ifdef HAVE_STPCPY strcpy(stpcpy(stpcpy(sess->user_agent, UAHDR), token), AGENT); #else strcat(strcat(strcpy(sess->user_agent, UAHDR), token), AGENT); #endif } const char *ne_get_server_hostport(ne_session *sess) { return sess->server.hostport; } const char *ne_get_scheme(ne_session *sess) { return sess->scheme; } void ne_fill_server_uri(ne_session *sess, ne_uri *uri) { uri->host = ne_strdup(sess->server.hostname); uri->port = sess->server.port; uri->scheme = ne_strdup(sess->scheme); } void ne_fill_proxy_uri(ne_session *sess, ne_uri *uri) { if (sess->proxies) { struct host_info *hi = sess->nexthop ? sess->nexthop : sess->proxies; if (hi->proxy == PROXY_HTTP) { uri->host = ne_strdup(hi->hostname); uri->port = hi->port; } } } const char *ne_get_error(ne_session *sess) { return sess->error; } void ne_close_connection(ne_session *sess) { if (sess->connected) { struct hook *hk; NE_DEBUG(NE_DBG_SOCKET, "sess: Closing connection.\n"); if (sess->notify_cb) { sess->status.cd.hostname = sess->nexthop->hostname; sess->notify_cb(sess->notify_ud, ne_status_disconnected, &sess->status); } /* Run the close_conn hooks. */ for (hk = sess->close_conn_hooks; hk != NULL; hk = hk->next) { ne_close_conn_fn fn = (ne_close_conn_fn)hk->fn; fn(hk->userdata); } ne_sock_close(sess->socket); sess->socket = NULL; NE_DEBUG(NE_DBG_SOCKET, "sess: Connection closed.\n"); } else { NE_DEBUG(NE_DBG_SOCKET, "sess: Not closing closed connection.\n"); } sess->connected = 0; } void ne_ssl_set_verify(ne_session *sess, ne_ssl_verify_fn fn, void *userdata) { sess->ssl_verify_fn = fn; sess->ssl_verify_ud = userdata; } void ne_ssl_provide_clicert(ne_session *sess, ne_ssl_provide_fn fn, void *userdata) { sess->ssl_provide_fn = fn; sess->ssl_provide_ud = userdata; } void ne_ssl_trust_cert(ne_session *sess, const ne_ssl_certificate *cert) { #ifdef NE_HAVE_SSL if (sess->ssl_context) { ne_ssl_context_trustcert(sess->ssl_context, cert); } #endif } void ne_ssl_cert_validity(const ne_ssl_certificate *cert, char *from, char *until) { #ifdef NE_HAVE_SSL time_t tf, tu; char *date; ne_ssl_cert_validity_time(cert, &tf, &tu); if (from) { if (tf != (time_t) -1) { date = ne_rfc1123_date(tf); ne_strnzcpy(from, date, NE_SSL_VDATELEN); ne_free(date); } else { ne_strnzcpy(from, _("[invalid date]"), NE_SSL_VDATELEN); } } if (until) { if (tu != (time_t) -1) { date = ne_rfc1123_date(tu); ne_strnzcpy(until, date, NE_SSL_VDATELEN); ne_free(date); } else { ne_strnzcpy(until, _("[invalid date]"), NE_SSL_VDATELEN); } } #endif } #ifdef NE_HAVE_SSL void ne__ssl_set_verify_err(ne_session *sess, int failures) { static const struct { int bit; const char *str; } reasons[] = { { NE_SSL_NOTYETVALID, N_("certificate is not yet valid") }, { NE_SSL_EXPIRED, N_("certificate has expired") }, { NE_SSL_IDMISMATCH, N_("certificate issued for a different hostname") }, { NE_SSL_UNTRUSTED, N_("issuer is not trusted") }, { NE_SSL_BADCHAIN, N_("bad certificate chain") }, { NE_SSL_REVOKED, N_("certificate has been revoked") }, { 0, NULL } }; int n, flag = 0; strcpy(sess->error, _("Server certificate verification failed: ")); for (n = 0; reasons[n].bit; n++) { if (failures & reasons[n].bit) { if (flag) strncat(sess->error, ", ", sizeof sess->error); strncat(sess->error, _(reasons[n].str), sizeof sess->error); flag = 1; } } } /* This doesn't actually implement complete RFC 2818 logic; omits * "f*.example.com" support for simplicity. */ int ne__ssl_match_hostname(const char *cn, size_t cnlen, const char *hostname) { const char *dot; NE_DEBUG(NE_DBG_SSL, "ssl: Match common name '%s' against '%s'\n", cn, hostname); if (strncmp(cn, "*.", 2) == 0 && cnlen > 2 && (dot = strchr(hostname, '.')) != NULL) { hostname = dot + 1; cn += 2; cnlen -= 2; } return cnlen == strlen(hostname) && !ne_strcasecmp(cn, hostname); } #endif /* NE_HAVE_SSL */ typedef void (*void_fn)(void); #define ADD_HOOK(hooks, fn, ud) add_hook(&(hooks), NULL, (void_fn)(fn), (ud)) static void add_hook(struct hook **hooks, const char *id, void_fn fn, void *ud) { struct hook *hk = ne_malloc(sizeof (struct hook)), *pos; if (*hooks != NULL) { for (pos = *hooks; pos->next != NULL; pos = pos->next) /* nullop */; pos->next = hk; } else { *hooks = hk; } hk->id = id; hk->fn = fn; hk->userdata = ud; hk->next = NULL; } void ne_hook_create_request(ne_session *sess, ne_create_request_fn fn, void *userdata) { ADD_HOOK(sess->create_req_hooks, fn, userdata); } void ne_hook_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata) { ADD_HOOK(sess->pre_send_hooks, fn, userdata); } void ne_hook_post_send(ne_session *sess, ne_post_send_fn fn, void *userdata) { ADD_HOOK(sess->post_send_hooks, fn, userdata); } void ne_hook_post_headers(ne_session *sess, ne_post_headers_fn fn, void *userdata) { ADD_HOOK(sess->post_headers_hooks, fn, userdata); } void ne_hook_destroy_request(ne_session *sess, ne_destroy_req_fn fn, void *userdata) { ADD_HOOK(sess->destroy_req_hooks, fn, userdata); } void ne_hook_destroy_session(ne_session *sess, ne_destroy_sess_fn fn, void *userdata) { ADD_HOOK(sess->destroy_sess_hooks, fn, userdata); } void ne_hook_close_conn(ne_session *sess, ne_close_conn_fn fn, void *userdata) { ADD_HOOK(sess->close_conn_hooks, fn, userdata); } void ne_set_session_private(ne_session *sess, const char *id, void *userdata) { add_hook(&sess->private, id, NULL, userdata); } static void remove_hook(struct hook **hooks, void_fn fn, void *ud) { struct hook **p = hooks; while (*p) { if ((*p)->fn == fn && (*p)->userdata == ud) { struct hook *next = (*p)->next; ne_free(*p); (*p) = next; break; } p = &(*p)->next; } } #define REMOVE_HOOK(hooks, fn, ud) remove_hook(&hooks, (void_fn)fn, ud) void ne_unhook_create_request(ne_session *sess, ne_create_request_fn fn, void *userdata) { REMOVE_HOOK(sess->create_req_hooks, fn, userdata); } void ne_unhook_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata) { REMOVE_HOOK(sess->pre_send_hooks, fn, userdata); } void ne_unhook_post_headers(ne_session *sess, ne_post_headers_fn fn, void *userdata) { REMOVE_HOOK(sess->post_headers_hooks, fn, userdata); } void ne_unhook_post_send(ne_session *sess, ne_post_send_fn fn, void *userdata) { REMOVE_HOOK(sess->post_send_hooks, fn, userdata); } void ne_unhook_destroy_request(ne_session *sess, ne_destroy_req_fn fn, void *userdata) { REMOVE_HOOK(sess->destroy_req_hooks, fn, userdata); } void ne_unhook_destroy_session(ne_session *sess, ne_destroy_sess_fn fn, void *userdata) { REMOVE_HOOK(sess->destroy_sess_hooks, fn, userdata); } void ne_unhook_close_conn(ne_session *sess, ne_close_conn_fn fn, void *userdata) { REMOVE_HOOK(sess->close_conn_hooks, fn, userdata); } cadaver-0.23.3/lib/neon/ne_locks.c0000664000076400007640000005344210561601127016303 0ustar jortonjorton/* WebDAV Class 2 locking operations Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #include /* for isdigit() */ #include "ne_alloc.h" #include "ne_request.h" #include "ne_xml.h" #include "ne_locks.h" #include "ne_uri.h" #include "ne_basic.h" #include "ne_props.h" #include "ne_207.h" #include "ne_internal.h" #include "ne_xmlreq.h" #define HOOK_ID "http://webdav.org/neon/hooks/webdav-locking" /* A list of lock objects. */ struct lock_list { struct ne_lock *lock; struct lock_list *next, *prev; }; struct ne_lock_store_s { struct lock_list *locks; struct lock_list *cursor; /* current position in 'locks' */ }; struct lh_req_cookie { const ne_lock_store *store; struct lock_list *submit; }; /* Context for PROPFIND/lockdiscovery callbacks */ struct discover_ctx { ne_propfind_handler *phandler; ne_lock_result results; void *userdata; ne_buffer *cdata; }; /* Context for handling LOCK response */ struct lock_ctx { struct ne_lock active; /* activelock */ ne_request *req; /* the request in question */ ne_xml_parser *parser; char *token; /* the token we're after. */ int found; ne_buffer *cdata; }; /* use the "application" state space. */ #define ELM_LOCK_FIRST (NE_PROPS_STATE_TOP + 66) #define ELM_lockdiscovery (ELM_LOCK_FIRST) #define ELM_activelock (ELM_LOCK_FIRST + 1) #define ELM_lockscope (ELM_LOCK_FIRST + 2) #define ELM_locktype (ELM_LOCK_FIRST + 3) #define ELM_depth (ELM_LOCK_FIRST + 4) #define ELM_owner (ELM_LOCK_FIRST + 5) #define ELM_timeout (ELM_LOCK_FIRST + 6) #define ELM_locktoken (ELM_LOCK_FIRST + 7) #define ELM_lockinfo (ELM_LOCK_FIRST + 8) #define ELM_write (ELM_LOCK_FIRST + 9) #define ELM_exclusive (ELM_LOCK_FIRST + 10) #define ELM_shared (ELM_LOCK_FIRST + 11) #define ELM_href (ELM_LOCK_FIRST + 12) #define ELM_prop (NE_207_STATE_PROP) static const struct ne_xml_idmap element_map[] = { #define ELM(x) { "DAV:", #x, ELM_ ## x } ELM(lockdiscovery), ELM(activelock), ELM(prop), ELM(lockscope), ELM(locktype), ELM(depth), ELM(owner), ELM(timeout), ELM(locktoken), ELM(lockinfo), ELM(lockscope), ELM(locktype), ELM(write), ELM(exclusive), ELM(shared), ELM(href) /* no "lockentry" */ #undef ELM }; static const ne_propname lock_props[] = { { "DAV:", "lockdiscovery" }, { NULL } }; /* this simply registers the accessor for the function. */ static void lk_create(ne_request *req, void *session, const char *method, const char *uri) { struct lh_req_cookie *lrc = ne_malloc(sizeof *lrc); lrc->store = session; lrc->submit = NULL; ne_set_request_private(req, HOOK_ID, lrc); } static void lk_pre_send(ne_request *r, void *userdata, ne_buffer *req) { struct lh_req_cookie *lrc = ne_get_request_private(r, HOOK_ID); if (lrc->submit != NULL) { struct lock_list *item; /* Add in the If header */ ne_buffer_czappend(req, "If:"); for (item = lrc->submit; item != NULL; item = item->next) { char *uri = ne_uri_unparse(&item->lock->uri); ne_buffer_concat(req, " <", uri, "> (<", item->lock->token, ">)", NULL); ne_free(uri); } ne_buffer_czappend(req, "\r\n"); } } /* Insert 'lock' into lock list *list. */ static void insert_lock(struct lock_list **list, struct ne_lock *lock) { struct lock_list *item = ne_malloc(sizeof *item); if (*list != NULL) { (*list)->prev = item; } item->prev = NULL; item->next = *list; item->lock = lock; *list = item; } static void free_list(struct lock_list *list, int destroy) { struct lock_list *next; while (list != NULL) { next = list->next; if (destroy) ne_lock_destroy(list->lock); ne_free(list); list = next; } } static void lk_destroy(ne_request *req, void *userdata) { struct lh_req_cookie *lrc = ne_get_request_private(req, HOOK_ID); free_list(lrc->submit, 0); ne_free(lrc); } void ne_lockstore_destroy(ne_lock_store *store) { free_list(store->locks, 1); ne_free(store); } ne_lock_store *ne_lockstore_create(void) { return ne_calloc(sizeof(ne_lock_store)); } #define CURSOR_RET(s) ((s)->cursor?(s)->cursor->lock:NULL) struct ne_lock *ne_lockstore_first(ne_lock_store *store) { store->cursor = store->locks; return CURSOR_RET(store); } struct ne_lock *ne_lockstore_next(ne_lock_store *store) { store->cursor = store->cursor->next; return CURSOR_RET(store); } void ne_lockstore_register(ne_lock_store *store, ne_session *sess) { /* Register the hooks */ ne_hook_create_request(sess, lk_create, store); ne_hook_pre_send(sess, lk_pre_send, store); ne_hook_destroy_request(sess, lk_destroy, store); } /* Submit the given lock for the given URI */ static void submit_lock(struct lh_req_cookie *lrc, struct ne_lock *lock) { struct lock_list *item; /* Check for dups */ for (item = lrc->submit; item != NULL; item = item->next) { if (ne_strcasecmp(item->lock->token, lock->token) == 0) return; } insert_lock(&lrc->submit, lock); } struct ne_lock *ne_lockstore_findbyuri(ne_lock_store *store, const ne_uri *uri) { struct lock_list *cur; for (cur = store->locks; cur != NULL; cur = cur->next) { if (ne_uri_cmp(&cur->lock->uri, uri) == 0) { return cur->lock; } } return NULL; } void ne_lock_using_parent(ne_request *req, const char *path) { struct lh_req_cookie *lrc = ne_get_request_private(req, HOOK_ID); ne_uri u = {0}; struct lock_list *item; char *parent; if (lrc == NULL) return; parent = ne_path_parent(path); if (parent == NULL) return; ne_fill_server_uri(ne_get_session(req), &u); for (item = lrc->store->locks; item != NULL; item = item->next) { /* Only care about locks which are on this server. */ u.path = item->lock->uri.path; if (ne_uri_cmp(&u, &item->lock->uri)) continue; /* This lock is needed if it is an infinite depth lock which * covers the parent, or a lock on the parent itself. */ if ((item->lock->depth == NE_DEPTH_INFINITE && ne_path_childof(item->lock->uri.path, parent)) || ne_path_compare(item->lock->uri.path, parent) == 0) { NE_DEBUG(NE_DBG_LOCKS, "Locked parent, %s on %s\n", item->lock->token, item->lock->uri.path); submit_lock(lrc, item->lock); } } u.path = parent; /* handy: makes u.path valid and ne_free(parent). */ ne_uri_free(&u); } void ne_lock_using_resource(ne_request *req, const char *uri, int depth) { struct lh_req_cookie *lrc = ne_get_request_private(req, HOOK_ID); struct lock_list *item; int match; if (lrc == NULL) return; /* Iterate over the list of stored locks to see if any of them * apply to this resource */ for (item = lrc->store->locks; item != NULL; item = item->next) { match = 0; if (depth == NE_DEPTH_INFINITE && ne_path_childof(uri, item->lock->uri.path)) { /* Case 1: this is a depth-infinity request which will * modify a lock somewhere inside the collection. */ NE_DEBUG(NE_DBG_LOCKS, "Has child: %s\n", item->lock->token); match = 1; } else if (ne_path_compare(uri, item->lock->uri.path) == 0) { /* Case 2: this request is directly on a locked resource */ NE_DEBUG(NE_DBG_LOCKS, "Has direct lock: %s\n", item->lock->token); match = 1; } else if (item->lock->depth == NE_DEPTH_INFINITE && ne_path_childof(item->lock->uri.path, uri)) { /* Case 3: there is a higher-up infinite-depth lock which * covers the resource that this request will modify. */ NE_DEBUG(NE_DBG_LOCKS, "Is child of: %s\n", item->lock->token); match = 1; } if (match) { submit_lock(lrc, item->lock); } } } void ne_lockstore_add(ne_lock_store *store, struct ne_lock *lock) { insert_lock(&store->locks, lock); } void ne_lockstore_remove(ne_lock_store *store, struct ne_lock *lock) { struct lock_list *item; /* Find the lock */ for (item = store->locks; item != NULL; item = item->next) if (item->lock == lock) break; if (item->prev != NULL) { item->prev->next = item->next; } else { store->locks = item->next; } if (item->next != NULL) { item->next->prev = item->prev; } ne_free(item); } struct ne_lock *ne_lock_copy(const struct ne_lock *lock) { struct ne_lock *ret = ne_calloc(sizeof *ret); ne_uri_copy(&ret->uri, &lock->uri); ret->token = ne_strdup(lock->token); ret->depth = lock->depth; ret->type = lock->type; ret->scope = lock->scope; if (lock->owner) ret->owner = ne_strdup(lock->owner); ret->timeout = lock->timeout; return ret; } struct ne_lock *ne_lock_create(void) { struct ne_lock *lock = ne_calloc(sizeof *lock); lock->depth = NE_DEPTH_ZERO; lock->type = ne_locktype_write; lock->scope = ne_lockscope_exclusive; lock->timeout = NE_TIMEOUT_INVALID; return lock; } void ne_lock_free(struct ne_lock *lock) { ne_uri_free(&lock->uri); if (lock->owner) { ne_free(lock->owner); lock->owner = NULL; } if (lock->token) { ne_free(lock->token); lock->token = NULL; } } void ne_lock_destroy(struct ne_lock *lock) { ne_lock_free(lock); ne_free(lock); } int ne_unlock(ne_session *sess, const struct ne_lock *lock) { ne_request *req = ne_request_create(sess, "UNLOCK", lock->uri.path); int ret; ne_print_request_header(req, "Lock-Token", "<%s>", lock->token); /* UNLOCK of a lock-null resource removes the resource from the * parent collection; so an UNLOCK may modify the parent * collection. (somewhat counter-intuitive, and not easily derived * from 2518.) */ ne_lock_using_parent(req, lock->uri.path); ret = ne_request_dispatch(req); if (ret == NE_OK && ne_get_status(req)->klass != 2) { ret = NE_ERROR; } ne_request_destroy(req); return ret; } static int parse_depth(const char *depth) { if (ne_strcasecmp(depth, "infinity") == 0) { return NE_DEPTH_INFINITE; } else if (isdigit(depth[0])) { return atoi(depth); } else { return -1; } } static long parse_timeout(const char *timeout) { if (ne_strcasecmp(timeout, "infinite") == 0) { return NE_TIMEOUT_INFINITE; } else if (strncasecmp(timeout, "Second-", 7) == 0) { long to = strtol(timeout+7, NULL, 10); if (to == LONG_MIN || to == LONG_MAX) return NE_TIMEOUT_INVALID; return to; } else { return NE_TIMEOUT_INVALID; } } static void discover_results(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) { struct discover_ctx *ctx = userdata; struct ne_lock *lock = ne_propset_private(set); const ne_status *status = ne_propset_status(set, &lock_props[0]); /* Require at least that the lock has a token. */ if (lock->token) { if (status && status->klass != 2) { ctx->results(ctx->userdata, NULL, uri, status); } else { ctx->results(ctx->userdata, lock, uri, NULL); } } else if (status) { ctx->results(ctx->userdata, NULL, uri, status); } NE_DEBUG(NE_DBG_LOCKS, "End of response for %s\n", uri->path); } static int end_element_common(struct ne_lock *l, int state, const char *cdata) { switch (state) { case ELM_write: l->type = ne_locktype_write; break; case ELM_exclusive: l->scope = ne_lockscope_exclusive; break; case ELM_shared: l->scope = ne_lockscope_shared; break; case ELM_depth: NE_DEBUG(NE_DBG_LOCKS, "Got depth: %s\n", cdata); l->depth = parse_depth(cdata); if (l->depth == -1) { return -1; } break; case ELM_timeout: NE_DEBUG(NE_DBG_LOCKS, "Got timeout: %s\n", cdata); l->timeout = parse_timeout(cdata); if (l->timeout == NE_TIMEOUT_INVALID) { return -1; } break; case ELM_owner: l->owner = strdup(cdata); break; case ELM_href: l->token = strdup(cdata); break; } return 0; } /* End-element handler for lock discovery PROPFIND response */ static int end_element_ldisc(void *userdata, int state, const char *nspace, const char *name) { struct discover_ctx *ctx = userdata; struct ne_lock *lock = ne_propfind_current_private(ctx->phandler); return end_element_common(lock, state, ctx->cdata->data); } static inline int can_accept(int parent, int id) { return (parent == NE_XML_STATEROOT && id == ELM_prop) || (parent == ELM_prop && id == ELM_lockdiscovery) || (parent == ELM_lockdiscovery && id == ELM_activelock) || (parent == ELM_activelock && (id == ELM_lockscope || id == ELM_locktype || id == ELM_depth || id == ELM_owner || id == ELM_timeout || id == ELM_locktoken)) || (parent == ELM_lockscope && (id == ELM_exclusive || id == ELM_shared)) || (parent == ELM_locktype && id == ELM_write) || (parent == ELM_locktoken && id == ELM_href); } static int ld_startelm(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { struct discover_ctx *ctx = userdata; int id = ne_xml_mapid(element_map, NE_XML_MAPLEN(element_map), nspace, name); ne_buffer_clear(ctx->cdata); if (can_accept(parent, id)) return id; else return NE_XML_DECLINE; } #define MAX_CDATA (256) static int lk_cdata(void *userdata, int state, const char *cdata, size_t len) { struct lock_ctx *ctx = userdata; if (ctx->cdata->used + len < MAX_CDATA) ne_buffer_append(ctx->cdata, cdata, len); return 0; } static int ld_cdata(void *userdata, int state, const char *cdata, size_t len) { struct discover_ctx *ctx = userdata; if (ctx->cdata->used + len < MAX_CDATA) ne_buffer_append(ctx->cdata, cdata, len); return 0; } static int lk_startelm(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { struct lock_ctx *ctx = userdata; int id; id = ne_xml_mapid(element_map, NE_XML_MAPLEN(element_map), nspace, name); NE_DEBUG(NE_DBG_LOCKS, "lk_startelm: %s => %d\n", name, id); if (id == 0) return NE_XML_DECLINE; if (parent == 0 && ctx->token == NULL) { const char *token = ne_get_response_header(ctx->req, "Lock-Token"); /* at the root element; retrieve the Lock-Token header, * and bail if it wasn't given. */ if (token == NULL) { ne_xml_set_error(ctx->parser, _("LOCK response missing Lock-Token header")); return NE_XML_ABORT; } if (token[0] == '<') token++; ctx->token = ne_strdup(token); ne_shave(ctx->token, ">"); NE_DEBUG(NE_DBG_LOCKS, "lk_startelm: Finding token %s\n", ctx->token); } /* TODO: only accept 'prop' as root for LOCK response */ if (!can_accept(parent, id)) return NE_XML_DECLINE; if (id == ELM_activelock && !ctx->found) { /* a new activelock */ ne_lock_free(&ctx->active); memset(&ctx->active, 0, sizeof ctx->active); ctx->active.timeout = NE_TIMEOUT_INVALID; } ne_buffer_clear(ctx->cdata); return id; } /* End-element handler for LOCK response */ static int lk_endelm(void *userdata, int state, const char *nspace, const char *name) { struct lock_ctx *ctx = userdata; if (ctx->found) return 0; if (end_element_common(&ctx->active, state, ctx->cdata->data)) return -1; if (state == ELM_activelock) { if (ctx->active.token && strcmp(ctx->active.token, ctx->token) == 0) { ctx->found = 1; } } return 0; } /* Creator callback for private structure. */ static void *ld_create(void *userdata, const ne_uri *uri) { struct ne_lock *lk = ne_lock_create(); ne_uri_copy(&lk->uri, uri); return lk; } /* Destructor callback for private structure. */ static void ld_destroy(void *userdata, void *private) { struct ne_lock *lk = private; ne_lock_destroy(lk); } /* Discover all locks on URI */ int ne_lock_discover(ne_session *sess, const char *uri, ne_lock_result callback, void *userdata) { ne_propfind_handler *handler; struct discover_ctx ctx = {0}; int ret; ctx.results = callback; ctx.userdata = userdata; ctx.cdata = ne_buffer_create(); ctx.phandler = handler = ne_propfind_create(sess, uri, NE_DEPTH_ZERO); ne_propfind_set_private(handler, ld_create, ld_destroy, &ctx); ne_xml_push_handler(ne_propfind_get_parser(handler), ld_startelm, ld_cdata, end_element_ldisc, &ctx); ret = ne_propfind_named(handler, lock_props, discover_results, &ctx); ne_buffer_destroy(ctx.cdata); ne_propfind_destroy(handler); return ret; } static void add_timeout_header(ne_request *req, long timeout) { if (timeout == NE_TIMEOUT_INFINITE) { ne_add_request_header(req, "Timeout", "Infinite"); } else if (timeout != NE_TIMEOUT_INVALID && timeout > 0) { ne_print_request_header(req, "Timeout", "Second-%ld", timeout); } /* just ignore it if timeout == 0 or invalid. */ } int ne_lock(ne_session *sess, struct ne_lock *lock) { ne_request *req = ne_request_create(sess, "LOCK", lock->uri.path); ne_buffer *body = ne_buffer_create(); ne_xml_parser *parser = ne_xml_create(); int ret; struct lock_ctx ctx; memset(&ctx, 0, sizeof ctx); ctx.cdata = ne_buffer_create(); ctx.req = req; ctx.parser = parser; /* LOCK is not idempotent. */ ne_set_request_flag(req, NE_REQFLAG_IDEMPOTENT, 0); ne_xml_push_handler(parser, lk_startelm, lk_cdata, lk_endelm, &ctx); /* Create the body */ ne_buffer_concat(body, "\n" "\n" " ", lock->scope==ne_lockscope_exclusive? "":"", "\n" "", NULL); if (lock->owner) { ne_buffer_concat(body, "", lock->owner, "\n", NULL); } ne_buffer_czappend(body, "\n"); ne_set_request_body_buffer(req, body->data, ne_buffer_size(body)); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); ne_add_depth_header(req, lock->depth); add_timeout_header(req, lock->timeout); /* TODO: * By 2518, we need this only if we are creating a lock-null resource. * Since we don't KNOW whether the lock we're given is a lock-null * or not, we cover our bases. */ ne_lock_using_parent(req, lock->uri.path); /* This one is clearer from 2518 sec 8.10.4. */ ne_lock_using_resource(req, lock->uri.path, lock->depth); ret = ne_xml_dispatch_request(req, parser); ne_buffer_destroy(body); ne_buffer_destroy(ctx.cdata); if (ret == NE_OK && ne_get_status(req)->klass == 2) { if (ne_get_status(req)->code == 207) { ret = NE_ERROR; /* TODO: set the error string appropriately */ } else if (ctx.found) { /* it worked: copy over real lock details if given. */ if (lock->token) ne_free(lock->token); lock->token = ctx.token; ctx.token = NULL; if (ctx.active.timeout != NE_TIMEOUT_INVALID) lock->timeout = ctx.active.timeout; lock->scope = ctx.active.scope; lock->type = ctx.active.type; if (ctx.active.depth >= 0) lock->depth = ctx.active.depth; if (ctx.active.owner) { if (lock->owner) ne_free(lock->owner); lock->owner = ctx.active.owner; ctx.active.owner = NULL; } } else { ret = NE_ERROR; ne_set_error(sess, _("Response missing activelock for %s"), ctx.token); } } else if (ret == NE_OK /* && status != 2xx */) { ret = NE_ERROR; } ne_lock_free(&ctx.active); if (ctx.token) ne_free(ctx.token); ne_request_destroy(req); ne_xml_destroy(parser); return ret; } int ne_lock_refresh(ne_session *sess, struct ne_lock *lock) { ne_request *req = ne_request_create(sess, "LOCK", lock->uri.path); ne_xml_parser *parser = ne_xml_create(); int ret; struct lock_ctx ctx; memset(&ctx, 0, sizeof ctx); ctx.cdata = ne_buffer_create(); ctx.req = req; ctx.token = lock->token; ctx.parser = parser; /* Handle the response and update *lock appropriately. */ ne_xml_push_handler(parser, lk_startelm, lk_cdata, lk_endelm, &ctx); /* For a lock refresh, submitting only this lock token must be * sufficient. */ ne_print_request_header(req, "If", "(<%s>)", lock->token); add_timeout_header(req, lock->timeout); ret = ne_xml_dispatch_request(req, parser); if (ret == NE_OK) { if (ne_get_status(req)->klass != 2) { ret = NE_ERROR; /* and use default session error */ } else if (!ctx.found) { ne_set_error(sess, _("No activelock for <%s> returned in " "LOCK refresh response"), lock->token); ret = NE_ERROR; } else /* success! */ { /* update timeout for passed-in lock structure. */ lock->timeout = ctx.active.timeout; } } ne_lock_free(&ctx.active); ne_buffer_destroy(ctx.cdata); ne_request_destroy(req); ne_xml_destroy(parser); return ret; } cadaver-0.23.3/lib/neon/ne_ssl.h0000664000076400007640000001775711153736032016011 0ustar jortonjorton/* SSL/TLS abstraction layer for neon Copyright (C) 2003-2006, 2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* ne_ssl.h defines an interface for loading and accessing the * properties of SSL certificates. */ #ifndef NE_SSL_H #define NE_SSL_H 1 #include #include "ne_defs.h" NE_BEGIN_DECLS /* A "distinguished name"; a unique name for some entity. */ typedef struct ne_ssl_dname_s ne_ssl_dname; /* Returns a single-line string representation of a distinguished * name, intended to be human-readable (e.g. "Acme Ltd., Norfolk, * GB"). Return value is a UTF-8-encoded malloc-allocated string and * must be free'd by the caller. */ char *ne_ssl_readable_dname(const ne_ssl_dname *dn); /* Returns zero if 'dn1' and 'dn2' refer to same name, or non-zero if * they are different. */ int ne_ssl_dname_cmp(const ne_ssl_dname *dn1, const ne_ssl_dname *dn2); /* An SSL certificate. */ typedef struct ne_ssl_certificate_s ne_ssl_certificate; /* Read a certificate from a file in PEM format; returns NULL if the * certificate could not be parsed. */ ne_ssl_certificate *ne_ssl_cert_read(const char *filename); /* Write a certificate to a file in PEM format; returns non-zero if * the certificate could not be written. */ int ne_ssl_cert_write(const ne_ssl_certificate *cert, const char *filename); /* Export a certificate to a base64-encoded, NUL-terminated string. * The returned string is malloc-allocated and must be free()d by the * caller. */ char *ne_ssl_cert_export(const ne_ssl_certificate *cert); /* Import a certificate from a base64-encoded string as returned by * ne_ssl_cert_export(). Returns a certificate object or NULL if * 'data' was not valid. */ ne_ssl_certificate *ne_ssl_cert_import(const char *data); /* Returns the identity of the certificate, or NULL if none is given. * For a server certificate this will be the hostname of the server to * which the cert was issued. A NUL-terminated UTF-8-encoded string * is returned, which is valid for the lifetime of the certificate * object. */ const char *ne_ssl_cert_identity(const ne_ssl_certificate *cert); /* Return the certificate of the entity which signed certificate * 'cert'. Returns NULL if 'cert' is self-signed or the issuer * certificate is not available; if non-NULL, the pointer is valid for * the lifetime of the certificate object. */ const ne_ssl_certificate *ne_ssl_cert_signedby(const ne_ssl_certificate *cert); /* Returns the distinguished name of the certificate issuer. */ const ne_ssl_dname *ne_ssl_cert_issuer(const ne_ssl_certificate *cert); /* Returns the distinguished name of the certificate subject. */ const ne_ssl_dname *ne_ssl_cert_subject(const ne_ssl_certificate *cert); #define NE_SSL_DIGESTLEN (60) /* Calculate the certificate digest ("fingerprint") and format it as a * NUL-terminated hex string in 'digest', of the form "aa:bb:...:ff". * Returns zero on success or non-zero if there was an internal error * whilst calculating the digest. 'digest' must be at least * NE_SSL_DIGESTLEN bytes in length. */ int ne_ssl_cert_digest(const ne_ssl_certificate *cert, char *digest); /* Copy the validity times for the certificate 'cert' into 'from' and * 'until' (either may be NULL). If the time cannot be represented by * a time_t value, then (time_t)-1 will be written. */ void ne_ssl_cert_validity_time(const ne_ssl_certificate *cert, time_t *from, time_t *until); #define NE_SSL_VDATELEN (30) /* Copy the validity times into buffers 'from' and 'until' as * NUL-terminated human-readable strings, using RFC 1123-style date * formatting (and not localized, so always using English month/week * names). The buffers must be at least NE_SSL_VDATELEN bytes in * length, and either may be NULL. */ void ne_ssl_cert_validity(const ne_ssl_certificate *cert, char *from, char *until); /* Returns zero if 'c1' and 'c2' refer to the same certificate, or * non-zero otherwise. */ int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, const ne_ssl_certificate *c2); /* Deallocate memory associated with certificate. */ void ne_ssl_cert_free(ne_ssl_certificate *cert); /* A client certificate (and private key). A client certificate * object has state; the object is either in the "encrypted" or * "decrypted" state. */ typedef struct ne_ssl_client_cert_s ne_ssl_client_cert; /* Read a client certificate and private key from a PKCS12 file; * returns NULL if the file could not be parsed, or otherwise * returning a client certificate object. The returned object may be * in either the encrypted or decrypted state. */ ne_ssl_client_cert *ne_ssl_clicert_read(const char *filename); /* Returns non-zero if client cert is in the encrypted state. */ int ne_ssl_clicert_encrypted(const ne_ssl_client_cert *ccert); /* Returns the "friendly name" given for the client cert, or NULL if * none given. Returns a NUL-terminated, UTF-8-encoded string. This * function may be used on a ccert object in either encrypted or * decrypted state. */ const char *ne_ssl_clicert_name(const ne_ssl_client_cert *ccert); /* Decrypt the encrypted client cert using the given password. * Returns non-zero on failure, in which case, the ccert object * remains in the encrypted state and the function may be called again * with a different password. This function has undefined behaviour * for a ccert object which is in the decrypted state. */ int ne_ssl_clicert_decrypt(ne_ssl_client_cert *ccert, const char *password); /* Return the actual certificate part of the client certificate (never * returns NULL). This function has undefined behaviour for a ccert * object which is in the encrypted state. */ const ne_ssl_certificate *ne_ssl_clicert_owner(const ne_ssl_client_cert *ccert); /* Destroy a client certificate object. This function may be used on * a ccert object in either the encrypted or decrypted state. */ void ne_ssl_clicert_free(ne_ssl_client_cert *ccert); /* SSL context object. The interfaces to manipulate an SSL context * are only needed when interfacing directly with ne_socket.h. */ typedef struct ne_ssl_context_s ne_ssl_context; /* Context creation modes: */ #define NE_SSL_CTX_CLIENT (0) /* client context */ #define NE_SSL_CTX_SERVER (1) /* default server context */ #define NE_SSL_CTX_SERVERv2 (2) /* SSLv2-specific server context */ /* Create an SSL context. */ ne_ssl_context *ne_ssl_context_create(int mode); /* Client mode: trust the given certificate 'cert' in context 'ctx'. */ void ne_ssl_context_trustcert(ne_ssl_context *ctx, const ne_ssl_certificate *cert); /* Server mode: use given cert and key (filenames to PEM certificates). */ int ne_ssl_context_keypair(ne_ssl_context *ctx, const char *cert, const char *key); /* Server mode: set client cert verification options: required is non-zero if * a client cert is required, if ca_names is non-NULL it is a filename containing * a set of PEM certs from which CA names are sent in the ccert request. */ int ne_ssl_context_set_verify(ne_ssl_context *ctx, int required, const char *ca_names, const char *verify_cas); #define NE_SSL_CTX_SSLv2 (0) /* Set a flag for the SSL context. */ void ne_ssl_context_set_flag(ne_ssl_context *ctx, int flag, int value); /* Destroy an SSL context. */ void ne_ssl_context_destroy(ne_ssl_context *ctx); NE_END_DECLS #endif cadaver-0.23.3/lib/neon/ne_dates.c0000664000076400007640000001616510750062474016277 0ustar jortonjorton/* Date manipulation routines Copyright (C) 1999-2006, Joe Orton Copyright (C) 2004 Jiang Lei This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_STRING_H #include #endif #ifdef WIN32 #include /* for TIME_ZONE_INFORMATION */ #endif #include "ne_alloc.h" #include "ne_dates.h" #include "ne_string.h" /* Generic date manipulation routines. */ /* ISO8601: 2001-01-01T12:30:00Z */ #define ISO8601_FORMAT_Z "%04d-%02d-%02dT%02d:%02d:%lfZ" #define ISO8601_FORMAT_M "%04d-%02d-%02dT%02d:%02d:%lf-%02d:%02d" #define ISO8601_FORMAT_P "%04d-%02d-%02dT%02d:%02d:%lf+%02d:%02d" /* RFC1123: Sun, 06 Nov 1994 08:49:37 GMT */ #define RFC1123_FORMAT "%3s, %02d %3s %4d %02d:%02d:%02d GMT" /* RFC850: Sunday, 06-Nov-94 08:49:37 GMT */ #define RFC1036_FORMAT "%10s %2d-%3s-%2d %2d:%2d:%2d GMT" /* asctime: Wed Jun 30 21:49:08 1993 */ #define ASCTIME_FORMAT "%3s %3s %2d %2d:%2d:%2d %4d" static const char rfc1123_weekdays[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char short_months[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; #if defined(HAVE_STRUCT_TM_TM_GMTOFF) #define GMTOFF(t) ((t).tm_gmtoff) #elif defined(HAVE_STRUCT_TM___TM_GMTOFF) #define GMTOFF(t) ((t).__tm_gmtoff) #elif defined(WIN32) #define GMTOFF(t) (gmt_to_local_win32()) #elif defined(HAVE_TIMEZONE) /* FIXME: the following assumes fixed dst offset of 1 hour */ #define GMTOFF(t) (-timezone + ((t).tm_isdst > 0 ? 3600 : 0)) #else /* FIXME: work out the offset anyway. */ #define GMTOFF(t) (0) #endif #ifdef WIN32 time_t gmt_to_local_win32(void) { TIME_ZONE_INFORMATION tzinfo; DWORD dwStandardDaylight; long bias; dwStandardDaylight = GetTimeZoneInformation(&tzinfo); bias = tzinfo.Bias; if (dwStandardDaylight == TIME_ZONE_ID_STANDARD) bias += tzinfo.StandardBias; if (dwStandardDaylight == TIME_ZONE_ID_DAYLIGHT) bias += tzinfo.DaylightBias; return (- bias * 60); } #endif /* Returns the time/date GMT, in RFC1123-type format: eg * Sun, 06 Nov 1994 08:49:37 GMT. */ char *ne_rfc1123_date(time_t anytime) { struct tm *gmt; char *ret; gmt = gmtime(&anytime); if (gmt == NULL) return NULL; ret = ne_malloc(29 + 1); /* dates are 29 chars long */ /* it goes: Sun, 06 Nov 1994 08:49:37 GMT */ ne_snprintf(ret, 30, RFC1123_FORMAT, rfc1123_weekdays[gmt->tm_wday], gmt->tm_mday, short_months[gmt->tm_mon], 1900 + gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); return ret; } /* Takes an ISO-8601-formatted date string and returns the time_t. * Returns (time_t)-1 if the parse fails. */ time_t ne_iso8601_parse(const char *date) { struct tm gmt = {0}; int off_hour, off_min; double sec; off_t fix; int n; time_t result; /* it goes: ISO8601: 2001-01-01T12:30:00+03:30 */ if ((n = sscanf(date, ISO8601_FORMAT_P, &gmt.tm_year, &gmt.tm_mon, &gmt.tm_mday, &gmt.tm_hour, &gmt.tm_min, &sec, &off_hour, &off_min)) == 8) { gmt.tm_sec = (int)sec; fix = - off_hour * 3600 - off_min * 60; } /* it goes: ISO8601: 2001-01-01T12:30:00-03:30 */ else if ((n = sscanf(date, ISO8601_FORMAT_M, &gmt.tm_year, &gmt.tm_mon, &gmt.tm_mday, &gmt.tm_hour, &gmt.tm_min, &sec, &off_hour, &off_min)) == 8) { gmt.tm_sec = (int)sec; fix = off_hour * 3600 + off_min * 60; } /* it goes: ISO8601: 2001-01-01T12:30:00Z */ else if ((n = sscanf(date, ISO8601_FORMAT_Z, &gmt.tm_year, &gmt.tm_mon, &gmt.tm_mday, &gmt.tm_hour, &gmt.tm_min, &sec)) == 6) { gmt.tm_sec = (int)sec; fix = 0; } else { return (time_t)-1; } gmt.tm_year -= 1900; gmt.tm_isdst = -1; gmt.tm_mon--; result = mktime(&gmt) + fix; return result + GMTOFF(gmt); } /* Takes an RFC1123-formatted date string and returns the time_t. * Returns (time_t)-1 if the parse fails. */ time_t ne_rfc1123_parse(const char *date) { struct tm gmt = {0}; char wkday[4], mon[4]; int n; time_t result; /* it goes: Sun, 06 Nov 1994 08:49:37 GMT */ n = sscanf(date, RFC1123_FORMAT, wkday, &gmt.tm_mday, mon, &gmt.tm_year, &gmt.tm_hour, &gmt.tm_min, &gmt.tm_sec); /* Is it portable to check n==7 here? */ gmt.tm_year -= 1900; for (n=0; n<12; n++) if (strcmp(mon, short_months[n]) == 0) break; /* tm_mon comes out as 12 if the month is corrupt, which is desired, * since the mktime will then fail */ gmt.tm_mon = n; gmt.tm_isdst = -1; result = mktime(&gmt); return result + GMTOFF(gmt); } /* Takes a string containing a RFC1036-style date and returns the time_t */ time_t ne_rfc1036_parse(const char *date) { struct tm gmt = {0}; int n; char wkday[11], mon[4]; time_t result; /* RFC850/1036 style dates: Sunday, 06-Nov-94 08:49:37 GMT */ n = sscanf(date, RFC1036_FORMAT, wkday, &gmt.tm_mday, mon, &gmt.tm_year, &gmt.tm_hour, &gmt.tm_min, &gmt.tm_sec); if (n != 7) { return (time_t)-1; } /* portable to check n here? */ for (n=0; n<12; n++) if (strcmp(mon, short_months[n]) == 0) break; /* tm_mon comes out as 12 if the month is corrupt, which is desired, * since the mktime will then fail */ /* Defeat Y2K bug. */ if (gmt.tm_year < 50) gmt.tm_year += 100; gmt.tm_mon = n; gmt.tm_isdst = -1; result = mktime(&gmt); return result + GMTOFF(gmt); } /* (as)ctime dates are like: * Wed Jun 30 21:49:08 1993 */ time_t ne_asctime_parse(const char *date) { struct tm gmt = {0}; int n; char wkday[4], mon[4]; time_t result; n = sscanf(date, ASCTIME_FORMAT, wkday, mon, &gmt.tm_mday, &gmt.tm_hour, &gmt.tm_min, &gmt.tm_sec, &gmt.tm_year); /* portable to check n here? */ for (n=0; n<12; n++) if (strcmp(mon, short_months[n]) == 0) break; /* tm_mon comes out as 12 if the month is corrupt, which is desired, * since the mktime will then fail */ gmt.tm_mon = n; gmt.tm_isdst = -1; result = mktime(&gmt); return result + GMTOFF(gmt); } /* HTTP-date parser */ time_t ne_httpdate_parse(const char *date) { time_t tmp; tmp = ne_rfc1123_parse(date); if (tmp == -1) { tmp = ne_rfc1036_parse(date); if (tmp == -1) tmp = ne_asctime_parse(date); } return tmp; } cadaver-0.23.3/lib/neon/ne_privssl.h0000664000076400007640000000553211247475573016714 0ustar jortonjorton/* SSL interface definitions internal to neon. Copyright (C) 2003-2005, 2008, 2009, Joe Orton Copyright (C) 2004, Aleix Conchillo Flaque This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* THIS IS NOT A PUBLIC INTERFACE. You CANNOT include this header file * from an application. */ #ifndef NE_PRIVSSL_H #define NE_PRIVSSL_H /* This is the private interface between ne_socket, ne_gnutls and * ne_openssl. */ #include "ne_ssl.h" #include "ne_socket.h" #ifdef HAVE_OPENSSL #include struct ne_ssl_context_s { SSL_CTX *ctx; SSL_SESSION *sess; const char *hostname; /* for SNI */ int failures; /* bitmask of exposed failure bits. */ }; typedef SSL *ne_ssl_socket; /* Create a clicert object from cert DER {der, der_len}, using given * RSA_METHOD for the RSA object. */ NE_PRIVATE ne_ssl_client_cert * ne__ssl_clicert_exkey_import(const unsigned char *der, size_t der_len, const RSA_METHOD *method); #endif /* HAVE_OPENSSL */ #ifdef HAVE_GNUTLS #include struct ne_ssl_context_s { gnutls_certificate_credentials cred; int verify; /* non-zero if client cert verification required */ const char *hostname; /* for SNI */ /* Session cache. */ union ne_ssl_scache { struct { gnutls_datum key, data; } server; #if defined(HAVE_GNUTLS_SESSION_GET_DATA2) gnutls_datum client; #else struct { char *data; size_t len; } client; #endif } cache; #ifdef HAVE_GNUTLS_SIGN_CALLBACK_SET gnutls_sign_func sign_func; void *sign_data; #endif }; typedef gnutls_session ne_ssl_socket; NE_PRIVATE ne_ssl_client_cert * ne__ssl_clicert_exkey_import(const unsigned char *der, size_t der_len); #endif /* HAVE_GNUTLS */ #ifdef NE_HAVE_SSL NE_PRIVATE ne_ssl_socket ne__sock_sslsock(ne_socket *sock); /* Process-global initialization of the SSL library; returns non-zero * on error. */ NE_PRIVATE int ne__ssl_init(void); /* Process-global de-initialization of the SSL library. */ NE_PRIVATE void ne__ssl_exit(void); #endif #endif /* NE_PRIVSSL_H */ cadaver-0.23.3/lib/neon/ne_compress.c0000664000076400007640000003245410722565672017040 0ustar jortonjorton/* Handling of compressed HTTP responses Copyright (C) 2001-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include "ne_request.h" #include "ne_compress.h" #include "ne_utils.h" #include "ne_internal.h" #ifdef NE_HAVE_ZLIB #include /* Adds support for the 'gzip' Content-Encoding in HTTP. gzip is a * file format which wraps the DEFLATE compression algorithm. zlib * implements DEFLATE: we have to unwrap the gzip format (specified in * RFC1952) as it comes off the wire, and hand off chunks of data to * be inflated. */ struct ne_decompress_s { ne_request *request; /* associated request. */ ne_session *session; /* associated session. */ /* temporary buffer for holding inflated data. */ char outbuf[NE_BUFSIZ]; z_stream zstr; int zstrinit; /* non-zero if zstr has been initialized */ /* pass blocks back to this. */ ne_block_reader reader; ne_accept_response acceptor; void *userdata; /* buffer for gzip header bytes. */ unsigned char header[10]; size_t hdrcount; /* bytes in header */ unsigned char footer[8]; size_t footcount; /* bytes in footer. */ /* CRC32 checksum: odd that zlib uses uLong for this since it is a * 64-bit integer on LP64 platforms. */ uLong checksum; /* current state. */ enum state { NE_Z_BEFORE_DATA, /* not received any response blocks yet. */ NE_Z_PASSTHROUGH, /* response not compressed: passing through. */ NE_Z_IN_HEADER, /* received a few bytes of response data, but not * got past the gzip header yet. */ NE_Z_POST_HEADER, /* waiting for the end of the NUL-terminated bits. */ NE_Z_INFLATING, /* inflating response bytes. */ NE_Z_AFTER_DATA, /* after data; reading CRC32 & ISIZE */ NE_Z_FINISHED /* stream is finished. */ } state; }; /* Convert 'buf' to unsigned int; 'buf' must be 'unsigned char *' */ #define BUF2UINT(buf) (((buf)[3]<<24) + ((buf)[2]<<16) + ((buf)[1]<<8) + (buf)[0]) #define ID1 0x1f #define ID2 0x8b #define HDR_DONE 0 #define HDR_EXTENDED 1 #define HDR_ERROR 2 #define HDR_ID1(ctx) ((ctx)->header[0]) #define HDR_ID2(ctx) ((ctx)->header[1]) #define HDR_CMETH(ctx) ((ctx)->header[2]) #define HDR_FLAGS(ctx) ((ctx)->header[3]) #define HDR_MTIME(ctx) (BUF2UINT(&(ctx)->header[4])) #define HDR_XFLAGS(ctx) ((ctx)->header[8]) #define HDR_OS(ctx) ((ctx)->header[9]) /* parse_header parses the gzip header, sets the next state and returns * HDR_DONE: all done, bytes following are raw DEFLATE data. * HDR_EXTENDED: all done, expect a NUL-termianted string * before the DEFLATE data * HDR_ERROR: invalid header, give up (session error is set). */ static int parse_header(ne_decompress *ctx) { NE_DEBUG(NE_DBG_HTTP, "ID1: %d ID2: %d, cmeth %d, flags %d\n", HDR_ID1(ctx), HDR_ID2(ctx), HDR_CMETH(ctx), HDR_FLAGS(ctx)); if (HDR_ID1(ctx) != ID1 || HDR_ID2(ctx) != ID2 || HDR_CMETH(ctx) != 8) { ne_set_error(ctx->session, "Compressed stream invalid"); return HDR_ERROR; } NE_DEBUG(NE_DBG_HTTP, "mtime: %d, xflags: %d, os: %d\n", HDR_MTIME(ctx), HDR_XFLAGS(ctx), HDR_OS(ctx)); /* TODO: we can only handle one NUL-terminated extensions field * currently. Really, we should count the number of bits set, and * skip as many fields as bits set (bailing if any reserved bits * are set. */ if (HDR_FLAGS(ctx) == 8) { ctx->state = NE_Z_POST_HEADER; return HDR_EXTENDED; } else if (HDR_FLAGS(ctx) != 0) { ne_set_error(ctx->session, "Compressed stream not supported"); return HDR_ERROR; } NE_DEBUG(NE_DBG_HTTP, "compress: Good stream.\n"); ctx->state = NE_Z_INFLATING; return HDR_DONE; } /* Process extra 'len' bytes of 'buf' which were received after the * DEFLATE data. */ static int process_footer(ne_decompress *ctx, const unsigned char *buf, size_t len) { if (len + ctx->footcount > 8) { ne_set_error(ctx->session, "Too many bytes (%" NE_FMT_SIZE_T ") in gzip footer", len); return -1; } else { memcpy(ctx->footer + ctx->footcount, buf, len); ctx->footcount += len; if (ctx->footcount == 8) { uLong crc = BUF2UINT(ctx->footer) & 0xFFFFFFFF; if (crc == ctx->checksum) { ctx->state = NE_Z_FINISHED; NE_DEBUG(NE_DBG_HTTP, "compress: End of response; checksum match.\n"); } else { NE_DEBUG(NE_DBG_HTTP, "compress: End of response; checksum mismatch: " "given %lu vs computed %lu\n", crc, ctx->checksum); ne_set_error(ctx->session, "Checksum invalid for compressed stream"); return -1; } } } return 0; } /* A zlib function failed with 'code'; set the session error string * appropriately. */ static void set_zlib_error(ne_decompress *ctx, const char *msg, int code) { if (ctx->zstr.msg) ne_set_error(ctx->session, "%s: %s", msg, ctx->zstr.msg); else { const char *err; switch (code) { case Z_STREAM_ERROR: err = "stream error"; break; case Z_DATA_ERROR: err = "data corrupt"; break; case Z_MEM_ERROR: err = "out of memory"; break; case Z_BUF_ERROR: err = "buffer error"; break; case Z_VERSION_ERROR: err = "library version mismatch"; break; default: err = "unknown error"; break; } ne_set_error(ctx->session, _("%s: %s (code %d)"), msg, err, code); } } /* Inflate response buffer 'buf' of length 'len'. */ static int do_inflate(ne_decompress *ctx, const char *buf, size_t len) { int ret; ctx->zstr.avail_in = len; ctx->zstr.next_in = (unsigned char *)buf; ctx->zstr.total_in = 0; do { ctx->zstr.avail_out = sizeof ctx->outbuf; ctx->zstr.next_out = (unsigned char *)ctx->outbuf; ctx->zstr.total_out = 0; ret = inflate(&ctx->zstr, Z_NO_FLUSH); NE_DEBUG(NE_DBG_HTTP, "compress: inflate %d, %ld bytes out, %d remaining\n", ret, ctx->zstr.total_out, ctx->zstr.avail_in); #if 0 NE_DEBUG(NE_DBG_HTTPBODY, "Inflated body block (%ld):\n[%.*s]\n", ctx->zstr.total_out, (int)ctx->zstr.total_out, ctx->outbuf); #endif /* update checksum. */ ctx->checksum = crc32(ctx->checksum, (unsigned char *)ctx->outbuf, ctx->zstr.total_out); /* pass on the inflated data, if any */ if (ctx->zstr.total_out > 0) { int rret = ctx->reader(ctx->userdata, ctx->outbuf, ctx->zstr.total_out); if (rret) return rret; } } while (ret == Z_OK && ctx->zstr.avail_in > 0); if (ret == Z_STREAM_END) { NE_DEBUG(NE_DBG_HTTP, "compress: end of data stream, %d bytes remain.\n", ctx->zstr.avail_in); /* process the footer. */ ctx->state = NE_Z_AFTER_DATA; return process_footer(ctx, ctx->zstr.next_in, ctx->zstr.avail_in); } else if (ret != Z_OK) { set_zlib_error(ctx, _("Could not inflate data"), ret); return NE_ERROR; } return 0; } /* Callback which is passed blocks of the response body. */ static int gz_reader(void *ud, const char *buf, size_t len) { ne_decompress *ctx = ud; const char *zbuf; size_t count; const char *hdr; if (len == 0) { /* End of response: */ switch (ctx->state) { case NE_Z_BEFORE_DATA: hdr = ne_get_response_header(ctx->request, "Content-Encoding"); if (hdr && ne_strcasecmp(hdr, "gzip") == 0) { /* response was truncated: return error. */ break; } /* else, fall through */ case NE_Z_FINISHED: /* complete gzip response */ case NE_Z_PASSTHROUGH: /* complete uncompressed response */ return ctx->reader(ctx->userdata, buf, 0); default: /* invalid state: truncated response. */ break; } /* else: truncated response, fail. */ ne_set_error(ctx->session, "Compressed response was truncated"); return NE_ERROR; } switch (ctx->state) { case NE_Z_PASSTHROUGH: /* move along there. */ return ctx->reader(ctx->userdata, buf, len); case NE_Z_FINISHED: /* Could argue for tolerance, and ignoring trailing content; * but it could mean something more serious. */ if (len > 0) { ne_set_error(ctx->session, "Unexpected content received after compressed stream"); return NE_ERROR; } break; case NE_Z_BEFORE_DATA: /* work out whether this is a compressed response or not. */ hdr = ne_get_response_header(ctx->request, "Content-Encoding"); if (hdr && ne_strcasecmp(hdr, "gzip") == 0) { int ret; NE_DEBUG(NE_DBG_HTTP, "compress: got gzipped stream.\n"); /* inflateInit2() works here where inflateInit() doesn't. */ ret = inflateInit2(&ctx->zstr, -MAX_WBITS); if (ret != Z_OK) { set_zlib_error(ctx, _("Could not initialize zlib"), ret); return -1; } ctx->zstrinit = 1; } else { /* No Content-Encoding header: pass it on. TODO: we could * hack it and register the real callback now. But that * would require add_resp_body_rdr to have defined * ordering semantics etc etc */ ctx->state = NE_Z_PASSTHROUGH; return ctx->reader(ctx->userdata, buf, len); } ctx->state = NE_Z_IN_HEADER; /* FALLTHROUGH */ case NE_Z_IN_HEADER: /* copy as many bytes as possible into the buffer. */ if (len + ctx->hdrcount > 10) { count = 10 - ctx->hdrcount; } else { count = len; } memcpy(ctx->header + ctx->hdrcount, buf, count); ctx->hdrcount += count; /* have we got the full header yet? */ if (ctx->hdrcount != 10) { return 0; } buf += count; len -= count; switch (parse_header(ctx)) { case HDR_EXTENDED: if (len == 0) return 0; break; case HDR_ERROR: return NE_ERROR; case HDR_DONE: if (len > 0) { return do_inflate(ctx, buf, len); } break; } /* FALLTHROUGH */ case NE_Z_POST_HEADER: /* eating the filename string. */ zbuf = memchr(buf, '\0', len); if (zbuf == NULL) { /* not found it yet. */ return 0; } NE_DEBUG(NE_DBG_HTTP, "compresss: skipped %" NE_FMT_SIZE_T " header bytes.\n", zbuf - buf); /* found end of string. */ len -= (1 + zbuf - buf); buf = zbuf + 1; ctx->state = NE_Z_INFLATING; if (len == 0) { /* end of string was at end of buffer. */ return 0; } /* FALLTHROUGH */ case NE_Z_INFLATING: return do_inflate(ctx, buf, len); case NE_Z_AFTER_DATA: return process_footer(ctx, (unsigned char *)buf, len); } return 0; } /* Prepare for a compressed response; may be called many times per * request, for auth retries etc. */ static void gz_pre_send(ne_request *r, void *ud, ne_buffer *req) { ne_decompress *ctx = ud; if (ctx->request == r) { NE_DEBUG(NE_DBG_HTTP, "compress: Initialization.\n"); /* (Re-)Initialize the context */ ctx->state = NE_Z_BEFORE_DATA; if (ctx->zstrinit) inflateEnd(&ctx->zstr); ctx->zstrinit = 0; ctx->hdrcount = ctx->footcount = 0; ctx->checksum = crc32(0L, Z_NULL, 0); } } /* Wrapper for user-passed acceptor function. */ static int gz_acceptor(void *userdata, ne_request *req, const ne_status *st) { ne_decompress *ctx = userdata; return ctx->acceptor(ctx->userdata, req, st); } /* A slightly ugly hack: the pre_send hook is scoped per-session, so * must check that the invoking request is this one, before doing * anything, and must be unregistered when the context is * destroyed. */ ne_decompress *ne_decompress_reader(ne_request *req, ne_accept_response acpt, ne_block_reader rdr, void *userdata) { ne_decompress *ctx = ne_calloc(sizeof *ctx); ne_add_request_header(req, "Accept-Encoding", "gzip"); ne_add_response_body_reader(req, gz_acceptor, gz_reader, ctx); ctx->reader = rdr; ctx->userdata = userdata; ctx->session = ne_get_session(req); ctx->request = req; ctx->acceptor = acpt; ne_hook_pre_send(ne_get_session(req), gz_pre_send, ctx); return ctx; } void ne_decompress_destroy(ne_decompress *ctx) { if (ctx->zstrinit) inflateEnd(&ctx->zstr); ne_unhook_pre_send(ctx->session, gz_pre_send, ctx); ne_free(ctx); } #else /* !NE_HAVE_ZLIB */ /* Pass-through interface present to provide ABI compatibility. */ ne_decompress *ne_decompress_reader(ne_request *req, ne_accept_response acpt, ne_block_reader rdr, void *userdata) { ne_add_response_body_reader(req, acpt, rdr, userdata); /* an arbitrary return value: don't confuse them by returning NULL. */ return (ne_decompress *)req; } void ne_decompress_destroy(ne_decompress *dc) { } #endif /* NE_HAVE_ZLIB */ cadaver-0.23.3/lib/neon/ne_oldacl.c0000664000076400007640000000676211075170315016432 0ustar jortonjorton/* Access control Copyright (C) 2001-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* Contributed by Arun Garg */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include "ne_request.h" #include "ne_locks.h" #include "ne_alloc.h" #include "ne_string.h" #include "ne_acl.h" #include "ne_uri.h" #include "ne_xml.h" /* for NE_XML_MEDIA_TYPE */ #define EOL "\r\n" static ne_buffer *acl_body(const ne_acl_entry *right, int count) { ne_buffer *body = ne_buffer_create(); int m; ne_buffer_zappend(body, "" EOL "" EOL); for (m = 0; m < count; m++) { const char *type; type = (right[m].type == ne_acl_grant ? "grant" : "deny"); ne_buffer_concat(body, "" EOL "", NULL); switch (right[m].apply) { case ne_acl_all: ne_buffer_zappend(body, "" EOL); break; case ne_acl_property: ne_buffer_concat(body, "<", right[m].principal, "/>" EOL, NULL); break; case ne_acl_href: ne_buffer_concat(body, "", right[m].principal, "" EOL, NULL); break; } ne_buffer_concat(body, "" EOL "<", type, ">" EOL, NULL); if (right[m].read == 0) ne_buffer_concat(body, "" "" "" EOL, NULL); if (right[m].read_acl == 0) ne_buffer_concat(body, "" "" "" EOL, NULL); if (right[m].write == 0) ne_buffer_concat(body, "" "" "" EOL, NULL); if (right[m].write_acl == 0) ne_buffer_concat(body, "" "" "" EOL, NULL); if (right[m].read_cuprivset == 0) ne_buffer_concat(body, "" "" "" EOL, NULL); ne_buffer_concat(body, "" EOL, NULL); ne_buffer_zappend(body, "" EOL); } ne_buffer_zappend(body, "" EOL); return body; } int ne_acl_set(ne_session *sess, const char *uri, const ne_acl_entry *entries, int numentries) { int ret; ne_request *req = ne_request_create(sess, "ACL", uri); ne_buffer *body = acl_body(entries, numentries); #ifdef NE_HAVE_DAV ne_lock_using_resource(req, uri, 0); #endif ne_set_request_body_buffer(req, body->data, ne_buffer_size(body)); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); ret = ne_request_dispatch(req); ne_buffer_destroy(body); if (ret == NE_OK && ne_get_status(req)->code == 207) { ret = NE_ERROR; } ne_request_destroy(req); return ret; } cadaver-0.23.3/lib/neon/ne_basic.c0000664000076400007640000003105710752702217016253 0ustar jortonjorton/* Basic HTTP and WebDAV methods Copyright (C) 1999-2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include #include /* for struct stat */ #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include #include "ne_request.h" #include "ne_alloc.h" #include "ne_utils.h" #include "ne_basic.h" #include "ne_207.h" #ifdef NE_HAVE_DAV #include "ne_uri.h" #include "ne_locks.h" #endif #include "ne_dates.h" #include "ne_internal.h" int ne_getmodtime(ne_session *sess, const char *uri, time_t *modtime) { ne_request *req = ne_request_create(sess, "HEAD", uri); const char *value; int ret; ret = ne_request_dispatch(req); value = ne_get_response_header(req, "Last-Modified"); if (ret == NE_OK && ne_get_status(req)->klass != 2) { *modtime = -1; ret = NE_ERROR; } else if (value) { *modtime = ne_httpdate_parse(value); } else { *modtime = -1; } ne_request_destroy(req); return ret; } #ifdef NE_LFS #define ne_fstat fstat64 typedef struct stat64 struct_stat; #else #define ne_fstat fstat typedef struct stat struct_stat; #endif /* PUT's from fd to URI */ int ne_put(ne_session *sess, const char *uri, int fd) { ne_request *req; struct_stat st; int ret; if (ne_fstat(fd, &st)) { int errnum = errno; char buf[200]; ne_set_error(sess, _("Could not determine file size: %s"), ne_strerror(errnum, buf, sizeof buf)); return NE_ERROR; } req = ne_request_create(sess, "PUT", uri); #ifdef NE_HAVE_DAV ne_lock_using_resource(req, uri, 0); ne_lock_using_parent(req, uri); #endif ne_set_request_body_fd(req, fd, 0, st.st_size); ret = ne_request_dispatch(req); if (ret == NE_OK && ne_get_status(req)->klass != 2) ret = NE_ERROR; ne_request_destroy(req); return ret; } /* Dispatch a GET request REQ, writing the response body to FD fd. If * RANGE is non-NULL, then it is the value of the Range request * header, e.g. "bytes=1-5". Returns an NE_* error code. */ static int dispatch_to_fd(ne_request *req, int fd, const char *range) { ne_session *const sess = ne_get_session(req); const ne_status *const st = ne_get_status(req); int ret; size_t rlen; /* length of bytespec after "bytes=" */ rlen = range ? strlen(range + 6) : 0; do { const char *value; ret = ne_begin_request(req); if (ret != NE_OK) break; value = ne_get_response_header(req, "Content-Range"); /* For a 206 response, check that a Content-Range header is * given which matches the Range request header. */ if (range && st->code == 206 && (value == NULL || strncmp(value, "bytes ", 6) != 0 || strncmp(range + 6, value + 6, rlen) || (range[5 + rlen] != '-' && value[6 + rlen] != '/'))) { ne_set_error(sess, _("Response did not include requested range")); return NE_ERROR; } if ((range && st->code == 206) || (!range && st->klass == 2)) { ret = ne_read_response_to_fd(req, fd); } else { ret = ne_discard_response(req); } if (ret == NE_OK) ret = ne_end_request(req); } while (ret == NE_RETRY); return ret; } static int get_range_common(ne_session *sess, const char *uri, const char *brange, int fd) { ne_request *req = ne_request_create(sess, "GET", uri); const ne_status *status; int ret; ne_add_request_header(req, "Range", brange); ne_add_request_header(req, "Accept-Ranges", "bytes"); ret = dispatch_to_fd(req, fd, brange); status = ne_get_status(req); if (ret == NE_OK && status->code == 416) { /* connection is terminated too early with Apache/1.3, so we check * this even if ret == NE_ERROR... */ ne_set_error(sess, _("Range is not satisfiable")); ret = NE_ERROR; } else if (ret == NE_OK) { if (status->klass == 2 && status->code != 206) { ne_set_error(sess, _("Resource does not support ranged GET requests")); ret = NE_ERROR; } else if (status->klass != 2) { ret = NE_ERROR; } } ne_request_destroy(req); return ret; } int ne_get_range(ne_session *sess, const char *uri, ne_content_range *range, int fd) { char brange[64]; if (range->end == -1) { ne_snprintf(brange, sizeof brange, "bytes=%" FMT_NE_OFF_T "-", range->start); } else { ne_snprintf(brange, sizeof brange, "bytes=%" FMT_NE_OFF_T "-%" FMT_NE_OFF_T, range->start, range->end); } return get_range_common(sess, uri, brange, fd); } /* Get to given fd */ int ne_get(ne_session *sess, const char *uri, int fd) { ne_request *req = ne_request_create(sess, "GET", uri); int ret; ret = dispatch_to_fd(req, fd, NULL); if (ret == NE_OK && ne_get_status(req)->klass != 2) { ret = NE_ERROR; } ne_request_destroy(req); return ret; } /* Get to given fd */ int ne_post(ne_session *sess, const char *uri, int fd, const char *buffer) { ne_request *req = ne_request_create(sess, "POST", uri); int ret; ne_set_request_flag(req, NE_REQFLAG_IDEMPOTENT, 0); ne_set_request_body_buffer(req, buffer, strlen(buffer)); ret = dispatch_to_fd(req, fd, NULL); if (ret == NE_OK && ne_get_status(req)->klass != 2) { ret = NE_ERROR; } ne_request_destroy(req); return ret; } int ne_get_content_type(ne_request *req, ne_content_type *ct) { const char *value; char *sep, *stype; value = ne_get_response_header(req, "Content-Type"); if (value == NULL || strchr(value, '/') == NULL) { return -1; } ct->value = ne_strdup(value); stype = strchr(ct->value, '/'); *stype++ = '\0'; ct->type = ct->value; ct->charset = NULL; sep = strchr(stype, ';'); if (sep) { char *tok; /* look for the charset parameter. TODO; probably better to * hand-carve a parser than use ne_token/strstr/shave here. */ *sep++ = '\0'; do { tok = ne_qtoken(&sep, ';', "\"\'"); if (tok) { tok = strstr(tok, "charset="); if (tok) ct->charset = ne_shave(tok+8, "\"\'"); } else { break; } } while (sep != NULL); } /* set subtype, losing any trailing whitespace */ ct->subtype = ne_shave(stype, " \t"); if (ct->charset == NULL && ne_strcasecmp(ct->type, "text") == 0) { /* 3280§3.1: text/xml without charset implies us-ascii. */ if (ne_strcasecmp(ct->subtype, "xml") == 0) ct->charset = "us-ascii"; /* 2616§3.7.1: subtypes of text/ default to charset ISO-8859-1. */ else ct->charset = "ISO-8859-1"; } return 0; } static const struct options_map { const char *name; unsigned int cap; } options_map[] = { { "1", NE_CAP_DAV_CLASS1 }, { "2", NE_CAP_DAV_CLASS2 }, { "3", NE_CAP_DAV_CLASS3 }, { "", NE_CAP_MODDAV_EXEC }, { "access-control", NE_CAP_DAV_ACL }, { "version-control", NE_CAP_VER_CONTROL }, { "checkout-in-place", NE_CAP_CO_IN_PLACE }, { "version-history", NE_CAP_VER_HISTORY }, { "workspace", NE_CAP_WORKSPACE }, { "update", NE_CAP_UPDATE }, { "label", NE_CAP_LABEL }, { "working-resource", NE_CAP_WORK_RESOURCE }, { "merge", NE_CAP_MERGE }, { "baseline", NE_CAP_BASELINE }, { "version-controlled-collection", NE_CAP_VC_COLLECTION } }; static void parse_dav_header(const char *value, unsigned int *caps) { char *tokens = ne_strdup(value), *pnt = tokens; *caps = 0; do { char *tok = ne_qtoken(&pnt, ',', "\"'"); unsigned n; if (!tok) break; tok = ne_shave(tok, " \r\t\n"); for (n = 0; n < sizeof(options_map)/sizeof(options_map[0]); n++) { if (strcmp(tok, options_map[n].name) == 0) { *caps |= options_map[n].cap; } } } while (pnt != NULL); ne_free(tokens); } int ne_options2(ne_session *sess, const char *uri, unsigned int *caps) { ne_request *req = ne_request_create(sess, "OPTIONS", uri); int ret = ne_request_dispatch(req); const char *header = ne_get_response_header(req, "DAV"); if (header) parse_dav_header(header, caps); if (ret == NE_OK && ne_get_status(req)->klass != 2) { ret = NE_ERROR; } ne_request_destroy(req); return ret; } int ne_options(ne_session *sess, const char *path, ne_server_capabilities *caps) { int ret; unsigned int capmask = 0; memset(caps, 0, sizeof *caps); ret = ne_options2(sess, path, &capmask); caps->dav_class1 = capmask & NE_CAP_DAV_CLASS1 ? 1 : 0; caps->dav_class2 = capmask & NE_CAP_DAV_CLASS2 ? 1 : 0; caps->dav_executable = capmask & NE_CAP_MODDAV_EXEC ? 1 : 0; return ret; } #ifdef NE_HAVE_DAV void ne_add_depth_header(ne_request *req, int depth) { const char *value; switch(depth) { case NE_DEPTH_ZERO: value = "0"; break; case NE_DEPTH_ONE: value = "1"; break; default: value = "infinity"; break; } ne_add_request_header(req, "Depth", value); } static int copy_or_move(ne_session *sess, int is_move, int overwrite, int depth, const char *src, const char *dest) { ne_request *req = ne_request_create( sess, is_move?"MOVE":"COPY", src ); /* 2518 S8.9.2 says only use Depth: infinity with MOVE. */ if (!is_move) { ne_add_depth_header(req, depth); } #ifdef NE_HAVE_DAV if (is_move) { ne_lock_using_resource(req, src, NE_DEPTH_INFINITE); } ne_lock_using_resource(req, dest, NE_DEPTH_INFINITE); /* And we need to be able to add members to the destination's parent */ ne_lock_using_parent(req, dest); #endif if (ne_get_session_flag(sess, NE_SESSFLAG_RFC4918)) { ne_add_request_header(req, "Destination", dest); } else { ne_print_request_header(req, "Destination", "%s://%s%s", ne_get_scheme(sess), ne_get_server_hostport(sess), dest); } ne_add_request_header(req, "Overwrite", overwrite?"T":"F"); return ne_simple_request(sess, req); } int ne_copy(ne_session *sess, int overwrite, int depth, const char *src, const char *dest) { return copy_or_move(sess, 0, overwrite, depth, src, dest); } int ne_move(ne_session *sess, int overwrite, const char *src, const char *dest) { return copy_or_move(sess, 1, overwrite, 0, src, dest); } /* Deletes the specified resource. (and in only two lines of code!) */ int ne_delete(ne_session *sess, const char *uri) { ne_request *req = ne_request_create(sess, "DELETE", uri); #ifdef NE_HAVE_DAV ne_lock_using_resource(req, uri, NE_DEPTH_INFINITE); ne_lock_using_parent(req, uri); #endif /* joe: I asked on the DAV WG list about whether we might get a * 207 error back from a DELETE... conclusion, you shouldn't if * you don't send the Depth header, since we might be an HTTP/1.1 * client and a 2xx response indicates success to them. But * it's all a bit unclear. In any case, DAV servers today do * return 207 to DELETE even if we don't send the Depth header. * So we handle 207 errors appropriately. */ return ne_simple_request(sess, req); } int ne_mkcol(ne_session *sess, const char *uri) { ne_request *req; char *real_uri; int ret; if (ne_path_has_trailing_slash(uri)) { real_uri = ne_strdup(uri); } else { real_uri = ne_concat(uri, "/", NULL); } req = ne_request_create(sess, "MKCOL", real_uri); #ifdef NE_HAVE_DAV ne_lock_using_resource(req, real_uri, 0); ne_lock_using_parent(req, real_uri); #endif ret = ne_simple_request(sess, req); ne_free(real_uri); return ret; } #endif /* NE_HAVE_DAV */ cadaver-0.23.3/lib/neon/ne_sspi.c0000664000076400007640000004225110657101620016141 0ustar jortonjorton/* Microsoft SSPI based authentication routines Copyright (C) 2004-2005, Vladimir Berezniker @ http://public.xdi.org/=vmpn Copyright (C) 2007, Yves Martin This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include "ne_utils.h" #include "ne_string.h" #include "ne_socket.h" #include "ne_sspi.h" #ifdef HAVE_SSPI #define SEC_SUCCESS(Status) ((Status) >= 0) #ifndef SECURITY_ENTRYPOINT /* Missing in MingW 3.7 */ #define SECURITY_ENTRYPOINT "InitSecurityInterfaceA" #endif struct SSPIContextStruct { CtxtHandle context; char *serverName; CredHandle credentials; int continueNeeded; int authfinished; char *mechanism; int ntlm; ULONG maxTokenSize; }; typedef struct SSPIContextStruct SSPIContext; static ULONG negotiateMaxTokenSize = 0; static ULONG ntlmMaxTokenSize = 0; static HINSTANCE hSecDll = NULL; static PSecurityFunctionTable pSFT = NULL; static int initialized = 0; /* * Query specified package for it's maximum token size. */ static int getMaxTokenSize(char *package, ULONG * maxTokenSize) { SECURITY_STATUS status; SecPkgInfo *packageSecurityInfo = NULL; status = pSFT->QuerySecurityPackageInfo(package, &packageSecurityInfo); if (status == SEC_E_OK) { *maxTokenSize = packageSecurityInfo->cbMaxToken; if (pSFT->FreeContextBuffer(packageSecurityInfo) != SEC_E_OK) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Unable to free security package info."); } } else { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: QuerySecurityPackageInfo [failed] [%x].", status); return -1; } return 0; } /* * Initialize all the SSPI data */ static void initDll(HINSTANCE hSecDll) { INIT_SECURITY_INTERFACE initSecurityInterface = NULL; initSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress(hSecDll, SECURITY_ENTRYPOINT); if (initSecurityInterface == NULL) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Obtaining security interface [fail].\n"); initialized = -1; return; } else { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Obtaining security interface [ok].\n"); } pSFT = (initSecurityInterface) (); if (pSFT == NULL) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Security Function Table [fail].\n"); initialized = -2; return; } else { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Security Function Table [ok].\n"); } if (getMaxTokenSize("Negotiate", &negotiateMaxTokenSize)) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Unable to get negotiate maximum packet size"); initialized = -3; } if (getMaxTokenSize("NTLM", &ntlmMaxTokenSize)) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Unable to get negotiate maximum packet size"); initialized = -3; } } /* * This function needs to be called at least once before using any other. */ int ne_sspi_init(void) { if (initialized) { return 0; } NE_DEBUG(NE_DBG_SOCKET, "sspiInit\n"); NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Loading security dll.\n"); hSecDll = LoadLibrary("security.dll"); if (hSecDll == NULL) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Loading of security dll [fail].\n"); } else { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Loading of security dll [ok].\n"); initDll(hSecDll); if (initialized == 0) { initialized = 1; } } NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: sspiInit [%d].\n", initialized); if (initialized < 0) { return initialized; } else { return 0; } } /* * This function can be called to free resources used by SSPI. */ int ne_sspi_deinit(void) { NE_DEBUG(NE_DBG_SOCKET, "sspi: DeInit\n"); if (initialized <= 0) { return initialized; } pSFT = NULL; if (hSecDll != NULL) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Unloading security dll.\n"); if (FreeLibrary(hSecDll)) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Unloading of security dll [ok].\n"); } else { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Unloading of security dll [fail].\n"); return -1; } hSecDll = NULL; } initialized = 0; return 0; } /* * Simplification wrapper arround AcquireCredentialsHandle as most of * the parameters do not change. */ static int acquireCredentialsHandle(CredHandle * credentials, char *package) { SECURITY_STATUS status; TimeStamp timestamp; status = pSFT->AcquireCredentialsHandle(NULL, package, SECPKG_CRED_OUTBOUND, NULL, NULL, NULL, NULL, credentials, ×tamp); if (status != SEC_E_OK) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: AcquireCredentialsHandle [fail] [%x].\n", status); return -1; } return 0; } /* * Wrapper arround initializeSecurityContext. Supplies several * default parameters as well as logging in case of errors. */ static SECURITY_STATUS initializeSecurityContext(CredHandle * credentials, CtxtHandle * context, char *spn, ULONG contextReq, SecBufferDesc * inBuffer, CtxtHandle * newContext, SecBufferDesc * outBuffer) { ULONG contextAttributes; SECURITY_STATUS status; status = pSFT->InitializeSecurityContext(credentials, context, spn, contextReq, 0, SECURITY_NETWORK_DREP, inBuffer, 0, newContext, outBuffer, &contextAttributes, NULL); if (!SEC_SUCCESS(status)) { if (status == SEC_E_INVALID_TOKEN) { NE_DEBUG(NE_DBG_HTTPAUTH, "InitializeSecurityContext [fail] SEC_E_INVALID_TOKEN.\n"); } else if (status == SEC_E_UNSUPPORTED_FUNCTION) { NE_DEBUG(NE_DBG_HTTPAUTH, "InitializeSecurityContext [fail] SEC_E_UNSUPPORTED_FUNCTION.\n"); } else { NE_DEBUG(NE_DBG_HTTPAUTH, "InitializeSecurityContext [fail] [%x].\n", status); } } return status; } /* * Validates that the pointer is not NULL and converts it to its real type. */ static int getContext(void *context, SSPIContext **sspiContext) { if (!context) { return -1; } *sspiContext = context; return 0; } /* * Verifies that the buffer descriptor point only to one buffer and * returns the pointer to it. */ static int getSingleBufferDescriptor(SecBufferDesc *secBufferDesc, SecBuffer **secBuffer) { if (secBufferDesc->cBuffers != 1) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: fillBufferDescriptor " "[fail] numbers of descriptor buffers. 1 != [%d].\n", secBufferDesc->cBuffers); return -1; } *secBuffer = secBufferDesc->pBuffers; return 0; } /* * Decodes BASE64 string into SSPI SecBuffer */ static int base64ToBuffer(const char *token, SecBufferDesc * secBufferDesc) { SecBuffer *buffer; if (getSingleBufferDescriptor(secBufferDesc, &buffer)) { return -1; } buffer->BufferType = SECBUFFER_TOKEN; buffer->cbBuffer = ne_unbase64(token, (unsigned char **) &buffer->pvBuffer); if (buffer->cbBuffer == 0) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Unable to decode BASE64 SSPI token.\n"); return -1; } return 0; } /* * Creates a SecBuffer of a specified size. */ static int makeBuffer(SecBufferDesc * secBufferDesc, ULONG size) { SecBuffer *buffer; if (getSingleBufferDescriptor(secBufferDesc, &buffer)) { return -1; } buffer->BufferType = SECBUFFER_TOKEN; buffer->cbBuffer = size; buffer->pvBuffer = ne_calloc(size); return 0; } /* * Frees data allocated in the buffer. */ static int freeBuffer(SecBufferDesc * secBufferDesc) { SecBuffer *buffer; if (getSingleBufferDescriptor(secBufferDesc, &buffer)) { return -1; } if (buffer->cbBuffer > 0 && buffer->pvBuffer) { ne_free(buffer->pvBuffer); buffer->cbBuffer = 0; buffer->pvBuffer = NULL; } return 0; } /* * Canonicalize a server host name if possible. * The returned pointer must be freed after usage. */ static char *canonical_hostname(const char *serverName) { char *hostname; ne_sock_addr *addresses; /* DNS resolution. It would be useful to be able to use the * AI_CANONNAME flag where getaddrinfo() is available, but the * reverse-lookup is sufficient and simpler. */ addresses = ne_addr_resolve(serverName, 0); if (ne_addr_result(addresses)) { /* Lookup failed */ char buf[256]; NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Could not resolve IP address for `%s': %s\n", serverName, ne_addr_error(addresses, buf, sizeof buf)); hostname = ne_strdup(serverName); } else { char hostbuffer[256]; const ne_inet_addr *address = ne_addr_first(addresses); if (ne_iaddr_reverse(address, hostbuffer, sizeof hostbuffer) == 0) { hostname = ne_strdup(hostbuffer); } else { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Could not resolve host name" "from IP address for `%s'\n", serverName); hostname = ne_strdup(serverName); } } ne_addr_destroy(addresses); return hostname; } /* * Create a context to authenticate to specified server, using either * ntlm or negotiate. */ int ne_sspi_create_context(void **context, char *serverName, int ntlm) { SSPIContext *sspiContext; char *canonicalName; if (initialized <= 0) { return -1; } sspiContext = ne_calloc(sizeof(SSPIContext)); sspiContext->continueNeeded = 0; if (ntlm) { sspiContext->mechanism = "NTLM"; sspiContext->serverName = ne_strdup(serverName); sspiContext->maxTokenSize = ntlmMaxTokenSize; } else { sspiContext->mechanism = "Negotiate"; /* Canonicalize to conform to GSSAPI behavior */ canonicalName = canonical_hostname(serverName); sspiContext->serverName = ne_concat("HTTP/", canonicalName, NULL); ne_free(canonicalName); NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Created context with SPN '%s'\n", sspiContext->serverName); sspiContext->maxTokenSize = negotiateMaxTokenSize; } sspiContext->ntlm = ntlm; sspiContext->authfinished = 0; *context = sspiContext; return 0; } /* * Resets the context */ static void resetContext(SSPIContext * sspiContext) { pSFT->DeleteSecurityContext(&(sspiContext->context)); #if defined(_MSC_VER) && _MSC_VER <= 1200 pSFT->FreeCredentialHandle(&(sspiContext->credentials)); #else pSFT->FreeCredentialsHandle(&(sspiContext->credentials)); #endif sspiContext->continueNeeded = 0; } /* * Initializes supplied SecBufferDesc to point to supplied SecBuffer * that is also initialized; */ static void initSingleEmptyBuffer(SecBufferDesc * bufferDesc, SecBuffer * buffer) { buffer->BufferType = SECBUFFER_EMPTY; buffer->cbBuffer = 0; buffer->pvBuffer = NULL; bufferDesc->cBuffers = 1; bufferDesc->ulVersion = SECBUFFER_VERSION; bufferDesc->pBuffers = buffer; } /* * Destroyes the supplied context. */ int ne_sspi_destroy_context(void *context) { int status; SSPIContext *sspiContext; if (initialized <= 0) { return -1; } status = getContext(context, &sspiContext); if (status) { return status; } resetContext(sspiContext); if (sspiContext->serverName) { ne_free(sspiContext->serverName); sspiContext->serverName = NULL; } ne_free(sspiContext); return 0; } int ne_sspi_clear_context(void *context) { int status; SSPIContext *sspiContext; if (initialized <= 0) { return -1; } status = getContext(context, &sspiContext); if (status) { return status; } sspiContext->authfinished = 0; return 0; } /* * Processes received authentication tokens as well as supplies the * response token. */ int ne_sspi_authenticate(void *context, const char *base64Token, char **responseToken) { SecBufferDesc outBufferDesc; SecBuffer outBuffer; int status; SECURITY_STATUS securityStatus; ULONG contextFlags; SSPIContext *sspiContext; if (initialized <= 0) { return -1; } status = getContext(context, &sspiContext); if (status) { return status; } /* TODO: Not sure what flags should be set. joe: this needs to be * driven by the ne_auth interface; the GSSAPI code needs similar * flags. */ contextFlags = ISC_REQ_CONFIDENTIALITY | ISC_REQ_MUTUAL_AUTH; initSingleEmptyBuffer(&outBufferDesc, &outBuffer); status = makeBuffer(&outBufferDesc, sspiContext->maxTokenSize); if (status) { return status; } if (base64Token) { SecBufferDesc inBufferDesc; SecBuffer inBuffer; if (!sspiContext->continueNeeded) { freeBuffer(&outBufferDesc); NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Got an unexpected token.\n"); return -1; } initSingleEmptyBuffer(&inBufferDesc, &inBuffer); status = base64ToBuffer(base64Token, &inBufferDesc); if (status) { freeBuffer(&outBufferDesc); return status; } securityStatus = initializeSecurityContext(&sspiContext->credentials, &(sspiContext->context), sspiContext->serverName, contextFlags, &inBufferDesc, &(sspiContext->context), &outBufferDesc); if (securityStatus == SEC_E_OK) { sspiContext->authfinished = 1; } freeBuffer(&inBufferDesc); } else { if (sspiContext->continueNeeded) { freeBuffer(&outBufferDesc); NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: Expected a token from server.\n"); return -1; } if (sspiContext->authfinished && (sspiContext->credentials.dwLower || sspiContext->credentials.dwUpper)) { if (sspiContext->authfinished) { freeBuffer(&outBufferDesc); sspiContext->authfinished = 0; NE_DEBUG(NE_DBG_HTTPAUTH,"sspi: failing because starting over from failed try.\n"); return -1; } sspiContext->authfinished = 0; } /* Reset any existing context since we are starting over */ resetContext(sspiContext); if (acquireCredentialsHandle (&sspiContext->credentials, sspiContext->mechanism) != SEC_E_OK) { freeBuffer(&outBufferDesc); NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: acquireCredentialsHandle failed.\n"); return -1; } securityStatus = initializeSecurityContext(&sspiContext->credentials, NULL, sspiContext->serverName, contextFlags, NULL, &(sspiContext->context), &outBufferDesc); } if (securityStatus == SEC_I_COMPLETE_AND_CONTINUE || securityStatus == SEC_I_COMPLETE_NEEDED) { SECURITY_STATUS compleStatus = pSFT->CompleteAuthToken(&(sspiContext->context), &outBufferDesc); if (compleStatus != SEC_E_OK) { freeBuffer(&outBufferDesc); NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: CompleteAuthToken failed.\n"); return -1; } } if (securityStatus == SEC_I_COMPLETE_AND_CONTINUE || securityStatus == SEC_I_CONTINUE_NEEDED) { sspiContext->continueNeeded = 1; } else { sspiContext->continueNeeded = 0; } if (!(securityStatus == SEC_I_COMPLETE_AND_CONTINUE || securityStatus == SEC_I_COMPLETE_NEEDED || securityStatus == SEC_I_CONTINUE_NEEDED || securityStatus == SEC_E_OK)) { NE_DEBUG(NE_DBG_HTTPAUTH, "sspi: initializeSecurityContext [failed] [%x].\n", securityStatus); freeBuffer(&outBufferDesc); return -1; } *responseToken = ne_base64(outBufferDesc.pBuffers->pvBuffer, outBufferDesc.pBuffers->cbBuffer); freeBuffer(&outBufferDesc); return 0; } #endif /* HAVE_SSPI */ cadaver-0.23.3/lib/neon/ne_i18n.c0000664000076400007640000000300110304633721015731 0ustar jortonjorton/* Internationalization of neon Copyright (C) 1999-2005, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include "ne_i18n.h" #ifdef HAVE_LIBINTL_H #include #endif void ne_i18n_init(const char *encoding) { #if defined(NE_HAVE_I18N) && defined(NEON_IS_LIBRARY) /* The bindtextdomain call is only enabled if neon is built as a * library rather than as a bundled source; it would be possible * in the future to allow it for bundled builds too, if the neon * message catalogs could be installed alongside the app's own * message catalogs. */ bindtextdomain("neon", LOCALEDIR); #ifdef HAVE_BIND_TEXTDOMAIN_CODESET if (encoding) { bind_textdomain_codeset("neon", encoding); } #endif /* HAVE_BIND_TEXTDOMAIN_CODESET */ #endif } cadaver-0.23.3/lib/neon/ne_xml.c0000664000076400007640000005100011242534115015753 0ustar jortonjorton/* Wrapper interface to XML parser Copyright (C) 1999-2007, 2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #include "ne_internal.h" #include "ne_alloc.h" #include "ne_xml.h" #include "ne_utils.h" #include "ne_string.h" #if defined(HAVE_EXPAT) /* expat support: */ #ifdef HAVE_XMLPARSE_H #include "xmlparse.h" #else #include #endif typedef XML_Char ne_xml_char; #if !defined(XML_MAJOR_VERSION) #define NEED_BOM_HANDLING #elif XML_MAJOR_VERSION < 2 && XML_MINOR_VERSION == 95 && XML_MICRO_VERSION < 2 #define NEED_BOM_HANDLING #endif #elif defined(HAVE_LIBXML) /* libxml2 support: */ #include #include typedef xmlChar ne_xml_char; #if LIBXML_VERSION < 20619 /* 2.6.19 and earlier have broken BOM handling */ #define NEED_BOM_HANDLING #endif #else /* not HAVE_LIBXML */ # error need an XML parser #endif /* not HAVE_EXPAT */ /* Approx. one screen of text: */ #define ERR_SIZE (2048) struct handler { ne_xml_startelm_cb *startelm_cb; /* start-element callback */ ne_xml_endelm_cb *endelm_cb; /* end-element callback */ ne_xml_cdata_cb *cdata_cb; /* character-data callback. */ void *userdata; /* userdata for the above. */ struct handler *next; /* next handler in stack. */ }; #ifdef HAVE_LIBXML static void sax_error(void *ctx, const char *msg, ...); #endif struct element { const ne_xml_char *nspace; ne_xml_char *name; int state; /* opaque state integer */ /* Namespaces declared in this element */ ne_xml_char *default_ns; /* A default namespace */ struct namespace *nspaces; /* List of other namespace scopes */ struct handler *handler; /* Handler for this element */ struct element *parent; /* parent element, or NULL */ }; /* We pass around a ne_xml_parser as the userdata in the parsing * library. This maintains the current state of the parse and various * other bits and bobs. Within the parse, we store the current branch * of the tree, i.e., the current element and all its parents, up to * the root, but nothing other than that. */ struct ne_xml_parser_s { struct element *root; /* the root of the document */ struct element *current; /* current element in the branch */ struct handler *top_handlers; /* always points at the * handler on top of the stack. */ int failure; /* zero whilst parse should continue */ int prune; /* if non-zero, depth within a dead branch */ #ifdef NEED_BOM_HANDLING int bom_pos; #endif #ifdef HAVE_EXPAT XML_Parser parser; char *encoding; #else xmlParserCtxtPtr parser; #endif char error[ERR_SIZE]; }; /* The callback handlers */ static void start_element(void *userdata, const ne_xml_char *name, const ne_xml_char **atts); static void end_element(void *userdata, const ne_xml_char *name); static void char_data(void *userdata, const ne_xml_char *cdata, int len); static const char *resolve_nspace(const struct element *elm, const char *prefix, size_t pfxlen); /* Linked list of namespace scopes */ struct namespace { ne_xml_char *name; ne_xml_char *uri; struct namespace *next; }; #ifdef HAVE_LIBXML /* Could be const as far as we care, but libxml doesn't want that */ static xmlSAXHandler sax_handler = { NULL, /* internalSubset */ NULL, /* isStandalone */ NULL, /* hasInternalSubset */ NULL, /* hasExternalSubset */ NULL, /* resolveEntity */ NULL, /* getEntity */ NULL, /* entityDecl */ NULL, /* notationDecl */ NULL, /* attributeDecl */ NULL, /* elementDecl */ NULL, /* unparsedEntityDecl */ NULL, /* setDocumentLocator */ NULL, /* startDocument */ NULL, /* endDocument */ start_element, /* startElement */ end_element, /* endElement */ NULL, /* reference */ char_data, /* characters */ NULL, /* ignorableWhitespace */ NULL, /* processingInstruction */ NULL, /* comment */ NULL, /* xmlParserWarning */ sax_error, /* xmlParserError */ sax_error, /* fatal error (never called by libxml2?) */ NULL, /* getParameterEntity */ char_data /* cdataBlock */ }; /* empty attributes array to mimic expat behaviour */ static const char *const empty_atts[] = {NULL, NULL}; /* macro for determining the attributes array to pass */ #define PASS_ATTS(atts) (atts ? (const char **)(atts) : empty_atts) #else #define PASS_ATTS(atts) ((const char **)(atts)) /* XML declaration callback for expat. */ static void decl_handler(void *userdata, const XML_Char *version, const XML_Char *encoding, int standalone) { ne_xml_parser *p = userdata; if (encoding) p->encoding = ne_strdup(encoding); } #endif /* HAVE_LIBXML */ int ne_xml_currentline(ne_xml_parser *p) { #ifdef HAVE_EXPAT return XML_GetCurrentLineNumber(p->parser); #else return p->parser->input->line; #endif } const char *ne_xml_doc_encoding(const ne_xml_parser *p) { #ifdef HAVE_LIBXML return p->parser->encoding; #else return p->encoding; #endif } /* The first character of the REC-xml-names "NCName" rule excludes * "Digit | '.' | '-' | '_' | CombiningChar | Extender"; the XML * parser will not enforce this rule in a namespace declaration since * it treats the entire attribute name as a REC-xml "Name" rule. It's * too hard to check for all of CombiningChar | Digit | Extender here, * but the valid_ncname_ch1 macro catches some of the rest. */ /* Return non-zero if 'ch' is an invalid start character for an NCName: */ #define invalid_ncname_ch1(ch) ((ch) == '\0' || strchr("-.0123456789", (ch)) != NULL) /* Subversion repositories have been deployed which use property names * marshalled as NCNames including a colon character; these should * also be rejected but will be allowed for the time being. */ #define invalid_ncname(xn) (invalid_ncname_ch1((xn)[0])) /* Extract the namespace prefix declarations from 'atts'. */ static int declare_nspaces(ne_xml_parser *p, struct element *elm, const ne_xml_char **atts) { int n; for (n = 0; atts && atts[n]; n += 2) { if (strcmp(atts[n], "xmlns") == 0) { /* New default namespace */ elm->default_ns = ne_strdup(atts[n+1]); } else if (strncmp(atts[n], "xmlns:", 6) == 0) { struct namespace *ns; /* Reject some invalid NCNames as namespace prefix, and an * empty URI as the namespace URI */ if (invalid_ncname(atts[n] + 6) || atts[n+1][0] == '\0') { ne_snprintf(p->error, ERR_SIZE, ("XML parse error at line %d: invalid namespace " "declaration"), ne_xml_currentline(p)); return -1; } /* New namespace scope */ ns = ne_calloc(sizeof(*ns)); ns->next = elm->nspaces; elm->nspaces = ns; ns->name = ne_strdup(atts[n]+6); /* skip the xmlns= */ ns->uri = ne_strdup(atts[n+1]); } } return 0; } /* Expand an XML qualified name, which may include a namespace prefix * as well as the local part. */ static int expand_qname(ne_xml_parser *p, struct element *elm, const ne_xml_char *qname) { const ne_xml_char *pfx; pfx = strchr(qname, ':'); if (pfx == NULL) { struct element *e = elm; /* Find default namespace; guaranteed to terminate as the root * element always has default_ns="". */ while (e->default_ns == NULL) e = e->parent; elm->name = ne_strdup(qname); elm->nspace = e->default_ns; } else if (invalid_ncname(pfx + 1) || qname == pfx) { ne_snprintf(p->error, ERR_SIZE, _("XML parse error at line %d: invalid element name"), ne_xml_currentline(p)); return -1; } else { const char *uri = resolve_nspace(elm, qname, pfx-qname); if (uri) { elm->name = ne_strdup(pfx+1); elm->nspace = uri; } else { ne_snprintf(p->error, ERR_SIZE, ("XML parse error at line %d: undeclared namespace prefix"), ne_xml_currentline(p)); return -1; } } return 0; } /* Called with the start of a new element. */ static void start_element(void *userdata, const ne_xml_char *name, const ne_xml_char **atts) { ne_xml_parser *p = userdata; struct element *elm; struct handler *hand; int state = NE_XML_DECLINE; if (p->failure) return; if (p->prune) { p->prune++; return; } /* Create a new element */ elm = ne_calloc(sizeof *elm); elm->parent = p->current; p->current = elm; if (declare_nspaces(p, elm, atts) || expand_qname(p, elm, name)) { p->failure = 1; return; } /* Find a handler which will accept this element (or abort the parse) */ for (hand = elm->parent->handler; hand && state == NE_XML_DECLINE; hand = hand->next) { elm->handler = hand; state = hand->startelm_cb(hand->userdata, elm->parent->state, elm->nspace, elm->name, PASS_ATTS(atts)); } NE_DEBUG(NE_DBG_XML, "XML: start-element (%d, {%s, %s}) => %d\n", elm->parent->state, elm->nspace, elm->name, state); if (state > 0) elm->state = state; else if (state == NE_XML_DECLINE) /* prune this branch. */ p->prune++; else /* state < 0 => abort parse */ p->failure = state; } /* Destroys an element structure. */ static void destroy_element(struct element *elm) { struct namespace *this_ns, *next_ns; ne_free(elm->name); /* Free the namespaces */ this_ns = elm->nspaces; while (this_ns != NULL) { next_ns = this_ns->next; ne_free(this_ns->name); ne_free(this_ns->uri); ne_free(this_ns); this_ns = next_ns; } if (elm->default_ns) ne_free(elm->default_ns); ne_free(elm); } /* cdata SAX callback */ static void char_data(void *userdata, const ne_xml_char *data, int len) { ne_xml_parser *p = userdata; struct element *elm = p->current; if (p->failure || p->prune) return; if (elm->handler->cdata_cb) { p->failure = elm->handler->cdata_cb(elm->handler->userdata, elm->state, data, len); NE_DEBUG(NE_DBG_XML, "XML: char-data (%d) returns %d\n", elm->state, p->failure); } } /* Called with the end of an element */ static void end_element(void *userdata, const ne_xml_char *name) { ne_xml_parser *p = userdata; struct element *elm = p->current; if (p->failure) return; if (p->prune) { if (p->prune-- > 1) return; } else if (elm->handler->endelm_cb) { p->failure = elm->handler->endelm_cb(elm->handler->userdata, elm->state, elm->nspace, elm->name); if (p->failure) { NE_DEBUG(NE_DBG_XML, "XML: end-element for %d failed with %d.\n", elm->state, p->failure); } } NE_DEBUG(NE_DBG_XML, "XML: end-element (%d, {%s, %s})\n", elm->state, elm->nspace, elm->name); /* move back up the tree */ p->current = elm->parent; p->prune = 0; destroy_element(elm); } #if defined(HAVE_EXPAT) && XML_MAJOR_VERSION > 1 /* Stop the parser if an entity declaration is hit. */ static void entity_declaration(void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName) { ne_xml_parser *parser = userData; NE_DEBUG(NE_DBG_XMLPARSE, "XML: entity declaration [%s]. Failing.\n", entityName); XML_StopParser(parser->parser, XML_FALSE); } #elif defined(HAVE_EXPAT) /* A noop default_handler. */ static void default_handler(void *userData, const XML_Char *s, int len) { } #endif /* Find a namespace definition for 'prefix' in given element, where * length of prefix is 'pfxlen'. Returns the URI or NULL. */ static const char *resolve_nspace(const struct element *elm, const char *prefix, size_t pfxlen) { const struct element *s; /* Search up the tree. */ for (s = elm; s != NULL; s = s->parent) { const struct namespace *ns; /* Iterate over defined spaces on this node. */ for (ns = s->nspaces; ns != NULL; ns = ns->next) { if (strlen(ns->name) == pfxlen && memcmp(ns->name, prefix, pfxlen) == 0) return ns->uri; } } return NULL; } const char *ne_xml_resolve_nspace(ne_xml_parser *parser, const char *prefix, size_t length) { if (prefix) { return resolve_nspace(parser->current, prefix, length); } else { struct element *e = parser->current; while (e->default_ns == NULL) e = e->parent; return e->default_ns; } } ne_xml_parser *ne_xml_create(void) { ne_xml_parser *p = ne_calloc(sizeof *p); /* Placeholder for the root element */ p->current = p->root = ne_calloc(sizeof *p->root); p->root->default_ns = ""; p->root->state = 0; strcpy(p->error, _("Unknown error")); #ifdef HAVE_EXPAT p->parser = XML_ParserCreate(NULL); if (p->parser == NULL) { abort(); } XML_SetElementHandler(p->parser, start_element, end_element); XML_SetCharacterDataHandler(p->parser, char_data); XML_SetUserData(p->parser, (void *) p); XML_SetXmlDeclHandler(p->parser, decl_handler); /* Prevent the "billion laughs" attack against expat by disabling * internal entity expansion. With 2.x, forcibly stop the parser * if an entity is declared - this is safer and a more obvious * failure mode. With older versions, installing a noop * DefaultHandler means that internal entities will be expanded as * the empty string, which is also sufficient to prevent the * attack. */ #if XML_MAJOR_VERSION > 1 XML_SetEntityDeclHandler(p->parser, entity_declaration); #else XML_SetDefaultHandler(p->parser, default_handler); #endif #else /* HAVE_LIBXML */ p->parser = xmlCreatePushParserCtxt(&sax_handler, (void *)p, NULL, 0, NULL); if (p->parser == NULL) { abort(); } #if LIBXML_VERSION < 20602 p->parser->replaceEntities = 1; #else /* Enable expansion of entities, and disable network access. */ xmlCtxtUseOptions(p->parser, XML_PARSE_NOENT | XML_PARSE_NONET); #endif #endif /* HAVE_LIBXML || HAVE_EXPAT */ return p; } void ne_xml_push_handler(ne_xml_parser *p, ne_xml_startelm_cb *startelm_cb, ne_xml_cdata_cb *cdata_cb, ne_xml_endelm_cb *endelm_cb, void *userdata) { struct handler *hand = ne_calloc(sizeof(struct handler)); hand->startelm_cb = startelm_cb; hand->cdata_cb = cdata_cb; hand->endelm_cb = endelm_cb; hand->userdata = userdata; /* If this is the first handler registered, update the * base pointer too. */ if (p->top_handlers == NULL) { p->root->handler = hand; p->top_handlers = hand; } else { p->top_handlers->next = hand; p->top_handlers = hand; } } int ne_xml_parse_v(void *userdata, const char *block, size_t len) { ne_xml_parser *p = userdata; return ne_xml_parse(p, (const ne_xml_char *)block, len); } #define BOM_UTF8 "\xEF\xBB\xBF" /* UTF-8 BOM */ int ne_xml_parse(ne_xml_parser *p, const char *block, size_t len) { int ret, flag; /* duck out if it's broken */ if (p->failure) { NE_DEBUG(NE_DBG_XMLPARSE, "XML: Failed; ignoring %" NE_FMT_SIZE_T " bytes.\n", len); return p->failure; } if (len == 0) { flag = -1; block = ""; NE_DEBUG(NE_DBG_XMLPARSE, "XML: End of document.\n"); } else { NE_DEBUG(NE_DBG_XMLPARSE, "XML: Parsing %" NE_FMT_SIZE_T " bytes.\n", len); flag = 0; } #ifdef NEED_BOM_HANDLING if (p->bom_pos < 3) { NE_DEBUG(NE_DBG_XMLPARSE, "Checking for UTF-8 BOM.\n"); while (len > 0 && p->bom_pos < 3 && block[0] == BOM_UTF8[p->bom_pos]) { block++; len--; p->bom_pos++; } if (len == 0) return 0; if (p->bom_pos == 0) { p->bom_pos = 3; /* no BOM */ } else if (p->bom_pos > 0 && p->bom_pos < 3) { strcpy(p->error, _("Invalid Byte Order Mark")); return p->failure = 1; } } #endif /* Note, don't write a parser error if p->failure, since an error * will already have been written in that case. */ #ifdef HAVE_EXPAT ret = XML_Parse(p->parser, block, len, flag); NE_DEBUG(NE_DBG_XMLPARSE, "XML: XML_Parse returned %d\n", ret); if (ret == 0 && p->failure == 0) { ne_snprintf(p->error, ERR_SIZE, "XML parse error at line %" NE_FMT_XML_SIZE ": %s", XML_GetCurrentLineNumber(p->parser), XML_ErrorString(XML_GetErrorCode(p->parser))); p->failure = 1; NE_DEBUG(NE_DBG_XMLPARSE, "XML: Parse error: %s\n", p->error); } #else ret = xmlParseChunk(p->parser, block, len, flag); NE_DEBUG(NE_DBG_XMLPARSE, "XML: xmlParseChunk returned %d\n", ret); /* Parse errors are normally caught by the sax_error() callback, * which clears p->valid. */ if (p->parser->errNo && p->failure == 0) { ne_snprintf(p->error, ERR_SIZE, "XML parse error at line %d", ne_xml_currentline(p)); p->failure = 1; NE_DEBUG(NE_DBG_XMLPARSE, "XML: Parse error: %s\n", p->error); } #endif return p->failure; } int ne_xml_failed(ne_xml_parser *p) { return p->failure; } void ne_xml_destroy(ne_xml_parser *p) { struct element *elm, *parent; struct handler *hand, *next; /* Free up the handlers on the stack: the root element has the * pointer to the base of the handler stack. */ for (hand = p->root->handler; hand!=NULL; hand=next) { next = hand->next; ne_free(hand); } /* Clean up remaining elements */ for (elm = p->current; elm != p->root; elm = parent) { parent = elm->parent; destroy_element(elm); } /* free root element */ ne_free(p->root); #ifdef HAVE_EXPAT XML_ParserFree(p->parser); if (p->encoding) ne_free(p->encoding); #else xmlFreeParserCtxt(p->parser); #endif ne_free(p); } void ne_xml_set_error(ne_xml_parser *p, const char *msg) { ne_snprintf(p->error, ERR_SIZE, "%s", msg); } #ifdef HAVE_LIBXML static void sax_error(void *ctx, const char *msg, ...) { ne_xml_parser *p = ctx; va_list ap; char buf[1024]; va_start(ap, msg); ne_vsnprintf(buf, 1024, msg, ap); va_end(ap); if (p->failure == 0) { ne_snprintf(p->error, ERR_SIZE, _("XML parse error at line %d: %s"), p->parser->input->line, buf); p->failure = 1; } } #endif const char *ne_xml_get_error(ne_xml_parser *p) { return p->error; } const char * ne_xml_get_attr(ne_xml_parser *p, const char **attrs, const char *nspace, const char *name) { int n; for (n = 0; attrs[n] != NULL; n += 2) { char *pnt = strchr(attrs[n], ':'); if (!nspace && !pnt && strcmp(attrs[n], name) == 0) { return attrs[n+1]; } else if (nspace && pnt) { /* If a namespace is given, and the local part matches, * then resolve the namespace and compare that too. */ if (strcmp(pnt + 1, name) == 0) { const char *uri = resolve_nspace(p->current, attrs[n], pnt - attrs[n]); if (uri && strcmp(uri, nspace) == 0) return attrs[n+1]; } } } return NULL; } int ne_xml_mapid(const struct ne_xml_idmap map[], size_t maplen, const char *nspace, const char *name) { size_t n; for (n = 0; n < maplen; n++) if (strcmp(name, map[n].name) == 0 && strcmp(nspace, map[n].nspace) == 0) return map[n].id; return 0; } cadaver-0.23.3/lib/neon/ne_xmlreq.c0000664000076400007640000000616110506172162016475 0ustar jortonjorton/* XML/HTTP response handling Copyright (C) 2004-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include #include #include "ne_internal.h" #include "ne_xmlreq.h" #include "ne_basic.h" #include "ne_string.h" /* Handle an XML response parse error, setting session error string * and closing the connection. */ static int parse_error(ne_session *sess, ne_xml_parser *parser) { ne_set_error(sess, _("Could not parse response: %s"), ne_xml_get_error(parser)); ne_close_connection(sess); return NE_ERROR; } int ne_xml_parse_response(ne_request *req, ne_xml_parser *parser) { char buf[8000]; ssize_t bytes; int ret = 0; while ((bytes = ne_read_response_block(req, buf, sizeof buf)) > 0) { ret = ne_xml_parse(parser, buf, bytes); if (ret) return parse_error(ne_get_session(req), parser); } if (bytes == 0) { /* Tell the parser that end of document was reached: */ if (ne_xml_parse(parser, NULL, 0) == 0) return NE_OK; else return parse_error(ne_get_session(req), parser); } else { return NE_ERROR; } } /* Returns non-zero if given content-type is an XML media type, * following the RFC 3023 rules. */ static int media_type_is_xml(const ne_content_type *ctype) { size_t stlen; return (ne_strcasecmp(ctype->type, "text") == 0 && ne_strcasecmp(ctype->subtype, "xml") == 0) || (ne_strcasecmp(ctype->type, "application") == 0 && ne_strcasecmp(ctype->subtype, "xml") == 0) || ((stlen = strlen(ctype->subtype)) > 4 && ne_strcasecmp(ctype->subtype + stlen - 4, "+xml") == 0); } int ne_xml_dispatch_request(ne_request *req, ne_xml_parser *parser) { int ret; do { int parseit = 0; ret = ne_begin_request(req); if (ret) break; if (ne_get_status(req)->klass == 2) { ne_content_type ctype; if (ne_get_content_type(req, &ctype) == 0) { parseit = media_type_is_xml(&ctype); ne_free(ctype.value); } } if (parseit) ret = ne_xml_parse_response(req, parser); else ret = ne_discard_response(req); if (ret == NE_OK) ret = ne_end_request(req); } while (ret == NE_RETRY); return ret; } cadaver-0.23.3/lib/neon/COPYING.LIB0000664000076400007640000006130310127573646016011 0ustar jortonjorton GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! cadaver-0.23.3/lib/neon/ne_uri.h0000664000076400007640000000750111046071237015771 0ustar jortonjorton/* URI manipulation routines. Copyright (C) 1999-2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_URI_H #define NE_URI_H #include "ne_defs.h" NE_BEGIN_DECLS /* Return a copy of a path string with anything other than * "unreserved" and the forward-slash character percent-encoded * according to the URI encoding rules. Returns a malloc-allocated * string and never NULL. */ char *ne_path_escape(const char *path); /* Return a decoded copy of a percent-encoded path string. Returns * malloc-allocated path on success, or NULL if the string contained * any syntactically invalid percent-encoding sequences. */ char *ne_path_unescape(const char *epath); /* Returns malloc-allocated parent of path, or NULL if path has no * parent (such as "/"). */ char *ne_path_parent(const char *path); /* Returns strcmp-like value giving comparison between p1 and p2, * ignoring trailing-slashes. */ int ne_path_compare(const char *p1, const char *p2); /* Returns non-zero if child is a child of parent */ int ne_path_childof(const char *parent, const char *child); /* Returns non-zero if path has a trailing slash character */ int ne_path_has_trailing_slash(const char *path); /* Return the default port for the given scheme, or 0 if none is * known. */ unsigned int ne_uri_defaultport(const char *scheme); typedef struct { char *scheme; char *host, *userinfo; unsigned int port; char *path, *query, *fragment; } ne_uri; /* Parse a URI-reference 'uri' and place parsed components in *parsed. * Returns zero on success, non-zero on parse error. On successful or * error return, all the 'char *' fields of *parsed are either set to * NULL, or point to malloc-allocated NUL-terminated strings; * ne_uri_free can be used to free any set fields. On success, * parsed->path is guaranteed to be non-NULL. */ int ne_uri_parse(const char *uri, ne_uri *parsed); /* Turns a URI structure back into a string. The returned string is * malloc-allocated, and must be freed by the caller. */ char *ne_uri_unparse(const ne_uri *uri); /* Resolve a relative URI 'relative', with respect to base URI 'base', * placing the resultant URI in '*result'. At least both base->path * and relative->path must be non-NULL. On return, all the 'char *' * fields of *result are either set to NULL or point to * malloc-allocated NUL-terminated strings. result->path is * guaranteed to be non-NULL. ne_uri_free can be used to free the * result structure after use. Returns 'result'. */ ne_uri *ne_uri_resolve(const ne_uri *base, const ne_uri *relative, ne_uri *result); /* Compares URIs u1 and u2, returns non-zero if they are found to be * non-equal. The sign of the return value is <0 if 'u1' is less than * 'u2', or >0 if 'u2' is greater than 'u1'. */ int ne_uri_cmp(const ne_uri *u1, const ne_uri *u2); /* Copy components of URI 'src' to destination 'dest'. Returns * 'dest'. */ ne_uri *ne_uri_copy(ne_uri *dest, const ne_uri *src); /* Frees any non-NULL fields of parsed URI structure *parsed. All * fields are then zero-initialized. */ void ne_uri_free(ne_uri *parsed); NE_END_DECLS #endif /* NE_URI_H */ cadaver-0.23.3/lib/neon/memleak.h0000664000076400007640000000410010127573646016125 0ustar jortonjorton/* Memory leak wrappers Copyright (C) 2003, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* WARNING: THIS IS AN INTERNAL NEON INTERFACE AND MUST NOT BE USED * from NEON APPLICATIONS. */ /* This file contains an alternate interface to the memory allocation * wrappers in ne_alloc.c, which perform simple leak detection. It * MUST NOT BE INSTALLED, or used from neon applications. */ #ifndef MEMLEAK_H #define MEMLEAK_H #include #define ne_malloc(s) ne_malloc_ml(s, __FILE__, __LINE__) #define ne_calloc(s) ne_calloc_ml(s, __FILE__, __LINE__) #define ne_realloc(p, s) ne_realloc_ml(p, s, __FILE__, __LINE__) #define ne_strdup(s) ne_strdup_ml(s, __FILE__, __LINE__) #define ne_strndup(s, n) ne_strndup_ml(s, n, __FILE__, __LINE__) #define ne_free ne_free_ml /* Prototypes of allocation functions: */ void *ne_malloc_ml(size_t size, const char *file, int line); void *ne_calloc_ml(size_t size, const char *file, int line); void *ne_realloc_ml(void *ptr, size_t s, const char *file, int line); char *ne_strdup_ml(const char *s, const char *file, int line); char *ne_strndup_ml(const char *s, size_t n, const char *file, int line); void ne_free_ml(void *ptr); /* Dump the list of currently allocated blocks to 'f'. */ void ne_alloc_dump(FILE *f); /* Current number of bytes in allocated but not free'd. */ extern size_t ne_alloc_used; #endif /* MEMLEAK_H */ cadaver-0.23.3/lib/neon/ne_pkcs11.c0000664000076400007640000004520211111354724016265 0ustar jortonjorton/* neon PKCS#11 support Copyright (C) 2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #include "ne_pkcs11.h" #ifdef HAVE_PAKCHOIS #include #include #include "ne_internal.h" #include "ne_alloc.h" #include "ne_private.h" #include "ne_privssl.h" struct ne_ssl_pkcs11_provider_s { pakchois_module_t *module; ne_ssl_pkcs11_pin_fn pin_fn; void *pin_data; pakchois_session_t *session; ne_ssl_client_cert *clicert; ck_object_handle_t privkey; ck_key_type_t keytype; }; /* To do list for PKCS#11 support: - propagate error strings back to ne_session; use new pakchois_error() for pakchois API 0.2 - add API to specify a particular slot number to use for clicert - add API to specify a particular cert ID for clicert - find a certificate which has an issuer matching the CA dnames given by GnuTLS - make sure subject name matches between pubkey and privkey - check error handling & fail gracefully if the token is ejected mid-session - add API to enumerate/search provided certs and allow direct choice? (or just punt) - the session<->provider interface requires that one clicert is used for all sessions. remove this limitation - add API to import all CA certs as trusted (CKA_CERTIFICATE_CATEGORY seems to be unused unfortunately; just add all X509 certs with CKA_TRUSTED set to true)) - make DSA work */ #ifdef HAVE_OPENSSL #include #include #define PK11_RSA_ERR (RSA_F_RSA_EAY_PRIVATE_ENCRYPT) /* RSA_METHOD ->rsa_sign calback. */ static int pk11_rsa_sign(int type, const unsigned char *m, unsigned int mlen, unsigned char *sigret, unsigned int *siglen, const RSA *r) { ne_ssl_pkcs11_provider *prov = (ne_ssl_pkcs11_provider *)r->meth->app_data; ck_rv_t rv; struct ck_mechanism mech; unsigned long len; if (!prov->session || prov->privkey == CK_INVALID_HANDLE) { NE_DEBUG(NE_DBG_SSL, "pk11: Cannot sign, no session/key.\n"); RSAerr(PK11_RSA_ERR,ERR_R_RSA_LIB); return 0; } mech.mechanism = CKM_RSA_PKCS; mech.parameter = NULL; mech.parameter_len = 0; /* Initialize signing operation; using the private key discovered * earlier. */ rv = pakchois_sign_init(prov->session, &mech, prov->privkey); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: SignInit failed: %lx.\n", rv); RSAerr(PK11_RSA_ERR, ERR_R_RSA_LIB); return 0; } len = *siglen = RSA_size(r); rv = pakchois_sign(prov->session, (unsigned char *)m, mlen, sigret, &len); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: Sign failed.\n"); RSAerr(PK11_RSA_ERR, ERR_R_RSA_LIB); return 0; } NE_DEBUG(NE_DBG_SSL, "pk11: Signed successfully.\n"); return 1; } /* RSA_METHOD ->rsa_init implementation; called during RSA_new(rsa). */ static int pk11_rsa_init(RSA *rsa) { /* Ensures that RSA_sign() uses meth->rsa_sign: */ rsa->flags |= RSA_FLAG_SIGN_VER; return 1; } /* RSA_METHOD ->rsa_finish implementation; called during * RSA_free(rsa). */ static int pk11_rsa_finish(RSA *rsa) { RSA_METHOD *meth = (RSA_METHOD *)rsa->meth; /* Freeing the dynamically allocated method here works as well as * doing anything else: */ ne_free(meth); /* Does not appear that rsa->meth will be used after this, but in * case it is, ensure a NULL pointer dereference rather than a * random pointer dereference. */ rsa->meth = NULL; return 0; } /* Return an RSA_METHOD which will use the PKCS#11 provider to * implement the signing operation. */ static RSA_METHOD *pk11_rsa_method(ne_ssl_pkcs11_provider *prov) { RSA_METHOD *m = ne_calloc(sizeof *m); m->name = "neon PKCS#11"; m->rsa_sign = pk11_rsa_sign; m->init = pk11_rsa_init; m->finish = pk11_rsa_finish; /* This is hopefully under complete control of the RSA_METHOD, * otherwise there is nowhere to put this. */ m->app_data = (char *)prov; m->flags = RSA_METHOD_FLAG_NO_CHECK; return m; } #endif static int pk11_find_x509(ne_ssl_pkcs11_provider *prov, pakchois_session_t *pks, unsigned char *certid, unsigned long *cid_len) { struct ck_attribute a[3]; ck_object_class_t class; ck_certificate_type_t type; ck_rv_t rv; ck_object_handle_t obj; unsigned long count; int found = 0; /* Find objects with cert class and X.509 cert type. */ class = CKO_CERTIFICATE; type = CKC_X_509; a[0].type = CKA_CLASS; a[0].value = &class; a[0].value_len = sizeof class; a[1].type = CKA_CERTIFICATE_TYPE; a[1].value = &type; a[1].value_len = sizeof type; rv = pakchois_find_objects_init(pks, a, 2); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: FindObjectsInit failed.\n"); return 0; } while (pakchois_find_objects(pks, &obj, 1, &count) == CKR_OK && count == 1) { unsigned char value[8192], subject[8192]; a[0].type = CKA_VALUE; a[0].value = value; a[0].value_len = sizeof value; a[1].type = CKA_ID; a[1].value = certid; a[1].value_len = *cid_len; a[2].type = CKA_SUBJECT; a[2].value = subject; a[2].value_len = sizeof subject; if (pakchois_get_attribute_value(pks, obj, a, 3) == CKR_OK) { ne_ssl_client_cert *cc; #ifdef HAVE_GNUTLS cc = ne__ssl_clicert_exkey_import(value, a[0].value_len); #else cc = ne__ssl_clicert_exkey_import(value, a[0].value_len, pk11_rsa_method(prov)); #endif if (cc) { NE_DEBUG(NE_DBG_SSL, "pk11: Imported X.509 cert.\n"); prov->clicert = cc; found = 1; *cid_len = a[1].value_len; break; } } else { NE_DEBUG(NE_DBG_SSL, "pk11: Skipped cert, missing attrs.\n"); } } pakchois_find_objects_final(pks); return found; } #ifdef HAVE_OPENSSL /* No DSA support for OpenSSL (yet, anyway). */ #define KEYTYPE_IS_DSA(kt) (0) #else #define KEYTYPE_IS_DSA(kt) (kt == CKK_DSA) #endif static int pk11_find_pkey(ne_ssl_pkcs11_provider *prov, pakchois_session_t *pks, unsigned char *certid, unsigned long cid_len) { struct ck_attribute a[3]; ck_object_class_t class; ck_rv_t rv; ck_object_handle_t obj; unsigned long count; int found = 0; class = CKO_PRIVATE_KEY; /* Find an object with private key class and a certificate ID * which matches the certificate. */ /* FIXME: also match the cert subject. */ a[0].type = CKA_CLASS; a[0].value = &class; a[0].value_len = sizeof class; a[1].type = CKA_ID; a[1].value = certid; a[1].value_len = cid_len; rv = pakchois_find_objects_init(pks, a, 2); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: FindObjectsInit failed.\n"); /* TODO: error propagation */ return 0; } rv = pakchois_find_objects(pks, &obj, 1, &count); if (rv == CKR_OK && count == 1) { NE_DEBUG(NE_DBG_SSL, "pk11: Found private key.\n"); a[0].type = CKA_KEY_TYPE; a[0].value = &prov->keytype; a[0].value_len = sizeof prov->keytype; if (pakchois_get_attribute_value(pks, obj, a, 1) == CKR_OK && (prov->keytype == CKK_RSA || KEYTYPE_IS_DSA(prov->keytype))) { found = 1; prov->privkey = obj; } else { NE_DEBUG(NE_DBG_SSL, "pk11: Could not determine key type.\n"); } } pakchois_find_objects_final(pks); return found; } static int find_client_cert(ne_ssl_pkcs11_provider *prov, pakchois_session_t *pks) { unsigned char certid[8192]; unsigned long cid_len = sizeof certid; /* TODO: match cert subject too. */ return pk11_find_x509(prov, pks, certid, &cid_len) && pk11_find_pkey(prov, pks, certid, cid_len); } #ifdef HAVE_GNUTLS /* Callback invoked by GnuTLS to provide the signature. The signature * operation is handled here by the PKCS#11 provider. */ static int pk11_sign_callback(gnutls_session_t session, void *userdata, gnutls_certificate_type_t cert_type, const gnutls_datum_t *cert, const gnutls_datum_t *hash, gnutls_datum_t *signature) { ne_ssl_pkcs11_provider *prov = userdata; ck_rv_t rv; struct ck_mechanism mech; unsigned long siglen; if (!prov->session || prov->privkey == CK_INVALID_HANDLE) { NE_DEBUG(NE_DBG_SSL, "pk11: Cannot sign, no session/key.\n"); return GNUTLS_E_NO_CERTIFICATE_FOUND; } mech.mechanism = prov->keytype == CKK_DSA ? CKM_DSA : CKM_RSA_PKCS; mech.parameter = NULL; mech.parameter_len = 0; /* Initialize signing operation; using the private key discovered * earlier. */ rv = pakchois_sign_init(prov->session, &mech, prov->privkey); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: SignInit failed: %lx.\n", rv); return GNUTLS_E_PK_SIGN_FAILED; } /* Work out how long the signature must be: */ rv = pakchois_sign(prov->session, hash->data, hash->size, NULL, &siglen); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: Sign1 failed.\n"); return GNUTLS_E_PK_SIGN_FAILED; } signature->data = gnutls_malloc(siglen); signature->size = siglen; rv = pakchois_sign(prov->session, hash->data, hash->size, signature->data, &siglen); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: Sign2 failed.\n"); return GNUTLS_E_PK_SIGN_FAILED; } NE_DEBUG(NE_DBG_SSL, "pk11: Signed successfully.\n"); return 0; } #endif static void terminate_string(unsigned char *str, size_t len) { unsigned char *ptr = str + len - 1; while ((*ptr == ' ' || *ptr == '\t' || *ptr == '\0') && ptr >= str) ptr--; if (ptr == str - 1) str[0] = '\0'; else if (ptr == str + len - 1) str[len-1] = '\0'; else ptr[1] = '\0'; } static int pk11_login(ne_ssl_pkcs11_provider *prov, ck_slot_id_t slot_id, pakchois_session_t *pks, struct ck_slot_info *sinfo) { struct ck_token_info tinfo; int attempt = 0; ck_rv_t rv; if (pakchois_get_token_info(prov->module, slot_id, &tinfo) != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: GetTokenInfo failed\n"); /* TODO: propagate error. */ return -1; } if ((tinfo.flags & CKF_LOGIN_REQUIRED) == 0) { NE_DEBUG(NE_DBG_SSL, "pk11: No login required.\n"); return 0; } /* For a token with a "protected" (out-of-band) authentication * path, calling login with a NULL username is all that is * required. */ if (tinfo.flags & CKF_PROTECTED_AUTHENTICATION_PATH) { if (pakchois_login(pks, CKU_USER, NULL, 0) == CKR_OK) { return 0; } else { NE_DEBUG(NE_DBG_SSL, "pk11: Protected login failed.\n"); /* TODO: error propagation. */ return -1; } } /* Otherwise, PIN entry is necessary for login, so fail if there's * no callback. */ if (!prov->pin_fn) { NE_DEBUG(NE_DBG_SSL, "pk11: No pin callback but login required.\n"); /* TODO: propagate error. */ return -1; } terminate_string(sinfo->slot_description, sizeof sinfo->slot_description); do { char pin[NE_SSL_P11PINLEN]; unsigned int flags = 0; /* If login has been attempted once already, check the token * status again, the flags might change. */ if (attempt) { if (pakchois_get_token_info(prov->module, slot_id, &tinfo) != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: GetTokenInfo failed\n"); /* TODO: propagate error. */ return -1; } } if (tinfo.flags & CKF_USER_PIN_COUNT_LOW) flags |= NE_SSL_P11PIN_COUNT_LOW; if (tinfo.flags & CKF_USER_PIN_FINAL_TRY) flags |= NE_SSL_P11PIN_FINAL_TRY; terminate_string(tinfo.label, sizeof tinfo.label); if (prov->pin_fn(prov->pin_data, attempt++, (char *)sinfo->slot_description, (char *)tinfo.label, flags, pin)) { return -1; } rv = pakchois_login(pks, CKU_USER, (unsigned char *)pin, strlen(pin)); /* Try to scrub the pin off the stack. Clever compilers will * probably optimize this away, oh well. */ memset(pin, 0, sizeof pin); } while (rv == CKR_PIN_INCORRECT); NE_DEBUG(NE_DBG_SSL, "pk11: Login result = %lu\n", rv); return (rv == CKR_OK || rv == CKR_USER_ALREADY_LOGGED_IN) ? 0 : -1; } static void pk11_provide(void *userdata, ne_session *sess, const ne_ssl_dname *const *dnames, int dncount) { ne_ssl_pkcs11_provider *prov = userdata; ck_slot_id_t *slots; unsigned long scount, n; if (prov->clicert) { NE_DEBUG(NE_DBG_SSL, "pk11: Using existing clicert.\n"); ne_ssl_set_clicert(sess, prov->clicert); return; } if (pakchois_get_slot_list(prov->module, 1, NULL, &scount) != CKR_OK || scount == 0) { NE_DEBUG(NE_DBG_SSL, "pk11: No slots.\n"); /* TODO: propagate error. */ return; } slots = ne_malloc(scount * sizeof *slots); if (pakchois_get_slot_list(prov->module, 1, slots, &scount) != CKR_OK) { ne_free(slots); NE_DEBUG(NE_DBG_SSL, "pk11: Really, no slots?\n"); /* TODO: propagate error. */ return; } NE_DEBUG(NE_DBG_SSL, "pk11: Found %ld slots.\n", scount); for (n = 0; n < scount; n++) { pakchois_session_t *pks; ck_rv_t rv; struct ck_slot_info sinfo; if (pakchois_get_slot_info(prov->module, slots[n], &sinfo) != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: GetSlotInfo failed\n"); continue; } if ((sinfo.flags & CKF_TOKEN_PRESENT) == 0) { NE_DEBUG(NE_DBG_SSL, "pk11: slot empty, ignoring\n"); continue; } rv = pakchois_open_session(prov->module, slots[n], CKF_SERIAL_SESSION, NULL, NULL, &pks); if (rv != CKR_OK) { NE_DEBUG(NE_DBG_SSL, "pk11: could not open slot, %ld (%ld: %ld)\n", rv, n, slots[n]); continue; } if (pk11_login(prov, slots[n], pks, &sinfo) == 0) { if (find_client_cert(prov, pks)) { NE_DEBUG(NE_DBG_SSL, "pk11: Setup complete.\n"); prov->session = pks; ne_ssl_set_clicert(sess, prov->clicert); ne_free(slots); return; } } pakchois_close_session(pks); } ne_free(slots); } static int pk11_init(ne_ssl_pkcs11_provider **provider, pakchois_module_t *module) { ne_ssl_pkcs11_provider *prov; prov = *provider = ne_calloc(sizeof *prov); prov->module = module; prov->privkey = CK_INVALID_HANDLE; return NE_PK11_OK; } int ne_ssl_pkcs11_provider_init(ne_ssl_pkcs11_provider **provider, const char *name) { pakchois_module_t *pm; if (pakchois_module_load(&pm, name) == CKR_OK) { return pk11_init(provider, pm); } else { return NE_PK11_FAILED; } } int ne_ssl_pkcs11_nss_provider_init(ne_ssl_pkcs11_provider **provider, const char *name, const char *directory, const char *cert_prefix, const char *key_prefix, const char *secmod_db) { pakchois_module_t *pm; if (pakchois_module_nssload(&pm, name, directory, cert_prefix, key_prefix, secmod_db) == CKR_OK) { return pk11_init(provider, pm); } else { return NE_PK11_FAILED; } } void ne_ssl_pkcs11_provider_pin(ne_ssl_pkcs11_provider *provider, ne_ssl_pkcs11_pin_fn fn, void *userdata) { provider->pin_fn = fn; provider->pin_data = userdata; } void ne_ssl_set_pkcs11_provider(ne_session *sess, ne_ssl_pkcs11_provider *provider) { #ifdef HAVE_GNUTLS sess->ssl_context->sign_func = pk11_sign_callback; sess->ssl_context->sign_data = provider; #endif ne_ssl_provide_clicert(sess, pk11_provide, provider); } void ne_ssl_pkcs11_provider_destroy(ne_ssl_pkcs11_provider *prov) { if (prov->session) { pakchois_close_session(prov->session); } if (prov->clicert) { ne_ssl_clicert_free(prov->clicert); } pakchois_module_destroy(prov->module); ne_free(prov); } #else /* !HAVE_PAKCHOIS */ int ne_ssl_pkcs11_provider_init(ne_ssl_pkcs11_provider **provider, const char *name) { return NE_PK11_NOTIMPL; } int ne_ssl_pkcs11_nss_provider_init(ne_ssl_pkcs11_provider **provider, const char *name, const char *directory, const char *cert_prefix, const char *key_prefix, const char *secmod_db) { return NE_PK11_NOTIMPL; } void ne_ssl_pkcs11_provider_destroy(ne_ssl_pkcs11_provider *provider) { } void ne_ssl_pkcs11_provider_pin(ne_ssl_pkcs11_provider *provider, ne_ssl_pkcs11_pin_fn fn, void *userdata) { } void ne_ssl_set_pkcs11_provider(ne_session *sess, ne_ssl_pkcs11_provider *provider) { } #endif /* HAVE_PAKCHOIS */ cadaver-0.23.3/lib/neon/ne_string.h0000664000076400007640000001647411240311511016475 0ustar jortonjorton/* String utility functions Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_STRING_H #define NE_STRING_H #include "ne_defs.h" #include "ne_alloc.h" #include NE_BEGIN_DECLS /* ne_token and ne_qtoken return the next token in *str before either * the next separator character 'sep' or the NUL terminator. * ne_qtoken skips over any parts quoted using a pair of any one of * the characters given in 'quotes'. After returning, *str will point * to the next character after the separator, or NULL if no separator * character was found. * * ne_qtoken will return NULL if unterminated quotes are found. */ char *ne_token(char **str, char sep); char *ne_qtoken(char **str, char sep, const char *quotes); /* Return portion of 'str' with any characters in 'whitespace' shaved * off the beginning and end. Modifies str in-place. */ char *ne_shave(char *str, const char *whitespace); /* Cleanse 'str' of non-printable (e.g. control) characters. 'str' is * modified in-place, and returned. */ char *ne_strclean(char *str); /* Encode 'len' bytes of 'text' to base64. Returns malloc-allocated * NUL-terminated buffer which the caller must free(). */ char *ne_base64(const unsigned char *text, size_t len); /* Decode NUL-terminated base64-encoded string 'data', placing * malloc-allocated raw decoder output in '*out'. Returns length, or * zero on decode error (in which case the content of *out is * undefined). */ size_t ne_unbase64(const char *data, unsigned char **out); /* Dynamically-allocated string buffer. A string buffer which grows * dynamically . (Strings are zero-terminated still). A * string buffer ne_buffer which grows dynamically with the string. */ typedef struct { char *data; /* contents: NUL-terminated string */ size_t used; /* strlen(data) + 1 */ size_t length; /* number of bytes allocated */ } ne_buffer; /* Create a new string buffer object. */ ne_buffer *ne_buffer_create(void); /* Create a new string buffer object with at least 'size' bytes of * allocated space. */ ne_buffer *ne_buffer_ncreate(size_t size); /* Returns size of data in buffer, equiv to strlen(ne_buffer_data(buf)) */ #define ne_buffer_size(buf) ((buf)->used - 1) /* Concatenate all given strings onto the end of the buffer. The * strings must all be NUL-terminated, and MUST be followed by a NULL * argument marking the end of the list. */ void ne_buffer_concat(ne_buffer *buf, ...) ne_attribute_sentinel; /* Append a NUL-terminated string 'str' to buf. */ void ne_buffer_zappend(ne_buffer *buf, const char *str); /* Append 'len' bytes of 'data' to buf, where 'data' does not contain * a NUL terminator. (A NUL terminator is appended to buf) */ void ne_buffer_append(ne_buffer *buf, const char *data, size_t len); /* Append 'len' bytes of 'data' to buf. All non-ASCII bytes, and * ASCII control characters, are escaped. (Note that this includes * the NUL byte). */ void ne_buffer_qappend(ne_buffer *buf, const unsigned char *data, size_t len); /* Print a string to the end of the buffer using printf-style format * string 'format' and subsqeuent arguments. At most 'max' characters * are appended; the number of characters appended (excluding the NUL * terminator) is returned. Behaviour is undefined if 'max' is passed * as zero. */ size_t ne_buffer_snprintf(ne_buffer *buf, size_t max, const char *format, ...) ne_attribute((format(printf, 3, 4))); /* Append a literal, NUL-terminated constant string 'str' to buffer * 'buf'. */ #define ne_buffer_czappend(buf, str) \ ne_buffer_append((buf), (str), sizeof((str)) - 1) /* Clear the string buffer 'buf', making it equivalent to the empty * string. */ void ne_buffer_clear(ne_buffer *buf); /* Grow the allocated size of string buffer 'buf' to at least 'size' * bytes. */ void ne_buffer_grow(ne_buffer *buf, size_t size); /* Re-establish the 'used' invariant if the string buffer data field is * altered directly. */ void ne_buffer_altered(ne_buffer *buf); /* Destroy the string buffer object 'buf' without deallocating the * data string. The data string must subsequently be freed using * ne_free(). */ char *ne_buffer_finish(ne_buffer *buf); /* Destroy a string buffer object. */ void ne_buffer_destroy(ne_buffer *buf); /* Thread-safe strerror() wrapper; place system error for errno value * 'errnum' in 'buffer', which is of length 'buflen'. Returns * 'buffer'. */ char *ne_strerror(int errnum, char *buffer, size_t buflen); /* ne_strnzcpy copies at most 'n'-1 bytes of 'src' to 'dest', and * ensures that 'dest' is subsequently NUL-terminated. */ #define ne_strnzcpy(dest, src, n) do { size_t ne__nm1 = (n) - 1; \ strncpy(dest, src, ne__nm1); dest[ne__nm1] = '\0'; } while (0) /* Return a malloc-allocated copy of 'data', of length 'len', with all * non-ASCII bytes, and ASCII control characters escaped. (Note that * the escaping includes the NUL byte). */ char *ne_strnqdup(const unsigned char *data, size_t len); /* Return malloc-allocated concatenation of all NUL-terminated string * arguments, up to a terminating NULL pointer. */ char *ne_concat(const char *str, ...) ne_attribute_sentinel; /* Wrapper for snprintf: always NUL-terminates returned buffer, and * returns strlen(str). */ size_t ne_snprintf(char *str, size_t size, const char *fmt, ...) ne_attribute((format(printf, 3, 4))); /* Wrapper for vsnprintf. */ size_t ne_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) ne_attribute((format(printf, 3, 0))); /* Implementations of strcasecmp and strncasecmp which behave as * defined by the ANSI C strcasecmp() and strncasecmp() when in the * POSIX locale; i.e. ignoring the process locale. */ /* Compares 's1' and 's2', ignoring differences in case. */ int ne_strcasecmp(const char *s1, const char *s2); /* Compares up to 'n' characters of 's1' and 's2', ignoring * differences in case. */ int ne_strncasecmp(const char *s1, const char *s2, size_t n); /* Return lowercase 'c' as in POSIX locale; note difference from ANSI * C semantics as both the argument and return value are unsigned * char. */ #define ne_tolower(c) (ne_tolower_array()[(unsigned char)c]) const unsigned char *ne_tolower_array(void); /* Convert an ASCII hexadecimal character in the ranges '0'..'9' * 'a'..'f' 'A'..'F' to its numeric equivalent. */ #define NE_ASC2HEX(x) (((x) <= '9') ? ((x) - '0') : \ (ne_tolower((x)) + 10 - 'a')) /* Convert an integer in the range 0..15 to the equivalent (lowercase) * ASCII hexadecimal equivalent character, in the range '0..9,'a..f' */ #define NE_HEX2ASC(x) ((char) ((x) > 9 ? ((x) - 10 + 'a') : ((x) + '0'))) NE_END_DECLS #endif /* NE_STRING_H */ cadaver-0.23.3/lib/neon/ne_socket.c0000664000076400007640000014511111305555706016463 0ustar jortonjorton/* Socket handling routines Copyright (C) 1998-2009, Joe Orton Copyright (C) 2004 Aleix Conchillo Flaque This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* portions were originally under GPL in Mutt, http://www.mutt.org/ Relicensed under LGPL for neon, http://www.webdav.org/neon/ */ #include "config.h" #include #ifdef HAVE_SYS_TIME_H #include #endif #include #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef NE_USE_POLL #include #elif defined(HAVE_SYS_SELECT_H) #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_NETINET_TCP_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef WIN32 #include #include #ifdef USE_GETADDRINFO #include #include #endif #endif #if defined(HAVE_OPENSSL) && defined(HAVE_LIMITS_H) #include /* for INT_MAX */ #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SOCKS_H #include #endif #ifdef HAVE_OPENSSL #include #include #include /* for PKCS12_PBE_add */ #include #include /* for OPENSSL_VERSION_NUMBER */ #endif #ifdef HAVE_GNUTLS #include #endif #define NE_INET_ADDR_DEFINED /* A slightly ugly hack: change the ne_inet_addr definition to be the * real address type used. The API only exposes ne_inet_addr as a * pointer to an opaque object, so this should be well-defined * behaviour. It avoids the hassle of a real wrapper ne_inet_addr * structure, or losing type-safety by using void *. */ #ifdef USE_GETADDRINFO typedef struct addrinfo ne_inet_addr; #else typedef struct in_addr ne_inet_addr; #endif #include "ne_privssl.h" /* MUST come after ne_inet_addr is defined */ /* To avoid doing AAAA queries unless absolutely necessary, either use * AI_ADDRCONFIG where available, or a run-time check for working IPv6 * support; the latter is only known to work on Linux. */ #if defined(USE_GETADDRINFO) && !defined(USE_GAI_ADDRCONFIG) && defined(__linux__) #define USE_CHECK_IPV6 #endif /* "Be Conservative In What You Build". */ #if defined(HAVE_FCNTL) && defined(O_NONBLOCK) && defined(F_SETFL) \ && defined(HAVE_GETSOCKOPT) && defined(SO_ERROR) \ && defined(HAVE_SOCKLEN_T) && defined(SOL_SOCKET) \ && defined(EINPROGRESS) #define USE_NONBLOCKING_CONNECT #endif #include "ne_internal.h" #include "ne_utils.h" #include "ne_string.h" #include "ne_socket.h" #include "ne_alloc.h" #include "ne_sspi.h" #if defined(__BEOS__) && !defined(BONE_VERSION) /* pre-BONE */ #define ne_close(s) closesocket(s) #define ne_errno errno #elif defined(WIN32) #define ne_close(s) closesocket(s) #define ne_errno WSAGetLastError() #else /* really Unix! */ #define ne_close(s) close(s) #define ne_errno errno #endif #ifdef WIN32 #define NE_ISRESET(e) ((e) == WSAECONNABORTED || (e) == WSAETIMEDOUT || \ (e) == WSAECONNRESET || (e) == WSAENETRESET) #define NE_ISCLOSED(e) ((e) == WSAESHUTDOWN || (e) == WSAENOTCONN) #define NE_ISINTR(e) (0) #define NE_ISINPROGRESS(e) ((e) == WSAEWOULDBLOCK) /* says MSDN */ #else /* Unix */ /* Also treat ECONNABORTED and ENOTCONN as "connection reset" errors; * both can be returned by Winsock-based sockets layers e.g. CygWin */ #ifndef ECONNABORTED #define ECONNABORTED ECONNRESET #endif #ifndef ENOTCONN #define ENOTCONN ECONNRESET #endif #define NE_ISRESET(e) ((e) == ECONNRESET || (e) == ECONNABORTED || (e) == ENOTCONN) #define NE_ISCLOSED(e) ((e) == EPIPE) #define NE_ISINTR(e) ((e) == EINTR) #define NE_ISINPROGRESS(e) ((e) == EINPROGRESS) #endif /* Socket read timeout */ #define SOCKET_READ_TIMEOUT 120 /* Critical I/O functions on a socket: useful abstraction for easily * handling SSL I/O alongside raw socket I/O. */ struct iofns { /* Read up to 'len' bytes into 'buf' from socket. Return <0 on * error or EOF, or >0; number of bytes read. */ ssize_t (*sread)(ne_socket *s, char *buf, size_t len); /* Write up to 'len' bytes from 'buf' to socket. Return number of * bytes written on success, or <0 on error. */ ssize_t (*swrite)(ne_socket *s, const char *buf, size_t len); /* Wait up to 'n' seconds for socket to become readable. Returns * 0 when readable, otherwise NE_SOCK_TIMEOUT or NE_SOCK_ERROR. */ int (*readable)(ne_socket *s, int n); /* Write up to 'count' blocks described by 'vector' to socket. * Return number of bytes written on success, or <0 on error. */ ssize_t (*swritev)(ne_socket *s, const struct ne_iovec *vector, int count); }; static const ne_inet_addr dummy_laddr; struct ne_socket_s { int fd; unsigned int lport; const ne_inet_addr *laddr; void *progress_ud; int rdtimeout, cotimeout; /* timeouts */ const struct iofns *ops; #ifdef NE_HAVE_SSL ne_ssl_socket ssl; #endif /* The read buffer: ->buffer stores byte which have been read; as * these are consumed and passed back to the caller, bufpos * advances through ->buffer. ->bufavail gives the number of * bytes which remain to be consumed in ->buffer (from ->bufpos), * and is hence always <= RDBUFSIZ. */ char *bufpos; size_t bufavail; #define RDBUFSIZ 4096 char buffer[RDBUFSIZ]; /* Error string. */ char error[192]; }; /* ne_sock_addr represents an Internet address. */ struct ne_sock_addr_s { #ifdef USE_GETADDRINFO struct addrinfo *result, *cursor; #else struct in_addr *addrs; size_t cursor, count; #endif int errnum; }; /* set_error: set socket error string to 'str'. */ #define set_error(s, str) ne_strnzcpy((s)->error, (str), sizeof (s)->error) /* set_strerror: set socket error to system error string for 'errnum' */ #ifdef WIN32 /* Print system error message to given buffer. */ static void print_error(int errnum, char *buffer, size_t buflen) { if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, (DWORD) errnum, 0, buffer, buflen, NULL) == 0) ne_snprintf(buffer, buflen, "Socket error %d", errnum); } #define set_strerror(s, e) print_error((e), (s)->error, sizeof (s)->error) #else /* not WIN32 */ #define set_strerror(s, e) ne_strerror((e), (s)->error, sizeof (s)->error) #endif #ifdef HAVE_OPENSSL /* Seed the SSL PRNG, if necessary; returns non-zero on failure. */ static int seed_ssl_prng(void) { /* Check whether the PRNG has already been seeded. */ if (RAND_status() == 1) return 0; #if defined(EGD_PATH) NE_DEBUG(NE_DBG_SOCKET, "Seeding PRNG from " EGD_PATH "...\n"); if (RAND_egd(EGD_PATH) != -1) return 0; #elif defined(ENABLE_EGD) { static const char *paths[] = { "/var/run/egd-pool", "/dev/egd-pool", "/etc/egd-pool", "/etc/entropy" }; size_t n; for (n = 0; n < sizeof(paths) / sizeof(char *); n++) { NE_DEBUG(NE_DBG_SOCKET, "Seeding PRNG from %s...\n", paths[n]); if (RAND_egd(paths[n]) != -1) return 0; } } #endif /* EGD_PATH */ NE_DEBUG(NE_DBG_SOCKET, "No entropy source found; could not seed PRNG.\n"); return -1; } #endif /* HAVE_OPENSSL */ #ifdef USE_CHECK_IPV6 static int ipv6_disabled = 0; /* On Linux kernels, IPv6 is typically built as a loadable module, and * socket(AF_INET6, ...) will fail if this module is not loaded, so * the slow AAAA lookups can be avoided for this common case. */ static void init_ipv6(void) { int fd = socket(AF_INET6, SOCK_STREAM, 0); if (fd < 0) ipv6_disabled = 1; else close(fd); } #elif defined(AF_INET6) #define ipv6_disabled (0) #else #define ipv6_disabled (1) #endif /* If init_state is N where > 0, ne_sock_init has been called N times; * if == 0, library is not initialized; if < 0, library initialization * has failed. */ static int init_state = 0; int ne_sock_init(void) { #ifdef WIN32 WORD wVersionRequested; WSADATA wsaData; int err; #endif if (init_state > 0) { init_state++; return 0; } else if (init_state < 0) { return -1; } #ifdef WIN32 wVersionRequested = MAKEWORD(2, 2); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { return init_state = -1; } #ifdef HAVE_SSPI if (ne_sspi_init() < 0) { return init_state = -1; } #endif #endif #ifdef NE_HAVE_SOCKS SOCKSinit("neon"); #endif #if defined(HAVE_SIGNAL) && defined(SIGPIPE) (void) signal(SIGPIPE, SIG_IGN); #endif #ifdef USE_CHECK_IPV6 init_ipv6(); #endif #ifdef NE_HAVE_SSL if (ne__ssl_init()) { return init_state = -1; } #endif init_state = 1; return 0; } void ne_sock_exit(void) { if (init_state > 0 && --init_state == 0) { #ifdef WIN32 WSACleanup(); #endif #ifdef NE_HAVE_SSL ne__ssl_exit(); #endif #ifdef HAVE_SSPI ne_sspi_deinit(); #endif } } /* Await readability (rdwr = 0) or writability (rdwr != 0) for socket * fd for secs seconds. Returns <0 on error, zero on timeout, >0 if * data is available. */ static int raw_poll(int fdno, int rdwr, int secs) { int ret; #ifdef NE_USE_POLL struct pollfd fds; int timeout = secs > 0 ? secs * 1000 : -1; fds.fd = fdno; fds.events = rdwr == 0 ? POLLIN : POLLOUT; fds.revents = 0; do { ret = poll(&fds, 1, timeout); } while (ret < 0 && NE_ISINTR(ne_errno)); #else fd_set rdfds, wrfds; struct timeval timeout, *tvp = (secs >= 0 ? &timeout : NULL); /* Init the fd set */ FD_ZERO(&rdfds); FD_ZERO(&wrfds); /* Note that (amazingly) the FD_SET macro does not expand * correctly on Netware if not inside a compound statement * block. */ if (rdwr == 0) { FD_SET(fdno, &rdfds); } else { FD_SET(fdno, &wrfds); } if (tvp) { tvp->tv_sec = secs; tvp->tv_usec = 0; } do { ret = select(fdno + 1, &rdfds, &wrfds, NULL, tvp); } while (ret < 0 && NE_ISINTR(ne_errno)); #endif return ret; } int ne_sock_block(ne_socket *sock, int n) { if (sock->bufavail) return 0; return sock->ops->readable(sock, n); } /* Cast address object AD to type 'sockaddr_TY' */ #define SACAST(ty, ad) ((struct sockaddr_##ty *)(ad)) ssize_t ne_sock_read(ne_socket *sock, char *buffer, size_t buflen) { ssize_t bytes; #if 0 NE_DEBUG(NE_DBG_SOCKET, "buf: at %d, %d avail [%s]\n", sock->bufpos - sock->buffer, sock->bufavail, sock->bufpos); #endif if (sock->bufavail > 0) { /* Deliver buffered data. */ if (buflen > sock->bufavail) buflen = sock->bufavail; memcpy(buffer, sock->bufpos, buflen); sock->bufpos += buflen; sock->bufavail -= buflen; return buflen; } else if (buflen >= sizeof sock->buffer) { /* No need for read buffer. */ return sock->ops->sread(sock, buffer, buflen); } else { /* Fill read buffer. */ bytes = sock->ops->sread(sock, sock->buffer, sizeof sock->buffer); if (bytes <= 0) return bytes; if (buflen > (size_t)bytes) buflen = bytes; memcpy(buffer, sock->buffer, buflen); sock->bufpos = sock->buffer + buflen; sock->bufavail = bytes - buflen; return buflen; } } ssize_t ne_sock_peek(ne_socket *sock, char *buffer, size_t buflen) { ssize_t bytes; if (sock->bufavail) { /* just return buffered data. */ bytes = sock->bufavail; } else { /* fill the buffer. */ bytes = sock->ops->sread(sock, sock->buffer, sizeof sock->buffer); if (bytes <= 0) return bytes; sock->bufpos = sock->buffer; sock->bufavail = bytes; } if (buflen > (size_t)bytes) buflen = bytes; memcpy(buffer, sock->bufpos, buflen); return buflen; } /* Await data on raw fd in socket. */ static int readable_raw(ne_socket *sock, int secs) { int ret = raw_poll(sock->fd, 0, secs); if (ret < 0) { set_strerror(sock, ne_errno); return NE_SOCK_ERROR; } return (ret == 0) ? NE_SOCK_TIMEOUT : 0; } static ssize_t read_raw(ne_socket *sock, char *buffer, size_t len) { ssize_t ret; ret = readable_raw(sock, sock->rdtimeout); if (ret) return ret; do { ret = recv(sock->fd, buffer, len, 0); } while (ret == -1 && NE_ISINTR(ne_errno)); if (ret == 0) { set_error(sock, _("Connection closed")); ret = NE_SOCK_CLOSED; } else if (ret < 0) { int errnum = ne_errno; ret = NE_ISRESET(errnum) ? NE_SOCK_RESET : NE_SOCK_ERROR; set_strerror(sock, errnum); } return ret; } #define MAP_ERR(e) (NE_ISCLOSED(e) ? NE_SOCK_CLOSED : \ (NE_ISRESET(e) ? NE_SOCK_RESET : NE_SOCK_ERROR)) static ssize_t write_raw(ne_socket *sock, const char *data, size_t length) { ssize_t ret; #ifdef __QNX__ /* Test failures seen on QNX over loopback, if passing large * buffer lengths to send(). */ if (length > 8192) length = 8192; #endif do { ret = send(sock->fd, data, length, 0); } while (ret == -1 && NE_ISINTR(ne_errno)); if (ret < 0) { int errnum = ne_errno; set_strerror(sock, errnum); return MAP_ERR(errnum); } return ret; } static ssize_t writev_raw(ne_socket *sock, const struct ne_iovec *vector, int count) { ssize_t ret; #ifdef WIN32 LPWSABUF wasvector = (LPWSABUF)ne_malloc(count * sizeof(WSABUF)); DWORD total; int i; for (i = 0; i < count; i++){ wasvector[i].buf = vector[i].base; wasvector[i].len = vector[i].len; } ret = WSASend(sock->fd, wasvector, count, &total, 0, NULL, NULL); if (ret == 0) ret = total; ne_free(wasvector); #else const struct iovec *vec = (const struct iovec *) vector; do { ret = writev(sock->fd, vec, count); } while (ret == -1 && NE_ISINTR(ne_errno)); #endif if (ret < 0) { int errnum = ne_errno; set_strerror(sock, errnum); return MAP_ERR(errnum); } return ret; } #ifdef NE_HAVE_SSL static ssize_t writev_dummy(ne_socket *sock, const struct ne_iovec *vector, int count) { return sock->ops->swrite(sock, vector[0].base, vector[0].len); } #endif static const struct iofns iofns_raw = { read_raw, write_raw, readable_raw, writev_raw }; #ifdef HAVE_OPENSSL /* OpenSSL I/O function implementations. */ static int readable_ossl(ne_socket *sock, int secs) { if (SSL_pending(sock->ssl)) return 0; return readable_raw(sock, secs); } /* SSL error handling, according to SSL_get_error(3). */ static int error_ossl(ne_socket *sock, int sret) { int errnum = SSL_get_error(sock->ssl, sret); unsigned long err; if (errnum == SSL_ERROR_ZERO_RETURN) { set_error(sock, _("Connection closed")); return NE_SOCK_CLOSED; } /* for all other errors, look at the OpenSSL error stack */ err = ERR_get_error(); if (err == 0) { /* Empty error stack, presume this is a system call error: */ if (sret == 0) { /* EOF without close_notify, possible truncation */ set_error(sock, _("Secure connection truncated")); return NE_SOCK_TRUNC; } else { /* Other socket error. */ errnum = ne_errno; set_strerror(sock, errnum); return MAP_ERR(errnum); } } if (ERR_reason_error_string(err)) { ne_snprintf(sock->error, sizeof sock->error, _("SSL error: %s"), ERR_reason_error_string(err)); } else { ne_snprintf(sock->error, sizeof sock->error, _("SSL error code %d/%d/%lu"), sret, errnum, err); } /* make sure the error stack is now empty. */ ERR_clear_error(); return NE_SOCK_ERROR; } /* Work around OpenSSL's use of 'int' rather than 'size_t', to prevent * accidentally passing a negative number, etc. */ #define CAST2INT(n) (((n) > INT_MAX) ? INT_MAX : (n)) static ssize_t read_ossl(ne_socket *sock, char *buffer, size_t len) { int ret; ret = readable_ossl(sock, sock->rdtimeout); if (ret) return ret; ret = SSL_read(sock->ssl, buffer, CAST2INT(len)); if (ret <= 0) ret = error_ossl(sock, ret); return ret; } static ssize_t write_ossl(ne_socket *sock, const char *data, size_t len) { int ret, ilen = CAST2INT(len); ret = SSL_write(sock->ssl, data, ilen); /* ssl.h says SSL_MODE_ENABLE_PARTIAL_WRITE must be enabled to * have SSL_write return < length... so, SSL_write should never * return < length. */ if (ret != ilen) return error_ossl(sock, ret); return ret; } static const struct iofns iofns_ssl = { read_ossl, write_ossl, readable_ossl, writev_dummy }; #elif defined(HAVE_GNUTLS) /* Return zero if an alert value can be ignored. */ static int check_alert(ne_socket *sock, ssize_t ret) { const char *alert; if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED) { alert = gnutls_alert_get_name(gnutls_alert_get(sock->ssl)); NE_DEBUG(NE_DBG_SOCKET, "TLS warning alert: %s\n", alert); return 0; } else if (ret == GNUTLS_E_FATAL_ALERT_RECEIVED) { alert = gnutls_alert_get_name(gnutls_alert_get(sock->ssl)); NE_DEBUG(NE_DBG_SOCKET, "TLS fatal alert: %s\n", alert); return -1; } return ret; } static int readable_gnutls(ne_socket *sock, int secs) { if (gnutls_record_check_pending(sock->ssl)) { return 0; } return readable_raw(sock, secs); } static ssize_t error_gnutls(ne_socket *sock, ssize_t sret) { ssize_t ret; switch (sret) { case 0: ret = NE_SOCK_CLOSED; set_error(sock, _("Connection closed")); break; case GNUTLS_E_FATAL_ALERT_RECEIVED: ret = NE_SOCK_ERROR; ne_snprintf(sock->error, sizeof sock->error, _("SSL alert received: %s"), gnutls_alert_get_name(gnutls_alert_get(sock->ssl))); break; case GNUTLS_E_UNEXPECTED_PACKET_LENGTH: /* It's not exactly an API guarantee but this error will * always mean a premature EOF. */ ret = NE_SOCK_TRUNC; set_error(sock, _("Secure connection truncated")); break; case GNUTLS_E_PUSH_ERROR: ret = NE_SOCK_RESET; set_error(sock, ("SSL socket write failed")); break; case GNUTLS_E_PULL_ERROR: ret = NE_SOCK_RESET; set_error(sock, _("SSL socket read failed")); break; default: ret = NE_SOCK_ERROR; ne_snprintf(sock->error, sizeof sock->error, _("SSL error: %s"), gnutls_strerror(sret)); } return ret; } #define RETRY_GNUTLS(sock, ret) ((ret < 0) \ && (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN \ || check_alert(sock, ret) == 0)) static ssize_t read_gnutls(ne_socket *sock, char *buffer, size_t len) { ssize_t ret; unsigned reneg = 1; /* number of allowed rehandshakes */ ret = readable_gnutls(sock, sock->rdtimeout); if (ret) return ret; do { do { ret = gnutls_record_recv(sock->ssl, buffer, len); } while (RETRY_GNUTLS(sock, ret)); } while (ret == GNUTLS_E_REHANDSHAKE && reneg-- && (ret = gnutls_handshake(sock->ssl)) == GNUTLS_E_SUCCESS); if (ret <= 0) ret = error_gnutls(sock, ret); return ret; } static ssize_t write_gnutls(ne_socket *sock, const char *data, size_t len) { ssize_t ret; do { ret = gnutls_record_send(sock->ssl, data, len); } while (RETRY_GNUTLS(sock, ret)); if (ret < 0) return error_gnutls(sock, ret); return ret; } static const struct iofns iofns_ssl = { read_gnutls, write_gnutls, readable_gnutls, writev_dummy }; #endif int ne_sock_fullwrite(ne_socket *sock, const char *data, size_t len) { ssize_t ret; do { ret = sock->ops->swrite(sock, data, len); if (ret > 0) { data += ret; len -= ret; } } while (ret > 0 && len > 0); return ret < 0 ? ret : 0; } int ne_sock_fullwritev(ne_socket *sock, const struct ne_iovec *vector, int count) { ssize_t ret; do { ret = sock->ops->swritev(sock, vector, count); if (ret > 0) { while (count && (size_t)ret >= vector[0].len) { ret -= vector[0].len; count--; vector++; } if (ret && count) { /* Partial buffer sent; send the rest. */ ret = ne_sock_fullwrite(sock, (char *)vector[0].base + ret, vector[0].len - ret); count--; vector++; } } } while (count && ret >= 0); return ret < 0 ? ret : 0; } ssize_t ne_sock_readline(ne_socket *sock, char *buf, size_t buflen) { char *lf; size_t len; if ((lf = memchr(sock->bufpos, '\n', sock->bufavail)) == NULL && sock->bufavail < RDBUFSIZ) { /* The buffered data does not contain a complete line: move it * to the beginning of the buffer. */ if (sock->bufavail) memmove(sock->buffer, sock->bufpos, sock->bufavail); sock->bufpos = sock->buffer; /* Loop filling the buffer whilst no newline is found in the data * buffered so far, and there is still buffer space available */ do { /* Read more data onto end of buffer. */ ssize_t ret = sock->ops->sread(sock, sock->buffer + sock->bufavail, RDBUFSIZ - sock->bufavail); if (ret < 0) return ret; sock->bufavail += ret; } while ((lf = memchr(sock->buffer, '\n', sock->bufavail)) == NULL && sock->bufavail < RDBUFSIZ); } if (lf) len = lf - sock->bufpos + 1; else len = buflen; /* fall into "line too long" error... */ if ((len + 1) > buflen) { set_error(sock, _("Line too long")); return NE_SOCK_ERROR; } memcpy(buf, sock->bufpos, len); buf[len] = '\0'; /* consume the line from buffer: */ sock->bufavail -= len; sock->bufpos += len; return len; } ssize_t ne_sock_fullread(ne_socket *sock, char *buffer, size_t buflen) { ssize_t len; while (buflen > 0) { len = ne_sock_read(sock, buffer, buflen); if (len < 0) return len; buflen -= len; buffer += len; } return 0; } #ifndef INADDR_NONE #define INADDR_NONE ((in_addr_t) -1) #endif #if !defined(USE_GETADDRINFO) && !defined(WIN32) && !HAVE_DECL_H_ERRNO /* Ancient versions of netdb.h don't export h_errno. */ extern int h_errno; #endif /* This implemementation does not attempt to support IPv6 using * gethostbyname2 et al. */ ne_sock_addr *ne_addr_resolve(const char *hostname, int flags) { ne_sock_addr *addr = ne_calloc(sizeof *addr); #ifdef USE_GETADDRINFO struct addrinfo hints = {0}; char *pnt; hints.ai_socktype = SOCK_STREAM; #ifdef AF_INET6 if (hostname[0] == '[' && ((pnt = strchr(hostname, ']')) != NULL)) { char *hn = ne_strdup(hostname + 1); hn[pnt - hostname - 1] = '\0'; #ifdef AI_NUMERICHOST /* added in the RFC2553 API */ hints.ai_flags = AI_NUMERICHOST; #endif hints.ai_family = AF_INET6; addr->errnum = getaddrinfo(hn, NULL, &hints, &addr->result); ne_free(hn); } else #endif /* AF_INET6 */ { #ifdef USE_GAI_ADDRCONFIG /* added in the RFC3493 API */ hints.ai_flags = AI_ADDRCONFIG; hints.ai_family = AF_UNSPEC; addr->errnum = getaddrinfo(hostname, NULL, &hints, &addr->result); #else hints.ai_family = ipv6_disabled ? AF_INET : AF_UNSPEC; addr->errnum = getaddrinfo(hostname, NULL, &hints, &addr->result); #endif } #else /* Use gethostbyname() */ in_addr_t laddr; struct hostent *hp; laddr = inet_addr(hostname); if (laddr == INADDR_NONE) { hp = gethostbyname(hostname); if (hp == NULL) { #ifdef WIN32 addr->errnum = WSAGetLastError(); #else addr->errnum = h_errno; #endif } else if (hp->h_length != sizeof(struct in_addr)) { /* fail gracefully if somebody set RES_USE_INET6 */ addr->errnum = NO_RECOVERY; } else { size_t n; /* count addresses */ for (n = 0; hp->h_addr_list[n] != NULL; n++) /* noop */; addr->count = n; addr->addrs = ne_malloc(n * sizeof *addr->addrs); for (n = 0; n < addr->count; n++) memcpy(&addr->addrs[n], hp->h_addr_list[n], hp->h_length); } } else { addr->addrs = ne_malloc(sizeof *addr->addrs); addr->count = 1; memcpy(addr->addrs, &laddr, sizeof *addr->addrs); } #endif return addr; } int ne_addr_result(const ne_sock_addr *addr) { return addr->errnum; } const ne_inet_addr *ne_addr_first(ne_sock_addr *addr) { #ifdef USE_GETADDRINFO addr->cursor = addr->result->ai_next; return addr->result; #else addr->cursor = 0; return &addr->addrs[0]; #endif } const ne_inet_addr *ne_addr_next(ne_sock_addr *addr) { #ifdef USE_GETADDRINFO struct addrinfo *ret = addr->cursor; if (addr->cursor) addr->cursor = addr->cursor->ai_next; #else struct in_addr *ret; if (++addr->cursor < addr->count) ret = &addr->addrs[addr->cursor]; else ret = NULL; #endif return ret; } char *ne_addr_error(const ne_sock_addr *addr, char *buf, size_t bufsiz) { #ifdef WIN32 print_error(addr->errnum, buf, bufsiz); #else const char *err; #ifdef USE_GETADDRINFO /* override horrible generic "Name or service not known" error. */ if (addr->errnum == EAI_NONAME) err = _("Host not found"); else err = gai_strerror(addr->errnum); #elif defined(HAVE_HSTRERROR) err = hstrerror(addr->errnum); #else err = _("Host not found"); #endif ne_strnzcpy(buf, err, bufsiz); #endif /* WIN32 */ return buf; } char *ne_iaddr_print(const ne_inet_addr *ia, char *buf, size_t bufsiz) { #if defined(USE_GETADDRINFO) && defined(HAVE_INET_NTOP) const char *ret; #ifdef AF_INET6 if (ia->ai_family == AF_INET6) { struct sockaddr_in6 *in6 = SACAST(in6, ia->ai_addr); ret = inet_ntop(AF_INET6, &in6->sin6_addr, buf, bufsiz); } else #endif if (ia->ai_family == AF_INET) { struct sockaddr_in *in = SACAST(in, ia->ai_addr); ret = inet_ntop(AF_INET, &in->sin_addr, buf, bufsiz); } else ret = NULL; if (ret == NULL) ne_strnzcpy(buf, "[IP address]", bufsiz); #elif defined(USE_GETADDRINFO) && defined(NI_NUMERICHOST) /* use getnameinfo instead for Win32, which lacks inet_ntop: */ if (getnameinfo(ia->ai_addr, ia->ai_addrlen, buf, bufsiz, NULL, 0, NI_NUMERICHOST)) ne_strnzcpy(buf, "[IP address]", bufsiz); #else /* USE_GETADDRINFO */ ne_strnzcpy(buf, inet_ntoa(*ia), bufsiz); #endif return buf; } unsigned char *ne_iaddr_raw(const ne_inet_addr *ia, unsigned char *buf) { #ifdef USE_GETADDRINFO #ifdef AF_INET6 if (ia->ai_family == AF_INET6) { struct sockaddr_in6 *in6 = SACAST(in6, ia->ai_addr); return memcpy(buf, in6->sin6_addr.s6_addr, sizeof in6->sin6_addr.s6_addr); } else #endif /* AF_INET6 */ { struct sockaddr_in *in = SACAST(in, ia->ai_addr); return memcpy(buf, &in->sin_addr.s_addr, sizeof in->sin_addr.s_addr); } #else /* !USE_GETADDRINFO */ return memcpy(buf, &ia->s_addr, sizeof ia->s_addr); #endif } ne_inet_addr *ne_iaddr_parse(const char *addr, ne_iaddr_type type) { #if defined(USE_GETADDRINFO) && defined(HAVE_INET_PTON) char dst[sizeof(struct in6_addr)]; int af = type == ne_iaddr_ipv6 ? AF_INET6 : AF_INET; if (inet_pton(af, addr, dst) != 1) { return NULL; } return ne_iaddr_make(type, (unsigned char *)dst); #elif defined(USE_GETADDRINFO) && !defined(HAVE_INET_PTON) /* For Windows, which lacks inet_pton(). */ struct addrinfo *ai, *rv, hints; memset(&hints, 0, sizeof hints); hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICHOST; hints.ai_family = type == ne_iaddr_ipv6 ? AF_INET6 : AF_INET; if (getaddrinfo(addr, NULL, &hints, &ai)) { return NULL; } /* Copy the returned addrinfo, since it needs to be ne_free()-able * later; must only call freeaddrinfo() on ai. */ rv = ne_calloc(sizeof *rv); memcpy(rv, ai, sizeof *rv); rv->ai_next = NULL; rv->ai_canonname = NULL; rv->ai_addr = ne_calloc(ai->ai_addrlen); memcpy(rv->ai_addr, ai->ai_addr, ai->ai_addrlen); freeaddrinfo(ai); return rv; #else /* !USE_GETADDRINFO */ struct in_addr a; if (type == ne_iaddr_ipv6) { return NULL; } #ifdef WIN32 /* inet_addr() is broken because INADDR_NONE is a valid * broadcast address, so only use it on Windows. */ a.s_addr = inet_addr(addr); if (a.s_addr == INADDR_NONE) { return NULL; } #else /* !WIN32 */ if (inet_aton(addr, &a) == 0) { return NULL; } #endif return ne_iaddr_make(ne_iaddr_ipv4, (unsigned char *)&a.s_addr); #endif /* !USE_GETADDRINFO */ } int ne_iaddr_reverse(const ne_inet_addr *ia, char *buf, size_t bufsiz) { #ifdef USE_GETADDRINFO return getnameinfo(ia->ai_addr, ia->ai_addrlen, buf, bufsiz, NULL, 0, 0); #else struct hostent *hp; hp = gethostbyaddr(ia, sizeof *ia, AF_INET); if (hp && hp->h_name) { ne_strnzcpy(buf, hp->h_name, bufsiz); return 0; } return -1; #endif } void ne_addr_destroy(ne_sock_addr *addr) { #ifdef USE_GETADDRINFO if (addr->result) freeaddrinfo(addr->result); #else if (addr->addrs) ne_free(addr->addrs); #endif ne_free(addr); } /* Perform a connect() for given fd, handling EINTR retries. Returns * zero on success or -1 on failure, in which case, ne_errno is set * appropriately. */ static int raw_connect(int fd, const struct sockaddr *sa, size_t salen) { int ret; do { ret = connect(fd, sa, salen); } while (ret < 0 && NE_ISINTR(ne_errno)); return ret; } /* Perform a connect() for fd to address sa of length salen, with a * timeout if supported on this platform. Returns zero on success or * NE_SOCK_* on failure, with sock->error set appropriately. */ static int timed_connect(ne_socket *sock, int fd, const struct sockaddr *sa, size_t salen) { int ret; #ifdef USE_NONBLOCKING_CONNECT if (sock->cotimeout) { int errnum, flags; /* Get flags and then set O_NONBLOCK. */ flags = fcntl(fd, F_GETFL); if (flags & O_NONBLOCK) { /* This socket was created using SOCK_NONBLOCK... flip the * bit for restoring flags later. */ flags &= ~O_NONBLOCK; } else if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) { set_strerror(sock, errno); return NE_SOCK_ERROR; } ret = raw_connect(fd, sa, salen); if (ret == -1) { errnum = ne_errno; if (NE_ISINPROGRESS(errnum)) { ret = raw_poll(fd, 1, sock->cotimeout); if (ret > 0) { /* poll got data */ socklen_t len = sizeof(errnum); /* Check whether there is a pending error for the * socket. Per Stevens UNPv1§15.4, Solaris will * return a pending error via errno by failing the * getsockopt() call. */ errnum = 0; if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &errnum, &len)) errnum = errno; if (errnum == 0) { ret = 0; } else { set_strerror(sock, errnum); ret = NE_SOCK_ERROR; } } else if (ret == 0) { /* poll timed out */ set_error(sock, _("Connection timed out")); ret = NE_SOCK_TIMEOUT; } else /* poll failed */ { set_strerror(sock, errno); ret = NE_SOCK_ERROR; } } else /* non-EINPROGRESS error from connect() */ { set_strerror(sock, errnum); ret = NE_SOCK_ERROR; } } /* Reset to old flags: */ if (fcntl(fd, F_SETFL, flags) == -1) { set_strerror(sock, errno); ret = NE_SOCK_ERROR; } } else #endif /* USE_NONBLOCKING_CONNECT */ { ret = raw_connect(fd, sa, salen); if (ret < 0) { set_strerror(sock, errno); ret = NE_SOCK_ERROR; } } return ret; } /* Connect socket to address 'addr' on given 'port'. Returns zero on * success or NE_SOCK_* on failure with sock->error set * appropriately. */ static int connect_socket(ne_socket *sock, int fd, const ne_inet_addr *addr, unsigned int port) { #ifdef USE_GETADDRINFO #ifdef AF_INET6 /* fill in the _family field for AIX 4.3, which forgets to do so. */ if (addr->ai_family == AF_INET6) { struct sockaddr_in6 in6; memcpy(&in6, addr->ai_addr, sizeof in6); in6.sin6_port = port; in6.sin6_family = AF_INET6; return timed_connect(sock, fd, (struct sockaddr *)&in6, sizeof in6); } else #endif if (addr->ai_family == AF_INET) { struct sockaddr_in in; memcpy(&in, addr->ai_addr, sizeof in); in.sin_port = port; in.sin_family = AF_INET; return timed_connect(sock, fd, (struct sockaddr *)&in, sizeof in); } else { set_strerror(sock, EINVAL); return NE_SOCK_ERROR; } #else struct sockaddr_in sa = {0}; sa.sin_family = AF_INET; sa.sin_port = port; sa.sin_addr = *addr; return timed_connect(sock, fd, (struct sockaddr *)&sa, sizeof sa); #endif } ne_socket *ne_sock_create(void) { ne_socket *sock = ne_calloc(sizeof *sock); sock->rdtimeout = SOCKET_READ_TIMEOUT; sock->cotimeout = 0; sock->bufpos = sock->buffer; sock->ops = &iofns_raw; sock->fd = -1; return sock; } #ifdef USE_GETADDRINFO #define ia_family(a) ((a)->ai_family) #define ia_proto(a) ((a)->ai_protocol) #else #define ia_family(a) AF_INET #define ia_proto(a) 0 #endif void ne_sock_prebind(ne_socket *sock, const ne_inet_addr *addr, unsigned int port) { sock->lport = port; sock->laddr = addr ? addr : &dummy_laddr; } /* Bind socket 'fd' to address/port 'addr' and 'port', for subsequent * connect() to address of family 'peer_family'. */ static int do_bind(int fd, int peer_family, const ne_inet_addr *addr, unsigned int port) { #if defined(HAVE_SETSOCKOPT) && defined(SO_REUSEADDR) && defined(SOL_SOCKET) { int flag = 1; (void) setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof flag); /* An error here is not fatal, so ignore it. */ } #endif #if defined(USE_GETADDRINFO) && defined(AF_INET6) /* Use a sockaddr_in6 if an AF_INET6 local address is specifed, or * if no address is specified and the peer address is AF_INET6: */ if ((addr != &dummy_laddr && addr->ai_family == AF_INET6) || (addr == &dummy_laddr && peer_family == AF_INET6)) { struct sockaddr_in6 in6; if (addr == &dummy_laddr) memset(&in6, 0, sizeof in6); else memcpy(&in6, addr->ai_addr, sizeof in6); in6.sin6_port = htons(port); /* fill in the _family field for AIX 4.3, which forgets to do so. */ in6.sin6_family = AF_INET6; return bind(fd, (struct sockaddr *)&in6, sizeof in6); } else #endif { struct sockaddr_in in; if (addr == &dummy_laddr) memset(&in, 0, sizeof in); else { #ifdef USE_GETADDRINFO memcpy(&in, addr->ai_addr, sizeof in); #else in.sin_addr = *addr; #endif } in.sin_port = htons(port); in.sin_family = AF_INET; return bind(fd, (struct sockaddr *)&in, sizeof in); } } #ifdef SOCK_CLOEXEC /* sock_cloexec is initialized to SOCK_CLOEXEC and cleared to zero if * a socket() call ever fails with EINVAL. */ static int sock_cloexec = SOCK_CLOEXEC; #define RETRY_ON_EINVAL #else #define sock_cloexec 0 #endif int ne_sock_connect(ne_socket *sock, const ne_inet_addr *addr, unsigned int port) { int fd, ret; int type = SOCK_STREAM | sock_cloexec; #if defined(RETRY_ON_EINVAL) && defined(SOCK_NONBLOCK) \ && defined(USE_NONBLOCKING_CONNECT) /* If the SOCK_NONBLOCK flag is defined, and the retry-on-EINVAL * logic is enabled, and the socket has a configured timeout, then * also use the SOCK_NONBLOCK flag to save enabling O_NONBLOCK * later. */ if (sock->cotimeout && sock_cloexec) { type |= SOCK_NONBLOCK; } #endif /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo * implementations do not set ai_socktype, e.g. RHL6.2. */ fd = socket(ia_family(addr), type, ia_proto(addr)); #ifdef RETRY_ON_EINVAL /* Handle forwards compat for new glibc on an older kernels; clear * the sock_cloexec flag and retry the call: */ if (fd < 0 && sock_cloexec && errno == EINVAL) { sock_cloexec = 0; fd = socket(ia_family(addr), SOCK_STREAM, ia_proto(addr)); } #endif if (fd < 0) { set_strerror(sock, ne_errno); return -1; } #if !defined(NE_USE_POLL) && !defined(WIN32) if (fd > FD_SETSIZE) { ne_close(fd); set_error(sock, _("Socket descriptor number exceeds FD_SETSIZE")); return NE_SOCK_ERROR; } #endif #if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) \ && defined(FD_CLOEXEC) /* Set the FD_CLOEXEC bit for the new fd, if the socket was not * created with the CLOEXEC bit already set. */ if (!sock_cloexec && (ret = fcntl(fd, F_GETFD)) >= 0) { fcntl(fd, F_SETFD, ret | FD_CLOEXEC); /* ignore failure; not a critical error. */ } #endif if (sock->laddr && (sock->laddr == &dummy_laddr || ia_family(sock->laddr) == ia_family(addr))) { ret = do_bind(fd, ia_family(addr), sock->laddr, sock->lport); if (ret < 0) { int errnum = errno; ne_close(fd); set_strerror(sock, errnum); return NE_SOCK_ERROR; } } #if defined(HAVE_SETSOCKOPT) && (defined(TCP_NODELAY) || defined(WIN32)) { /* Disable the Nagle algorithm. */ int flag = 1; setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof flag); } #endif ret = connect_socket(sock, fd, addr, htons(port)); if (ret == 0) sock->fd = fd; else ne_close(fd); return ret; } ne_inet_addr *ne_sock_peer(ne_socket *sock, unsigned int *port) { union saun { struct sockaddr sa; struct sockaddr_in sin; #if defined(USE_GETADDRINFO) && defined(AF_INET6) struct sockaddr_in6 sin6; #endif } saun; socklen_t len = sizeof saun; ne_inet_addr *ia; struct sockaddr *sad = (struct sockaddr *)&saun; if (getpeername(sock->fd, sad, &len) != 0) { set_strerror(sock, errno); return NULL; } #if !defined(USE_GETADDRINFO) || !defined(AF_INET6) if (sad->sa_family != AF_INET) { set_error(sock, _("Socket family not supported")); return NULL; } #endif ia = ne_calloc(sizeof *ia); #ifdef USE_GETADDRINFO ia->ai_addr = ne_malloc(sizeof *ia); ia->ai_addrlen = len; memcpy(ia->ai_addr, sad, len); ia->ai_family = saun.sa.sa_family; #else memcpy(ia, &saun.sin.sin_addr.s_addr, sizeof *ia); #endif #if defined(USE_GETADDRINFO) && defined(AF_INET6) *port = ntohs(saun.sa.sa_family == AF_INET ? saun.sin.sin_port : saun.sin6.sin6_port); #else *port = ntohs(saun.sin.sin_port); #endif return ia; } ne_inet_addr *ne_iaddr_make(ne_iaddr_type type, const unsigned char *raw) { ne_inet_addr *ia; #if !defined(AF_INET6) || !defined(USE_GETADDRINFO) /* fail if IPv6 address is given if IPv6 is not supported. */ if (type == ne_iaddr_ipv6) return NULL; #endif ia = ne_calloc(sizeof *ia); #ifdef USE_GETADDRINFO /* ai_protocol and ai_socktype aren't used by connect_socket() so * ignore them here. (for now) */ if (type == ne_iaddr_ipv4) { struct sockaddr_in *in4 = ne_calloc(sizeof *in4); ia->ai_family = AF_INET; ia->ai_addr = (struct sockaddr *)in4; ia->ai_addrlen = sizeof *in4; in4->sin_family = AF_INET; memcpy(&in4->sin_addr.s_addr, raw, sizeof in4->sin_addr.s_addr); } #ifdef AF_INET6 else { struct sockaddr_in6 *in6 = ne_calloc(sizeof *in6); ia->ai_family = AF_INET6; ia->ai_addr = (struct sockaddr *)in6; ia->ai_addrlen = sizeof *in6; in6->sin6_family = AF_INET6; memcpy(&in6->sin6_addr, raw, sizeof in6->sin6_addr.s6_addr); } #endif #else /* !USE_GETADDRINFO */ memcpy(&ia->s_addr, raw, sizeof ia->s_addr); #endif return ia; } ne_iaddr_type ne_iaddr_typeof(const ne_inet_addr *ia) { #if defined(USE_GETADDRINFO) && defined(AF_INET6) return ia->ai_family == AF_INET6 ? ne_iaddr_ipv6 : ne_iaddr_ipv4; #else return ne_iaddr_ipv4; #endif } int ne_iaddr_cmp(const ne_inet_addr *i1, const ne_inet_addr *i2) { #ifdef USE_GETADDRINFO if (i1->ai_family != i2->ai_family) return i2->ai_family - i1->ai_family; if (i1->ai_family == AF_INET) { struct sockaddr_in *in1 = SACAST(in, i1->ai_addr), *in2 = SACAST(in, i2->ai_addr); return memcmp(&in1->sin_addr.s_addr, &in2->sin_addr.s_addr, sizeof in1->sin_addr.s_addr); } #ifdef AF_INET6 else if (i1->ai_family == AF_INET6) { struct sockaddr_in6 *in1 = SACAST(in6, i1->ai_addr), *in2 = SACAST(in6, i2->ai_addr); return memcmp(in1->sin6_addr.s6_addr, in2->sin6_addr.s6_addr, sizeof in1->sin6_addr.s6_addr); } #endif /* AF_INET6 */ else return -1; #else return memcmp(&i1->s_addr, &i2->s_addr, sizeof i1->s_addr); #endif /* USE_GETADDRINFO */ } void ne_iaddr_free(ne_inet_addr *addr) { #ifdef USE_GETADDRINFO ne_free(addr->ai_addr); #endif ne_free(addr); } int ne_sock_accept(ne_socket *sock, int listener) { int fd = accept(listener, NULL, NULL); if (fd < 0) return -1; sock->fd = fd; return 0; } int ne_sock_fd(const ne_socket *sock) { return sock->fd; } void ne_sock_read_timeout(ne_socket *sock, int timeout) { sock->rdtimeout = timeout; } void ne_sock_connect_timeout(ne_socket *sock, int timeout) { sock->cotimeout = timeout; } #ifdef NE_HAVE_SSL #ifdef HAVE_GNUTLS /* Dumb server session cache implementation for GNUTLS; holds a single * session. */ /* Copy datum 'src' to 'dest'. */ static void copy_datum(gnutls_datum *dest, gnutls_datum *src) { dest->size = src->size; dest->data = memcpy(gnutls_malloc(src->size), src->data, src->size); } /* Callback to store a session 'data' with id 'key'. */ static int store_sess(void *userdata, gnutls_datum key, gnutls_datum data) { ne_ssl_context *ctx = userdata; if (ctx->cache.server.key.data) { gnutls_free(ctx->cache.server.key.data); gnutls_free(ctx->cache.server.data.data); } copy_datum(&ctx->cache.server.key, &key); copy_datum(&ctx->cache.server.data, &data); return 0; } /* Returns non-zero if d1 and d2 are the same datum. */ static int match_datum(gnutls_datum *d1, gnutls_datum *d2) { return d1->size == d2->size && memcmp(d1->data, d2->data, d1->size) == 0; } /* Callback to retrieve a session of id 'key'. */ static gnutls_datum retrieve_sess(void *userdata, gnutls_datum key) { ne_ssl_context *ctx = userdata; gnutls_datum ret = { NULL, 0 }; if (match_datum(&ctx->cache.server.key, &key)) { copy_datum(&ret, &ctx->cache.server.data); } return ret; } /* Callback to remove a session of id 'key'; stub needed but * implementation seems unnecessary. */ static int remove_sess(void *userdata, gnutls_datum key) { return -1; } #endif int ne_sock_accept_ssl(ne_socket *sock, ne_ssl_context *ctx) { int ret; ne_ssl_socket ssl; #if defined(HAVE_OPENSSL) ssl = SSL_new(ctx->ctx); SSL_set_fd(ssl, sock->fd); sock->ssl = ssl; ret = SSL_accept(ssl); if (ret != 1) { return error_ossl(sock, ret); } if (SSL_session_reused(ssl)) { NE_DEBUG(NE_DBG_SSL, "ssl: Server reused session.\n"); } #elif defined(HAVE_GNUTLS) gnutls_init(&ssl, GNUTLS_SERVER); gnutls_credentials_set(ssl, GNUTLS_CRD_CERTIFICATE, ctx->cred); gnutls_set_default_priority(ssl); /* Set up dummy session cache. */ gnutls_db_set_store_function(ssl, store_sess); gnutls_db_set_retrieve_function(ssl, retrieve_sess); gnutls_db_set_remove_function(ssl, remove_sess); gnutls_db_set_ptr(ssl, ctx); if (ctx->verify) gnutls_certificate_server_set_request(ssl, GNUTLS_CERT_REQUEST); sock->ssl = ssl; gnutls_transport_set_ptr(sock->ssl, (gnutls_transport_ptr)(long)sock->fd); ret = gnutls_handshake(ssl); if (ret < 0) { return error_gnutls(sock, ret); } if (ctx->verify && gnutls_certificate_verify_peers(ssl)) { set_error(sock, _("Client certificate verification failed")); return NE_SOCK_ERROR; } #endif sock->ops = &iofns_ssl; return 0; } int ne_sock_connect_ssl(ne_socket *sock, ne_ssl_context *ctx, void *userdata) { int ret; #if defined(HAVE_OPENSSL) SSL *ssl; if (seed_ssl_prng()) { set_error(sock, _("SSL disabled due to lack of entropy")); return NE_SOCK_ERROR; } /* If runtime library version differs from compile-time version * number in major/minor/fix level, abort soon. */ if ((SSLeay() ^ OPENSSL_VERSION_NUMBER) & 0xFFFFF000) { set_error(sock, _("SSL disabled due to library version mismatch")); return NE_SOCK_ERROR; } sock->ssl = ssl = SSL_new(ctx->ctx); if (!ssl) { set_error(sock, _("Could not create SSL structure")); return NE_SOCK_ERROR; } SSL_set_app_data(ssl, userdata); SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); SSL_set_fd(ssl, sock->fd); sock->ops = &iofns_ssl; #ifdef SSL_set_tlsext_host_name if (ctx->hostname) { /* Try to enable SNI, but ignore failure (should only fail for * >255 char hostnames, which are probably not legal * anyway). */ if (SSL_set_tlsext_host_name(ssl, ctx->hostname) != 1) { ERR_clear_error(); } } #endif if (ctx->sess) SSL_set_session(ssl, ctx->sess); ret = SSL_connect(ssl); if (ret != 1) { error_ossl(sock, ret); SSL_free(ssl); sock->ssl = NULL; return NE_SOCK_ERROR; } #elif defined(HAVE_GNUTLS) /* DH and RSA params are set in ne_ssl_context_create */ gnutls_init(&sock->ssl, GNUTLS_CLIENT); gnutls_set_default_priority(sock->ssl); gnutls_session_set_ptr(sock->ssl, userdata); gnutls_credentials_set(sock->ssl, GNUTLS_CRD_CERTIFICATE, ctx->cred); #ifdef HAVE_GNUTLS_SIGN_CALLBACK_SET if (ctx->sign_func) gnutls_sign_callback_set(sock->ssl, ctx->sign_func, ctx->sign_data); #endif if (ctx->hostname) { gnutls_server_name_set(sock->ssl, GNUTLS_NAME_DNS, ctx->hostname, strlen(ctx->hostname)); } gnutls_transport_set_ptr(sock->ssl, (gnutls_transport_ptr)(long)sock->fd); if (ctx->cache.client.data) { #if defined(HAVE_GNUTLS_SESSION_GET_DATA2) gnutls_session_set_data(sock->ssl, ctx->cache.client.data, ctx->cache.client.size); #else gnutls_session_set_data(sock->ssl, ctx->cache.client.data, ctx->cache.client.len); #endif } sock->ops = &iofns_ssl; ret = gnutls_handshake(sock->ssl); if (ret < 0) { error_gnutls(sock, ret); return NE_SOCK_ERROR; } if (!gnutls_session_is_resumed(sock->ssl)) { /* New session. The old method of using the _get_data * function seems to be broken with 1.3.0 and later*/ #if defined(HAVE_GNUTLS_SESSION_GET_DATA2) gnutls_session_get_data2(sock->ssl, &ctx->cache.client); #else ctx->cache.client.len = 0; if (gnutls_session_get_data(sock->ssl, NULL, &ctx->cache.client.len) == 0) { ctx->cache.client.data = ne_malloc(ctx->cache.client.len); gnutls_session_get_data(sock->ssl, ctx->cache.client.data, &ctx->cache.client.len); } #endif } #endif return 0; } ne_ssl_socket ne__sock_sslsock(ne_socket *sock) { return sock->ssl; } #endif int ne_sock_sessid(ne_socket *sock, unsigned char *buf, size_t *buflen) { #ifdef NE_HAVE_SSL #ifdef HAVE_GNUTLS if (sock->ssl) { return gnutls_session_get_id(sock->ssl, buf, buflen); } else { return -1; } #else SSL_SESSION *sess; if (!sock->ssl) { return -1; } sess = SSL_get0_session(sock->ssl); if (!buf) { *buflen = sess->session_id_length; return 0; } if (*buflen < sess->session_id_length) { return -1; } *buflen = sess->session_id_length; memcpy(buf, sess->session_id, *buflen); return 0; #endif #else return -1; #endif } char *ne_sock_cipher(ne_socket *sock) { #ifdef NE_HAVE_SSL if (sock->ssl) { #ifdef HAVE_OPENSSL const char *name = SSL_get_cipher(sock->ssl); return ne_strdup(name); #elif defined(HAVE_GNUTLS) const char *name = gnutls_cipher_get_name(gnutls_cipher_get(sock->ssl)); return ne_strdup(name); #endif } else #endif /* NE_HAVE_SSL */ { return NULL; } } const char *ne_sock_error(const ne_socket *sock) { return sock->error; } void ne_sock_set_error(ne_socket *sock, const char *format, ...) { va_list params; va_start(params, format); ne_vsnprintf(sock->error, sizeof sock->error, format, params); va_end(params); } /* Closes given ne_socket */ int ne_sock_close(ne_socket *sock) { int ret; #if defined(HAVE_OPENSSL) if (sock->ssl) { /* Correct SSL shutdown procedure: call once... */ if (SSL_shutdown(sock->ssl) == 0) { /* close_notify sent but not received; wait for peer to * send close_notify... */ SSL_shutdown(sock->ssl); } SSL_free(sock->ssl); } #elif defined(HAVE_GNUTLS) if (sock->ssl) { do { ret = gnutls_bye(sock->ssl, GNUTLS_SHUT_RDWR); } while (ret < 0 && (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN)); } #endif if (sock->fd < 0) ret = 0; else ret = ne_close(sock->fd); ne_free(sock); return ret; } cadaver-0.23.3/lib/neon/ne_compress.h0000664000076400007640000000332210646613101017017 0ustar jortonjorton/* Compressed HTTP response handling Copyright (C) 2001-2004, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_COMPRESS_H #define NE_COMPRESS_H #include "ne_request.h" NE_BEGIN_DECLS typedef struct ne_decompress_s ne_decompress; /* Call this to register a 'reader' callback which will be passed * blocks of response body (if the 'acceptance' callback is * successful). If the response body is returned compressed by the * server, this reader will receive UNCOMPRESSED blocks. * * Returns pointer to context object which must be passed to * ne_decompress_destroy after the request has been dispatched, to * free any internal state. If an error occurs during decompression, * the request will be aborted and session error string set. */ ne_decompress *ne_decompress_reader(ne_request *req, ne_accept_response accpt, ne_block_reader rdr, void *userdata); /* Destroys decompression state. */ void ne_decompress_destroy(ne_decompress *ctx); NE_END_DECLS #endif /* NE_COMPRESS_H */ cadaver-0.23.3/lib/neon/ne_defs.h0000664000076400007640000000357011247475573016133 0ustar jortonjorton/* Standard definitions for neon headers Copyright (C) 2003-2008, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #undef NE_BEGIN_DECLS #undef NE_END_DECLS #ifdef __cplusplus # define NE_BEGIN_DECLS extern "C" { # define NE_END_DECLS } #else # define NE_BEGIN_DECLS /* empty */ # define NE_END_DECLS /* empty */ #endif #ifndef NE_DEFS_H #define NE_DEFS_H #include #ifdef NE_LFS typedef off64_t ne_off_t; #else typedef off_t ne_off_t; #endif /* define ssize_t for Win32 */ #if defined(WIN32) && !defined(ssize_t) #define ssize_t int #endif #ifdef __NETWARE__ #include /* for time_t */ #endif #ifdef __GNUC__ #if __GNUC__ >= 3 #define NE_PRIVATE __attribute__((visibility ("hidden"))) #define ne_attribute_malloc __attribute__((malloc)) #else #define ne_attribute_malloc #endif #if __GNUC__ > 3 #define ne_attribute_sentinel __attribute__((sentinel)) #else #define ne_attribute_sentinel #endif #define ne_attribute(x) __attribute__(x) #else #define ne_attribute(x) #define ne_attribute_malloc #define ne_attribute_sentinel #endif #ifndef NE_PRIVATE #define NE_PRIVATE #endif #ifndef NE_BUFSIZ #define NE_BUFSIZ 8192 #endif #endif /* NE_DEFS_H */ cadaver-0.23.3/lib/neon/ne_redirect.h0000664000076400007640000000275310646611303016776 0ustar jortonjorton/* HTTP-redirect support Copyright (C) 1999-2002, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_REDIRECT_H #define NE_REDIRECT_H #include "ne_request.h" NE_BEGIN_DECLS /* Register redirect handling for the session: if a valid redirect * (30x) response is given for any request in this session, the * request will fail with the NE_REDIRECT code, and the destination of * the redirect can be retrieved using ne_redirect_location(). */ void ne_redirect_register(ne_session *sess); /* Returns location of last redirect for the session. Returns NULL if * no redirect has been encountered for given session, or the last * redirect encountered could not be parsed. */ const ne_uri *ne_redirect_location(ne_session *sess); NE_END_DECLS #endif /* NE_REDIRECT_H */ cadaver-0.23.3/lib/neon/ne_props.h0000664000076400007640000002342510400633302016326 0ustar jortonjorton/* WebDAV Properties manipulation Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_PROPS_H #define NE_PROPS_H #include "ne_request.h" #include "ne_207.h" NE_BEGIN_DECLS /* There are two interfaces for fetching properties. The first is * 'ne_simple_propfind', which is relatively simple, and easy to use, * but only lets you fetch FLAT properties, i.e. properties which are * just a string of bytes. The complex interface is 'ne_propfind_*', * which is complicated, and hard to use, but lets you parse * structured properties, i.e. properties which have XML content. */ /* The 'ne_simple_propfind' interface. *** * * ne_simple_propfind allows you to fetch a set of properties for a * single resource, or a tree of resources. You set the operation * going by passing these arguments: * * - the session which should be used. * - the URI and the depth of the operation (0, 1, infinite) * - the names of the properties which you want to fetch * - a results callback, and the userdata for the callback. * * For each resource found, the results callback is called, passing * you two things along with the userdata you passed in originally: * * - the URI of the resource (const ne_uri *uri) * - the properties results set (const ne_prop_result_set *results) * */ /* The name of a WebDAV property. 'nspace' may be NULL. */ typedef struct { const char *nspace, *name; } ne_propname; typedef struct ne_prop_result_set_s ne_prop_result_set; /* Get the value of a given property. Will return NULL if there was an * error fetching this property on this resource. Call * ne_propset_result to get the response-status if so. */ const char *ne_propset_value(const ne_prop_result_set *set, const ne_propname *propname); /* Returns the status structure for fetching the given property on * this resource. This function will return NULL if the server did not * return the property (which is a server error). */ const ne_status *ne_propset_status(const ne_prop_result_set *set, const ne_propname *propname); /* Returns the private pointer for the given propset. */ void *ne_propset_private(const ne_prop_result_set *set); /* Return language string of property (may be NULL). */ const char *ne_propset_lang(const ne_prop_result_set *set, const ne_propname *pname); /* ne_propset_iterate iterates over a properties result set, * calling the callback for each property in the set. userdata is * passed as the first argument to the callback. value may be NULL, * indicating an error occurred fetching this property: look at * status for the error in that case. * * If the iterator returns non-zero, ne_propset_iterate will return * immediately with that value. */ typedef int (*ne_propset_iterator)(void *userdata, const ne_propname *pname, const char *value, const ne_status *status); /* Iterate over all the properties in 'set', calling 'iterator' * for each, passing 'userdata' as the first argument to callback. * * Returns: * whatever value iterator returns. */ int ne_propset_iterate(const ne_prop_result_set *set, ne_propset_iterator iterator, void *userdata); /* Callback for handling the results of fetching properties for a * single resource (identified by URI 'uri'). The results are stored * in the result set 'results': use ne_propset_* to examine this * object. */ typedef void (*ne_props_result)(void *userdata, const ne_uri *uri, const ne_prop_result_set *results); /* Fetch properties for a resource (if depth == NE_DEPTH_ZERO), * or a tree of resources (if depth == NE_DEPTH_ONE or _INFINITE). * * Names of the properties required must be given in 'props', * or if props is NULL, *all* properties are fetched. * * 'results' is called for each resource in the response, userdata is * passed as the first argument to the callback. It is important to * note that the callback is called as the response is read off the * socket, so don't do anything silly in it (e.g. sleep(100), or call * any functions which use this session). * * Note that if 'depth' is NE_DEPTH_INFINITY, some servers may refuse * the request. * * Returns NE_*. */ int ne_simple_propfind(ne_session *sess, const char *path, int depth, const ne_propname *props, ne_props_result results, void *userdata); /* The properties of a resource can be manipulated using ne_proppatch. * A single proppatch request may include any number of individual * "set" and "remove" operations, and is defined to have * "all-or-nothing" semantics, so either all the operations succeed, * or none do. */ /* A proppatch operation may either set a property to have a new * value, in which case 'type' must be ne_propset, and 'value' must be * non-NULL; or it can remove a property; in which case 'type' must be * ne_propremove, and 'value' is ignored. In both cases, 'name' must * be set to the name of the property to alter. */ enum ne_proppatch_optype { ne_propset, ne_propremove }; typedef struct { const ne_propname *name; enum ne_proppatch_optype type; const char *value; } ne_proppatch_operation; /* Execute a set of property operations 'ops' on 'path'. 'ops' is an * array terminated by an operation with a NULL 'name' field. Returns * NE_*. */ int ne_proppatch(ne_session *sess, const char *path, const ne_proppatch_operation *ops); /* Retrieve property names for the resources at 'path'. 'results' * callback is called for each resource. Use 'ne_propset_iterate' on * the passed results object to retrieve the list of property names. * */ int ne_propnames(ne_session *sess, const char *path, int depth, ne_props_result results, void *userdata); /* The complex, you-do-all-the-work, property fetch interface: */ struct ne_propfind_handler_s; typedef struct ne_propfind_handler_s ne_propfind_handler; /* Retrieve the 'private' pointer for the current propset for the * given handler, as returned by the ne_props_create_complex callback * installed using 'ne_propfind_set_private'. If this callback was * not registered, this function will return NULL. */ void *ne_propfind_current_private(ne_propfind_handler *handler); /* Create a PROPFIND handler, for the given resource or set of * resources. * * Depth must be one of NE_DEPTH_*. */ ne_propfind_handler * ne_propfind_create(ne_session *sess, const char *path, int depth); /* Return the XML parser for the given handler (only need if you want * to handle complex properties). */ ne_xml_parser *ne_propfind_get_parser(ne_propfind_handler *handler); /* This interface reserves the state integer range 'x' where 0 < x * and x < NE_PROPS_STATE_TOP. */ #define NE_PROPS_STATE_TOP (NE_207_STATE_TOP + 100) /* Return the request object for the given handler. You MUST NOT use * ne_set_request_body_* on this request object. (this call is only * needed if for instance, you want to add extra headers to the * PROPFIND request). The result of using the request pointer after * ne_propfind_destroy(handler) has been called is undefined. */ ne_request *ne_propfind_get_request(ne_propfind_handler *handler); /* A "complex property" has a value which is structured XML. To handle * complex properties, you must set up and register an XML handler * which will understand the elements which make up such properties. * The handler must be registered with the parser returned by * 'ne_propfind_get_parser'. * * To store the parsed value of the property, a 'private' structure is * allocated in each propset (i.e. one per resource). When parsing the * property value elements, for each new resource encountered in the * response, the 'creator' callback is called to retrieve a 'private' * structure for this resource. When the private structure is no longer * needed, the 'destructor' callback is called to deallocate any * memory, if necessary. * * Whilst in XML element callbacks you will have registered to handle * complex properties, you can use the 'ne_propfind_current_private' * call to retrieve the pointer to this private structure. * * To retrieve this 'private' structure from the propset in the * results callback, simply call 'ne_propset_private'. * */ typedef void *(*ne_props_create_complex)(void *userdata, const ne_uri *uri); typedef void (*ne_props_destroy_complex)(void *userdata, void *complex); void ne_propfind_set_private(ne_propfind_handler *handler, ne_props_create_complex creator, ne_props_destroy_complex destructor, void *userdata); /* Fetch all properties. * * Returns NE_*. */ int ne_propfind_allprop(ne_propfind_handler *handler, ne_props_result result, void *userdata); /* Fetch all properties with names listed in array 'names', which is * terminated by a property with a NULL name field. For each resource * encountered, the result callback will be invoked, passing in * 'userdata' as the first argument. * * Returns NE_*. */ int ne_propfind_named(ne_propfind_handler *handler, const ne_propname *names, ne_props_result result, void *userdata); /* Destroy a propfind handler after use. */ void ne_propfind_destroy(ne_propfind_handler *handler); NE_END_DECLS #endif /* NE_PROPS_H */ cadaver-0.23.3/lib/neon/ne_alloc.h0000664000076400007640000000353011111347357016264 0ustar jortonjorton/* Replacement memory allocation handling etc. Copyright (C) 1999-2005, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_ALLOC_H #define NE_ALLOC_H #include #ifndef WIN32 #include #endif #include "ne_defs.h" NE_BEGIN_DECLS typedef void (*ne_oom_callback_fn)(void); /* Set callback which is called if malloc() returns NULL. */ void ne_oom_callback(ne_oom_callback_fn callback); #ifndef NEON_MEMLEAK /* Replacements for standard C library memory allocation functions, * which never return NULL. If the C library malloc() returns NULL, * neon will abort(); calling an OOM callback beforehand if one is * registered. The C library will only ever return NULL if the * operating system does not use optimistic memory allocation. */ void *ne_malloc(size_t size) ne_attribute_malloc; void *ne_calloc(size_t size) ne_attribute_malloc; void *ne_realloc(void *ptr, size_t s); char *ne_strdup(const char *s) ne_attribute_malloc; char *ne_strndup(const char *s, size_t n) ne_attribute_malloc; #ifdef WIN32 void ne_free(void *ptr); #else #define ne_free free #endif #endif NE_END_DECLS #endif /* NE_ALLOC_H */ cadaver-0.23.3/lib/neon/ne_xmlreq.h0000664000076400007640000000366510506172162016510 0ustar jortonjorton/* XML/HTTP response handling Copyright (C) 2004-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_XMLREQ_H #define NE_XMLREQ_H #include "ne_request.h" #include "ne_xml.h" NE_BEGIN_DECLS /* Read the HTTP response body using calls to ne_read_response_block * (so must be enclosed by ne_begin_request/ne_end_request calls), and * parse it as an XML document, using the given parser. Returns NE_* * error codes. If an XML parse error occurs, the session error * string is set to the XML parser's error string, and NE_ERROR is * returned. */ int ne_xml_parse_response(ne_request *req, ne_xml_parser *parser); /* Dispatch the HTTP request, parsing the response body as an XML * document using the given parser, if the response status class is * 2xx and an XML media type is specified for the response entity. If * a non-2xx response code is given, or a non-XML media type is * specified, then the response body will be silently discarded. * * Returns NE_* error codes. If an XML parse error occurs, the * session error string is set to the XML parser's error string, and * NE_ERROR is returned. */ int ne_xml_dispatch_request(ne_request *req, ne_xml_parser *parser); NE_END_DECLS #endif /* NE_XMLREQ_H */ cadaver-0.23.3/lib/neon/ne_auth.h0000664000076400007640000001276111247300130016125 0ustar jortonjorton/* HTTP authentication routines Copyright (C) 1999-2009, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_AUTH_H #define NE_AUTH_H #include "ne_session.h" /* for ne_session */ NE_BEGIN_DECLS /* Size of username/password buffers passed to ne_auth_creds * callback. */ #define NE_ABUFSIZ (256) /* The callback used to request the username and password in the given * realm. The username and password must be copied into the buffers * which are both of size NE_ABUFSIZ. The 'attempt' parameter is zero * on the first call to the callback, and increases by one each time * an attempt to authenticate fails. * * The callback must return zero to indicate that authentication * should be attempted with the username/password, or non-zero to * cancel the request. (if non-zero, username and password are * ignored.) * * IMPORTANT NOTE: The callback will be invoked repeatedly until * either it returns non-zero, or authentication is successful. * * Hint: if you just wish to attempt authentication just once (even if * the user gets the username/password wrong), have the callback * function use 'attempt' value as the function return value. */ typedef int (*ne_auth_creds)(void *userdata, const char *realm, int attempt, char *username, char *password); /* Set callbacks to provide credentials for server and proxy * authentication, using the default set of authentication protocols. * userdata is passed as the first argument to the callback. */ void ne_set_server_auth(ne_session *sess, ne_auth_creds creds, void *userdata); void ne_set_proxy_auth(ne_session *sess, ne_auth_creds creds, void *userdata); /* As an alternative to using ne_set_server_auth and * ne_set_proxy_auth, the following interfaces may be used; these * allow control over which authentication protocol is used. */ /* NE_AUTH_BASIC: Basic authentication transmits the username and * password unprotected over the channel; this allows a passive attack * to steal the credentials if using an unsecured channel * (i.e. non-SSL). */ #define NE_AUTH_BASIC (0x0001) /* NE_AUTH_DIGEST: Digest authentication uses a hash of the username, * password, and certain aspects of the request, so prevents passive * attackers from obtaining the credentials; active attackers can * still modify most of the request/response if using an unsecured * channel. */ #define NE_AUTH_DIGEST (0x0002) /* NE_AUTH_NEGOTIATE: Negotiate uses GSSAPI/SSPI, or NTLM, to * authenticate the user; an active attacker can modify any of the * request/response at will, so this must not be used over an * unsecured channel. NE_AUTH_NEGOTIATE is currently equivalent to * use of (NE_AUTH_GSSAPI | NE_AUTH_NTLM). */ #define NE_AUTH_NEGOTIATE (0x0004) /* NE_AUTH_GSSAPI: Use GSSAPI or SSPI to authenticate the user; an * active attacker can modify any of the request/response at will, so * this must not be used over an unsecured channel. */ #define NE_AUTH_GSSAPI (0x0008) /* NE_AUTH_NTLM: Use NTLM to authenticate the user; an active attacker * can modify any of the request/response at will, so this must not be * used over an unsecured channel. */ #define NE_AUTH_NTLM (0x0010) /* The default set of supported protocols, as deemed appropriate for * the given session scheme. */ #define NE_AUTH_DEFAULT (0x1000) /* All protocols supported by the library. */ #define NE_AUTH_ALL (0x2000) /* Add a callback to provide credentials for server and proxy * authentication using a particular auth protocol or set of * protocols. The protocol is supplied as a bitmask of NE_AUTH_* * values. For NE_AUTH_NEGOTIATE, the creds and userdata arguments * are ignored and may be NULL. * * These functions may be called multiple times per session to * register callbacks for different protocols. If the server presents * more than one protocol in an auth challenge, the following * algorithm will be used to determine which callback is used: * * - iterate over the registered callbacks in the order registered * - for each each callback, iterate over the known set of protocols * in order of algorithm strength (strongest first). * - if the protocol mask for that callback matches the protocol, * attempt authentication using this protocol. * * Therefore, if multiple calls to ne_add_server_auth or * ne_add_proxy_auth are used for a given session, the caller must * ensure that the order in which those calls are made reflects the * precedence of protocols to be used. */ void ne_add_server_auth(ne_session *sess, unsigned protocol, ne_auth_creds creds, void *userdata); void ne_add_proxy_auth(ne_session *sess, unsigned protocol, ne_auth_creds creds, void *userdata); /* Clear any cached authentication credentials for the given * session. */ void ne_forget_auth(ne_session *sess); NE_END_DECLS #endif /* NE_AUTH_H */ cadaver-0.23.3/lib/neon/ne_alloc.c0000664000076400007640000001100311111347357016251 0ustar jortonjorton/* Replacement memory allocation handling etc. Copyright (C) 1999-2005, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include #include "ne_alloc.h" static ne_oom_callback_fn oom; void ne_oom_callback(ne_oom_callback_fn callback) { oom = callback; } #ifndef NEON_MEMLEAK #define DO_MALLOC(ptr, len) do { \ ptr = malloc((len)); \ if (!ptr) { \ if (oom != NULL) \ oom(); \ abort(); \ } \ } while(0); void *ne_malloc(size_t len) { void *ptr; DO_MALLOC(ptr, len); return ptr; } void *ne_calloc(size_t len) { void *ptr; DO_MALLOC(ptr, len); return memset(ptr, 0, len); } void *ne_realloc(void *ptr, size_t len) { void *ret = realloc(ptr, len); if (!ret) { if (oom) oom(); abort(); } return ret; } #ifdef WIN32 /* Implemented only to ensure free is bound to the correct DLL. */ void ne_free(void *ptr) { free(ptr); } #endif char *ne_strdup(const char *s) { char *ret; DO_MALLOC(ret, strlen(s) + 1); return strcpy(ret, s); } char *ne_strndup(const char *s, size_t n) { char *new; DO_MALLOC(new, n+1); new[n] = '\0'; memcpy(new, s, n); return new; } #else /* NEON_MEMLEAK */ #include /* Memory-leak detection implementation: ne_malloc and friends are * #defined to ne_malloc_ml etc by memleak.h, which is conditionally * included by config.h. */ /* memory allocated be ne_*alloc, but not freed. */ size_t ne_alloc_used = 0; static struct block { void *ptr; size_t len; const char *file; int line; struct block *next; } *blocks = NULL; void ne_alloc_dump(FILE *f) { struct block *b; for (b = blocks; b != NULL; b = b->next) fprintf(f, "%" NE_FMT_SIZE_T "b@%s:%d%s", b->len, b->file, b->line, b->next?", ":""); } static void *tracking_malloc(size_t len, const char *file, int line) { void *ptr = malloc((len)); struct block *block; if (!ptr) { if (oom) oom(); abort(); } block = malloc(sizeof *block); if (block != NULL) { block->ptr = ptr; block->len = len; block->file = file; block->line = line; block->next = blocks; blocks = block; ne_alloc_used += len; } return ptr; } void *ne_malloc_ml(size_t size, const char *file, int line) { return tracking_malloc(size, file, line); } void *ne_calloc_ml(size_t size, const char *file, int line) { return memset(tracking_malloc(size, file, line), 0, size); } void *ne_realloc_ml(void *ptr, size_t s, const char *file, int line) { void *ret; struct block *b; if (ptr == NULL) return tracking_malloc(s, file, line); ret = realloc(ptr, s); if (!ret) { if (oom) oom(); abort(); } for (b = blocks; b != NULL; b = b->next) { if (b->ptr == ptr) { ne_alloc_used += s - b->len; b->ptr = ret; b->len = s; break; } } assert(b != NULL); return ret; } char *ne_strdup_ml(const char *s, const char *file, int line) { return strcpy(tracking_malloc(strlen(s) + 1, file, line), s); } char *ne_strndup_ml(const char *s, size_t n, const char *file, int line) { char *ret = tracking_malloc(n + 1, file, line); ret[n] = '\0'; return memcpy(ret, s, n); } void ne_free_ml(void *ptr) { struct block *b, *last = NULL; for (b = blocks; b != NULL; last = b, b = b->next) { if (b->ptr == ptr) { ne_alloc_used -= b->len; if (last) last->next = b->next; else blocks = b->next; free(b); break; } } free(ptr); } #endif /* NEON_MEMLEAK */ cadaver-0.23.3/lib/neon/ne_utils.h0000664000076400007640000001000610646613101016321 0ustar jortonjorton/* HTTP utility functions Copyright (C) 1999-2006, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_UTILS_H #define NE_UTILS_H #include #include #include #include "ne_defs.h" #ifdef NEON_TRIO #include #endif NE_BEGIN_DECLS /* Returns a human-readable library version string describing the * version and build information; for example: * "neon 0.2.0: Library build, OpenSSL support" */ const char *ne_version_string(void); /* Returns non-zero if library version is not of major version * 'major', or if minor version is not greater than or equal to * 'minor'. For neon versions with major == 0, all minor versions are * presumed to be incompatible. */ int ne_version_match(int major, int minor); /* Feature codes: */ #define NE_FEATURE_SSL (1) /* SSL/TLS support */ #define NE_FEATURE_ZLIB (2) /* zlib compression in compress interface */ #define NE_FEATURE_IPV6 (3) /* IPv6 is supported in resolver */ #define NE_FEATURE_LFS (4) /* large file support */ #define NE_FEATURE_SOCKS (5) /* SOCKSv5 support */ #define NE_FEATURE_TS_SSL (6) /* Thread-safe SSL/TLS support */ #define NE_FEATURE_I18N (7) /* i18n error message support */ /* Returns non-zero if library is built with support for the given * NE_FEATURE_* feature code 'code'. */ int ne_has_support(int feature); /* Debugging macro to allow code to be optimized out if debugging is * disabled at build time. */ #ifndef NE_DEBUGGING #define NE_DEBUG if (0) ne_debug #else /* DEBUGGING */ #define NE_DEBUG ne_debug #endif /* DEBUGGING */ /* Debugging masks. */ #define NE_DBG_SOCKET (1<<0) /* raw socket */ #define NE_DBG_HTTP (1<<1) /* HTTP request/response handling */ #define NE_DBG_XML (1<<2) /* XML parser */ #define NE_DBG_HTTPAUTH (1<<3) /* HTTP authentication (hiding credentials) */ #define NE_DBG_HTTPPLAIN (1<<4) /* plaintext HTTP authentication */ #define NE_DBG_LOCKS (1<<5) /* WebDAV locking */ #define NE_DBG_XMLPARSE (1<<6) /* low-level XML parser */ #define NE_DBG_HTTPBODY (1<<7) /* HTTP response body blocks */ #define NE_DBG_SSL (1<<8) /* SSL/TLS */ #define NE_DBG_FLUSH (1<<30) /* always flush debugging */ /* Send debugging output to 'stream', for all of the given debug * channels. To disable debugging, pass 'stream' as NULL and 'mask' * as 0. */ void ne_debug_init(FILE *stream, int mask); /* The current debug mask and stream set by the last call to * ne_debug_init. */ extern int ne_debug_mask; extern FILE *ne_debug_stream; /* Produce debug output if any of channels 'ch' is enabled for * debugging. */ void ne_debug(int ch, const char *, ...) ne_attribute((format(printf, 2, 3))); /* Storing an HTTP status result */ typedef struct { int major_version; int minor_version; int code; /* Status-Code value */ int klass; /* Class of Status-Code (1-5) */ char *reason_phrase; } ne_status; /* NB: couldn't use 'class' in ne_status because it would clash with * the C++ reserved word. */ /* Parse 'status_line' using the the RFC2616 Status-Line grammar. * s->reason_phrase is malloc-allocated if non-NULL, and must be * free'd by the caller. Returns 0 on success, in which case all * fields of '*s' will be set; or -1 on parse error, in which case * '*s' is unmodified. */ int ne_parse_statusline(const char *status_line, ne_status *s); NE_END_DECLS #endif /* NE_UTILS_H */ cadaver-0.23.3/lib/neon/ne_acl3744.h0000664000076400007640000000525711075170315016260 0ustar jortonjorton/* Access control Copyright (C) 2001-2007, Joe Orton Copyright (C) 2001, Arun Garg Copyright (C) 2007 Henrik Holst This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_ACL3744_H #define NE_ACL3744_H #include "ne_session.h" NE_BEGIN_DECLS #define NE_ACL_READ (0x0001) #define NE_ACL_WRITE (0x0002) #define NE_ACL_WRITE_PROPERTIES (0x0004) #define NE_ACL_WRITE_CONTENT (0x0008) #define NE_ACL_UNLOCK (0x0010) #define NE_ACL_READ_ACL (0x0020) #define NE_ACL_READ_CUPRIVSET (0x0040) #define NE_ACL_WRITE_ACL (0x0080) #define NE_ACL_BIND (0x0100) #define NE_ACL_UNBIND (0x0200) #define NE_ACL_ALL (0x0400) enum ne_acl_target { ne_acl_href, ne_acl_property, ne_acl_all, ne_acl_authenticated, ne_acl_unauthenticated, ne_acl_self }; enum ne_acl_optype { ne_acl_grant, ne_acl_deny }; /* A simplified representation of an Access Control Element (ACE): */ typedef struct { /* Identify the principal(s) to which this ACE applies: */ enum ne_acl_target target; /* Whether to grant or deny access: */ enum ne_acl_optype type; /* If target == ne_acl_href, tname must be non-NULL and give the * principal URL. If target == ne_acl_property, tname must be * non-NULL and be a property name, including an XML namespace * definition, if appropriate (the default namespace being * "DAV:"). This restricts access as described at: * http://tools.ietf.org/html/rfc3744#section-5.5.1 */ char *tname; /* The set of privileges to be restricted; a bit mask of one or * more of the NE_ACL_* constants defined above: */ unsigned int privileges; } ne_acl_entry; /* Set the ACL for the given resource to the list of ACL entries. */ int ne_acl3744_set(ne_session *sess, const char *path, const ne_acl_entry entries[], int numentries); NE_END_DECLS #endif /* NE_ACL3744_H */ cadaver-0.23.3/lib/neon/ne_ntlm.h0000664000076400007640000000272111247475573016161 0ustar jortonjorton/* Handling of NTLM Authentication Copyright (C) 2009, Kai Sommerfeld This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_NTLM_H #define NE_NTLM_H #include "config.h" /* PRIVATE TO NEON -- NOT PART OF THE EXTERNAL API. */ #ifdef HAVE_NTLM #include "ne_defs.h" typedef struct ne_ntlm_context_s ne_ntlm_context; NE_PRIVATE ne_ntlm_context *ne__ntlm_create_context(const char *userName, const char *password); NE_PRIVATE int ne__ntlm_clear_context(ne_ntlm_context *context); NE_PRIVATE void ne__ntlm_destroy_context(ne_ntlm_context *context); NE_PRIVATE int ne__ntlm_authenticate(ne_ntlm_context *context, const char *responseToken); NE_PRIVATE char *ne__ntlm_getRequestToken(ne_ntlm_context *context); #endif /* HAVE_NTLM */ #endif /* NE_NTLM_H */ cadaver-0.23.3/lib/neon/ne_acl3744.c0000664000076400007640000001206111075170315016242 0ustar jortonjorton/* Access control Copyright (C) 2001-2006, 2008, Joe Orton Copyright (C) 2001, Arun Garg Copyright (C) 2007 Henrik Holst This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* Contributed by Arun Garg */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include "ne_request.h" #include "ne_locks.h" #include "ne_alloc.h" #include "ne_string.h" #include "ne_acl3744.h" #include "ne_uri.h" #include "ne_xml.h" /* for NE_XML_MEDIA_TYPE */ #define EOL "\r\n" static ne_buffer *acl_body(const ne_acl_entry *right, int count) { ne_buffer *body = ne_buffer_create(); int m; ne_buffer_zappend(body, "" EOL "" EOL); for (m = 0; m < count; m++) { const char *type; type = (right[m].type == ne_acl_grant ? "grant" : "deny"); ne_buffer_concat(body, "" EOL "", NULL); switch (right[m].target) { case ne_acl_all: ne_buffer_czappend(body, "" EOL); break; case ne_acl_authenticated: ne_buffer_czappend(body, "" EOL); break; case ne_acl_unauthenticated: ne_buffer_czappend(body, "" EOL); break; case ne_acl_self: ne_buffer_czappend(body, "" EOL); break; case ne_acl_property: ne_buffer_concat(body, "<", right[m].tname, "/>" EOL, NULL); break; case ne_acl_href: ne_buffer_concat(body, "", right[m].tname, "" EOL, NULL); break; } ne_buffer_concat(body, "" EOL "<", type, ">" EOL, NULL); if ((right[m].privileges & NE_ACL_READ) == NE_ACL_READ) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_WRITE) == NE_ACL_WRITE) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_WRITE_PROPERTIES) == NE_ACL_WRITE_PROPERTIES) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_WRITE_CONTENT) == NE_ACL_WRITE_CONTENT) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_UNLOCK) == NE_ACL_UNLOCK) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_READ_ACL) == NE_ACL_READ_ACL) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_READ_CUPRIVSET) == NE_ACL_READ_CUPRIVSET) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_WRITE_ACL) == NE_ACL_WRITE_ACL) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_BIND) == NE_ACL_BIND) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_UNBIND) == NE_ACL_UNBIND) ne_buffer_concat(body, "" "" "" EOL, NULL); if ((right[m].privileges & NE_ACL_ALL) == NE_ACL_ALL) ne_buffer_concat(body, "" "" "" EOL, NULL); ne_buffer_concat(body, "" EOL, NULL); ne_buffer_czappend(body, "" EOL); } ne_buffer_czappend(body, "" EOL); return body; } int ne_acl3744_set(ne_session *sess, const char *uri, const ne_acl_entry *entries, int numentries) { int ret; ne_request *req = ne_request_create(sess, "ACL", uri); ne_buffer *body = acl_body(entries, numentries); #ifdef NE_HAVE_DAV ne_lock_using_resource(req, uri, 0); #endif ne_set_request_body_buffer(req, body->data, ne_buffer_size(body)); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); ret = ne_request_dispatch(req); ne_buffer_destroy(body); if (ret == NE_OK && ne_get_status(req)->code == 207) { ret = NE_ERROR; } ne_request_destroy(req); return ret; } cadaver-0.23.3/lib/neon/ne_dates.h0000664000076400007640000000315610342676201016274 0ustar jortonjorton/* Date manipulation routines Copyright (C) 1999-2002, 2005, Joe Orton This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef NE_DATES_H #define NE_DATES_H #include #include "ne_defs.h" NE_BEGIN_DECLS /* Date manipulation routines as per RFC1123 and RFC1036 */ /* Return current date/time in RFC1123 format */ char *ne_rfc1123_date(time_t anytime); /* Returns time from date/time using the subset of the ISO8601 format * referenced in RFC2518 (e.g as used in the creationdate property in * the DAV: namespace). */ time_t ne_iso8601_parse(const char *date); /* Returns time from date/time in RFC1123 format */ time_t ne_rfc1123_parse(const char *date); time_t ne_rfc1036_parse(const char *date); /* Parses asctime date string */ time_t ne_asctime_parse(const char *date); /* Parse an HTTP-date as per RFC2616 */ time_t ne_httpdate_parse(const char *date); NE_END_DECLS #endif /* NE_DATES_H */ cadaver-0.23.3/lib/getopt1.c0000664000076400007640000001072210132320456015121 0ustar jortonjorton/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ cadaver-0.23.3/lib/dirname.c0000664000076400007640000000421010132320456015150 0ustar jortonjorton/* dirname.c -- return all but the last element in a path Copyright (C) 1990, 1998 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if HAVE_CONFIG_H # include #endif /******************************************************* * THIS IS A MODIFIED dirname IMPLEMENTATION: * - sitecopy wants "" if there is no directory name, * standard GNU implementation gives us "." * - sitecopy wants the trailing slash. *******************************************************/ #ifdef STDC_HEADERS # include #else char *malloc (); #endif #if defined STDC_HEADERS || defined HAVE_STRING_H # include #else # include # ifndef strrchr # define strrchr rindex # endif #endif #include "dirname.h" /* Return the leading directories part of PATH, allocated with malloc. If out of memory, return 0. Assumes that trailing slashes have already been removed. */ char * dir_name (const char *path) { char *newpath; char *slash; int length; /* Length of result, not including NUL. */ slash = strrchr (path, '/'); if (slash == 0) { /* File is in the current directory. */ path = ""; length = 0; } else { /* Remove any trailing slashes from the result. while (slash > path && *slash == '/') --slash; */ length = slash - path + 1; } newpath = (char *) malloc (length + 1); if (newpath == 0) return 0; strncpy (newpath, path, length); newpath[length] = 0; return newpath; } cadaver-0.23.3/lib/netrc.h0000664000076400007640000000407210132320456014657 0ustar jortonjorton/* netrc.h -- declarations for netrc.c Copyright (C) 1996, Free Software Foundation, Inc. Gordon Matzigkeit , 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _NETRC_H_ #define _NETRC_H_ 1 # undef __BEGIN_DECLS # undef __END_DECLS #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS /* empty */ # define __END_DECLS /* empty */ #endif #undef __P #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus) # define __P(protos) protos #else # define __P(protos) () #endif /* The structure used to return account information from the .netrc. */ typedef struct _netrc_entry { /* The exact host name given in the .netrc, NULL if default. */ char *host; /* The name of the account. */ char *account; /* Password for the account (NULL, if none). */ char *password; /* Pointer to the next entry in the list. */ struct _netrc_entry *next; } netrc_entry; __BEGIN_DECLS /* Parse FILE as a .netrc file (as described in ftp(1)), and return a list of entries. NULL is returned if the file could not be parsed. */ netrc_entry *parse_netrc __P((char *file)); /* Return the netrc entry from LIST corresponding to HOST. NULL is returned if no such entry exists. */ netrc_entry *search_netrc __P((netrc_entry *list, const char *host)); __END_DECLS #endif /* _NETRC_H_ */ cadaver-0.23.3/lib/basename.c0000664000076400007640000000322110132320456015305 0ustar jortonjorton/* basename.c -- return the last element in a path Copyright (C) 1990, 1998, 1999 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if HAVE_CONFIG_H # include #endif #include #ifndef FILESYSTEM_PREFIX_LEN # define FILESYSTEM_PREFIX_LEN(Filename) 0 #endif #ifndef ISSLASH # define ISSLASH(C) ((C) == '/') #endif /* In general, we can't use the builtin `basename' function if available, since it has different meanings in different environments. In some environments the builtin `basename' modifies its argument. If NAME is all slashes, be sure to return `/'. */ char * base_name (char const *name) { char const *base = name += FILESYSTEM_PREFIX_LEN (name); int all_slashes = 1; char const *p; for (p = name; *p; p++) { if (ISSLASH (*p)) base = p + 1; else all_slashes = 0; } /* If NAME is all slashes, arrange to return `/'. */ if (*base == '\0' && ISSLASH (*name) && all_slashes) --base; return (char *) base; } cadaver-0.23.3/lib/strftime.c0000664000076400007640000007210610132320456015377 0ustar jortonjorton/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include #endif #ifdef _LIBC # define HAVE_LIMITS_H 1 # define HAVE_MBLEN 1 # define HAVE_MBRLEN 1 # define HAVE_STRUCT_ERA_ENTRY 1 # define HAVE_TM_GMTOFF 1 # define HAVE_TM_ZONE 1 # define HAVE_TZNAME 1 # define HAVE_TZSET 1 # define MULTIBYTE_IS_FORMAT_SAFE 1 # define STDC_HEADERS 1 # include "../locale/localeinfo.h" #endif #if defined emacs && !defined HAVE_BCOPY # define HAVE_MEMCPY 1 #endif #include #include /* Some systems define `time_t' here. */ #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #if HAVE_TZNAME extern char *tzname[]; #endif /* Do multibyte processing if multibytes are supported, unless multibyte sequences are safe in formats. Multibyte sequences are safe if they cannot contain byte sequences that look like format conversion specifications. The GNU C Library uses UTF8 multibyte encoding, which is safe for formats, but strftime.c can be used with other C libraries that use unsafe encodings. */ #define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE) #if DO_MULTIBYTE # if HAVE_MBRLEN # include # else /* Simulate mbrlen with mblen as best we can. */ # define mbstate_t int # define mbrlen(s, n, ps) mblen (s, n) # define mbsinit(ps) (*(ps) == 0) # endif static const mbstate_t mbstate_zero; #endif #if HAVE_LIMITS_H # include #endif #if STDC_HEADERS # include # include # include #else # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # endif #endif #ifdef _LIBC # define MEMPCPY(d, s, n) __mempcpy (d, s, n) #else # ifndef HAVE_MEMPCPY # define MEMPCPY(d, s, n) ((void *) ((char *) memcpy (d, s, n) + (n))) # endif #endif #ifndef __P # if defined (__GNUC__) || (defined (__STDC__) && __STDC__) # define __P(args) args # else # define __P(args) () # endif /* GCC. */ #endif /* Not __P. */ #ifndef PTR # ifdef __STDC__ # define PTR void * # else # define PTR char * # endif #endif #ifndef CHAR_BIT # define CHAR_BIT 8 #endif #ifndef NULL # define NULL 0 #endif #define TYPE_SIGNED(t) ((t) -1 < 0) /* Bound on length of the string representing an integer value of type t. Subtract one for the sign bit if t is signed; 302 / 1000 is log10 (2) rounded up; add one for integer division truncation; add one more for a minus sign if t is signed. */ #define INT_STRLEN_BOUND(t) \ ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 + 1 + TYPE_SIGNED (t)) #define TM_YEAR_BASE 1900 #ifndef __isleap /* Nonzero if YEAR is a leap year (every 4 years, except every 100th isn't, and every 400th is). */ # define __isleap(year) \ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) #endif #ifdef _LIBC # define my_strftime_gmtime_r __gmtime_r # define my_strftime_localtime_r __localtime_r # define tzname __tzname # define tzset __tzset #else /* If we're a strftime substitute in a GNU program, then prefer gmtime to gmtime_r, since many gmtime_r implementations are buggy. Similarly for localtime_r. */ # if ! HAVE_TM_GMTOFF static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *)); static struct tm * my_strftime_gmtime_r (const time_t *t, struct tm *tp) { struct tm *l = gmtime (t); if (! l) return 0; *tp = *l; return tp; } # endif /* ! HAVE_TM_GMTOFF */ static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *)); static struct tm * my_strftime_localtime_r (const time_t *t, struct tm *tp) { struct tm *l = localtime (t); if (! l) return 0; *tp = *l; return tp; } #endif /* ! defined _LIBC */ #if !defined memset && !defined HAVE_MEMSET && !defined _LIBC /* Some systems lack the `memset' function and we don't want to introduce additional dependencies. */ /* The SGI compiler reportedly barfs on the trailing null if we use a string constant as the initializer. 28 June 1997, rms. */ static const char spaces[16] = /* " " */ { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' }; static const char zeroes[16] = /* "0000000000000000" */ { '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0' }; # define memset_space(P, Len) \ do { \ int _len = (Len); \ \ do \ { \ int _this = _len > 16 ? 16 : _len; \ (P) = MEMPCPY ((P), spaces, _this); \ _len -= _this; \ } \ while (_len > 0); \ } while (0) # define memset_zero(P, Len) \ do { \ int _len = (Len); \ \ do \ { \ int _this = _len > 16 ? 16 : _len; \ (P) = MEMPCPY ((P), zeroes, _this); \ _len -= _this; \ } \ while (_len > 0); \ } while (0) #else # define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len)) # define memset_zero(P, Len) (memset ((P), '0', (Len)), (P) += (Len)) #endif #define add(n, f) \ do \ { \ int _n = (n); \ int _delta = width - _n; \ int _incr = _n + (_delta > 0 ? _delta : 0); \ if (i + _incr >= maxsize) \ return 0; \ if (p) \ { \ if (_delta > 0) \ { \ if (pad == '0') \ memset_zero (p, _delta); \ else \ memset_space (p, _delta); \ } \ f; \ p += _n; \ } \ i += _incr; \ } while (0) #define cpy(n, s) \ add ((n), \ if (to_lowcase) \ memcpy_lowcase (p, (s), _n); \ else if (to_uppcase) \ memcpy_uppcase (p, (s), _n); \ else \ memcpy ((PTR) p, (PTR) (s), _n)) #ifdef _LIBC # define TOUPPER(Ch) toupper (Ch) # define TOLOWER(Ch) tolower (Ch) #else # define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch)) # define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) #endif /* We don't use `isdigit' here since the locale dependent interpretation is not what we want here. We only need to accept the arabic digits in the ASCII range. One day there is perhaps a more reliable way to accept other sets of digits. */ #define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9) static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len)); static char * memcpy_lowcase (char *dest, const char *src, size_t len) { while (len-- > 0) dest[len] = TOLOWER ((unsigned char) src[len]); return dest; } static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len)); static char * memcpy_uppcase (char *dest, const char *src, size_t len) { while (len-- > 0) dest[len] = TOUPPER ((unsigned char) src[len]); return dest; } #if ! HAVE_TM_GMTOFF /* Yield the difference between *A and *B, measured in seconds, ignoring leap seconds. */ # define tm_diff ftime_tm_diff static int tm_diff __P ((const struct tm *, const struct tm *)); static int tm_diff (const struct tm *a, const struct tm *b) { /* Compute intervening leap days correctly even if year is negative. Take care to avoid int overflow in leap day calculations, but it's OK to assume that A and B are close to each other. */ int a4 = (a->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (a->tm_year & 3); int b4 = (b->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (b->tm_year & 3); int a100 = a4 / 25 - (a4 % 25 < 0); int b100 = b4 / 25 - (b4 % 25 < 0); int a400 = a100 >> 2; int b400 = b100 >> 2; int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400); int years = a->tm_year - b->tm_year; int days = (365 * years + intervening_leap_days + (a->tm_yday - b->tm_yday)); return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour)) + (a->tm_min - b->tm_min)) + (a->tm_sec - b->tm_sec)); } #endif /* ! HAVE_TM_GMTOFF */ /* The number of days from the first day of the first ISO week of this year to the year day YDAY with week day WDAY. ISO weeks start on Monday; the first ISO week has the year's first Thursday. YDAY may be as small as YDAY_MINIMUM. */ #define ISO_WEEK_START_WDAY 1 /* Monday */ #define ISO_WEEK1_WDAY 4 /* Thursday */ #define YDAY_MINIMUM (-366) static int iso_week_days __P ((int, int)); #ifdef __GNUC__ __inline__ #endif static int iso_week_days (int yday, int wday) { /* Add enough to the first operand of % to make it nonnegative. */ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7; return (yday - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7 + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY); } #if !(defined _NL_CURRENT || HAVE_STRFTIME) static char const weekday_name[][10] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; static char const month_name[][10] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; #endif #ifdef emacs # define my_strftime emacs_strftimeu # define ut_argument , ut # define ut_argument_spec int ut; # define ut_argument_spec_iso , int ut #else # define my_strftime strftime # define ut_argument # define ut_argument_spec # define ut_argument_spec_iso /* We don't have this information in general. */ # define ut 0 #endif #if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. Work around this bug by copying *tp before it might be munged. */ size_t _strftime_copytm __P ((char *, size_t, const char *, const struct tm * ut_argument_spec_iso)); size_t my_strftime (s, maxsize, format, tp ut_argument) char *s; size_t maxsize; const char *format; const struct tm *tp; ut_argument_spec { struct tm tmcopy; tmcopy = *tp; return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument); } # undef my_strftime # define my_strftime(S, Maxsize, Format, Tp) \ _strftime_copytm (S, Maxsize, Format, Tp) #endif /* Write information from TP into S according to the format string FORMAT, writing no more that MAXSIZE characters (including the terminating '\0') and returning number of characters written. If S is NULL, nothing will be written anywhere, so to determine how many characters would be written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */ size_t my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp ut_argument_spec) { int hour12 = tp->tm_hour; #ifdef _NL_CURRENT /* We cannot make the following values variables since we must delay the evaluation of these values until really needed since some expressions might not be valid in every situation. The `struct tm' might be generated by a strptime() call that initialized only a few elements. Dereference the pointers only if the format requires this. Then it is ok to fail if the pointers are invalid. */ # define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday) # define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday) # define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon) # define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon) # define ampm _NL_CURRENT (LC_TIME, tp->tm_hour > 11 ? PM_STR : AM_STR) # define aw_len strlen (a_wkday) # define am_len strlen (a_month) # define ap_len strlen (ampm) #else # if !HAVE_STRFTIME # define f_wkday (weekday_name[tp->tm_wday]) # define f_month (month_name[tp->tm_mon]) # define a_wkday f_wkday # define a_month f_month # define ampm ("AMPM" + 2 * (tp->tm_hour > 11)) size_t aw_len = 3; size_t am_len = 3; size_t ap_len = 2; # endif #endif const char *zone; size_t i = 0; char *p = s; const char *f; zone = NULL; #if HAVE_TM_ZONE /* The POSIX test suite assumes that setting the environment variable TZ to a new value before calling strftime() will influence the result (the %Z format) even if the information in TP is computed with a totally different time zone. This is bogus: though POSIX allows bad behavior like this, POSIX does not require it. Do the right thing instead. */ zone = (const char *) tp->tm_zone; #endif #if HAVE_TZNAME if (ut) { if (! (zone && *zone)) zone = "GMT"; } else { /* POSIX.1 8.1.1 requires that whenever strftime() is called, the time zone names contained in the external variable `tzname' shall be set as if the tzset() function had been called. */ # if HAVE_TZSET tzset (); # endif } #endif if (hour12 > 12) hour12 -= 12; else if (hour12 == 0) hour12 = 12; for (f = format; *f != '\0'; ++f) { int pad = 0; /* Padding for number ('-', '_', or 0). */ int modifier; /* Field modifier ('E', 'O', or 0). */ int digits; /* Max digits for numeric format. */ int number_value; /* Numeric value to be printed. */ int negative_number; /* 1 if the number is negative. */ const char *subfmt; char *bufp; char buf[1 + (sizeof (int) < sizeof (time_t) ? INT_STRLEN_BOUND (time_t) : INT_STRLEN_BOUND (int))]; int width = -1; int to_lowcase = 0; int to_uppcase = 0; int change_case = 0; int format_char; #if DO_MULTIBYTE switch (*f) { case '%': break; case '\a': case '\b': case '\t': case '\n': case '\v': case '\f': case '\r': case ' ': case '!': case '"': case '#': case '&': case'\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case ':': case ';': case '<': case '=': case '>': case '?': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case'\\': case ']': case '^': case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}': case '~': /* The C Standard requires these 98 characters (plus '%') to be in the basic execution character set. None of these characters can start a multibyte sequence, so they need not be analyzed further. */ add (1, *p = *f); continue; default: /* Copy this multibyte sequence until we reach its end, find an error, or come back to the initial shift state. */ { mbstate_t mbstate = mbstate_zero; size_t len = 0; do { size_t bytes = mbrlen (f + len, (size_t) -1, &mbstate); if (bytes == 0) break; if (bytes == (size_t) -2) { len += strlen (f + len); break; } if (bytes == (size_t) -1) { len++; break; } len += bytes; } while (! mbsinit (&mbstate)); cpy (len, f); f += len - 1; continue; } } #else /* ! DO_MULTIBYTE */ /* Either multibyte encodings are not supported, or they are safe for formats, so any non-'%' byte can be copied through. */ if (*f != '%') { add (1, *p = *f); continue; } #endif /* ! DO_MULTIBYTE */ /* Check for flags that can modify a format. */ while (1) { switch (*++f) { /* This influences the number formats. */ case '_': case '-': case '0': pad = *f; continue; /* This changes textual output. */ case '^': to_uppcase = 1; continue; case '#': change_case = 1; continue; default: break; } break; } /* As a GNU extension we allow to specify the field width. */ if (ISDIGIT (*f)) { width = 0; do { width *= 10; width += *f - '0'; ++f; } while (ISDIGIT (*f)); } /* Check for modifiers. */ switch (*f) { case 'E': case 'O': modifier = *f++; break; default: modifier = 0; break; } /* Now do the specified format. */ format_char = *f; switch (format_char) { #define DO_NUMBER(d, v) \ digits = width == -1 ? d : width; \ number_value = v; goto do_number #define DO_NUMBER_SPACEPAD(d, v) \ digits = width == -1 ? d : width; \ number_value = v; goto do_number_spacepad case '%': if (modifier != 0) goto bad_format; add (1, *p = *f); break; case 'a': if (modifier != 0) goto bad_format; if (change_case) { to_uppcase = 1; to_lowcase = 0; } #if defined _NL_CURRENT || !HAVE_STRFTIME cpy (aw_len, a_wkday); break; #else goto underlying_strftime; #endif case 'A': if (modifier != 0) goto bad_format; if (change_case) { to_uppcase = 1; to_lowcase = 0; } #if defined _NL_CURRENT || !HAVE_STRFTIME cpy (strlen (f_wkday), f_wkday); break; #else goto underlying_strftime; #endif case 'b': case 'h': /* POSIX.2 extension. */ if (modifier != 0) goto bad_format; #if defined _NL_CURRENT || !HAVE_STRFTIME cpy (am_len, a_month); break; #else goto underlying_strftime; #endif case 'B': if (modifier != 0) goto bad_format; if (change_case) { to_uppcase = 1; to_lowcase = 0; } #if defined _NL_CURRENT || !HAVE_STRFTIME cpy (strlen (f_month), f_month); break; #else goto underlying_strftime; #endif case 'c': if (modifier == 'O') goto bad_format; #ifdef _NL_CURRENT if (! (modifier == 'E' && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT)) != '\0')) subfmt = _NL_CURRENT (LC_TIME, D_T_FMT); #else # if HAVE_STRFTIME goto underlying_strftime; # else subfmt = "%a %b %e %H:%M:%S %Y"; # endif #endif subformat: { char *old_start = p; size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp); add (len, my_strftime (p, maxsize - i, subfmt, tp)); if (to_uppcase) while (old_start < p) { *old_start = TOUPPER ((unsigned char) *old_start); ++old_start; } } break; #if HAVE_STRFTIME && ! (defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY) underlying_strftime: { /* The relevant information is available only via the underlying strftime implementation, so use that. */ char ufmt[4]; char *u = ufmt; char ubuf[1024]; /* enough for any single format in practice */ size_t len; *u++ = '%'; if (modifier != 0) *u++ = modifier; *u++ = format_char; *u = '\0'; len = strftime (ubuf, sizeof ubuf, ufmt, tp); if (len == 0 && ubuf[0] != '\0') return 0; cpy (len, ubuf); } break; #endif case 'C': /* POSIX.2 extension. */ if (modifier == 'O') goto bad_format; if (modifier == 'E') { #if HAVE_STRUCT_ERA_ENTRY struct era_entry *era = _nl_get_era_entry (tp); if (era) { size_t len = strlen (era->name_fmt); cpy (len, era->name_fmt); break; } #else # if HAVE_STRFTIME goto underlying_strftime; # endif #endif } { int year = tp->tm_year + TM_YEAR_BASE; DO_NUMBER (1, year / 100 - (year % 100 < 0)); } case 'x': if (modifier == 'O') goto bad_format; #ifdef _NL_CURRENT if (! (modifier == 'E' && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_FMT)) != '\0')) subfmt = _NL_CURRENT (LC_TIME, D_FMT); goto subformat; #else # if HAVE_STRFTIME goto underlying_strftime; # else /* Fall through. */ # endif #endif case 'D': /* POSIX.2 extension. */ if (modifier != 0) goto bad_format; subfmt = "%m/%d/%y"; goto subformat; case 'd': if (modifier == 'E') goto bad_format; DO_NUMBER (2, tp->tm_mday); case 'e': /* POSIX.2 extension. */ if (modifier == 'E') goto bad_format; DO_NUMBER_SPACEPAD (2, tp->tm_mday); /* All numeric formats set DIGITS and NUMBER_VALUE and then jump to one of these two labels. */ do_number_spacepad: /* Force `_' flag unless overwritten by `0' flag. */ if (pad != '0') pad = '_'; do_number: /* Format the number according to the MODIFIER flag. */ if (modifier == 'O' && 0 <= number_value) { #ifdef _NL_CURRENT /* Get the locale specific alternate representation of the number NUMBER_VALUE. If none exist NULL is returned. */ const char *cp = _nl_get_alt_digit (number_value); if (cp != NULL) { size_t digitlen = strlen (cp); if (digitlen != 0) { cpy (digitlen, cp); break; } } #else # if HAVE_STRFTIME goto underlying_strftime; # endif #endif } { unsigned int u = number_value; bufp = buf + sizeof (buf); negative_number = number_value < 0; if (negative_number) u = -u; do *--bufp = u % 10 + '0'; while ((u /= 10) != 0); } do_number_sign_and_padding: if (negative_number) *--bufp = '-'; if (pad != '-') { int padding = digits - (buf + sizeof (buf) - bufp); if (pad == '_') { while (0 < padding--) *--bufp = ' '; } else { bufp += negative_number; while (0 < padding--) *--bufp = '0'; if (negative_number) *--bufp = '-'; } } cpy (buf + sizeof (buf) - bufp, bufp); break; case 'F': if (modifier != 0) goto bad_format; subfmt = "%Y-%m-%d"; goto subformat; case 'H': if (modifier == 'E') goto bad_format; DO_NUMBER (2, tp->tm_hour); case 'I': if (modifier == 'E') goto bad_format; DO_NUMBER (2, hour12); case 'k': /* GNU extension. */ if (modifier == 'E') goto bad_format; DO_NUMBER_SPACEPAD (2, tp->tm_hour); case 'l': /* GNU extension. */ if (modifier == 'E') goto bad_format; DO_NUMBER_SPACEPAD (2, hour12); case 'j': if (modifier == 'E') goto bad_format; DO_NUMBER (3, 1 + tp->tm_yday); case 'M': if (modifier == 'E') goto bad_format; DO_NUMBER (2, tp->tm_min); case 'm': if (modifier == 'E') goto bad_format; DO_NUMBER (2, tp->tm_mon + 1); case 'n': /* POSIX.2 extension. */ add (1, *p = '\n'); break; case 'P': to_lowcase = 1; #if !defined _NL_CURRENT && HAVE_STRFTIME format_char = 'p'; #endif /* FALLTHROUGH */ case 'p': if (change_case) { to_uppcase = 0; to_lowcase = 1; } #if defined _NL_CURRENT || !HAVE_STRFTIME cpy (ap_len, ampm); break; #else goto underlying_strftime; #endif case 'R': /* GNU extension. */ subfmt = "%H:%M"; goto subformat; case 'r': /* POSIX.2 extension. */ #ifdef _NL_CURRENT if (*(subfmt = _NL_CURRENT (LC_TIME, T_FMT_AMPM)) == '\0') #endif subfmt = "%I:%M:%S %p"; goto subformat; case 'S': if (modifier == 'E') goto bad_format; DO_NUMBER (2, tp->tm_sec); case 's': /* GNU extension. */ { struct tm ltm; time_t t; ltm = *tp; t = mktime (<m); /* Generate string value for T using time_t arithmetic; this works even if sizeof (long) < sizeof (time_t). */ bufp = buf + sizeof (buf); negative_number = t < 0; do { int d = t % 10; t /= 10; if (negative_number) { d = -d; /* Adjust if division truncates to minus infinity. */ if (0 < -1 % 10 && d < 0) { t++; d += 10; } } *--bufp = d + '0'; } while (t != 0); digits = 1; goto do_number_sign_and_padding; } case 'X': if (modifier == 'O') goto bad_format; #ifdef _NL_CURRENT if (! (modifier == 'E' && *(subfmt = _NL_CURRENT (LC_TIME, ERA_T_FMT)) != '\0')) subfmt = _NL_CURRENT (LC_TIME, T_FMT); goto subformat; #else # if HAVE_STRFTIME goto underlying_strftime; # else /* Fall through. */ # endif #endif case 'T': /* POSIX.2 extension. */ subfmt = "%H:%M:%S"; goto subformat; case 't': /* POSIX.2 extension. */ add (1, *p = '\t'); break; case 'u': /* POSIX.2 extension. */ DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1); case 'U': if (modifier == 'E') goto bad_format; DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7); case 'V': case 'g': /* GNU extension. */ case 'G': /* GNU extension. */ if (modifier == 'E') goto bad_format; { int year = tp->tm_year + TM_YEAR_BASE; int days = iso_week_days (tp->tm_yday, tp->tm_wday); if (days < 0) { /* This ISO week belongs to the previous year. */ year--; days = iso_week_days (tp->tm_yday + (365 + __isleap (year)), tp->tm_wday); } else { int d = iso_week_days (tp->tm_yday - (365 + __isleap (year)), tp->tm_wday); if (0 <= d) { /* This ISO week belongs to the next year. */ year++; days = d; } } switch (*f) { case 'g': DO_NUMBER (2, (year % 100 + 100) % 100); case 'G': DO_NUMBER (1, year); default: DO_NUMBER (2, days / 7 + 1); } } case 'W': if (modifier == 'E') goto bad_format; DO_NUMBER (2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7); case 'w': if (modifier == 'E') goto bad_format; DO_NUMBER (1, tp->tm_wday); case 'Y': if (modifier == 'E') { #if HAVE_STRUCT_ERA_ENTRY struct era_entry *era = _nl_get_era_entry (tp); if (era) { subfmt = strchr (era->name_fmt, '\0') + 1; goto subformat; } #else # if HAVE_STRFTIME goto underlying_strftime; # endif #endif } if (modifier == 'O') goto bad_format; else DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); case 'y': if (modifier == 'E') { #if HAVE_STRUCT_ERA_ENTRY struct era_entry *era = _nl_get_era_entry (tp); if (era) { int delta = tp->tm_year - era->start_date[0]; DO_NUMBER (1, (era->offset + (era->direction == '-' ? -delta : delta))); } #else # if HAVE_STRFTIME goto underlying_strftime; # endif #endif } DO_NUMBER (2, (tp->tm_year % 100 + 100) % 100); case 'Z': if (change_case) { to_uppcase = 0; to_lowcase = 1; } #if HAVE_TZNAME /* The tzset() call might have changed the value. */ if (!(zone && *zone) && tp->tm_isdst >= 0) zone = tzname[tp->tm_isdst]; #endif if (! zone) zone = ""; /* POSIX.2 requires the empty string here. */ cpy (strlen (zone), zone); break; case 'z': /* GNU extension. */ if (tp->tm_isdst < 0) break; { int diff; #if HAVE_TM_GMTOFF diff = tp->tm_gmtoff; #else if (ut) diff = 0; else { struct tm gtm; struct tm ltm; time_t lt; ltm = *tp; lt = mktime (<m); if (lt == (time_t) -1) { /* mktime returns -1 for errors, but -1 is also a valid time_t value. Check whether an error really occurred. */ struct tm tm; if (! my_strftime_localtime_r (<, &tm) || ((ltm.tm_sec ^ tm.tm_sec) | (ltm.tm_min ^ tm.tm_min) | (ltm.tm_hour ^ tm.tm_hour) | (ltm.tm_mday ^ tm.tm_mday) | (ltm.tm_mon ^ tm.tm_mon) | (ltm.tm_year ^ tm.tm_year))) break; } if (! my_strftime_gmtime_r (<, >m)) break; diff = tm_diff (<m, >m); } #endif if (diff < 0) { add (1, *p = '-'); diff = -diff; } else add (1, *p = '+'); diff /= 60; DO_NUMBER (4, (diff / 60) * 100 + diff % 60); } case '\0': /* GNU extension: % at end of format. */ --f; /* Fall through. */ default: /* Unknown format; output the format, including the '%', since this is most likely the right thing to do if a multibyte string has been misparsed. */ bad_format: { int flen; for (flen = 1; f[1 - flen] != '%'; flen++) continue; cpy (flen, &f[1 - flen]); } break; } } if (p && maxsize != 0) *p = '\0'; return i; } #ifdef emacs /* For Emacs we have a separate interface which corresponds to the normal strftime function and does not have the extra information whether the TP arguments comes from a `gmtime' call or not. */ size_t emacs_strftime (s, maxsize, format, tp) char *s; size_t maxsize; const char *format; const struct tm *tp; { return my_strftime (s, maxsize, format, tp, 0); } #endif cadaver-0.23.3/lib/rpmatch.c0000664000076400007640000000454010132320456015175 0ustar jortonjorton/* Determine whether string value is affirmation or negative response according to current locale's data. Copyright (C) 1996, 1998 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if HAVE_CONFIG_H # include #endif #if STDC_HEADERS || _LIBC # include # include #else # ifndef NULL # define NULL 0 # endif #endif #ifdef ENABLE_NLS # include # include # include # define _(Text) gettext (Text) static int try (const char *response, const char *pattern, const int match, const int nomatch, const char **lastp, regex_t *re) { if (pattern != *lastp) { /* The pattern has changed. */ if (*lastp) { /* Free the old compiled pattern. */ regfree (re); *lastp = NULL; } /* Compile the pattern and cache it for future runs. */ if (regcomp (re, pattern, REG_EXTENDED) != 0) return -1; *lastp = pattern; } /* See if the regular expression matches RESPONSE. */ return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch; } #endif int rpmatch (const char *response) { #ifdef ENABLE_NLS /* Match against one of the response patterns, compiling the pattern first if necessary. */ /* We cache the response patterns and compiled regexps here. */ static const char *yesexpr, *noexpr; static regex_t yesre, nore; int result; return ((result = try (response, _("^[yY]"), 1, 0, &yesexpr, &yesre)) ? result : try (response, _("^[nN]"), 0, -1, &noexpr, &nore)); #else /* Test against "^[yY]" and "^[nN]", hardcoded to avoid requiring regex */ return (*response == 'y' || *response == 'Y' ? 1 : *response == 'n' || *response == 'N' ? 0 : -1); #endif } cadaver-0.23.3/lib/yesno.c0000664000076400007640000000307010545034154014676 0ustar jortonjorton/* yesno.c -- read a yes/no response from stdin Copyright (C) 1990, 1998 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if HAVE_CONFIG_H # include #endif #include #if HAVE_STDLIB_H # include #endif #include #include "common.h" /* Read one line from standard input and return nonzero if that line begins with y or Y, otherwise return 0. */ int rpmatch (); int yesno () { /* We make some assumptions here: a) leading white space in the response are not vital b) the first 128 characters of the answer are enough (the rest can be ignored) I cannot think for a situation where this is not ok. --drepper@gnu */ char buf[128]; int len = 0; int c; while ((c = getchar ()) != EOF && c != '\n') if ((len > 0 && len < 127) || (len == 0 && !isspace (c))) buf[len++] = c; buf[len] = '\0'; return rpmatch (buf) == 1; } cadaver-0.23.3/lib/getpass.h0000664000076400007640000000020110132320456015200 0ustar jortonjorton #ifndef GETPASS_H #define GETPASS_H char *fm_getpassword(const char *prompt); #define PASSWORDLEN 256 #endif /* GETPASS_H */ cadaver-0.23.3/lib/dirname.h0000664000076400007640000000201710132320456015160 0ustar jortonjorton/* Copyright (C) 1998 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 # ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args # else # define PARAMS(Args) () # endif # endif char * dir_name PARAMS ((const char *path)); #endif /* not DIRNAME_H_ */ cadaver-0.23.3/lib/expat/0000775000076400007640000000000011312007507014511 5ustar jortonjortoncadaver-0.23.3/lib/expat/expat.html0000664000076400007640000000631710132700136016524 0ustar jortonjorton expat

expat - XML Parser Toolkit

Version 19990709

Copyright (c) 1998, 1999 James Clark. Expat is subject to the Mozilla Public License Version 1.1. Alternatively you may use expat under the GNU General Public License instead. Please contact me if you wish to negotiate an alternative license. This version elects to use the GPL

This is a test version of expat which adds support for parsing external DTDs and parameter entities. Compiling with -DXML_DTD enables this support. There's a new -p option for xmlwf which will cause it to process external DTDs and parameter entities; this implies the -x option. See the comment above XML_SetParamEntityParsing in xmlparse.h for the API addition that enables this.

Expat is an XML 1.0 parser written in C. It aims to be fully conforming. It is currently not a validating XML processor. The current production version of expat can be downloaded from ftp://ftp.jclark.com/pub/xml/expat.zip.

The directory xmltok contains a low-level library for tokenizing XML. The interface is documented in xmltok/xmltok.h.

The directory xmlparse contains an XML parser library which is built on top of the xmltok library. The interface is documented in xmlparse/xmlparse.h. The directory sample contains a simple example program using this interface; sample/build.bat is a batch file to build the example using Visual C++.

The directory xmlwf contains the xmlwf application, which uses the xmlparse library. The arguments to xmlwf are one or more files which are each to be checked for well-formedness. An option -d dir can be specified; for each well-formed input file the corresponding canonical XML will be written to dir/f, where f is the filename (without any path) of the input file. A -x option will cause references to external general entities to be processed. A -s option will make documents that are not standalone cause an error (a document is considered standalone if either it is intrinsically standalone because it has no external subset and no references to parameter entities in the internal subset or it is declared as standalone in the XML declaration).

The bin directory contains Win32 executables. The lib directory contains Win32 import libraries.

Answers to some frequently asked questions about expat can be found in the expat FAQ.

James Clark
cadaver-0.23.3/lib/expat/README0000664000076400007640000000032210132700136015363 0ustar jortonjorton This is a MODIFIED version of the expat package. For the unabridged source, see: http://www.jclark.com/xml/expat.html See the ChangeLog for details of all changes made. Joe Orton cadaver-0.23.3/lib/expat/xmlparse/0000775000076400007640000000000011312007507016344 5ustar jortonjortoncadaver-0.23.3/lib/expat/xmlparse/xmlparse.c0000664000076400007640000030474410132320456020357 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "xmldef.h" #include "xmlparse.h" #ifdef XML_UNICODE #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX #define XmlConvert XmlUtf16Convert #define XmlGetInternalEncoding XmlGetUtf16InternalEncoding #define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS #define XmlEncode XmlUtf16Encode #define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) typedef unsigned short ICHAR; #else #define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX #define XmlConvert XmlUtf8Convert #define XmlGetInternalEncoding XmlGetUtf8InternalEncoding #define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS #define XmlEncode XmlUtf8Encode #define MUST_CONVERT(enc, s) (!(enc)->isUtf8) typedef char ICHAR; #endif #ifndef XML_NS #define XmlInitEncodingNS XmlInitEncoding #define XmlInitUnknownEncodingNS XmlInitUnknownEncoding #undef XmlGetInternalEncodingNS #define XmlGetInternalEncodingNS XmlGetInternalEncoding #define XmlParseXmlDeclNS XmlParseXmlDecl #endif #ifdef XML_UNICODE_WCHAR_T #define XML_T(x) L ## x #else #define XML_T(x) x #endif /* Round up n to be a multiple of sz, where sz is a power of 2. */ #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) #include "xmltok.h" #include "xmlrole.h" #include "hashtable.h" #define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ #define INIT_DATA_BUF_SIZE 1024 #define INIT_ATTS_SIZE 16 #define INIT_BLOCK_SIZE 1024 #define INIT_BUFFER_SIZE 1024 #define EXPAND_SPARE 24 typedef struct binding { struct prefix *prefix; struct binding *nextTagBinding; struct binding *prevPrefixBinding; const struct attribute_id *attId; XML_Char *uri; int uriLen; int uriAlloc; } BINDING; typedef struct prefix { const XML_Char *name; BINDING *binding; } PREFIX; typedef struct { const XML_Char *str; const XML_Char *localPart; int uriLen; } TAG_NAME; typedef struct tag { struct tag *parent; const char *rawName; int rawNameLength; TAG_NAME name; char *buf; char *bufEnd; BINDING *bindings; } TAG; typedef struct { const XML_Char *name; const XML_Char *textPtr; int textLen; const XML_Char *systemId; const XML_Char *base; const XML_Char *publicId; const XML_Char *notation; char open; } ENTITY; typedef struct block { struct block *next; int size; XML_Char s[1]; } BLOCK; typedef struct { BLOCK *blocks; BLOCK *freeBlocks; const XML_Char *end; XML_Char *ptr; XML_Char *start; } STRING_POOL; /* The XML_Char before the name is used to determine whether an attribute has been specified. */ typedef struct attribute_id { XML_Char *name; PREFIX *prefix; char maybeTokenized; char xmlns; } ATTRIBUTE_ID; typedef struct { const ATTRIBUTE_ID *id; char isCdata; const XML_Char *value; } DEFAULT_ATTRIBUTE; typedef struct { const XML_Char *name; PREFIX *prefix; int nDefaultAtts; int allocDefaultAtts; DEFAULT_ATTRIBUTE *defaultAtts; } ELEMENT_TYPE; typedef struct { HASH_TABLE generalEntities; HASH_TABLE elementTypes; HASH_TABLE attributeIds; HASH_TABLE prefixes; STRING_POOL pool; int complete; int standalone; #ifdef XML_DTD HASH_TABLE paramEntities; #endif /* XML_DTD */ PREFIX defaultPrefix; } DTD; typedef struct open_internal_entity { const char *internalEventPtr; const char *internalEventEndPtr; struct open_internal_entity *next; ENTITY *entity; } OPEN_INTERNAL_ENTITY; typedef enum XML_Error Processor(XML_Parser parser, const char *start, const char *end, const char **endPtr); static Processor prologProcessor; static Processor prologInitProcessor; static Processor contentProcessor; static Processor cdataSectionProcessor; #ifdef XML_DTD static Processor ignoreSectionProcessor; #endif /* XML_DTD */ static Processor epilogProcessor; static Processor errorProcessor; static Processor externalEntityInitProcessor; static Processor externalEntityInitProcessor2; static Processor externalEntityInitProcessor3; static Processor externalEntityContentProcessor; static enum XML_Error handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); static enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *, const char *); static enum XML_Error initializeEncoding(XML_Parser parser); static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, int tok, const char *next, const char **nextPtr); static enum XML_Error processInternalParamEntity(XML_Parser parser, ENTITY *entity); static enum XML_Error doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, const char *start, const char *end, const char **endPtr); static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr); #ifdef XML_DTD static enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr); #endif /* XML_DTD */ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr); static int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr); static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, int isCdata, const XML_Char *dfltValue); static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *, STRING_POOL *); static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *, STRING_POOL *); static ATTRIBUTE_ID * getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static int reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static void reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static const XML_Char *getContext(XML_Parser parser); static int setContext(XML_Parser parser, const XML_Char *context); static void normalizePublicId(XML_Char *s); static int dtdInit(DTD *); static void dtdDestroy(DTD *); static int dtdCopy(DTD *newDtd, const DTD *oldDtd); static int copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *); #ifdef XML_DTD static void dtdSwap(DTD *, DTD *); #endif /* XML_DTD */ static void poolInit(STRING_POOL *); static void poolClear(STRING_POOL *); static void poolDestroy(STRING_POOL *); static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end); static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end); static int poolGrow(STRING_POOL *pool); static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s); static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); #define poolStart(pool) ((pool)->start) #define poolEnd(pool) ((pool)->ptr) #define poolLength(pool) ((pool)->ptr - (pool)->start) #define poolChop(pool) ((void)--(pool->ptr)) #define poolLastChar(pool) (((pool)->ptr)[-1]) #define poolDiscard(pool) ((pool)->ptr = (pool)->start) #define poolFinish(pool) ((pool)->start = (pool)->ptr) #define poolAppendChar(pool, c) \ (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ ? 0 \ : ((*((pool)->ptr)++ = c), 1)) typedef struct { /* The first member must be userData so that the XML_GetUserData macro works. */ void *m_userData; void *m_handlerArg; char *m_buffer; /* first character to be parsed */ const char *m_bufferPtr; /* past last character to be parsed */ char *m_bufferEnd; /* allocated end of buffer */ const char *m_bufferLim; long m_parseEndByteIndex; const char *m_parseEndPtr; XML_Char *m_dataBuf; XML_Char *m_dataBufEnd; XML_XmlDeclHandler m_xmlDeclHandler; XML_StartElementHandler m_startElementHandler; XML_EndElementHandler m_endElementHandler; XML_CharacterDataHandler m_characterDataHandler; XML_ProcessingInstructionHandler m_processingInstructionHandler; XML_CommentHandler m_commentHandler; XML_StartCdataSectionHandler m_startCdataSectionHandler; XML_EndCdataSectionHandler m_endCdataSectionHandler; XML_DefaultHandler m_defaultHandler; XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; XML_NotationDeclHandler m_notationDeclHandler; XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; XML_NotStandaloneHandler m_notStandaloneHandler; XML_ExternalEntityRefHandler m_externalEntityRefHandler; void *m_externalEntityRefHandlerArg; XML_UnknownEncodingHandler m_unknownEncodingHandler; const ENCODING *m_encoding; INIT_ENCODING m_initEncoding; const ENCODING *m_internalEncoding; const XML_Char *m_protocolEncodingName; int m_ns; void *m_unknownEncodingMem; void *m_unknownEncodingData; void *m_unknownEncodingHandlerData; void (*m_unknownEncodingRelease)(void *); PROLOG_STATE m_prologState; Processor *m_processor; enum XML_Error m_errorCode; const char *m_eventPtr; const char *m_eventEndPtr; const char *m_positionPtr; OPEN_INTERNAL_ENTITY *m_openInternalEntities; int m_defaultExpandInternalEntities; int m_tagLevel; ENTITY *m_declEntity; const XML_Char *m_declNotationName; const XML_Char *m_declNotationPublicId; ELEMENT_TYPE *m_declElementType; ATTRIBUTE_ID *m_declAttributeId; char m_declAttributeIsCdata; DTD m_dtd; const XML_Char *m_curBase; TAG *m_tagStack; TAG *m_freeTagList; BINDING *m_inheritedBindings; BINDING *m_freeBindingList; int m_attsSize; int m_nSpecifiedAtts; ATTRIBUTE *m_atts; POSITION m_position; STRING_POOL m_tempPool; STRING_POOL m_temp2Pool; char *m_groupConnector; unsigned m_groupSize; int m_hadExternalDoctype; XML_Char m_namespaceSeparator; #ifdef XML_DTD enum XML_ParamEntityParsing m_paramEntityParsing; XML_Parser m_parentParser; #endif } Parser; #define userData (((Parser *)parser)->m_userData) #define handlerArg (((Parser *)parser)->m_handlerArg) #define xmlDeclHandler (((Parser *)parser)->m_xmlDeclHandler) #define startElementHandler (((Parser *)parser)->m_startElementHandler) #define endElementHandler (((Parser *)parser)->m_endElementHandler) #define characterDataHandler (((Parser *)parser)->m_characterDataHandler) #define processingInstructionHandler (((Parser *)parser)->m_processingInstructionHandler) #define commentHandler (((Parser *)parser)->m_commentHandler) #define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler) #define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler) #define defaultHandler (((Parser *)parser)->m_defaultHandler) #define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler) #define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler) #define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler) #define endNamespaceDeclHandler (((Parser *)parser)->m_endNamespaceDeclHandler) #define notStandaloneHandler (((Parser *)parser)->m_notStandaloneHandler) #define externalEntityRefHandler (((Parser *)parser)->m_externalEntityRefHandler) #define externalEntityRefHandlerArg (((Parser *)parser)->m_externalEntityRefHandlerArg) #define unknownEncodingHandler (((Parser *)parser)->m_unknownEncodingHandler) #define encoding (((Parser *)parser)->m_encoding) #define initEncoding (((Parser *)parser)->m_initEncoding) #define internalEncoding (((Parser *)parser)->m_internalEncoding) #define unknownEncodingMem (((Parser *)parser)->m_unknownEncodingMem) #define unknownEncodingData (((Parser *)parser)->m_unknownEncodingData) #define unknownEncodingHandlerData \ (((Parser *)parser)->m_unknownEncodingHandlerData) #define unknownEncodingRelease (((Parser *)parser)->m_unknownEncodingRelease) #define protocolEncodingName (((Parser *)parser)->m_protocolEncodingName) #define ns (((Parser *)parser)->m_ns) #define prologState (((Parser *)parser)->m_prologState) #define processor (((Parser *)parser)->m_processor) #define errorCode (((Parser *)parser)->m_errorCode) #define eventPtr (((Parser *)parser)->m_eventPtr) #define eventEndPtr (((Parser *)parser)->m_eventEndPtr) #define positionPtr (((Parser *)parser)->m_positionPtr) #define position (((Parser *)parser)->m_position) #define openInternalEntities (((Parser *)parser)->m_openInternalEntities) #define defaultExpandInternalEntities (((Parser *)parser)->m_defaultExpandInternalEntities) #define tagLevel (((Parser *)parser)->m_tagLevel) #define buffer (((Parser *)parser)->m_buffer) #define bufferPtr (((Parser *)parser)->m_bufferPtr) #define bufferEnd (((Parser *)parser)->m_bufferEnd) #define parseEndByteIndex (((Parser *)parser)->m_parseEndByteIndex) #define parseEndPtr (((Parser *)parser)->m_parseEndPtr) #define bufferLim (((Parser *)parser)->m_bufferLim) #define dataBuf (((Parser *)parser)->m_dataBuf) #define dataBufEnd (((Parser *)parser)->m_dataBufEnd) #define dtd (((Parser *)parser)->m_dtd) #define curBase (((Parser *)parser)->m_curBase) #define declEntity (((Parser *)parser)->m_declEntity) #define declNotationName (((Parser *)parser)->m_declNotationName) #define declNotationPublicId (((Parser *)parser)->m_declNotationPublicId) #define declElementType (((Parser *)parser)->m_declElementType) #define declAttributeId (((Parser *)parser)->m_declAttributeId) #define declAttributeIsCdata (((Parser *)parser)->m_declAttributeIsCdata) #define freeTagList (((Parser *)parser)->m_freeTagList) #define freeBindingList (((Parser *)parser)->m_freeBindingList) #define inheritedBindings (((Parser *)parser)->m_inheritedBindings) #define tagStack (((Parser *)parser)->m_tagStack) #define atts (((Parser *)parser)->m_atts) #define attsSize (((Parser *)parser)->m_attsSize) #define nSpecifiedAtts (((Parser *)parser)->m_nSpecifiedAtts) #define tempPool (((Parser *)parser)->m_tempPool) #define temp2Pool (((Parser *)parser)->m_temp2Pool) #define groupConnector (((Parser *)parser)->m_groupConnector) #define groupSize (((Parser *)parser)->m_groupSize) #define hadExternalDoctype (((Parser *)parser)->m_hadExternalDoctype) #define namespaceSeparator (((Parser *)parser)->m_namespaceSeparator) #ifdef XML_DTD #define parentParser (((Parser *)parser)->m_parentParser) #define paramEntityParsing (((Parser *)parser)->m_paramEntityParsing) #endif /* XML_DTD */ #ifdef _MSC_VER #ifdef _DEBUG Parser *asParser(XML_Parser parser) { return parser; } #endif #endif XML_Parser XML_ParserCreate(const XML_Char *encodingName) { XML_Parser parser = malloc(sizeof(Parser)); if (!parser) return parser; processor = prologInitProcessor; XmlPrologStateInit(&prologState); userData = 0; handlerArg = 0; startElementHandler = 0; endElementHandler = 0; characterDataHandler = 0; processingInstructionHandler = 0; commentHandler = 0; startCdataSectionHandler = 0; endCdataSectionHandler = 0; defaultHandler = 0; unparsedEntityDeclHandler = 0; notationDeclHandler = 0; startNamespaceDeclHandler = 0; endNamespaceDeclHandler = 0; notStandaloneHandler = 0; externalEntityRefHandler = 0; externalEntityRefHandlerArg = parser; unknownEncodingHandler = 0; buffer = 0; bufferPtr = 0; bufferEnd = 0; parseEndByteIndex = 0; parseEndPtr = 0; bufferLim = 0; declElementType = 0; declAttributeId = 0; declEntity = 0; declNotationName = 0; declNotationPublicId = 0; memset(&position, 0, sizeof(POSITION)); errorCode = XML_ERROR_NONE; eventPtr = 0; eventEndPtr = 0; positionPtr = 0; openInternalEntities = 0; tagLevel = 0; tagStack = 0; freeTagList = 0; freeBindingList = 0; inheritedBindings = 0; attsSize = INIT_ATTS_SIZE; atts = malloc(attsSize * sizeof(ATTRIBUTE)); nSpecifiedAtts = 0; dataBuf = malloc(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); groupSize = 0; groupConnector = 0; hadExternalDoctype = 0; unknownEncodingMem = 0; unknownEncodingRelease = 0; unknownEncodingData = 0; unknownEncodingHandlerData = 0; namespaceSeparator = '!'; #ifdef XML_DTD parentParser = 0; #endif ns = 0; poolInit(&tempPool); poolInit(&temp2Pool); protocolEncodingName = encodingName ? poolCopyString(&tempPool, encodingName) : 0; curBase = 0; if (!dtdInit(&dtd) || !atts || !dataBuf || (encodingName && !protocolEncodingName)) { XML_ParserFree(parser); return 0; } dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; XmlInitEncoding(&initEncoding, &encoding, 0); internalEncoding = XmlGetInternalEncoding(); return parser; } XML_Parser XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) { static const XML_Char implicitContext[] = { XML_T('x'), XML_T('m'), XML_T('l'), XML_T('='), XML_T('h'), XML_T('t'), XML_T('t'), XML_T('p'), XML_T(':'), XML_T('/'), XML_T('/'), XML_T('w'), XML_T('w'), XML_T('w'), XML_T('.'), XML_T('w'), XML_T('3'), XML_T('.'), XML_T('o'), XML_T('r'), XML_T('g'), XML_T('/'), XML_T('X'), XML_T('M'), XML_T('L'), XML_T('/'), XML_T('1'), XML_T('9'), XML_T('9'), XML_T('8'), XML_T('/'), XML_T('n'), XML_T('a'), XML_T('m'), XML_T('e'), XML_T('s'), XML_T('p'), XML_T('a'), XML_T('c'), XML_T('e'), XML_T('\0') }; XML_Parser parser = XML_ParserCreate(encodingName); if (parser) { XmlInitEncodingNS(&initEncoding, &encoding, 0); ns = 1; internalEncoding = XmlGetInternalEncodingNS(); namespaceSeparator = nsSep; } if (!setContext(parser, implicitContext)) { XML_ParserFree(parser); return 0; } return parser; } int XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) { if (!encodingName) protocolEncodingName = 0; else { protocolEncodingName = poolCopyString(&tempPool, encodingName); if (!protocolEncodingName) return 0; } return 1; } XML_Parser XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context, const XML_Char *encodingName) { XML_Parser parser = oldParser; DTD *oldDtd = &dtd; XML_StartElementHandler oldStartElementHandler = startElementHandler; XML_EndElementHandler oldEndElementHandler = endElementHandler; XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler; XML_CommentHandler oldCommentHandler = commentHandler; XML_StartCdataSectionHandler oldStartCdataSectionHandler = startCdataSectionHandler; XML_EndCdataSectionHandler oldEndCdataSectionHandler = endCdataSectionHandler; XML_DefaultHandler oldDefaultHandler = defaultHandler; XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler = startNamespaceDeclHandler; XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler = endNamespaceDeclHandler; XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler; XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler; void *oldUserData = userData; void *oldHandlerArg = handlerArg; int oldDefaultExpandInternalEntities = defaultExpandInternalEntities; void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; #ifdef XML_DTD int oldParamEntityParsing = paramEntityParsing; #endif parser = (ns ? XML_ParserCreateNS(encodingName, namespaceSeparator) : XML_ParserCreate(encodingName)); if (!parser) return 0; startElementHandler = oldStartElementHandler; endElementHandler = oldEndElementHandler; characterDataHandler = oldCharacterDataHandler; processingInstructionHandler = oldProcessingInstructionHandler; commentHandler = oldCommentHandler; startCdataSectionHandler = oldStartCdataSectionHandler; endCdataSectionHandler = oldEndCdataSectionHandler; defaultHandler = oldDefaultHandler; startNamespaceDeclHandler = oldStartNamespaceDeclHandler; endNamespaceDeclHandler = oldEndNamespaceDeclHandler; notStandaloneHandler = oldNotStandaloneHandler; externalEntityRefHandler = oldExternalEntityRefHandler; unknownEncodingHandler = oldUnknownEncodingHandler; userData = oldUserData; if (oldUserData == oldHandlerArg) handlerArg = userData; else handlerArg = parser; if (oldExternalEntityRefHandlerArg != oldParser) externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; defaultExpandInternalEntities = oldDefaultExpandInternalEntities; #ifdef XML_DTD paramEntityParsing = oldParamEntityParsing; if (context) { #endif /* XML_DTD */ if (!dtdCopy(&dtd, oldDtd) || !setContext(parser, context)) { XML_ParserFree(parser); return 0; } processor = externalEntityInitProcessor; #ifdef XML_DTD } else { dtdSwap(&dtd, oldDtd); parentParser = oldParser; XmlPrologStateInitExternalEntity(&prologState); dtd.complete = 1; hadExternalDoctype = 1; } #endif /* XML_DTD */ return parser; } static void destroyBindings(BINDING *bindings) { for (;;) { BINDING *b = bindings; if (!b) break; bindings = b->nextTagBinding; free(b->uri); free(b); } } void XML_ParserFree(XML_Parser parser) { for (;;) { TAG *p; if (tagStack == 0) { if (freeTagList == 0) break; tagStack = freeTagList; freeTagList = 0; } p = tagStack; tagStack = tagStack->parent; free(p->buf); destroyBindings(p->bindings); free(p); } destroyBindings(freeBindingList); destroyBindings(inheritedBindings); poolDestroy(&tempPool); poolDestroy(&temp2Pool); #ifdef XML_DTD if (parentParser) { if (hadExternalDoctype) dtd.complete = 0; dtdSwap(&dtd, &((Parser *)parentParser)->m_dtd); } #endif /* XML_DTD */ dtdDestroy(&dtd); free((void *)atts); free(groupConnector); free(buffer); free(dataBuf); free(unknownEncodingMem); if (unknownEncodingRelease) unknownEncodingRelease(unknownEncodingData); free(parser); } void XML_UseParserAsHandlerArg(XML_Parser parser) { handlerArg = parser; } void XML_SetUserData(XML_Parser parser, void *p) { if (handlerArg == userData) handlerArg = userData = p; else userData = p; } int XML_SetBase(XML_Parser parser, const XML_Char *p) { if (p) { p = poolCopyString(&dtd.pool, p); if (!p) return 0; curBase = p; } else curBase = 0; return 1; } const XML_Char *XML_GetBase(XML_Parser parser) { return curBase; } int XML_GetSpecifiedAttributeCount(XML_Parser parser) { return nSpecifiedAtts; } void XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) { startElementHandler = start; endElementHandler = end; } void XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler) { characterDataHandler = handler; } void XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler) { xmlDeclHandler = handler; } void XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler) { processingInstructionHandler = handler; } void XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) { commentHandler = handler; } void XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) { startCdataSectionHandler = start; endCdataSectionHandler = end; } void XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler) { defaultHandler = handler; defaultExpandInternalEntities = 0; } void XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) { defaultHandler = handler; defaultExpandInternalEntities = 1; } void XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler) { unparsedEntityDeclHandler = handler; } void XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler) { notationDeclHandler = handler; } void XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) { startNamespaceDeclHandler = start; endNamespaceDeclHandler = end; } void XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler) { notStandaloneHandler = handler; } void XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler) { externalEntityRefHandler = handler; } void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) { if (arg) externalEntityRefHandlerArg = arg; else externalEntityRefHandlerArg = parser; } void XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *data) { unknownEncodingHandler = handler; unknownEncodingHandlerData = data; } int XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing parsing) { #ifdef XML_DTD paramEntityParsing = parsing; return 1; #else return parsing == XML_PARAM_ENTITY_PARSING_NEVER; #endif } int XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { if (len == 0) { if (!isFinal) return 1; positionPtr = bufferPtr; errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0); if (errorCode == XML_ERROR_NONE) return 1; eventEndPtr = eventPtr; processor = errorProcessor; return 0; } else if (bufferPtr == bufferEnd) { const char *end; int nLeftOver; parseEndByteIndex += len; positionPtr = s; if (isFinal) { errorCode = processor(parser, s, parseEndPtr = s + len, 0); if (errorCode == XML_ERROR_NONE) return 1; eventEndPtr = eventPtr; processor = errorProcessor; return 0; } errorCode = processor(parser, s, parseEndPtr = s + len, &end); if (errorCode != XML_ERROR_NONE) { eventEndPtr = eventPtr; processor = errorProcessor; return 0; } XmlUpdatePosition(encoding, positionPtr, end, &position); nLeftOver = s + len - end; if (nLeftOver) { if (buffer == 0 || nLeftOver > bufferLim - buffer) { /* FIXME avoid integer overflow */ buffer = buffer == 0 ? malloc(len * 2) : realloc(buffer, len * 2); /* FIXME storage leak if realloc fails */ if (!buffer) { errorCode = XML_ERROR_NO_MEMORY; eventPtr = eventEndPtr = 0; processor = errorProcessor; return 0; } bufferLim = buffer + len * 2; } memcpy(buffer, end, nLeftOver); bufferPtr = buffer; bufferEnd = buffer + nLeftOver; } return 1; } else { memcpy(XML_GetBuffer(parser, len), s, len); return XML_ParseBuffer(parser, len, isFinal); } } int XML_ParseBuffer(XML_Parser parser, int len, int isFinal) { const char *start = bufferPtr; positionPtr = start; bufferEnd += len; parseEndByteIndex += len; errorCode = processor(parser, start, parseEndPtr = bufferEnd, isFinal ? (const char **)0 : &bufferPtr); if (errorCode == XML_ERROR_NONE) { if (!isFinal) XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); return 1; } else { eventEndPtr = eventPtr; processor = errorProcessor; return 0; } } void *XML_GetBuffer(XML_Parser parser, int len) { if (len > bufferLim - bufferEnd) { /* FIXME avoid integer overflow */ int neededSize = len + (bufferEnd - bufferPtr); if (neededSize <= bufferLim - buffer) { memmove(buffer, bufferPtr, bufferEnd - bufferPtr); bufferEnd = buffer + (bufferEnd - bufferPtr); bufferPtr = buffer; } else { char *newBuf; int bufferSize = bufferLim - bufferPtr; if (bufferSize == 0) bufferSize = INIT_BUFFER_SIZE; do { bufferSize *= 2; } while (bufferSize < neededSize); newBuf = malloc(bufferSize); if (newBuf == 0) { errorCode = XML_ERROR_NO_MEMORY; return 0; } bufferLim = newBuf + bufferSize; if (bufferPtr) { memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); free(buffer); } bufferEnd = newBuf + (bufferEnd - bufferPtr); bufferPtr = buffer = newBuf; } } return bufferEnd; } enum XML_Error XML_GetErrorCode(XML_Parser parser) { return errorCode; } long XML_GetCurrentByteIndex(XML_Parser parser) { if (eventPtr) return parseEndByteIndex - (parseEndPtr - eventPtr); return -1; } int XML_GetCurrentByteCount(XML_Parser parser) { if (eventEndPtr && eventPtr) return eventEndPtr - eventPtr; return 0; } int XML_GetCurrentLineNumber(XML_Parser parser) { if (eventPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; } return position.lineNumber + 1; } int XML_GetCurrentColumnNumber(XML_Parser parser) { if (eventPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; } return position.columnNumber; } void XML_DefaultCurrent(XML_Parser parser) { if (defaultHandler) { if (openInternalEntities) reportDefault(parser, internalEncoding, openInternalEntities->internalEventPtr, openInternalEntities->internalEventEndPtr); else reportDefault(parser, encoding, eventPtr, eventEndPtr); } } const XML_LChar *XML_ErrorString(int code) { static const XML_LChar *message[] = { 0, XML_T("out of memory"), XML_T("syntax error"), XML_T("no element found"), XML_T("not well-formed"), XML_T("unclosed token"), XML_T("unclosed token"), XML_T("mismatched tag"), XML_T("duplicate attribute"), XML_T("junk after document element"), XML_T("illegal parameter entity reference"), XML_T("undefined entity"), XML_T("recursive entity reference"), XML_T("asynchronous entity"), XML_T("reference to invalid character number"), XML_T("reference to binary entity"), XML_T("reference to external entity in attribute"), XML_T("xml processing instruction not at start of external entity"), XML_T("unknown encoding"), XML_T("encoding specified in XML declaration is incorrect"), XML_T("unclosed CDATA section"), XML_T("error in processing external entity reference"), XML_T("document is not standalone") }; if (code > 0 && code < sizeof(message)/sizeof(message[0])) return message[code]; return 0; } static enum XML_Error contentProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { return doContent(parser, 0, encoding, start, end, endPtr); } static enum XML_Error externalEntityInitProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; processor = externalEntityInitProcessor2; return externalEntityInitProcessor2(parser, start, end, endPtr); } static enum XML_Error externalEntityInitProcessor2(XML_Parser parser, const char *start, const char *end, const char **endPtr) { const char *next; int tok = XmlContentTok(encoding, start, end, &next); switch (tok) { case XML_TOK_BOM: start = next; break; case XML_TOK_PARTIAL: if (endPtr) { *endPtr = start; return XML_ERROR_NONE; } eventPtr = start; return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (endPtr) { *endPtr = start; return XML_ERROR_NONE; } eventPtr = start; return XML_ERROR_PARTIAL_CHAR; } processor = externalEntityInitProcessor3; return externalEntityInitProcessor3(parser, start, end, endPtr); } static enum XML_Error externalEntityInitProcessor3(XML_Parser parser, const char *start, const char *end, const char **endPtr) { const char *next; int tok = XmlContentTok(encoding, start, end, &next); switch (tok) { case XML_TOK_XML_DECL: { enum XML_Error result = processXmlDecl(parser, 1, start, next); if (result != XML_ERROR_NONE) return result; start = next; } break; case XML_TOK_PARTIAL: if (endPtr) { *endPtr = start; return XML_ERROR_NONE; } eventPtr = start; return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (endPtr) { *endPtr = start; return XML_ERROR_NONE; } eventPtr = start; return XML_ERROR_PARTIAL_CHAR; } processor = externalEntityContentProcessor; tagLevel = 1; return doContent(parser, 1, encoding, start, end, endPtr); } static enum XML_Error externalEntityContentProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { return doContent(parser, 1, encoding, start, end, endPtr); } static enum XML_Error doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, const char *s, const char *end, const char **nextPtr) { const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } *eventPP = s; for (;;) { const char *next = s; /* XmlContentTok doesn't always set the last arg */ int tok = XmlContentTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { case XML_TOK_TRAILING_CR: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } *eventEndPP = end; if (characterDataHandler) { XML_Char c = 0xA; characterDataHandler(handlerArg, &c, 1); } else if (defaultHandler) reportDefault(parser, enc, s, end); if (startTagLevel == 0) return XML_ERROR_NO_ELEMENTS; if (tagLevel != startTagLevel) return XML_ERROR_ASYNC_ENTITY; return XML_ERROR_NONE; case XML_TOK_NONE: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } if (startTagLevel > 0) { if (tagLevel != startTagLevel) return XML_ERROR_ASYNC_ENTITY; return XML_ERROR_NONE; } return XML_ERROR_NO_ELEMENTS; case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; case XML_TOK_ENTITY_REF: { const XML_Char *name; ENTITY *entity; XML_Char ch = XmlPredefinedEntityName(enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (ch) { if (characterDataHandler) characterDataHandler(handlerArg, &ch, 1); else if (defaultHandler) reportDefault(parser, enc, s, next); break; } name = poolStoreString(&dtd.pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); poolDiscard(&dtd.pool); if (!entity) { if (dtd.complete || dtd.standalone) return XML_ERROR_UNDEFINED_ENTITY; if (defaultHandler) reportDefault(parser, enc, s, next); break; } if (entity->open) return XML_ERROR_RECURSIVE_ENTITY_REF; if (entity->notation) return XML_ERROR_BINARY_ENTITY_REF; if (entity) { if (entity->textPtr) { enum XML_Error result; OPEN_INTERNAL_ENTITY openEntity; if (defaultHandler && !defaultExpandInternalEntities) { reportDefault(parser, enc, s, next); break; } entity->open = 1; openEntity.next = openInternalEntities; openInternalEntities = &openEntity; openEntity.entity = entity; openEntity.internalEventPtr = 0; openEntity.internalEventEndPtr = 0; result = doContent(parser, tagLevel, internalEncoding, (char *)entity->textPtr, (char *)(entity->textPtr + entity->textLen), 0); entity->open = 0; openInternalEntities = openEntity.next; if (result) return result; } else if (externalEntityRefHandler) { const XML_Char *context; entity->open = 1; context = getContext(parser); entity->open = 0; if (!context) return XML_ERROR_NO_MEMORY; if (!externalEntityRefHandler(externalEntityRefHandlerArg, context, entity->base, entity->systemId, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; poolDiscard(&tempPool); } else if (defaultHandler) reportDefault(parser, enc, s, next); } break; } case XML_TOK_START_TAG_WITH_ATTS: if (!startElementHandler) { enum XML_Error result = storeAtts(parser, enc, s, 0, 0); if (result) return result; } /* fall through */ case XML_TOK_START_TAG_NO_ATTS: { TAG *tag; if (freeTagList) { tag = freeTagList; freeTagList = freeTagList->parent; } else { tag = malloc(sizeof(TAG)); if (!tag) return XML_ERROR_NO_MEMORY; tag->buf = malloc(INIT_TAG_BUF_SIZE); if (!tag->buf) return XML_ERROR_NO_MEMORY; tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; } tag->bindings = 0; tag->parent = tagStack; tagStack = tag; tag->name.localPart = 0; tag->rawName = s + enc->minBytesPerChar; tag->rawNameLength = XmlNameLength(enc, tag->rawName); if (nextPtr) { /* Need to guarantee that: tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */ if (tag->rawNameLength + (int)(sizeof(XML_Char) - 1) + (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) { int bufSize = tag->rawNameLength * 4; bufSize = ROUND_UP(bufSize, sizeof(XML_Char)); tag->buf = realloc(tag->buf, bufSize); if (!tag->buf) return XML_ERROR_NO_MEMORY; tag->bufEnd = tag->buf + bufSize; } memcpy(tag->buf, tag->rawName, tag->rawNameLength); tag->rawName = tag->buf; } ++tagLevel; if (startElementHandler) { enum XML_Error result; XML_Char *toPtr; for (;;) { const char *rawNameEnd = tag->rawName + tag->rawNameLength; const char *fromPtr = tag->rawName; int bufSize; if (nextPtr) toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char))); else toPtr = (XML_Char *)tag->buf; tag->name.str = toPtr; XmlConvert(enc, &fromPtr, rawNameEnd, (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); if (fromPtr == rawNameEnd) break; bufSize = (tag->bufEnd - tag->buf) << 1; tag->buf = realloc(tag->buf, bufSize); if (!tag->buf) return XML_ERROR_NO_MEMORY; tag->bufEnd = tag->buf + bufSize; if (nextPtr) tag->rawName = tag->buf; } *toPtr = XML_T('\0'); result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); if (result) return result; startElementHandler(handlerArg, tag->name.str, (const XML_Char **)atts); poolClear(&tempPool); } else { tag->name.str = 0; if (defaultHandler) reportDefault(parser, enc, s, next); } break; } case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: if (!startElementHandler) { enum XML_Error result = storeAtts(parser, enc, s, 0, 0); if (result) return result; } /* fall through */ case XML_TOK_EMPTY_ELEMENT_NO_ATTS: if (startElementHandler || endElementHandler) { const char *rawName = s + enc->minBytesPerChar; enum XML_Error result; BINDING *bindings = 0; TAG_NAME name; name.str = poolStoreString(&tempPool, enc, rawName, rawName + XmlNameLength(enc, rawName)); if (!name.str) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); result = storeAtts(parser, enc, s, &name, &bindings); if (result) return result; poolFinish(&tempPool); if (startElementHandler) startElementHandler(handlerArg, name.str, (const XML_Char **)atts); if (endElementHandler) { if (startElementHandler) *eventPP = *eventEndPP; endElementHandler(handlerArg, name.str); } poolClear(&tempPool); while (bindings) { BINDING *b = bindings; if (endNamespaceDeclHandler) endNamespaceDeclHandler(handlerArg, b->prefix->name); bindings = bindings->nextTagBinding; b->nextTagBinding = freeBindingList; freeBindingList = b; b->prefix->binding = b->prevPrefixBinding; } } else if (defaultHandler) reportDefault(parser, enc, s, next); if (tagLevel == 0) return epilogProcessor(parser, next, end, nextPtr); break; case XML_TOK_END_TAG: if (tagLevel == startTagLevel) return XML_ERROR_ASYNC_ENTITY; else { int len; const char *rawName; TAG *tag = tagStack; tagStack = tag->parent; tag->parent = freeTagList; freeTagList = tag; rawName = s + enc->minBytesPerChar*2; len = XmlNameLength(enc, rawName); if (len != tag->rawNameLength || memcmp(tag->rawName, rawName, len) != 0) { *eventPP = rawName; return XML_ERROR_TAG_MISMATCH; } --tagLevel; if (endElementHandler && tag->name.str) { if (tag->name.localPart) { XML_Char *to = (XML_Char *)tag->name.str + tag->name.uriLen; const XML_Char *from = tag->name.localPart; while ((*to++ = *from++) != 0) ; } endElementHandler(handlerArg, tag->name.str); } else if (defaultHandler) reportDefault(parser, enc, s, next); while (tag->bindings) { BINDING *b = tag->bindings; if (endNamespaceDeclHandler) endNamespaceDeclHandler(handlerArg, b->prefix->name); tag->bindings = tag->bindings->nextTagBinding; b->nextTagBinding = freeBindingList; freeBindingList = b; b->prefix->binding = b->prevPrefixBinding; } if (tagLevel == 0) return epilogProcessor(parser, next, end, nextPtr); } break; case XML_TOK_CHAR_REF: { int n = XmlCharRefNumber(enc, s); if (n < 0) return XML_ERROR_BAD_CHAR_REF; if (characterDataHandler) { XML_Char buf[XML_ENCODE_MAX]; characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); } else if (defaultHandler) reportDefault(parser, enc, s, next); } break; case XML_TOK_XML_DECL: return XML_ERROR_MISPLACED_XML_PI; case XML_TOK_DATA_NEWLINE: if (characterDataHandler) { XML_Char c = 0xA; characterDataHandler(handlerArg, &c, 1); } else if (defaultHandler) reportDefault(parser, enc, s, next); break; case XML_TOK_CDATA_SECT_OPEN: { enum XML_Error result; if (startCdataSectionHandler) startCdataSectionHandler(handlerArg); #if 0 /* Suppose you doing a transformation on a document that involves changing only the character data. You set up a defaultHandler and a characterDataHandler. The defaultHandler simply copies characters through. The characterDataHandler does the transformation and writes the characters out escaping them as necessary. This case will fail to work if we leave out the following two lines (because & and < inside CDATA sections will be incorrectly escaped). However, now we have a start/endCdataSectionHandler, so it seems easier to let the user deal with this. */ else if (characterDataHandler) characterDataHandler(handlerArg, dataBuf, 0); #endif else if (defaultHandler) reportDefault(parser, enc, s, next); result = doCdataSection(parser, enc, &next, end, nextPtr); if (!next) { processor = cdataSectionProcessor; return result; } } break; case XML_TOK_TRAILING_RSQB: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } if (characterDataHandler) { if (MUST_CONVERT(enc, s)) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); } else characterDataHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); } else if (defaultHandler) reportDefault(parser, enc, s, end); if (startTagLevel == 0) { *eventPP = end; return XML_ERROR_NO_ELEMENTS; } if (tagLevel != startTagLevel) { *eventPP = end; return XML_ERROR_ASYNC_ENTITY; } return XML_ERROR_NONE; case XML_TOK_DATA_CHARS: if (characterDataHandler) { if (MUST_CONVERT(enc, s)) { for (;;) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); if (s == next) break; *eventPP = s; } } else characterDataHandler(handlerArg, (XML_Char *)s, (XML_Char *)next - (XML_Char *)s); } else if (defaultHandler) reportDefault(parser, enc, s, next); break; case XML_TOK_PI: if (!reportProcessingInstruction(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_COMMENT: if (!reportComment(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; default: if (defaultHandler) reportDefault(parser, enc, s, next); break; } *eventPP = s = next; } /* not reached */ } /* If tagNamePtr is non-null, build a real list of attributes, otherwise just check the attributes for well-formedness. */ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc, const char *attStr, TAG_NAME *tagNamePtr, BINDING **bindingsPtr) { ELEMENT_TYPE *elementType = 0; int nDefaultAtts = 0; const XML_Char **appAtts; int attIndex = 0; int i; int n; int nPrefixes = 0; BINDING *binding; const XML_Char *localPart; if (tagNamePtr) { elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, 0); if (!elementType) { tagNamePtr->str = poolCopyString(&dtd.pool, tagNamePtr->str); if (!tagNamePtr->str) return XML_ERROR_NO_MEMORY; elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, sizeof(ELEMENT_TYPE)); if (!elementType) return XML_ERROR_NO_MEMORY; if (ns && !setElementTypePrefix(parser, elementType)) return XML_ERROR_NO_MEMORY; } nDefaultAtts = elementType->nDefaultAtts; } n = XmlGetAttributes(enc, attStr, attsSize, atts); if (n + nDefaultAtts > attsSize) { int oldAttsSize = attsSize; attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; atts = realloc((void *)atts, attsSize * sizeof(ATTRIBUTE)); if (!atts) return XML_ERROR_NO_MEMORY; if (n > oldAttsSize) XmlGetAttributes(enc, attStr, n, atts); } appAtts = (const XML_Char **)atts; for (i = 0; i < n; i++) { ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name, atts[i].name + XmlNameLength(enc, atts[i].name)); if (!attId) return XML_ERROR_NO_MEMORY; if ((attId->name)[-1]) { if (enc == encoding) eventPtr = atts[i].name; return XML_ERROR_DUPLICATE_ATTRIBUTE; } (attId->name)[-1] = 1; appAtts[attIndex++] = attId->name; if (!atts[i].normalized) { enum XML_Error result; int isCdata = 1; if (attId->maybeTokenized) { int j; for (j = 0; j < nDefaultAtts; j++) { if (attId == elementType->defaultAtts[j].id) { isCdata = elementType->defaultAtts[j].isCdata; break; } } } result = storeAttributeValue(parser, enc, isCdata, atts[i].valuePtr, atts[i].valueEnd, &tempPool); if (result) return result; if (tagNamePtr) { appAtts[attIndex] = poolStart(&tempPool); poolFinish(&tempPool); } else poolDiscard(&tempPool); } else if (tagNamePtr) { appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd); if (appAtts[attIndex] == 0) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); } if (attId->prefix && tagNamePtr) { if (attId->xmlns) { if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex], bindingsPtr)) return XML_ERROR_NO_MEMORY; --attIndex; } else { attIndex++; nPrefixes++; (attId->name)[-1] = 2; } } else attIndex++; } nSpecifiedAtts = attIndex; if (tagNamePtr) { int j; for (j = 0; j < nDefaultAtts; j++) { const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j; if (!(da->id->name)[-1] && da->value) { if (da->id->prefix) { if (da->id->xmlns) { if (!addBinding(parser, da->id->prefix, da->id, da->value, bindingsPtr)) return XML_ERROR_NO_MEMORY; } else { (da->id->name)[-1] = 2; nPrefixes++; appAtts[attIndex++] = da->id->name; appAtts[attIndex++] = da->value; } } else { (da->id->name)[-1] = 1; appAtts[attIndex++] = da->id->name; appAtts[attIndex++] = da->value; } } } appAtts[attIndex] = 0; } i = 0; if (nPrefixes) { for (; i < attIndex; i += 2) { if (appAtts[i][-1] == 2) { ATTRIBUTE_ID *id; ((XML_Char *)(appAtts[i]))[-1] = 0; id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0); if (id->prefix->binding) { int j; const BINDING *b = id->prefix->binding; const XML_Char *s = appAtts[i]; for (j = 0; j < b->uriLen; j++) { if (!poolAppendChar(&tempPool, b->uri[j])) return XML_ERROR_NO_MEMORY; } while (*s++ != ':') ; do { if (!poolAppendChar(&tempPool, *s)) return XML_ERROR_NO_MEMORY; } while (*s++); appAtts[i] = poolStart(&tempPool); poolFinish(&tempPool); } if (!--nPrefixes) break; } else ((XML_Char *)(appAtts[i]))[-1] = 0; } } for (; i < attIndex; i += 2) ((XML_Char *)(appAtts[i]))[-1] = 0; if (!tagNamePtr) return XML_ERROR_NONE; for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) binding->attId->name[-1] = 0; if (elementType->prefix) { binding = elementType->prefix->binding; if (!binding) return XML_ERROR_NONE; localPart = tagNamePtr->str; while (*localPart++ != XML_T(':')) ; } else if (dtd.defaultPrefix.binding) { binding = dtd.defaultPrefix.binding; localPart = tagNamePtr->str; } else return XML_ERROR_NONE; tagNamePtr->localPart = localPart; tagNamePtr->uriLen = binding->uriLen; i = binding->uriLen; do { if (i == binding->uriAlloc) { binding->uri = realloc(binding->uri, binding->uriAlloc *= 2); if (!binding->uri) return XML_ERROR_NO_MEMORY; } binding->uri[i++] = *localPart; } while (*localPart++); tagNamePtr->str = binding->uri; return XML_ERROR_NONE; } static int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr) { BINDING *b; int len; for (len = 0; uri[len]; len++) ; if (namespaceSeparator) len++; if (freeBindingList) { b = freeBindingList; if (len > b->uriAlloc) { b->uri = realloc(b->uri, len + EXPAND_SPARE); if (!b->uri) return 0; b->uriAlloc = len + EXPAND_SPARE; } freeBindingList = b->nextTagBinding; } else { b = malloc(sizeof(BINDING)); if (!b) return 0; b->uri = malloc(sizeof(XML_Char) * len + EXPAND_SPARE); if (!b->uri) { free(b); return 0; } b->uriAlloc = len; } b->uriLen = len; memcpy(b->uri, uri, len * sizeof(XML_Char)); if (namespaceSeparator) b->uri[len - 1] = namespaceSeparator; b->prefix = prefix; b->attId = attId; b->prevPrefixBinding = prefix->binding; if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix) prefix->binding = 0; else prefix->binding = b; b->nextTagBinding = *bindingsPtr; *bindingsPtr = b; if (startNamespaceDeclHandler) startNamespaceDeclHandler(handlerArg, prefix->name, prefix->binding ? uri : 0); return 1; } /* The idea here is to avoid using stack for each CDATA section when the whole file is parsed with one call. */ static enum XML_Error cdataSectionProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr); if (start) { processor = contentProcessor; return contentProcessor(parser, start, end, endPtr); } return result; } /* startPtr gets set to non-null is the section is closed, and to null if the section is not yet closed. */ static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, const char *end, const char **nextPtr) { const char *s = *startPtr; const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; *eventPP = s; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } *eventPP = s; *startPtr = 0; for (;;) { const char *next; int tok = XmlCdataSectionTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { case XML_TOK_CDATA_SECT_CLOSE: if (endCdataSectionHandler) endCdataSectionHandler(handlerArg); #if 0 /* see comment under XML_TOK_CDATA_SECT_OPEN */ else if (characterDataHandler) characterDataHandler(handlerArg, dataBuf, 0); #endif else if (defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; return XML_ERROR_NONE; case XML_TOK_DATA_NEWLINE: if (characterDataHandler) { XML_Char c = 0xA; characterDataHandler(handlerArg, &c, 1); } else if (defaultHandler) reportDefault(parser, enc, s, next); break; case XML_TOK_DATA_CHARS: if (characterDataHandler) { if (MUST_CONVERT(enc, s)) { for (;;) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = next; characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); if (s == next) break; *eventPP = s; } } else characterDataHandler(handlerArg, (XML_Char *)s, (XML_Char *)next - (XML_Char *)s); } else if (defaultHandler) reportDefault(parser, enc, s, next); break; case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL_CHAR: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; case XML_TOK_PARTIAL: case XML_TOK_NONE: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_CDATA_SECTION; default: abort(); } *eventPP = s = next; } /* not reached */ } #ifdef XML_DTD /* The idea here is to avoid using stack for each IGNORE section when the whole file is parsed with one call. */ static enum XML_Error ignoreSectionProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, endPtr); if (start) { processor = prologProcessor; return prologProcessor(parser, start, end, endPtr); } return result; } /* startPtr gets set to non-null is the section is closed, and to null if the section is not yet closed. */ static enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, const char *end, const char **nextPtr) { const char *next; int tok; const char *s = *startPtr; const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; *eventPP = s; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } *eventPP = s; *startPtr = 0; tok = XmlIgnoreSectionTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { case XML_TOK_IGNORE_SECT: if (defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; return XML_ERROR_NONE; case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL_CHAR: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; case XML_TOK_PARTIAL: case XML_TOK_NONE: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ default: abort(); } /* not reached */ } #endif /* XML_DTD */ static enum XML_Error initializeEncoding(XML_Parser parser) { const char *s; #ifdef XML_UNICODE char encodingBuf[128]; if (!protocolEncodingName) s = 0; else { int i; for (i = 0; protocolEncodingName[i]; i++) { if (i == sizeof(encodingBuf) - 1 || protocolEncodingName[i] >= 0x80 || protocolEncodingName[i] < 0) { encodingBuf[0] = '\0'; break; } encodingBuf[i] = (char)protocolEncodingName[i]; } encodingBuf[i] = '\0'; s = encodingBuf; } #else s = protocolEncodingName; #endif if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) return XML_ERROR_NONE; return handleUnknownEncoding(parser, protocolEncodingName); } static enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s, const char *next) { const char *encodingName = 0; const ENCODING *newEncoding = 0; const char *version; int standalone = -1; if (!(ns ? XmlParseXmlDeclNS : XmlParseXmlDecl)(isGeneralTextEntity, encoding, s, next, &eventPtr, &version, &encodingName, &newEncoding, &standalone)) return XML_ERROR_SYNTAX; if (!isGeneralTextEntity && standalone == 1) { dtd.standalone = 1; #ifdef XML_DTD if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; #endif /* XML_DTD */ } if (defaultHandler) reportDefault(parser, encoding, s, next); if (!protocolEncodingName) { if (newEncoding) { if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { eventPtr = encodingName; return XML_ERROR_INCORRECT_ENCODING; } encoding = newEncoding; } else if (encodingName) { enum XML_Error result; const XML_Char *s = poolStoreString(&tempPool, encoding, encodingName, encodingName + XmlNameLength(encoding, encodingName)); if (!s) return XML_ERROR_NO_MEMORY; if (xmlDeclHandler) xmlDeclHandler(userData, version, s, standalone); result = handleUnknownEncoding(parser, s); poolDiscard(&tempPool); if (result == XML_ERROR_UNKNOWN_ENCODING) eventPtr = encodingName; return result; } } return XML_ERROR_NONE; } static enum XML_Error handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) { if (unknownEncodingHandler) { XML_Encoding info; int i; for (i = 0; i < 256; i++) info.map[i] = -1; info.convert = 0; info.data = 0; info.release = 0; if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, &info)) { ENCODING *enc; unknownEncodingMem = malloc(XmlSizeOfUnknownEncoding()); if (!unknownEncodingMem) { if (info.release) info.release(info.data); return XML_ERROR_NO_MEMORY; } enc = (ns ? XmlInitUnknownEncodingNS : XmlInitUnknownEncoding)(unknownEncodingMem, info.map, info.convert, info.data); if (enc) { unknownEncodingData = info.data; unknownEncodingRelease = info.release; encoding = enc; return XML_ERROR_NONE; } } if (info.release) info.release(info.data); } return XML_ERROR_UNKNOWN_ENCODING; } static enum XML_Error prologInitProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; processor = prologProcessor; return prologProcessor(parser, s, end, nextPtr); } static enum XML_Error prologProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { const char *next; int tok = XmlPrologTok(encoding, s, end, &next); return doProlog(parser, encoding, s, end, tok, next, nextPtr); } static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, int tok, const char *next, const char **nextPtr) { #ifdef XML_DTD static const XML_Char externalSubsetName[] = { '#' , '\0' }; #endif /* XML_DTD */ const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } for (;;) { int role; *eventPP = s; *eventEndPP = next; if (tok <= 0) { if (nextPtr != 0 && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } switch (tok) { case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; case XML_TOK_NONE: #ifdef XML_DTD if (enc != encoding) return XML_ERROR_NONE; if (parentParser) { if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) == XML_ROLE_ERROR) return XML_ERROR_SYNTAX; hadExternalDoctype = 0; return XML_ERROR_NONE; } #endif /* XML_DTD */ return XML_ERROR_NO_ELEMENTS; default: tok = -tok; next = end; break; } } role = XmlTokenRole(&prologState, tok, s, next, enc); switch (role) { case XML_ROLE_XML_DECL: { enum XML_Error result = processXmlDecl(parser, 0, s, next); if (result != XML_ERROR_NONE) return result; enc = encoding; } break; #ifdef XML_DTD case XML_ROLE_TEXT_DECL: { enum XML_Error result = processXmlDecl(parser, 1, s, next); if (result != XML_ERROR_NONE) return result; enc = encoding; } break; #endif /* XML_DTD */ case XML_ROLE_DOCTYPE_PUBLIC_ID: #ifdef XML_DTD declEntity = (ENTITY *)lookup(&dtd.paramEntities, externalSubsetName, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; #endif /* XML_DTD */ /* fall through */ case XML_ROLE_ENTITY_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_SYNTAX; if (declEntity) { XML_Char *tem = poolStoreString(&dtd.pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!tem) return XML_ERROR_NO_MEMORY; normalizePublicId(tem); declEntity->publicId = tem; poolFinish(&dtd.pool); } break; case XML_ROLE_DOCTYPE_CLOSE: if (dtd.complete && hadExternalDoctype) { dtd.complete = 0; #ifdef XML_DTD if (paramEntityParsing && externalEntityRefHandler) { ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities, externalSubsetName, 0); if (!externalEntityRefHandler(externalEntityRefHandlerArg, 0, entity->base, entity->systemId, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; } #endif /* XML_DTD */ if (!dtd.complete && !dtd.standalone && notStandaloneHandler && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; } break; case XML_ROLE_INSTANCE_START: processor = contentProcessor; return contentProcessor(parser, s, end, nextPtr); case XML_ROLE_ATTLIST_ELEMENT_NAME: { const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next); if (!name) return XML_ERROR_NO_MEMORY; declElementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE)); if (!declElementType) return XML_ERROR_NO_MEMORY; if (declElementType->name != name) poolDiscard(&dtd.pool); else { poolFinish(&dtd.pool); if (!setElementTypePrefix(parser, declElementType)) return XML_ERROR_NO_MEMORY; } break; } case XML_ROLE_ATTRIBUTE_NAME: declAttributeId = getAttributeId(parser, enc, s, next); if (!declAttributeId) return XML_ERROR_NO_MEMORY; declAttributeIsCdata = 0; break; case XML_ROLE_ATTRIBUTE_TYPE_CDATA: declAttributeIsCdata = 1; break; case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: if (dtd.complete && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, 0)) return XML_ERROR_NO_MEMORY; break; case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: case XML_ROLE_FIXED_ATTRIBUTE_VALUE: { const XML_Char *attVal; enum XML_Error result = storeAttributeValue(parser, enc, declAttributeIsCdata, s + enc->minBytesPerChar, next - enc->minBytesPerChar, &dtd.pool); if (result) return result; attVal = poolStart(&dtd.pool); poolFinish(&dtd.pool); if (dtd.complete && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, attVal)) return XML_ERROR_NO_MEMORY; break; } case XML_ROLE_ENTITY_VALUE: { enum XML_Error result = storeEntityValue(parser, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (declEntity) { declEntity->textPtr = poolStart(&dtd.pool); declEntity->textLen = poolLength(&dtd.pool); poolFinish(&dtd.pool); } else poolDiscard(&dtd.pool); if (result != XML_ERROR_NONE) return result; } break; case XML_ROLE_DOCTYPE_SYSTEM_ID: if (!dtd.standalone #ifdef XML_DTD && !paramEntityParsing #endif /* XML_DTD */ && notStandaloneHandler && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; hadExternalDoctype = 1; #ifndef XML_DTD break; #else /* XML_DTD */ if (!declEntity) { declEntity = (ENTITY *)lookup(&dtd.paramEntities, externalSubsetName, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; } /* fall through */ #endif /* XML_DTD */ case XML_ROLE_ENTITY_SYSTEM_ID: if (declEntity) { declEntity->systemId = poolStoreString(&dtd.pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!declEntity->systemId) return XML_ERROR_NO_MEMORY; declEntity->base = curBase; poolFinish(&dtd.pool); } break; case XML_ROLE_ENTITY_NOTATION_NAME: if (declEntity) { declEntity->notation = poolStoreString(&dtd.pool, enc, s, next); if (!declEntity->notation) return XML_ERROR_NO_MEMORY; poolFinish(&dtd.pool); if (unparsedEntityDeclHandler) { *eventEndPP = s; unparsedEntityDeclHandler(handlerArg, declEntity->name, declEntity->base, declEntity->systemId, declEntity->publicId, declEntity->notation); } } break; case XML_ROLE_GENERAL_ENTITY_NAME: { const XML_Char *name; if (XmlPredefinedEntityName(enc, s, next)) { declEntity = 0; break; } name = poolStoreString(&dtd.pool, enc, s, next); if (!name) return XML_ERROR_NO_MEMORY; if (dtd.complete) { declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; if (declEntity->name != name) { poolDiscard(&dtd.pool); declEntity = 0; } else poolFinish(&dtd.pool); } else { poolDiscard(&dtd.pool); declEntity = 0; } } break; case XML_ROLE_PARAM_ENTITY_NAME: #ifdef XML_DTD if (dtd.complete) { const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next); if (!name) return XML_ERROR_NO_MEMORY; declEntity = (ENTITY *)lookup(&dtd.paramEntities, name, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; if (declEntity->name != name) { poolDiscard(&dtd.pool); declEntity = 0; } else poolFinish(&dtd.pool); } #else /* not XML_DTD */ declEntity = 0; #endif /* not XML_DTD */ break; case XML_ROLE_NOTATION_NAME: declNotationPublicId = 0; declNotationName = 0; if (notationDeclHandler) { declNotationName = poolStoreString(&tempPool, enc, s, next); if (!declNotationName) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); } break; case XML_ROLE_NOTATION_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_SYNTAX; if (declNotationName) { XML_Char *tem = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!tem) return XML_ERROR_NO_MEMORY; normalizePublicId(tem); declNotationPublicId = tem; poolFinish(&tempPool); } break; case XML_ROLE_NOTATION_SYSTEM_ID: if (declNotationName && notationDeclHandler) { const XML_Char *systemId = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!systemId) return XML_ERROR_NO_MEMORY; *eventEndPP = s; notationDeclHandler(handlerArg, declNotationName, curBase, systemId, declNotationPublicId); } poolClear(&tempPool); break; case XML_ROLE_NOTATION_NO_SYSTEM_ID: if (declNotationPublicId && notationDeclHandler) { *eventEndPP = s; notationDeclHandler(handlerArg, declNotationName, curBase, 0, declNotationPublicId); } poolClear(&tempPool); break; case XML_ROLE_ERROR: switch (tok) { case XML_TOK_PARAM_ENTITY_REF: return XML_ERROR_PARAM_ENTITY_REF; case XML_TOK_XML_DECL: return XML_ERROR_MISPLACED_XML_PI; default: return XML_ERROR_SYNTAX; } #ifdef XML_DTD case XML_ROLE_IGNORE_SECT: { enum XML_Error result; if (defaultHandler) reportDefault(parser, enc, s, next); result = doIgnoreSection(parser, enc, &next, end, nextPtr); if (!next) { processor = ignoreSectionProcessor; return result; } } break; #endif /* XML_DTD */ case XML_ROLE_GROUP_OPEN: if (prologState.level >= groupSize) { if (groupSize) groupConnector = realloc(groupConnector, groupSize *= 2); else groupConnector = malloc(groupSize = 32); if (!groupConnector) return XML_ERROR_NO_MEMORY; } groupConnector[prologState.level] = 0; break; case XML_ROLE_GROUP_SEQUENCE: if (groupConnector[prologState.level] == '|') return XML_ERROR_SYNTAX; groupConnector[prologState.level] = ','; break; case XML_ROLE_GROUP_CHOICE: if (groupConnector[prologState.level] == ',') return XML_ERROR_SYNTAX; groupConnector[prologState.level] = '|'; break; case XML_ROLE_PARAM_ENTITY_REF: #ifdef XML_DTD case XML_ROLE_INNER_PARAM_ENTITY_REF: if (paramEntityParsing && (dtd.complete || role == XML_ROLE_INNER_PARAM_ENTITY_REF)) { const XML_Char *name; ENTITY *entity; name = poolStoreString(&dtd.pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); poolDiscard(&dtd.pool); if (!entity) { /* FIXME what to do if !dtd.complete? */ return XML_ERROR_UNDEFINED_ENTITY; } if (entity->open) return XML_ERROR_RECURSIVE_ENTITY_REF; if (entity->textPtr) { enum XML_Error result; result = processInternalParamEntity(parser, entity); if (result != XML_ERROR_NONE) return result; break; } if (role == XML_ROLE_INNER_PARAM_ENTITY_REF) return XML_ERROR_PARAM_ENTITY_REF; if (externalEntityRefHandler) { dtd.complete = 0; entity->open = 1; if (!externalEntityRefHandler(externalEntityRefHandlerArg, 0, entity->base, entity->systemId, entity->publicId)) { entity->open = 0; return XML_ERROR_EXTERNAL_ENTITY_HANDLING; } entity->open = 0; if (dtd.complete) break; } } #endif /* XML_DTD */ if (!dtd.standalone && notStandaloneHandler && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; dtd.complete = 0; if (defaultHandler) reportDefault(parser, enc, s, next); break; case XML_ROLE_NONE: switch (tok) { case XML_TOK_PI: if (!reportProcessingInstruction(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_COMMENT: if (!reportComment(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; } break; } if (defaultHandler) { switch (tok) { case XML_TOK_PI: case XML_TOK_COMMENT: case XML_TOK_BOM: case XML_TOK_XML_DECL: #ifdef XML_DTD case XML_TOK_IGNORE_SECT: #endif /* XML_DTD */ case XML_TOK_PARAM_ENTITY_REF: break; default: if (role != XML_ROLE_IGNORE_SECT) reportDefault(parser, enc, s, next); } } s = next; tok = XmlPrologTok(enc, s, end, &next); } /* not reached */ } static enum XML_Error epilogProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { processor = epilogProcessor; eventPtr = s; for (;;) { const char *next; int tok = XmlPrologTok(encoding, s, end, &next); eventEndPtr = next; switch (tok) { case -XML_TOK_PROLOG_S: if (defaultHandler) { eventEndPtr = end; reportDefault(parser, encoding, s, end); } /* fall through */ case XML_TOK_NONE: if (nextPtr) *nextPtr = end; return XML_ERROR_NONE; case XML_TOK_PROLOG_S: if (defaultHandler) reportDefault(parser, encoding, s, next); break; case XML_TOK_PI: if (!reportProcessingInstruction(parser, encoding, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_COMMENT: if (!reportComment(parser, encoding, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_INVALID: eventPtr = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (nextPtr) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; default: return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; } eventPtr = s = next; } } #ifdef XML_DTD static enum XML_Error processInternalParamEntity(XML_Parser parser, ENTITY *entity) { const char *s, *end, *next; int tok; enum XML_Error result; OPEN_INTERNAL_ENTITY openEntity; entity->open = 1; openEntity.next = openInternalEntities; openInternalEntities = &openEntity; openEntity.entity = entity; openEntity.internalEventPtr = 0; openEntity.internalEventEndPtr = 0; s = (char *)entity->textPtr; end = (char *)(entity->textPtr + entity->textLen); tok = XmlPrologTok(internalEncoding, s, end, &next); result = doProlog(parser, internalEncoding, s, end, tok, next, 0); entity->open = 0; openInternalEntities = openEntity.next; return result; } #endif /* XML_DTD */ static enum XML_Error errorProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { return errorCode; } static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata, const char *ptr, const char *end, STRING_POOL *pool) { enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, end, pool); if (result) return result; if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) poolChop(pool); if (!poolAppendChar(pool, XML_T('\0'))) return XML_ERROR_NO_MEMORY; return XML_ERROR_NONE; } static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata, const char *ptr, const char *end, STRING_POOL *pool) { for (;;) { const char *next; int tok = XmlAttributeValueTok(enc, ptr, end, &next); switch (tok) { case XML_TOK_NONE: return XML_ERROR_NONE; case XML_TOK_INVALID: if (enc == encoding) eventPtr = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: if (enc == encoding) eventPtr = ptr; return XML_ERROR_INVALID_TOKEN; case XML_TOK_CHAR_REF: { XML_Char buf[XML_ENCODE_MAX]; int i; int n = XmlCharRefNumber(enc, ptr); if (n < 0) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_BAD_CHAR_REF; } if (!isCdata && n == 0x20 /* space */ && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) break; n = XmlEncode(n, (ICHAR *)buf); if (!n) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_BAD_CHAR_REF; } for (i = 0; i < n; i++) { if (!poolAppendChar(pool, buf[i])) return XML_ERROR_NO_MEMORY; } } break; case XML_TOK_DATA_CHARS: if (!poolAppend(pool, enc, ptr, next)) return XML_ERROR_NO_MEMORY; break; break; case XML_TOK_TRAILING_CR: next = ptr + enc->minBytesPerChar; /* fall through */ case XML_TOK_ATTRIBUTE_VALUE_S: case XML_TOK_DATA_NEWLINE: if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) break; if (!poolAppendChar(pool, 0x20)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_ENTITY_REF: { const XML_Char *name; ENTITY *entity; XML_Char ch = XmlPredefinedEntityName(enc, ptr + enc->minBytesPerChar, next - enc->minBytesPerChar); if (ch) { if (!poolAppendChar(pool, ch)) return XML_ERROR_NO_MEMORY; break; } name = poolStoreString(&temp2Pool, enc, ptr + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); poolDiscard(&temp2Pool); if (!entity) { if (dtd.complete) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_UNDEFINED_ENTITY; } } else if (entity->open) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_RECURSIVE_ENTITY_REF; } else if (entity->notation) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_BINARY_ENTITY_REF; } else if (!entity->textPtr) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; } else { enum XML_Error result; const XML_Char *textEnd = entity->textPtr + entity->textLen; entity->open = 1; result = appendAttributeValue(parser, internalEncoding, isCdata, (char *)entity->textPtr, (char *)textEnd, pool); entity->open = 0; if (result) return result; } } break; default: abort(); } ptr = next; } /* not reached */ } static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *entityTextPtr, const char *entityTextEnd) { STRING_POOL *pool = &(dtd.pool); for (;;) { const char *next; int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); switch (tok) { case XML_TOK_PARAM_ENTITY_REF: #ifdef XML_DTD if (parentParser || enc != encoding) { enum XML_Error result; const XML_Char *name; ENTITY *entity; name = poolStoreString(&tempPool, enc, entityTextPtr + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); poolDiscard(&tempPool); if (!entity) { if (enc == encoding) eventPtr = entityTextPtr; return XML_ERROR_UNDEFINED_ENTITY; } if (entity->open) { if (enc == encoding) eventPtr = entityTextPtr; return XML_ERROR_RECURSIVE_ENTITY_REF; } if (entity->systemId) { if (enc == encoding) eventPtr = entityTextPtr; return XML_ERROR_PARAM_ENTITY_REF; } entity->open = 1; result = storeEntityValue(parser, internalEncoding, (char *)entity->textPtr, (char *)(entity->textPtr + entity->textLen)); entity->open = 0; if (result) return result; break; } #endif /* XML_DTD */ eventPtr = entityTextPtr; return XML_ERROR_SYNTAX; case XML_TOK_NONE: return XML_ERROR_NONE; case XML_TOK_ENTITY_REF: case XML_TOK_DATA_CHARS: if (!poolAppend(pool, enc, entityTextPtr, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_TRAILING_CR: next = entityTextPtr + enc->minBytesPerChar; /* fall through */ case XML_TOK_DATA_NEWLINE: if (pool->end == pool->ptr && !poolGrow(pool)) return XML_ERROR_NO_MEMORY; *(pool->ptr)++ = 0xA; break; case XML_TOK_CHAR_REF: { XML_Char buf[XML_ENCODE_MAX]; int i; int n = XmlCharRefNumber(enc, entityTextPtr); if (n < 0) { if (enc == encoding) eventPtr = entityTextPtr; return XML_ERROR_BAD_CHAR_REF; } n = XmlEncode(n, (ICHAR *)buf); if (!n) { if (enc == encoding) eventPtr = entityTextPtr; return XML_ERROR_BAD_CHAR_REF; } for (i = 0; i < n; i++) { if (pool->end == pool->ptr && !poolGrow(pool)) return XML_ERROR_NO_MEMORY; *(pool->ptr)++ = buf[i]; } } break; case XML_TOK_PARTIAL: if (enc == encoding) eventPtr = entityTextPtr; return XML_ERROR_INVALID_TOKEN; case XML_TOK_INVALID: if (enc == encoding) eventPtr = next; return XML_ERROR_INVALID_TOKEN; default: abort(); } entityTextPtr = next; } /* not reached */ } static void normalizeLines(XML_Char *s) { XML_Char *p; for (;; s++) { if (*s == XML_T('\0')) return; if (*s == 0xD) break; } p = s; do { if (*s == 0xD) { *p++ = 0xA; if (*++s == 0xA) s++; } else *p++ = *s++; } while (*s); *p = XML_T('\0'); } static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { const XML_Char *target; XML_Char *data; const char *tem; if (!processingInstructionHandler) { if (defaultHandler) reportDefault(parser, enc, start, end); return 1; } start += enc->minBytesPerChar * 2; tem = start + XmlNameLength(enc, start); target = poolStoreString(&tempPool, enc, start, tem); if (!target) return 0; poolFinish(&tempPool); data = poolStoreString(&tempPool, enc, XmlSkipS(enc, tem), end - enc->minBytesPerChar*2); if (!data) return 0; normalizeLines(data); processingInstructionHandler(handlerArg, target, data); poolClear(&tempPool); return 1; } static int reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { XML_Char *data; if (!commentHandler) { if (defaultHandler) reportDefault(parser, enc, start, end); return 1; } data = poolStoreString(&tempPool, enc, start + enc->minBytesPerChar * 4, end - enc->minBytesPerChar * 3); if (!data) return 0; normalizeLines(data); commentHandler(handlerArg, data); poolClear(&tempPool); return 1; } static void reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end) { if (MUST_CONVERT(enc, s)) { const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } do { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); *eventPP = s; } while (s != end); } else defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); } static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata, const XML_Char *value) { DEFAULT_ATTRIBUTE *att; if (value) { /* The handling of default attributes gets messed up if we have a default which duplicates a non-default. */ int i; for (i = 0; i < type->nDefaultAtts; i++) if (attId == type->defaultAtts[i].id) return 1; } if (type->nDefaultAtts == type->allocDefaultAtts) { if (type->allocDefaultAtts == 0) { type->allocDefaultAtts = 8; type->defaultAtts = malloc(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE)); } else { type->allocDefaultAtts *= 2; type->defaultAtts = realloc(type->defaultAtts, type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE)); } if (!type->defaultAtts) return 0; } att = type->defaultAtts + type->nDefaultAtts; att->id = attId; att->value = value; att->isCdata = isCdata; if (!isCdata) attId->maybeTokenized = 1; type->nDefaultAtts += 1; return 1; } static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) { const XML_Char *name; for (name = elementType->name; *name; name++) { if (*name == XML_T(':')) { PREFIX *prefix; const XML_Char *s; for (s = elementType->name; s != name; s++) { if (!poolAppendChar(&dtd.pool, *s)) return 0; } if (!poolAppendChar(&dtd.pool, XML_T('\0'))) return 0; prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX)); if (!prefix) return 0; if (prefix->name == poolStart(&dtd.pool)) poolFinish(&dtd.pool); else poolDiscard(&dtd.pool); elementType->prefix = prefix; } } return 1; } static ATTRIBUTE_ID * getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { ATTRIBUTE_ID *id; const XML_Char *name; if (!poolAppendChar(&dtd.pool, XML_T('\0'))) return 0; name = poolStoreString(&dtd.pool, enc, start, end); if (!name) return 0; ++name; id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID)); if (!id) return 0; if (id->name != name) poolDiscard(&dtd.pool); else { poolFinish(&dtd.pool); if (!ns) ; else if (name[0] == 'x' && name[1] == 'm' && name[2] == 'l' && name[3] == 'n' && name[4] == 's' && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) { if (name[5] == '\0') id->prefix = &dtd.defaultPrefix; else id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX)); id->xmlns = 1; } else { int i; for (i = 0; name[i]; i++) { if (name[i] == XML_T(':')) { int j; for (j = 0; j < i; j++) { if (!poolAppendChar(&dtd.pool, name[j])) return 0; } if (!poolAppendChar(&dtd.pool, XML_T('\0'))) return 0; id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX)); if (id->prefix->name == poolStart(&dtd.pool)) poolFinish(&dtd.pool); else poolDiscard(&dtd.pool); break; } } } } return id; } #define CONTEXT_SEP XML_T('\f') static const XML_Char *getContext(XML_Parser parser) { HASH_TABLE_ITER iter; int needSep = 0; if (dtd.defaultPrefix.binding) { int i; int len; if (!poolAppendChar(&tempPool, XML_T('='))) return 0; len = dtd.defaultPrefix.binding->uriLen; if (namespaceSeparator != XML_T('\0')) len--; for (i = 0; i < len; i++) if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i])) return 0; needSep = 1; } hashTableIterInit(&iter, &(dtd.prefixes)); for (;;) { int i; int len; const XML_Char *s; PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); if (!prefix) break; if (!prefix->binding) continue; if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) return 0; for (s = prefix->name; *s; s++) if (!poolAppendChar(&tempPool, *s)) return 0; if (!poolAppendChar(&tempPool, XML_T('='))) return 0; len = prefix->binding->uriLen; if (namespaceSeparator != XML_T('\0')) len--; for (i = 0; i < len; i++) if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) return 0; needSep = 1; } hashTableIterInit(&iter, &(dtd.generalEntities)); for (;;) { const XML_Char *s; ENTITY *e = (ENTITY *)hashTableIterNext(&iter); if (!e) break; if (!e->open) continue; if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) return 0; for (s = e->name; *s; s++) if (!poolAppendChar(&tempPool, *s)) return 0; needSep = 1; } if (!poolAppendChar(&tempPool, XML_T('\0'))) return 0; return tempPool.start; } static int setContext(XML_Parser parser, const XML_Char *context) { const XML_Char *s = context; while (*context != XML_T('\0')) { if (*s == CONTEXT_SEP || *s == XML_T('\0')) { ENTITY *e; if (!poolAppendChar(&tempPool, XML_T('\0'))) return 0; e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0); if (e) e->open = 1; if (*s != XML_T('\0')) s++; context = s; poolDiscard(&tempPool); } else if (*s == '=') { PREFIX *prefix; if (poolLength(&tempPool) == 0) prefix = &dtd.defaultPrefix; else { if (!poolAppendChar(&tempPool, XML_T('\0'))) return 0; prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool), sizeof(PREFIX)); if (!prefix) return 0; if (prefix->name == poolStart(&tempPool)) poolFinish(&tempPool); else poolDiscard(&tempPool); } for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0'); context++) if (!poolAppendChar(&tempPool, *context)) return 0; if (!poolAppendChar(&tempPool, XML_T('\0'))) return 0; if (!addBinding(parser, prefix, 0, poolStart(&tempPool), &inheritedBindings)) return 0; poolDiscard(&tempPool); if (*context != XML_T('\0')) ++context; s = context; } else { if (!poolAppendChar(&tempPool, *s)) return 0; s++; } } return 1; } static void normalizePublicId(XML_Char *publicId) { XML_Char *p = publicId; XML_Char *s; for (s = publicId; *s; s++) { switch (*s) { case 0x20: case 0xD: case 0xA: if (p != publicId && p[-1] != 0x20) *p++ = 0x20; break; default: *p++ = *s; } } if (p != publicId && p[-1] == 0x20) --p; *p = XML_T('\0'); } static int dtdInit(DTD *p) { poolInit(&(p->pool)); hashTableInit(&(p->generalEntities)); hashTableInit(&(p->elementTypes)); hashTableInit(&(p->attributeIds)); hashTableInit(&(p->prefixes)); p->complete = 1; p->standalone = 0; #ifdef XML_DTD hashTableInit(&(p->paramEntities)); #endif /* XML_DTD */ p->defaultPrefix.name = 0; p->defaultPrefix.binding = 0; return 1; } #ifdef XML_DTD static void dtdSwap(DTD *p1, DTD *p2) { DTD tem; memcpy(&tem, p1, sizeof(DTD)); memcpy(p1, p2, sizeof(DTD)); memcpy(p2, &tem, sizeof(DTD)); } #endif /* XML_DTD */ static void dtdDestroy(DTD *p) { HASH_TABLE_ITER iter; hashTableIterInit(&iter, &(p->elementTypes)); for (;;) { ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); if (!e) break; if (e->allocDefaultAtts != 0) free(e->defaultAtts); } hashTableDestroy(&(p->generalEntities)); #ifdef XML_DTD hashTableDestroy(&(p->paramEntities)); #endif /* XML_DTD */ hashTableDestroy(&(p->elementTypes)); hashTableDestroy(&(p->attributeIds)); hashTableDestroy(&(p->prefixes)); poolDestroy(&(p->pool)); } /* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise. The new DTD has already been initialized. */ static int dtdCopy(DTD *newDtd, const DTD *oldDtd) { HASH_TABLE_ITER iter; /* Copy the prefix table. */ hashTableIterInit(&iter, &(oldDtd->prefixes)); for (;;) { const XML_Char *name; const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); if (!oldP) break; name = poolCopyString(&(newDtd->pool), oldP->name); if (!name) return 0; if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX))) return 0; } hashTableIterInit(&iter, &(oldDtd->attributeIds)); /* Copy the attribute id table. */ for (;;) { ATTRIBUTE_ID *newA; const XML_Char *name; const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); if (!oldA) break; /* Remember to allocate the scratch byte before the name. */ if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) return 0; name = poolCopyString(&(newDtd->pool), oldA->name); if (!name) return 0; ++name; newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID)); if (!newA) return 0; newA->maybeTokenized = oldA->maybeTokenized; if (oldA->prefix) { newA->xmlns = oldA->xmlns; if (oldA->prefix == &oldDtd->defaultPrefix) newA->prefix = &newDtd->defaultPrefix; else newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldA->prefix->name, 0); } } /* Copy the element type table. */ hashTableIterInit(&iter, &(oldDtd->elementTypes)); for (;;) { int i; ELEMENT_TYPE *newE; const XML_Char *name; const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); if (!oldE) break; name = poolCopyString(&(newDtd->pool), oldE->name); if (!name) return 0; newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE)); if (!newE) return 0; if (oldE->nDefaultAtts) { newE->defaultAtts = (DEFAULT_ATTRIBUTE *)malloc(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); if (!newE->defaultAtts) return 0; } newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; if (oldE->prefix) newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldE->prefix->name, 0); for (i = 0; i < newE->nDefaultAtts; i++) { newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; if (oldE->defaultAtts[i].value) { newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); if (!newE->defaultAtts[i].value) return 0; } else newE->defaultAtts[i].value = 0; } } /* Copy the entity tables. */ if (!copyEntityTable(&(newDtd->generalEntities), &(newDtd->pool), &(oldDtd->generalEntities))) return 0; #ifdef XML_DTD if (!copyEntityTable(&(newDtd->paramEntities), &(newDtd->pool), &(oldDtd->paramEntities))) return 0; #endif /* XML_DTD */ newDtd->complete = oldDtd->complete; newDtd->standalone = oldDtd->standalone; return 1; } static int copyEntityTable(HASH_TABLE *newTable, STRING_POOL *newPool, const HASH_TABLE *oldTable) { HASH_TABLE_ITER iter; const XML_Char *cachedOldBase = 0; const XML_Char *cachedNewBase = 0; hashTableIterInit(&iter, oldTable); for (;;) { ENTITY *newE; const XML_Char *name; const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); if (!oldE) break; name = poolCopyString(newPool, oldE->name); if (!name) return 0; newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY)); if (!newE) return 0; if (oldE->systemId) { const XML_Char *tem = poolCopyString(newPool, oldE->systemId); if (!tem) return 0; newE->systemId = tem; if (oldE->base) { if (oldE->base == cachedOldBase) newE->base = cachedNewBase; else { cachedOldBase = oldE->base; tem = poolCopyString(newPool, cachedOldBase); if (!tem) return 0; cachedNewBase = newE->base = tem; } } } else { const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen); if (!tem) return 0; newE->textPtr = tem; newE->textLen = oldE->textLen; } if (oldE->notation) { const XML_Char *tem = poolCopyString(newPool, oldE->notation); if (!tem) return 0; newE->notation = tem; } } return 1; } static void poolInit(STRING_POOL *pool) { pool->blocks = 0; pool->freeBlocks = 0; pool->start = 0; pool->ptr = 0; pool->end = 0; } static void poolClear(STRING_POOL *pool) { if (!pool->freeBlocks) pool->freeBlocks = pool->blocks; else { BLOCK *p = pool->blocks; while (p) { BLOCK *tem = p->next; p->next = pool->freeBlocks; pool->freeBlocks = p; p = tem; } } pool->blocks = 0; pool->start = 0; pool->ptr = 0; pool->end = 0; } static void poolDestroy(STRING_POOL *pool) { BLOCK *p = pool->blocks; while (p) { BLOCK *tem = p->next; free(p); p = tem; } pool->blocks = 0; p = pool->freeBlocks; while (p) { BLOCK *tem = p->next; free(p); p = tem; } pool->freeBlocks = 0; pool->ptr = 0; pool->start = 0; pool->end = 0; } static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end) { if (!pool->ptr && !poolGrow(pool)) return 0; for (;;) { XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); if (ptr == end) break; if (!poolGrow(pool)) return 0; } return pool->start; } static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s) { do { if (!poolAppendChar(pool, *s)) return 0; } while (*s++); s = pool->start; poolFinish(pool); return s; } static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) { if (!pool->ptr && !poolGrow(pool)) return 0; for (; n > 0; --n, s++) { if (!poolAppendChar(pool, *s)) return 0; } s = pool->start; poolFinish(pool); return s; } static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end) { if (!poolAppend(pool, enc, ptr, end)) return 0; if (pool->ptr == pool->end && !poolGrow(pool)) return 0; *(pool->ptr)++ = 0; return pool->start; } static int poolGrow(STRING_POOL *pool) { if (pool->freeBlocks) { if (pool->start == 0) { pool->blocks = pool->freeBlocks; pool->freeBlocks = pool->freeBlocks->next; pool->blocks->next = 0; pool->start = pool->blocks->s; pool->end = pool->start + pool->blocks->size; pool->ptr = pool->start; return 1; } if (pool->end - pool->start < pool->freeBlocks->size) { BLOCK *tem = pool->freeBlocks->next; pool->freeBlocks->next = pool->blocks; pool->blocks = pool->freeBlocks; pool->freeBlocks = tem; memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char)); pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s; pool->end = pool->start + pool->blocks->size; return 1; } } if (pool->blocks && pool->start == pool->blocks->s) { int blockSize = (pool->end - pool->start)*2; pool->blocks = realloc(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); if (!pool->blocks) return 0; pool->blocks->size = blockSize; pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s; pool->end = pool->start + blockSize; } else { BLOCK *tem; int blockSize = pool->end - pool->start; if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; else blockSize *= 2; tem = malloc(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); if (!tem) return 0; tem->size = blockSize; tem->next = pool->blocks; pool->blocks = tem; memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char)); pool->ptr = tem->s + (pool->ptr - pool->start); pool->start = tem->s; pool->end = tem->s + blockSize; } return 1; } cadaver-0.23.3/lib/expat/xmlparse/hashtable.h0000664000076400007640000000267110132320456020456 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #ifdef XML_UNICODE #ifdef XML_UNICODE_WCHAR_T typedef const wchar_t *KEY; #else /* not XML_UNICODE_WCHAR_T */ typedef const unsigned short *KEY; #endif /* not XML_UNICODE_WCHAR_T */ #else /* not XML_UNICODE */ typedef const char *KEY; #endif /* not XML_UNICODE */ typedef struct { KEY name; } NAMED; typedef struct { NAMED **v; size_t size; size_t used; size_t usedLim; } HASH_TABLE; NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize); void hashTableInit(HASH_TABLE *); void hashTableDestroy(HASH_TABLE *); typedef struct { NAMED **p; NAMED **end; } HASH_TABLE_ITER; void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); NAMED *hashTableIterNext(HASH_TABLE_ITER *); cadaver-0.23.3/lib/expat/xmlparse/hashtable.c0000664000076400007640000000576710132320456020462 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "xmldef.h" #ifdef XML_UNICODE_WCHAR_T #ifndef XML_UNICODE #define XML_UNICODE #endif #endif #include "hashtable.h" #define INIT_SIZE 64 static int keyeq(KEY s1, KEY s2) { for (; *s1 == *s2; s1++, s2++) if (*s1 == 0) return 1; return 0; } static unsigned long hash(KEY s) { unsigned long h = 0; while (*s) h = (h << 5) + h + (unsigned char)*s++; return h; } NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize) { size_t i; if (table->size == 0) { if (!createSize) return 0; table->v = calloc(INIT_SIZE, sizeof(NAMED *)); if (!table->v) return 0; table->size = INIT_SIZE; table->usedLim = INIT_SIZE / 2; i = hash(name) & (table->size - 1); } else { unsigned long h = hash(name); for (i = h & (table->size - 1); table->v[i]; i == 0 ? i = table->size - 1 : --i) { if (keyeq(name, table->v[i]->name)) return table->v[i]; } if (!createSize) return 0; if (table->used == table->usedLim) { /* check for overflow */ size_t newSize = table->size * 2; NAMED **newV = calloc(newSize, sizeof(NAMED *)); if (!newV) return 0; for (i = 0; i < table->size; i++) if (table->v[i]) { size_t j; for (j = hash(table->v[i]->name) & (newSize - 1); newV[j]; j == 0 ? j = newSize - 1 : --j) ; newV[j] = table->v[i]; } free(table->v); table->v = newV; table->size = newSize; table->usedLim = newSize/2; for (i = h & (table->size - 1); table->v[i]; i == 0 ? i = table->size - 1 : --i) ; } } table->v[i] = calloc(1, createSize); if (!table->v[i]) return 0; table->v[i]->name = name; (table->used)++; return table->v[i]; } void hashTableDestroy(HASH_TABLE *table) { size_t i; for (i = 0; i < table->size; i++) { NAMED *p = table->v[i]; if (p) free(p); } free(table->v); } void hashTableInit(HASH_TABLE *p) { p->size = 0; p->usedLim = 0; p->used = 0; p->v = 0; } void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) { iter->p = table->v; iter->end = iter->p + table->size; } NAMED *hashTableIterNext(HASH_TABLE_ITER *iter) { while (iter->p != iter->end) { NAMED *tem = *(iter->p)++; if (tem) return tem; } return 0; } cadaver-0.23.3/lib/expat/xmlparse/xmlparse.h0000664000076400007640000004543410132320456020362 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef XmlParse_INCLUDED #define XmlParse_INCLUDED 1 #ifdef __cplusplus extern "C" { #endif #ifndef XMLPARSEAPI #define XMLPARSEAPI /* as nothing */ #endif typedef void *XML_Parser; #ifdef XML_UNICODE_WCHAR_T /* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t uses Unicode. */ /* Information is UTF-16 encoded as wchar_ts */ #ifndef XML_UNICODE #define XML_UNICODE #endif #include typedef wchar_t XML_Char; typedef wchar_t XML_LChar; #else /* not XML_UNICODE_WCHAR_T */ #ifdef XML_UNICODE /* Information is UTF-16 encoded as unsigned shorts */ typedef unsigned short XML_Char; typedef char XML_LChar; #else /* not XML_UNICODE */ /* Information is UTF-8 encoded. */ typedef char XML_Char; typedef char XML_LChar; #endif /* not XML_UNICODE */ #endif /* not XML_UNICODE_WCHAR_T */ /* Constructs a new parser; encoding is the encoding specified by the external protocol or null if there is none specified. */ XML_Parser XMLPARSEAPI XML_ParserCreate(const XML_Char *encoding); /* Constructs a new parser and namespace processor. Element type names and attribute names that belong to a namespace will be expanded; unprefixed attribute names are never expanded; unprefixed element type names are expanded only if there is a default namespace. The expanded name is the concatenation of the namespace URI, the namespace separator character, and the local part of the name. If the namespace separator is '\0' then the namespace URI and the local part will be concatenated without any separator. When a namespace is not declared, the name and prefix will be passed through without expansion. */ XML_Parser XMLPARSEAPI XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); /* atts is array of name/value pairs, terminated by 0; names and values are 0 terminated. */ typedef void (*XML_StartElementHandler)(void *userData, const XML_Char *name, const XML_Char **atts); typedef void (*XML_EndElementHandler)(void *userData, const XML_Char *name); /* s is not 0 terminated. */ typedef void (*XML_CharacterDataHandler)(void *userData, const XML_Char *s, int len); /* target and data are 0 terminated */ typedef void (*XML_ProcessingInstructionHandler)(void *userData, const XML_Char *target, const XML_Char *data); /* data is 0 terminated */ typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data); typedef void (*XML_StartCdataSectionHandler)(void *userData); typedef void (*XML_EndCdataSectionHandler)(void *userData); /* This is called for any characters in the XML document for which there is no applicable handler. This includes both characters that are part of markup which is of a kind that is not reported (comments, markup declarations), or characters that are part of a construct which could be reported but for which no handler has been supplied. The characters are passed exactly as they were in the XML document except that they will be encoded in UTF-8. Line boundaries are not normalized. Note that a byte order mark character is not passed to the default handler. There are no guarantees about how characters are divided between calls to the default handler: for example, a comment might be split between multiple calls. */ typedef void (*XML_DefaultHandler)(void *userData, const XML_Char *s, int len); /* This is called for a declaration of an unparsed (NDATA) entity. The base argument is whatever was set by XML_SetBase. The entityName, systemId and notationName arguments will never be null. The other arguments may be. */ typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, const XML_Char *entityName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); /* This is called for a declaration of notation. The base argument is whatever was set by XML_SetBase. The notationName will never be null. The other arguments can be. */ typedef void (*XML_NotationDeclHandler)(void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); /* When namespace processing is enabled, these are called once for each namespace declaration. The call to the start and end element handlers occur between the calls to the start and end namespace declaration handlers. For an xmlns attribute, prefix will be null. For an xmlns="" attribute, uri will be null. */ typedef void (*XML_StartNamespaceDeclHandler)(void *userData, const XML_Char *prefix, const XML_Char *uri); typedef void (*XML_EndNamespaceDeclHandler)(void *userData, const XML_Char *prefix); /* XML declaration handler */ typedef void (*XML_XmlDeclHandler)(void *userdata, const XML_Char *version, const XML_Char *encoding, int standalone); /* This is called if the document is not standalone (it has an external subset or a reference to a parameter entity, but does not have standalone="yes"). If this handler returns 0, then processing will not continue, and the parser will return a XML_ERROR_NOT_STANDALONE error. */ typedef int (*XML_NotStandaloneHandler)(void *userData); /* This is called for a reference to an external parsed general entity. The referenced entity is not automatically parsed. The application can parse it immediately or later using XML_ExternalEntityParserCreate. The parser argument is the parser parsing the entity containing the reference; it can be passed as the parser argument to XML_ExternalEntityParserCreate. The systemId argument is the system identifier as specified in the entity declaration; it will not be null. The base argument is the system identifier that should be used as the base for resolving systemId if systemId was relative; this is set by XML_SetBase; it may be null. The publicId argument is the public identifier as specified in the entity declaration, or null if none was specified; the whitespace in the public identifier will have been normalized as required by the XML spec. The context argument specifies the parsing context in the format expected by the context argument to XML_ExternalEntityParserCreate; context is valid only until the handler returns, so if the referenced entity is to be parsed later, it must be copied. The handler should return 0 if processing should not continue because of a fatal error in the handling of the external entity. In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING error. Note that unlike other handlers the first argument is the parser, not userData. */ typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); /* This structure is filled in by the XML_UnknownEncodingHandler to provide information to the parser about encodings that are unknown to the parser. The map[b] member gives information about byte sequences whose first byte is b. If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c. If map[b] is -1, then the byte sequence is malformed. If map[b] is -n, where n >= 2, then b is the first byte of an n-byte sequence that encodes a single Unicode scalar value. The data member will be passed as the first argument to the convert function. The convert function is used to convert multibyte sequences; s will point to a n-byte sequence where map[(unsigned char)*s] == -n. The convert function must return the Unicode scalar value represented by this byte sequence or -1 if the byte sequence is malformed. The convert function may be null if the encoding is a single-byte encoding, that is if map[b] >= -1 for all bytes b. When the parser is finished with the encoding, then if release is not null, it will call release passing it the data member; once release has been called, the convert function will not be called again. Expat places certain restrictions on the encodings that are supported using this mechanism. 1. Every ASCII character that can appear in a well-formed XML document, other than the characters $@\^`{}~ must be represented by a single byte, and that byte must be the same byte that represents that character in ASCII. 2. No character may require more than 4 bytes to encode. 3. All characters encoded must have Unicode scalar values <= 0xFFFF, (ie characters that would be encoded by surrogates in UTF-16 are not allowed). Note that this restriction doesn't apply to the built-in support for UTF-8 and UTF-16. 4. No Unicode character may be encoded by more than one distinct sequence of bytes. */ typedef struct { int map[256]; void *data; int (*convert)(void *data, const char *s); void (*release)(void *data); } XML_Encoding; /* This is called for an encoding that is unknown to the parser. The encodingHandlerData argument is that which was passed as the second argument to XML_SetUnknownEncodingHandler. The name argument gives the name of the encoding as specified in the encoding declaration. If the callback can provide information about the encoding, it must fill in the XML_Encoding structure, and return 1. Otherwise it must return 0. If info does not describe a suitable encoding, then the parser will return an XML_UNKNOWN_ENCODING error. */ typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); void XMLPARSEAPI XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler); void XMLPARSEAPI XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); void XMLPARSEAPI XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler); void XMLPARSEAPI XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler); void XMLPARSEAPI XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler); void XMLPARSEAPI XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); /* This sets the default handler and also inhibits expansion of internal entities. The entity reference will be passed to the default handler. */ void XMLPARSEAPI XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler); /* This sets the default handler but does not inhibit expansion of internal entities. The entity reference will not be passed to the default handler. */ void XMLPARSEAPI XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler); void XMLPARSEAPI XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler); void XMLPARSEAPI XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler); void XMLPARSEAPI XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); void XMLPARSEAPI XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler); void XMLPARSEAPI XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler); /* If a non-null value for arg is specified here, then it will be passed as the first argument to the external entity ref handler instead of the parser object. */ void XMLPARSEAPI XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); void XMLPARSEAPI XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData); /* This can be called within a handler for a start element, end element, processing instruction or character data. It causes the corresponding markup to be passed to the default handler. */ void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser); /* This value is passed as the userData argument to callbacks. */ void XMLPARSEAPI XML_SetUserData(XML_Parser parser, void *userData); /* Returns the last value set by XML_SetUserData or null. */ #define XML_GetUserData(parser) (*(void **)(parser)) /* This is equivalent to supplying an encoding argument to XML_CreateParser. It must not be called after XML_Parse or XML_ParseBuffer. */ int XMLPARSEAPI XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); /* If this function is called, then the parser will be passed as the first argument to callbacks instead of userData. The userData will still be accessible using XML_GetUserData. */ void XMLPARSEAPI XML_UseParserAsHandlerArg(XML_Parser parser); /* Sets the base to be used for resolving relative URIs in system identifiers in declarations. Resolving relative identifiers is left to the application: this value will be passed through as the base argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base argument will be copied. Returns zero if out of memory, non-zero otherwise. */ int XMLPARSEAPI XML_SetBase(XML_Parser parser, const XML_Char *base); const XML_Char XMLPARSEAPI * XML_GetBase(XML_Parser parser); /* Returns the number of the attributes passed in last call to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. */ int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser); /* Parses some input. Returns 0 if a fatal error is detected. The last call to XML_Parse must have isFinal true; len may be zero for this call (or any other). */ int XMLPARSEAPI XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); void XMLPARSEAPI * XML_GetBuffer(XML_Parser parser, int len); int XMLPARSEAPI XML_ParseBuffer(XML_Parser parser, int len, int isFinal); /* Creates an XML_Parser object that can parse an external general entity; context is a '\0'-terminated string specifying the parse context; encoding is a '\0'-terminated string giving the name of the externally specified encoding, or null if there is no externally specified encoding. The context string consists of a sequence of tokens separated by formfeeds (\f); a token consisting of a name specifies that the general entity of the name is open; a token of the form prefix=uri specifies the namespace for a particular prefix; a token of the form =uri specifies the default namespace. This can be called at any point after the first call to an ExternalEntityRefHandler so longer as the parser has not yet been freed. The new parser is completely independent and may safely be used in a separate thread. The handlers and userData are initialized from the parser argument. Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */ XML_Parser XMLPARSEAPI XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, const XML_Char *encoding); enum XML_ParamEntityParsing { XML_PARAM_ENTITY_PARSING_NEVER, XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, XML_PARAM_ENTITY_PARSING_ALWAYS }; /* Controls parsing of parameter entities (including the external DTD subset). If parsing of parameter entities is enabled, then references to external parameter entities (including the external DTD subset) will be passed to the handler set with XML_SetExternalEntityRefHandler. The context passed will be 0. Unlike external general entities, external parameter entities can only be parsed synchronously. If the external parameter entity is to be parsed, it must be parsed during the call to the external entity ref handler: the complete sequence of XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during this call. After XML_ExternalEntityParserCreate has been called to create the parser for the external parameter entity (context must be 0 for this call), it is illegal to make any calls on the old parser until XML_ParserFree has been called on the newly created parser. If the library has been compiled without support for parameter entity parsing (ie without XML_DTD being defined), then XML_SetParamEntityParsing will return 0 if parsing of parameter entities is requested; otherwise it will return non-zero. */ int XMLPARSEAPI XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing parsing); enum XML_Error { XML_ERROR_NONE, XML_ERROR_NO_MEMORY, XML_ERROR_SYNTAX, XML_ERROR_NO_ELEMENTS, XML_ERROR_INVALID_TOKEN, XML_ERROR_UNCLOSED_TOKEN, XML_ERROR_PARTIAL_CHAR, XML_ERROR_TAG_MISMATCH, XML_ERROR_DUPLICATE_ATTRIBUTE, XML_ERROR_JUNK_AFTER_DOC_ELEMENT, XML_ERROR_PARAM_ENTITY_REF, XML_ERROR_UNDEFINED_ENTITY, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_ASYNC_ENTITY, XML_ERROR_BAD_CHAR_REF, XML_ERROR_BINARY_ENTITY_REF, XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, XML_ERROR_MISPLACED_XML_PI, XML_ERROR_UNKNOWN_ENCODING, XML_ERROR_INCORRECT_ENCODING, XML_ERROR_UNCLOSED_CDATA_SECTION, XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_NOT_STANDALONE }; /* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode returns information about the error. */ enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser); /* These functions return information about the current parse location. They may be called when XML_Parse or XML_ParseBuffer return 0; in this case the location is the location of the character at which the error was detected. They may also be called from any other callback called to report some parse event; in this the location is the location of the first of the sequence of characters that generated the event. */ int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser); int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser); long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); /* Return the number of bytes in the current event. Returns 0 if the event is in an internal entity. */ int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser); /* For backwards compatibility with previous versions. */ #define XML_GetErrorLineNumber XML_GetCurrentLineNumber #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber #define XML_GetErrorByteIndex XML_GetCurrentByteIndex /* Frees memory used by the parser. */ void XMLPARSEAPI XML_ParserFree(XML_Parser parser); /* Returns a string describing the error. */ const XML_LChar XMLPARSEAPI *XML_ErrorString(int code); #ifdef __cplusplus } #endif #endif /* not XmlParse_INCLUDED */ cadaver-0.23.3/lib/expat/ChangeLog0000664000076400007640000000123310132700136016257 0ustar jortonjortonMon Sep 6 13:59:42 1999 Joe Orton * Makefile: Removed file. Wed Aug 25 08:47:24 1999 Joe Orton * gennmtab/.cvsignore: Add gennmtab Tue Aug 24 18:53:54 1999 Joe Orton * xmltok/xmltok.h: Added void to XmlGetUtf8InternalEncodingNS, XmlGetUtf16InternalEncodingNS declarations to make them proper prototypes. Tue Aug 24 18:52:37 1999 Joe Orton * */*. Import of expat-19990709 sources. * sample/*, xmlwf/*: Removed unneeded code. * bin/*, lib/*, */*.dsp, expat.dsw: Removed Win32-specific files. * */*.[ch], expat.html: Elect to use GPL over MPL. cadaver-0.23.3/lib/expat/gennmtab/0000775000076400007640000000000011312007507016304 5ustar jortonjortoncadaver-0.23.3/lib/expat/gennmtab/gennmtab.c0000664000076400007640000002207610132320456020252 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include struct range { int start; int end; }; struct range nmstrt[] = { { '_' }, { ':' }, /* BaseChar */ { 0x0041, 0x005a }, { 0x0061, 0x007a }, { 0x00c0, 0x00d6 }, { 0x00d8, 0x00f6 }, { 0x00f8, 0x00ff }, { 0x0100, 0x0131 }, { 0x0134, 0x013e }, { 0x0141, 0x0148 }, { 0x014a, 0x017e }, { 0x0180, 0x01c3 }, { 0x01cd, 0x01f0 }, { 0x01f4, 0x01f5 }, { 0x01fa, 0x0217 }, { 0x0250, 0x02a8 }, { 0x02bb, 0x02c1 }, { 0x0386 }, { 0x0388, 0x038a }, { 0x038c }, { 0x038e, 0x03a1 }, { 0x03a3, 0x03ce }, { 0x03d0, 0x03d6 }, { 0x03da }, { 0x03dc }, { 0x03de }, { 0x03e0 }, { 0x03e2, 0x03f3 }, { 0x0401, 0x040c }, { 0x040e, 0x044f }, { 0x0451, 0x045c }, { 0x045e, 0x0481 }, { 0x0490, 0x04c4 }, { 0x04c7, 0x04c8 }, { 0x04cb, 0x04cc }, { 0x04d0, 0x04eb }, { 0x04ee, 0x04f5 }, { 0x04f8, 0x04f9 }, { 0x0531, 0x0556 }, { 0x0559 }, { 0x0561, 0x0586 }, { 0x05d0, 0x05ea }, { 0x05f0, 0x05f2 }, { 0x0621, 0x063a }, { 0x0641, 0x064a }, { 0x0671, 0x06b7 }, { 0x06ba, 0x06be }, { 0x06c0, 0x06ce }, { 0x06d0, 0x06d3 }, { 0x06d5 }, { 0x06e5, 0x06e6 }, { 0x0905, 0x0939 }, { 0x093d }, { 0x0958, 0x0961 }, { 0x0985, 0x098c }, { 0x098f, 0x0990 }, { 0x0993, 0x09a8 }, { 0x09aa, 0x09b0 }, { 0x09b2 }, { 0x09b6, 0x09b9 }, { 0x09dc, 0x09dd }, { 0x09df, 0x09e1 }, { 0x09f0, 0x09f1 }, { 0x0a05, 0x0a0a }, { 0x0a0f, 0x0a10 }, { 0x0a13, 0x0a28 }, { 0x0a2a, 0x0a30 }, { 0x0a32, 0x0a33 }, { 0x0a35, 0x0a36 }, { 0x0a38, 0x0a39 }, { 0x0a59, 0x0a5c }, { 0x0a5e }, { 0x0a72, 0x0a74 }, { 0x0a85, 0x0a8b }, { 0x0a8d }, { 0x0a8f, 0x0a91 }, { 0x0a93, 0x0aa8 }, { 0x0aaa, 0x0ab0 }, { 0x0ab2, 0x0ab3 }, { 0x0ab5, 0x0ab9 }, { 0x0abd }, { 0x0ae0 }, { 0x0b05, 0x0b0c }, { 0x0b0f, 0x0b10 }, { 0x0b13, 0x0b28 }, { 0x0b2a, 0x0b30 }, { 0x0b32, 0x0b33 }, { 0x0b36, 0x0b39 }, { 0x0b3d }, { 0x0b5c, 0x0b5d }, { 0x0b5f, 0x0b61 }, { 0x0b85, 0x0b8a }, { 0x0b8e, 0x0b90 }, { 0x0b92, 0x0b95 }, { 0x0b99, 0x0b9a }, { 0x0b9c }, { 0x0b9e, 0x0b9f }, { 0x0ba3, 0x0ba4 }, { 0x0ba8, 0x0baa }, { 0x0bae, 0x0bb5 }, { 0x0bb7, 0x0bb9 }, { 0x0c05, 0x0c0c }, { 0x0c0e, 0x0c10 }, { 0x0c12, 0x0c28 }, { 0x0c2a, 0x0c33 }, { 0x0c35, 0x0c39 }, { 0x0c60, 0x0c61 }, { 0x0c85, 0x0c8c }, { 0x0c8e, 0x0c90 }, { 0x0c92, 0x0ca8 }, { 0x0caa, 0x0cb3 }, { 0x0cb5, 0x0cb9 }, { 0x0cde }, { 0x0ce0, 0x0ce1 }, { 0x0d05, 0x0d0c }, { 0x0d0e, 0x0d10 }, { 0x0d12, 0x0d28 }, { 0x0d2a, 0x0d39 }, { 0x0d60, 0x0d61 }, { 0x0e01, 0x0e2e }, { 0x0e30 }, { 0x0e32, 0x0e33 }, { 0x0e40, 0x0e45 }, { 0x0e81, 0x0e82 }, { 0x0e84 }, { 0x0e87, 0x0e88 }, { 0x0e8a }, { 0x0e8d }, { 0x0e94, 0x0e97 }, { 0x0e99, 0x0e9f }, { 0x0ea1, 0x0ea3 }, { 0x0ea5 }, { 0x0ea7 }, { 0x0eaa, 0x0eab }, { 0x0ead, 0x0eae }, { 0x0eb0 }, { 0x0eb2, 0x0eb3 }, { 0x0ebd }, { 0x0ec0, 0x0ec4 }, { 0x0f40, 0x0f47 }, { 0x0f49, 0x0f69 }, { 0x10a0, 0x10c5 }, { 0x10d0, 0x10f6 }, { 0x1100 }, { 0x1102, 0x1103 }, { 0x1105, 0x1107 }, { 0x1109 }, { 0x110b, 0x110c }, { 0x110e, 0x1112 }, { 0x113c }, { 0x113e }, { 0x1140 }, { 0x114c }, { 0x114e }, { 0x1150 }, { 0x1154, 0x1155 }, { 0x1159 }, { 0x115f, 0x1161 }, { 0x1163 }, { 0x1165 }, { 0x1167 }, { 0x1169 }, { 0x116d, 0x116e }, { 0x1172, 0x1173 }, { 0x1175 }, { 0x119e }, { 0x11a8 }, { 0x11ab }, { 0x11ae, 0x11af }, { 0x11b7, 0x11b8 }, { 0x11ba }, { 0x11bc, 0x11c2 }, { 0x11eb }, { 0x11f0 }, { 0x11f9 }, { 0x1e00, 0x1e9b }, { 0x1ea0, 0x1ef9 }, { 0x1f00, 0x1f15 }, { 0x1f18, 0x1f1d }, { 0x1f20, 0x1f45 }, { 0x1f48, 0x1f4d }, { 0x1f50, 0x1f57 }, { 0x1f59 }, { 0x1f5b }, { 0x1f5d }, { 0x1f5f, 0x1f7d }, { 0x1f80, 0x1fb4 }, { 0x1fb6, 0x1fbc }, { 0x1fbe }, { 0x1fc2, 0x1fc4 }, { 0x1fc6, 0x1fcc }, { 0x1fd0, 0x1fd3 }, { 0x1fd6, 0x1fdb }, { 0x1fe0, 0x1fec }, { 0x1ff2, 0x1ff4 }, { 0x1ff6, 0x1ffc }, { 0x2126 }, { 0x212a, 0x212b }, { 0x212e }, { 0x2180, 0x2182 }, { 0x3041, 0x3094 }, { 0x30a1, 0x30fa }, { 0x3105, 0x312c }, { 0xac00, 0xd7a3 }, /* Ideographic */ { 0x4e00, 0x9fa5 }, { 0x3007 }, { 0x3021, 0x3029 }, }; /* name chars that are not name start chars */ struct range name[] = { { '.' }, { '-' }, /* CombiningChar */ { 0x0300, 0x0345 }, { 0x0360, 0x0361 }, { 0x0483, 0x0486 }, { 0x0591, 0x05a1 }, { 0x05a3, 0x05b9 }, { 0x05bb, 0x05bd }, { 0x05bf }, { 0x05c1, 0x05c2 }, { 0x05c4 }, { 0x064b, 0x0652 }, { 0x0670 }, { 0x06d6, 0x06dc }, { 0x06dd, 0x06df }, { 0x06e0, 0x06e4 }, { 0x06e7, 0x06e8 }, { 0x06ea, 0x06ed }, { 0x0901, 0x0903 }, { 0x093c }, { 0x093e, 0x094c }, { 0x094d }, { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0983 }, { 0x09bc }, { 0x09be }, { 0x09bf }, { 0x09c0, 0x09c4 }, { 0x09c7, 0x09c8 }, { 0x09cb, 0x09cd }, { 0x09d7 }, { 0x09e2, 0x09e3 }, { 0x0a02 }, { 0x0a3c }, { 0x0a3e }, { 0x0a3f }, { 0x0a40, 0x0a42 }, { 0x0a47, 0x0a48 }, { 0x0a4b, 0x0a4d }, { 0x0a70, 0x0a71 }, { 0x0a81, 0x0a83 }, { 0x0abc }, { 0x0abe, 0x0ac5 }, { 0x0ac7, 0x0ac9 }, { 0x0acb, 0x0acd }, { 0x0b01, 0x0b03 }, { 0x0b3c }, { 0x0b3e, 0x0b43 }, { 0x0b47, 0x0b48 }, { 0x0b4b, 0x0b4d }, { 0x0b56, 0x0b57 }, { 0x0b82, 0x0b83 }, { 0x0bbe, 0x0bc2 }, { 0x0bc6, 0x0bc8 }, { 0x0bca, 0x0bcd }, { 0x0bd7 }, { 0x0c01, 0x0c03 }, { 0x0c3e, 0x0c44 }, { 0x0c46, 0x0c48 }, { 0x0c4a, 0x0c4d }, { 0x0c55, 0x0c56 }, { 0x0c82, 0x0c83 }, { 0x0cbe, 0x0cc4 }, { 0x0cc6, 0x0cc8 }, { 0x0cca, 0x0ccd }, { 0x0cd5, 0x0cd6 }, { 0x0d02, 0x0d03 }, { 0x0d3e, 0x0d43 }, { 0x0d46, 0x0d48 }, { 0x0d4a, 0x0d4d }, { 0x0d57 }, { 0x0e31 }, { 0x0e34, 0x0e3a }, { 0x0e47, 0x0e4e }, { 0x0eb1 }, { 0x0eb4, 0x0eb9 }, { 0x0ebb, 0x0ebc }, { 0x0ec8, 0x0ecd }, { 0x0f18, 0x0f19 }, { 0x0f35 }, { 0x0f37 }, { 0x0f39 }, { 0x0f3e }, { 0x0f3f }, { 0x0f71, 0x0f84 }, { 0x0f86, 0x0f8b }, { 0x0f90, 0x0f95 }, { 0x0f97 }, { 0x0f99, 0x0fad }, { 0x0fb1, 0x0fb7 }, { 0x0fb9 }, { 0x20d0, 0x20dc }, { 0x20e1 }, { 0x302a, 0x302f }, { 0x3099 }, { 0x309a }, /* Digit */ { 0x0030, 0x0039 }, { 0x0660, 0x0669 }, { 0x06f0, 0x06f9 }, { 0x0966, 0x096f }, { 0x09e6, 0x09ef }, { 0x0a66, 0x0a6f }, { 0x0ae6, 0x0aef }, { 0x0b66, 0x0b6f }, { 0x0be7, 0x0bef }, { 0x0c66, 0x0c6f }, { 0x0ce6, 0x0cef }, { 0x0d66, 0x0d6f }, { 0x0e50, 0x0e59 }, { 0x0ed0, 0x0ed9 }, { 0x0f20, 0x0f29 }, /* Extender */ { 0xb7 }, { 0x02d0 }, { 0x02d1 }, { 0x0387 }, { 0x0640 }, { 0x0e46 }, { 0x0ec6 }, { 0x3005 }, { 0x3031, 0x3035 }, { 0x309d, 0x309e }, { 0x30fc, 0x30fe }, }; void setTab(char *tab, struct range *ranges, size_t nRanges) { size_t i; int j; for (i = 0; i < nRanges; i++) { if (ranges[i].end) { for (j = ranges[i].start; j <= ranges[i].end; j++) tab[j] = 1; } else tab[ranges[i].start] = 1; } } void printTabs(char *tab) { int nBitmaps = 2; int i, j, k; unsigned char pageIndex[512]; printf( "static const unsigned namingBitmap[] = {\n\ 0x00000000, 0x00000000, 0x00000000, 0x00000000,\n\ 0x00000000, 0x00000000, 0x00000000, 0x00000000,\n\ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n\ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n"); for (i = 0; i < 512; i++) { int kind = tab[i*256]; for (j = 1; j < 256; j++) if (tab[i*256 +j] != kind) { kind = -1; break; } if (i >= 256 && memcmp(tab + (i - 256)*256, tab + i*256, 256) == 0) pageIndex[i] = pageIndex[i - 256]; else if (kind == -1) { pageIndex[i] = nBitmaps++; for (j = 0; j < 8; j++) { unsigned val = 0; for (k = 0; k < 32; k++) { if (tab[i*256 + j*32 +k]) val |= (1 << k); } printf("0x%08X,", val); putchar((((j + 1) & 3) == 0) ? '\n' : ' '); } } else pageIndex[i] = kind; } printf("};\n"); printf("static const unsigned char nmstrtPages[] = {\n"); for (i = 0; i < 512; i++) { if (i == 256) printf("};\nstatic const unsigned char namePages[] = {\n"); printf("0x%02X,", pageIndex[i]); putchar((((i + 1) & 7) == 0) ? '\n' : ' '); } printf("};\n"); } int main() { char tab[2*65536]; memset(tab, 0, 65536); setTab(tab, nmstrt, sizeof(nmstrt)/sizeof(nmstrt[0])); memcpy(tab + 65536, tab, 65536); setTab(tab + 65536, name, sizeof(name)/sizeof(name[0])); printTabs(tab); return 0; } cadaver-0.23.3/lib/expat/xmltok/0000775000076400007640000000000011312007507016027 5ustar jortonjortoncadaver-0.23.3/lib/expat/xmltok/iasciitab.h0000664000076400007640000000461710132320456020140 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, cadaver-0.23.3/lib/expat/xmltok/latin1tab.h0000664000076400007640000000457610132320456020073 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, cadaver-0.23.3/lib/expat/xmltok/xmlrole.h0000664000076400007640000000575710132320456017700 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef XmlRole_INCLUDED #define XmlRole_INCLUDED 1 #include "xmltok.h" #ifdef __cplusplus extern "C" { #endif enum { XML_ROLE_ERROR = -1, XML_ROLE_NONE = 0, XML_ROLE_XML_DECL, XML_ROLE_INSTANCE_START, XML_ROLE_DOCTYPE_NAME, XML_ROLE_DOCTYPE_SYSTEM_ID, XML_ROLE_DOCTYPE_PUBLIC_ID, XML_ROLE_DOCTYPE_CLOSE, XML_ROLE_GENERAL_ENTITY_NAME, XML_ROLE_PARAM_ENTITY_NAME, XML_ROLE_ENTITY_VALUE, XML_ROLE_ENTITY_SYSTEM_ID, XML_ROLE_ENTITY_PUBLIC_ID, XML_ROLE_ENTITY_NOTATION_NAME, XML_ROLE_NOTATION_NAME, XML_ROLE_NOTATION_SYSTEM_ID, XML_ROLE_NOTATION_NO_SYSTEM_ID, XML_ROLE_NOTATION_PUBLIC_ID, XML_ROLE_ATTRIBUTE_NAME, XML_ROLE_ATTRIBUTE_TYPE_CDATA, XML_ROLE_ATTRIBUTE_TYPE_ID, XML_ROLE_ATTRIBUTE_TYPE_IDREF, XML_ROLE_ATTRIBUTE_TYPE_IDREFS, XML_ROLE_ATTRIBUTE_TYPE_ENTITY, XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, XML_ROLE_ATTRIBUTE_ENUM_VALUE, XML_ROLE_ATTRIBUTE_NOTATION_VALUE, XML_ROLE_ATTLIST_ELEMENT_NAME, XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, XML_ROLE_FIXED_ATTRIBUTE_VALUE, XML_ROLE_ELEMENT_NAME, XML_ROLE_CONTENT_ANY, XML_ROLE_CONTENT_EMPTY, XML_ROLE_CONTENT_PCDATA, XML_ROLE_GROUP_OPEN, XML_ROLE_GROUP_CLOSE, XML_ROLE_GROUP_CLOSE_REP, XML_ROLE_GROUP_CLOSE_OPT, XML_ROLE_GROUP_CLOSE_PLUS, XML_ROLE_GROUP_CHOICE, XML_ROLE_GROUP_SEQUENCE, XML_ROLE_CONTENT_ELEMENT, XML_ROLE_CONTENT_ELEMENT_REP, XML_ROLE_CONTENT_ELEMENT_OPT, XML_ROLE_CONTENT_ELEMENT_PLUS, #ifdef XML_DTD XML_ROLE_TEXT_DECL, XML_ROLE_IGNORE_SECT, XML_ROLE_INNER_PARAM_ENTITY_REF, #endif /* XML_DTD */ XML_ROLE_PARAM_ENTITY_REF }; typedef struct prolog_state { int (*handler)(struct prolog_state *state, int tok, const char *ptr, const char *end, const ENCODING *enc); unsigned level; #ifdef XML_DTD unsigned includeLevel; int documentEntity; #endif /* XML_DTD */ } PROLOG_STATE; void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *); #ifdef XML_DTD void XMLTOKAPI XmlPrologStateInitExternalEntity(PROLOG_STATE *); #endif /* XML_DTD */ #define XmlTokenRole(state, tok, ptr, end, enc) \ (((state)->handler)(state, tok, ptr, end, enc)) #ifdef __cplusplus } #endif #endif /* not XmlRole_INCLUDED */ cadaver-0.23.3/lib/expat/xmltok/asciitab.h0000664000076400007640000000451110132320456017760 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, cadaver-0.23.3/lib/expat/xmltok/xmltok_impl.c0000664000076400007640000012007610132320456020540 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef IS_INVALID_CHAR #define IS_INVALID_CHAR(enc, ptr, n) (0) #endif #define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (IS_INVALID_CHAR(enc, ptr, n)) { \ *(nextTokPtr) = (ptr); \ return XML_TOK_INVALID; \ } \ ptr += n; \ break; #define INVALID_CASES(ptr, nextTokPtr) \ INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ case BT_NONXML: \ case BT_MALFORM: \ case BT_TRAIL: \ *(nextTokPtr) = (ptr); \ return XML_TOK_INVALID; #define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (!IS_NAME_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ ptr += n; \ break; #define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ case BT_NONASCII: \ if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ case BT_NMSTRT: \ case BT_HEX: \ case BT_DIGIT: \ case BT_NAME: \ case BT_MINUS: \ ptr += MINBPC(enc); \ break; \ CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) #define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ ptr += n; \ break; #define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ case BT_NONASCII: \ if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ case BT_NMSTRT: \ case BT_HEX: \ ptr += MINBPC(enc); \ break; \ CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) #ifndef PREFIX #define PREFIX(ident) ident #endif /* ptr points to character following "')) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_COMMENT; } break; default: ptr += MINBPC(enc); break; } } } return XML_TOK_PARTIAL; } /* ptr points to character following " */ switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: *nextTokPtr = ptr; return XML_TOK_INVALID; } /* fall through */ case BT_S: case BT_CR: case BT_LF: *nextTokPtr = ptr; return XML_TOK_DECL_OPEN; case BT_NMSTRT: case BT_HEX: ptr += MINBPC(enc); break; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return XML_TOK_PARTIAL; } static int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr) { int upper = 0; *tokPtr = XML_TOK_PI; if (end - ptr != MINBPC(enc)*3) return 1; switch (BYTE_TO_ASCII(enc, ptr)) { case 'x': break; case 'X': upper = 1; break; default: return 1; } ptr += MINBPC(enc); switch (BYTE_TO_ASCII(enc, ptr)) { case 'm': break; case 'M': upper = 1; break; default: return 1; } ptr += MINBPC(enc); switch (BYTE_TO_ASCII(enc, ptr)) { case 'l': break; case 'L': upper = 1; break; default: return 1; } if (upper) return 0; *tokPtr = XML_TOK_XML_DECL; return 1; } /* ptr points to character following "')) { *nextTokPtr = ptr + MINBPC(enc); return tok; } break; default: ptr += MINBPC(enc); break; } } return XML_TOK_PARTIAL; case BT_QUEST: if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) { *nextTokPtr = ptr; return XML_TOK_INVALID; } ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, '>')) { *nextTokPtr = ptr + MINBPC(enc); return tok; } /* fall through */ default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return XML_TOK_PARTIAL; } static int PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { int i; /* CDATA[ */ if (end - ptr < 6 * MINBPC(enc)) return XML_TOK_PARTIAL; for (i = 0; i < 6; i++, ptr += MINBPC(enc)) { if (!CHAR_MATCHES(enc, ptr, "CDATA["[i])) { *nextTokPtr = ptr; return XML_TOK_INVALID; } } *nextTokPtr = ptr; return XML_TOK_CDATA_SECT_OPEN; } static int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { if (ptr == end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); if (n == 0) return XML_TOK_PARTIAL; end = ptr + n; } } switch (BYTE_TYPE(enc, ptr)) { case BT_RSQB: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (!CHAR_MATCHES(enc, ptr, ']')) break; ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (!CHAR_MATCHES(enc, ptr, '>')) { ptr -= MINBPC(enc); break; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CDATA_SECT_CLOSE; case BT_CR: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; case BT_LF: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; INVALID_CASES(ptr, nextTokPtr) default: ptr += MINBPC(enc); break; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_DATA_CHARS; \ } \ ptr += n; \ break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NONXML: case BT_MALFORM: case BT_TRAIL: case BT_CR: case BT_LF: case BT_RSQB: *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } /* ptr points to character following "')) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_EMPTY_ELEMENT_WITH_ATTS; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } break; } break; } default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return XML_TOK_PARTIAL; } /* ptr points to character following "<" */ static int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { #ifdef XML_NS int hadColon; #endif if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_EXCL: if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { case BT_MINUS: return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_LSQB: return PREFIX(scanCdataSection)(enc, ptr + MINBPC(enc), end, nextTokPtr); } *nextTokPtr = ptr; return XML_TOK_INVALID; case BT_QUEST: return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_SOL: return PREFIX(scanEndTag)(enc, ptr + MINBPC(enc), end, nextTokPtr); default: *nextTokPtr = ptr; return XML_TOK_INVALID; } #ifdef XML_NS hadColon = 0; #endif /* we have a start-tag */ while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) #ifdef XML_NS case BT_COLON: if (hadColon) { *nextTokPtr = ptr; return XML_TOK_INVALID; } hadColon = 1; ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: *nextTokPtr = ptr; return XML_TOK_INVALID; } break; #endif case BT_S: case BT_CR: case BT_LF: { ptr += MINBPC(enc); while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_GT: goto gt; case BT_SOL: goto sol; case BT_S: case BT_CR: case BT_LF: ptr += MINBPC(enc); continue; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } return PREFIX(scanAtts)(enc, ptr, end, nextTokPtr); } return XML_TOK_PARTIAL; } case BT_GT: gt: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_START_TAG_NO_ATTS; case BT_SOL: sol: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (!CHAR_MATCHES(enc, ptr, '>')) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_EMPTY_ELEMENT_NO_ATTS; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return XML_TOK_PARTIAL; } static int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { if (ptr == end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); if (n == 0) return XML_TOK_PARTIAL; end = ptr + n; } } switch (BYTE_TYPE(enc, ptr)) { case BT_LT: return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_AMP: return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_CR: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; case BT_LF: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; case BT_RSQB: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_RSQB; if (!CHAR_MATCHES(enc, ptr, ']')) break; ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_RSQB; if (!CHAR_MATCHES(enc, ptr, '>')) { ptr -= MINBPC(enc); break; } *nextTokPtr = ptr; return XML_TOK_INVALID; INVALID_CASES(ptr, nextTokPtr) default: ptr += MINBPC(enc); break; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_DATA_CHARS; \ } \ ptr += n; \ break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_RSQB: if (ptr + MINBPC(enc) != end) { if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ']')) { ptr += MINBPC(enc); break; } if (ptr + 2*MINBPC(enc) != end) { if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), '>')) { ptr += MINBPC(enc); break; } *nextTokPtr = ptr + 2*MINBPC(enc); return XML_TOK_INVALID; } } /* fall through */ case BT_AMP: case BT_LT: case BT_NONXML: case BT_MALFORM: case BT_TRAIL: case BT_CR: case BT_LF: *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } /* ptr points to character following "%" */ static int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: *nextTokPtr = ptr; return XML_TOK_PERCENT; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_SEMI: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_PARAM_ENTITY_REF; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return XML_TOK_PARTIAL; } static int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: *nextTokPtr = ptr; return XML_TOK_INVALID; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_CR: case BT_LF: case BT_S: case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: *nextTokPtr = ptr; return XML_TOK_POUND_NAME; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return -XML_TOK_POUND_NAME; } static int PREFIX(scanLit)(int open, const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { while (ptr != end) { int t = BYTE_TYPE(enc, ptr); switch (t) { INVALID_CASES(ptr, nextTokPtr) case BT_QUOT: case BT_APOS: ptr += MINBPC(enc); if (t != open) break; if (ptr == end) return -XML_TOK_LITERAL; *nextTokPtr = ptr; switch (BYTE_TYPE(enc, ptr)) { case BT_S: case BT_CR: case BT_LF: case BT_GT: case BT_PERCNT: case BT_LSQB: return XML_TOK_LITERAL; default: return XML_TOK_INVALID; } default: ptr += MINBPC(enc); break; } } return XML_TOK_PARTIAL; } static int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { int tok; if (ptr == end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); if (n == 0) return XML_TOK_PARTIAL; end = ptr + n; } } switch (BYTE_TYPE(enc, ptr)) { case BT_QUOT: return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_APOS: return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_LT: { ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { case BT_EXCL: return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_QUEST: return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_NMSTRT: case BT_HEX: case BT_NONASCII: case BT_LEAD2: case BT_LEAD3: case BT_LEAD4: *nextTokPtr = ptr - MINBPC(enc); return XML_TOK_INSTANCE_START; } *nextTokPtr = ptr; return XML_TOK_INVALID; } case BT_CR: if (ptr + MINBPC(enc) == end) return -XML_TOK_PROLOG_S; /* fall through */ case BT_S: case BT_LF: for (;;) { ptr += MINBPC(enc); if (ptr == end) break; switch (BYTE_TYPE(enc, ptr)) { case BT_S: case BT_LF: break; case BT_CR: /* don't split CR/LF pair */ if (ptr + MINBPC(enc) != end) break; /* fall through */ default: *nextTokPtr = ptr; return XML_TOK_PROLOG_S; } } *nextTokPtr = ptr; return XML_TOK_PROLOG_S; case BT_PERCNT: return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_COMMA: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_COMMA; case BT_LSQB: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_OPEN_BRACKET; case BT_RSQB: ptr += MINBPC(enc); if (ptr == end) return -XML_TOK_CLOSE_BRACKET; if (CHAR_MATCHES(enc, ptr, ']')) { if (ptr + MINBPC(enc) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr + MINBPC(enc), '>')) { *nextTokPtr = ptr + 2*MINBPC(enc); return XML_TOK_COND_SECT_CLOSE; } } *nextTokPtr = ptr; return XML_TOK_CLOSE_BRACKET; case BT_LPAR: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_OPEN_PAREN; case BT_RPAR: ptr += MINBPC(enc); if (ptr == end) return -XML_TOK_CLOSE_PAREN; switch (BYTE_TYPE(enc, ptr)) { case BT_AST: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CLOSE_PAREN_ASTERISK; case BT_QUEST: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CLOSE_PAREN_QUESTION; case BT_PLUS: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CLOSE_PAREN_PLUS; case BT_CR: case BT_LF: case BT_S: case BT_GT: case BT_COMMA: case BT_VERBAR: case BT_RPAR: *nextTokPtr = ptr; return XML_TOK_CLOSE_PAREN; } *nextTokPtr = ptr; return XML_TOK_INVALID; case BT_VERBAR: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_OR; case BT_GT: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DECL_CLOSE; case BT_NUM: return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ ptr += n; \ tok = XML_TOK_NAME; \ break; \ } \ if (IS_NAME_CHAR(enc, ptr, n)) { \ ptr += n; \ tok = XML_TOK_NMTOKEN; \ break; \ } \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NMSTRT: case BT_HEX: tok = XML_TOK_NAME; ptr += MINBPC(enc); break; case BT_DIGIT: case BT_NAME: case BT_MINUS: #ifdef XML_NS case BT_COLON: #endif tok = XML_TOK_NMTOKEN; ptr += MINBPC(enc); break; case BT_NONASCII: if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { ptr += MINBPC(enc); tok = XML_TOK_NAME; break; } if (IS_NAME_CHAR_MINBPC(enc, ptr)) { ptr += MINBPC(enc); tok = XML_TOK_NMTOKEN; break; } /* fall through */ default: *nextTokPtr = ptr; return XML_TOK_INVALID; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_GT: case BT_RPAR: case BT_COMMA: case BT_VERBAR: case BT_LSQB: case BT_PERCNT: case BT_S: case BT_CR: case BT_LF: *nextTokPtr = ptr; return tok; #ifdef XML_NS case BT_COLON: ptr += MINBPC(enc); switch (tok) { case XML_TOK_NAME: if (ptr == end) return XML_TOK_PARTIAL; tok = XML_TOK_PREFIXED_NAME; switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) default: tok = XML_TOK_NMTOKEN; break; } break; case XML_TOK_PREFIXED_NAME: tok = XML_TOK_NMTOKEN; break; } break; #endif case BT_PLUS: if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_PLUS; case BT_AST: if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_ASTERISK; case BT_QUEST: if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_QUESTION; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return -tok; } static int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { const char *start; if (ptr == end) return XML_TOK_NONE; start = ptr; while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_AMP: if (ptr == start) return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_LT: /* this is for inside entity references */ *nextTokPtr = ptr; return XML_TOK_INVALID; case BT_LF: if (ptr == start) { *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_CR: if (ptr == start) { ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_S: if (ptr == start) { *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_ATTRIBUTE_VALUE_S; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } static int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { const char *start; if (ptr == end) return XML_TOK_NONE; start = ptr; while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_AMP: if (ptr == start) return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_PERCNT: if (ptr == start) return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_LF: if (ptr == start) { *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_CR: if (ptr == start) { ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } #ifdef XML_DTD static int PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { int level = 0; if (MINBPC(enc) > 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); end = ptr + n; } } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { INVALID_CASES(ptr, nextTokPtr) case BT_LT: if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, '!')) { if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, '[')) { ++level; ptr += MINBPC(enc); } } break; case BT_RSQB: if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, ']')) { if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, '>')) { ptr += MINBPC(enc); if (level == 0) { *nextTokPtr = ptr; return XML_TOK_IGNORE_SECT; } --level; } } break; default: ptr += MINBPC(enc); break; } } return XML_TOK_PARTIAL; } #endif /* XML_DTD */ static int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, const char **badPtr) { ptr += MINBPC(enc); end -= MINBPC(enc); for (; ptr != end; ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { case BT_DIGIT: case BT_HEX: case BT_MINUS: case BT_APOS: case BT_LPAR: case BT_RPAR: case BT_PLUS: case BT_COMMA: case BT_SOL: case BT_EQUALS: case BT_QUEST: case BT_CR: case BT_LF: case BT_SEMI: case BT_EXCL: case BT_AST: case BT_PERCNT: case BT_NUM: #ifdef XML_NS case BT_COLON: #endif break; case BT_S: if (CHAR_MATCHES(enc, ptr, '\t')) { *badPtr = ptr; return 0; } break; case BT_NAME: case BT_NMSTRT: if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) break; default: switch (BYTE_TO_ASCII(enc, ptr)) { case 0x24: /* $ */ case 0x40: /* @ */ break; default: *badPtr = ptr; return 0; } break; } } return 1; } /* This must only be called for a well-formed start-tag or empty element tag. Returns the number of attributes. Pointers to the first attsMax attributes are stored in atts. */ static int PREFIX(getAtts)(const ENCODING *enc, const char *ptr, int attsMax, ATTRIBUTE *atts) { enum { other, inName, inValue } state = inName; int nAtts = 0; int open = 0; /* defined when state == inValue; initialization just to shut up compilers */ for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { #define START_NAME \ if (state == other) { \ if (nAtts < attsMax) { \ atts[nAtts].name = ptr; \ atts[nAtts].normalized = 1; \ } \ state = inName; \ } #define LEAD_CASE(n) \ case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NONASCII: case BT_NMSTRT: case BT_HEX: START_NAME break; #undef START_NAME case BT_QUOT: if (state != inValue) { if (nAtts < attsMax) atts[nAtts].valuePtr = ptr + MINBPC(enc); state = inValue; open = BT_QUOT; } else if (open == BT_QUOT) { state = other; if (nAtts < attsMax) atts[nAtts].valueEnd = ptr; nAtts++; } break; case BT_APOS: if (state != inValue) { if (nAtts < attsMax) atts[nAtts].valuePtr = ptr + MINBPC(enc); state = inValue; open = BT_APOS; } else if (open == BT_APOS) { state = other; if (nAtts < attsMax) atts[nAtts].valueEnd = ptr; nAtts++; } break; case BT_AMP: if (nAtts < attsMax) atts[nAtts].normalized = 0; break; case BT_S: if (state == inName) state = other; else if (state == inValue && nAtts < attsMax && atts[nAtts].normalized && (ptr == atts[nAtts].valuePtr || BYTE_TO_ASCII(enc, ptr) != ' ' || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ' ' || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) atts[nAtts].normalized = 0; break; case BT_CR: case BT_LF: /* This case ensures that the first attribute name is counted Apart from that we could just change state on the quote. */ if (state == inName) state = other; else if (state == inValue && nAtts < attsMax) atts[nAtts].normalized = 0; break; case BT_GT: case BT_SOL: if (state != inValue) return nAtts; break; default: break; } } /* not reached */ } static int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) { int result = 0; /* skip &# */ ptr += 2*MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 'x')) { for (ptr += MINBPC(enc); !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC(enc)) { int c = BYTE_TO_ASCII(enc, ptr); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': result <<= 4; result |= (c - '0'); break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': result <<= 4; result += 10 + (c - 'A'); break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': result <<= 4; result += 10 + (c - 'a'); break; } if (result >= 0x110000) return -1; } } else { for (; !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC(enc)) { int c = BYTE_TO_ASCII(enc, ptr); result *= 10; result += (c - '0'); if (result >= 0x110000) return -1; } } return checkCharRefNumber(result); } static int PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end) { switch ((end - ptr)/MINBPC(enc)) { case 2: if (CHAR_MATCHES(enc, ptr + MINBPC(enc), 't')) { switch (BYTE_TO_ASCII(enc, ptr)) { case 'l': return '<'; case 'g': return '>'; } } break; case 3: if (CHAR_MATCHES(enc, ptr, 'a')) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 'm')) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 'p')) return '&'; } } break; case 4: switch (BYTE_TO_ASCII(enc, ptr)) { case 'q': ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 'u')) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 'o')) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 't')) return '"'; } } break; case 'a': ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 'p')) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 'o')) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, 's')) return '\''; } } break; } } return 0; } static int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) { for (;;) { switch (BYTE_TYPE(enc, ptr1)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (*ptr1++ != *ptr2++) \ return 0; LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) #undef LEAD_CASE /* fall through */ if (*ptr1++ != *ptr2++) return 0; break; case BT_NONASCII: case BT_NMSTRT: #ifdef XML_NS case BT_COLON: #endif case BT_HEX: case BT_DIGIT: case BT_NAME: case BT_MINUS: if (*ptr2++ != *ptr1++) return 0; if (MINBPC(enc) > 1) { if (*ptr2++ != *ptr1++) return 0; if (MINBPC(enc) > 2) { if (*ptr2++ != *ptr1++) return 0; if (MINBPC(enc) > 3) { if (*ptr2++ != *ptr1++) return 0; } } } break; default: if (MINBPC(enc) == 1 && *ptr1 == *ptr2) return 1; switch (BYTE_TYPE(enc, ptr2)) { case BT_LEAD2: case BT_LEAD3: case BT_LEAD4: case BT_NONASCII: case BT_NMSTRT: #ifdef XML_NS case BT_COLON: #endif case BT_HEX: case BT_DIGIT: case BT_NAME: case BT_MINUS: return 0; default: return 1; } } } /* not reached */ } static int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, const char *end1, const char *ptr2) { for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { if (ptr1 == end1) return 0; if (!CHAR_MATCHES(enc, ptr1, *ptr2)) return 0; } return ptr1 == end1; } static int PREFIX(nameLength)(const ENCODING *enc, const char *ptr) { const char *start = ptr; for (;;) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NONASCII: case BT_NMSTRT: #ifdef XML_NS case BT_COLON: #endif case BT_HEX: case BT_DIGIT: case BT_NAME: case BT_MINUS: ptr += MINBPC(enc); break; default: return ptr - start; } } } static const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr) { for (;;) { switch (BYTE_TYPE(enc, ptr)) { case BT_LF: case BT_CR: case BT_S: ptr += MINBPC(enc); break; default: return ptr; } } } static void PREFIX(updatePosition)(const ENCODING *enc, const char *ptr, const char *end, POSITION *pos) { while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ ptr += n; \ break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_LF: pos->columnNumber = (unsigned)-1; pos->lineNumber++; ptr += MINBPC(enc); break; case BT_CR: pos->lineNumber++; ptr += MINBPC(enc); if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); pos->columnNumber = (unsigned)-1; break; default: ptr += MINBPC(enc); break; } pos->columnNumber++; } } #undef DO_LEAD_CASE #undef MULTIBYTE_CASES #undef INVALID_CASES #undef CHECK_NAME_CASE #undef CHECK_NAME_CASES #undef CHECK_NMSTRT_CASE #undef CHECK_NMSTRT_CASES cadaver-0.23.3/lib/expat/xmltok/nametab.h0000664000076400007640000001561210132320456017614 0ustar jortonjortonstatic const unsigned namingBitmap[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, 0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, 0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, 0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, 0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, 0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, 0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, 0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, 0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, 0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, 0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, 0x40000000, 0xF580C900, 0x00000007, 0x02010800, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, 0x00000000, 0x00004C40, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, 0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, 0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, 0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, 0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, 0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, 0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, 0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, 0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, 0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, 0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, 0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, 0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, }; static const unsigned char nmstrtPages[] = { 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; static const unsigned char namePages[] = { 0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, 0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; cadaver-0.23.3/lib/expat/xmltok/xmldef.h0000664000076400007640000000272410132320456017464 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #ifdef XML_WINLIB #define WIN32_LEAN_AND_MEAN #define STRICT #include #define malloc(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define calloc(x, y) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x)*(y)) #define free(x) HeapFree(GetProcessHeap(), 0, (x)) #define realloc(x, y) HeapReAlloc(GetProcessHeap(), 0, x, y) #define abort() /* as nothing */ #else /* not XML_WINLIB */ #include #endif /* not XML_WINLIB */ /* This file can be used for any definitions needed in particular environments. */ #ifdef MOZILLA #include "nspr.h" #define malloc(x) PR_Malloc(x) #define realloc(x, y) PR_Realloc((x), (y)) #define calloc(x, y) PR_Calloc((x),(y)) #define free(x) PR_Free(x) #define int int32 #endif /* MOZILLA */ cadaver-0.23.3/lib/expat/xmltok/xmltok_ns.c0000664000076400007640000000456210132320456020220 0ustar jortonjortonconst ENCODING *NS(XmlGetUtf8InternalEncoding)(void) { return &ns(internal_utf8_encoding).enc; } const ENCODING *NS(XmlGetUtf16InternalEncoding)(void) { #if XML_BYTE_ORDER == 12 return &ns(internal_little2_encoding).enc; #elif XML_BYTE_ORDER == 21 return &ns(internal_big2_encoding).enc; #else const short n = 1; return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc; #endif } static const ENCODING *NS(encodings)[] = { &ns(latin1_encoding).enc, &ns(ascii_encoding).enc, &ns(utf8_encoding).enc, &ns(big2_encoding).enc, &ns(big2_encoding).enc, &ns(little2_encoding).enc, &ns(utf8_encoding).enc /* NO_ENC */ }; static int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr); } static int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr); } int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name) { int i = getEncodingIndex(name); if (i == UNKNOWN_ENC) return 0; SET_INIT_ENC_INDEX(p, i); p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); p->initEnc.updatePosition = initUpdatePosition; p->encPtr = encPtr; *encPtr = &(p->initEnc); return 1; } static const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) { #define ENCODING_MAX 128 char buf[ENCODING_MAX]; char *p = buf; int i; XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); if (ptr != end) return 0; *p = 0; if (streqci(buf, "UTF-16") && enc->minBytesPerChar == 2) return enc; i = getEncodingIndex(buf); if (i == UNKNOWN_ENC) return 0; return NS(encodings)[i]; } int NS(XmlParseXmlDecl)(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **encodingName, const ENCODING **encoding, int *standalone) { return doParseXmlDecl(NS(findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, encodingName, encoding, standalone); } cadaver-0.23.3/lib/expat/xmltok/xmltok.c0000664000076400007640000011021210132320456017506 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "xmldef.h" #include "xmltok.h" #include "nametab.h" #ifdef XML_DTD #define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) #else #define IGNORE_SECTION_TOK_VTABLE /* as nothing */ #endif #define VTABLE1 \ { PREFIX(prologTok), PREFIX(contentTok), \ PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ PREFIX(sameName), \ PREFIX(nameMatchesAscii), \ PREFIX(nameLength), \ PREFIX(skipS), \ PREFIX(getAtts), \ PREFIX(charRefNumber), \ PREFIX(predefinedEntityName), \ PREFIX(updatePosition), \ PREFIX(isPublicId) #define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) #define UCS2_GET_NAMING(pages, hi, lo) \ (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) /* A 2 byte UTF-8 representation splits the characters 11 bits between the bottom 5 and 6 bits of the bytes. We need 8 bits to index into pages, 3 bits to add to that index and 5 bits to generate the mask. */ #define UTF8_GET_NAMING2(pages, byte) \ (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ + ((((byte)[0]) & 3) << 1) \ + ((((byte)[1]) >> 5) & 1)] \ & (1 << (((byte)[1]) & 0x1F))) /* A 3 byte UTF-8 representation splits the characters 16 bits between the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index into pages, 3 bits to add to that index and 5 bits to generate the mask. */ #define UTF8_GET_NAMING3(pages, byte) \ (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ + ((((byte)[1]) >> 2) & 0xF)] \ << 3) \ + ((((byte)[1]) & 3) << 1) \ + ((((byte)[2]) >> 5) & 1)] \ & (1 << (((byte)[2]) & 0x1F))) #define UTF8_GET_NAMING(pages, p, n) \ ((n) == 2 \ ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ : ((n) == 3 \ ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ : 0)) #define UTF8_INVALID3(p) \ ((*p) == 0xED \ ? (((p)[1] & 0x20) != 0) \ : ((*p) == 0xEF \ ? ((p)[1] == 0xBF && ((p)[2] == 0xBF || (p)[2] == 0xBE)) \ : 0)) #define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0) static int isNever(const ENCODING *enc, const char *p) { return 0; } static int utf8_isName2(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); } static int utf8_isName3(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); } #define utf8_isName4 isNever static int utf8_isNmstrt2(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); } static int utf8_isNmstrt3(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); } #define utf8_isNmstrt4 isNever #define utf8_isInvalid2 isNever static int utf8_isInvalid3(const ENCODING *enc, const char *p) { return UTF8_INVALID3((const unsigned char *)p); } static int utf8_isInvalid4(const ENCODING *enc, const char *p) { return UTF8_INVALID4((const unsigned char *)p); } struct normal_encoding { ENCODING enc; unsigned char type[256]; #ifdef XML_MIN_SIZE int (*byteType)(const ENCODING *, const char *); int (*isNameMin)(const ENCODING *, const char *); int (*isNmstrtMin)(const ENCODING *, const char *); int (*byteToAscii)(const ENCODING *, const char *); int (*charMatches)(const ENCODING *, const char *, int); #endif /* XML_MIN_SIZE */ int (*isName2)(const ENCODING *, const char *); int (*isName3)(const ENCODING *, const char *); int (*isName4)(const ENCODING *, const char *); int (*isNmstrt2)(const ENCODING *, const char *); int (*isNmstrt3)(const ENCODING *, const char *); int (*isNmstrt4)(const ENCODING *, const char *); int (*isInvalid2)(const ENCODING *, const char *); int (*isInvalid3)(const ENCODING *, const char *); int (*isInvalid4)(const ENCODING *, const char *); }; #ifdef XML_MIN_SIZE #define STANDARD_VTABLE(E) \ E ## byteType, \ E ## isNameMin, \ E ## isNmstrtMin, \ E ## byteToAscii, \ E ## charMatches, #else #define STANDARD_VTABLE(E) /* as nothing */ #endif #define NORMAL_VTABLE(E) \ E ## isName2, \ E ## isName3, \ E ## isName4, \ E ## isNmstrt2, \ E ## isNmstrt3, \ E ## isNmstrt4, \ E ## isInvalid2, \ E ## isInvalid3, \ E ## isInvalid4 static int checkCharRefNumber(int); #include "xmltok_impl.h" #ifdef XML_MIN_SIZE #define sb_isNameMin isNever #define sb_isNmstrtMin isNever #endif #ifdef XML_MIN_SIZE #define MINBPC(enc) ((enc)->minBytesPerChar) #else /* minimum bytes per character */ #define MINBPC(enc) 1 #endif #define SB_BYTE_TYPE(enc, p) \ (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) #ifdef XML_MIN_SIZE static int sb_byteType(const ENCODING *enc, const char *p) { return SB_BYTE_TYPE(enc, p); } #define BYTE_TYPE(enc, p) \ (((const struct normal_encoding *)(enc))->byteType(enc, p)) #else #define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) #endif #ifdef XML_MIN_SIZE #define BYTE_TO_ASCII(enc, p) \ (((const struct normal_encoding *)(enc))->byteToAscii(enc, p)) static int sb_byteToAscii(const ENCODING *enc, const char *p) { return *p; } #else #define BYTE_TO_ASCII(enc, p) (*p) #endif #define IS_NAME_CHAR(enc, p, n) \ (((const struct normal_encoding *)(enc))->isName ## n(enc, p)) #define IS_NMSTRT_CHAR(enc, p, n) \ (((const struct normal_encoding *)(enc))->isNmstrt ## n(enc, p)) #define IS_INVALID_CHAR(enc, p, n) \ (((const struct normal_encoding *)(enc))->isInvalid ## n(enc, p)) #ifdef XML_MIN_SIZE #define IS_NAME_CHAR_MINBPC(enc, p) \ (((const struct normal_encoding *)(enc))->isNameMin(enc, p)) #define IS_NMSTRT_CHAR_MINBPC(enc, p) \ (((const struct normal_encoding *)(enc))->isNmstrtMin(enc, p)) #else #define IS_NAME_CHAR_MINBPC(enc, p) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) #endif #ifdef XML_MIN_SIZE #define CHAR_MATCHES(enc, p, c) \ (((const struct normal_encoding *)(enc))->charMatches(enc, p, c)) static int sb_charMatches(const ENCODING *enc, const char *p, int c) { return *p == c; } #else /* c is an ASCII character */ #define CHAR_MATCHES(enc, p, c) (*(p) == c) #endif #define PREFIX(ident) normal_ ## ident #include "xmltok_impl.c" #undef MINBPC #undef BYTE_TYPE #undef BYTE_TO_ASCII #undef CHAR_MATCHES #undef IS_NAME_CHAR #undef IS_NAME_CHAR_MINBPC #undef IS_NMSTRT_CHAR #undef IS_NMSTRT_CHAR_MINBPC #undef IS_INVALID_CHAR enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ UTF8_cval1 = 0x00, UTF8_cval2 = 0xc0, UTF8_cval3 = 0xe0, UTF8_cval4 = 0xf0 }; static void utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { char *to; const char *from; if (fromLim - *fromP > toLim - *toP) { /* Avoid copying partial characters. */ for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) break; } for (to = *toP, from = *fromP; from != fromLim; from++, to++) *to = *from; *fromP = from; *toP = to; } static void utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { unsigned short *to = *toP; const char *from = *fromP; while (from != fromLim && to != toLim) { switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { case BT_LEAD2: *to++ = ((from[0] & 0x1f) << 6) | (from[1] & 0x3f); from += 2; break; case BT_LEAD3: *to++ = ((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f); from += 3; break; case BT_LEAD4: { unsigned long n; if (to + 1 == toLim) break; n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); n -= 0x10000; to[0] = (unsigned short)((n >> 10) | 0xD800); to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); to += 2; from += 4; } break; default: *to++ = *from++; break; } } *fromP = from; *toP = to; } #ifdef XML_NS static const struct normal_encoding utf8_encoding_ns = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #include "asciitab.h" #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; #endif static const struct normal_encoding utf8_encoding = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; #ifdef XML_NS static const struct normal_encoding internal_utf8_encoding_ns = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #include "iasciitab.h" #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; #endif static const struct normal_encoding internal_utf8_encoding = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #define BT_COLON BT_NMSTRT #include "iasciitab.h" #undef BT_COLON #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; static void latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { for (;;) { unsigned char c; if (*fromP == fromLim) break; c = (unsigned char)**fromP; if (c & 0x80) { if (toLim - *toP < 2) break; *(*toP)++ = ((c >> 6) | UTF8_cval2); *(*toP)++ = ((c & 0x3f) | 0x80); (*fromP)++; } else { if (*toP == toLim) break; *(*toP)++ = *(*fromP)++; } } } static void latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { while (*fromP != fromLim && *toP != toLim) *(*toP)++ = (unsigned char)*(*fromP)++; } #ifdef XML_NS static const struct normal_encoding latin1_encoding_ns = { { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, { #include "asciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(sb_) }; #endif static const struct normal_encoding latin1_encoding = { { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(sb_) }; static void ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { while (*fromP != fromLim && *toP != toLim) *(*toP)++ = *(*fromP)++; } #ifdef XML_NS static const struct normal_encoding ascii_encoding_ns = { { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, { #include "asciitab.h" /* BT_NONXML == 0 */ }, STANDARD_VTABLE(sb_) }; #endif static const struct normal_encoding ascii_encoding = { { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON /* BT_NONXML == 0 */ }, STANDARD_VTABLE(sb_) }; static int unicode_byte_type(char hi, char lo) { switch ((unsigned char)hi) { case 0xD8: case 0xD9: case 0xDA: case 0xDB: return BT_LEAD4; case 0xDC: case 0xDD: case 0xDE: case 0xDF: return BT_TRAIL; case 0xFF: switch ((unsigned char)lo) { case 0xFF: case 0xFE: return BT_NONXML; } break; } return BT_NONASCII; } #define DEFINE_UTF16_TO_UTF8(E) \ static \ void E ## toUtf8(const ENCODING *enc, \ const char **fromP, const char *fromLim, \ char **toP, const char *toLim) \ { \ const char *from; \ for (from = *fromP; from != fromLim; from += 2) { \ int plane; \ unsigned char lo2; \ unsigned char lo = GET_LO(from); \ unsigned char hi = GET_HI(from); \ switch (hi) { \ case 0: \ if (lo < 0x80) { \ if (*toP == toLim) { \ *fromP = from; \ return; \ } \ *(*toP)++ = lo; \ break; \ } \ /* fall through */ \ case 0x1: case 0x2: case 0x3: \ case 0x4: case 0x5: case 0x6: case 0x7: \ if (toLim - *toP < 2) { \ *fromP = from; \ return; \ } \ *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ *(*toP)++ = ((lo & 0x3f) | 0x80); \ break; \ default: \ if (toLim - *toP < 3) { \ *fromP = from; \ return; \ } \ /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ *(*toP)++ = ((lo & 0x3f) | 0x80); \ break; \ case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ if (toLim - *toP < 4) { \ *fromP = from; \ return; \ } \ plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ from += 2; \ lo2 = GET_LO(from); \ *(*toP)++ = (((lo & 0x3) << 4) \ | ((GET_HI(from) & 0x3) << 2) \ | (lo2 >> 6) \ | 0x80); \ *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ break; \ } \ } \ *fromP = from; \ } #define DEFINE_UTF16_TO_UTF16(E) \ static \ void E ## toUtf16(const ENCODING *enc, \ const char **fromP, const char *fromLim, \ unsigned short **toP, const unsigned short *toLim) \ { \ /* Avoid copying first half only of surrogate */ \ if (fromLim - *fromP > ((toLim - *toP) << 1) \ && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ fromLim -= 2; \ for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ } #define SET2(ptr, ch) \ (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) #define GET_LO(ptr) ((unsigned char)(ptr)[0]) #define GET_HI(ptr) ((unsigned char)(ptr)[1]) DEFINE_UTF16_TO_UTF8(little2_) DEFINE_UTF16_TO_UTF16(little2_) #undef SET2 #undef GET_LO #undef GET_HI #define SET2(ptr, ch) \ (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) #define GET_LO(ptr) ((unsigned char)(ptr)[1]) #define GET_HI(ptr) ((unsigned char)(ptr)[0]) DEFINE_UTF16_TO_UTF8(big2_) DEFINE_UTF16_TO_UTF16(big2_) #undef SET2 #undef GET_LO #undef GET_HI #define LITTLE2_BYTE_TYPE(enc, p) \ ((p)[1] == 0 \ ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ : unicode_byte_type((p)[1], (p)[0])) #define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) #define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) #define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) #define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) #ifdef XML_MIN_SIZE static int little2_byteType(const ENCODING *enc, const char *p) { return LITTLE2_BYTE_TYPE(enc, p); } static int little2_byteToAscii(const ENCODING *enc, const char *p) { return LITTLE2_BYTE_TO_ASCII(enc, p); } static int little2_charMatches(const ENCODING *enc, const char *p, int c) { return LITTLE2_CHAR_MATCHES(enc, p, c); } static int little2_isNameMin(const ENCODING *enc, const char *p) { return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); } static int little2_isNmstrtMin(const ENCODING *enc, const char *p) { return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); } #undef VTABLE #define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 #else /* not XML_MIN_SIZE */ #undef PREFIX #define PREFIX(ident) little2_ ## ident #define MINBPC(enc) 2 /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ #define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) #define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) #define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) #define IS_NAME_CHAR(enc, p, n) 0 #define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) #define IS_NMSTRT_CHAR(enc, p, n) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) #include "xmltok_impl.c" #undef MINBPC #undef BYTE_TYPE #undef BYTE_TO_ASCII #undef CHAR_MATCHES #undef IS_NAME_CHAR #undef IS_NAME_CHAR_MINBPC #undef IS_NMSTRT_CHAR #undef IS_NMSTRT_CHAR_MINBPC #undef IS_INVALID_CHAR #endif /* not XML_MIN_SIZE */ #ifdef XML_NS static const struct normal_encoding little2_encoding_ns = { { VTABLE, 2, 0, #if XML_BYTE_ORDER == 12 1 #else 0 #endif }, { #include "asciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #endif static const struct normal_encoding little2_encoding = { { VTABLE, 2, 0, #if XML_BYTE_ORDER == 12 1 #else 0 #endif }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #if XML_BYTE_ORDER != 21 #ifdef XML_NS static const struct normal_encoding internal_little2_encoding_ns = { { VTABLE, 2, 0, 1 }, { #include "iasciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #endif static const struct normal_encoding internal_little2_encoding = { { VTABLE, 2, 0, 1 }, { #define BT_COLON BT_NMSTRT #include "iasciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #endif #define BIG2_BYTE_TYPE(enc, p) \ ((p)[0] == 0 \ ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ : unicode_byte_type((p)[0], (p)[1])) #define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) #define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) #define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) #define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) #ifdef XML_MIN_SIZE static int big2_byteType(const ENCODING *enc, const char *p) { return BIG2_BYTE_TYPE(enc, p); } static int big2_byteToAscii(const ENCODING *enc, const char *p) { return BIG2_BYTE_TO_ASCII(enc, p); } static int big2_charMatches(const ENCODING *enc, const char *p, int c) { return BIG2_CHAR_MATCHES(enc, p, c); } static int big2_isNameMin(const ENCODING *enc, const char *p) { return BIG2_IS_NAME_CHAR_MINBPC(enc, p); } static int big2_isNmstrtMin(const ENCODING *enc, const char *p) { return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); } #undef VTABLE #define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 #else /* not XML_MIN_SIZE */ #undef PREFIX #define PREFIX(ident) big2_ ## ident #define MINBPC(enc) 2 /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ #define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) #define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) #define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) #define IS_NAME_CHAR(enc, p, n) 0 #define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) #define IS_NMSTRT_CHAR(enc, p, n) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) #include "xmltok_impl.c" #undef MINBPC #undef BYTE_TYPE #undef BYTE_TO_ASCII #undef CHAR_MATCHES #undef IS_NAME_CHAR #undef IS_NAME_CHAR_MINBPC #undef IS_NMSTRT_CHAR #undef IS_NMSTRT_CHAR_MINBPC #undef IS_INVALID_CHAR #endif /* not XML_MIN_SIZE */ #ifdef XML_NS static const struct normal_encoding big2_encoding_ns = { { VTABLE, 2, 0, #if XML_BYTE_ORDER == 21 1 #else 0 #endif }, { #include "asciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #endif static const struct normal_encoding big2_encoding = { { VTABLE, 2, 0, #if XML_BYTE_ORDER == 21 1 #else 0 #endif }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #if XML_BYTE_ORDER != 12 #ifdef XML_NS static const struct normal_encoding internal_big2_encoding_ns = { { VTABLE, 2, 0, 1 }, { #include "iasciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #endif static const struct normal_encoding internal_big2_encoding = { { VTABLE, 2, 0, 1 }, { #define BT_COLON BT_NMSTRT #include "iasciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #endif #undef PREFIX static int streqci(const char *s1, const char *s2) { for (;;) { char c1 = *s1++; char c2 = *s2++; if ('a' <= c1 && c1 <= 'z') c1 += 'A' - 'a'; if ('a' <= c2 && c2 <= 'z') c2 += 'A' - 'a'; if (c1 != c2) return 0; if (!c1) break; } return 1; } static void initUpdatePosition(const ENCODING *enc, const char *ptr, const char *end, POSITION *pos) { normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); } static int toAscii(const ENCODING *enc, const char *ptr, const char *end) { char buf[1]; char *p = buf; XmlUtf8Convert(enc, &ptr, end, &p, p + 1); if (p == buf) return -1; else return buf[0]; } static int isSpace(int c) { switch (c) { case 0x20: case 0xD: case 0xA: case 0x9: return 1; } return 0; } /* Return 1 if there's just optional white space or there's an S followed by name=val. */ static int parsePseudoAttribute(const ENCODING *enc, const char *ptr, const char *end, const char **namePtr, const char **nameEndPtr, const char **valPtr, const char **nextTokPtr) { int c; char open; if (ptr == end) { *namePtr = 0; return 1; } if (!isSpace(toAscii(enc, ptr, end))) { *nextTokPtr = ptr; return 0; } do { ptr += enc->minBytesPerChar; } while (isSpace(toAscii(enc, ptr, end))); if (ptr == end) { *namePtr = 0; return 1; } *namePtr = ptr; for (;;) { c = toAscii(enc, ptr, end); if (c == -1) { *nextTokPtr = ptr; return 0; } if (c == '=') { *nameEndPtr = ptr; break; } if (isSpace(c)) { *nameEndPtr = ptr; do { ptr += enc->minBytesPerChar; } while (isSpace(c = toAscii(enc, ptr, end))); if (c != '=') { *nextTokPtr = ptr; return 0; } break; } ptr += enc->minBytesPerChar; } if (ptr == *namePtr) { *nextTokPtr = ptr; return 0; } ptr += enc->minBytesPerChar; c = toAscii(enc, ptr, end); while (isSpace(c)) { ptr += enc->minBytesPerChar; c = toAscii(enc, ptr, end); } if (c != '"' && c != '\'') { *nextTokPtr = ptr; return 0; } open = c; ptr += enc->minBytesPerChar; *valPtr = ptr; for (;; ptr += enc->minBytesPerChar) { c = toAscii(enc, ptr, end); if (c == open) break; if (!('a' <= c && c <= 'z') && !('A' <= c && c <= 'Z') && !('0' <= c && c <= '9') && c != '.' && c != '-' && c != '_') { *nextTokPtr = ptr; return 0; } } *nextTokPtr = ptr + enc->minBytesPerChar; return 1; } static int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *, const char *), int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **encodingName, const ENCODING **encoding, int *standalone) { const char *val = 0; const char *name = 0; const char *nameEnd = 0; ptr += 5 * enc->minBytesPerChar; end -= 2 * enc->minBytesPerChar; if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) || !name) { *badPtr = ptr; return 0; } if (!XmlNameMatchesAscii(enc, name, nameEnd, "version")) { if (!isGeneralTextEntity) { *badPtr = name; return 0; } } else { if (versionPtr) *versionPtr = val; if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { *badPtr = ptr; return 0; } if (!name) { if (isGeneralTextEntity) { /* a TextDecl must have an EncodingDecl */ *badPtr = ptr; return 0; } return 1; } } if (XmlNameMatchesAscii(enc, name, nameEnd, "encoding")) { int c = toAscii(enc, val, end); if (!('a' <= c && c <= 'z') && !('A' <= c && c <= 'Z')) { *badPtr = val; return 0; } if (encodingName) *encodingName = val; if (encoding) *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { *badPtr = ptr; return 0; } if (!name) return 1; } if (!XmlNameMatchesAscii(enc, name, nameEnd, "standalone") || isGeneralTextEntity) { *badPtr = name; return 0; } if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, "yes")) { if (standalone) *standalone = 1; } else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, "no")) { if (standalone) *standalone = 0; } else { *badPtr = val; return 0; } while (isSpace(toAscii(enc, ptr, end))) ptr += enc->minBytesPerChar; if (ptr != end) { *badPtr = ptr; return 0; } return 1; } static int checkCharRefNumber(int result) { switch (result >> 8) { case 0xD8: case 0xD9: case 0xDA: case 0xDB: case 0xDC: case 0xDD: case 0xDE: case 0xDF: return -1; case 0: if (latin1_encoding.type[result] == BT_NONXML) return -1; break; case 0xFF: if (result == 0xFFFE || result == 0xFFFF) return -1; break; } return result; } int XmlUtf8Encode(int c, char *buf) { enum { /* minN is minimum legal resulting value for N byte sequence */ min2 = 0x80, min3 = 0x800, min4 = 0x10000 }; if (c < 0) return 0; if (c < min2) { buf[0] = (c | UTF8_cval1); return 1; } if (c < min3) { buf[0] = ((c >> 6) | UTF8_cval2); buf[1] = ((c & 0x3f) | 0x80); return 2; } if (c < min4) { buf[0] = ((c >> 12) | UTF8_cval3); buf[1] = (((c >> 6) & 0x3f) | 0x80); buf[2] = ((c & 0x3f) | 0x80); return 3; } if (c < 0x110000) { buf[0] = ((c >> 18) | UTF8_cval4); buf[1] = (((c >> 12) & 0x3f) | 0x80); buf[2] = (((c >> 6) & 0x3f) | 0x80); buf[3] = ((c & 0x3f) | 0x80); return 4; } return 0; } int XmlUtf16Encode(int charNum, unsigned short *buf) { if (charNum < 0) return 0; if (charNum < 0x10000) { buf[0] = charNum; return 1; } if (charNum < 0x110000) { charNum -= 0x10000; buf[0] = (charNum >> 10) + 0xD800; buf[1] = (charNum & 0x3FF) + 0xDC00; return 2; } return 0; } struct unknown_encoding { struct normal_encoding normal; int (*convert)(void *userData, const char *p); void *userData; unsigned short utf16[256]; char utf8[256][4]; }; int XmlSizeOfUnknownEncoding(void) { return sizeof(struct unknown_encoding); } static int unknown_isName(const ENCODING *enc, const char *p) { int c = ((const struct unknown_encoding *)enc) ->convert(((const struct unknown_encoding *)enc)->userData, p); if (c & ~0xFFFF) return 0; return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); } static int unknown_isNmstrt(const ENCODING *enc, const char *p) { int c = ((const struct unknown_encoding *)enc) ->convert(((const struct unknown_encoding *)enc)->userData, p); if (c & ~0xFFFF) return 0; return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); } static int unknown_isInvalid(const ENCODING *enc, const char *p) { int c = ((const struct unknown_encoding *)enc) ->convert(((const struct unknown_encoding *)enc)->userData, p); return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; } static void unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { char buf[XML_UTF8_ENCODE_MAX]; for (;;) { const char *utf8; int n; if (*fromP == fromLim) break; utf8 = ((const struct unknown_encoding *)enc)->utf8[(unsigned char)**fromP]; n = *utf8++; if (n == 0) { int c = ((const struct unknown_encoding *)enc) ->convert(((const struct unknown_encoding *)enc)->userData, *fromP); n = XmlUtf8Encode(c, buf); if (n > toLim - *toP) break; utf8 = buf; *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP] - (BT_LEAD2 - 2); } else { if (n > toLim - *toP) break; (*fromP)++; } do { *(*toP)++ = *utf8++; } while (--n != 0); } } static void unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { while (*fromP != fromLim && *toP != toLim) { unsigned short c = ((const struct unknown_encoding *)enc)->utf16[(unsigned char)**fromP]; if (c == 0) { c = (unsigned short)((const struct unknown_encoding *)enc) ->convert(((const struct unknown_encoding *)enc)->userData, *fromP); *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP] - (BT_LEAD2 - 2); } else (*fromP)++; *(*toP)++ = c; } } ENCODING * XmlInitUnknownEncoding(void *mem, int *table, int (*convert)(void *userData, const char *p), void *userData) { int i; struct unknown_encoding *e = mem; for (i = 0; i < sizeof(struct normal_encoding); i++) ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; for (i = 0; i < 128; i++) if (latin1_encoding.type[i] != BT_OTHER && latin1_encoding.type[i] != BT_NONXML && table[i] != i) return 0; for (i = 0; i < 256; i++) { int c = table[i]; if (c == -1) { e->normal.type[i] = BT_MALFORM; /* This shouldn't really get used. */ e->utf16[i] = 0xFFFF; e->utf8[i][0] = 1; e->utf8[i][1] = 0; } else if (c < 0) { if (c < -4) return 0; e->normal.type[i] = BT_LEAD2 - (c + 2); e->utf8[i][0] = 0; e->utf16[i] = 0; } else if (c < 0x80) { if (latin1_encoding.type[c] != BT_OTHER && latin1_encoding.type[c] != BT_NONXML && c != i) return 0; e->normal.type[i] = latin1_encoding.type[c]; e->utf8[i][0] = 1; e->utf8[i][1] = (char)c; e->utf16[i] = c == 0 ? 0xFFFF : c; } else if (checkCharRefNumber(c) < 0) { e->normal.type[i] = BT_NONXML; /* This shouldn't really get used. */ e->utf16[i] = 0xFFFF; e->utf8[i][0] = 1; e->utf8[i][1] = 0; } else { if (c > 0xFFFF) return 0; if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) e->normal.type[i] = BT_NMSTRT; else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) e->normal.type[i] = BT_NAME; else e->normal.type[i] = BT_OTHER; e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); e->utf16[i] = c; } } e->userData = userData; e->convert = convert; if (convert) { e->normal.isName2 = unknown_isName; e->normal.isName3 = unknown_isName; e->normal.isName4 = unknown_isName; e->normal.isNmstrt2 = unknown_isNmstrt; e->normal.isNmstrt3 = unknown_isNmstrt; e->normal.isNmstrt4 = unknown_isNmstrt; e->normal.isInvalid2 = unknown_isInvalid; e->normal.isInvalid3 = unknown_isInvalid; e->normal.isInvalid4 = unknown_isInvalid; } e->normal.enc.utf8Convert = unknown_toUtf8; e->normal.enc.utf16Convert = unknown_toUtf16; return &(e->normal.enc); } /* If this enumeration is changed, getEncodingIndex and encodings must also be changed. */ enum { UNKNOWN_ENC = -1, ISO_8859_1_ENC = 0, US_ASCII_ENC, UTF_8_ENC, UTF_16_ENC, UTF_16BE_ENC, UTF_16LE_ENC, /* must match encodingNames up to here */ NO_ENC }; static int getEncodingIndex(const char *name) { static const char *encodingNames[] = { "ISO-8859-1", "US-ASCII", "UTF-8", "UTF-16", "UTF-16BE" "UTF-16LE", }; int i; if (name == 0) return NO_ENC; for (i = 0; i < sizeof(encodingNames)/sizeof(encodingNames[0]); i++) if (streqci(name, encodingNames[i])) return i; return UNKNOWN_ENC; } /* For binary compatibility, we store the index of the encoding specified at initialization in the isUtf16 member. */ #define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) #define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) /* This is what detects the encoding. encodingTable maps from encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of the external (protocol) specified encoding; state is XML_CONTENT_STATE if we're parsing an external text entity, and XML_PROLOG_STATE otherwise. */ static int initScan(const ENCODING **encodingTable, const INIT_ENCODING *enc, int state, const char *ptr, const char *end, const char **nextTokPtr) { const ENCODING **encPtr; if (ptr == end) return XML_TOK_NONE; encPtr = enc->encPtr; if (ptr + 1 == end) { /* only a single byte available for auto-detection */ #ifndef XML_DTD /* FIXME */ /* a well-formed document entity must have more than one byte */ if (state != XML_CONTENT_STATE) return XML_TOK_PARTIAL; #endif /* so we're parsing an external text entity... */ /* if UTF-16 was externally specified, then we need at least 2 bytes */ switch (INIT_ENC_INDEX(enc)) { case UTF_16_ENC: case UTF_16LE_ENC: case UTF_16BE_ENC: return XML_TOK_PARTIAL; } switch ((unsigned char)*ptr) { case 0xFE: case 0xFF: case 0xEF: /* possibly first byte of UTF-8 BOM */ if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; /* fall through */ case 0x00: case 0x3C: return XML_TOK_PARTIAL; } } else { switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { case 0xFEFF: if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; *nextTokPtr = ptr + 2; *encPtr = encodingTable[UTF_16BE_ENC]; return XML_TOK_BOM; /* 00 3C is handled in the default case */ case 0x3C00: if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC || INIT_ENC_INDEX(enc) == UTF_16_ENC) && state == XML_CONTENT_STATE) break; *encPtr = encodingTable[UTF_16LE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); case 0xFFFE: if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; *nextTokPtr = ptr + 2; *encPtr = encodingTable[UTF_16LE_ENC]; return XML_TOK_BOM; case 0xEFBB: /* Maybe a UTF-8 BOM (EF BB BF) */ /* If there's an explicitly specified (external) encoding of ISO-8859-1 or some flavour of UTF-16 and this is an external text entity, don't look for the BOM, because it might be a legal data. */ if (state == XML_CONTENT_STATE) { int e = INIT_ENC_INDEX(enc); if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC || e == UTF_16LE_ENC || e == UTF_16_ENC) break; } if (ptr + 2 == end) return XML_TOK_PARTIAL; if ((unsigned char)ptr[2] == 0xBF) { *encPtr = encodingTable[UTF_8_ENC]; return XML_TOK_BOM; } break; default: if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only way this can fail to be big-endian UTF-16 if it it's an external parsed general entity that's labelled as UTF-16LE. */ if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) break; *encPtr = encodingTable[UTF_16BE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); } else if (ptr[1] == '\0') { /* We could recover here in the case: - parsing an external entity - second byte is 0 - no externally specified encoding - no encoding declaration by assuming UTF-16LE. But we don't, because this would mean when presented just with a single byte, we couldn't reliably determine whether we needed further bytes. */ if (state == XML_CONTENT_STATE) break; *encPtr = encodingTable[UTF_16LE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); } break; } } *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); } #define NS(x) x #define ns(x) x #include "xmltok_ns.c" #undef NS #undef ns #ifdef XML_NS #define NS(x) x ## NS #define ns(x) x ## _ns #include "xmltok_ns.c" #undef NS #undef ns ENCODING * XmlInitUnknownEncodingNS(void *mem, int *table, int (*convert)(void *userData, const char *p), void *userData) { ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); if (enc) ((struct normal_encoding *)enc)->type[':'] = BT_COLON; return enc; } #endif /* XML_NS */ cadaver-0.23.3/lib/expat/xmltok/xmltok.h0000664000076400007640000002464210132320456017526 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef XmlTok_INCLUDED #define XmlTok_INCLUDED 1 #ifdef __cplusplus extern "C" { #endif #ifndef XMLTOKAPI #define XMLTOKAPI /* as nothing */ #endif /* The following token may be returned by XmlContentTok */ #define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of illegal ]]> sequence */ /* The following tokens may be returned by both XmlPrologTok and XmlContentTok */ #define XML_TOK_NONE -4 /* The string to be scanned is empty */ #define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; might be part of CRLF sequence */ #define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ #define XML_TOK_PARTIAL -1 /* only part of a token */ #define XML_TOK_INVALID 0 /* The following tokens are returned by XmlContentTok; some are also returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */ #define XML_TOK_START_TAG_WITH_ATTS 1 #define XML_TOK_START_TAG_NO_ATTS 2 #define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ #define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 #define XML_TOK_END_TAG 5 #define XML_TOK_DATA_CHARS 6 #define XML_TOK_DATA_NEWLINE 7 #define XML_TOK_CDATA_SECT_OPEN 8 #define XML_TOK_ENTITY_REF 9 #define XML_TOK_CHAR_REF 10 /* numeric character reference */ /* The following tokens may be returned by both XmlPrologTok and XmlContentTok */ #define XML_TOK_PI 11 /* processing instruction */ #define XML_TOK_XML_DECL 12 /* XML decl or text decl */ #define XML_TOK_COMMENT 13 #define XML_TOK_BOM 14 /* Byte order mark */ /* The following tokens are returned only by XmlPrologTok */ #define XML_TOK_PROLOG_S 15 #define XML_TOK_DECL_OPEN 16 /* */ #define XML_TOK_NAME 18 #define XML_TOK_NMTOKEN 19 #define XML_TOK_POUND_NAME 20 /* #name */ #define XML_TOK_OR 21 /* | */ #define XML_TOK_PERCENT 22 #define XML_TOK_OPEN_PAREN 23 #define XML_TOK_CLOSE_PAREN 24 #define XML_TOK_OPEN_BRACKET 25 #define XML_TOK_CLOSE_BRACKET 26 #define XML_TOK_LITERAL 27 #define XML_TOK_PARAM_ENTITY_REF 28 #define XML_TOK_INSTANCE_START 29 /* The following occur only in element type declarations */ #define XML_TOK_NAME_QUESTION 30 /* name? */ #define XML_TOK_NAME_ASTERISK 31 /* name* */ #define XML_TOK_NAME_PLUS 32 /* name+ */ #define XML_TOK_COND_SECT_OPEN 33 /* */ #define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ #define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ #define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ #define XML_TOK_COMMA 38 /* The following token is returned only by XmlAttributeValueTok */ #define XML_TOK_ATTRIBUTE_VALUE_S 39 /* The following token is returned only by XmlCdataSectionTok */ #define XML_TOK_CDATA_SECT_CLOSE 40 /* With namespace processing this is returned by XmlPrologTok for a name with a colon. */ #define XML_TOK_PREFIXED_NAME 41 #ifdef XML_DTD #define XML_TOK_IGNORE_SECT 42 #endif /* XML_DTD */ #ifdef XML_DTD #define XML_N_STATES 4 #else /* not XML_DTD */ #define XML_N_STATES 3 #endif /* not XML_DTD */ #define XML_PROLOG_STATE 0 #define XML_CONTENT_STATE 1 #define XML_CDATA_SECTION_STATE 2 #ifdef XML_DTD #define XML_IGNORE_SECTION_STATE 3 #endif /* XML_DTD */ #define XML_N_LITERAL_TYPES 2 #define XML_ATTRIBUTE_VALUE_LITERAL 0 #define XML_ENTITY_VALUE_LITERAL 1 /* The size of the buffer passed to XmlUtf8Encode must be at least this. */ #define XML_UTF8_ENCODE_MAX 4 /* The size of the buffer passed to XmlUtf16Encode must be at least this. */ #define XML_UTF16_ENCODE_MAX 2 typedef struct position { /* first line and first column are 0 not 1 */ unsigned long lineNumber; unsigned long columnNumber; } POSITION; typedef struct { const char *name; const char *valuePtr; const char *valueEnd; char normalized; } ATTRIBUTE; struct encoding; typedef struct encoding ENCODING; struct encoding { int (*scanners[XML_N_STATES])(const ENCODING *, const char *, const char *, const char **); int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *, const char *, const char *, const char **); int (*sameName)(const ENCODING *, const char *, const char *); int (*nameMatchesAscii)(const ENCODING *, const char *, const char *, const char *); int (*nameLength)(const ENCODING *, const char *); const char *(*skipS)(const ENCODING *, const char *); int (*getAtts)(const ENCODING *enc, const char *ptr, int attsMax, ATTRIBUTE *atts); int (*charRefNumber)(const ENCODING *enc, const char *ptr); int (*predefinedEntityName)(const ENCODING *, const char *, const char *); void (*updatePosition)(const ENCODING *, const char *ptr, const char *end, POSITION *); int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end, const char **badPtr); void (*utf8Convert)(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim); void (*utf16Convert)(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim); int minBytesPerChar; char isUtf8; char isUtf16; }; /* Scan the string starting at ptr until the end of the next complete token, but do not scan past eptr. Return an integer giving the type of token. Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. Return XML_TOK_PARTIAL when the string does not contain a complete token; nextTokPtr will not be set. Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr will be set to point to the character which made the token invalid. Otherwise the string starts with a valid token; nextTokPtr will be set to point to the character following the end of that token. Each data character counts as a single token, but adjacent data characters may be returned together. Similarly for characters in the prolog outside literals, comments and processing instructions. */ #define XmlTok(enc, state, ptr, end, nextTokPtr) \ (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) #define XmlPrologTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) #define XmlContentTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) #define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) #ifdef XML_DTD #define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) #endif /* XML_DTD */ /* This is used for performing a 2nd-level tokenization on the content of a literal that has already been returned by XmlTok. */ #define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) #define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) #define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) #define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) #define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) #define XmlNameLength(enc, ptr) \ (((enc)->nameLength)(enc, ptr)) #define XmlSkipS(enc, ptr) \ (((enc)->skipS)(enc, ptr)) #define XmlGetAttributes(enc, ptr, attsMax, atts) \ (((enc)->getAtts)(enc, ptr, attsMax, atts)) #define XmlCharRefNumber(enc, ptr) \ (((enc)->charRefNumber)(enc, ptr)) #define XmlPredefinedEntityName(enc, ptr, end) \ (((enc)->predefinedEntityName)(enc, ptr, end)) #define XmlUpdatePosition(enc, ptr, end, pos) \ (((enc)->updatePosition)(enc, ptr, end, pos)) #define XmlIsPublicId(enc, ptr, end, badPtr) \ (((enc)->isPublicId)(enc, ptr, end, badPtr)) #define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) #define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) typedef struct { ENCODING initEnc; const ENCODING **encPtr; } INIT_ENCODING; int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr); int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding(void); const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding(void); int XMLTOKAPI XmlUtf8Encode(int charNumber, char *buf); int XMLTOKAPI XmlUtf16Encode(int charNumber, unsigned short *buf); int XMLTOKAPI XmlSizeOfUnknownEncoding(void); ENCODING XMLTOKAPI * XmlInitUnknownEncoding(void *mem, int *table, int (*conv)(void *userData, const char *p), void *userData); int XMLTOKAPI XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr); int XMLTOKAPI XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncodingNS(void); const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncodingNS(void); ENCODING XMLTOKAPI * XmlInitUnknownEncodingNS(void *mem, int *table, int (*conv)(void *userData, const char *p), void *userData); #ifdef __cplusplus } #endif #endif /* not XmlTok_INCLUDED */ cadaver-0.23.3/lib/expat/xmltok/xmlrole.c0000664000076400007640000006426410132320456017671 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "xmldef.h" #include "xmlrole.h" /* Doesn't check: that ,| are not mixed in a model group content of literals */ #ifndef MIN_BYTES_PER_CHAR #define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) #endif #ifdef XML_DTD #define setTopLevel(state) \ ((state)->handler = ((state)->documentEntity \ ? internalSubset \ : externalSubset1)) #else /* not XML_DTD */ #define setTopLevel(state) ((state)->handler = internalSubset) #endif /* not XML_DTD */ typedef int PROLOG_HANDLER(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc); static PROLOG_HANDLER prolog0, prolog1, prolog2, doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, internalSubset, entity0, entity1, entity2, entity3, entity4, entity5, entity6, entity7, entity8, entity9, notation0, notation1, notation2, notation3, notation4, attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, attlist7, attlist8, attlist9, element0, element1, element2, element3, element4, element5, element6, element7, #ifdef XML_DTD externalSubset0, externalSubset1, condSect0, condSect1, condSect2, #endif /* XML_DTD */ declClose, error; static int common(PROLOG_STATE *state, int tok); static int prolog0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: state->handler = prolog1; return XML_ROLE_NONE; case XML_TOK_XML_DECL: state->handler = prolog1; return XML_ROLE_XML_DECL; case XML_TOK_PI: state->handler = prolog1; return XML_ROLE_NONE; case XML_TOK_COMMENT: state->handler = prolog1; case XML_TOK_BOM: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: if (!XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, "DOCTYPE")) break; state->handler = doctype0; return XML_ROLE_NONE; case XML_TOK_INSTANCE_START: state->handler = error; return XML_ROLE_INSTANCE_START; } return common(state, tok); } static int prolog1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_PI: case XML_TOK_COMMENT: case XML_TOK_BOM: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: if (!XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, "DOCTYPE")) break; state->handler = doctype0; return XML_ROLE_NONE; case XML_TOK_INSTANCE_START: state->handler = error; return XML_ROLE_INSTANCE_START; } return common(state, tok); } static int prolog2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_PI: case XML_TOK_COMMENT: return XML_ROLE_NONE; case XML_TOK_INSTANCE_START: state->handler = error; return XML_ROLE_INSTANCE_START; } return common(state, tok); } static int doctype0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = doctype1; return XML_ROLE_DOCTYPE_NAME; } return common(state, tok); } static int doctype1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = internalSubset; return XML_ROLE_NONE; case XML_TOK_DECL_CLOSE: state->handler = prolog2; return XML_ROLE_DOCTYPE_CLOSE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, "SYSTEM")) { state->handler = doctype3; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, "PUBLIC")) { state->handler = doctype2; return XML_ROLE_NONE; } break; } return common(state, tok); } static int doctype2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = doctype3; return XML_ROLE_DOCTYPE_PUBLIC_ID; } return common(state, tok); } static int doctype3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = doctype4; return XML_ROLE_DOCTYPE_SYSTEM_ID; } return common(state, tok); } static int doctype4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = internalSubset; return XML_ROLE_NONE; case XML_TOK_DECL_CLOSE: state->handler = prolog2; return XML_ROLE_DOCTYPE_CLOSE; } return common(state, tok); } static int doctype5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_DECL_CLOSE: state->handler = prolog2; return XML_ROLE_DOCTYPE_CLOSE; } return common(state, tok); } static int internalSubset(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, "ENTITY")) { state->handler = entity0; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, "ATTLIST")) { state->handler = attlist0; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, "ELEMENT")) { state->handler = element0; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, "NOTATION")) { state->handler = notation0; return XML_ROLE_NONE; } break; case XML_TOK_PI: case XML_TOK_COMMENT: return XML_ROLE_NONE; case XML_TOK_PARAM_ENTITY_REF: return XML_ROLE_PARAM_ENTITY_REF; case XML_TOK_CLOSE_BRACKET: state->handler = doctype5; return XML_ROLE_NONE; } return common(state, tok); } #ifdef XML_DTD static int externalSubset0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { state->handler = externalSubset1; if (tok == XML_TOK_XML_DECL) return XML_ROLE_TEXT_DECL; return externalSubset1(state, tok, ptr, end, enc); } static int externalSubset1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_COND_SECT_OPEN: state->handler = condSect0; return XML_ROLE_NONE; case XML_TOK_COND_SECT_CLOSE: if (state->includeLevel == 0) break; state->includeLevel -= 1; return XML_ROLE_NONE; case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_CLOSE_BRACKET: break; case XML_TOK_NONE: if (state->includeLevel) break; return XML_ROLE_NONE; default: return internalSubset(state, tok, ptr, end, enc); } return common(state, tok); } #endif /* XML_DTD */ static int entity0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_PERCENT: state->handler = entity1; return XML_ROLE_NONE; case XML_TOK_NAME: state->handler = entity2; return XML_ROLE_GENERAL_ENTITY_NAME; } return common(state, tok); } static int entity1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: state->handler = entity7; return XML_ROLE_PARAM_ENTITY_NAME; } return common(state, tok); } static int entity2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, "SYSTEM")) { state->handler = entity4; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, "PUBLIC")) { state->handler = entity3; return XML_ROLE_NONE; } break; case XML_TOK_LITERAL: state->handler = declClose; return XML_ROLE_ENTITY_VALUE; } return common(state, tok); } static int entity3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = entity4; return XML_ROLE_ENTITY_PUBLIC_ID; } return common(state, tok); } static int entity4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = entity5; return XML_ROLE_ENTITY_SYSTEM_ID; } return common(state, tok); } static int entity5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, "NDATA")) { state->handler = entity6; return XML_ROLE_NONE; } break; } return common(state, tok); } static int entity6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: state->handler = declClose; return XML_ROLE_ENTITY_NOTATION_NAME; } return common(state, tok); } static int entity7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, "SYSTEM")) { state->handler = entity9; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, "PUBLIC")) { state->handler = entity8; return XML_ROLE_NONE; } break; case XML_TOK_LITERAL: state->handler = declClose; return XML_ROLE_ENTITY_VALUE; } return common(state, tok); } static int entity8(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = entity9; return XML_ROLE_ENTITY_PUBLIC_ID; } return common(state, tok); } static int entity9(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = declClose; return XML_ROLE_ENTITY_SYSTEM_ID; } return common(state, tok); } static int notation0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: state->handler = notation1; return XML_ROLE_NOTATION_NAME; } return common(state, tok); } static int notation1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, "SYSTEM")) { state->handler = notation3; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, "PUBLIC")) { state->handler = notation2; return XML_ROLE_NONE; } break; } return common(state, tok); } static int notation2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = notation4; return XML_ROLE_NOTATION_PUBLIC_ID; } return common(state, tok); } static int notation3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = declClose; return XML_ROLE_NOTATION_SYSTEM_ID; } return common(state, tok); } static int notation4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = declClose; return XML_ROLE_NOTATION_SYSTEM_ID; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_NOTATION_NO_SYSTEM_ID; } return common(state, tok); } static int attlist0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = attlist1; return XML_ROLE_ATTLIST_ELEMENT_NAME; } return common(state, tok); } static int attlist1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = attlist2; return XML_ROLE_ATTRIBUTE_NAME; } return common(state, tok); } static int attlist2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: { static const char *types[] = { "CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS", }; int i; for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { state->handler = attlist8; return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; } } if (XmlNameMatchesAscii(enc, ptr, end, "NOTATION")) { state->handler = attlist5; return XML_ROLE_NONE; } break; case XML_TOK_OPEN_PAREN: state->handler = attlist3; return XML_ROLE_NONE; } return common(state, tok); } static int attlist3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NMTOKEN: case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = attlist4; return XML_ROLE_ATTRIBUTE_ENUM_VALUE; } return common(state, tok); } static int attlist4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_CLOSE_PAREN: state->handler = attlist8; return XML_ROLE_NONE; case XML_TOK_OR: state->handler = attlist3; return XML_ROLE_NONE; } return common(state, tok); } static int attlist5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_PAREN: state->handler = attlist6; return XML_ROLE_NONE; } return common(state, tok); } static int attlist6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: state->handler = attlist7; return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; } return common(state, tok); } static int attlist7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_CLOSE_PAREN: state->handler = attlist8; return XML_ROLE_NONE; case XML_TOK_OR: state->handler = attlist6; return XML_ROLE_NONE; } return common(state, tok); } /* default value */ static int attlist8(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_POUND_NAME: if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, "IMPLIED")) { state->handler = attlist1; return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; } if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, "REQUIRED")) { state->handler = attlist1; return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; } if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, "FIXED")) { state->handler = attlist9; return XML_ROLE_NONE; } break; case XML_TOK_LITERAL: state->handler = attlist1; return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; } return common(state, tok); } static int attlist9(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_LITERAL: state->handler = attlist1; return XML_ROLE_FIXED_ATTRIBUTE_VALUE; } return common(state, tok); } static int element0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element1; return XML_ROLE_ELEMENT_NAME; } return common(state, tok); } static int element1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, "EMPTY")) { state->handler = declClose; return XML_ROLE_CONTENT_EMPTY; } if (XmlNameMatchesAscii(enc, ptr, end, "ANY")) { state->handler = declClose; return XML_ROLE_CONTENT_ANY; } break; case XML_TOK_OPEN_PAREN: state->handler = element2; state->level = 1; return XML_ROLE_GROUP_OPEN; } return common(state, tok); } static int element2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_POUND_NAME: if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, "PCDATA")) { state->handler = element3; return XML_ROLE_CONTENT_PCDATA; } break; case XML_TOK_OPEN_PAREN: state->level = 2; state->handler = element6; return XML_ROLE_GROUP_OPEN; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT; case XML_TOK_NAME_QUESTION: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_OPT; case XML_TOK_NAME_ASTERISK: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_REP; case XML_TOK_NAME_PLUS: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_PLUS; } return common(state, tok); } static int element3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_CLOSE_PAREN: case XML_TOK_CLOSE_PAREN_ASTERISK: state->handler = declClose; return XML_ROLE_GROUP_CLOSE_REP; case XML_TOK_OR: state->handler = element4; return XML_ROLE_NONE; } return common(state, tok); } static int element4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element5; return XML_ROLE_CONTENT_ELEMENT; } return common(state, tok); } static int element5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_CLOSE_PAREN_ASTERISK: state->handler = declClose; return XML_ROLE_GROUP_CLOSE_REP; case XML_TOK_OR: state->handler = element4; return XML_ROLE_NONE; } return common(state, tok); } static int element6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_PAREN: state->level += 1; return XML_ROLE_GROUP_OPEN; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT; case XML_TOK_NAME_QUESTION: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_OPT; case XML_TOK_NAME_ASTERISK: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_REP; case XML_TOK_NAME_PLUS: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_PLUS; } return common(state, tok); } static int element7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_CLOSE_PAREN: state->level -= 1; if (state->level == 0) state->handler = declClose; return XML_ROLE_GROUP_CLOSE; case XML_TOK_CLOSE_PAREN_ASTERISK: state->level -= 1; if (state->level == 0) state->handler = declClose; return XML_ROLE_GROUP_CLOSE_REP; case XML_TOK_CLOSE_PAREN_QUESTION: state->level -= 1; if (state->level == 0) state->handler = declClose; return XML_ROLE_GROUP_CLOSE_OPT; case XML_TOK_CLOSE_PAREN_PLUS: state->level -= 1; if (state->level == 0) state->handler = declClose; return XML_ROLE_GROUP_CLOSE_PLUS; case XML_TOK_COMMA: state->handler = element6; return XML_ROLE_GROUP_SEQUENCE; case XML_TOK_OR: state->handler = element6; return XML_ROLE_GROUP_CHOICE; } return common(state, tok); } #ifdef XML_DTD static int condSect0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, "INCLUDE")) { state->handler = condSect1; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, "IGNORE")) { state->handler = condSect2; return XML_ROLE_NONE; } break; } return common(state, tok); } static int condSect1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = externalSubset1; state->includeLevel += 1; return XML_ROLE_NONE; } return common(state, tok); } static int condSect2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = externalSubset1; return XML_ROLE_IGNORE_SECT; } return common(state, tok); } #endif /* XML_DTD */ static int declClose(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_NONE; } return common(state, tok); } #if 0 static int ignore(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_DECL_CLOSE: state->handler = internalSubset; return 0; default: return XML_ROLE_NONE; } return common(state, tok); } #endif static int error(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { return XML_ROLE_NONE; } static int common(PROLOG_STATE *state, int tok) { #ifdef XML_DTD if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) return XML_ROLE_INNER_PARAM_ENTITY_REF; #endif state->handler = error; return XML_ROLE_ERROR; } void XmlPrologStateInit(PROLOG_STATE *state) { state->handler = prolog0; #ifdef XML_DTD state->documentEntity = 1; state->includeLevel = 0; #endif /* XML_DTD */ } #ifdef XML_DTD void XmlPrologStateInitExternalEntity(PROLOG_STATE *state) { state->handler = externalSubset0; state->documentEntity = 0; state->includeLevel = 0; } #endif /* XML_DTD */ cadaver-0.23.3/lib/expat/xmltok/xmltok_impl.h0000664000076400007640000000240110132320456020534 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ enum { BT_NONXML, BT_MALFORM, BT_LT, BT_AMP, BT_RSQB, BT_LEAD2, BT_LEAD3, BT_LEAD4, BT_TRAIL, BT_CR, BT_LF, BT_GT, BT_QUOT, BT_APOS, BT_EQUALS, BT_QUEST, BT_EXCL, BT_SOL, BT_SEMI, BT_NUM, BT_LSQB, BT_S, BT_NMSTRT, BT_COLON, BT_HEX, BT_DIGIT, BT_NAME, BT_MINUS, BT_OTHER, /* known not to be a name or name start character */ BT_NONASCII, /* might be a name or name start character */ BT_PERCNT, BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, BT_COMMA, BT_VERBAR }; #include cadaver-0.23.3/lib/expat/xmltok/utf8tab.h0000664000076400007640000000451410132320456017561 0ustar jortonjorton/* expat XML parser Copyright (C) 1998 James Clark 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 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, cadaver-0.23.3/lib/mkstemp.c0000664000076400007640000000253010545034170015217 0ustar jortonjorton/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include "common.h" #ifndef __GT_FILE # define __GT_FILE 0 #endif int __gen_tempname (); /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int cad_mkstemp (char *template) { return __gen_tempname (template, __GT_FILE); } cadaver-0.23.3/lib/tempname.c0000664000076400007640000002217310132320456015347 0ustar jortonjorton/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #if HAVE_CONFIG_H # include #endif #include #include #include #ifndef __set_errno # define __set_errno(Val) errno = (Val) #endif #include #ifndef P_tmpdir # define P_tmpdir "/tmp" #endif #ifndef TMP_MAX # define TMP_MAX 238328 #endif #ifndef __GT_FILE # define __GT_FILE 0 # define __GT_BIGFILE 1 # define __GT_DIR 2 # define __GT_NOCREATE 3 #endif #if STDC_HEADERS || defined(_LIBC) # include # include #endif #include #if HAVE_FCNTL_H || defined(_LIBC) # include #endif #if HAVE_SYS_TIME_H || defined(_LIBC) # include #endif #if HAVE_STDINT_H || defined(_LIBC) # include #endif #if HAVE_UNISTD_H || defined(_LIBC) # include #endif #include #ifdef STAT_MACROS_BROKEN # undef S_ISDIR #endif #if !defined S_ISDIR && defined S_IFDIR # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif #if !S_IRUSR && S_IREAD # define S_IRUSR S_IREAD #endif #if !S_IRUSR # define S_IRUSR 00400 #endif #if !S_IWUSR && S_IWRITE # define S_IWUSR S_IWRITE #endif #if !S_IWUSR # define S_IWUSR 00200 #endif #if !S_IXUSR && S_IEXEC # define S_IXUSR S_IEXEC #endif #if !S_IXUSR # define S_IXUSR 00100 #endif #if defined(_LIBC) # define struct_stat64 struct stat64 #else # define struct_stat64 struct stat # define __getpid getpid # define __gettimeofday gettimeofday # define __mkdir mkdir # define __open open # define __open64 open # define __lxstat64(version, path, buf) lstat (path, buf) # define __xstat64(version, path, buf) stat (path, buf) #endif #if ! (HAVE___SECURE_GETENV || defined(_LIBC)) # define __secure_getenv getenv #endif #ifdef _LIBC # include # if HP_TIMING_AVAIL # define RANDOM_BITS(Var) \ if (__builtin_expect (value == UINT64_C (0), 0)) \ { \ /* If this is the first time this function is used initialize \ the variable we accumulate the value in to some somewhat \ random value. If we'd not do this programs at startup time \ might have a reduced set of possible names, at least on slow \ machines. */ \ struct timeval tv; \ __gettimeofday (&tv, NULL); \ value = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; \ } \ HP_TIMING_NOW (Var) # endif #endif /* Use the widest available unsigned type if uint64_t is not available. The algorithm below extracts a number less than 62**6 (approximately 2**35.725) from uint64_t, so ancient hosts where uintmax_t is only 32 bits lose about 3.725 bits of randomness, which is better than not having mkstemp at all. */ #if !defined UINT64_MAX && !defined uint64_t # define uint64_t uintmax_t #endif /* Return nonzero if DIR is an existent directory. */ static int direxists (const char *dir) { struct_stat64 buf; return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode); } /* Prototypes. */ int __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, int try_tmpdir); int __gen_tempname (char *tmpl, int kind); /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is non-null and exists, uses it; otherwise uses the first of $TMPDIR, P_tmpdir, /tmp that exists. Copies into TMPL a template suitable for use with mk[s]temp. Will fail (-1) if DIR is non-null and doesn't exist, none of the searched dirs exists, or there's not enough space in TMPL. */ int __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, int try_tmpdir) { const char *d; size_t dlen, plen; if (!pfx || !pfx[0]) { pfx = "file"; plen = 4; } else { plen = strlen (pfx); if (plen > 5) plen = 5; } if (try_tmpdir) { d = __secure_getenv ("TMPDIR"); if (d != NULL && direxists (d)) dir = d; else if (dir != NULL && direxists (dir)) /* nothing */ ; else dir = NULL; } if (dir == NULL) { if (direxists (P_tmpdir)) dir = P_tmpdir; else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) dir = "/tmp"; else { __set_errno (ENOENT); return -1; } } dlen = strlen (dir); while (dlen > 1 && dir[dlen - 1] == '/') dlen--; /* remove trailing slashes */ /* check we have room for "${dir}/${pfx}XXXXXX\0" */ if (tmpl_len < dlen + 1 + plen + 6 + 1) { __set_errno (EINVAL); return -1; } sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx); return 0; } /* These are the characters used in temporary filenames. */ static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; /* Generate a temporary file name based on TMPL. TMPL must match the rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed does not exist at the time of the call to __gen_tempname. TMPL is overwritten with the result. KIND may be one of: __GT_NOCREATE: simply verify that the name does not exist at the time of the call. __GT_FILE: create the file using open(O_CREAT|O_EXCL) and return a read-write fd. The file is mode 0600. __GT_BIGFILE: same as __GT_FILE but use open64(). __GT_DIR: create a directory, which will be mode 0700. We use a clever algorithm to get hard-to-predict names. */ int __gen_tempname (char *tmpl, int kind) { char *XXXXXX; static uint64_t value; uint64_t random_time_bits; unsigned int count; int fd = -1; int save_errno = errno; struct_stat64 st; /* A lower bound on the number of temporary files to attempt to generate. The maximum total number of temporary file names that can exist for a given template is 62**6. It should never be necessary to try all these combinations. Instead if a reasonable number of names is tried (we define reasonable as 62**3) fail to give the system administrator the chance to remove the problems. */ unsigned int attempts_min = 62 * 62 * 62; /* The number of times to attempt to generate a temporary file. To conform to POSIX, this must be no smaller than TMP_MAX. */ unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min; #ifdef VANILLA len = strlen (tmpl); if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) { __set_errno (EINVAL); return -1; } /* This is where the Xs start. */ XXXXXX = &tmpl[len - 6]; #else /* !VANILLA */ /* hacked for cadaver. */ XXXXXX = strstr(tmpl, "XXXXXX"); if (XXXXXX == NULL) { __set_errno (EINVAL); return -1; } #endif /* VANILLA */ /* Get some more or less random data. */ #ifdef RANDOM_BITS RANDOM_BITS (random_time_bits); #else # if HAVE_GETTIMEOFDAY || defined(_LIBC) { struct timeval tv; __gettimeofday (&tv, NULL); random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; } # else random_time_bits = time (NULL); # endif #endif value += random_time_bits ^ __getpid (); for (count = 0; count < attempts; value += 7777, ++count) { uint64_t v = value; /* Fill in the random bits. */ XXXXXX[0] = letters[v % 62]; v /= 62; XXXXXX[1] = letters[v % 62]; v /= 62; XXXXXX[2] = letters[v % 62]; v /= 62; XXXXXX[3] = letters[v % 62]; v /= 62; XXXXXX[4] = letters[v % 62]; v /= 62; XXXXXX[5] = letters[v % 62]; switch (kind) { case __GT_FILE: fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); break; case __GT_BIGFILE: fd = __open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); break; case __GT_DIR: fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); break; case __GT_NOCREATE: /* This case is backward from the other three. __gen_tempname succeeds if __xstat fails because the name does not exist. Note the continue to bypass the common logic at the bottom of the loop. */ if (__lxstat64 (_STAT_VER, tmpl, &st) < 0) { if (errno == ENOENT) { __set_errno (save_errno); return 0; } else /* Give up now. */ return -1; } continue; default: assert (! "invalid KIND in __gen_tempname"); } if (fd >= 0) { __set_errno (save_errno); return fd; } else if (errno != EEXIST) return -1; } /* We got out of the loop because we ran out of combinations to try. */ __set_errno (EEXIST); return -1; } cadaver-0.23.3/lib/getopt.c0000664000076400007640000007265310132320456015053 0ustar jortonjorton/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ # ifdef HAVE_LIBINTL_H # include # define _(msgid) gettext (msgid) # else # define _(msgid) (msgid) # endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # include # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; static int original_argc; static char *const *original_argv; /* Make sure the environment variable bash 2.0 puts in the environment is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ static void __attribute__ ((unused)) store_args_and_env (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ original_argc = argc; original_argv = argv; } # ifdef text_set_element text_set_element (__libc_subinit, store_args_and_env); # endif /* text_set_element */ # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #ifdef _LIBC /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #ifdef _LIBC if (posixly_correct == NULL && argc == original_argc && argv == original_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ cadaver-0.23.3/lib/basename.h0000664000076400007640000000004510132320456015313 0ustar jortonjorton char *base_name (char const *name); cadaver-0.23.3/lib/fnmatch.c0000664000076400007640000001202110132320456015150 0ustar jortonjorton/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if HAVE_CONFIG_H # include #endif #include #include #include #if defined (STDC_HEADERS) || !defined (isascii) # define ISASCII(c) 1 #else # define ISASCII(c) isascii(c) #endif #define ISUPPER(c) (ISASCII (c) && isupper (c)) /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) # ifndef errno extern int errno; # endif /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ int fnmatch (pattern, string, flags) const char *pattern; const char *string; int flags; { register const char *p = pattern, *n = string; register char c; /* Note that this evalutes C many times. */ # define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) while ((c = *p++) != '\0') { c = FOLD (c); switch (c) { case '?': if (*n == '\0') return FNM_NOMATCH; else if ((flags & FNM_FILE_NAME) && *n == '/') return FNM_NOMATCH; else if ((flags & FNM_PERIOD) && *n == '.' && (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; break; case '\\': if (!(flags & FNM_NOESCAPE)) { c = *p++; c = FOLD (c); } if (FOLD (*n) != c) return FNM_NOMATCH; break; case '*': if ((flags & FNM_PERIOD) && *n == '.' && (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; for (c = *p++; c == '?' || c == '*'; c = *p++, ++n) if (((flags & FNM_FILE_NAME) && *n == '/') || (c == '?' && *n == '\0')) return FNM_NOMATCH; if (c == '\0') return 0; { char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; c1 = FOLD (c1); for (--p; *n != '\0'; ++n) if ((c == '[' || FOLD (*n) == c1) && fnmatch (p, n, flags & ~FNM_PERIOD) == 0) return 0; return FNM_NOMATCH; } case '[': { /* Nonzero if the sense of the character class is inverted. */ register int not; if (*n == '\0') return FNM_NOMATCH; if ((flags & FNM_PERIOD) && *n == '.' && (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; not = (*p == '!' || *p == '^'); if (not) ++p; c = *p++; for (;;) { register char cstart = c, cend = c; if (!(flags & FNM_NOESCAPE) && c == '\\') cstart = cend = *p++; cstart = cend = FOLD (cstart); if (c == '\0') /* [ (unterminated) loses. */ return FNM_NOMATCH; c = *p++; c = FOLD (c); if ((flags & FNM_FILE_NAME) && c == '/') /* [/] can never match. */ return FNM_NOMATCH; if (c == '-' && *p != ']') { cend = *p++; if (!(flags & FNM_NOESCAPE) && cend == '\\') cend = *p++; if (cend == '\0') return FNM_NOMATCH; cend = FOLD (cend); c = *p++; } if (FOLD (*n) >= cstart && FOLD (*n) <= cend) goto matched; if (c == ']') break; } if (!not) return FNM_NOMATCH; break; matched:; /* Skip the rest of the [...] that already matched. */ while (c != ']') { if (c == '\0') /* [... (unterminated) loses. */ return FNM_NOMATCH; c = *p++; if (!(flags & FNM_NOESCAPE) && c == '\\') /* XXX 1003.2d11 is unclear if this is right. */ ++p; } if (not) return FNM_NOMATCH; } break; default: if (c != FOLD (*n)) return FNM_NOMATCH; } ++n; } if (*n == '\0') return 0; if ((flags & FNM_LEADING_DIR) && *n == '/') /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */ return 0; return FNM_NOMATCH; # undef FOLD } #endif /* _LIBC or not __GNU_LIBRARY__. */ cadaver-0.23.3/lib/strcasecmp.c0000664000076400007640000000254310132320456015704 0ustar jortonjorton/* Copyright (C) 1991, 1992 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #include /* Compare S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexiographically less than, equal to or greater than S2. */ int strcasecmp (s1, s2) const char *s1; const char *s2; { register const unsigned char *p1 = (const unsigned char *) s1; register const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; if (p1 == p2) return 0; do { c1 = tolower (*p1++); c2 = tolower (*p2++); if (c1 == '\0') break; } while (c1 == c2); return c1 - c2; } cadaver-0.23.3/lib/getpass.c0000664000076400007640000001060610132320456015205 0ustar jortonjorton/* * For license terms, see the file COPYING in this directory. */ /*********************************************************************** module: getpass.c project: fetchmail programmer: Carl Harris, ceharris@mal.com description: getpass() replacement which allows for long passwords. This version hacked by Wilfred Teiken, allowing the password to be piped to fetchmail. ***********************************************************************/ #include "config.h" #include #include #include #if defined(HAVE_UNISTD_H) #include #endif #if defined(HAVE_STDLIB_H) #include #endif #include "i18n.h" #include "getpass.h" #define INPUT_BUF_SIZE PASSWORDLEN #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCSETATTR) # include #else #if defined(HAVE_TERMIO_H) # include # include #else #if defined(HAVE_SGTTY_H) # include #endif #endif #endif static int ttyfd; #if defined(HAVE_TCSETATTR) static struct termios termb; static tcflag_t flags; #else #if defined(HAVE_TERMIO_H) static struct termio termb; static unsigned short flags; #else #if defined(HAVE_STTY) static struct sgttyb ttyb; static int flags; #endif #endif #endif void static save_tty_state(void); void static disable_tty_echo(void); void static restore_tty_state(void); static RETSIGTYPE sigint_handler(int); char *fm_getpassword(const char *prompt) { #if !(defined(HAVE_TCSETATTR) || defined(HAVE_TERMIO_H) || defined(HAVE_STTY)) #if defined(HAVE_GETPASS) char *getpass(); return getpass(prompt); #else fputs(_("ERROR: no support for getpassword() routine\n"),stderr); exit(1); #endif #else register char *p; register int c; FILE *fi; static char pbuf[INPUT_BUF_SIZE]; RETSIGTYPE (*sig)(int) = 0; /* initialization pacifies -Wall */ RETSIGTYPE sigint_handler(int); char *ret; int istty = isatty(0); /* get the file descriptor for the actual input device if it's a tty */ if (istty) { if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL) fi = stdin; else setbuf(fi, (char *)NULL); } else fi = stdin; /* store descriptor for the tty */ ttyfd = fileno(fi); if (istty) { /* preserve tty state before turning off echo */ save_tty_state(); /* now that we have the current tty state, we can catch SIGINT and exit gracefully */ sig = signal(SIGINT, sigint_handler); /* turn off echo on the tty */ disable_tty_echo(); /* display the prompt and get the input string */ fprintf(stderr, "%s", prompt); } for (p = pbuf; (c = getc(fi))!='\n' && c!=EOF;) { if (p < &pbuf[INPUT_BUF_SIZE - 1]) *p++ = c; } *p = '\0'; if (c == EOF) ret = NULL; else ret = pbuf; /* write a newline so cursor won't appear to hang */ if (fi != stdin) fprintf(stderr, "\n"); if (istty) { /* restore previous state of the tty */ restore_tty_state(); /* restore previous state of SIGINT */ signal(SIGINT, sig); } if (fi != stdin) fclose(fi); /* not checking should be safe, file mode was "r" */ return(ret); #endif /* !(defined(HAVE_TCSETATTR) || ... */ } static void save_tty_state (void) { #if defined(HAVE_TCSETATTR) tcgetattr(ttyfd, &termb); flags = termb.c_lflag; #else #if defined(HAVE_TERMIO_H) ioctl(ttyfd, TCGETA, (char *) &termb); flags = termb.c_lflag; #else /* we HAVE_STTY */ gtty(ttyfd, &ttyb); flags = ttyb.sg_flags; #endif #endif } static void disable_tty_echo(void) { /* turn off echo on the tty */ #if defined(HAVE_TCSETATTR) termb.c_lflag &= ~ECHO; tcsetattr(ttyfd, TCSAFLUSH, &termb); #else #if defined(HAVE_TERMIO_H) termb.c_lflag &= ~ECHO; ioctl(ttyfd, TCSETA, (char *) &termb); #else /* we HAVE_STTY */ ttyb.sg_flags &= ~ECHO; stty(ttyfd, &ttyb); #endif #endif } static void restore_tty_state(void) { /* restore previous tty echo state */ #if defined(HAVE_TCSETATTR) termb.c_lflag = flags; tcsetattr(ttyfd, TCSAFLUSH, &termb); #else #if defined(HAVE_TERMIO_H) termb.c_lflag = flags; ioctl(ttyfd, TCSETA, (char *) &termb); #else /* we HAVE_STTY */ ttyb.sg_flags = flags; stty(ttyfd, &ttyb); #endif #endif } static RETSIGTYPE sigint_handler(int signum) { restore_tty_state(); fprintf(stderr, _("\nCaught SIGINT... bailing out.\n")); exit(1); } /* getpass.c ends here */ cadaver-0.23.3/lib/glob.h0000664000076400007640000001557510132320456014501 0ustar jortonjorton/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GLOB_H #define _GLOB_H 1 #ifdef __cplusplus extern "C" { #endif #undef __ptr_t #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 /* joe: added !defined __PMT at the end here: */ # if !defined __GLIBC__ || !defined __P || !defined __PMT # undef __P # undef __PMT # define __P(protos) protos # define __PMT(protos) protos # if !defined __GNUC__ || __GNUC__ < 2 # undef __const # define __const const # endif # endif # define __ptr_t void * #else /* Not C++ or ANSI C. */ # undef __P # undef __PMT # define __P(protos) () # define __PMT(protos) () # undef __const # define __const # define __ptr_t char * #endif /* C++ or ANSI C. */ /* We need `size_t' for the following definitions. */ #ifndef __size_t # if defined __GNUC__ && __GNUC__ >= 2 typedef __SIZE_TYPE__ __size_t; # else /* This is a guess. */ typedef unsigned long int __size_t; # endif #else /* The GNU CC stddef.h version defines __size_t as empty. We need a real definition. */ # undef __size_t # define __size_t size_t #endif /* Bits set in the FLAGS argument to `glob'. */ #define GLOB_ERR (1 << 0)/* Return on read errors. */ #define GLOB_MARK (1 << 1)/* Append a slash to each name. */ #define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ #define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ #define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ #define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \ || defined _GNU_SOURCE) # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ # define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ # define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ # define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ # define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error if the user name is not available. */ # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) #else # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD) #endif /* Error returns from `glob'. */ #define GLOB_NOSPACE 1 /* Ran out of memory. */ #define GLOB_ABORTED 2 /* Read error. */ #define GLOB_NOMATCH 3 /* No matches found. */ #define GLOB_NOSYS 4 /* Not implemented. */ #ifdef _GNU_SOURCE /* Previous versions of this file defined GLOB_ABEND instead of GLOB_ABORTED. Provide a compatibility definition here. */ # define GLOB_ABEND GLOB_ABORTED #endif /* Structure describing a globbing run. */ #if !defined _AMIGA && !defined VMS /* Buggy compiler. */ struct stat; #endif typedef struct { __size_t gl_pathc; /* Count of paths matched by the pattern. */ char **gl_pathv; /* List of matched pathnames. */ __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ /* If the GLOB_ALTDIRFUNC flag is set, the following functions are used instead of the normal file access functions. */ void (*gl_closedir) __PMT ((void *)); struct dirent *(*gl_readdir) __PMT ((void *)); __ptr_t (*gl_opendir) __PMT ((__const char *)); int (*gl_lstat) __PMT ((__const char *, struct stat *)); int (*gl_stat) __PMT ((__const char *, struct stat *)); } glob_t; #ifdef _LARGEFILE64_SOURCE struct stat64; typedef struct { __size_t gl_pathc; char **gl_pathv; __size_t gl_offs; int gl_flags; /* If the GLOB_ALTDIRFUNC flag is set, the following functions are used instead of the normal file access functions. */ void (*gl_closedir) __PMT ((void *)); struct dirent64 *(*gl_readdir) __PMT ((void *)); __ptr_t (*gl_opendir) __PMT ((__const char *)); int (*gl_lstat) __PMT ((__const char *, struct stat64 *)); int (*gl_stat) __PMT ((__const char *, struct stat64 *)); } glob64_t; #endif /* Do glob searching for PATTERN, placing results in PGLOB. The bits defined above may be set in FLAGS. If a directory cannot be opened or read and ERRFUNC is not nil, it is called with the pathname that caused the error, and the `errno' value from the failing call; if it returns non-zero `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ #if !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64 extern int glob __P ((__const char *__pattern, int __flags, int (*__errfunc) (__const char *, int), glob_t *__pglob)); /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void globfree __P ((glob_t *__pglob)); #else # if __GNUC__ >= 2 extern int glob __P ((__const char *__pattern, int __flags, int (*__errfunc) (__const char *, int), glob_t *__pglob)) __asm__ ("glob64"); extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64"); # else # define glob glob64 # define globfree globfree64 # endif #endif #ifdef _LARGEFILE64_SOURCE extern int glob64 __P ((__const char *__pattern, int __flags, int (*__errfunc) (__const char *, int), glob64_t *__pglob)); extern void globfree64 __P ((glob64_t *__pglob)); #endif #ifdef _GNU_SOURCE /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. This function is not part of the interface specified by POSIX.2 but several programs want to use it. */ extern int glob_pattern_p __P ((__const char *__pattern, int __quote)); #endif #ifdef __cplusplus } #endif #endif /* glob.h */ cadaver-0.23.3/lib/netrc.c0000664000076400007640000002115010132320456014646 0ustar jortonjorton/* netrc.c -- parse the .netrc file to get hosts, accounts, and passwords Gordon Matzigkeit , 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. For license terms, see the file COPYING in this directory. Compile with -DSTANDALONE to test this module. */ #include #include #include #include #include #include "netrc.h" /* Normally defined in xstrdup.c. */ # define xstrdup strdup /* Normally defined in xmalloc.c */ # define xmalloc malloc # define xrealloc realloc #define POPBUFSIZE BUFSIZ /* Maybe add NEWENTRY to the account information list, LIST. NEWENTRY is set to a ready-to-use netrc_entry, in any event. */ static void maybe_add_to_list (netrc_entry **newentry, netrc_entry **list) { netrc_entry *a, *l; a = *newentry; l = *list; /* We need an account name in order to add the entry to the list. */ if (a && ! a->account) { /* Free any allocated space. */ if (a->host) free (a->host); if (a->password) free (a->password); } else { if (a) { /* Add the current machine into our list. */ a->next = l; l = a; } /* Allocate a new netrc_entry structure. */ a = (netrc_entry *) xmalloc (sizeof (netrc_entry)); } /* Zero the structure, so that it is ready to use. */ memset (a, 0, sizeof(*a)); /* Return the new pointers. */ *newentry = a; *list = l; return; } /* Parse FILE as a .netrc file (as described in ftp(1)), and return a list of entries. NULL is returned if the file could not be parsed. */ netrc_entry * parse_netrc (file) char *file; { FILE *fp; char buf[POPBUFSIZE+1], *p, *tok; const char *premature_token; netrc_entry *current, *retval; int ln; /* The latest token we've seen in the file. */ enum { tok_nothing, tok_account, tok_login, tok_macdef, tok_machine, tok_password } last_token = tok_nothing; current = retval = NULL; fp = fopen (file, "r"); if (!fp) { /* Just return NULL if we can't open the file. */ return NULL; } /* Initialize the file data. */ ln = 0; premature_token = NULL; /* While there are lines in the file... */ while (fgets(buf, POPBUFSIZE, fp)) { ln++; /* Strip trailing CRLF */ for (p = buf + strlen(buf) - 1; (p >= buf) && isspace((unsigned)*p); p--) *p = '\0'; /* Parse the line. */ p = buf; /* If the line is empty... */ if (!*p) { if (last_token == tok_macdef) { /* end of macro */ last_token = tok_nothing; } else { continue; /* otherwise ignore it */ } } /* If we are defining macros, then skip parsing the line. */ while (*p && last_token != tok_macdef) { char quote_char = 0; char *pp; /* Skip any whitespace. */ while (*p && isspace ((unsigned)*p)) p++; /* Discard end-of-line comments. */ if (*p == '#') break; tok = pp = p; /* Find the end of the token. */ while (*p && (quote_char || !isspace ((unsigned)*p))) { if (quote_char) { if (quote_char == *p) { quote_char = 0; p ++; } else { *pp = *p; p ++; pp ++; } } else { if (*p == '"' || *p == '\'') quote_char = *p; else { *pp = *p; pp ++; } p ++; } } /* Null-terminate the token, if it isn't already. */ if (*p) *p ++ = '\0'; *pp = 0; switch (last_token) { case tok_login: if (current) current->account = (char *) xstrdup (tok); else premature_token = "login"; break; case tok_machine: /* Start a new machine entry. */ maybe_add_to_list (¤t, &retval); current->host = (char *) xstrdup (tok); break; case tok_password: if (current) current->password = (char *) xstrdup (tok); else premature_token = "password"; break; /* We handle most of tok_macdef above. */ case tok_macdef: if (!current) premature_token = "macdef"; break; /* We don't handle the account keyword at all. */ case tok_account: if (!current) premature_token = "account"; break; /* We handle tok_nothing below this switch. */ case tok_nothing: break; } if (premature_token) { #ifdef HAVE_ERROR error_at_line (0, file, ln, "warning: found \"%s\" before any host names", premature_token); #else fprintf (stderr, "%s:%d: warning: found \"%s\" before any host names\n", file, ln, premature_token); #endif premature_token = NULL; } if (last_token != tok_nothing) /* We got a value, so reset the token state. */ last_token = tok_nothing; else { /* Fetch the next token. */ if (!strcmp (tok, "default")) { maybe_add_to_list (¤t, &retval); } else if (!strcmp (tok, "login")) last_token = tok_login; else if (!strcmp (tok, "user")) last_token = tok_login; else if (!strcmp (tok, "macdef")) last_token = tok_macdef; else if (!strcmp (tok, "machine")) last_token = tok_machine; else if (!strcmp (tok, "password")) last_token = tok_password; else if (!strcmp (tok, "passwd")) last_token = tok_password; else if (!strcmp (tok, "account")) last_token = tok_account; else { fprintf (stderr, "%s:%d: warning: unknown token \"%s\"\n", file, ln, tok); } } } } fclose (fp); /* Finalize the last machine entry we found. */ maybe_add_to_list (¤t, &retval); free (current); /* Reverse the order of the list so that it appears in file order. */ current = retval; retval = NULL; while (current) { netrc_entry *saved_reference; /* Change the direction of the pointers. */ saved_reference = current->next; current->next = retval; /* Advance to the next node. */ retval = current; current = saved_reference; } return retval; } /* Return the netrc entry from LIST corresponding to HOST. NULL is returned if no such entry exists. */ netrc_entry * search_netrc (list, host) netrc_entry *list; const char *host; { /* Look for the HOST in LIST. */ while (list) { if (!list->host) /* We hit the default entry. */ break; else if (!strcmp (list->host, host)) /* We found a matching entry. */ break; list = list->next; } /* Return the matching entry, or NULL. */ return list; } #ifdef STANDALONE #include #include extern int errno; int main (argc, argv) int argc; char **argv; { struct stat sb; char *program_name, *file, *target; netrc_entry *head, *a; if (argc < 2) { fprintf (stderr, "Usage: %s NETRC [HOSTNAME]...\n", argv[0]); exit (1); } program_name = argv[0]; file = argv[1]; target = argv[2]; if (stat (file, &sb)) { fprintf (stderr, "%s: cannot stat %s: %s\n", argv[0], file, strerror (errno)); exit (1); } head = parse_netrc (file); if (!head) { fprintf (stderr, "%s: no entries found in %s\n", argv[0], file); exit (1); } if (argc > 2) { int i, status; status = 0; for (i = 2; i < argc; i++) { /* Print out the host that we are checking for. */ fputs (argv[i], stdout); a = search_netrc (head, argv[i]); if (a) { /* Print out the account and password (if any). */ fputc (' ', stdout); fputs (a->account, stdout); if (a->password) { fputc (' ', stdout); fputs (a->password, stdout); } } else status = 1; fputc ('\n', stdout); } exit (status); } /* Print out the entire contents of the netrc. */ a = head; while (a) { /* Print the host name. */ if (a->host) fputs (a->host, stdout); else fputs ("DEFAULT", stdout); fputc (' ', stdout); /* Print the account name. */ fputs (a->account, stdout); if (a->password) { /* Print the password, if there is any. */ fputc (' ', stdout); fputs (a->password, stdout); } fputc ('\n', stdout); a = a->next; } exit (0); } #endif /* STANDALONE */ cadaver-0.23.3/lib/getopt.h0000664000076400007640000001076710132320456015056 0ustar jortonjorton/* Declarations for getopt. Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if defined (__STDC__) && __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #if defined (__STDC__) && __STDC__ #ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); #endif /* __STDC__ */ #ifdef __cplusplus } #endif #endif /* getopt.h */ cadaver-0.23.3/lib/snprintf.h0000664000076400007640000001441610132320456015412 0ustar jortonjorton/* Unix snprintf implementation. Version 1.1 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Revision History: sitecopy changes: added sys/types.h include to pick up size_t define. renamed dtoa -> doubletoa to avoid dtoa conflict with cygwin. 1.1: * added changes from Miles Bader * corrected a bug with %f * added support for %#g * added more comments :-) 1.0: * supporting must ANSI syntaxic_sugars(see below) 0.0: * suppot %s %c %d it understands: Integer: %lu %lu %u %hd %ld %d decimal %ho %lo %o octal %hx %lx %x %X hexa Floating points: %g %G %e %E %f double Strings: %s %c string %% % Formating conversion flags: - justify left + Justify right or put a plus if number # prefix 0x, 0X for hexa and 0 for octal * precision/witdth is specify as an (int) in the arguments ' ' leave a blank for number with no sign l the later should be a long h the later should be a short format: snprintf(holder, sizeof_holder, format, ...) Return values: (sizeof_holder - 1) THANKS(for the patches and ideas): Miles Bader Cyrille Rustom Jacek Slabocewiz Mike Parker(mouse) Alain Magloire: alainm@rcsm.ee.mcgill.ca */ #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ /**** changed for sitecopy ****/ #include #include #else #include #endif /* * For the FLOATING POINT FORMAT : * the challenge was finding a way to * manipulate the Real numbers without having * to resort to mathematical function(it * would require to link with -lm) and not * going down to the bit pattern(not portable) * * so a number, a real is: real = integral + fraction integral = ... + a(2)*10^2 + a(1)*10^1 + a(0)*10^0 fraction = b(1)*10^-1 + b(2)*10^-2 + ... where: 0 <= a(i) => 9 0 <= b(i) => 9 from then it was simple math */ /* * size of the buffer for the integral part * and the fraction part */ #define MAX_INT 99 + 1 /* 1 for the null */ #define MAX_FRACT 29 + 1 /* * numtoa() uses PRIVATE buffers to store the results, * So this function is not reentrant */ #define itoa(n) numtoa(n, 10, 0, (char **)0) #define otoa(n) numtoa(n, 8, 0, (char **)0) #define htoa(n) numtoa(n, 16, 0, (char **)0) #define doubletoa(n, p, f) numtoa(n, 10, p, f) #define SWAP_INT(a,b) {int t; t = (a); (a) = (b); (b) = t;} /* this struct holds everything we need */ struct DATA { int length; char *holder; int counter; #ifdef __STDC__ const char *pf; #else char *pf; #endif /* FLAGS */ int width, precision; int justify; char pad; int square, space, star_w, star_p, a_long ; }; #define PRIVATE static #define PUBLIC extern /* signature of the functions */ #ifdef __STDC__ /* the floating point stuff */ PRIVATE double pow_10(int); PRIVATE int log_10(double); PRIVATE double integral(double, double *); PRIVATE char * numtoa(double, int, int, char **); /* for the format */ PRIVATE void conv_flag(char *, struct DATA *); PRIVATE void floating(struct DATA *, double); PRIVATE void exponent(struct DATA *, double); PRIVATE void decimal(struct DATA *, double); PRIVATE void octal(struct DATA *, double); PRIVATE void hexa(struct DATA *, double); PRIVATE void strings(struct DATA *, char *); #else /* the floating point stuff */ PRIVATE double pow_10(); PRIVATE int log_10(); PRIVATE double integral(); PRIVATE char * numtoa(); /* for the format */ PRIVATE void conv_flag(); PRIVATE void floating(); PRIVATE void exponent(); PRIVATE void decimal(); PRIVATE void octal(); PRIVATE void hexa(); PRIVATE void strings(); #endif /* those are defines specific to snprintf to hopefully * make the code clearer :-) */ #define RIGHT 1 #define LEFT 0 #define NOT_FOUND -1 #define FOUND 1 #define MAX_FIELD 15 /* the conversion flags */ #define isflag(c) ((c) == '#' || (c) == ' ' || \ (c) == '*' || (c) == '+' || \ (c) == '-' || (c) == '.' || \ isdigit(c)) /* round off to the precision */ #define ROUND(d, p) \ (d < 0.) ? \ d - pow_10(-(p)->precision) * 0.5 : \ d + pow_10(-(p)->precision) * 0.5 /* set default precision */ #define DEF_PREC(p) \ if ((p)->precision == NOT_FOUND) \ (p)->precision = 6 /* put a char */ #define PUT_CHAR(c, p) \ if ((p)->counter < (p)->length) { \ *(p)->holder++ = (c); \ (p)->counter++; \ } #define PUT_PLUS(d, p) \ if ((d) > 0. && (p)->justify == RIGHT) \ PUT_CHAR('+', p) #define PUT_SPACE(d, p) \ if ((p)->space == FOUND && (d) > 0.) \ PUT_CHAR(' ', p) /* pad right */ #define PAD_RIGHT(p) \ if ((p)->width > 0 && (p)->justify != LEFT) \ for (; (p)->width > 0; (p)->width--) \ PUT_CHAR((p)->pad, p) /* pad left */ #define PAD_LEFT(p) \ if ((p)->width > 0 && (p)->justify == LEFT) \ for (; (p)->width > 0; (p)->width--) \ PUT_CHAR((p)->pad, p) /* if width and prec. in the args */ #define STAR_ARGS(p) \ if ((p)->star_w == FOUND) \ (p)->width = va_arg(args, int); \ if ((p)->star_p == FOUND) \ (p)->precision = va_arg(args, int) PUBLIC int #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ snprintf(char *string, size_t length, const char * format, ...); #else snprintf(string, length, format, va_alist); char *string; size_t length; char * format; va_dcl #endif cadaver-0.23.3/lib/intl/0000755000076400007640000000000011312007552014334 5ustar jortonjortoncadaver-0.23.3/lib/intl/config.charset0000755000076400007640000004702611312007552017170 0ustar jortonjorton#! /bin/sh # Output a system dependent table of character encoding aliases. # # Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. # # The table consists of lines of the form # ALIAS CANONICAL # # ALIAS is the (system dependent) result of "nl_langinfo (CODESET)". # ALIAS is compared in a case sensitive way. # # CANONICAL is the GNU canonical name for this character encoding. # It must be an encoding supported by libiconv. Support by GNU libc is # also desirable. CANONICAL is case insensitive. Usually an upper case # MIME charset name is preferred. # The current list of GNU canonical charset names is as follows. # # name MIME? used by which systems # ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin # ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd darwin # ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd darwin # ISO-8859-3 Y glibc solaris # ISO-8859-4 Y osf solaris freebsd netbsd darwin # ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd darwin # ISO-8859-6 Y glibc aix hpux solaris # ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd darwin # ISO-8859-8 Y glibc aix hpux osf solaris # ISO-8859-9 Y glibc aix hpux irix osf solaris darwin # ISO-8859-13 glibc netbsd darwin # ISO-8859-14 glibc # ISO-8859-15 glibc aix osf solaris freebsd darwin # KOI8-R Y glibc solaris freebsd netbsd darwin # KOI8-U Y glibc freebsd netbsd darwin # KOI8-T glibc # CP437 dos # CP775 dos # CP850 aix osf dos # CP852 dos # CP855 dos # CP856 aix # CP857 dos # CP861 dos # CP862 dos # CP864 dos # CP865 dos # CP866 freebsd netbsd darwin dos # CP869 dos # CP874 woe32 dos # CP922 aix # CP932 aix woe32 dos # CP943 aix # CP949 osf woe32 dos # CP950 woe32 dos # CP1046 aix # CP1124 aix # CP1125 dos # CP1129 aix # CP1250 woe32 # CP1251 glibc solaris netbsd darwin woe32 # CP1252 aix woe32 # CP1253 woe32 # CP1254 woe32 # CP1255 glibc woe32 # CP1256 woe32 # CP1257 woe32 # GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin # EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin # EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin # EUC-TW glibc aix hpux irix osf solaris netbsd # BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin # BIG5-HKSCS glibc solaris # GBK glibc aix osf solaris woe32 dos # GB18030 glibc solaris netbsd # SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin # JOHAB glibc solaris woe32 # TIS-620 glibc aix hpux osf solaris # VISCII Y glibc # TCVN5712-1 glibc # GEORGIAN-PS glibc # HP-ROMAN8 hpux # HP-ARABIC8 hpux # HP-GREEK8 hpux # HP-HEBREW8 hpux # HP-TURKISH8 hpux # HP-KANA8 hpux # DEC-KANJI osf # DEC-HANYU osf # UTF-8 Y glibc aix hpux osf solaris netbsd darwin # # Note: Names which are not marked as being a MIME name should not be used in # Internet protocols for information interchange (mail, news, etc.). # # Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications # must understand both names and treat them as equivalent. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM host="$1" os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'` echo "# This file contains a table of character encoding aliases," echo "# suitable for operating system '${os}'." echo "# It was automatically generated from config.charset." # List of references, updated during installation: echo "# Packages using this file: " case "$os" in linux-gnulibc1*) # Linux libc5 doesn't have nl_langinfo(CODESET); therefore # localcharset.c falls back to using the full locale name # from the environment variables. echo "C ASCII" echo "POSIX ASCII" for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \ en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \ en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \ es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \ et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \ fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \ it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \ sv_FI sv_SE; do echo "$l ISO-8859-1" echo "$l.iso-8859-1 ISO-8859-1" echo "$l.iso-8859-15 ISO-8859-15" echo "$l.iso-8859-15@euro ISO-8859-15" echo "$l@euro ISO-8859-15" echo "$l.cp-437 CP437" echo "$l.cp-850 CP850" echo "$l.cp-1252 CP1252" echo "$l.cp-1252@euro CP1252" #echo "$l.atari-st ATARI-ST" # not a commonly used encoding echo "$l.utf-8 UTF-8" echo "$l.utf-8@euro UTF-8" done for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \ sl_SI sr sr_CS sr_YU; do echo "$l ISO-8859-2" echo "$l.iso-8859-2 ISO-8859-2" echo "$l.cp-852 CP852" echo "$l.cp-1250 CP1250" echo "$l.utf-8 UTF-8" done for l in mk mk_MK ru ru_RU; do echo "$l ISO-8859-5" echo "$l.iso-8859-5 ISO-8859-5" echo "$l.koi8-r KOI8-R" echo "$l.cp-866 CP866" echo "$l.cp-1251 CP1251" echo "$l.utf-8 UTF-8" done for l in ar ar_SA; do echo "$l ISO-8859-6" echo "$l.iso-8859-6 ISO-8859-6" echo "$l.cp-864 CP864" #echo "$l.cp-868 CP868" # not a commonly used encoding echo "$l.cp-1256 CP1256" echo "$l.utf-8 UTF-8" done for l in el el_GR gr gr_GR; do echo "$l ISO-8859-7" echo "$l.iso-8859-7 ISO-8859-7" echo "$l.cp-869 CP869" echo "$l.cp-1253 CP1253" echo "$l.cp-1253@euro CP1253" echo "$l.utf-8 UTF-8" echo "$l.utf-8@euro UTF-8" done for l in he he_IL iw iw_IL; do echo "$l ISO-8859-8" echo "$l.iso-8859-8 ISO-8859-8" echo "$l.cp-862 CP862" echo "$l.cp-1255 CP1255" echo "$l.utf-8 UTF-8" done for l in tr tr_TR; do echo "$l ISO-8859-9" echo "$l.iso-8859-9 ISO-8859-9" echo "$l.cp-857 CP857" echo "$l.cp-1254 CP1254" echo "$l.utf-8 UTF-8" done for l in lt lt_LT lv lv_LV; do #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name echo "$l ISO-8859-13" done for l in ru_UA uk uk_UA; do echo "$l KOI8-U" done for l in zh zh_CN; do #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name echo "$l GB2312" done for l in ja ja_JP ja_JP.EUC; do echo "$l EUC-JP" done for l in ko ko_KR; do echo "$l EUC-KR" done for l in th th_TH; do echo "$l TIS-620" done for l in fa fa_IR; do #echo "$l ISIRI-3342" # a broken encoding echo "$l.utf-8 UTF-8" done ;; linux* | *-gnu*) # With glibc-2.1 or newer, we don't need any canonicalization, # because glibc has iconv and both glibc and libiconv support all # GNU canonical names directly. Therefore, the Makefile does not # need to install the alias file at all. # The following applies only to glibc-2.0.x and older libcs. echo "ISO_646.IRV:1983 ASCII" ;; aix*) echo "ISO8859-1 ISO-8859-1" echo "ISO8859-2 ISO-8859-2" echo "ISO8859-5 ISO-8859-5" echo "ISO8859-6 ISO-8859-6" echo "ISO8859-7 ISO-8859-7" echo "ISO8859-8 ISO-8859-8" echo "ISO8859-9 ISO-8859-9" echo "ISO8859-15 ISO-8859-15" echo "IBM-850 CP850" echo "IBM-856 CP856" echo "IBM-921 ISO-8859-13" echo "IBM-922 CP922" echo "IBM-932 CP932" echo "IBM-943 CP943" echo "IBM-1046 CP1046" echo "IBM-1124 CP1124" echo "IBM-1129 CP1129" echo "IBM-1252 CP1252" echo "IBM-eucCN GB2312" echo "IBM-eucJP EUC-JP" echo "IBM-eucKR EUC-KR" echo "IBM-eucTW EUC-TW" echo "big5 BIG5" echo "GBK GBK" echo "TIS-620 TIS-620" echo "UTF-8 UTF-8" ;; hpux*) echo "iso88591 ISO-8859-1" echo "iso88592 ISO-8859-2" echo "iso88595 ISO-8859-5" echo "iso88596 ISO-8859-6" echo "iso88597 ISO-8859-7" echo "iso88598 ISO-8859-8" echo "iso88599 ISO-8859-9" echo "iso885915 ISO-8859-15" echo "roman8 HP-ROMAN8" echo "arabic8 HP-ARABIC8" echo "greek8 HP-GREEK8" echo "hebrew8 HP-HEBREW8" echo "turkish8 HP-TURKISH8" echo "kana8 HP-KANA8" echo "tis620 TIS-620" echo "big5 BIG5" echo "eucJP EUC-JP" echo "eucKR EUC-KR" echo "eucTW EUC-TW" echo "hp15CN GB2312" #echo "ccdc ?" # what is this? echo "SJIS SHIFT_JIS" echo "utf8 UTF-8" ;; irix*) echo "ISO8859-1 ISO-8859-1" echo "ISO8859-2 ISO-8859-2" echo "ISO8859-5 ISO-8859-5" echo "ISO8859-7 ISO-8859-7" echo "ISO8859-9 ISO-8859-9" echo "eucCN GB2312" echo "eucJP EUC-JP" echo "eucKR EUC-KR" echo "eucTW EUC-TW" ;; osf*) echo "ISO8859-1 ISO-8859-1" echo "ISO8859-2 ISO-8859-2" echo "ISO8859-4 ISO-8859-4" echo "ISO8859-5 ISO-8859-5" echo "ISO8859-7 ISO-8859-7" echo "ISO8859-8 ISO-8859-8" echo "ISO8859-9 ISO-8859-9" echo "ISO8859-15 ISO-8859-15" echo "cp850 CP850" echo "big5 BIG5" echo "dechanyu DEC-HANYU" echo "dechanzi GB2312" echo "deckanji DEC-KANJI" echo "deckorean EUC-KR" echo "eucJP EUC-JP" echo "eucKR EUC-KR" echo "eucTW EUC-TW" echo "GBK GBK" echo "KSC5601 CP949" echo "sdeckanji EUC-JP" echo "SJIS SHIFT_JIS" echo "TACTIS TIS-620" echo "UTF-8 UTF-8" ;; solaris*) echo "646 ASCII" echo "ISO8859-1 ISO-8859-1" echo "ISO8859-2 ISO-8859-2" echo "ISO8859-3 ISO-8859-3" echo "ISO8859-4 ISO-8859-4" echo "ISO8859-5 ISO-8859-5" echo "ISO8859-6 ISO-8859-6" echo "ISO8859-7 ISO-8859-7" echo "ISO8859-8 ISO-8859-8" echo "ISO8859-9 ISO-8859-9" echo "ISO8859-15 ISO-8859-15" echo "koi8-r KOI8-R" echo "ansi-1251 CP1251" echo "BIG5 BIG5" echo "Big5-HKSCS BIG5-HKSCS" echo "gb2312 GB2312" echo "GBK GBK" echo "GB18030 GB18030" echo "cns11643 EUC-TW" echo "5601 EUC-KR" echo "ko_KR.johap92 JOHAB" echo "eucJP EUC-JP" echo "PCK SHIFT_JIS" echo "TIS620.2533 TIS-620" #echo "sun_eu_greek ?" # what is this? echo "UTF-8 UTF-8" ;; freebsd* | os2*) # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore # localcharset.c falls back to using the full locale name # from the environment variables. # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just # reuse FreeBSD's locale data for OS/2. echo "C ASCII" echo "US-ASCII ASCII" for l in la_LN lt_LN; do echo "$l.ASCII ASCII" done for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do echo "$l.ISO_8859-1 ISO-8859-1" echo "$l.DIS_8859-15 ISO-8859-15" done for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do echo "$l.ISO_8859-2 ISO-8859-2" done for l in la_LN lt_LT; do echo "$l.ISO_8859-4 ISO-8859-4" done for l in ru_RU ru_SU; do echo "$l.KOI8-R KOI8-R" echo "$l.ISO_8859-5 ISO-8859-5" echo "$l.CP866 CP866" done echo "uk_UA.KOI8-U KOI8-U" echo "zh_TW.BIG5 BIG5" echo "zh_TW.Big5 BIG5" echo "zh_CN.EUC GB2312" echo "ja_JP.EUC EUC-JP" echo "ja_JP.SJIS SHIFT_JIS" echo "ja_JP.Shift_JIS SHIFT_JIS" echo "ko_KR.EUC EUC-KR" ;; netbsd*) echo "646 ASCII" echo "ISO8859-1 ISO-8859-1" echo "ISO8859-2 ISO-8859-2" echo "ISO8859-4 ISO-8859-4" echo "ISO8859-5 ISO-8859-5" echo "ISO8859-7 ISO-8859-7" echo "ISO8859-13 ISO-8859-13" echo "ISO8859-15 ISO-8859-15" echo "eucCN GB2312" echo "eucJP EUC-JP" echo "eucKR EUC-KR" echo "eucTW EUC-TW" echo "BIG5 BIG5" echo "SJIS SHIFT_JIS" ;; darwin[56]*) # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore # localcharset.c falls back to using the full locale name # from the environment variables. echo "C ASCII" for l in en_AU en_CA en_GB en_US la_LN; do echo "$l.US-ASCII ASCII" done for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \ nl_NL no_NO pt_PT sv_SE; do echo "$l ISO-8859-1" echo "$l.ISO8859-1 ISO-8859-1" echo "$l.ISO8859-15 ISO-8859-15" done for l in la_LN; do echo "$l.ISO8859-1 ISO-8859-1" echo "$l.ISO8859-15 ISO-8859-15" done for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do echo "$l.ISO8859-2 ISO-8859-2" done for l in la_LN lt_LT; do echo "$l.ISO8859-4 ISO-8859-4" done for l in ru_RU; do echo "$l.KOI8-R KOI8-R" echo "$l.ISO8859-5 ISO-8859-5" echo "$l.CP866 CP866" done for l in bg_BG; do echo "$l.CP1251 CP1251" done echo "uk_UA.KOI8-U KOI8-U" echo "zh_TW.BIG5 BIG5" echo "zh_TW.Big5 BIG5" echo "zh_CN.EUC GB2312" echo "ja_JP.EUC EUC-JP" echo "ja_JP.SJIS SHIFT_JIS" echo "ko_KR.EUC EUC-KR" ;; darwin*) # Darwin 7.5 has nl_langinfo(CODESET), but it is useless: # - It returns the empty string when LANG is set to a locale of the # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 # LC_CTYPE file. # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case. # - The documentation says: # "... all code that calls BSD system routines should ensure # that the const *char parameters of these routines are in UTF-8 # encoding. All BSD system functions expect their string # parameters to be in UTF-8 encoding and nothing else." # It also says # "An additional caveat is that string parameters for files, # paths, and other file-system entities must be in canonical # UTF-8. In a canonical UTF-8 Unicode string, all decomposable # characters are decomposed ..." # but this is not true: You can pass non-decomposed UTF-8 strings # to file system functions, and it is the OS which will convert # them to decomposed UTF-8 before accessing the file system. # - The Apple Terminal application displays UTF-8 by default. # - However, other applications are free to use different encodings: # - xterm uses ISO-8859-1 by default. # - TextEdit uses MacRoman by default. # We prefer UTF-8 over decomposed UTF-8-MAC because one should # minimize the use of decomposed Unicode. Unfortunately, through the # Darwin file system, decomposed UTF-8 strings are leaked into user # space nevertheless. echo "* UTF-8" ;; beos*) # BeOS has a single locale, and it has UTF-8 encoding. echo "* UTF-8" ;; msdosdjgpp*) # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore # localcharset.c falls back to using the full locale name # from the environment variables. echo "#" echo "# The encodings given here may not all be correct." echo "# If you find that the encoding given for your language and" echo "# country is not the one your DOS machine actually uses, just" echo "# correct it in this file, and send a mail to" echo "# Juan Manuel Guerrero " echo "# and Bruno Haible ." echo "#" echo "C ASCII" # ISO-8859-1 languages echo "ca CP850" echo "ca_ES CP850" echo "da CP865" # not CP850 ?? echo "da_DK CP865" # not CP850 ?? echo "de CP850" echo "de_AT CP850" echo "de_CH CP850" echo "de_DE CP850" echo "en CP850" echo "en_AU CP850" # not CP437 ?? echo "en_CA CP850" echo "en_GB CP850" echo "en_NZ CP437" echo "en_US CP437" echo "en_ZA CP850" # not CP437 ?? echo "es CP850" echo "es_AR CP850" echo "es_BO CP850" echo "es_CL CP850" echo "es_CO CP850" echo "es_CR CP850" echo "es_CU CP850" echo "es_DO CP850" echo "es_EC CP850" echo "es_ES CP850" echo "es_GT CP850" echo "es_HN CP850" echo "es_MX CP850" echo "es_NI CP850" echo "es_PA CP850" echo "es_PY CP850" echo "es_PE CP850" echo "es_SV CP850" echo "es_UY CP850" echo "es_VE CP850" echo "et CP850" echo "et_EE CP850" echo "eu CP850" echo "eu_ES CP850" echo "fi CP850" echo "fi_FI CP850" echo "fr CP850" echo "fr_BE CP850" echo "fr_CA CP850" echo "fr_CH CP850" echo "fr_FR CP850" echo "ga CP850" echo "ga_IE CP850" echo "gd CP850" echo "gd_GB CP850" echo "gl CP850" echo "gl_ES CP850" echo "id CP850" # not CP437 ?? echo "id_ID CP850" # not CP437 ?? echo "is CP861" # not CP850 ?? echo "is_IS CP861" # not CP850 ?? echo "it CP850" echo "it_CH CP850" echo "it_IT CP850" echo "lt CP775" echo "lt_LT CP775" echo "lv CP775" echo "lv_LV CP775" echo "nb CP865" # not CP850 ?? echo "nb_NO CP865" # not CP850 ?? echo "nl CP850" echo "nl_BE CP850" echo "nl_NL CP850" echo "nn CP865" # not CP850 ?? echo "nn_NO CP865" # not CP850 ?? echo "no CP865" # not CP850 ?? echo "no_NO CP865" # not CP850 ?? echo "pt CP850" echo "pt_BR CP850" echo "pt_PT CP850" echo "sv CP850" echo "sv_SE CP850" # ISO-8859-2 languages echo "cs CP852" echo "cs_CZ CP852" echo "hr CP852" echo "hr_HR CP852" echo "hu CP852" echo "hu_HU CP852" echo "pl CP852" echo "pl_PL CP852" echo "ro CP852" echo "ro_RO CP852" echo "sk CP852" echo "sk_SK CP852" echo "sl CP852" echo "sl_SI CP852" echo "sq CP852" echo "sq_AL CP852" echo "sr CP852" # CP852 or CP866 or CP855 ?? echo "sr_CS CP852" # CP852 or CP866 or CP855 ?? echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? # ISO-8859-3 languages echo "mt CP850" echo "mt_MT CP850" # ISO-8859-5 languages echo "be CP866" echo "be_BE CP866" echo "bg CP866" # not CP855 ?? echo "bg_BG CP866" # not CP855 ?? echo "mk CP866" # not CP855 ?? echo "mk_MK CP866" # not CP855 ?? echo "ru CP866" echo "ru_RU CP866" echo "uk CP1125" echo "uk_UA CP1125" # ISO-8859-6 languages echo "ar CP864" echo "ar_AE CP864" echo "ar_DZ CP864" echo "ar_EG CP864" echo "ar_IQ CP864" echo "ar_IR CP864" echo "ar_JO CP864" echo "ar_KW CP864" echo "ar_MA CP864" echo "ar_OM CP864" echo "ar_QA CP864" echo "ar_SA CP864" echo "ar_SY CP864" # ISO-8859-7 languages echo "el CP869" echo "el_GR CP869" # ISO-8859-8 languages echo "he CP862" echo "he_IL CP862" # ISO-8859-9 languages echo "tr CP857" echo "tr_TR CP857" # Japanese echo "ja CP932" echo "ja_JP CP932" # Chinese echo "zh_CN GBK" echo "zh_TW CP950" # not CP938 ?? # Korean echo "kr CP949" # not CP934 ?? echo "kr_KR CP949" # not CP934 ?? # Thai echo "th CP874" echo "th_TH CP874" # Other echo "eo CP850" echo "eo_EO CP850" ;; esac cadaver-0.23.3/lib/intl/plural.c0000644000076400007640000014212011312007552015777 0ustar jortonjorton/* A Bison parser, made by GNU Bison 2.3a. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* 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 "2.3a" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse __gettextparse #define yylex __gettextlex #define yyerror __gettexterror #define yylval __gettextlval #define yychar __gettextchar #define yydebug __gettextdebug #define yynerrs __gettextnerrs /* Copy the first part of user declarations. */ /* Line 164 of yacc.c. */ #line 1 "plural.y" /* Expression parsing for plural form selection. Copyright (C) 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us to put this declaration at the beginning of the file. The declaration in bison's skeleton file comes too late. This must come before because may include arbitrary system headers. This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */ #if defined _AIX && !defined __GNUC__ #pragma alloca #endif #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "plural-exp.h" /* The main function generated by the parser is called __gettextparse, but we want it to be called PLURAL_PARSE. */ #ifndef _LIBC # define __gettextparse PLURAL_PARSE #endif #define YYLEX_PARAM &((struct parse_args *) arg)->cp #define YYPARSE_PARAM arg /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { EQUOP2 = 258, CMPOP2 = 259, ADDOP2 = 260, MULOP2 = 261, NUMBER = 262 }; #endif /* Tokens. */ #define EQUOP2 258 #define CMPOP2 259 #define ADDOP2 260 #define MULOP2 261 #define NUMBER 262 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE {/* Line 191 of yacc.c. */ #line 51 "plural.y" unsigned long int num; enum expression_operator op; struct expression *exp; } /* Line 191 of yacc.c. */ #line 175 "plural.c" YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif /* Copy the second part of user declarations. */ /* Line 221 of yacc.c. */ #line 57 "plural.y" /* Prototypes for local functions. */ static int yylex (YYSTYPE *lval, const char **pexp); static void yyerror (const char *str); /* Allocation of expressions. */ static struct expression * new_exp (int nargs, enum expression_operator op, struct expression * const *args) { int i; struct expression *newp; /* If any of the argument could not be malloc'ed, just return NULL. */ for (i = nargs - 1; i >= 0; i--) if (args[i] == NULL) goto fail; /* Allocate a new expression. */ newp = (struct expression *) malloc (sizeof (*newp)); if (newp != NULL) { newp->nargs = nargs; newp->operation = op; for (i = nargs - 1; i >= 0; i--) newp->val.args[i] = args[i]; return newp; } fail: for (i = nargs - 1; i >= 0; i--) FREE_EXPRESSION (args[i]); return NULL; } static inline struct expression * new_exp_0 (enum expression_operator op) { return new_exp (0, op, NULL); } static inline struct expression * new_exp_1 (enum expression_operator op, struct expression *right) { struct expression *args[1]; args[0] = right; return new_exp (1, op, args); } static struct expression * new_exp_2 (enum expression_operator op, struct expression *left, struct expression *right) { struct expression *args[2]; args[0] = left; args[1] = right; return new_exp (2, op, args); } static inline struct expression * new_exp_3 (enum expression_operator op, struct expression *bexp, struct expression *tbranch, struct expression *fbranch) { struct expression *args[3]; args[0] = bexp; args[1] = tbranch; args[2] = fbranch; return new_exp (3, op, args); } /* Line 221 of yacc.c. */ #line 265 "plural.c" #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; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int 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 && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # 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 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 /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #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 _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (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 _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) 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; YYSTYPE yyvs; }; /* 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) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* 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) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 9 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 54 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 16 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 3 /* YYNRULES -- Number of rules. */ #define YYNRULES 13 /* YYNRULES -- Number of states. */ #define YYNSTATES 27 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 262 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 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, 10, 2, 2, 2, 2, 5, 2, 14, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, 2, 2, 2, 3, 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, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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, 6, 7, 8, 9, 11 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 11, 15, 19, 23, 27, 31, 35, 38, 40, 42 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 17, 0, -1, 18, -1, 18, 3, 18, 12, 18, -1, 18, 4, 18, -1, 18, 5, 18, -1, 18, 6, 18, -1, 18, 7, 18, -1, 18, 8, 18, -1, 18, 9, 18, -1, 10, 18, -1, 13, -1, 11, -1, 14, 18, 15, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 154, 154, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 203 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* 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", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2", "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'", "$accept", "start", "exp", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 63, 124, 38, 258, 259, 260, 261, 33, 262, 58, 110, 40, 41 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 5, 3, 3, 3, 3, 3, 3, 2, 1, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 0, 12, 11, 0, 0, 2, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 13, 0, 4, 5, 6, 7, 8, 9, 0, 3 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 5, 6 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -10 static const yytype_int8 yypact[] = { -9, -9, -10, -10, -9, 8, 36, -10, 13, -10, -9, -9, -9, -9, -9, -9, -9, -10, 26, 41, 45, 18, -2, 14, -10, -9, 36 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -10, -10, -1 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 7, 1, 2, 8, 3, 4, 15, 16, 9, 18, 19, 20, 21, 22, 23, 24, 10, 11, 12, 13, 14, 15, 16, 16, 26, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 0, 0, 25, 10, 11, 12, 13, 14, 15, 16, 12, 13, 14, 15, 16, 13, 14, 15, 16 }; static const yytype_int8 yycheck[] = { 1, 10, 11, 4, 13, 14, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 3, 4, 5, 6, 7, 8, 9, 9, 25, 7, 8, 9, 15, 3, 4, 5, 6, 7, 8, 9, -1, -1, 12, 3, 4, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 6, 7, 8, 9 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 10, 11, 13, 14, 17, 18, 18, 18, 0, 3, 4, 5, 6, 7, 8, 9, 15, 18, 18, 18, 18, 18, 18, 18, 12, 18 }; #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 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else # define YYLEX yylex (&yylval) #endif /* 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 (YYID (0)) # 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 (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", 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). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { 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 (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (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. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { 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. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { 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 YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ 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 yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* 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 = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; 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); YYSTACK_RELOCATE (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 (yyn == YYPACT_NINF) 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 (yyn == 0 || yyn == YYTABLE_NINF) 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; *++yyvsp = yylval; 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 1269 of yacc.c. */ #line 155 "plural.y" { if ((yyvsp[(1) - (1)].exp) == NULL) YYABORT; ((struct parse_args *) arg)->res = (yyvsp[(1) - (1)].exp); } break; case 3: /* Line 1269 of yacc.c. */ #line 163 "plural.y" { (yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp)); } break; case 4: /* Line 1269 of yacc.c. */ #line 167 "plural.y" { (yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp)); } break; case 5: /* Line 1269 of yacc.c. */ #line 171 "plural.y" { (yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp)); } break; case 6: /* Line 1269 of yacc.c. */ #line 175 "plural.y" { (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp)); } break; case 7: /* Line 1269 of yacc.c. */ #line 179 "plural.y" { (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp)); } break; case 8: /* Line 1269 of yacc.c. */ #line 183 "plural.y" { (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp)); } break; case 9: /* Line 1269 of yacc.c. */ #line 187 "plural.y" { (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp)); } break; case 10: /* Line 1269 of yacc.c. */ #line 191 "plural.y" { (yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp)); } break; case 11: /* Line 1269 of yacc.c. */ #line 195 "plural.y" { (yyval.exp) = new_exp_0 (var); } break; case 12: /* Line 1269 of yacc.c. */ #line 199 "plural.y" { if (((yyval.exp) = new_exp_0 (num)) != NULL) (yyval.exp)->val.num = (yyvsp[(1) - (1)].num); } break; case 13: /* Line 1269 of yacc.c. */ #line 204 "plural.y" { (yyval.exp) = (yyvsp[(2) - (3)].exp); } break; /* Line 1269 of yacc.c. */ #line 1572 "plural.c" default: break; } 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: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #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 which 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 (yyn != YYPACT_NINF) { 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); } *++yyvsp = yylval; /* 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; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which 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 /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 1486 of yacc.c. */ #line 209 "plural.y" void internal_function FREE_EXPRESSION (struct expression *exp) { if (exp == NULL) return; /* Handle the recursive case. */ switch (exp->nargs) { case 3: FREE_EXPRESSION (exp->val.args[2]); /* FALLTHROUGH */ case 2: FREE_EXPRESSION (exp->val.args[1]); /* FALLTHROUGH */ case 1: FREE_EXPRESSION (exp->val.args[0]); /* FALLTHROUGH */ default: break; } free (exp); } static int yylex (YYSTYPE *lval, const char **pexp) { const char *exp = *pexp; int result; while (1) { if (exp[0] == '\0') { *pexp = exp; return YYEOF; } if (exp[0] != ' ' && exp[0] != '\t') break; ++exp; } result = *exp++; switch (result) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { unsigned long int n = result - '0'; while (exp[0] >= '0' && exp[0] <= '9') { n *= 10; n += exp[0] - '0'; ++exp; } lval->num = n; result = NUMBER; } break; case '=': if (exp[0] == '=') { ++exp; lval->op = equal; result = EQUOP2; } else result = YYERRCODE; break; case '!': if (exp[0] == '=') { ++exp; lval->op = not_equal; result = EQUOP2; } break; case '&': case '|': if (exp[0] == result) ++exp; else result = YYERRCODE; break; case '<': if (exp[0] == '=') { ++exp; lval->op = less_or_equal; } else lval->op = less_than; result = CMPOP2; break; case '>': if (exp[0] == '=') { ++exp; lval->op = greater_or_equal; } else lval->op = greater_than; result = CMPOP2; break; case '*': lval->op = mult; result = MULOP2; break; case '/': lval->op = divide; result = MULOP2; break; case '%': lval->op = module; result = MULOP2; break; case '+': lval->op = plus; result = ADDOP2; break; case '-': lval->op = minus; result = ADDOP2; break; case 'n': case '?': case ':': case '(': case ')': /* Nothing, just return the character. */ break; case ';': case '\n': case '\0': /* Be safe and let the user call this function again. */ --exp; result = YYEOF; break; default: result = YYERRCODE; #if YYDEBUG != 0 --exp; #endif break; } *pexp = exp; return result; } static void yyerror (const char *str) { /* Do nothing. We don't print error messages here. */ } cadaver-0.23.3/lib/intl/eval-plural.h0000644000076400007640000000534211312007552016735 0ustar jortonjorton/* Plural expression evaluation. Copyright (C) 2000-2003, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef STATIC #define STATIC static #endif /* Evaluate the plural expression and return an index value. */ STATIC unsigned long int internal_function plural_eval (const struct expression *pexp, unsigned long int n) { switch (pexp->nargs) { case 0: switch (pexp->operation) { case var: return n; case num: return pexp->val.num; default: break; } /* NOTREACHED */ break; case 1: { /* pexp->operation must be lnot. */ unsigned long int arg = plural_eval (pexp->val.args[0], n); return ! arg; } case 2: { unsigned long int leftarg = plural_eval (pexp->val.args[0], n); if (pexp->operation == lor) return leftarg || plural_eval (pexp->val.args[1], n); else if (pexp->operation == land) return leftarg && plural_eval (pexp->val.args[1], n); else { unsigned long int rightarg = plural_eval (pexp->val.args[1], n); switch (pexp->operation) { case mult: return leftarg * rightarg; case divide: #if !INTDIV0_RAISES_SIGFPE if (rightarg == 0) raise (SIGFPE); #endif return leftarg / rightarg; case module: #if !INTDIV0_RAISES_SIGFPE if (rightarg == 0) raise (SIGFPE); #endif return leftarg % rightarg; case plus: return leftarg + rightarg; case minus: return leftarg - rightarg; case less_than: return leftarg < rightarg; case greater_than: return leftarg > rightarg; case less_or_equal: return leftarg <= rightarg; case greater_or_equal: return leftarg >= rightarg; case equal: return leftarg == rightarg; case not_equal: return leftarg != rightarg; default: break; } } /* NOTREACHED */ break; } case 3: { /* pexp->operation must be qmop. */ unsigned long int boolarg = plural_eval (pexp->val.args[0], n); return plural_eval (pexp->val.args[boolarg ? 1 : 2], n); } } /* NOTREACHED */ return 0; } cadaver-0.23.3/lib/intl/gettextP.h0000644000076400007640000002221411312007552016312 0ustar jortonjorton/* Header describing internals of libintl library. Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc. Written by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETTEXTP_H #define _GETTEXTP_H #include /* Get size_t. */ #ifdef _LIBC # include "../iconv/gconv_int.h" #else # if HAVE_ICONV # include # endif #endif /* Handle multi-threaded applications. */ #ifdef _LIBC # include # define gl_rwlock_define __libc_rwlock_define #else # include "lock.h" #endif #ifdef _LIBC extern char *__gettext (const char *__msgid); extern char *__dgettext (const char *__domainname, const char *__msgid); extern char *__dcgettext (const char *__domainname, const char *__msgid, int __category); extern char *__ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n); extern char *__dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int n); extern char *__dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category); extern char *__dcigettext (const char *__domainname, const char *__msgid1, const char *__msgid2, int __plural, unsigned long int __n, int __category); extern char *__textdomain (const char *__domainname); extern char *__bindtextdomain (const char *__domainname, const char *__dirname); extern char *__bind_textdomain_codeset (const char *__domainname, const char *__codeset); extern void _nl_finddomain_subfreeres (void) attribute_hidden; extern void _nl_unload_domain (struct loaded_domain *__domain) internal_function attribute_hidden; #else /* Declare the exported libintl_* functions, in a way that allows us to call them under their real name. */ # undef _INTL_REDIRECT_INLINE # undef _INTL_REDIRECT_MACROS # define _INTL_REDIRECT_MACROS # include "libgnuintl.h" # ifdef IN_LIBGLOCALE extern char *gl_dcigettext (const char *__domainname, const char *__msgid1, const char *__msgid2, int __plural, unsigned long int __n, int __category, const char *__localename, const char *__encoding); # else extern char *libintl_dcigettext (const char *__domainname, const char *__msgid1, const char *__msgid2, int __plural, unsigned long int __n, int __category); # endif #endif #include "loadinfo.h" #include "gmo.h" /* Get nls_uint32. */ /* @@ end of prolog @@ */ #ifndef internal_function # define internal_function #endif #ifndef attribute_hidden # define attribute_hidden #endif /* Tell the compiler when a conditional or integer expression is almost always true or almost always false. */ #ifndef HAVE_BUILTIN_EXPECT # define __builtin_expect(expr, val) (expr) #endif #ifndef W # define W(flag, data) ((flag) ? SWAP (data) : (data)) #endif #ifdef _LIBC # include # define SWAP(i) bswap_32 (i) #else static inline nls_uint32 # ifdef __cplusplus SWAP (nls_uint32 i) # else SWAP (i) nls_uint32 i; # endif { return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24); } #endif /* In-memory representation of system dependent string. */ struct sysdep_string_desc { /* Length of addressed string, including the trailing NUL. */ size_t length; /* Pointer to addressed string. */ const char *pointer; }; /* Cache of translated strings after charset conversion. Note: The strings are converted to the target encoding only on an as-needed basis. */ struct converted_domain { /* The target encoding name. */ const char *encoding; /* The descriptor for conversion from the message catalog's encoding to this target encoding. */ #ifdef _LIBC __gconv_t conv; #else # if HAVE_ICONV iconv_t conv; # endif #endif /* The table of translated strings after charset conversion. */ char **conv_tab; }; /* The representation of an opened message catalog. */ struct loaded_domain { /* Pointer to memory containing the .mo file. */ const char *data; /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */ int use_mmap; /* Size of mmap()ed memory. */ size_t mmap_size; /* 1 if the .mo file uses a different endianness than this machine. */ int must_swap; /* Pointer to additional malloc()ed memory. */ void *malloced; /* Number of static strings pairs. */ nls_uint32 nstrings; /* Pointer to descriptors of original strings in the file. */ const struct string_desc *orig_tab; /* Pointer to descriptors of translated strings in the file. */ const struct string_desc *trans_tab; /* Number of system dependent strings pairs. */ nls_uint32 n_sysdep_strings; /* Pointer to descriptors of original sysdep strings. */ const struct sysdep_string_desc *orig_sysdep_tab; /* Pointer to descriptors of translated sysdep strings. */ const struct sysdep_string_desc *trans_sysdep_tab; /* Size of hash table. */ nls_uint32 hash_size; /* Pointer to hash table. */ const nls_uint32 *hash_tab; /* 1 if the hash table uses a different endianness than this machine. */ int must_swap_hash_tab; /* Cache of charset conversions of the translated strings. */ struct converted_domain *conversions; size_t nconversions; gl_rwlock_define (, conversions_lock) const struct expression *plural; unsigned long int nplurals; }; /* We want to allocate a string at the end of the struct. But ISO C doesn't allow zero sized arrays. */ #ifdef __GNUC__ # define ZERO 0 #else # define ZERO 1 #endif /* A set of settings bound to a message domain. Used to store settings from bindtextdomain() and bind_textdomain_codeset(). */ struct binding { struct binding *next; char *dirname; char *codeset; char domainname[ZERO]; }; /* A counter which is incremented each time some previous translations become invalid. This variable is part of the external ABI of the GNU libintl. */ #ifdef IN_LIBGLOCALE # include extern LIBGLOCALE_DLL_EXPORTED int _nl_msg_cat_cntr; #else extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr; #endif #ifndef _LIBC extern const char *_nl_language_preferences_default (void); # define gl_locale_name_canonicalize _nl_locale_name_canonicalize extern void _nl_locale_name_canonicalize (char *name); # define gl_locale_name_posix _nl_locale_name_posix extern const char *_nl_locale_name_posix (int category, const char *categoryname); # define gl_locale_name_default _nl_locale_name_default extern const char *_nl_locale_name_default (void); # define gl_locale_name _nl_locale_name extern const char *_nl_locale_name (int category, const char *categoryname); #endif struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale, const char *__domainname, struct binding *__domainbinding) internal_function; void _nl_load_domain (struct loaded_l10nfile *__domain, struct binding *__domainbinding) internal_function; #ifdef IN_LIBGLOCALE char *_nl_find_msg (struct loaded_l10nfile *domain_file, struct binding *domainbinding, const char *encoding, const char *msgid, size_t *lengthp) internal_function; #else char *_nl_find_msg (struct loaded_l10nfile *domain_file, struct binding *domainbinding, const char *msgid, int convert, size_t *lengthp) internal_function; #endif /* The internal variables in the standalone libintl.a must have different names than the internal variables in GNU libc, otherwise programs using libintl.a cannot be linked statically. */ #if !defined _LIBC # define _nl_default_dirname libintl_nl_default_dirname # define _nl_domain_bindings libintl_nl_domain_bindings #endif /* Contains the default location of the message catalogs. */ extern const char _nl_default_dirname[]; #ifdef _LIBC libc_hidden_proto (_nl_default_dirname) #endif /* List with bindings of specific domains. */ extern struct binding *_nl_domain_bindings; /* The internal variables in the standalone libintl.a must have different names than the internal variables in GNU libc, otherwise programs using libintl.a cannot be linked statically. */ #if !defined _LIBC # define _nl_default_default_domain libintl_nl_default_default_domain # define _nl_current_default_domain libintl_nl_current_default_domain #endif /* Name of the default text domain. */ extern const char _nl_default_default_domain[] attribute_hidden; /* Default text domain in which entries for gettext(3) are to be found. */ extern const char *_nl_current_default_domain attribute_hidden; /* @@ begin of epilog @@ */ #endif /* gettextP.h */ cadaver-0.23.3/lib/intl/printf-parse.c0000644000076400007640000003306011312007552017114 0ustar jortonjorton/* Formatted output to strings. Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file can be parametrized with the following macros: CHAR_T The element type of the format string. CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters in the format string are ASCII. DIRECTIVE Structure denoting a format directive. Depends on CHAR_T. DIRECTIVES Structure denoting the set of format directives of a format string. Depends on CHAR_T. PRINTF_PARSE Function that parses a format string. Depends on CHAR_T. STATIC Set to 'static' to declare the function static. ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. */ #ifndef PRINTF_PARSE # include #endif /* Specification. */ #ifndef PRINTF_PARSE # include "printf-parse.h" #endif /* Default parameters. */ #ifndef PRINTF_PARSE # define PRINTF_PARSE printf_parse # define CHAR_T char # define DIRECTIVE char_directive # define DIRECTIVES char_directives #endif /* Get size_t, NULL. */ #include /* Get intmax_t. */ #if defined IN_LIBINTL || defined IN_LIBASPRINTF # if HAVE_STDINT_H_WITH_UINTMAX # include # endif # if HAVE_INTTYPES_H_WITH_UINTMAX # include # endif #else # include #endif /* malloc(), realloc(), free(). */ #include /* errno. */ #include /* Checked size_t computations. */ #include "xsize.h" #if CHAR_T_ONLY_ASCII /* c_isascii(). */ # include "c-ctype.h" #endif #ifdef STATIC STATIC #endif int PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) { const CHAR_T *cp = format; /* pointer into format */ size_t arg_posn = 0; /* number of regular arguments consumed */ size_t d_allocated; /* allocated elements of d->dir */ size_t a_allocated; /* allocated elements of a->arg */ size_t max_width_length = 0; size_t max_precision_length = 0; d->count = 0; d_allocated = 1; d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); if (d->dir == NULL) /* Out of memory. */ goto out_of_memory_1; a->count = 0; a_allocated = 0; a->arg = NULL; #define REGISTER_ARG(_index_,_type_) \ { \ size_t n = (_index_); \ if (n >= a_allocated) \ { \ size_t memory_size; \ argument *memory; \ \ a_allocated = xtimes (a_allocated, 2); \ if (a_allocated <= n) \ a_allocated = xsum (n, 1); \ memory_size = xtimes (a_allocated, sizeof (argument)); \ if (size_overflow_p (memory_size)) \ /* Overflow, would lead to out of memory. */ \ goto out_of_memory; \ memory = (argument *) (a->arg \ ? realloc (a->arg, memory_size) \ : malloc (memory_size)); \ if (memory == NULL) \ /* Out of memory. */ \ goto out_of_memory; \ a->arg = memory; \ } \ while (a->count <= n) \ a->arg[a->count++].type = TYPE_NONE; \ if (a->arg[n].type == TYPE_NONE) \ a->arg[n].type = (_type_); \ else if (a->arg[n].type != (_type_)) \ /* Ambiguous type for positional argument. */ \ goto error; \ } while (*cp != '\0') { CHAR_T c = *cp++; if (c == '%') { size_t arg_index = ARG_NONE; DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ /* Initialize the next directive. */ dp->dir_start = cp - 1; dp->flags = 0; dp->width_start = NULL; dp->width_end = NULL; dp->width_arg_index = ARG_NONE; dp->precision_start = NULL; dp->precision_end = NULL; dp->precision_arg_index = ARG_NONE; dp->arg_index = ARG_NONE; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; arg_index = n - 1; cp = np + 1; } } /* Read the flags. */ for (;;) { if (*cp == '\'') { dp->flags |= FLAG_GROUP; cp++; } else if (*cp == '-') { dp->flags |= FLAG_LEFT; cp++; } else if (*cp == '+') { dp->flags |= FLAG_SHOWSIGN; cp++; } else if (*cp == ' ') { dp->flags |= FLAG_SPACE; cp++; } else if (*cp == '#') { dp->flags |= FLAG_ALT; cp++; } else if (*cp == '0') { dp->flags |= FLAG_ZERO; cp++; } else break; } /* Parse the field width. */ if (*cp == '*') { dp->width_start = cp; cp++; dp->width_end = cp; if (max_width_length < 1) max_width_length = 1; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; dp->width_arg_index = n - 1; cp = np + 1; } } if (dp->width_arg_index == ARG_NONE) { dp->width_arg_index = arg_posn++; if (dp->width_arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->width_arg_index, TYPE_INT); } else if (*cp >= '0' && *cp <= '9') { size_t width_length; dp->width_start = cp; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->width_end = cp; width_length = dp->width_end - dp->width_start; if (max_width_length < width_length) max_width_length = width_length; } /* Parse the precision. */ if (*cp == '.') { cp++; if (*cp == '*') { dp->precision_start = cp - 1; cp++; dp->precision_end = cp; if (max_precision_length < 2) max_precision_length = 2; /* Test for positional argument. */ if (*cp >= '0' && *cp <= '9') { const CHAR_T *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum (xtimes (n, 10), *np - '0'); if (n == 0) /* Positional argument 0. */ goto error; if (size_overflow_p (n)) /* n too large, would lead to out of memory later. */ goto error; dp->precision_arg_index = n - 1; cp = np + 1; } } if (dp->precision_arg_index == ARG_NONE) { dp->precision_arg_index = arg_posn++; if (dp->precision_arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->precision_arg_index, TYPE_INT); } else { size_t precision_length; dp->precision_start = cp - 1; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->precision_end = cp; precision_length = dp->precision_end - dp->precision_start; if (max_precision_length < precision_length) max_precision_length = precision_length; } } { arg_type type; /* Parse argument type/size specifiers. */ { int flags = 0; for (;;) { if (*cp == 'h') { flags |= (1 << (flags & 1)); cp++; } else if (*cp == 'L') { flags |= 4; cp++; } else if (*cp == 'l') { flags += 8; cp++; } else if (*cp == 'j') { if (sizeof (intmax_t) > sizeof (long)) { /* intmax_t = long long */ flags += 16; } else if (sizeof (intmax_t) > sizeof (int)) { /* intmax_t = long */ flags += 8; } cp++; } else if (*cp == 'z' || *cp == 'Z') { /* 'z' is standardized in ISO C 99, but glibc uses 'Z' because the warning facility in gcc-2.95.2 understands only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ if (sizeof (size_t) > sizeof (long)) { /* size_t = long long */ flags += 16; } else if (sizeof (size_t) > sizeof (int)) { /* size_t = long */ flags += 8; } cp++; } else if (*cp == 't') { if (sizeof (ptrdiff_t) > sizeof (long)) { /* ptrdiff_t = long long */ flags += 16; } else if (sizeof (ptrdiff_t) > sizeof (int)) { /* ptrdiff_t = long */ flags += 8; } cp++; } else break; } /* Read the conversion character. */ c = *cp++; switch (c) { case 'd': case 'i': #if HAVE_LONG_LONG_INT /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_LONGLONGINT; else #endif /* If 'long long' exists and is the same as 'long', we parse "lld" into TYPE_LONGINT. */ if (flags >= 8) type = TYPE_LONGINT; else if (flags & 2) type = TYPE_SCHAR; else if (flags & 1) type = TYPE_SHORT; else type = TYPE_INT; break; case 'o': case 'u': case 'x': case 'X': #if HAVE_LONG_LONG_INT /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_ULONGLONGINT; else #endif /* If 'unsigned long long' exists and is the same as 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ if (flags >= 8) type = TYPE_ULONGINT; else if (flags & 2) type = TYPE_UCHAR; else if (flags & 1) type = TYPE_USHORT; else type = TYPE_UINT; break; case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': if (flags >= 16 || (flags & 4)) type = TYPE_LONGDOUBLE; else type = TYPE_DOUBLE; break; case 'c': if (flags >= 8) #if HAVE_WINT_T type = TYPE_WIDE_CHAR; #else goto error; #endif else type = TYPE_CHAR; break; #if HAVE_WINT_T case 'C': type = TYPE_WIDE_CHAR; c = 'c'; break; #endif case 's': if (flags >= 8) #if HAVE_WCHAR_T type = TYPE_WIDE_STRING; #else goto error; #endif else type = TYPE_STRING; break; #if HAVE_WCHAR_T case 'S': type = TYPE_WIDE_STRING; c = 's'; break; #endif case 'p': type = TYPE_POINTER; break; case 'n': #if HAVE_LONG_LONG_INT /* If 'long long' exists and is larger than 'long': */ if (flags >= 16 || (flags & 4)) type = TYPE_COUNT_LONGLONGINT_POINTER; else #endif /* If 'long long' exists and is the same as 'long', we parse "lln" into TYPE_COUNT_LONGINT_POINTER. */ if (flags >= 8) type = TYPE_COUNT_LONGINT_POINTER; else if (flags & 2) type = TYPE_COUNT_SCHAR_POINTER; else if (flags & 1) type = TYPE_COUNT_SHORT_POINTER; else type = TYPE_COUNT_INT_POINTER; break; #if ENABLE_UNISTDIO /* The unistdio extensions. */ case 'U': if (flags >= 16) type = TYPE_U32_STRING; else if (flags >= 8) type = TYPE_U16_STRING; else type = TYPE_U8_STRING; break; #endif case '%': type = TYPE_NONE; break; default: /* Unknown conversion character. */ goto error; } } if (type != TYPE_NONE) { dp->arg_index = arg_index; if (dp->arg_index == ARG_NONE) { dp->arg_index = arg_posn++; if (dp->arg_index == ARG_NONE) /* arg_posn wrapped around. */ goto error; } REGISTER_ARG (dp->arg_index, type); } dp->conversion = c; dp->dir_end = cp; } d->count++; if (d->count >= d_allocated) { size_t memory_size; DIRECTIVE *memory; d_allocated = xtimes (d_allocated, 2); memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); if (size_overflow_p (memory_size)) /* Overflow, would lead to out of memory. */ goto out_of_memory; memory = (DIRECTIVE *) realloc (d->dir, memory_size); if (memory == NULL) /* Out of memory. */ goto out_of_memory; d->dir = memory; } } #if CHAR_T_ONLY_ASCII else if (!c_isascii (c)) { /* Non-ASCII character. Not supported. */ goto error; } #endif } d->dir[d->count].dir_start = cp; d->max_width_length = max_width_length; d->max_precision_length = max_precision_length; return 0; error: if (a->arg) free (a->arg); if (d->dir) free (d->dir); errno = EINVAL; return -1; out_of_memory: if (a->arg) free (a->arg); if (d->dir) free (d->dir); out_of_memory_1: errno = ENOMEM; return -1; } #undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE #undef CHAR_T_ONLY_ASCII #undef CHAR_T cadaver-0.23.3/lib/intl/textdomain.c0000644000076400007640000000746611312007552016671 0ustar jortonjorton/* Implementation of the textdomain(3) function. Copyright (C) 1995-1998, 2000-2003, 2005-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include "gettextP.h" #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* Handle multi-threaded applications. */ #ifdef _LIBC # include # define gl_rwlock_define __libc_rwlock_define # define gl_rwlock_wrlock __libc_rwlock_wrlock # define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif /* @@ end of prolog @@ */ /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define TEXTDOMAIN __textdomain # ifndef strdup # define strdup(str) __strdup (str) # endif #else # define TEXTDOMAIN libintl_textdomain #endif /* Lock variable to protect the global data in the gettext implementation. */ gl_rwlock_define (extern, _nl_state_lock attribute_hidden) /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ char * TEXTDOMAIN (const char *domainname) { char *new_domain; char *old_domain; /* A NULL pointer requests the current setting. */ if (domainname == NULL) return (char *) _nl_current_default_domain; gl_rwlock_wrlock (_nl_state_lock); old_domain = (char *) _nl_current_default_domain; /* If domain name is the null string set to default domain "messages". */ if (domainname[0] == '\0' || strcmp (domainname, _nl_default_default_domain) == 0) { _nl_current_default_domain = _nl_default_default_domain; new_domain = (char *) _nl_current_default_domain; } else if (strcmp (domainname, old_domain) == 0) /* This can happen and people will use it to signal that some environment variable changed. */ new_domain = old_domain; else { /* If the following malloc fails `_nl_current_default_domain' will be NULL. This value will be returned and so signals we are out of core. */ #if defined _LIBC || defined HAVE_STRDUP new_domain = strdup (domainname); #else size_t len = strlen (domainname) + 1; new_domain = (char *) malloc (len); if (new_domain != NULL) memcpy (new_domain, domainname, len); #endif if (new_domain != NULL) _nl_current_default_domain = new_domain; } /* We use this possibility to signal a change of the loaded catalogs since this is most likely the case and there is no other easy we to do it. Do it only when the call was successful. */ if (new_domain != NULL) { ++_nl_msg_cat_cntr; if (old_domain != new_domain && old_domain != _nl_default_default_domain) free (old_domain); } gl_rwlock_unlock (_nl_state_lock); return new_domain; } #ifdef _LIBC /* Alias for function name in GNU C Library. */ weak_alias (__textdomain, textdomain); #endif cadaver-0.23.3/lib/intl/localealias.c0000644000076400007640000002454611312007552016764 0ustar jortonjorton/* Handle aliases for locale names. Copyright (C) 1995-1999, 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Tell glibc's to provide a prototype for mempcpy(). This must come before because may include , and once has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #ifdef HAVE_CONFIG_H # include #endif #include #include #if defined _LIBC || defined HAVE___FSETLOCKING # include #endif #include #ifdef __GNUC__ # undef alloca # define alloca __builtin_alloca # define HAVE_ALLOCA 1 #else # ifdef _MSC_VER # include # define alloca _alloca # else # if defined HAVE_ALLOCA_H || defined _LIBC # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca char *alloca (); # endif # endif # endif # endif #endif #include #include #include "gettextP.h" #if ENABLE_RELOCATABLE # include "relocatable.h" #else # define relocate(pathname) (pathname) #endif /* @@ end of prolog @@ */ #ifdef _LIBC /* Rename the non ANSI C functions. This is required by the standard because some ANSI C functions will require linking with this object file and the name space must not be polluted. */ # define strcasecmp __strcasecmp # ifndef mempcpy # define mempcpy __mempcpy # endif # define HAVE_MEMPCPY 1 # define HAVE___FSETLOCKING 1 #endif /* Handle multi-threaded applications. */ #ifdef _LIBC # include #else # include "lock.h" #endif #ifndef internal_function # define internal_function #endif /* Some optimizations for glibc. */ #ifdef _LIBC # define FEOF(fp) feof_unlocked (fp) # define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp) #else # define FEOF(fp) feof (fp) # define FGETS(buf, n, fp) fgets (buf, n, fp) #endif /* For those losing systems which don't have `alloca' we have to add some additional code emulating it. */ #ifdef HAVE_ALLOCA # define freea(p) /* nothing */ #else # define alloca(n) malloc (n) # define freea(p) free (p) #endif #if defined _LIBC_REENTRANT || HAVE_DECL_FGETS_UNLOCKED # undef fgets # define fgets(buf, len, s) fgets_unlocked (buf, len, s) #endif #if defined _LIBC_REENTRANT || HAVE_DECL_FEOF_UNLOCKED # undef feof # define feof(s) feof_unlocked (s) #endif __libc_lock_define_initialized (static, lock) struct alias_map { const char *alias; const char *value; }; #ifndef _LIBC # define libc_freeres_ptr(decl) decl #endif libc_freeres_ptr (static char *string_space); static size_t string_space_act; static size_t string_space_max; libc_freeres_ptr (static struct alias_map *map); static size_t nmap; static size_t maxmap; /* Prototypes for local functions. */ static size_t read_alias_file (const char *fname, int fname_len) internal_function; static int extend_alias_table (void); static int alias_compare (const struct alias_map *map1, const struct alias_map *map2); const char * _nl_expand_alias (const char *name) { static const char *locale_alias_path; struct alias_map *retval; const char *result = NULL; size_t added; __libc_lock_lock (lock); if (locale_alias_path == NULL) locale_alias_path = LOCALE_ALIAS_PATH; do { struct alias_map item; item.alias = name; if (nmap > 0) retval = (struct alias_map *) bsearch (&item, map, nmap, sizeof (struct alias_map), (int (*) (const void *, const void *) ) alias_compare); else retval = NULL; /* We really found an alias. Return the value. */ if (retval != NULL) { result = retval->value; break; } /* Perhaps we can find another alias file. */ added = 0; while (added == 0 && locale_alias_path[0] != '\0') { const char *start; while (locale_alias_path[0] == PATH_SEPARATOR) ++locale_alias_path; start = locale_alias_path; while (locale_alias_path[0] != '\0' && locale_alias_path[0] != PATH_SEPARATOR) ++locale_alias_path; if (start < locale_alias_path) added = read_alias_file (start, locale_alias_path - start); } } while (added != 0); __libc_lock_unlock (lock); return result; } static size_t internal_function read_alias_file (const char *fname, int fname_len) { FILE *fp; char *full_fname; size_t added; static const char aliasfile[] = "/locale.alias"; full_fname = (char *) alloca (fname_len + sizeof aliasfile); #ifdef HAVE_MEMPCPY mempcpy (mempcpy (full_fname, fname, fname_len), aliasfile, sizeof aliasfile); #else memcpy (full_fname, fname, fname_len); memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile); #endif #ifdef _LIBC /* Note the file is opened with cancellation in the I/O functions disabled. */ fp = fopen (relocate (full_fname), "rc"); #else fp = fopen (relocate (full_fname), "r"); #endif freea (full_fname); if (fp == NULL) return 0; #ifdef HAVE___FSETLOCKING /* No threads present. */ __fsetlocking (fp, FSETLOCKING_BYCALLER); #endif added = 0; while (!FEOF (fp)) { /* It is a reasonable approach to use a fix buffer here because a) we are only interested in the first two fields b) these fields must be usable as file names and so must not be that long We avoid a multi-kilobyte buffer here since this would use up stack space which we might not have if the program ran out of memory. */ char buf[400]; char *alias; char *value; char *cp; int complete_line; if (FGETS (buf, sizeof buf, fp) == NULL) /* EOF reached. */ break; /* Determine whether the line is complete. */ complete_line = strchr (buf, '\n') != NULL; cp = buf; /* Ignore leading white space. */ while (isspace ((unsigned char) cp[0])) ++cp; /* A leading '#' signals a comment line. */ if (cp[0] != '\0' && cp[0] != '#') { alias = cp++; while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) ++cp; /* Terminate alias name. */ if (cp[0] != '\0') *cp++ = '\0'; /* Now look for the beginning of the value. */ while (isspace ((unsigned char) cp[0])) ++cp; if (cp[0] != '\0') { value = cp++; while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) ++cp; /* Terminate value. */ if (cp[0] == '\n') { /* This has to be done to make the following test for the end of line possible. We are looking for the terminating '\n' which do not overwrite here. */ *cp++ = '\0'; *cp = '\n'; } else if (cp[0] != '\0') *cp++ = '\0'; #ifdef IN_LIBGLOCALE /* glibc's locale.alias contains entries for ja_JP and ko_KR that make it impossible to use a Japanese or Korean UTF-8 locale under the name "ja_JP" or "ko_KR". Ignore these entries. */ if (strchr (alias, '_') == NULL) #endif { size_t alias_len; size_t value_len; if (nmap >= maxmap) if (__builtin_expect (extend_alias_table (), 0)) goto out; alias_len = strlen (alias) + 1; value_len = strlen (value) + 1; if (string_space_act + alias_len + value_len > string_space_max) { /* Increase size of memory pool. */ size_t new_size = (string_space_max + (alias_len + value_len > 1024 ? alias_len + value_len : 1024)); char *new_pool = (char *) realloc (string_space, new_size); if (new_pool == NULL) goto out; if (__builtin_expect (string_space != new_pool, 0)) { size_t i; for (i = 0; i < nmap; i++) { map[i].alias += new_pool - string_space; map[i].value += new_pool - string_space; } } string_space = new_pool; string_space_max = new_size; } map[nmap].alias = (const char *) memcpy (&string_space[string_space_act], alias, alias_len); string_space_act += alias_len; map[nmap].value = (const char *) memcpy (&string_space[string_space_act], value, value_len); string_space_act += value_len; ++nmap; ++added; } } } /* Possibly not the whole line fits into the buffer. Ignore the rest of the line. */ if (! complete_line) do if (FGETS (buf, sizeof buf, fp) == NULL) /* Make sure the inner loop will be left. The outer loop will exit at the `feof' test. */ break; while (strchr (buf, '\n') == NULL); } out: /* Should we test for ferror()? I think we have to silently ignore errors. --drepper */ fclose (fp); if (added > 0) qsort (map, nmap, sizeof (struct alias_map), (int (*) (const void *, const void *)) alias_compare); return added; } static int extend_alias_table () { size_t new_size; struct alias_map *new_map; new_size = maxmap == 0 ? 100 : 2 * maxmap; new_map = (struct alias_map *) realloc (map, (new_size * sizeof (struct alias_map))); if (new_map == NULL) /* Simply don't extend: we don't have any more core. */ return -1; map = new_map; maxmap = new_size; return 0; } static int alias_compare (const struct alias_map *map1, const struct alias_map *map2) { #if defined _LIBC || defined HAVE_STRCASECMP return strcasecmp (map1->alias, map2->alias); #else const unsigned char *p1 = (const unsigned char *) map1->alias; const unsigned char *p2 = (const unsigned char *) map2->alias; unsigned char c1, c2; if (p1 == p2) return 0; do { /* I know this seems to be odd but the tolower() function in some systems libc cannot handle nonalpha characters. */ c1 = isupper (*p1) ? tolower (*p1) : *p1; c2 = isupper (*p2) ? tolower (*p2) : *p2; if (c1 == '\0') break; ++p1; ++p2; } while (c1 == c2); return c1 - c2; #endif } cadaver-0.23.3/lib/intl/printf-args.c0000644000076400007640000001336311312007552016742 0ustar jortonjorton/* Decomposed printf argument list. Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file can be parametrized with the following macros: ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. PRINTF_FETCHARGS Name of the function to be defined. STATIC Set to 'static' to declare the function static. */ #ifndef PRINTF_FETCHARGS # include #endif /* Specification. */ #ifndef PRINTF_FETCHARGS # include "printf-args.h" #endif #ifdef STATIC STATIC #endif int PRINTF_FETCHARGS (va_list args, arguments *a) { size_t i; argument *ap; for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) switch (ap->type) { case TYPE_SCHAR: ap->a.a_schar = va_arg (args, /*signed char*/ int); break; case TYPE_UCHAR: ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); break; case TYPE_SHORT: ap->a.a_short = va_arg (args, /*short*/ int); break; case TYPE_USHORT: ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); break; case TYPE_INT: ap->a.a_int = va_arg (args, int); break; case TYPE_UINT: ap->a.a_uint = va_arg (args, unsigned int); break; case TYPE_LONGINT: ap->a.a_longint = va_arg (args, long int); break; case TYPE_ULONGINT: ap->a.a_ulongint = va_arg (args, unsigned long int); break; #if HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: ap->a.a_longlongint = va_arg (args, long long int); break; case TYPE_ULONGLONGINT: ap->a.a_ulonglongint = va_arg (args, unsigned long long int); break; #endif case TYPE_DOUBLE: ap->a.a_double = va_arg (args, double); break; case TYPE_LONGDOUBLE: ap->a.a_longdouble = va_arg (args, long double); break; case TYPE_CHAR: ap->a.a_char = va_arg (args, int); break; #if HAVE_WINT_T case TYPE_WIDE_CHAR: /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by default argument promotions", this is not the case in mingw32, where wint_t is 'unsigned short'. */ ap->a.a_wide_char = (sizeof (wint_t) < sizeof (int) ? va_arg (args, int) : va_arg (args, wint_t)); break; #endif case TYPE_STRING: ap->a.a_string = va_arg (args, const char *); /* A null pointer is an invalid argument for "%s", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_string == NULL) ap->a.a_string = "(NULL)"; break; #if HAVE_WCHAR_T case TYPE_WIDE_STRING: ap->a.a_wide_string = va_arg (args, const wchar_t *); /* A null pointer is an invalid argument for "%ls", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_wide_string == NULL) { static const wchar_t wide_null_string[] = { (wchar_t)'(', (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', (wchar_t)')', (wchar_t)0 }; ap->a.a_wide_string = wide_null_string; } break; #endif case TYPE_POINTER: ap->a.a_pointer = va_arg (args, void *); break; case TYPE_COUNT_SCHAR_POINTER: ap->a.a_count_schar_pointer = va_arg (args, signed char *); break; case TYPE_COUNT_SHORT_POINTER: ap->a.a_count_short_pointer = va_arg (args, short *); break; case TYPE_COUNT_INT_POINTER: ap->a.a_count_int_pointer = va_arg (args, int *); break; case TYPE_COUNT_LONGINT_POINTER: ap->a.a_count_longint_pointer = va_arg (args, long int *); break; #if HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); break; #endif #if ENABLE_UNISTDIO /* The unistdio extensions. */ case TYPE_U8_STRING: ap->a.a_u8_string = va_arg (args, const uint8_t *); /* A null pointer is an invalid argument for "%U", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_u8_string == NULL) { static const uint8_t u8_null_string[] = { '(', 'N', 'U', 'L', 'L', ')', 0 }; ap->a.a_u8_string = u8_null_string; } break; case TYPE_U16_STRING: ap->a.a_u16_string = va_arg (args, const uint16_t *); /* A null pointer is an invalid argument for "%lU", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_u16_string == NULL) { static const uint16_t u16_null_string[] = { '(', 'N', 'U', 'L', 'L', ')', 0 }; ap->a.a_u16_string = u16_null_string; } break; case TYPE_U32_STRING: ap->a.a_u32_string = va_arg (args, const uint32_t *); /* A null pointer is an invalid argument for "%llU", but in practice it occurs quite frequently in printf statements that produce debug output. Use a fallback in this case. */ if (ap->a.a_u32_string == NULL) { static const uint32_t u32_null_string[] = { '(', 'N', 'U', 'L', 'L', ')', 0 }; ap->a.a_u32_string = u32_null_string; } break; #endif default: /* Unknown type. */ return -1; } return 0; } cadaver-0.23.3/lib/intl/ref-del.sin0000644000076400007640000000203011312007552016360 0ustar jortonjorton# Remove this package from a list of references stored in a text file. # # Copyright (C) 2000 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. # # Written by Bruno Haible . # /^# Packages using this file: / { s/# Packages using this file:// s/ @PACKAGE@ / / s/^/# Packages using this file:/ } cadaver-0.23.3/lib/intl/loadmsgcat.c0000644000076400007640000010270011312007552016616 0ustar jortonjorton/* Load needed message catalogs. Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Tell glibc's to provide a prototype for mempcpy(). This must come before because may include , and once has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #ifdef __GNUC__ # undef alloca # define alloca __builtin_alloca # define HAVE_ALLOCA 1 #else # ifdef _MSC_VER # include # define alloca _alloca # else # if defined HAVE_ALLOCA_H || defined _LIBC # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca char *alloca (); # endif # endif # endif # endif #endif #include #include #if defined HAVE_UNISTD_H || defined _LIBC # include #endif #ifdef _LIBC # include # include #endif #if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ || (defined _LIBC && defined _POSIX_MAPPED_FILES) # include # undef HAVE_MMAP # define HAVE_MMAP 1 #else # undef HAVE_MMAP #endif #if defined HAVE_STDINT_H_WITH_UINTMAX || defined _LIBC # include #endif #if defined HAVE_INTTYPES_H || defined _LIBC # include #endif #include "gmo.h" #include "gettextP.h" #include "hash-string.h" #include "plural-exp.h" #ifdef _LIBC # include "../locale/localeinfo.h" # include #endif /* Handle multi-threaded applications. */ #ifdef _LIBC # include #else # include "lock.h" #endif /* Provide fallback values for macros that ought to be defined in . Note that our fallback values need not be literal strings, because we don't use them with preprocessor string concatenation. */ #if !defined PRId8 || PRI_MACROS_BROKEN # undef PRId8 # define PRId8 "d" #endif #if !defined PRIi8 || PRI_MACROS_BROKEN # undef PRIi8 # define PRIi8 "i" #endif #if !defined PRIo8 || PRI_MACROS_BROKEN # undef PRIo8 # define PRIo8 "o" #endif #if !defined PRIu8 || PRI_MACROS_BROKEN # undef PRIu8 # define PRIu8 "u" #endif #if !defined PRIx8 || PRI_MACROS_BROKEN # undef PRIx8 # define PRIx8 "x" #endif #if !defined PRIX8 || PRI_MACROS_BROKEN # undef PRIX8 # define PRIX8 "X" #endif #if !defined PRId16 || PRI_MACROS_BROKEN # undef PRId16 # define PRId16 "d" #endif #if !defined PRIi16 || PRI_MACROS_BROKEN # undef PRIi16 # define PRIi16 "i" #endif #if !defined PRIo16 || PRI_MACROS_BROKEN # undef PRIo16 # define PRIo16 "o" #endif #if !defined PRIu16 || PRI_MACROS_BROKEN # undef PRIu16 # define PRIu16 "u" #endif #if !defined PRIx16 || PRI_MACROS_BROKEN # undef PRIx16 # define PRIx16 "x" #endif #if !defined PRIX16 || PRI_MACROS_BROKEN # undef PRIX16 # define PRIX16 "X" #endif #if !defined PRId32 || PRI_MACROS_BROKEN # undef PRId32 # define PRId32 "d" #endif #if !defined PRIi32 || PRI_MACROS_BROKEN # undef PRIi32 # define PRIi32 "i" #endif #if !defined PRIo32 || PRI_MACROS_BROKEN # undef PRIo32 # define PRIo32 "o" #endif #if !defined PRIu32 || PRI_MACROS_BROKEN # undef PRIu32 # define PRIu32 "u" #endif #if !defined PRIx32 || PRI_MACROS_BROKEN # undef PRIx32 # define PRIx32 "x" #endif #if !defined PRIX32 || PRI_MACROS_BROKEN # undef PRIX32 # define PRIX32 "X" #endif #if !defined PRId64 || PRI_MACROS_BROKEN # undef PRId64 # define PRId64 (sizeof (long) == 8 ? "ld" : "lld") #endif #if !defined PRIi64 || PRI_MACROS_BROKEN # undef PRIi64 # define PRIi64 (sizeof (long) == 8 ? "li" : "lli") #endif #if !defined PRIo64 || PRI_MACROS_BROKEN # undef PRIo64 # define PRIo64 (sizeof (long) == 8 ? "lo" : "llo") #endif #if !defined PRIu64 || PRI_MACROS_BROKEN # undef PRIu64 # define PRIu64 (sizeof (long) == 8 ? "lu" : "llu") #endif #if !defined PRIx64 || PRI_MACROS_BROKEN # undef PRIx64 # define PRIx64 (sizeof (long) == 8 ? "lx" : "llx") #endif #if !defined PRIX64 || PRI_MACROS_BROKEN # undef PRIX64 # define PRIX64 (sizeof (long) == 8 ? "lX" : "llX") #endif #if !defined PRIdLEAST8 || PRI_MACROS_BROKEN # undef PRIdLEAST8 # define PRIdLEAST8 "d" #endif #if !defined PRIiLEAST8 || PRI_MACROS_BROKEN # undef PRIiLEAST8 # define PRIiLEAST8 "i" #endif #if !defined PRIoLEAST8 || PRI_MACROS_BROKEN # undef PRIoLEAST8 # define PRIoLEAST8 "o" #endif #if !defined PRIuLEAST8 || PRI_MACROS_BROKEN # undef PRIuLEAST8 # define PRIuLEAST8 "u" #endif #if !defined PRIxLEAST8 || PRI_MACROS_BROKEN # undef PRIxLEAST8 # define PRIxLEAST8 "x" #endif #if !defined PRIXLEAST8 || PRI_MACROS_BROKEN # undef PRIXLEAST8 # define PRIXLEAST8 "X" #endif #if !defined PRIdLEAST16 || PRI_MACROS_BROKEN # undef PRIdLEAST16 # define PRIdLEAST16 "d" #endif #if !defined PRIiLEAST16 || PRI_MACROS_BROKEN # undef PRIiLEAST16 # define PRIiLEAST16 "i" #endif #if !defined PRIoLEAST16 || PRI_MACROS_BROKEN # undef PRIoLEAST16 # define PRIoLEAST16 "o" #endif #if !defined PRIuLEAST16 || PRI_MACROS_BROKEN # undef PRIuLEAST16 # define PRIuLEAST16 "u" #endif #if !defined PRIxLEAST16 || PRI_MACROS_BROKEN # undef PRIxLEAST16 # define PRIxLEAST16 "x" #endif #if !defined PRIXLEAST16 || PRI_MACROS_BROKEN # undef PRIXLEAST16 # define PRIXLEAST16 "X" #endif #if !defined PRIdLEAST32 || PRI_MACROS_BROKEN # undef PRIdLEAST32 # define PRIdLEAST32 "d" #endif #if !defined PRIiLEAST32 || PRI_MACROS_BROKEN # undef PRIiLEAST32 # define PRIiLEAST32 "i" #endif #if !defined PRIoLEAST32 || PRI_MACROS_BROKEN # undef PRIoLEAST32 # define PRIoLEAST32 "o" #endif #if !defined PRIuLEAST32 || PRI_MACROS_BROKEN # undef PRIuLEAST32 # define PRIuLEAST32 "u" #endif #if !defined PRIxLEAST32 || PRI_MACROS_BROKEN # undef PRIxLEAST32 # define PRIxLEAST32 "x" #endif #if !defined PRIXLEAST32 || PRI_MACROS_BROKEN # undef PRIXLEAST32 # define PRIXLEAST32 "X" #endif #if !defined PRIdLEAST64 || PRI_MACROS_BROKEN # undef PRIdLEAST64 # define PRIdLEAST64 PRId64 #endif #if !defined PRIiLEAST64 || PRI_MACROS_BROKEN # undef PRIiLEAST64 # define PRIiLEAST64 PRIi64 #endif #if !defined PRIoLEAST64 || PRI_MACROS_BROKEN # undef PRIoLEAST64 # define PRIoLEAST64 PRIo64 #endif #if !defined PRIuLEAST64 || PRI_MACROS_BROKEN # undef PRIuLEAST64 # define PRIuLEAST64 PRIu64 #endif #if !defined PRIxLEAST64 || PRI_MACROS_BROKEN # undef PRIxLEAST64 # define PRIxLEAST64 PRIx64 #endif #if !defined PRIXLEAST64 || PRI_MACROS_BROKEN # undef PRIXLEAST64 # define PRIXLEAST64 PRIX64 #endif #if !defined PRIdFAST8 || PRI_MACROS_BROKEN # undef PRIdFAST8 # define PRIdFAST8 "d" #endif #if !defined PRIiFAST8 || PRI_MACROS_BROKEN # undef PRIiFAST8 # define PRIiFAST8 "i" #endif #if !defined PRIoFAST8 || PRI_MACROS_BROKEN # undef PRIoFAST8 # define PRIoFAST8 "o" #endif #if !defined PRIuFAST8 || PRI_MACROS_BROKEN # undef PRIuFAST8 # define PRIuFAST8 "u" #endif #if !defined PRIxFAST8 || PRI_MACROS_BROKEN # undef PRIxFAST8 # define PRIxFAST8 "x" #endif #if !defined PRIXFAST8 || PRI_MACROS_BROKEN # undef PRIXFAST8 # define PRIXFAST8 "X" #endif #if !defined PRIdFAST16 || PRI_MACROS_BROKEN # undef PRIdFAST16 # define PRIdFAST16 "d" #endif #if !defined PRIiFAST16 || PRI_MACROS_BROKEN # undef PRIiFAST16 # define PRIiFAST16 "i" #endif #if !defined PRIoFAST16 || PRI_MACROS_BROKEN # undef PRIoFAST16 # define PRIoFAST16 "o" #endif #if !defined PRIuFAST16 || PRI_MACROS_BROKEN # undef PRIuFAST16 # define PRIuFAST16 "u" #endif #if !defined PRIxFAST16 || PRI_MACROS_BROKEN # undef PRIxFAST16 # define PRIxFAST16 "x" #endif #if !defined PRIXFAST16 || PRI_MACROS_BROKEN # undef PRIXFAST16 # define PRIXFAST16 "X" #endif #if !defined PRIdFAST32 || PRI_MACROS_BROKEN # undef PRIdFAST32 # define PRIdFAST32 "d" #endif #if !defined PRIiFAST32 || PRI_MACROS_BROKEN # undef PRIiFAST32 # define PRIiFAST32 "i" #endif #if !defined PRIoFAST32 || PRI_MACROS_BROKEN # undef PRIoFAST32 # define PRIoFAST32 "o" #endif #if !defined PRIuFAST32 || PRI_MACROS_BROKEN # undef PRIuFAST32 # define PRIuFAST32 "u" #endif #if !defined PRIxFAST32 || PRI_MACROS_BROKEN # undef PRIxFAST32 # define PRIxFAST32 "x" #endif #if !defined PRIXFAST32 || PRI_MACROS_BROKEN # undef PRIXFAST32 # define PRIXFAST32 "X" #endif #if !defined PRIdFAST64 || PRI_MACROS_BROKEN # undef PRIdFAST64 # define PRIdFAST64 PRId64 #endif #if !defined PRIiFAST64 || PRI_MACROS_BROKEN # undef PRIiFAST64 # define PRIiFAST64 PRIi64 #endif #if !defined PRIoFAST64 || PRI_MACROS_BROKEN # undef PRIoFAST64 # define PRIoFAST64 PRIo64 #endif #if !defined PRIuFAST64 || PRI_MACROS_BROKEN # undef PRIuFAST64 # define PRIuFAST64 PRIu64 #endif #if !defined PRIxFAST64 || PRI_MACROS_BROKEN # undef PRIxFAST64 # define PRIxFAST64 PRIx64 #endif #if !defined PRIXFAST64 || PRI_MACROS_BROKEN # undef PRIXFAST64 # define PRIXFAST64 PRIX64 #endif #if !defined PRIdMAX || PRI_MACROS_BROKEN # undef PRIdMAX # define PRIdMAX (sizeof (uintmax_t) == sizeof (long) ? "ld" : "lld") #endif #if !defined PRIiMAX || PRI_MACROS_BROKEN # undef PRIiMAX # define PRIiMAX (sizeof (uintmax_t) == sizeof (long) ? "li" : "lli") #endif #if !defined PRIoMAX || PRI_MACROS_BROKEN # undef PRIoMAX # define PRIoMAX (sizeof (uintmax_t) == sizeof (long) ? "lo" : "llo") #endif #if !defined PRIuMAX || PRI_MACROS_BROKEN # undef PRIuMAX # define PRIuMAX (sizeof (uintmax_t) == sizeof (long) ? "lu" : "llu") #endif #if !defined PRIxMAX || PRI_MACROS_BROKEN # undef PRIxMAX # define PRIxMAX (sizeof (uintmax_t) == sizeof (long) ? "lx" : "llx") #endif #if !defined PRIXMAX || PRI_MACROS_BROKEN # undef PRIXMAX # define PRIXMAX (sizeof (uintmax_t) == sizeof (long) ? "lX" : "llX") #endif #if !defined PRIdPTR || PRI_MACROS_BROKEN # undef PRIdPTR # define PRIdPTR \ (sizeof (void *) == sizeof (long) ? "ld" : \ sizeof (void *) == sizeof (int) ? "d" : \ "lld") #endif #if !defined PRIiPTR || PRI_MACROS_BROKEN # undef PRIiPTR # define PRIiPTR \ (sizeof (void *) == sizeof (long) ? "li" : \ sizeof (void *) == sizeof (int) ? "i" : \ "lli") #endif #if !defined PRIoPTR || PRI_MACROS_BROKEN # undef PRIoPTR # define PRIoPTR \ (sizeof (void *) == sizeof (long) ? "lo" : \ sizeof (void *) == sizeof (int) ? "o" : \ "llo") #endif #if !defined PRIuPTR || PRI_MACROS_BROKEN # undef PRIuPTR # define PRIuPTR \ (sizeof (void *) == sizeof (long) ? "lu" : \ sizeof (void *) == sizeof (int) ? "u" : \ "llu") #endif #if !defined PRIxPTR || PRI_MACROS_BROKEN # undef PRIxPTR # define PRIxPTR \ (sizeof (void *) == sizeof (long) ? "lx" : \ sizeof (void *) == sizeof (int) ? "x" : \ "llx") #endif #if !defined PRIXPTR || PRI_MACROS_BROKEN # undef PRIXPTR # define PRIXPTR \ (sizeof (void *) == sizeof (long) ? "lX" : \ sizeof (void *) == sizeof (int) ? "X" : \ "llX") #endif /* @@ end of prolog @@ */ #ifdef _LIBC /* Rename the non ISO C functions. This is required by the standard because some ISO C functions will require linking with this object file and the name space must not be polluted. */ # define open(name, flags) open_not_cancel_2 (name, flags) # define close(fd) close_not_cancel_no_status (fd) # define read(fd, buf, n) read_not_cancel (fd, buf, n) # define mmap(addr, len, prot, flags, fd, offset) \ __mmap (addr, len, prot, flags, fd, offset) # define munmap(addr, len) __munmap (addr, len) #endif /* For those losing systems which don't have `alloca' we have to add some additional code emulating it. */ #ifdef HAVE_ALLOCA # define freea(p) /* nothing */ #else # define alloca(n) malloc (n) # define freea(p) free (p) #endif /* For systems that distinguish between text and binary I/O. O_BINARY is usually declared in . */ #if !defined O_BINARY && defined _O_BINARY /* For MSC-compatible compilers. */ # define O_BINARY _O_BINARY # define O_TEXT _O_TEXT #endif #ifdef __BEOS__ /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ # undef O_BINARY # undef O_TEXT #endif /* On reasonable systems, binary I/O is the default. */ #ifndef O_BINARY # define O_BINARY 0 #endif /* We need a sign, whether a new catalog was loaded, which can be associated with all translations. This is important if the translations are cached by one of GCC's features. */ int _nl_msg_cat_cntr; /* Expand a system dependent string segment. Return NULL if unsupported. */ static const char * get_sysdep_segment_value (const char *name) { /* Test for an ISO C 99 section 7.8.1 format string directive. Syntax: P R I { d | i | o | u | x | X } { { | LEAST | FAST } { 8 | 16 | 32 | 64 } | MAX | PTR } */ /* We don't use a table of 14 times 6 'const char *' strings here, because data relocations cost startup time. */ if (name[0] == 'P' && name[1] == 'R' && name[2] == 'I') { if (name[3] == 'd' || name[3] == 'i' || name[3] == 'o' || name[3] == 'u' || name[3] == 'x' || name[3] == 'X') { if (name[4] == '8' && name[5] == '\0') { if (name[3] == 'd') return PRId8; if (name[3] == 'i') return PRIi8; if (name[3] == 'o') return PRIo8; if (name[3] == 'u') return PRIu8; if (name[3] == 'x') return PRIx8; if (name[3] == 'X') return PRIX8; abort (); } if (name[4] == '1' && name[5] == '6' && name[6] == '\0') { if (name[3] == 'd') return PRId16; if (name[3] == 'i') return PRIi16; if (name[3] == 'o') return PRIo16; if (name[3] == 'u') return PRIu16; if (name[3] == 'x') return PRIx16; if (name[3] == 'X') return PRIX16; abort (); } if (name[4] == '3' && name[5] == '2' && name[6] == '\0') { if (name[3] == 'd') return PRId32; if (name[3] == 'i') return PRIi32; if (name[3] == 'o') return PRIo32; if (name[3] == 'u') return PRIu32; if (name[3] == 'x') return PRIx32; if (name[3] == 'X') return PRIX32; abort (); } if (name[4] == '6' && name[5] == '4' && name[6] == '\0') { if (name[3] == 'd') return PRId64; if (name[3] == 'i') return PRIi64; if (name[3] == 'o') return PRIo64; if (name[3] == 'u') return PRIu64; if (name[3] == 'x') return PRIx64; if (name[3] == 'X') return PRIX64; abort (); } if (name[4] == 'L' && name[5] == 'E' && name[6] == 'A' && name[7] == 'S' && name[8] == 'T') { if (name[9] == '8' && name[10] == '\0') { if (name[3] == 'd') return PRIdLEAST8; if (name[3] == 'i') return PRIiLEAST8; if (name[3] == 'o') return PRIoLEAST8; if (name[3] == 'u') return PRIuLEAST8; if (name[3] == 'x') return PRIxLEAST8; if (name[3] == 'X') return PRIXLEAST8; abort (); } if (name[9] == '1' && name[10] == '6' && name[11] == '\0') { if (name[3] == 'd') return PRIdLEAST16; if (name[3] == 'i') return PRIiLEAST16; if (name[3] == 'o') return PRIoLEAST16; if (name[3] == 'u') return PRIuLEAST16; if (name[3] == 'x') return PRIxLEAST16; if (name[3] == 'X') return PRIXLEAST16; abort (); } if (name[9] == '3' && name[10] == '2' && name[11] == '\0') { if (name[3] == 'd') return PRIdLEAST32; if (name[3] == 'i') return PRIiLEAST32; if (name[3] == 'o') return PRIoLEAST32; if (name[3] == 'u') return PRIuLEAST32; if (name[3] == 'x') return PRIxLEAST32; if (name[3] == 'X') return PRIXLEAST32; abort (); } if (name[9] == '6' && name[10] == '4' && name[11] == '\0') { if (name[3] == 'd') return PRIdLEAST64; if (name[3] == 'i') return PRIiLEAST64; if (name[3] == 'o') return PRIoLEAST64; if (name[3] == 'u') return PRIuLEAST64; if (name[3] == 'x') return PRIxLEAST64; if (name[3] == 'X') return PRIXLEAST64; abort (); } } if (name[4] == 'F' && name[5] == 'A' && name[6] == 'S' && name[7] == 'T') { if (name[8] == '8' && name[9] == '\0') { if (name[3] == 'd') return PRIdFAST8; if (name[3] == 'i') return PRIiFAST8; if (name[3] == 'o') return PRIoFAST8; if (name[3] == 'u') return PRIuFAST8; if (name[3] == 'x') return PRIxFAST8; if (name[3] == 'X') return PRIXFAST8; abort (); } if (name[8] == '1' && name[9] == '6' && name[10] == '\0') { if (name[3] == 'd') return PRIdFAST16; if (name[3] == 'i') return PRIiFAST16; if (name[3] == 'o') return PRIoFAST16; if (name[3] == 'u') return PRIuFAST16; if (name[3] == 'x') return PRIxFAST16; if (name[3] == 'X') return PRIXFAST16; abort (); } if (name[8] == '3' && name[9] == '2' && name[10] == '\0') { if (name[3] == 'd') return PRIdFAST32; if (name[3] == 'i') return PRIiFAST32; if (name[3] == 'o') return PRIoFAST32; if (name[3] == 'u') return PRIuFAST32; if (name[3] == 'x') return PRIxFAST32; if (name[3] == 'X') return PRIXFAST32; abort (); } if (name[8] == '6' && name[9] == '4' && name[10] == '\0') { if (name[3] == 'd') return PRIdFAST64; if (name[3] == 'i') return PRIiFAST64; if (name[3] == 'o') return PRIoFAST64; if (name[3] == 'u') return PRIuFAST64; if (name[3] == 'x') return PRIxFAST64; if (name[3] == 'X') return PRIXFAST64; abort (); } } if (name[4] == 'M' && name[5] == 'A' && name[6] == 'X' && name[7] == '\0') { if (name[3] == 'd') return PRIdMAX; if (name[3] == 'i') return PRIiMAX; if (name[3] == 'o') return PRIoMAX; if (name[3] == 'u') return PRIuMAX; if (name[3] == 'x') return PRIxMAX; if (name[3] == 'X') return PRIXMAX; abort (); } if (name[4] == 'P' && name[5] == 'T' && name[6] == 'R' && name[7] == '\0') { if (name[3] == 'd') return PRIdPTR; if (name[3] == 'i') return PRIiPTR; if (name[3] == 'o') return PRIoPTR; if (name[3] == 'u') return PRIuPTR; if (name[3] == 'x') return PRIxPTR; if (name[3] == 'X') return PRIXPTR; abort (); } } } /* Test for a glibc specific printf() format directive flag. */ if (name[0] == 'I' && name[1] == '\0') { #if defined _LIBC || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) /* The 'I' flag, in numeric format directives, replaces ASCII digits with the 'outdigits' defined in the LC_CTYPE locale facet. This is used for Farsi (Persian) and maybe Arabic. */ return "I"; #else return ""; #endif } /* Other system dependent strings are not valid. */ return NULL; } /* Load the message catalogs specified by FILENAME. If it is no valid message catalog do nothing. */ void internal_function _nl_load_domain (struct loaded_l10nfile *domain_file, struct binding *domainbinding) { __libc_lock_define_initialized_recursive (static, lock) int fd = -1; size_t size; #ifdef _LIBC struct stat64 st; #else struct stat st; #endif struct mo_file_header *data = (struct mo_file_header *) -1; int use_mmap = 0; struct loaded_domain *domain; int revision; const char *nullentry; size_t nullentrylen; __libc_lock_lock_recursive (lock); if (domain_file->decided != 0) { /* There are two possibilities: + this is the same thread calling again during this initialization via _nl_find_msg. We have initialized everything this call needs. + this is another thread which tried to initialize this object. Not necessary anymore since if the lock is available this is finished. */ goto done; } domain_file->decided = -1; domain_file->data = NULL; /* Note that it would be useless to store domainbinding in domain_file because domainbinding might be == NULL now but != NULL later (after a call to bind_textdomain_codeset). */ /* If the record does not represent a valid locale the FILENAME might be NULL. This can happen when according to the given specification the locale file name is different for XPG and CEN syntax. */ if (domain_file->filename == NULL) goto out; /* Try to open the addressed file. */ fd = open (domain_file->filename, O_RDONLY | O_BINARY); if (fd == -1) goto out; /* We must know about the size of the file. */ if ( #ifdef _LIBC __builtin_expect (fstat64 (fd, &st) != 0, 0) #else __builtin_expect (fstat (fd, &st) != 0, 0) #endif || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0) || __builtin_expect (size < sizeof (struct mo_file_header), 0)) /* Something went wrong. */ goto out; #ifdef HAVE_MMAP /* Now we are ready to load the file. If mmap() is available we try this first. If not available or it failed we try to load it. */ data = (struct mo_file_header *) mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); if (__builtin_expect (data != (struct mo_file_header *) -1, 1)) { /* mmap() call was successful. */ close (fd); fd = -1; use_mmap = 1; } #endif /* If the data is not yet available (i.e. mmap'ed) we try to load it manually. */ if (data == (struct mo_file_header *) -1) { size_t to_read; char *read_ptr; data = (struct mo_file_header *) malloc (size); if (data == NULL) goto out; to_read = size; read_ptr = (char *) data; do { long int nb = (long int) read (fd, read_ptr, to_read); if (nb <= 0) { #ifdef EINTR if (nb == -1 && errno == EINTR) continue; #endif goto out; } read_ptr += nb; to_read -= nb; } while (to_read > 0); close (fd); fd = -1; } /* Using the magic number we can test whether it really is a message catalog file. */ if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED, 0)) { /* The magic number is wrong: not a message catalog file. */ #ifdef HAVE_MMAP if (use_mmap) munmap ((caddr_t) data, size); else #endif free (data); goto out; } domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain)); if (domain == NULL) goto out; domain_file->data = domain; domain->data = (char *) data; domain->use_mmap = use_mmap; domain->mmap_size = size; domain->must_swap = data->magic != _MAGIC; domain->malloced = NULL; /* Fill in the information about the available tables. */ revision = W (domain->must_swap, data->revision); /* We support only the major revisions 0 and 1. */ switch (revision >> 16) { case 0: case 1: domain->nstrings = W (domain->must_swap, data->nstrings); domain->orig_tab = (const struct string_desc *) ((char *) data + W (domain->must_swap, data->orig_tab_offset)); domain->trans_tab = (const struct string_desc *) ((char *) data + W (domain->must_swap, data->trans_tab_offset)); domain->hash_size = W (domain->must_swap, data->hash_tab_size); domain->hash_tab = (domain->hash_size > 2 ? (const nls_uint32 *) ((char *) data + W (domain->must_swap, data->hash_tab_offset)) : NULL); domain->must_swap_hash_tab = domain->must_swap; /* Now dispatch on the minor revision. */ switch (revision & 0xffff) { case 0: domain->n_sysdep_strings = 0; domain->orig_sysdep_tab = NULL; domain->trans_sysdep_tab = NULL; break; case 1: default: { nls_uint32 n_sysdep_strings; if (domain->hash_tab == NULL) /* This is invalid. These minor revisions need a hash table. */ goto invalid; n_sysdep_strings = W (domain->must_swap, data->n_sysdep_strings); if (n_sysdep_strings > 0) { nls_uint32 n_sysdep_segments; const struct sysdep_segment *sysdep_segments; const char **sysdep_segment_values; const nls_uint32 *orig_sysdep_tab; const nls_uint32 *trans_sysdep_tab; nls_uint32 n_inmem_sysdep_strings; size_t memneed; char *mem; struct sysdep_string_desc *inmem_orig_sysdep_tab; struct sysdep_string_desc *inmem_trans_sysdep_tab; nls_uint32 *inmem_hash_tab; unsigned int i, j; /* Get the values of the system dependent segments. */ n_sysdep_segments = W (domain->must_swap, data->n_sysdep_segments); sysdep_segments = (const struct sysdep_segment *) ((char *) data + W (domain->must_swap, data->sysdep_segments_offset)); sysdep_segment_values = (const char **) alloca (n_sysdep_segments * sizeof (const char *)); for (i = 0; i < n_sysdep_segments; i++) { const char *name = (char *) data + W (domain->must_swap, sysdep_segments[i].offset); nls_uint32 namelen = W (domain->must_swap, sysdep_segments[i].length); if (!(namelen > 0 && name[namelen - 1] == '\0')) { freea (sysdep_segment_values); goto invalid; } sysdep_segment_values[i] = get_sysdep_segment_value (name); } orig_sysdep_tab = (const nls_uint32 *) ((char *) data + W (domain->must_swap, data->orig_sysdep_tab_offset)); trans_sysdep_tab = (const nls_uint32 *) ((char *) data + W (domain->must_swap, data->trans_sysdep_tab_offset)); /* Compute the amount of additional memory needed for the system dependent strings and the augmented hash table. At the same time, also drop string pairs which refer to an undefined system dependent segment. */ n_inmem_sysdep_strings = 0; memneed = domain->hash_size * sizeof (nls_uint32); for (i = 0; i < n_sysdep_strings; i++) { int valid = 1; size_t needs[2]; for (j = 0; j < 2; j++) { const struct sysdep_string *sysdep_string = (const struct sysdep_string *) ((char *) data + W (domain->must_swap, j == 0 ? orig_sysdep_tab[i] : trans_sysdep_tab[i])); size_t need = 0; const struct segment_pair *p = sysdep_string->segments; if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END) for (p = sysdep_string->segments;; p++) { nls_uint32 sysdepref; need += W (domain->must_swap, p->segsize); sysdepref = W (domain->must_swap, p->sysdepref); if (sysdepref == SEGMENTS_END) break; if (sysdepref >= n_sysdep_segments) { /* Invalid. */ freea (sysdep_segment_values); goto invalid; } if (sysdep_segment_values[sysdepref] == NULL) { /* This particular string pair is invalid. */ valid = 0; break; } need += strlen (sysdep_segment_values[sysdepref]); } needs[j] = need; if (!valid) break; } if (valid) { n_inmem_sysdep_strings++; memneed += needs[0] + needs[1]; } } memneed += 2 * n_inmem_sysdep_strings * sizeof (struct sysdep_string_desc); if (n_inmem_sysdep_strings > 0) { unsigned int k; /* Allocate additional memory. */ mem = (char *) malloc (memneed); if (mem == NULL) goto invalid; domain->malloced = mem; inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem; mem += n_inmem_sysdep_strings * sizeof (struct sysdep_string_desc); inmem_trans_sysdep_tab = (struct sysdep_string_desc *) mem; mem += n_inmem_sysdep_strings * sizeof (struct sysdep_string_desc); inmem_hash_tab = (nls_uint32 *) mem; mem += domain->hash_size * sizeof (nls_uint32); /* Compute the system dependent strings. */ k = 0; for (i = 0; i < n_sysdep_strings; i++) { int valid = 1; for (j = 0; j < 2; j++) { const struct sysdep_string *sysdep_string = (const struct sysdep_string *) ((char *) data + W (domain->must_swap, j == 0 ? orig_sysdep_tab[i] : trans_sysdep_tab[i])); const struct segment_pair *p = sysdep_string->segments; if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END) for (p = sysdep_string->segments;; p++) { nls_uint32 sysdepref; sysdepref = W (domain->must_swap, p->sysdepref); if (sysdepref == SEGMENTS_END) break; if (sysdep_segment_values[sysdepref] == NULL) { /* This particular string pair is invalid. */ valid = 0; break; } } if (!valid) break; } if (valid) { for (j = 0; j < 2; j++) { const struct sysdep_string *sysdep_string = (const struct sysdep_string *) ((char *) data + W (domain->must_swap, j == 0 ? orig_sysdep_tab[i] : trans_sysdep_tab[i])); const char *static_segments = (char *) data + W (domain->must_swap, sysdep_string->offset); const struct segment_pair *p = sysdep_string->segments; /* Concatenate the segments, and fill inmem_orig_sysdep_tab[k] (for j == 0) and inmem_trans_sysdep_tab[k] (for j == 1). */ struct sysdep_string_desc *inmem_tab_entry = (j == 0 ? inmem_orig_sysdep_tab : inmem_trans_sysdep_tab) + k; if (W (domain->must_swap, p->sysdepref) == SEGMENTS_END) { /* Only one static segment. */ inmem_tab_entry->length = W (domain->must_swap, p->segsize); inmem_tab_entry->pointer = static_segments; } else { inmem_tab_entry->pointer = mem; for (p = sysdep_string->segments;; p++) { nls_uint32 segsize = W (domain->must_swap, p->segsize); nls_uint32 sysdepref = W (domain->must_swap, p->sysdepref); size_t n; if (segsize > 0) { memcpy (mem, static_segments, segsize); mem += segsize; static_segments += segsize; } if (sysdepref == SEGMENTS_END) break; n = strlen (sysdep_segment_values[sysdepref]); memcpy (mem, sysdep_segment_values[sysdepref], n); mem += n; } inmem_tab_entry->length = mem - inmem_tab_entry->pointer; } } k++; } } if (k != n_inmem_sysdep_strings) abort (); /* Compute the augmented hash table. */ for (i = 0; i < domain->hash_size; i++) inmem_hash_tab[i] = W (domain->must_swap_hash_tab, domain->hash_tab[i]); for (i = 0; i < n_inmem_sysdep_strings; i++) { const char *msgid = inmem_orig_sysdep_tab[i].pointer; nls_uint32 hash_val = __hash_string (msgid); nls_uint32 idx = hash_val % domain->hash_size; nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); for (;;) { if (inmem_hash_tab[idx] == 0) { /* Hash table entry is empty. Use it. */ inmem_hash_tab[idx] = 1 + domain->nstrings + i; break; } if (idx >= domain->hash_size - incr) idx -= domain->hash_size - incr; else idx += incr; } } domain->n_sysdep_strings = n_inmem_sysdep_strings; domain->orig_sysdep_tab = inmem_orig_sysdep_tab; domain->trans_sysdep_tab = inmem_trans_sysdep_tab; domain->hash_tab = inmem_hash_tab; domain->must_swap_hash_tab = 0; } else { domain->n_sysdep_strings = 0; domain->orig_sysdep_tab = NULL; domain->trans_sysdep_tab = NULL; } freea (sysdep_segment_values); } else { domain->n_sysdep_strings = 0; domain->orig_sysdep_tab = NULL; domain->trans_sysdep_tab = NULL; } } break; } break; default: /* This is an invalid revision. */ invalid: /* This is an invalid .mo file. */ if (domain->malloced) free (domain->malloced); #ifdef HAVE_MMAP if (use_mmap) munmap ((caddr_t) data, size); else #endif free (data); free (domain); domain_file->data = NULL; goto out; } /* No caches of converted translations so far. */ domain->conversions = NULL; domain->nconversions = 0; gl_rwlock_init (domain->conversions_lock); /* Get the header entry and look for a plural specification. */ #ifdef IN_LIBGLOCALE nullentry = _nl_find_msg (domain_file, domainbinding, NULL, "", &nullentrylen); #else nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen); #endif EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals); out: if (fd != -1) close (fd); domain_file->decided = 1; done: __libc_lock_unlock_recursive (lock); } #ifdef _LIBC void internal_function __libc_freeres_fn_section _nl_unload_domain (struct loaded_domain *domain) { size_t i; if (domain->plural != &__gettext_germanic_plural) __gettext_free_exp ((struct expression *) domain->plural); for (i = 0; i < domain->nconversions; i++) { struct converted_domain *convd = &domain->conversions[i]; free (convd->encoding); if (convd->conv_tab != NULL && convd->conv_tab != (char **) -1) free (convd->conv_tab); if (convd->conv != (__gconv_t) -1) __gconv_close (convd->conv); } if (domain->conversions != NULL) free (domain->conversions); __libc_rwlock_fini (domain->conversions_lock); if (domain->malloced) free (domain->malloced); # ifdef _POSIX_MAPPED_FILES if (domain->use_mmap) munmap ((caddr_t) domain->data, domain->mmap_size); else # endif /* _POSIX_MAPPED_FILES */ free ((void *) domain->data); free (domain); } #endif cadaver-0.23.3/lib/intl/lock.c0000644000076400007640000005413011312007552015433 0ustar jortonjorton/* Locking in multithreaded situations. Copyright (C) 2005-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, gthr-win32.h. */ #include #include "lock.h" /* ========================================================================= */ #if USE_POSIX_THREADS /* Use the POSIX threads library. */ # if PTHREAD_IN_USE_DETECTION_HARD /* The function to be executed by a dummy thread. */ static void * dummy_thread_func (void *arg) { return arg; } int glthread_in_use (void) { static int tested; static int result; /* 1: linked with -lpthread, 0: only with libc */ if (!tested) { pthread_t thread; if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0) /* Thread creation failed. */ result = 0; else { /* Thread creation works. */ void *retval; if (pthread_join (thread, &retval) != 0) abort (); result = 1; } tested = 1; } return result; } # endif /* -------------------------- gl_lock_t datatype -------------------------- */ /* ------------------------- gl_rwlock_t datatype ------------------------- */ # if HAVE_PTHREAD_RWLOCK # if !defined PTHREAD_RWLOCK_INITIALIZER void glthread_rwlock_init (gl_rwlock_t *lock) { if (pthread_rwlock_init (&lock->rwlock, NULL) != 0) abort (); lock->initialized = 1; } void glthread_rwlock_rdlock (gl_rwlock_t *lock) { if (!lock->initialized) { if (pthread_mutex_lock (&lock->guard) != 0) abort (); if (!lock->initialized) glthread_rwlock_init (lock); if (pthread_mutex_unlock (&lock->guard) != 0) abort (); } if (pthread_rwlock_rdlock (&lock->rwlock) != 0) abort (); } void glthread_rwlock_wrlock (gl_rwlock_t *lock) { if (!lock->initialized) { if (pthread_mutex_lock (&lock->guard) != 0) abort (); if (!lock->initialized) glthread_rwlock_init (lock); if (pthread_mutex_unlock (&lock->guard) != 0) abort (); } if (pthread_rwlock_wrlock (&lock->rwlock) != 0) abort (); } void glthread_rwlock_unlock (gl_rwlock_t *lock) { if (!lock->initialized) abort (); if (pthread_rwlock_unlock (&lock->rwlock) != 0) abort (); } void glthread_rwlock_destroy (gl_rwlock_t *lock) { if (!lock->initialized) abort (); if (pthread_rwlock_destroy (&lock->rwlock) != 0) abort (); lock->initialized = 0; } # endif # else void glthread_rwlock_init (gl_rwlock_t *lock) { if (pthread_mutex_init (&lock->lock, NULL) != 0) abort (); if (pthread_cond_init (&lock->waiting_readers, NULL) != 0) abort (); if (pthread_cond_init (&lock->waiting_writers, NULL) != 0) abort (); lock->waiting_writers_count = 0; lock->runcount = 0; } void glthread_rwlock_rdlock (gl_rwlock_t *lock) { if (pthread_mutex_lock (&lock->lock) != 0) abort (); /* Test whether only readers are currently running, and whether the runcount field will not overflow. */ /* POSIX says: "It is implementation-defined whether the calling thread acquires the lock when a writer does not hold the lock and there are writers blocked on the lock." Let's say, no: give the writers a higher priority. */ while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_readers. */ if (pthread_cond_wait (&lock->waiting_readers, &lock->lock) != 0) abort (); } lock->runcount++; if (pthread_mutex_unlock (&lock->lock) != 0) abort (); } void glthread_rwlock_wrlock (gl_rwlock_t *lock) { if (pthread_mutex_lock (&lock->lock) != 0) abort (); /* Test whether no readers or writers are currently running. */ while (!(lock->runcount == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_writers. */ lock->waiting_writers_count++; if (pthread_cond_wait (&lock->waiting_writers, &lock->lock) != 0) abort (); lock->waiting_writers_count--; } lock->runcount--; /* runcount becomes -1 */ if (pthread_mutex_unlock (&lock->lock) != 0) abort (); } void glthread_rwlock_unlock (gl_rwlock_t *lock) { if (pthread_mutex_lock (&lock->lock) != 0) abort (); if (lock->runcount < 0) { /* Drop a writer lock. */ if (!(lock->runcount == -1)) abort (); lock->runcount = 0; } else { /* Drop a reader lock. */ if (!(lock->runcount > 0)) abort (); lock->runcount--; } if (lock->runcount == 0) { /* POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ if (lock->waiting_writers_count > 0) { /* Wake up one of the waiting writers. */ if (pthread_cond_signal (&lock->waiting_writers) != 0) abort (); } else { /* Wake up all waiting readers. */ if (pthread_cond_broadcast (&lock->waiting_readers) != 0) abort (); } } if (pthread_mutex_unlock (&lock->lock) != 0) abort (); } void glthread_rwlock_destroy (gl_rwlock_t *lock) { if (pthread_mutex_destroy (&lock->lock) != 0) abort (); if (pthread_cond_destroy (&lock->waiting_readers) != 0) abort (); if (pthread_cond_destroy (&lock->waiting_writers) != 0) abort (); } # endif /* --------------------- gl_recursive_lock_t datatype --------------------- */ # if HAVE_PTHREAD_MUTEX_RECURSIVE # if !(defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) void glthread_recursive_lock_init (gl_recursive_lock_t *lock) { pthread_mutexattr_t attributes; if (pthread_mutexattr_init (&attributes) != 0) abort (); if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0) abort (); if (pthread_mutex_init (&lock->recmutex, &attributes) != 0) abort (); if (pthread_mutexattr_destroy (&attributes) != 0) abort (); lock->initialized = 1; } void glthread_recursive_lock_lock (gl_recursive_lock_t *lock) { if (!lock->initialized) { if (pthread_mutex_lock (&lock->guard) != 0) abort (); if (!lock->initialized) glthread_recursive_lock_init (lock); if (pthread_mutex_unlock (&lock->guard) != 0) abort (); } if (pthread_mutex_lock (&lock->recmutex) != 0) abort (); } void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock) { if (!lock->initialized) abort (); if (pthread_mutex_unlock (&lock->recmutex) != 0) abort (); } void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) { if (!lock->initialized) abort (); if (pthread_mutex_destroy (&lock->recmutex) != 0) abort (); lock->initialized = 0; } # endif # else void glthread_recursive_lock_init (gl_recursive_lock_t *lock) { if (pthread_mutex_init (&lock->mutex, NULL) != 0) abort (); lock->owner = (pthread_t) 0; lock->depth = 0; } void glthread_recursive_lock_lock (gl_recursive_lock_t *lock) { pthread_t self = pthread_self (); if (lock->owner != self) { if (pthread_mutex_lock (&lock->mutex) != 0) abort (); lock->owner = self; } if (++(lock->depth) == 0) /* wraparound? */ abort (); } void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock) { if (lock->owner != pthread_self ()) abort (); if (lock->depth == 0) abort (); if (--(lock->depth) == 0) { lock->owner = (pthread_t) 0; if (pthread_mutex_unlock (&lock->mutex) != 0) abort (); } } void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) { if (lock->owner != (pthread_t) 0) abort (); if (pthread_mutex_destroy (&lock->mutex) != 0) abort (); } # endif /* -------------------------- gl_once_t datatype -------------------------- */ static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT; int glthread_once_singlethreaded (pthread_once_t *once_control) { /* We don't know whether pthread_once_t is an integer type, a floating-point type, a pointer type, or a structure type. */ char *firstbyte = (char *)once_control; if (*firstbyte == *(const char *)&fresh_once) { /* First time use of once_control. Invert the first byte. */ *firstbyte = ~ *(const char *)&fresh_once; return 1; } else return 0; } #endif /* ========================================================================= */ #if USE_PTH_THREADS /* Use the GNU Pth threads library. */ /* -------------------------- gl_lock_t datatype -------------------------- */ /* ------------------------- gl_rwlock_t datatype ------------------------- */ /* --------------------- gl_recursive_lock_t datatype --------------------- */ /* -------------------------- gl_once_t datatype -------------------------- */ void glthread_once_call (void *arg) { void (**gl_once_temp_addr) (void) = (void (**) (void)) arg; void (*initfunction) (void) = *gl_once_temp_addr; initfunction (); } int glthread_once_singlethreaded (pth_once_t *once_control) { /* We know that pth_once_t is an integer type. */ if (*once_control == PTH_ONCE_INIT) { /* First time use of once_control. Invert the marker. */ *once_control = ~ PTH_ONCE_INIT; return 1; } else return 0; } #endif /* ========================================================================= */ #if USE_SOLARIS_THREADS /* Use the old Solaris threads library. */ /* -------------------------- gl_lock_t datatype -------------------------- */ /* ------------------------- gl_rwlock_t datatype ------------------------- */ /* --------------------- gl_recursive_lock_t datatype --------------------- */ void glthread_recursive_lock_init (gl_recursive_lock_t *lock) { if (mutex_init (&lock->mutex, USYNC_THREAD, NULL) != 0) abort (); lock->owner = (thread_t) 0; lock->depth = 0; } void glthread_recursive_lock_lock (gl_recursive_lock_t *lock) { thread_t self = thr_self (); if (lock->owner != self) { if (mutex_lock (&lock->mutex) != 0) abort (); lock->owner = self; } if (++(lock->depth) == 0) /* wraparound? */ abort (); } void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock) { if (lock->owner != thr_self ()) abort (); if (lock->depth == 0) abort (); if (--(lock->depth) == 0) { lock->owner = (thread_t) 0; if (mutex_unlock (&lock->mutex) != 0) abort (); } } void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) { if (lock->owner != (thread_t) 0) abort (); if (mutex_destroy (&lock->mutex) != 0) abort (); } /* -------------------------- gl_once_t datatype -------------------------- */ void glthread_once (gl_once_t *once_control, void (*initfunction) (void)) { if (!once_control->inited) { /* Use the mutex to guarantee that if another thread is already calling the initfunction, this thread waits until it's finished. */ if (mutex_lock (&once_control->mutex) != 0) abort (); if (!once_control->inited) { once_control->inited = 1; initfunction (); } if (mutex_unlock (&once_control->mutex) != 0) abort (); } } int glthread_once_singlethreaded (gl_once_t *once_control) { /* We know that gl_once_t contains an integer type. */ if (!once_control->inited) { /* First time use of once_control. Invert the marker. */ once_control->inited = ~ 0; return 1; } else return 0; } #endif /* ========================================================================= */ #if USE_WIN32_THREADS /* -------------------------- gl_lock_t datatype -------------------------- */ void glthread_lock_init (gl_lock_t *lock) { InitializeCriticalSection (&lock->lock); lock->guard.done = 1; } void glthread_lock_lock (gl_lock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glthread_lock_init (lock); else /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } EnterCriticalSection (&lock->lock); } void glthread_lock_unlock (gl_lock_t *lock) { if (!lock->guard.done) abort (); LeaveCriticalSection (&lock->lock); } void glthread_lock_destroy (gl_lock_t *lock) { if (!lock->guard.done) abort (); DeleteCriticalSection (&lock->lock); lock->guard.done = 0; } /* ------------------------- gl_rwlock_t datatype ------------------------- */ static inline void gl_waitqueue_init (gl_waitqueue_t *wq) { wq->array = NULL; wq->count = 0; wq->alloc = 0; wq->offset = 0; } /* Enqueues the current thread, represented by an event, in a wait queue. Returns INVALID_HANDLE_VALUE if an allocation failure occurs. */ static HANDLE gl_waitqueue_add (gl_waitqueue_t *wq) { HANDLE event; unsigned int index; if (wq->count == wq->alloc) { unsigned int new_alloc = 2 * wq->alloc + 1; HANDLE *new_array = (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE)); if (new_array == NULL) /* No more memory. */ return INVALID_HANDLE_VALUE; /* Now is a good opportunity to rotate the array so that its contents starts at offset 0. */ if (wq->offset > 0) { unsigned int old_count = wq->count; unsigned int old_alloc = wq->alloc; unsigned int old_offset = wq->offset; unsigned int i; if (old_offset + old_count > old_alloc) { unsigned int limit = old_offset + old_count - old_alloc; for (i = 0; i < limit; i++) new_array[old_alloc + i] = new_array[i]; } for (i = 0; i < old_count; i++) new_array[i] = new_array[old_offset + i]; wq->offset = 0; } wq->array = new_array; wq->alloc = new_alloc; } event = CreateEvent (NULL, TRUE, FALSE, NULL); if (event == INVALID_HANDLE_VALUE) /* No way to allocate an event. */ return INVALID_HANDLE_VALUE; index = wq->offset + wq->count; if (index >= wq->alloc) index -= wq->alloc; wq->array[index] = event; wq->count++; return event; } /* Notifies the first thread from a wait queue and dequeues it. */ static inline void gl_waitqueue_notify_first (gl_waitqueue_t *wq) { SetEvent (wq->array[wq->offset + 0]); wq->offset++; wq->count--; if (wq->count == 0 || wq->offset == wq->alloc) wq->offset = 0; } /* Notifies all threads from a wait queue and dequeues them all. */ static inline void gl_waitqueue_notify_all (gl_waitqueue_t *wq) { unsigned int i; for (i = 0; i < wq->count; i++) { unsigned int index = wq->offset + i; if (index >= wq->alloc) index -= wq->alloc; SetEvent (wq->array[index]); } wq->count = 0; wq->offset = 0; } void glthread_rwlock_init (gl_rwlock_t *lock) { InitializeCriticalSection (&lock->lock); gl_waitqueue_init (&lock->waiting_readers); gl_waitqueue_init (&lock->waiting_writers); lock->runcount = 0; lock->guard.done = 1; } void glthread_rwlock_rdlock (gl_rwlock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glthread_rwlock_init (lock); else /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } EnterCriticalSection (&lock->lock); /* Test whether only readers are currently running, and whether the runcount field will not overflow. */ if (!(lock->runcount + 1 > 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_readers. */ HANDLE event = gl_waitqueue_add (&lock->waiting_readers); if (event != INVALID_HANDLE_VALUE) { DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); /* The thread which signalled the event already did the bookkeeping: removed us from the waiting_readers, incremented lock->runcount. */ if (!(lock->runcount > 0)) abort (); return; } else { /* Allocation failure. Weird. */ do { LeaveCriticalSection (&lock->lock); Sleep (1); EnterCriticalSection (&lock->lock); } while (!(lock->runcount + 1 > 0)); } } lock->runcount++; LeaveCriticalSection (&lock->lock); } void glthread_rwlock_wrlock (gl_rwlock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glthread_rwlock_init (lock); else /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } EnterCriticalSection (&lock->lock); /* Test whether no readers or writers are currently running. */ if (!(lock->runcount == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_writers. */ HANDLE event = gl_waitqueue_add (&lock->waiting_writers); if (event != INVALID_HANDLE_VALUE) { DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); /* The thread which signalled the event already did the bookkeeping: removed us from the waiting_writers, set lock->runcount = -1. */ if (!(lock->runcount == -1)) abort (); return; } else { /* Allocation failure. Weird. */ do { LeaveCriticalSection (&lock->lock); Sleep (1); EnterCriticalSection (&lock->lock); } while (!(lock->runcount == 0)); } } lock->runcount--; /* runcount becomes -1 */ LeaveCriticalSection (&lock->lock); } void glthread_rwlock_unlock (gl_rwlock_t *lock) { if (!lock->guard.done) abort (); EnterCriticalSection (&lock->lock); if (lock->runcount < 0) { /* Drop a writer lock. */ if (!(lock->runcount == -1)) abort (); lock->runcount = 0; } else { /* Drop a reader lock. */ if (!(lock->runcount > 0)) abort (); lock->runcount--; } if (lock->runcount == 0) { /* POSIX recommends that "write locks shall take precedence over read locks", to avoid "writer starvation". */ if (lock->waiting_writers.count > 0) { /* Wake up one of the waiting writers. */ lock->runcount--; gl_waitqueue_notify_first (&lock->waiting_writers); } else { /* Wake up all waiting readers. */ lock->runcount += lock->waiting_readers.count; gl_waitqueue_notify_all (&lock->waiting_readers); } } LeaveCriticalSection (&lock->lock); } void glthread_rwlock_destroy (gl_rwlock_t *lock) { if (!lock->guard.done) abort (); if (lock->runcount != 0) abort (); DeleteCriticalSection (&lock->lock); if (lock->waiting_readers.array != NULL) free (lock->waiting_readers.array); if (lock->waiting_writers.array != NULL) free (lock->waiting_writers.array); lock->guard.done = 0; } /* --------------------- gl_recursive_lock_t datatype --------------------- */ void glthread_recursive_lock_init (gl_recursive_lock_t *lock) { lock->owner = 0; lock->depth = 0; InitializeCriticalSection (&lock->lock); lock->guard.done = 1; } void glthread_recursive_lock_lock (gl_recursive_lock_t *lock) { if (!lock->guard.done) { if (InterlockedIncrement (&lock->guard.started) == 0) /* This thread is the first one to need this lock. Initialize it. */ glthread_recursive_lock_init (lock); else /* Yield the CPU while waiting for another thread to finish initializing this lock. */ while (!lock->guard.done) Sleep (0); } { DWORD self = GetCurrentThreadId (); if (lock->owner != self) { EnterCriticalSection (&lock->lock); lock->owner = self; } if (++(lock->depth) == 0) /* wraparound? */ abort (); } } void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock) { if (lock->owner != GetCurrentThreadId ()) abort (); if (lock->depth == 0) abort (); if (--(lock->depth) == 0) { lock->owner = 0; LeaveCriticalSection (&lock->lock); } } void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) { if (lock->owner != 0) abort (); DeleteCriticalSection (&lock->lock); lock->guard.done = 0; } /* -------------------------- gl_once_t datatype -------------------------- */ void glthread_once (gl_once_t *once_control, void (*initfunction) (void)) { if (once_control->inited <= 0) { if (InterlockedIncrement (&once_control->started) == 0) { /* This thread is the first one to come to this once_control. */ InitializeCriticalSection (&once_control->lock); EnterCriticalSection (&once_control->lock); once_control->inited = 0; initfunction (); once_control->inited = 1; LeaveCriticalSection (&once_control->lock); } else { /* Undo last operation. */ InterlockedDecrement (&once_control->started); /* Some other thread has already started the initialization. Yield the CPU while waiting for the other thread to finish initializing and taking the lock. */ while (once_control->inited < 0) Sleep (0); if (once_control->inited <= 0) { /* Take the lock. This blocks until the other thread has finished calling the initfunction. */ EnterCriticalSection (&once_control->lock); LeaveCriticalSection (&once_control->lock); if (!(once_control->inited > 0)) abort (); } } } } #endif /* ========================================================================= */ cadaver-0.23.3/lib/intl/COPYING.LIB-2.00000644000076400007640000006131311312007552016275 0ustar jortonjorton GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! cadaver-0.23.3/lib/intl/dgettext.c0000644000076400007640000000337111312007552016334 0ustar jortonjorton/* Implementation of the dgettext(3) function. Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include "gettextP.h" #include #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* @@ end of prolog @@ */ /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define DGETTEXT __dgettext # define DCGETTEXT INTUSE(__dcgettext) #else # define DGETTEXT libintl_dgettext # define DCGETTEXT libintl_dcgettext #endif /* Look up MSGID in the DOMAINNAME message catalog of the current LC_MESSAGES locale. */ char * DGETTEXT (const char *domainname, const char *msgid) { return DCGETTEXT (domainname, msgid, LC_MESSAGES); } #ifdef _LIBC /* Alias for function name in GNU C Library. */ weak_alias (__dgettext, dgettext); #endif cadaver-0.23.3/lib/intl/localename.c0000644000076400007640000012457111312007552016612 0ustar jortonjorton/* Determine name of the currently selected locale. Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Ulrich Drepper , 1995. */ /* Win32 code written by Tor Lillqvist . */ /* MacOS X code written by Bruno Haible . */ #include /* Specification. */ #ifdef IN_LIBINTL # include "gettextP.h" #else # include "localename.h" #endif #include #include #if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE # include # include # if HAVE_CFLOCALECOPYCURRENT # include # elif HAVE_CFPREFERENCESCOPYAPPVALUE # include # endif #endif #if defined _WIN32 || defined __WIN32__ # define WIN32_NATIVE #endif #ifdef WIN32_NATIVE # define WIN32_LEAN_AND_MEAN # include /* List of language codes, sorted by value: 0x01 LANG_ARABIC 0x02 LANG_BULGARIAN 0x03 LANG_CATALAN 0x04 LANG_CHINESE 0x05 LANG_CZECH 0x06 LANG_DANISH 0x07 LANG_GERMAN 0x08 LANG_GREEK 0x09 LANG_ENGLISH 0x0a LANG_SPANISH 0x0b LANG_FINNISH 0x0c LANG_FRENCH 0x0d LANG_HEBREW 0x0e LANG_HUNGARIAN 0x0f LANG_ICELANDIC 0x10 LANG_ITALIAN 0x11 LANG_JAPANESE 0x12 LANG_KOREAN 0x13 LANG_DUTCH 0x14 LANG_NORWEGIAN 0x15 LANG_POLISH 0x16 LANG_PORTUGUESE 0x17 LANG_RHAETO_ROMANCE 0x18 LANG_ROMANIAN 0x19 LANG_RUSSIAN 0x1a LANG_CROATIAN == LANG_SERBIAN 0x1b LANG_SLOVAK 0x1c LANG_ALBANIAN 0x1d LANG_SWEDISH 0x1e LANG_THAI 0x1f LANG_TURKISH 0x20 LANG_URDU 0x21 LANG_INDONESIAN 0x22 LANG_UKRAINIAN 0x23 LANG_BELARUSIAN 0x24 LANG_SLOVENIAN 0x25 LANG_ESTONIAN 0x26 LANG_LATVIAN 0x27 LANG_LITHUANIAN 0x28 LANG_TAJIK 0x29 LANG_FARSI 0x2a LANG_VIETNAMESE 0x2b LANG_ARMENIAN 0x2c LANG_AZERI 0x2d LANG_BASQUE 0x2e LANG_SORBIAN 0x2f LANG_MACEDONIAN 0x30 LANG_SUTU 0x31 LANG_TSONGA 0x32 LANG_TSWANA 0x33 LANG_VENDA 0x34 LANG_XHOSA 0x35 LANG_ZULU 0x36 LANG_AFRIKAANS 0x37 LANG_GEORGIAN 0x38 LANG_FAEROESE 0x39 LANG_HINDI 0x3a LANG_MALTESE 0x3b LANG_SAAMI 0x3c LANG_GAELIC 0x3d LANG_YIDDISH 0x3e LANG_MALAY 0x3f LANG_KAZAK 0x40 LANG_KYRGYZ 0x41 LANG_SWAHILI 0x42 LANG_TURKMEN 0x43 LANG_UZBEK 0x44 LANG_TATAR 0x45 LANG_BENGALI 0x46 LANG_PUNJABI 0x47 LANG_GUJARATI 0x48 LANG_ORIYA 0x49 LANG_TAMIL 0x4a LANG_TELUGU 0x4b LANG_KANNADA 0x4c LANG_MALAYALAM 0x4d LANG_ASSAMESE 0x4e LANG_MARATHI 0x4f LANG_SANSKRIT 0x50 LANG_MONGOLIAN 0x51 LANG_TIBETAN 0x52 LANG_WELSH 0x53 LANG_CAMBODIAN 0x54 LANG_LAO 0x55 LANG_BURMESE 0x56 LANG_GALICIAN 0x57 LANG_KONKANI 0x58 LANG_MANIPURI 0x59 LANG_SINDHI 0x5a LANG_SYRIAC 0x5b LANG_SINHALESE 0x5c LANG_CHEROKEE 0x5d LANG_INUKTITUT 0x5e LANG_AMHARIC 0x5f LANG_TAMAZIGHT 0x60 LANG_KASHMIRI 0x61 LANG_NEPALI 0x62 LANG_FRISIAN 0x63 LANG_PASHTO 0x64 LANG_TAGALOG 0x65 LANG_DIVEHI 0x66 LANG_EDO 0x67 LANG_FULFULDE 0x68 LANG_HAUSA 0x69 LANG_IBIBIO 0x6a LANG_YORUBA 0x70 LANG_IGBO 0x71 LANG_KANURI 0x72 LANG_OROMO 0x73 LANG_TIGRINYA 0x74 LANG_GUARANI 0x75 LANG_HAWAIIAN 0x76 LANG_LATIN 0x77 LANG_SOMALI 0x78 LANG_YI 0x79 LANG_PAPIAMENTU */ /* Mingw headers don't have latest language and sublanguage codes. */ # ifndef LANG_AFRIKAANS # define LANG_AFRIKAANS 0x36 # endif # ifndef LANG_ALBANIAN # define LANG_ALBANIAN 0x1c # endif # ifndef LANG_AMHARIC # define LANG_AMHARIC 0x5e # endif # ifndef LANG_ARABIC # define LANG_ARABIC 0x01 # endif # ifndef LANG_ARMENIAN # define LANG_ARMENIAN 0x2b # endif # ifndef LANG_ASSAMESE # define LANG_ASSAMESE 0x4d # endif # ifndef LANG_AZERI # define LANG_AZERI 0x2c # endif # ifndef LANG_BASQUE # define LANG_BASQUE 0x2d # endif # ifndef LANG_BELARUSIAN # define LANG_BELARUSIAN 0x23 # endif # ifndef LANG_BENGALI # define LANG_BENGALI 0x45 # endif # ifndef LANG_BURMESE # define LANG_BURMESE 0x55 # endif # ifndef LANG_CAMBODIAN # define LANG_CAMBODIAN 0x53 # endif # ifndef LANG_CATALAN # define LANG_CATALAN 0x03 # endif # ifndef LANG_CHEROKEE # define LANG_CHEROKEE 0x5c # endif # ifndef LANG_DIVEHI # define LANG_DIVEHI 0x65 # endif # ifndef LANG_EDO # define LANG_EDO 0x66 # endif # ifndef LANG_ESTONIAN # define LANG_ESTONIAN 0x25 # endif # ifndef LANG_FAEROESE # define LANG_FAEROESE 0x38 # endif # ifndef LANG_FARSI # define LANG_FARSI 0x29 # endif # ifndef LANG_FRISIAN # define LANG_FRISIAN 0x62 # endif # ifndef LANG_FULFULDE # define LANG_FULFULDE 0x67 # endif # ifndef LANG_GAELIC # define LANG_GAELIC 0x3c # endif # ifndef LANG_GALICIAN # define LANG_GALICIAN 0x56 # endif # ifndef LANG_GEORGIAN # define LANG_GEORGIAN 0x37 # endif # ifndef LANG_GUARANI # define LANG_GUARANI 0x74 # endif # ifndef LANG_GUJARATI # define LANG_GUJARATI 0x47 # endif # ifndef LANG_HAUSA # define LANG_HAUSA 0x68 # endif # ifndef LANG_HAWAIIAN # define LANG_HAWAIIAN 0x75 # endif # ifndef LANG_HEBREW # define LANG_HEBREW 0x0d # endif # ifndef LANG_HINDI # define LANG_HINDI 0x39 # endif # ifndef LANG_IBIBIO # define LANG_IBIBIO 0x69 # endif # ifndef LANG_IGBO # define LANG_IGBO 0x70 # endif # ifndef LANG_INDONESIAN # define LANG_INDONESIAN 0x21 # endif # ifndef LANG_INUKTITUT # define LANG_INUKTITUT 0x5d # endif # ifndef LANG_KANNADA # define LANG_KANNADA 0x4b # endif # ifndef LANG_KANURI # define LANG_KANURI 0x71 # endif # ifndef LANG_KASHMIRI # define LANG_KASHMIRI 0x60 # endif # ifndef LANG_KAZAK # define LANG_KAZAK 0x3f # endif # ifndef LANG_KONKANI # define LANG_KONKANI 0x57 # endif # ifndef LANG_KYRGYZ # define LANG_KYRGYZ 0x40 # endif # ifndef LANG_LAO # define LANG_LAO 0x54 # endif # ifndef LANG_LATIN # define LANG_LATIN 0x76 # endif # ifndef LANG_LATVIAN # define LANG_LATVIAN 0x26 # endif # ifndef LANG_LITHUANIAN # define LANG_LITHUANIAN 0x27 # endif # ifndef LANG_MACEDONIAN # define LANG_MACEDONIAN 0x2f # endif # ifndef LANG_MALAY # define LANG_MALAY 0x3e # endif # ifndef LANG_MALAYALAM # define LANG_MALAYALAM 0x4c # endif # ifndef LANG_MALTESE # define LANG_MALTESE 0x3a # endif # ifndef LANG_MANIPURI # define LANG_MANIPURI 0x58 # endif # ifndef LANG_MARATHI # define LANG_MARATHI 0x4e # endif # ifndef LANG_MONGOLIAN # define LANG_MONGOLIAN 0x50 # endif # ifndef LANG_NEPALI # define LANG_NEPALI 0x61 # endif # ifndef LANG_ORIYA # define LANG_ORIYA 0x48 # endif # ifndef LANG_OROMO # define LANG_OROMO 0x72 # endif # ifndef LANG_PAPIAMENTU # define LANG_PAPIAMENTU 0x79 # endif # ifndef LANG_PASHTO # define LANG_PASHTO 0x63 # endif # ifndef LANG_PUNJABI # define LANG_PUNJABI 0x46 # endif # ifndef LANG_RHAETO_ROMANCE # define LANG_RHAETO_ROMANCE 0x17 # endif # ifndef LANG_SAAMI # define LANG_SAAMI 0x3b # endif # ifndef LANG_SANSKRIT # define LANG_SANSKRIT 0x4f # endif # ifndef LANG_SERBIAN # define LANG_SERBIAN 0x1a # endif # ifndef LANG_SINDHI # define LANG_SINDHI 0x59 # endif # ifndef LANG_SINHALESE # define LANG_SINHALESE 0x5b # endif # ifndef LANG_SLOVAK # define LANG_SLOVAK 0x1b # endif # ifndef LANG_SOMALI # define LANG_SOMALI 0x77 # endif # ifndef LANG_SORBIAN # define LANG_SORBIAN 0x2e # endif # ifndef LANG_SUTU # define LANG_SUTU 0x30 # endif # ifndef LANG_SWAHILI # define LANG_SWAHILI 0x41 # endif # ifndef LANG_SYRIAC # define LANG_SYRIAC 0x5a # endif # ifndef LANG_TAGALOG # define LANG_TAGALOG 0x64 # endif # ifndef LANG_TAJIK # define LANG_TAJIK 0x28 # endif # ifndef LANG_TAMAZIGHT # define LANG_TAMAZIGHT 0x5f # endif # ifndef LANG_TAMIL # define LANG_TAMIL 0x49 # endif # ifndef LANG_TATAR # define LANG_TATAR 0x44 # endif # ifndef LANG_TELUGU # define LANG_TELUGU 0x4a # endif # ifndef LANG_THAI # define LANG_THAI 0x1e # endif # ifndef LANG_TIBETAN # define LANG_TIBETAN 0x51 # endif # ifndef LANG_TIGRINYA # define LANG_TIGRINYA 0x73 # endif # ifndef LANG_TSONGA # define LANG_TSONGA 0x31 # endif # ifndef LANG_TSWANA # define LANG_TSWANA 0x32 # endif # ifndef LANG_TURKMEN # define LANG_TURKMEN 0x42 # endif # ifndef LANG_UKRAINIAN # define LANG_UKRAINIAN 0x22 # endif # ifndef LANG_URDU # define LANG_URDU 0x20 # endif # ifndef LANG_UZBEK # define LANG_UZBEK 0x43 # endif # ifndef LANG_VENDA # define LANG_VENDA 0x33 # endif # ifndef LANG_VIETNAMESE # define LANG_VIETNAMESE 0x2a # endif # ifndef LANG_WELSH # define LANG_WELSH 0x52 # endif # ifndef LANG_XHOSA # define LANG_XHOSA 0x34 # endif # ifndef LANG_YI # define LANG_YI 0x78 # endif # ifndef LANG_YIDDISH # define LANG_YIDDISH 0x3d # endif # ifndef LANG_YORUBA # define LANG_YORUBA 0x6a # endif # ifndef LANG_ZULU # define LANG_ZULU 0x35 # endif # ifndef SUBLANG_ARABIC_SAUDI_ARABIA # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 # endif # ifndef SUBLANG_ARABIC_IRAQ # define SUBLANG_ARABIC_IRAQ 0x02 # endif # ifndef SUBLANG_ARABIC_EGYPT # define SUBLANG_ARABIC_EGYPT 0x03 # endif # ifndef SUBLANG_ARABIC_LIBYA # define SUBLANG_ARABIC_LIBYA 0x04 # endif # ifndef SUBLANG_ARABIC_ALGERIA # define SUBLANG_ARABIC_ALGERIA 0x05 # endif # ifndef SUBLANG_ARABIC_MOROCCO # define SUBLANG_ARABIC_MOROCCO 0x06 # endif # ifndef SUBLANG_ARABIC_TUNISIA # define SUBLANG_ARABIC_TUNISIA 0x07 # endif # ifndef SUBLANG_ARABIC_OMAN # define SUBLANG_ARABIC_OMAN 0x08 # endif # ifndef SUBLANG_ARABIC_YEMEN # define SUBLANG_ARABIC_YEMEN 0x09 # endif # ifndef SUBLANG_ARABIC_SYRIA # define SUBLANG_ARABIC_SYRIA 0x0a # endif # ifndef SUBLANG_ARABIC_JORDAN # define SUBLANG_ARABIC_JORDAN 0x0b # endif # ifndef SUBLANG_ARABIC_LEBANON # define SUBLANG_ARABIC_LEBANON 0x0c # endif # ifndef SUBLANG_ARABIC_KUWAIT # define SUBLANG_ARABIC_KUWAIT 0x0d # endif # ifndef SUBLANG_ARABIC_UAE # define SUBLANG_ARABIC_UAE 0x0e # endif # ifndef SUBLANG_ARABIC_BAHRAIN # define SUBLANG_ARABIC_BAHRAIN 0x0f # endif # ifndef SUBLANG_ARABIC_QATAR # define SUBLANG_ARABIC_QATAR 0x10 # endif # ifndef SUBLANG_AZERI_LATIN # define SUBLANG_AZERI_LATIN 0x01 # endif # ifndef SUBLANG_AZERI_CYRILLIC # define SUBLANG_AZERI_CYRILLIC 0x02 # endif # ifndef SUBLANG_BENGALI_INDIA # define SUBLANG_BENGALI_INDIA 0x01 # endif # ifndef SUBLANG_BENGALI_BANGLADESH # define SUBLANG_BENGALI_BANGLADESH 0x02 # endif # ifndef SUBLANG_CHINESE_MACAU # define SUBLANG_CHINESE_MACAU 0x05 # endif # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 # endif # ifndef SUBLANG_ENGLISH_JAMAICA # define SUBLANG_ENGLISH_JAMAICA 0x08 # endif # ifndef SUBLANG_ENGLISH_CARIBBEAN # define SUBLANG_ENGLISH_CARIBBEAN 0x09 # endif # ifndef SUBLANG_ENGLISH_BELIZE # define SUBLANG_ENGLISH_BELIZE 0x0a # endif # ifndef SUBLANG_ENGLISH_TRINIDAD # define SUBLANG_ENGLISH_TRINIDAD 0x0b # endif # ifndef SUBLANG_ENGLISH_ZIMBABWE # define SUBLANG_ENGLISH_ZIMBABWE 0x0c # endif # ifndef SUBLANG_ENGLISH_PHILIPPINES # define SUBLANG_ENGLISH_PHILIPPINES 0x0d # endif # ifndef SUBLANG_ENGLISH_INDONESIA # define SUBLANG_ENGLISH_INDONESIA 0x0e # endif # ifndef SUBLANG_ENGLISH_HONGKONG # define SUBLANG_ENGLISH_HONGKONG 0x0f # endif # ifndef SUBLANG_ENGLISH_INDIA # define SUBLANG_ENGLISH_INDIA 0x10 # endif # ifndef SUBLANG_ENGLISH_MALAYSIA # define SUBLANG_ENGLISH_MALAYSIA 0x11 # endif # ifndef SUBLANG_ENGLISH_SINGAPORE # define SUBLANG_ENGLISH_SINGAPORE 0x12 # endif # ifndef SUBLANG_FRENCH_LUXEMBOURG # define SUBLANG_FRENCH_LUXEMBOURG 0x05 # endif # ifndef SUBLANG_FRENCH_MONACO # define SUBLANG_FRENCH_MONACO 0x06 # endif # ifndef SUBLANG_FRENCH_WESTINDIES # define SUBLANG_FRENCH_WESTINDIES 0x07 # endif # ifndef SUBLANG_FRENCH_REUNION # define SUBLANG_FRENCH_REUNION 0x08 # endif # ifndef SUBLANG_FRENCH_CONGO # define SUBLANG_FRENCH_CONGO 0x09 # endif # ifndef SUBLANG_FRENCH_SENEGAL # define SUBLANG_FRENCH_SENEGAL 0x0a # endif # ifndef SUBLANG_FRENCH_CAMEROON # define SUBLANG_FRENCH_CAMEROON 0x0b # endif # ifndef SUBLANG_FRENCH_COTEDIVOIRE # define SUBLANG_FRENCH_COTEDIVOIRE 0x0c # endif # ifndef SUBLANG_FRENCH_MALI # define SUBLANG_FRENCH_MALI 0x0d # endif # ifndef SUBLANG_FRENCH_MOROCCO # define SUBLANG_FRENCH_MOROCCO 0x0e # endif # ifndef SUBLANG_FRENCH_HAITI # define SUBLANG_FRENCH_HAITI 0x0f # endif # ifndef SUBLANG_GERMAN_LUXEMBOURG # define SUBLANG_GERMAN_LUXEMBOURG 0x04 # endif # ifndef SUBLANG_GERMAN_LIECHTENSTEIN # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 # endif # ifndef SUBLANG_KASHMIRI_INDIA # define SUBLANG_KASHMIRI_INDIA 0x02 # endif # ifndef SUBLANG_MALAY_MALAYSIA # define SUBLANG_MALAY_MALAYSIA 0x01 # endif # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 # endif # ifndef SUBLANG_NEPALI_INDIA # define SUBLANG_NEPALI_INDIA 0x02 # endif # ifndef SUBLANG_PUNJABI_INDIA # define SUBLANG_PUNJABI_INDIA 0x01 # endif # ifndef SUBLANG_PUNJABI_PAKISTAN # define SUBLANG_PUNJABI_PAKISTAN 0x02 # endif # ifndef SUBLANG_ROMANIAN_ROMANIA # define SUBLANG_ROMANIAN_ROMANIA 0x01 # endif # ifndef SUBLANG_ROMANIAN_MOLDOVA # define SUBLANG_ROMANIAN_MOLDOVA 0x02 # endif # ifndef SUBLANG_SERBIAN_LATIN # define SUBLANG_SERBIAN_LATIN 0x02 # endif # ifndef SUBLANG_SERBIAN_CYRILLIC # define SUBLANG_SERBIAN_CYRILLIC 0x03 # endif # ifndef SUBLANG_SINDHI_PAKISTAN # define SUBLANG_SINDHI_PAKISTAN 0x01 # endif # ifndef SUBLANG_SINDHI_AFGHANISTAN # define SUBLANG_SINDHI_AFGHANISTAN 0x02 # endif # ifndef SUBLANG_SPANISH_GUATEMALA # define SUBLANG_SPANISH_GUATEMALA 0x04 # endif # ifndef SUBLANG_SPANISH_COSTA_RICA # define SUBLANG_SPANISH_COSTA_RICA 0x05 # endif # ifndef SUBLANG_SPANISH_PANAMA # define SUBLANG_SPANISH_PANAMA 0x06 # endif # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 # endif # ifndef SUBLANG_SPANISH_VENEZUELA # define SUBLANG_SPANISH_VENEZUELA 0x08 # endif # ifndef SUBLANG_SPANISH_COLOMBIA # define SUBLANG_SPANISH_COLOMBIA 0x09 # endif # ifndef SUBLANG_SPANISH_PERU # define SUBLANG_SPANISH_PERU 0x0a # endif # ifndef SUBLANG_SPANISH_ARGENTINA # define SUBLANG_SPANISH_ARGENTINA 0x0b # endif # ifndef SUBLANG_SPANISH_ECUADOR # define SUBLANG_SPANISH_ECUADOR 0x0c # endif # ifndef SUBLANG_SPANISH_CHILE # define SUBLANG_SPANISH_CHILE 0x0d # endif # ifndef SUBLANG_SPANISH_URUGUAY # define SUBLANG_SPANISH_URUGUAY 0x0e # endif # ifndef SUBLANG_SPANISH_PARAGUAY # define SUBLANG_SPANISH_PARAGUAY 0x0f # endif # ifndef SUBLANG_SPANISH_BOLIVIA # define SUBLANG_SPANISH_BOLIVIA 0x10 # endif # ifndef SUBLANG_SPANISH_EL_SALVADOR # define SUBLANG_SPANISH_EL_SALVADOR 0x11 # endif # ifndef SUBLANG_SPANISH_HONDURAS # define SUBLANG_SPANISH_HONDURAS 0x12 # endif # ifndef SUBLANG_SPANISH_NICARAGUA # define SUBLANG_SPANISH_NICARAGUA 0x13 # endif # ifndef SUBLANG_SPANISH_PUERTO_RICO # define SUBLANG_SPANISH_PUERTO_RICO 0x14 # endif # ifndef SUBLANG_SWEDISH_FINLAND # define SUBLANG_SWEDISH_FINLAND 0x02 # endif # ifndef SUBLANG_TAMAZIGHT_ARABIC # define SUBLANG_TAMAZIGHT_ARABIC 0x01 # endif # ifndef SUBLANG_TAMAZIGHT_ALGERIA_LATIN # define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02 # endif # ifndef SUBLANG_TIGRINYA_ETHIOPIA # define SUBLANG_TIGRINYA_ETHIOPIA 0x01 # endif # ifndef SUBLANG_TIGRINYA_ERITREA # define SUBLANG_TIGRINYA_ERITREA 0x02 # endif # ifndef SUBLANG_URDU_PAKISTAN # define SUBLANG_URDU_PAKISTAN 0x01 # endif # ifndef SUBLANG_URDU_INDIA # define SUBLANG_URDU_INDIA 0x02 # endif # ifndef SUBLANG_UZBEK_LATIN # define SUBLANG_UZBEK_LATIN 0x01 # endif # ifndef SUBLANG_UZBEK_CYRILLIC # define SUBLANG_UZBEK_CYRILLIC 0x02 # endif #endif # if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ /* Canonicalize a MacOS X locale name to a Unix locale name. NAME is a sufficiently large buffer. On input, it contains the MacOS X locale name. On output, it contains the Unix locale name. */ # if !defined IN_LIBINTL static # endif void gl_locale_name_canonicalize (char *name) { /* This conversion is based on a posting by Deborah GoldSmith on 2005-03-08, http://lists.apple.com/archives/carbon-dev/2005/Mar/msg00293.html */ /* Convert legacy (NeXTstep inherited) English names to Unix (ISO 639 and ISO 3166) names. Prior to MacOS X 10.3, there is no API for doing this. Therefore we do it ourselves, using a table based on the results of the MacOS X 10.3.8 function CFLocaleCreateCanonicalLocaleIdentifierFromString(). */ typedef struct { const char legacy[21+1]; const char unixy[5+1]; } legacy_entry; static const legacy_entry legacy_table[] = { { "Afrikaans", "af" }, { "Albanian", "sq" }, { "Amharic", "am" }, { "Arabic", "ar" }, { "Armenian", "hy" }, { "Assamese", "as" }, { "Aymara", "ay" }, { "Azerbaijani", "az" }, { "Basque", "eu" }, { "Belarusian", "be" }, { "Belorussian", "be" }, { "Bengali", "bn" }, { "Brazilian Portugese", "pt_BR" }, { "Brazilian Portuguese", "pt_BR" }, { "Breton", "br" }, { "Bulgarian", "bg" }, { "Burmese", "my" }, { "Byelorussian", "be" }, { "Catalan", "ca" }, { "Chewa", "ny" }, { "Chichewa", "ny" }, { "Chinese", "zh" }, { "Chinese, Simplified", "zh_CN" }, { "Chinese, Traditional", "zh_TW" }, { "Chinese, Tradtional", "zh_TW" }, { "Croatian", "hr" }, { "Czech", "cs" }, { "Danish", "da" }, { "Dutch", "nl" }, { "Dzongkha", "dz" }, { "English", "en" }, { "Esperanto", "eo" }, { "Estonian", "et" }, { "Faroese", "fo" }, { "Farsi", "fa" }, { "Finnish", "fi" }, { "Flemish", "nl_BE" }, { "French", "fr" }, { "Galician", "gl" }, { "Gallegan", "gl" }, { "Georgian", "ka" }, { "German", "de" }, { "Greek", "el" }, { "Greenlandic", "kl" }, { "Guarani", "gn" }, { "Gujarati", "gu" }, { "Hawaiian", "haw" }, /* Yes, "haw", not "cpe". */ { "Hebrew", "he" }, { "Hindi", "hi" }, { "Hungarian", "hu" }, { "Icelandic", "is" }, { "Indonesian", "id" }, { "Inuktitut", "iu" }, { "Irish", "ga" }, { "Italian", "it" }, { "Japanese", "ja" }, { "Javanese", "jv" }, { "Kalaallisut", "kl" }, { "Kannada", "kn" }, { "Kashmiri", "ks" }, { "Kazakh", "kk" }, { "Khmer", "km" }, { "Kinyarwanda", "rw" }, { "Kirghiz", "ky" }, { "Korean", "ko" }, { "Kurdish", "ku" }, { "Latin", "la" }, { "Latvian", "lv" }, { "Lithuanian", "lt" }, { "Macedonian", "mk" }, { "Malagasy", "mg" }, { "Malay", "ms" }, { "Malayalam", "ml" }, { "Maltese", "mt" }, { "Manx", "gv" }, { "Marathi", "mr" }, { "Moldavian", "mo" }, { "Mongolian", "mn" }, { "Nepali", "ne" }, { "Norwegian", "nb" }, /* Yes, "nb", not the obsolete "no". */ { "Nyanja", "ny" }, { "Nynorsk", "nn" }, { "Oriya", "or" }, { "Oromo", "om" }, { "Panjabi", "pa" }, { "Pashto", "ps" }, { "Persian", "fa" }, { "Polish", "pl" }, { "Portuguese", "pt" }, { "Portuguese, Brazilian", "pt_BR" }, { "Punjabi", "pa" }, { "Pushto", "ps" }, { "Quechua", "qu" }, { "Romanian", "ro" }, { "Ruanda", "rw" }, { "Rundi", "rn" }, { "Russian", "ru" }, { "Sami", "se_NO" }, /* Not just "se". */ { "Sanskrit", "sa" }, { "Scottish", "gd" }, { "Serbian", "sr" }, { "Simplified Chinese", "zh_CN" }, { "Sindhi", "sd" }, { "Sinhalese", "si" }, { "Slovak", "sk" }, { "Slovenian", "sl" }, { "Somali", "so" }, { "Spanish", "es" }, { "Sundanese", "su" }, { "Swahili", "sw" }, { "Swedish", "sv" }, { "Tagalog", "tl" }, { "Tajik", "tg" }, { "Tajiki", "tg" }, { "Tamil", "ta" }, { "Tatar", "tt" }, { "Telugu", "te" }, { "Thai", "th" }, { "Tibetan", "bo" }, { "Tigrinya", "ti" }, { "Tongan", "to" }, { "Traditional Chinese", "zh_TW" }, { "Turkish", "tr" }, { "Turkmen", "tk" }, { "Uighur", "ug" }, { "Ukrainian", "uk" }, { "Urdu", "ur" }, { "Uzbek", "uz" }, { "Vietnamese", "vi" }, { "Welsh", "cy" }, { "Yiddish", "yi" } }; /* Convert new-style locale names with language tags (ISO 639 and ISO 15924) to Unix (ISO 639 and ISO 3166) names. */ typedef struct { const char langtag[7+1]; const char unixy[12+1]; } langtag_entry; static const langtag_entry langtag_table[] = { /* MacOS X has "az-Arab", "az-Cyrl", "az-Latn". The default script for az on Unix is Latin. */ { "az-Latn", "az" }, /* MacOS X has "ga-dots". Does not yet exist on Unix. */ { "ga-dots", "ga" }, /* MacOS X has "kk-Cyrl". Does not yet exist on Unix. */ /* MacOS X has "mn-Cyrl", "mn-Mong". The default script for mn on Unix is Cyrillic. */ { "mn-Cyrl", "mn" }, /* MacOS X has "ms-Arab", "ms-Latn". The default script for ms on Unix is Latin. */ { "ms-Latn", "ms" }, /* MacOS X has "tg-Cyrl". The default script for tg on Unix is Cyrillic. */ { "tg-Cyrl", "tg" }, /* MacOS X has "tk-Cyrl". Does not yet exist on Unix. */ /* MacOS X has "tt-Cyrl". The default script for tt on Unix is Cyrillic. */ { "tt-Cyrl", "tt" }, /* MacOS X has "zh-Hans", "zh-Hant". Country codes are used to distinguish these on Unix. */ { "zh-Hans", "zh_CN" }, { "zh-Hant", "zh_TW" } }; /* Convert script names (ISO 15924) to Unix conventions. See http://www.unicode.org/iso15924/iso15924-codes.html */ typedef struct { const char script[4+1]; const char unixy[9+1]; } script_entry; static const script_entry script_table[] = { { "Arab", "arabic" }, { "Cyrl", "cyrillic" }, { "Mong", "mongolian" } }; /* Step 1: Convert using legacy_table. */ if (name[0] >= 'A' && name[0] <= 'Z') { unsigned int i1, i2; i1 = 0; i2 = sizeof (legacy_table) / sizeof (legacy_entry); while (i2 - i1 > 1) { /* At this point we know that if name occurs in legacy_table, its index must be >= i1 and < i2. */ unsigned int i = (i1 + i2) >> 1; const legacy_entry *p = &legacy_table[i]; if (strcmp (name, p->legacy) < 0) i2 = i; else i1 = i; } if (strcmp (name, legacy_table[i1].legacy) == 0) { strcpy (name, legacy_table[i1].unixy); return; } } /* Step 2: Convert using langtag_table and script_table. */ if (strlen (name) == 7 && name[2] == '-') { unsigned int i1, i2; i1 = 0; i2 = sizeof (langtag_table) / sizeof (langtag_entry); while (i2 - i1 > 1) { /* At this point we know that if name occurs in langtag_table, its index must be >= i1 and < i2. */ unsigned int i = (i1 + i2) >> 1; const langtag_entry *p = &langtag_table[i]; if (strcmp (name, p->langtag) < 0) i2 = i; else i1 = i; } if (strcmp (name, langtag_table[i1].langtag) == 0) { strcpy (name, langtag_table[i1].unixy); return; } i1 = 0; i2 = sizeof (script_table) / sizeof (script_entry); while (i2 - i1 > 1) { /* At this point we know that if (name + 3) occurs in script_table, its index must be >= i1 and < i2. */ unsigned int i = (i1 + i2) >> 1; const script_entry *p = &script_table[i]; if (strcmp (name + 3, p->script) < 0) i2 = i; else i1 = i; } if (strcmp (name + 3, script_table[i1].script) == 0) { name[2] = '@'; strcpy (name + 3, script_table[i1].unixy); return; } } /* Step 3: Convert new-style dash to Unix underscore. */ { char *p; for (p = name; *p != '\0'; p++) if (*p == '-') *p = '_'; } } #endif /* XPG3 defines the result of 'setlocale (category, NULL)' as: "Directs 'setlocale()' to query 'category' and return the current setting of 'local'." However it does not specify the exact format. Neither do SUSV2 and ISO C 99. So we can use this feature only on selected systems (e.g. those using GNU C Library). */ #if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2) # define HAVE_LOCALE_NULL #endif /* Determine the current locale's name, and canonicalize it into XPG syntax language[_territory][.codeset][@modifier] The codeset part in the result is not reliable; the locale_charset() should be used for codeset information instead. The result must not be freed; it is statically allocated. */ const char * gl_locale_name_posix (int category, const char *categoryname) { /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'. On some systems this can be done by the 'setlocale' function itself. */ #if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL return setlocale (category, NULL); #else const char *retval; /* Setting of LC_ALL overrides all other. */ retval = getenv ("LC_ALL"); if (retval != NULL && retval[0] != '\0') return retval; /* Next comes the name of the desired category. */ retval = getenv (categoryname); if (retval != NULL && retval[0] != '\0') return retval; /* Last possibility is the LANG environment variable. */ retval = getenv ("LANG"); if (retval != NULL && retval[0] != '\0') return retval; return NULL; #endif } const char * gl_locale_name_default (void) { /* POSIX:2001 says: "All implementations shall define a locale as the default locale, to be invoked when no environment variables are set, or set to the empty string. This default locale can be the POSIX locale or any other implementation-defined locale. Some implementations may provide facilities for local installation administrators to set the default locale, customizing it for each location. POSIX:2001 does not require such a facility. */ #if !(HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE || defined(WIN32_NATIVE)) /* The system does not have a way of setting the locale, other than the POSIX specified environment variables. We use C as default locale. */ return "C"; #else /* Return an XPG style locale name language[_territory][@modifier]. Don't even bother determining the codeset; it's not useful in this context, because message catalogs are not specific to a single codeset. */ # if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ { /* Cache the locale name, since CoreFoundation calls are expensive. */ static const char *cached_localename; if (cached_localename == NULL) { char namebuf[256]; # if HAVE_CFLOCALECOPYCURRENT /* MacOS X 10.3 or newer */ CFLocaleRef locale = CFLocaleCopyCurrent (); CFStringRef name = CFLocaleGetIdentifier (locale); if (CFStringGetCString (name, namebuf, sizeof(namebuf), kCFStringEncodingASCII)) { gl_locale_name_canonicalize (namebuf); cached_localename = strdup (namebuf); } CFRelease (locale); # elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ CFTypeRef value = CFPreferencesCopyAppValue (CFSTR ("AppleLocale"), kCFPreferencesCurrentApplication); if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID () && CFStringGetCString ((CFStringRef)value, namebuf, sizeof(namebuf), kCFStringEncodingASCII)) { gl_locale_name_canonicalize (namebuf); cached_localename = strdup (namebuf); } # endif if (cached_localename == NULL) cached_localename = "C"; } return cached_localename; } # endif # if defined(WIN32_NATIVE) /* WIN32, not Cygwin */ { LCID lcid; LANGID langid; int primary, sub; /* Use native Win32 API locale ID. */ lcid = GetThreadLocale (); /* Strip off the sorting rules, keep only the language part. */ langid = LANGIDFROMLCID (lcid); /* Split into language and territory part. */ primary = PRIMARYLANGID (langid); sub = SUBLANGID (langid); /* Dispatch on language. See also http://www.unicode.org/unicode/onlinedat/languages.html . For details about languages, see http://www.ethnologue.com/ . */ switch (primary) { case LANG_AFRIKAANS: return "af_ZA"; case LANG_ALBANIAN: return "sq_AL"; case LANG_AMHARIC: return "am_ET"; case LANG_ARABIC: switch (sub) { case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA"; case SUBLANG_ARABIC_IRAQ: return "ar_IQ"; case SUBLANG_ARABIC_EGYPT: return "ar_EG"; case SUBLANG_ARABIC_LIBYA: return "ar_LY"; case SUBLANG_ARABIC_ALGERIA: return "ar_DZ"; case SUBLANG_ARABIC_MOROCCO: return "ar_MA"; case SUBLANG_ARABIC_TUNISIA: return "ar_TN"; case SUBLANG_ARABIC_OMAN: return "ar_OM"; case SUBLANG_ARABIC_YEMEN: return "ar_YE"; case SUBLANG_ARABIC_SYRIA: return "ar_SY"; case SUBLANG_ARABIC_JORDAN: return "ar_JO"; case SUBLANG_ARABIC_LEBANON: return "ar_LB"; case SUBLANG_ARABIC_KUWAIT: return "ar_KW"; case SUBLANG_ARABIC_UAE: return "ar_AE"; case SUBLANG_ARABIC_BAHRAIN: return "ar_BH"; case SUBLANG_ARABIC_QATAR: return "ar_QA"; } return "ar"; case LANG_ARMENIAN: return "hy_AM"; case LANG_ASSAMESE: return "as_IN"; case LANG_AZERI: switch (sub) { /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */ case SUBLANG_AZERI_LATIN: return "az_AZ@latin"; case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic"; } return "az"; case LANG_BASQUE: switch (sub) { case SUBLANG_DEFAULT: return "eu_ES"; } return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */ case LANG_BELARUSIAN: return "be_BY"; case LANG_BENGALI: switch (sub) { case SUBLANG_BENGALI_INDIA: return "bn_IN"; case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; } return "bn"; case LANG_BULGARIAN: return "bg_BG"; case LANG_BURMESE: return "my_MM"; case LANG_CAMBODIAN: return "km_KH"; case LANG_CATALAN: return "ca_ES"; case LANG_CHEROKEE: return "chr_US"; case LANG_CHINESE: switch (sub) { case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW"; case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN"; case SUBLANG_CHINESE_HONGKONG: return "zh_HK"; case SUBLANG_CHINESE_SINGAPORE: return "zh_SG"; case SUBLANG_CHINESE_MACAU: return "zh_MO"; } return "zh"; case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN * What used to be called Serbo-Croatian * should really now be two separate * languages because of political reasons. * (Says tml, who knows nothing about Serbian * or Croatian.) * (I can feel those flames coming already.) */ switch (sub) { case SUBLANG_DEFAULT: return "hr_HR"; case SUBLANG_SERBIAN_LATIN: return "sr_CS"; case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic"; } return "hr"; case LANG_CZECH: return "cs_CZ"; case LANG_DANISH: return "da_DK"; case LANG_DIVEHI: return "dv_MV"; case LANG_DUTCH: switch (sub) { case SUBLANG_DUTCH: return "nl_NL"; case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE"; } return "nl"; case LANG_EDO: return "bin_NG"; case LANG_ENGLISH: switch (sub) { /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought * English was the language spoken in England. * Oh well. */ case SUBLANG_ENGLISH_US: return "en_US"; case SUBLANG_ENGLISH_UK: return "en_GB"; case SUBLANG_ENGLISH_AUS: return "en_AU"; case SUBLANG_ENGLISH_CAN: return "en_CA"; case SUBLANG_ENGLISH_NZ: return "en_NZ"; case SUBLANG_ENGLISH_EIRE: return "en_IE"; case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA"; case SUBLANG_ENGLISH_JAMAICA: return "en_JM"; case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */ case SUBLANG_ENGLISH_BELIZE: return "en_BZ"; case SUBLANG_ENGLISH_TRINIDAD: return "en_TT"; case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW"; case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH"; case SUBLANG_ENGLISH_INDONESIA: return "en_ID"; case SUBLANG_ENGLISH_HONGKONG: return "en_HK"; case SUBLANG_ENGLISH_INDIA: return "en_IN"; case SUBLANG_ENGLISH_MALAYSIA: return "en_MY"; case SUBLANG_ENGLISH_SINGAPORE: return "en_SG"; } return "en"; case LANG_ESTONIAN: return "et_EE"; case LANG_FAEROESE: return "fo_FO"; case LANG_FARSI: return "fa_IR"; case LANG_FINNISH: return "fi_FI"; case LANG_FRENCH: switch (sub) { case SUBLANG_FRENCH: return "fr_FR"; case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE"; case SUBLANG_FRENCH_CANADIAN: return "fr_CA"; case SUBLANG_FRENCH_SWISS: return "fr_CH"; case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU"; case SUBLANG_FRENCH_MONACO: return "fr_MC"; case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */ case SUBLANG_FRENCH_REUNION: return "fr_RE"; case SUBLANG_FRENCH_CONGO: return "fr_CG"; case SUBLANG_FRENCH_SENEGAL: return "fr_SN"; case SUBLANG_FRENCH_CAMEROON: return "fr_CM"; case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI"; case SUBLANG_FRENCH_MALI: return "fr_ML"; case SUBLANG_FRENCH_MOROCCO: return "fr_MA"; case SUBLANG_FRENCH_HAITI: return "fr_HT"; } return "fr"; case LANG_FRISIAN: return "fy_NL"; case LANG_FULFULDE: /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */ return "ff_NG"; case LANG_GAELIC: switch (sub) { case 0x01: /* SCOTTISH */ return "gd_GB"; case 0x02: /* IRISH */ return "ga_IE"; } return "C"; case LANG_GALICIAN: return "gl_ES"; case LANG_GEORGIAN: return "ka_GE"; case LANG_GERMAN: switch (sub) { case SUBLANG_GERMAN: return "de_DE"; case SUBLANG_GERMAN_SWISS: return "de_CH"; case SUBLANG_GERMAN_AUSTRIAN: return "de_AT"; case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU"; case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI"; } return "de"; case LANG_GREEK: return "el_GR"; case LANG_GUARANI: return "gn_PY"; case LANG_GUJARATI: return "gu_IN"; case LANG_HAUSA: return "ha_NG"; case LANG_HAWAIIAN: /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers) or Hawaii Creole English ("cpe_US", 600000 speakers)? */ return "cpe_US"; case LANG_HEBREW: return "he_IL"; case LANG_HINDI: return "hi_IN"; case LANG_HUNGARIAN: return "hu_HU"; case LANG_IBIBIO: return "nic_NG"; case LANG_ICELANDIC: return "is_IS"; case LANG_IGBO: return "ig_NG"; case LANG_INDONESIAN: return "id_ID"; case LANG_INUKTITUT: return "iu_CA"; case LANG_ITALIAN: switch (sub) { case SUBLANG_ITALIAN: return "it_IT"; case SUBLANG_ITALIAN_SWISS: return "it_CH"; } return "it"; case LANG_JAPANESE: return "ja_JP"; case LANG_KANNADA: return "kn_IN"; case LANG_KANURI: return "kr_NG"; case LANG_KASHMIRI: switch (sub) { case SUBLANG_DEFAULT: return "ks_PK"; case SUBLANG_KASHMIRI_INDIA: return "ks_IN"; } return "ks"; case LANG_KAZAK: return "kk_KZ"; case LANG_KONKANI: /* FIXME: Adjust this when such locales appear on Unix. */ return "kok_IN"; case LANG_KOREAN: return "ko_KR"; case LANG_KYRGYZ: return "ky_KG"; case LANG_LAO: return "lo_LA"; case LANG_LATIN: return "la_VA"; case LANG_LATVIAN: return "lv_LV"; case LANG_LITHUANIAN: return "lt_LT"; case LANG_MACEDONIAN: return "mk_MK"; case LANG_MALAY: switch (sub) { case SUBLANG_MALAY_MALAYSIA: return "ms_MY"; case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN"; } return "ms"; case LANG_MALAYALAM: return "ml_IN"; case LANG_MALTESE: return "mt_MT"; case LANG_MANIPURI: /* FIXME: Adjust this when such locales appear on Unix. */ return "mni_IN"; case LANG_MARATHI: return "mr_IN"; case LANG_MONGOLIAN: switch (sub) { case SUBLANG_DEFAULT: return "mn_MN"; } return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */ case LANG_NEPALI: switch (sub) { case SUBLANG_DEFAULT: return "ne_NP"; case SUBLANG_NEPALI_INDIA: return "ne_IN"; } return "ne"; case LANG_NORWEGIAN: switch (sub) { case SUBLANG_NORWEGIAN_BOKMAL: return "nb_NO"; case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO"; } return "no"; case LANG_ORIYA: return "or_IN"; case LANG_OROMO: return "om_ET"; case LANG_PAPIAMENTU: return "pap_AN"; case LANG_PASHTO: return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */ case LANG_POLISH: return "pl_PL"; case LANG_PORTUGUESE: switch (sub) { case SUBLANG_PORTUGUESE: return "pt_PT"; /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT. Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */ case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR"; } return "pt"; case LANG_PUNJABI: switch (sub) { case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */ case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ } return "pa"; case LANG_RHAETO_ROMANCE: return "rm_CH"; case LANG_ROMANIAN: switch (sub) { case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO"; case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; } return "ro"; case LANG_RUSSIAN: switch (sub) { case SUBLANG_DEFAULT: return "ru_RU"; } return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */ case LANG_SAAMI: /* actually Northern Sami */ return "se_NO"; case LANG_SANSKRIT: return "sa_IN"; case LANG_SINDHI: switch (sub) { case SUBLANG_SINDHI_PAKISTAN: return "sd_PK"; case SUBLANG_SINDHI_AFGHANISTAN: return "sd_AF"; } return "sd"; case LANG_SINHALESE: return "si_LK"; case LANG_SLOVAK: return "sk_SK"; case LANG_SLOVENIAN: return "sl_SI"; case LANG_SOMALI: return "so_SO"; case LANG_SORBIAN: /* FIXME: Adjust this when such locales appear on Unix. */ return "wen_DE"; case LANG_SPANISH: switch (sub) { case SUBLANG_SPANISH: return "es_ES"; case SUBLANG_SPANISH_MEXICAN: return "es_MX"; case SUBLANG_SPANISH_MODERN: return "es_ES@modern"; /* not seen on Unix */ case SUBLANG_SPANISH_GUATEMALA: return "es_GT"; case SUBLANG_SPANISH_COSTA_RICA: return "es_CR"; case SUBLANG_SPANISH_PANAMA: return "es_PA"; case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO"; case SUBLANG_SPANISH_VENEZUELA: return "es_VE"; case SUBLANG_SPANISH_COLOMBIA: return "es_CO"; case SUBLANG_SPANISH_PERU: return "es_PE"; case SUBLANG_SPANISH_ARGENTINA: return "es_AR"; case SUBLANG_SPANISH_ECUADOR: return "es_EC"; case SUBLANG_SPANISH_CHILE: return "es_CL"; case SUBLANG_SPANISH_URUGUAY: return "es_UY"; case SUBLANG_SPANISH_PARAGUAY: return "es_PY"; case SUBLANG_SPANISH_BOLIVIA: return "es_BO"; case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV"; case SUBLANG_SPANISH_HONDURAS: return "es_HN"; case SUBLANG_SPANISH_NICARAGUA: return "es_NI"; case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR"; } return "es"; case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */ case LANG_SWAHILI: return "sw_KE"; case LANG_SWEDISH: switch (sub) { case SUBLANG_DEFAULT: return "sv_SE"; case SUBLANG_SWEDISH_FINLAND: return "sv_FI"; } return "sv"; case LANG_SYRIAC: return "syr_TR"; /* An extinct language. */ case LANG_TAGALOG: return "tl_PH"; case LANG_TAJIK: return "tg_TJ"; case LANG_TAMAZIGHT: switch (sub) { /* FIXME: Adjust this when Tamazight locales appear on Unix. */ case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic"; case SUBLANG_TAMAZIGHT_ALGERIA_LATIN: return "ber_DZ@latin"; } return "ber_MA"; case LANG_TAMIL: switch (sub) { case SUBLANG_DEFAULT: return "ta_IN"; } return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */ case LANG_TATAR: return "tt_RU"; case LANG_TELUGU: return "te_IN"; case LANG_THAI: return "th_TH"; case LANG_TIBETAN: return "bo_CN"; case LANG_TIGRINYA: switch (sub) { case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET"; case SUBLANG_TIGRINYA_ERITREA: return "ti_ER"; } return "ti"; case LANG_TSONGA: return "ts_ZA"; case LANG_TSWANA: return "tn_BW"; case LANG_TURKISH: return "tr_TR"; case LANG_TURKMEN: return "tk_TM"; case LANG_UKRAINIAN: return "uk_UA"; case LANG_URDU: switch (sub) { case SUBLANG_URDU_PAKISTAN: return "ur_PK"; case SUBLANG_URDU_INDIA: return "ur_IN"; } return "ur"; case LANG_UZBEK: switch (sub) { case SUBLANG_UZBEK_LATIN: return "uz_UZ"; case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic"; } return "uz"; case LANG_VENDA: return "ve_ZA"; case LANG_VIETNAMESE: return "vi_VN"; case LANG_WELSH: return "cy_GB"; case LANG_XHOSA: return "xh_ZA"; case LANG_YI: return "sit_CN"; case LANG_YIDDISH: return "yi_IL"; case LANG_YORUBA: return "yo_NG"; case LANG_ZULU: return "zu_ZA"; default: return "C"; } } # endif #endif } const char * gl_locale_name (int category, const char *categoryname) { const char *retval; retval = gl_locale_name_posix (category, categoryname); if (retval != NULL) return retval; return gl_locale_name_default (); } cadaver-0.23.3/lib/intl/plural-exp.h0000644000076400007640000001013111312007552016572 0ustar jortonjorton/* Expression parsing and evaluation for plural form selection. Copyright (C) 2000-2003, 2005-2007 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _PLURAL_EXP_H #define _PLURAL_EXP_H #ifndef internal_function # define internal_function #endif #ifndef attribute_hidden # define attribute_hidden #endif #ifdef __cplusplus extern "C" { #endif enum expression_operator { /* Without arguments: */ var, /* The variable "n". */ num, /* Decimal number. */ /* Unary operators: */ lnot, /* Logical NOT. */ /* Binary operators: */ mult, /* Multiplication. */ divide, /* Division. */ module, /* Modulo operation. */ plus, /* Addition. */ minus, /* Subtraction. */ less_than, /* Comparison. */ greater_than, /* Comparison. */ less_or_equal, /* Comparison. */ greater_or_equal, /* Comparison. */ equal, /* Comparison for equality. */ not_equal, /* Comparison for inequality. */ land, /* Logical AND. */ lor, /* Logical OR. */ /* Ternary operators: */ qmop /* Question mark operator. */ }; /* This is the representation of the expressions to determine the plural form. */ struct expression { int nargs; /* Number of arguments. */ enum expression_operator operation; union { unsigned long int num; /* Number value for `num'. */ struct expression *args[3]; /* Up to three arguments. */ } val; }; /* This is the data structure to pass information to the parser and get the result in a thread-safe way. */ struct parse_args { const char *cp; struct expression *res; }; /* Names for the libintl functions are a problem. This source code is used 1. in the GNU C Library library, 2. in the GNU libintl library, 3. in the GNU gettext tools. The function names in each situation must be different, to allow for binary incompatible changes in 'struct expression'. Furthermore, 1. in the GNU C Library library, the names have a __ prefix, 2.+3. in the GNU libintl library and in the GNU gettext tools, the names must follow ANSI C and not start with __. So we have to distinguish the three cases. */ #ifdef _LIBC # define FREE_EXPRESSION __gettext_free_exp # define PLURAL_PARSE __gettextparse # define GERMANIC_PLURAL __gettext_germanic_plural # define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural #elif defined (IN_LIBINTL) # define FREE_EXPRESSION libintl_gettext_free_exp # define PLURAL_PARSE libintl_gettextparse # define GERMANIC_PLURAL libintl_gettext_germanic_plural # define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural #else # define FREE_EXPRESSION free_plural_expression # define PLURAL_PARSE parse_plural_expression # define GERMANIC_PLURAL germanic_plural # define EXTRACT_PLURAL_EXPRESSION extract_plural_expression #endif extern void FREE_EXPRESSION (struct expression *exp) internal_function; extern int PLURAL_PARSE (void *arg); extern struct expression GERMANIC_PLURAL attribute_hidden; extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry, const struct expression **pluralp, unsigned long int *npluralsp) internal_function; #if !defined (_LIBC) && !defined (IN_LIBINTL) && !defined (IN_LIBGLOCALE) extern unsigned long int plural_eval (const struct expression *pexp, unsigned long int n); #endif #ifdef __cplusplus } #endif #endif /* _PLURAL_EXP_H */ cadaver-0.23.3/lib/intl/plural.y0000644000076400007640000001657611312007552016044 0ustar jortonjorton%{ /* Expression parsing for plural form selection. Copyright (C) 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us to put this declaration at the beginning of the file. The declaration in bison's skeleton file comes too late. This must come before because may include arbitrary system headers. This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */ #if defined _AIX && !defined __GNUC__ #pragma alloca #endif #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "plural-exp.h" /* The main function generated by the parser is called __gettextparse, but we want it to be called PLURAL_PARSE. */ #ifndef _LIBC # define __gettextparse PLURAL_PARSE #endif #define YYLEX_PARAM &((struct parse_args *) arg)->cp #define YYPARSE_PARAM arg %} %pure_parser %expect 7 %union { unsigned long int num; enum expression_operator op; struct expression *exp; } %{ /* Prototypes for local functions. */ static int yylex (YYSTYPE *lval, const char **pexp); static void yyerror (const char *str); /* Allocation of expressions. */ static struct expression * new_exp (int nargs, enum expression_operator op, struct expression * const *args) { int i; struct expression *newp; /* If any of the argument could not be malloc'ed, just return NULL. */ for (i = nargs - 1; i >= 0; i--) if (args[i] == NULL) goto fail; /* Allocate a new expression. */ newp = (struct expression *) malloc (sizeof (*newp)); if (newp != NULL) { newp->nargs = nargs; newp->operation = op; for (i = nargs - 1; i >= 0; i--) newp->val.args[i] = args[i]; return newp; } fail: for (i = nargs - 1; i >= 0; i--) FREE_EXPRESSION (args[i]); return NULL; } static inline struct expression * new_exp_0 (enum expression_operator op) { return new_exp (0, op, NULL); } static inline struct expression * new_exp_1 (enum expression_operator op, struct expression *right) { struct expression *args[1]; args[0] = right; return new_exp (1, op, args); } static struct expression * new_exp_2 (enum expression_operator op, struct expression *left, struct expression *right) { struct expression *args[2]; args[0] = left; args[1] = right; return new_exp (2, op, args); } static inline struct expression * new_exp_3 (enum expression_operator op, struct expression *bexp, struct expression *tbranch, struct expression *fbranch) { struct expression *args[3]; args[0] = bexp; args[1] = tbranch; args[2] = fbranch; return new_exp (3, op, args); } %} /* This declares that all operators have the same associativity and the precedence order as in C. See [Harbison, Steele: C, A Reference Manual]. There is no unary minus and no bitwise operators. Operators with the same syntactic behaviour have been merged into a single token, to save space in the array generated by bison. */ %right '?' /* ? */ %left '|' /* || */ %left '&' /* && */ %left EQUOP2 /* == != */ %left CMPOP2 /* < > <= >= */ %left ADDOP2 /* + - */ %left MULOP2 /* * / % */ %right '!' /* ! */ %token EQUOP2 CMPOP2 ADDOP2 MULOP2 %token NUMBER %type exp %% start: exp { if ($1 == NULL) YYABORT; ((struct parse_args *) arg)->res = $1; } ; exp: exp '?' exp ':' exp { $$ = new_exp_3 (qmop, $1, $3, $5); } | exp '|' exp { $$ = new_exp_2 (lor, $1, $3); } | exp '&' exp { $$ = new_exp_2 (land, $1, $3); } | exp EQUOP2 exp { $$ = new_exp_2 ($2, $1, $3); } | exp CMPOP2 exp { $$ = new_exp_2 ($2, $1, $3); } | exp ADDOP2 exp { $$ = new_exp_2 ($2, $1, $3); } | exp MULOP2 exp { $$ = new_exp_2 ($2, $1, $3); } | '!' exp { $$ = new_exp_1 (lnot, $2); } | 'n' { $$ = new_exp_0 (var); } | NUMBER { if (($$ = new_exp_0 (num)) != NULL) $$->val.num = $1; } | '(' exp ')' { $$ = $2; } ; %% void internal_function FREE_EXPRESSION (struct expression *exp) { if (exp == NULL) return; /* Handle the recursive case. */ switch (exp->nargs) { case 3: FREE_EXPRESSION (exp->val.args[2]); /* FALLTHROUGH */ case 2: FREE_EXPRESSION (exp->val.args[1]); /* FALLTHROUGH */ case 1: FREE_EXPRESSION (exp->val.args[0]); /* FALLTHROUGH */ default: break; } free (exp); } static int yylex (YYSTYPE *lval, const char **pexp) { const char *exp = *pexp; int result; while (1) { if (exp[0] == '\0') { *pexp = exp; return YYEOF; } if (exp[0] != ' ' && exp[0] != '\t') break; ++exp; } result = *exp++; switch (result) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { unsigned long int n = result - '0'; while (exp[0] >= '0' && exp[0] <= '9') { n *= 10; n += exp[0] - '0'; ++exp; } lval->num = n; result = NUMBER; } break; case '=': if (exp[0] == '=') { ++exp; lval->op = equal; result = EQUOP2; } else result = YYERRCODE; break; case '!': if (exp[0] == '=') { ++exp; lval->op = not_equal; result = EQUOP2; } break; case '&': case '|': if (exp[0] == result) ++exp; else result = YYERRCODE; break; case '<': if (exp[0] == '=') { ++exp; lval->op = less_or_equal; } else lval->op = less_than; result = CMPOP2; break; case '>': if (exp[0] == '=') { ++exp; lval->op = greater_or_equal; } else lval->op = greater_than; result = CMPOP2; break; case '*': lval->op = mult; result = MULOP2; break; case '/': lval->op = divide; result = MULOP2; break; case '%': lval->op = module; result = MULOP2; break; case '+': lval->op = plus; result = ADDOP2; break; case '-': lval->op = minus; result = ADDOP2; break; case 'n': case '?': case ':': case '(': case ')': /* Nothing, just return the character. */ break; case ';': case '\n': case '\0': /* Be safe and let the user call this function again. */ --exp; result = YYEOF; break; default: result = YYERRCODE; #if YYDEBUG != 0 --exp; #endif break; } *pexp = exp; return result; } static void yyerror (const char *str) { /* Do nothing. We don't print error messages here. */ } cadaver-0.23.3/lib/intl/ref-add.sin0000644000076400007640000000210511312007552016347 0ustar jortonjorton# Add this package to a list of references stored in a text file. # # Copyright (C) 2000 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. # # Written by Bruno Haible . # /^# Packages using this file: / { s/# Packages using this file:// ta :a s/ @PACKAGE@ / @PACKAGE@ / tb s/ $/ @PACKAGE@ / :b s/^/# Packages using this file:/ } cadaver-0.23.3/lib/intl/tsearch.c0000644000076400007640000004462011312007552016137 0ustar jortonjorton/* Copyright (C) 1995, 1996, 1997, 2000, 2006 Free Software Foundation, Inc. Contributed by Bernd Schmidt , 1997. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Tree search for red/black trees. The algorithm for adding nodes is taken from one of the many "Algorithms" books by Robert Sedgewick, although the implementation differs. The algorithm for deleting nodes can probably be found in a book named "Introduction to Algorithms" by Cormen/Leiserson/Rivest. At least that's the book that my professor took most algorithms from during the "Data Structures" course... Totally public domain. */ /* Red/black trees are binary trees in which the edges are colored either red or black. They have the following properties: 1. The number of black edges on every path from the root to a leaf is constant. 2. No two red edges are adjacent. Therefore there is an upper bound on the length of every path, it's O(log n) where n is the number of nodes in the tree. No path can be longer than 1+2*P where P is the length of the shortest path in the tree. Useful for the implementation: 3. If one of the children of a node is NULL, then the other one is red (if it exists). In the implementation, not the edges are colored, but the nodes. The color interpreted as the color of the edge leading to this node. The color is meaningless for the root node, but we color the root node black for convenience. All added nodes are red initially. Adding to a red/black tree is rather easy. The right place is searched with a usual binary tree search. Additionally, whenever a node N is reached that has two red successors, the successors are colored black and the node itself colored red. This moves red edges up the tree where they pose less of a problem once we get to really insert the new node. Changing N's color to red may violate rule 2, however, so rotations may become necessary to restore the invariants. Adding a new red leaf may violate the same rule, so afterwards an additional check is run and the tree possibly rotated. Deleting is hairy. There are mainly two nodes involved: the node to be deleted (n1), and another node that is to be unchained from the tree (n2). If n1 has a successor (the node with a smallest key that is larger than n1), then the successor becomes n2 and its contents are copied into n1, otherwise n1 becomes n2. Unchaining a node may violate rule 1: if n2 is black, one subtree is missing one black edge afterwards. The algorithm must try to move this error upwards towards the root, so that the subtree that does not have enough black edges becomes the whole tree. Once that happens, the error has disappeared. It may not be necessary to go all the way up, since it is possible that rotations and recoloring can fix the error before that. Although the deletion algorithm must walk upwards through the tree, we do not store parent pointers in the nodes. Instead, delete allocates a small array of parent pointers and fills it while descending the tree. Since we know that the length of a path is O(log n), where n is the number of nodes, this is likely to use less memory. */ /* Tree rotations look like this: A C / \ / \ B C A G / \ / \ --> / \ D E F G B F / \ D E In this case, A has been rotated left. This preserves the ordering of the binary tree. */ #include /* Specification. */ #ifdef IN_LIBINTL # include "tsearch.h" #else # include #endif #include typedef int (*__compar_fn_t) (const void *, const void *); typedef void (*__action_fn_t) (const void *, VISIT, int); #ifndef weak_alias # define __tsearch tsearch # define __tfind tfind # define __tdelete tdelete # define __twalk twalk #endif #ifndef internal_function /* Inside GNU libc we mark some function in a special way. In other environments simply ignore the marking. */ # define internal_function #endif typedef struct node_t { /* Callers expect this to be the first element in the structure - do not move! */ const void *key; struct node_t *left; struct node_t *right; unsigned int red:1; } *node; typedef const struct node_t *const_node; #undef DEBUGGING #ifdef DEBUGGING /* Routines to check tree invariants. */ #include #define CHECK_TREE(a) check_tree(a) static void check_tree_recurse (node p, int d_sofar, int d_total) { if (p == NULL) { assert (d_sofar == d_total); return; } check_tree_recurse (p->left, d_sofar + (p->left && !p->left->red), d_total); check_tree_recurse (p->right, d_sofar + (p->right && !p->right->red), d_total); if (p->left) assert (!(p->left->red && p->red)); if (p->right) assert (!(p->right->red && p->red)); } static void check_tree (node root) { int cnt = 0; node p; if (root == NULL) return; root->red = 0; for(p = root->left; p; p = p->left) cnt += !p->red; check_tree_recurse (root, 0, cnt); } #else #define CHECK_TREE(a) #endif /* Possibly "split" a node with two red successors, and/or fix up two red edges in a row. ROOTP is a pointer to the lowest node we visited, PARENTP and GPARENTP pointers to its parent/grandparent. P_R and GP_R contain the comparison values that determined which way was taken in the tree to reach ROOTP. MODE is 1 if we need not do the split, but must check for two red edges between GPARENTP and ROOTP. */ static void maybe_split_for_insert (node *rootp, node *parentp, node *gparentp, int p_r, int gp_r, int mode) { node root = *rootp; node *rp, *lp; rp = &(*rootp)->right; lp = &(*rootp)->left; /* See if we have to split this node (both successors red). */ if (mode == 1 || ((*rp) != NULL && (*lp) != NULL && (*rp)->red && (*lp)->red)) { /* This node becomes red, its successors black. */ root->red = 1; if (*rp) (*rp)->red = 0; if (*lp) (*lp)->red = 0; /* If the parent of this node is also red, we have to do rotations. */ if (parentp != NULL && (*parentp)->red) { node gp = *gparentp; node p = *parentp; /* There are two main cases: 1. The edge types (left or right) of the two red edges differ. 2. Both red edges are of the same type. There exist two symmetries of each case, so there is a total of 4 cases. */ if ((p_r > 0) != (gp_r > 0)) { /* Put the child at the top of the tree, with its parent and grandparent as successors. */ p->red = 1; gp->red = 1; root->red = 0; if (p_r < 0) { /* Child is left of parent. */ p->left = *rp; *rp = p; gp->right = *lp; *lp = gp; } else { /* Child is right of parent. */ p->right = *lp; *lp = p; gp->left = *rp; *rp = gp; } *gparentp = root; } else { *gparentp = *parentp; /* Parent becomes the top of the tree, grandparent and child are its successors. */ p->red = 0; gp->red = 1; if (p_r < 0) { /* Left edges. */ gp->left = p->right; p->right = gp; } else { /* Right edges. */ gp->right = p->left; p->left = gp; } } } } } /* Find or insert datum into search tree. KEY is the key to be located, ROOTP is the address of tree root, COMPAR the ordering function. */ void * __tsearch (const void *key, void **vrootp, __compar_fn_t compar) { node q; node *parentp = NULL, *gparentp = NULL; node *rootp = (node *) vrootp; node *nextp; int r = 0, p_r = 0, gp_r = 0; /* No they might not, Mr Compiler. */ if (rootp == NULL) return NULL; /* This saves some additional tests below. */ if (*rootp != NULL) (*rootp)->red = 0; CHECK_TREE (*rootp); nextp = rootp; while (*nextp != NULL) { node root = *rootp; r = (*compar) (key, root->key); if (r == 0) return root; maybe_split_for_insert (rootp, parentp, gparentp, p_r, gp_r, 0); /* If that did any rotations, parentp and gparentp are now garbage. That doesn't matter, because the values they contain are never used again in that case. */ nextp = r < 0 ? &root->left : &root->right; if (*nextp == NULL) break; gparentp = parentp; parentp = rootp; rootp = nextp; gp_r = p_r; p_r = r; } q = (struct node_t *) malloc (sizeof (struct node_t)); if (q != NULL) { *nextp = q; /* link new node to old */ q->key = key; /* initialize new node */ q->red = 1; q->left = q->right = NULL; if (nextp != rootp) /* There may be two red edges in a row now, which we must avoid by rotating the tree. */ maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1); } return q; } #ifdef weak_alias weak_alias (__tsearch, tsearch) #endif /* Find datum in search tree. KEY is the key to be located, ROOTP is the address of tree root, COMPAR the ordering function. */ void * __tfind (key, vrootp, compar) const void *key; void *const *vrootp; __compar_fn_t compar; { node *rootp = (node *) vrootp; if (rootp == NULL) return NULL; CHECK_TREE (*rootp); while (*rootp != NULL) { node root = *rootp; int r; r = (*compar) (key, root->key); if (r == 0) return root; rootp = r < 0 ? &root->left : &root->right; } return NULL; } #ifdef weak_alias weak_alias (__tfind, tfind) #endif /* Delete node with given key. KEY is the key to be deleted, ROOTP is the address of the root of tree, COMPAR the comparison function. */ void * __tdelete (const void *key, void **vrootp, __compar_fn_t compar) { node p, q, r, retval; int cmp; node *rootp = (node *) vrootp; node root, unchained; /* Stack of nodes so we remember the parents without recursion. It's _very_ unlikely that there are paths longer than 40 nodes. The tree would need to have around 250.000 nodes. */ int stacksize = 100; int sp = 0; node *nodestack[100]; if (rootp == NULL) return NULL; p = *rootp; if (p == NULL) return NULL; CHECK_TREE (p); while ((cmp = (*compar) (key, (*rootp)->key)) != 0) { if (sp == stacksize) abort (); nodestack[sp++] = rootp; p = *rootp; rootp = ((cmp < 0) ? &(*rootp)->left : &(*rootp)->right); if (*rootp == NULL) return NULL; } /* This is bogus if the node to be deleted is the root... this routine really should return an integer with 0 for success, -1 for failure and errno = ESRCH or something. */ retval = p; /* We don't unchain the node we want to delete. Instead, we overwrite it with its successor and unchain the successor. If there is no successor, we really unchain the node to be deleted. */ root = *rootp; r = root->right; q = root->left; if (q == NULL || r == NULL) unchained = root; else { node *parent = rootp, *up = &root->right; for (;;) { if (sp == stacksize) abort (); nodestack[sp++] = parent; parent = up; if ((*up)->left == NULL) break; up = &(*up)->left; } unchained = *up; } /* We know that either the left or right successor of UNCHAINED is NULL. R becomes the other one, it is chained into the parent of UNCHAINED. */ r = unchained->left; if (r == NULL) r = unchained->right; if (sp == 0) *rootp = r; else { q = *nodestack[sp-1]; if (unchained == q->right) q->right = r; else q->left = r; } if (unchained != root) root->key = unchained->key; if (!unchained->red) { /* Now we lost a black edge, which means that the number of black edges on every path is no longer constant. We must balance the tree. */ /* NODESTACK now contains all parents of R. R is likely to be NULL in the first iteration. */ /* NULL nodes are considered black throughout - this is necessary for correctness. */ while (sp > 0 && (r == NULL || !r->red)) { node *pp = nodestack[sp - 1]; p = *pp; /* Two symmetric cases. */ if (r == p->left) { /* Q is R's brother, P is R's parent. The subtree with root R has one black edge less than the subtree with root Q. */ q = p->right; if (q->red) { /* If Q is red, we know that P is black. We rotate P left so that Q becomes the top node in the tree, with P below it. P is colored red, Q is colored black. This action does not change the black edge count for any leaf in the tree, but we will be able to recognize one of the following situations, which all require that Q is black. */ q->red = 0; p->red = 1; /* Left rotate p. */ p->right = q->left; q->left = p; *pp = q; /* Make sure pp is right if the case below tries to use it. */ nodestack[sp++] = pp = &q->left; q = p->right; } /* We know that Q can't be NULL here. We also know that Q is black. */ if ((q->left == NULL || !q->left->red) && (q->right == NULL || !q->right->red)) { /* Q has two black successors. We can simply color Q red. The whole subtree with root P is now missing one black edge. Note that this action can temporarily make the tree invalid (if P is red). But we will exit the loop in that case and set P black, which both makes the tree valid and also makes the black edge count come out right. If P is black, we are at least one step closer to the root and we'll try again the next iteration. */ q->red = 1; r = p; } else { /* Q is black, one of Q's successors is red. We can repair the tree with one operation and will exit the loop afterwards. */ if (q->right == NULL || !q->right->red) { /* The left one is red. We perform the same action as in maybe_split_for_insert where two red edges are adjacent but point in different directions: Q's left successor (let's call it Q2) becomes the top of the subtree we are looking at, its parent (Q) and grandparent (P) become its successors. The former successors of Q2 are placed below P and Q. P becomes black, and Q2 gets the color that P had. This changes the black edge count only for node R and its successors. */ node q2 = q->left; q2->red = p->red; p->right = q2->left; q->left = q2->right; q2->right = q; q2->left = p; *pp = q2; p->red = 0; } else { /* It's the right one. Rotate P left. P becomes black, and Q gets the color that P had. Q's right successor also becomes black. This changes the black edge count only for node R and its successors. */ q->red = p->red; p->red = 0; q->right->red = 0; /* left rotate p */ p->right = q->left; q->left = p; *pp = q; } /* We're done. */ sp = 1; r = NULL; } } else { /* Comments: see above. */ q = p->left; if (q->red) { q->red = 0; p->red = 1; p->left = q->right; q->right = p; *pp = q; nodestack[sp++] = pp = &q->right; q = p->left; } if ((q->right == NULL || !q->right->red) && (q->left == NULL || !q->left->red)) { q->red = 1; r = p; } else { if (q->left == NULL || !q->left->red) { node q2 = q->right; q2->red = p->red; p->left = q2->right; q->right = q2->left; q2->left = q; q2->right = p; *pp = q2; p->red = 0; } else { q->red = p->red; p->red = 0; q->left->red = 0; p->left = q->right; q->right = p; *pp = q; } sp = 1; r = NULL; } } --sp; } if (r != NULL) r->red = 0; } free (unchained); return retval; } #ifdef weak_alias weak_alias (__tdelete, tdelete) #endif /* Walk the nodes of a tree. ROOT is the root of the tree to be walked, ACTION the function to be called at each node. LEVEL is the level of ROOT in the whole tree. */ static void internal_function trecurse (const void *vroot, __action_fn_t action, int level) { const_node root = (const_node) vroot; if (root->left == NULL && root->right == NULL) (*action) (root, leaf, level); else { (*action) (root, preorder, level); if (root->left != NULL) trecurse (root->left, action, level + 1); (*action) (root, postorder, level); if (root->right != NULL) trecurse (root->right, action, level + 1); (*action) (root, endorder, level); } } /* Walk the nodes of a tree. ROOT is the root of the tree to be walked, ACTION the function to be called at each node. */ void __twalk (const void *vroot, __action_fn_t action) { const_node root = (const_node) vroot; CHECK_TREE (root); if (root != NULL && action != NULL) trecurse (root, action, 0); } #ifdef weak_alias weak_alias (__twalk, twalk) #endif #ifdef _LIBC /* The standardized functions miss an important functionality: the tree cannot be removed easily. We provide a function to do this. */ static void internal_function tdestroy_recurse (node root, __free_fn_t freefct) { if (root->left != NULL) tdestroy_recurse (root->left, freefct); if (root->right != NULL) tdestroy_recurse (root->right, freefct); (*freefct) ((void *) root->key); /* Free the node itself. */ free (root); } void __tdestroy (void *vroot, __free_fn_t freefct) { node root = (node) vroot; CHECK_TREE (root); if (root != NULL) tdestroy_recurse (root, freefct); } weak_alias (__tdestroy, tdestroy) #endif /* _LIBC */ cadaver-0.23.3/lib/intl/tsearch.h0000644000076400007640000000536611312007552016150 0ustar jortonjorton/* Binary tree data structure. Copyright (C) 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _TSEARCH_H #define _TSEARCH_H #if HAVE_TSEARCH /* Get tseach(), tfind(), tdelete(), twalk() declarations. */ #include #else #ifdef __cplusplus extern "C" { #endif /* See , for details. */ typedef enum { preorder, postorder, endorder, leaf } VISIT; /* Searches an element in the tree *VROOTP that compares equal to KEY. If one is found, it is returned. Otherwise, a new element equal to KEY is inserted in the tree and is returned. */ extern void * tsearch (const void *key, void **vrootp, int (*compar) (const void *, const void *)); /* Searches an element in the tree *VROOTP that compares equal to KEY. If one is found, it is returned. Otherwise, NULL is returned. */ extern void * tfind (const void *key, void *const *vrootp, int (*compar) (const void *, const void *)); /* Searches an element in the tree *VROOTP that compares equal to KEY. If one is found, it is removed from the tree, and its parent node is returned. Otherwise, NULL is returned. */ extern void * tdelete (const void *key, void **vrootp, int (*compar) (const void *, const void *)); /* Perform a depth-first, left-to-right traversal of the tree VROOT. The ACTION function is called: - for non-leaf nodes: 3 times, before the left subtree traversal, after the left subtree traversal but before the right subtree traversal, and after the right subtree traversal, - for leaf nodes: once. The arguments passed to ACTION are: 1. the node; it can be casted to a 'const void * const *', i.e. into a pointer to the key, 2. an indicator which visit of the node this is, 3. the level of the node in the tree (0 for the root). */ extern void twalk (const void *vroot, void (*action) (const void *, VISIT, int)); #ifdef __cplusplus } #endif #endif #endif /* _TSEARCH_H */ cadaver-0.23.3/lib/intl/hash-string.h0000644000076400007640000000256611312007552016745 0ustar jortonjorton/* Description of GNU message catalog format: string hashing function. Copyright (C) 1995, 1997-1998, 2000-2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* @@ end of prolog @@ */ /* We assume to have `unsigned long int' value with at least 32 bits. */ #define HASHWORDBITS 32 #ifndef _LIBC # ifdef IN_LIBINTL # define __hash_string libintl_hash_string # else # define __hash_string hash_string # endif #endif /* Defines the so called `hashpjw' function by P.J. Weinberger [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, 1986, 1987 Bell Telephone Laboratories, Inc.] */ extern unsigned long int __hash_string (const char *str_param); cadaver-0.23.3/lib/intl/langprefs.c0000644000076400007640000000737511312007552016475 0ustar jortonjorton/* Determine the user's language preferences. Copyright (C) 2004-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Bruno Haible . */ #ifdef HAVE_CONFIG_H # include #endif #include #if HAVE_CFPREFERENCESCOPYAPPVALUE # include # include # include # include # include extern void _nl_locale_name_canonicalize (char *name); #endif /* Determine the user's language preferences, as a colon separated list of locale names in XPG syntax language[_territory][.codeset][@modifier] The result must not be freed; it is statically allocated. The LANGUAGE environment variable does not need to be considered; it is already taken into account by the caller. */ const char * _nl_language_preferences_default (void) { #if HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ { /* Cache the preferences list, since CoreFoundation calls are expensive. */ static const char *cached_languages; static int cache_initialized; if (!cache_initialized) { CFTypeRef preferences = CFPreferencesCopyAppValue (CFSTR ("AppleLanguages"), kCFPreferencesCurrentApplication); if (preferences != NULL && CFGetTypeID (preferences) == CFArrayGetTypeID ()) { CFArrayRef prefArray = (CFArrayRef)preferences; int n = CFArrayGetCount (prefArray); char buf[256]; size_t size = 0; int i; for (i = 0; i < n; i++) { CFTypeRef element = CFArrayGetValueAtIndex (prefArray, i); if (element != NULL && CFGetTypeID (element) == CFStringGetTypeID () && CFStringGetCString ((CFStringRef)element, buf, sizeof (buf), kCFStringEncodingASCII)) { _nl_locale_name_canonicalize (buf); size += strlen (buf) + 1; /* Most GNU programs use msgids in English and don't ship an en.mo message catalog. Therefore when we see "en" in the preferences list, arrange for gettext() to return the msgid, and ignore all further elements of the preferences list. */ if (strcmp (buf, "en") == 0) break; } else break; } if (size > 0) { char *languages = (char *) malloc (size); if (languages != NULL) { char *p = languages; for (i = 0; i < n; i++) { CFTypeRef element = CFArrayGetValueAtIndex (prefArray, i); if (element != NULL && CFGetTypeID (element) == CFStringGetTypeID () && CFStringGetCString ((CFStringRef)element, buf, sizeof (buf), kCFStringEncodingASCII)) { _nl_locale_name_canonicalize (buf); strcpy (p, buf); p += strlen (buf); *p++ = ':'; if (strcmp (buf, "en") == 0) break; } else break; } *--p = '\0'; cached_languages = languages; } } } cache_initialized = 1; } if (cached_languages != NULL) return cached_languages; } #endif return NULL; } cadaver-0.23.3/lib/intl/localcharset.h0000644000076400007640000000256311312007552017157 0ustar jortonjorton/* Determine a canonical name for the current locale's character encoding. Copyright (C) 2000-2003 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LOCALCHARSET_H #define _LOCALCHARSET_H #ifdef __cplusplus extern "C" { #endif /* Determine the current locale's character encoding, and canonicalize it into one of the canonical names listed in config.charset. The result must not be freed; it is statically allocated. If the canonical name cannot be determined, the result is a non-canonical name. */ extern const char * locale_charset (void); #ifdef __cplusplus } #endif #endif /* _LOCALCHARSET_H */ cadaver-0.23.3/lib/intl/dcngettext.c0000644000076400007640000000347411312007552016661 0ustar jortonjorton/* Implementation of the dcngettext(3) function. Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include "gettextP.h" #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* @@ end of prolog @@ */ /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define DCNGETTEXT __dcngettext # define DCIGETTEXT __dcigettext #else # define DCNGETTEXT libintl_dcngettext # define DCIGETTEXT libintl_dcigettext #endif /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ char * DCNGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category) { return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category); } #ifdef _LIBC /* Alias for function name in GNU C Library. */ weak_alias (__dcngettext, dcngettext); #endif cadaver-0.23.3/lib/intl/os2compat.c0000644000076400007640000000550711312007552016416 0ustar jortonjorton/* OS/2 compatibility functions. Copyright (C) 2001-2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #define OS2_AWARE #ifdef HAVE_CONFIG_H #include #endif #include #include #include /* A version of getenv() that works from DLLs */ extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue); char * _nl_getenv (const char *name) { unsigned char *value; if (DosScanEnv (name, &value)) return NULL; else return value; } /* A fixed size buffer. */ char libintl_nl_default_dirname[MAXPATHLEN+1]; char *_nlos2_libdir = NULL; char *_nlos2_localealiaspath = NULL; char *_nlos2_localedir = NULL; static __attribute__((constructor)) void nlos2_initialize () { char *root = getenv ("UNIXROOT"); char *gnulocaledir = getenv ("GNULOCALEDIR"); _nlos2_libdir = gnulocaledir; if (!_nlos2_libdir) { if (root) { size_t sl = strlen (root); _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1); memcpy (_nlos2_libdir, root, sl); memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1); } else _nlos2_libdir = LIBDIR; } _nlos2_localealiaspath = gnulocaledir; if (!_nlos2_localealiaspath) { if (root) { size_t sl = strlen (root); _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1); memcpy (_nlos2_localealiaspath, root, sl); memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1); } else _nlos2_localealiaspath = LOCALE_ALIAS_PATH; } _nlos2_localedir = gnulocaledir; if (!_nlos2_localedir) { if (root) { size_t sl = strlen (root); _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1); memcpy (_nlos2_localedir, root, sl); memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1); } else _nlos2_localedir = LOCALEDIR; } if (strlen (_nlos2_localedir) <= MAXPATHLEN) strcpy (libintl_nl_default_dirname, _nlos2_localedir); } cadaver-0.23.3/lib/intl/xsize.h0000644000076400007640000000672611312007552015662 0ustar jortonjorton/* xsize.h -- Checked size_t computations. Copyright (C) 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _XSIZE_H #define _XSIZE_H /* Get size_t. */ #include /* Get SIZE_MAX. */ #include #if HAVE_STDINT_H # include #endif /* The size of memory objects is often computed through expressions of type size_t. Example: void* p = malloc (header_size + n * element_size). These computations can lead to overflow. When this happens, malloc() returns a piece of memory that is way too small, and the program then crashes while attempting to fill the memory. To avoid this, the functions and macros in this file check for overflow. The convention is that SIZE_MAX represents overflow. malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc implementation that uses mmap --, it's recommended to use size_overflow_p() or size_in_bounds_p() before invoking malloc(). The example thus becomes: size_t size = xsum (header_size, xtimes (n, element_size)); void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); */ /* Convert an arbitrary value >= 0 to type size_t. */ #define xcast_size_t(N) \ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) /* Sum of two sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xsum (size_t size1, size_t size2) { size_t sum = size1 + size2; return (sum >= size1 ? sum : SIZE_MAX); } /* Sum of three sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xsum3 (size_t size1, size_t size2, size_t size3) { return xsum (xsum (size1, size2), size3); } /* Sum of four sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) { return xsum (xsum (xsum (size1, size2), size3), size4); } /* Maximum of two sizes, with overflow check. */ static inline size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif xmax (size_t size1, size_t size2) { /* No explicit check is needed here, because for any n: max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ return (size1 >= size2 ? size1 : size2); } /* Multiplication of a count with an element size, with overflow check. The count must be >= 0 and the element size must be > 0. This is a macro, not an inline function, so that it works correctly even when N is of a wider tupe and N > SIZE_MAX. */ #define xtimes(N, ELSIZE) \ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) /* Check for overflow. */ #define size_overflow_p(SIZE) \ ((SIZE) == SIZE_MAX) /* Check against overflow. */ #define size_in_bounds_p(SIZE) \ ((SIZE) != SIZE_MAX) #endif /* _XSIZE_H */ cadaver-0.23.3/lib/intl/printf-args.h0000644000076400007640000000662111312007552016746 0ustar jortonjorton/* Decomposed printf argument list. Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H /* This file can be parametrized with the following macros: ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. PRINTF_FETCHARGS Name of the function to be declared. STATIC Set to 'static' to declare the function static. */ /* Default parameters. */ #ifndef PRINTF_FETCHARGS # define PRINTF_FETCHARGS printf_fetchargs #endif /* Get size_t. */ #include /* Get wchar_t. */ #if HAVE_WCHAR_T # include #endif /* Get wint_t. */ #if HAVE_WINT_T # include #endif /* Get va_list. */ #include /* Argument types */ typedef enum { TYPE_NONE, TYPE_SCHAR, TYPE_UCHAR, TYPE_SHORT, TYPE_USHORT, TYPE_INT, TYPE_UINT, TYPE_LONGINT, TYPE_ULONGINT, #if HAVE_LONG_LONG_INT TYPE_LONGLONGINT, TYPE_ULONGLONGINT, #endif TYPE_DOUBLE, TYPE_LONGDOUBLE, TYPE_CHAR, #if HAVE_WINT_T TYPE_WIDE_CHAR, #endif TYPE_STRING, #if HAVE_WCHAR_T TYPE_WIDE_STRING, #endif TYPE_POINTER, TYPE_COUNT_SCHAR_POINTER, TYPE_COUNT_SHORT_POINTER, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER #if HAVE_LONG_LONG_INT , TYPE_COUNT_LONGLONGINT_POINTER #endif #if ENABLE_UNISTDIO /* The unistdio extensions. */ , TYPE_U8_STRING , TYPE_U16_STRING , TYPE_U32_STRING #endif } arg_type; /* Polymorphic argument */ typedef struct { arg_type type; union { signed char a_schar; unsigned char a_uchar; short a_short; unsigned short a_ushort; int a_int; unsigned int a_uint; long int a_longint; unsigned long int a_ulongint; #if HAVE_LONG_LONG_INT long long int a_longlongint; unsigned long long int a_ulonglongint; #endif float a_float; double a_double; long double a_longdouble; int a_char; #if HAVE_WINT_T wint_t a_wide_char; #endif const char* a_string; #if HAVE_WCHAR_T const wchar_t* a_wide_string; #endif void* a_pointer; signed char * a_count_schar_pointer; short * a_count_short_pointer; int * a_count_int_pointer; long int * a_count_longint_pointer; #if HAVE_LONG_LONG_INT long long int * a_count_longlongint_pointer; #endif #if ENABLE_UNISTDIO /* The unistdio extensions. */ const uint8_t * a_u8_string; const uint16_t * a_u16_string; const uint32_t * a_u32_string; #endif } a; } argument; typedef struct { size_t count; argument *arg; } arguments; /* Fetch the arguments, putting them into a. */ #ifdef STATIC STATIC #else extern #endif int PRINTF_FETCHARGS (va_list args, arguments *a); #endif /* _PRINTF_ARGS_H */ cadaver-0.23.3/lib/intl/printf.c0000644000076400007640000002217311312007552016007 0ustar jortonjorton/* Formatted output to strings, using POSIX/XSI format strings with positions. Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #ifdef __GNUC__ # define alloca __builtin_alloca # define HAVE_ALLOCA 1 #else # ifdef _MSC_VER # include # define alloca _alloca # else # if defined HAVE_ALLOCA_H || defined _LIBC # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca char *alloca (); # endif # endif # endif # endif #endif #include #if !HAVE_POSIX_PRINTF #include #include #include #include /* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ #ifndef EOVERFLOW # define EOVERFLOW E2BIG #endif /* When building a DLL, we must export some functions. Note that because the functions are only defined for binary backward compatibility, we don't need to use __declspec(dllimport) in any case. */ #if defined _MSC_VER && BUILDING_DLL # define DLL_EXPORTED __declspec(dllexport) #else # define DLL_EXPORTED #endif #define STATIC static /* This needs to be consistent with libgnuintl.h.in. */ #if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__ /* Don't break __attribute__((format(printf,M,N))). This redefinition is only possible because the libc in NetBSD, Cygwin, mingw does not have a function __printf__. */ # define libintl_printf __printf__ #endif /* Define auxiliary functions declared in "printf-args.h". */ #include "printf-args.c" /* Define auxiliary functions declared in "printf-parse.h". */ #include "printf-parse.c" /* Define functions declared in "vasnprintf.h". */ #define vasnprintf libintl_vasnprintf #include "vasnprintf.c" #if 0 /* not needed */ #define asnprintf libintl_asnprintf #include "asnprintf.c" #endif DLL_EXPORTED int libintl_vfprintf (FILE *stream, const char *format, va_list args) { if (strchr (format, '$') == NULL) return vfprintf (stream, format, args); else { size_t length; char *result = libintl_vasnprintf (NULL, &length, format, args); int retval = -1; if (result != NULL) { size_t written = fwrite (result, 1, length, stream); free (result); if (written == length) { if (length > INT_MAX) errno = EOVERFLOW; else retval = length; } } return retval; } } DLL_EXPORTED int libintl_fprintf (FILE *stream, const char *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vfprintf (stream, format, args); va_end (args); return retval; } DLL_EXPORTED int libintl_vprintf (const char *format, va_list args) { return libintl_vfprintf (stdout, format, args); } DLL_EXPORTED int libintl_printf (const char *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vprintf (format, args); va_end (args); return retval; } DLL_EXPORTED int libintl_vsprintf (char *resultbuf, const char *format, va_list args) { if (strchr (format, '$') == NULL) return vsprintf (resultbuf, format, args); else { size_t length = (size_t) ~0 / (4 * sizeof (char)); char *result = libintl_vasnprintf (resultbuf, &length, format, args); if (result != resultbuf) { free (result); return -1; } if (length > INT_MAX) { errno = EOVERFLOW; return -1; } else return length; } } DLL_EXPORTED int libintl_sprintf (char *resultbuf, const char *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vsprintf (resultbuf, format, args); va_end (args); return retval; } #if HAVE_SNPRINTF # if HAVE_DECL__SNPRINTF /* Windows. */ # define system_vsnprintf _vsnprintf # else /* Unix. */ # define system_vsnprintf vsnprintf # endif DLL_EXPORTED int libintl_vsnprintf (char *resultbuf, size_t length, const char *format, va_list args) { if (strchr (format, '$') == NULL) return system_vsnprintf (resultbuf, length, format, args); else { size_t maxlength = length; char *result = libintl_vasnprintf (resultbuf, &length, format, args); if (result != resultbuf) { if (maxlength > 0) { size_t pruned_length = (length < maxlength ? length : maxlength - 1); memcpy (resultbuf, result, pruned_length); resultbuf[pruned_length] = '\0'; } free (result); } if (length > INT_MAX) { errno = EOVERFLOW; return -1; } else return length; } } DLL_EXPORTED int libintl_snprintf (char *resultbuf, size_t length, const char *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vsnprintf (resultbuf, length, format, args); va_end (args); return retval; } #endif #if HAVE_ASPRINTF DLL_EXPORTED int libintl_vasprintf (char **resultp, const char *format, va_list args) { size_t length; char *result = libintl_vasnprintf (NULL, &length, format, args); if (result == NULL) return -1; if (length > INT_MAX) { free (result); errno = EOVERFLOW; return -1; } *resultp = result; return length; } DLL_EXPORTED int libintl_asprintf (char **resultp, const char *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vasprintf (resultp, format, args); va_end (args); return retval; } #endif #if HAVE_FWPRINTF #include #define WIDE_CHAR_VERSION 1 #include "wprintf-parse.h" /* Define auxiliary functions declared in "wprintf-parse.h". */ #define CHAR_T wchar_t #define DIRECTIVE wchar_t_directive #define DIRECTIVES wchar_t_directives #define PRINTF_PARSE wprintf_parse #include "printf-parse.c" /* Define functions declared in "vasnprintf.h". */ #define vasnwprintf libintl_vasnwprintf #include "vasnprintf.c" #if 0 /* not needed */ #define asnwprintf libintl_asnwprintf #include "asnprintf.c" #endif # if HAVE_DECL__SNWPRINTF /* Windows. */ # define system_vswprintf _vsnwprintf # else /* Unix. */ # define system_vswprintf vswprintf # endif DLL_EXPORTED int libintl_vfwprintf (FILE *stream, const wchar_t *format, va_list args) { if (wcschr (format, '$') == NULL) return vfwprintf (stream, format, args); else { size_t length; wchar_t *result = libintl_vasnwprintf (NULL, &length, format, args); int retval = -1; if (result != NULL) { size_t i; for (i = 0; i < length; i++) if (fputwc (result[i], stream) == WEOF) break; free (result); if (i == length) { if (length > INT_MAX) errno = EOVERFLOW; else retval = length; } } return retval; } } DLL_EXPORTED int libintl_fwprintf (FILE *stream, const wchar_t *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vfwprintf (stream, format, args); va_end (args); return retval; } DLL_EXPORTED int libintl_vwprintf (const wchar_t *format, va_list args) { return libintl_vfwprintf (stdout, format, args); } DLL_EXPORTED int libintl_wprintf (const wchar_t *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vwprintf (format, args); va_end (args); return retval; } DLL_EXPORTED int libintl_vswprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, va_list args) { if (wcschr (format, '$') == NULL) return system_vswprintf (resultbuf, length, format, args); else { size_t maxlength = length; wchar_t *result = libintl_vasnwprintf (resultbuf, &length, format, args); if (result != resultbuf) { if (maxlength > 0) { size_t pruned_length = (length < maxlength ? length : maxlength - 1); memcpy (resultbuf, result, pruned_length * sizeof (wchar_t)); resultbuf[pruned_length] = 0; } free (result); /* Unlike vsnprintf, which has to return the number of character that would have been produced if the resultbuf had been sufficiently large, the vswprintf function has to return a negative value if the resultbuf was not sufficiently large. */ if (length >= maxlength) return -1; } if (length > INT_MAX) { errno = EOVERFLOW; return -1; } else return length; } } DLL_EXPORTED int libintl_swprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, ...) { va_list args; int retval; va_start (args, format); retval = libintl_vswprintf (resultbuf, length, format, args); va_end (args); return retval; } #endif #endif cadaver-0.23.3/lib/intl/dcigettext.c0000644000076400007640000013334511312007552016655 0ustar jortonjorton/* Implementation of the internal dcigettext function. Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Tell glibc's to provide a prototype for mempcpy(). This must come before because may include , and once has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #ifdef HAVE_CONFIG_H # include #endif /* NL_LOCALE_NAME does not work in glibc-2.4. Ignore it. */ #undef HAVE_NL_LOCALE_NAME #include #ifdef __GNUC__ # define alloca __builtin_alloca # define HAVE_ALLOCA 1 #else # ifdef _MSC_VER # include # define alloca _alloca # else # if defined HAVE_ALLOCA_H || defined _LIBC # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca char *alloca (); # endif # endif # endif # endif #endif #include #ifndef errno extern int errno; #endif #ifndef __set_errno # define __set_errno(val) errno = (val) #endif #include #include #include #if defined HAVE_UNISTD_H || defined _LIBC # include #endif #include #ifdef _LIBC /* Guess whether integer division by zero raises signal SIGFPE. Set to 1 only if you know for sure. In case of doubt, set to 0. */ # if defined __alpha__ || defined __arm__ || defined __i386__ \ || defined __m68k__ || defined __s390__ # define INTDIV0_RAISES_SIGFPE 1 # else # define INTDIV0_RAISES_SIGFPE 0 # endif #endif #if !INTDIV0_RAISES_SIGFPE # include #endif #if defined HAVE_SYS_PARAM_H || defined _LIBC # include #endif #if !defined _LIBC # if HAVE_NL_LOCALE_NAME # include # endif # include "localcharset.h" #endif #include "gettextP.h" #include "plural-exp.h" #ifdef _LIBC # include #else # ifdef IN_LIBGLOCALE # include # endif # include "libgnuintl.h" #endif #include "hash-string.h" /* Handle multi-threaded applications. */ #ifdef _LIBC # include # define gl_rwlock_define_initialized __libc_rwlock_define_initialized # define gl_rwlock_rdlock __libc_rwlock_rdlock # define gl_rwlock_wrlock __libc_rwlock_wrlock # define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif /* Alignment of types. */ #if defined __GNUC__ && __GNUC__ >= 2 # define alignof(TYPE) __alignof__ (TYPE) #else # define alignof(TYPE) \ ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) #endif /* Some compilers, like SunOS4 cc, don't have offsetof in . */ #ifndef offsetof # define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) #endif /* @@ end of prolog @@ */ #ifdef _LIBC /* Rename the non ANSI C functions. This is required by the standard because some ANSI C functions will require linking with this object file and the name space must not be polluted. */ # define getcwd __getcwd # ifndef stpcpy # define stpcpy __stpcpy # endif # define tfind __tfind #else # if !defined HAVE_GETCWD char *getwd (); # define getcwd(buf, max) getwd (buf) # else # if VMS # define getcwd(buf, max) (getcwd) (buf, max, 0) # else char *getcwd (); # endif # endif # ifndef HAVE_STPCPY static char *stpcpy (char *dest, const char *src); # endif # ifndef HAVE_MEMPCPY static void *mempcpy (void *dest, const void *src, size_t n); # endif #endif /* Use a replacement if the system does not provide the `tsearch' function family. */ #if HAVE_TSEARCH || defined _LIBC # include #else # define tsearch libintl_tsearch # define tfind libintl_tfind # define tdelete libintl_tdelete # define twalk libintl_twalk # include "tsearch.h" #endif #ifdef _LIBC # define tsearch __tsearch #endif /* Amount to increase buffer size by in each try. */ #define PATH_INCR 32 /* The following is from pathmax.h. */ /* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define PATH_MAX but might cause redefinition warnings when sys/param.h is later included (as on MORE/BSD 4.3). */ #if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__) # include #endif #ifndef _POSIX_PATH_MAX # define _POSIX_PATH_MAX 255 #endif #if !defined PATH_MAX && defined _PC_PATH_MAX # define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX)) #endif /* Don't include sys/param.h if it already has been. */ #if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN # include #endif #if !defined PATH_MAX && defined MAXPATHLEN # define PATH_MAX MAXPATHLEN #endif #ifndef PATH_MAX # define PATH_MAX _POSIX_PATH_MAX #endif /* Pathname support. ISSLASH(C) tests whether C is a directory separator character. IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not, it may be concatenated to a directory pathname. IS_PATH_WITH_DIR(P) tests whether P contains a directory specification. */ #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Win32, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') # define HAS_DEVICE(P) \ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ && (P)[1] == ':') # define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P)) # define IS_PATH_WITH_DIR(P) \ (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P)) #else /* Unix */ # define ISSLASH(C) ((C) == '/') # define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0]) # define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL) #endif /* Whether to support different locales in different threads. */ #if defined _LIBC || HAVE_NL_LOCALE_NAME || (HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS) || defined IN_LIBGLOCALE # define HAVE_PER_THREAD_LOCALE #endif /* This is the type used for the search tree where known translations are stored. */ struct known_translation_t { /* Domain in which to search. */ const char *domainname; /* The category. */ int category; #ifdef HAVE_PER_THREAD_LOCALE /* Name of the relevant locale category, or "" for the global locale. */ const char *localename; #endif #ifdef IN_LIBGLOCALE /* The character encoding. */ const char *encoding; #endif /* State of the catalog counter at the point the string was found. */ int counter; /* Catalog where the string was found. */ struct loaded_l10nfile *domain; /* And finally the translation. */ const char *translation; size_t translation_length; /* Pointer to the string in question. */ char msgid[ZERO]; }; gl_rwlock_define_initialized (static, tree_lock) /* Root of the search tree with known translations. */ static void *root; /* Function to compare two entries in the table of known translations. */ static int transcmp (const void *p1, const void *p2) { const struct known_translation_t *s1; const struct known_translation_t *s2; int result; s1 = (const struct known_translation_t *) p1; s2 = (const struct known_translation_t *) p2; result = strcmp (s1->msgid, s2->msgid); if (result == 0) { result = strcmp (s1->domainname, s2->domainname); if (result == 0) { #ifdef HAVE_PER_THREAD_LOCALE result = strcmp (s1->localename, s2->localename); if (result == 0) #endif { #ifdef IN_LIBGLOCALE result = strcmp (s1->encoding, s2->encoding); if (result == 0) #endif /* We compare the category last (though this is the cheapest operation) since it is hopefully always the same (namely LC_MESSAGES). */ result = s1->category - s2->category; } } } return result; } /* Name of the default domain used for gettext(3) prior any call to textdomain(3). The default value for this is "messages". */ const char _nl_default_default_domain[] attribute_hidden = "messages"; #ifndef IN_LIBGLOCALE /* Value used as the default domain for gettext(3). */ const char *_nl_current_default_domain attribute_hidden = _nl_default_default_domain; #endif /* Contains the default location of the message catalogs. */ #if defined __EMX__ extern const char _nl_default_dirname[]; #else # ifdef _LIBC extern const char _nl_default_dirname[]; libc_hidden_proto (_nl_default_dirname) # endif const char _nl_default_dirname[] = LOCALEDIR; # ifdef _LIBC libc_hidden_data_def (_nl_default_dirname) # endif #endif #ifndef IN_LIBGLOCALE /* List with bindings of specific domains created by bindtextdomain() calls. */ struct binding *_nl_domain_bindings; #endif /* Prototypes for local functions. */ static char *plural_lookup (struct loaded_l10nfile *domain, unsigned long int n, const char *translation, size_t translation_len) internal_function; #ifdef IN_LIBGLOCALE static const char *guess_category_value (int category, const char *categoryname, const char *localename) internal_function; #else static const char *guess_category_value (int category, const char *categoryname) internal_function; #endif #ifdef _LIBC # include "../locale/localeinfo.h" # define category_to_name(category) \ _nl_category_names.str + _nl_category_name_idxs[category] #else static const char *category_to_name (int category) internal_function; #endif #if (defined _LIBC || HAVE_ICONV) && !defined IN_LIBGLOCALE static const char *get_output_charset (struct binding *domainbinding) internal_function; #endif /* For those loosing systems which don't have `alloca' we have to add some additional code emulating it. */ #ifdef HAVE_ALLOCA /* Nothing has to be done. */ # define freea(p) /* nothing */ # define ADD_BLOCK(list, address) /* nothing */ # define FREE_BLOCKS(list) /* nothing */ #else struct block_list { void *address; struct block_list *next; }; # define ADD_BLOCK(list, addr) \ do { \ struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ /* If we cannot get a free block we cannot add the new element to \ the list. */ \ if (newp != NULL) { \ newp->address = (addr); \ newp->next = (list); \ (list) = newp; \ } \ } while (0) # define FREE_BLOCKS(list) \ do { \ while (list != NULL) { \ struct block_list *old = list; \ list = list->next; \ free (old->address); \ free (old); \ } \ } while (0) # undef alloca # define alloca(size) (malloc (size)) # define freea(p) free (p) #endif /* have alloca */ #ifdef _LIBC /* List of blocks allocated for translations. */ typedef struct transmem_list { struct transmem_list *next; char data[ZERO]; } transmem_block_t; static struct transmem_list *transmem_list; #else typedef unsigned char transmem_block_t; #endif /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define DCIGETTEXT __dcigettext #else # define DCIGETTEXT libintl_dcigettext #endif /* Lock variable to protect the global data in the gettext implementation. */ gl_rwlock_define_initialized (, _nl_state_lock attribute_hidden) /* Checking whether the binaries runs SUID must be done and glibc provides easier methods therefore we make a difference here. */ #ifdef _LIBC # define ENABLE_SECURE __libc_enable_secure # define DETERMINE_SECURE #else # ifndef HAVE_GETUID # define getuid() 0 # endif # ifndef HAVE_GETGID # define getgid() 0 # endif # ifndef HAVE_GETEUID # define geteuid() getuid() # endif # ifndef HAVE_GETEGID # define getegid() getgid() # endif static int enable_secure; # define ENABLE_SECURE (enable_secure == 1) # define DETERMINE_SECURE \ if (enable_secure == 0) \ { \ if (getuid () != geteuid () || getgid () != getegid ()) \ enable_secure = 1; \ else \ enable_secure = -1; \ } #endif /* Get the function to evaluate the plural expression. */ #include "eval-plural.h" /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale and, if PLURAL is nonzero, search over string depending on the plural form determined by N. */ #ifdef IN_LIBGLOCALE char * gl_dcigettext (const char *domainname, const char *msgid1, const char *msgid2, int plural, unsigned long int n, int category, const char *localename, const char *encoding) #else char * DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, int plural, unsigned long int n, int category) #endif { #ifndef HAVE_ALLOCA struct block_list *block_list = NULL; #endif struct loaded_l10nfile *domain; struct binding *binding; const char *categoryname; const char *categoryvalue; const char *dirname; char *xdomainname; char *single_locale; char *retval; size_t retlen; int saved_errno; struct known_translation_t *search; struct known_translation_t **foundp = NULL; size_t msgid_len; #if defined HAVE_PER_THREAD_LOCALE && !defined IN_LIBGLOCALE const char *localename; #endif size_t domainname_len; /* If no real MSGID is given return NULL. */ if (msgid1 == NULL) return NULL; #ifdef _LIBC if (category < 0 || category >= __LC_LAST || category == LC_ALL) /* Bogus. */ return (plural == 0 ? (char *) msgid1 /* Use the Germanic plural rule. */ : n == 1 ? (char *) msgid1 : (char *) msgid2); #endif /* Preserve the `errno' value. */ saved_errno = errno; gl_rwlock_rdlock (_nl_state_lock); /* If DOMAINNAME is NULL, we are interested in the default domain. If CATEGORY is not LC_MESSAGES this might not make much sense but the definition left this undefined. */ if (domainname == NULL) domainname = _nl_current_default_domain; /* OS/2 specific: backward compatibility with older libintl versions */ #ifdef LC_MESSAGES_COMPAT if (category == LC_MESSAGES_COMPAT) category = LC_MESSAGES; #endif msgid_len = strlen (msgid1) + 1; /* Try to find the translation among those which we found at some time. */ search = (struct known_translation_t *) alloca (offsetof (struct known_translation_t, msgid) + msgid_len); memcpy (search->msgid, msgid1, msgid_len); search->domainname = domainname; search->category = category; #ifdef HAVE_PER_THREAD_LOCALE # ifndef IN_LIBGLOCALE # ifdef _LIBC localename = __current_locale_name (category); # else # if HAVE_NL_LOCALE_NAME /* NL_LOCALE_NAME is public glibc API introduced in glibc-2.4. */ localename = nl_langinfo (NL_LOCALE_NAME (category)); # else # if HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS /* The __names field is not public glibc API and must therefore not be used in code that is installed in public locations. */ { locale_t thread_locale = uselocale (NULL); if (thread_locale != LC_GLOBAL_LOCALE) localename = thread_locale->__names[category]; else localename = ""; } # endif # endif # endif # endif search->localename = localename; # ifdef IN_LIBGLOCALE search->encoding = encoding; # endif /* Since tfind/tsearch manage a balanced tree, concurrent tfind and tsearch calls can be fatal. */ gl_rwlock_rdlock (tree_lock); foundp = (struct known_translation_t **) tfind (search, &root, transcmp); gl_rwlock_unlock (tree_lock); freea (search); if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr) { /* Now deal with plural. */ if (plural) retval = plural_lookup ((*foundp)->domain, n, (*foundp)->translation, (*foundp)->translation_length); else retval = (char *) (*foundp)->translation; gl_rwlock_unlock (_nl_state_lock); __set_errno (saved_errno); return retval; } #endif /* See whether this is a SUID binary or not. */ DETERMINE_SECURE; /* First find matching binding. */ #ifdef IN_LIBGLOCALE /* We can use a trivial binding, since _nl_find_msg will ignore it anyway, and _nl_load_domain and _nl_find_domain just pass it through. */ binding = NULL; dirname = bindtextdomain (domainname, NULL); #else for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) { int compare = strcmp (domainname, binding->domainname); if (compare == 0) /* We found it! */ break; if (compare < 0) { /* It is not in the list. */ binding = NULL; break; } } if (binding == NULL) dirname = _nl_default_dirname; else { dirname = binding->dirname; #endif if (!IS_ABSOLUTE_PATH (dirname)) { /* We have a relative path. Make it absolute now. */ size_t dirname_len = strlen (dirname) + 1; size_t path_max; char *resolved_dirname; char *ret; path_max = (unsigned int) PATH_MAX; path_max += 2; /* The getcwd docs say to do this. */ for (;;) { resolved_dirname = (char *) alloca (path_max + dirname_len); ADD_BLOCK (block_list, tmp_dirname); __set_errno (0); ret = getcwd (resolved_dirname, path_max); if (ret != NULL || errno != ERANGE) break; path_max += path_max / 2; path_max += PATH_INCR; } if (ret == NULL) /* We cannot get the current working directory. Don't signal an error but simply return the default string. */ goto return_untranslated; stpcpy (stpcpy (strchr (resolved_dirname, '\0'), "/"), dirname); dirname = resolved_dirname; } #ifndef IN_LIBGLOCALE } #endif /* Now determine the symbolic name of CATEGORY and its value. */ categoryname = category_to_name (category); #ifdef IN_LIBGLOCALE categoryvalue = guess_category_value (category, categoryname, localename); #else categoryvalue = guess_category_value (category, categoryname); #endif domainname_len = strlen (domainname); xdomainname = (char *) alloca (strlen (categoryname) + domainname_len + 5); ADD_BLOCK (block_list, xdomainname); stpcpy ((char *) mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), domainname, domainname_len), ".mo"); /* Creating working area. */ single_locale = (char *) alloca (strlen (categoryvalue) + 1); ADD_BLOCK (block_list, single_locale); /* Search for the given string. This is a loop because we perhaps got an ordered list of languages to consider for the translation. */ while (1) { /* Make CATEGORYVALUE point to the next element of the list. */ while (categoryvalue[0] != '\0' && categoryvalue[0] == ':') ++categoryvalue; if (categoryvalue[0] == '\0') { /* The whole contents of CATEGORYVALUE has been searched but no valid entry has been found. We solve this situation by implicitly appending a "C" entry, i.e. no translation will take place. */ single_locale[0] = 'C'; single_locale[1] = '\0'; } else { char *cp = single_locale; while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') *cp++ = *categoryvalue++; *cp = '\0'; /* When this is a SUID binary we must not allow accessing files outside the dedicated directories. */ if (ENABLE_SECURE && IS_PATH_WITH_DIR (single_locale)) /* Ingore this entry. */ continue; } /* If the current locale value is C (or POSIX) we don't load a domain. Return the MSGID. */ if (strcmp (single_locale, "C") == 0 || strcmp (single_locale, "POSIX") == 0) break; /* Find structure describing the message catalog matching the DOMAINNAME and CATEGORY. */ domain = _nl_find_domain (dirname, single_locale, xdomainname, binding); if (domain != NULL) { #if defined IN_LIBGLOCALE retval = _nl_find_msg (domain, binding, encoding, msgid1, &retlen); #else retval = _nl_find_msg (domain, binding, msgid1, 1, &retlen); #endif if (retval == NULL) { int cnt; for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) { #if defined IN_LIBGLOCALE retval = _nl_find_msg (domain->successor[cnt], binding, encoding, msgid1, &retlen); #else retval = _nl_find_msg (domain->successor[cnt], binding, msgid1, 1, &retlen); #endif if (retval != NULL) { domain = domain->successor[cnt]; break; } } } /* Returning -1 means that some resource problem exists (likely memory) and that the strings could not be converted. Return the original strings. */ if (__builtin_expect (retval == (char *) -1, 0)) break; if (retval != NULL) { /* Found the translation of MSGID1 in domain DOMAIN: starting at RETVAL, RETLEN bytes. */ FREE_BLOCKS (block_list); if (foundp == NULL) { /* Create a new entry and add it to the search tree. */ size_t size; struct known_translation_t *newp; size = offsetof (struct known_translation_t, msgid) + msgid_len + domainname_len + 1; #ifdef HAVE_PER_THREAD_LOCALE size += strlen (localename) + 1; #endif newp = (struct known_translation_t *) malloc (size); if (newp != NULL) { char *new_domainname; #ifdef HAVE_PER_THREAD_LOCALE char *new_localename; #endif new_domainname = (char *) mempcpy (newp->msgid, msgid1, msgid_len); memcpy (new_domainname, domainname, domainname_len + 1); #ifdef HAVE_PER_THREAD_LOCALE new_localename = new_domainname + domainname_len + 1; strcpy (new_localename, localename); #endif newp->domainname = new_domainname; newp->category = category; #ifdef HAVE_PER_THREAD_LOCALE newp->localename = new_localename; #endif #ifdef IN_LIBGLOCALE newp->encoding = encoding; #endif newp->counter = _nl_msg_cat_cntr; newp->domain = domain; newp->translation = retval; newp->translation_length = retlen; gl_rwlock_wrlock (tree_lock); /* Insert the entry in the search tree. */ foundp = (struct known_translation_t **) tsearch (newp, &root, transcmp); gl_rwlock_unlock (tree_lock); if (foundp == NULL || __builtin_expect (*foundp != newp, 0)) /* The insert failed. */ free (newp); } } else { /* We can update the existing entry. */ (*foundp)->counter = _nl_msg_cat_cntr; (*foundp)->domain = domain; (*foundp)->translation = retval; (*foundp)->translation_length = retlen; } __set_errno (saved_errno); /* Now deal with plural. */ if (plural) retval = plural_lookup (domain, n, retval, retlen); gl_rwlock_unlock (_nl_state_lock); return retval; } } } return_untranslated: /* Return the untranslated MSGID. */ FREE_BLOCKS (block_list); gl_rwlock_unlock (_nl_state_lock); #ifndef _LIBC if (!ENABLE_SECURE) { extern void _nl_log_untranslated (const char *logfilename, const char *domainname, const char *msgid1, const char *msgid2, int plural); const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED"); if (logfilename != NULL && logfilename[0] != '\0') _nl_log_untranslated (logfilename, domainname, msgid1, msgid2, plural); } #endif __set_errno (saved_errno); return (plural == 0 ? (char *) msgid1 /* Use the Germanic plural rule. */ : n == 1 ? (char *) msgid1 : (char *) msgid2); } /* Look up the translation of msgid within DOMAIN_FILE and DOMAINBINDING. Return it if found. Return NULL if not found or in case of a conversion failure (problem in the particular message catalog). Return (char *) -1 in case of a memory allocation failure during conversion (only if ENCODING != NULL resp. CONVERT == true). */ char * internal_function #ifdef IN_LIBGLOCALE _nl_find_msg (struct loaded_l10nfile *domain_file, struct binding *domainbinding, const char *encoding, const char *msgid, size_t *lengthp) #else _nl_find_msg (struct loaded_l10nfile *domain_file, struct binding *domainbinding, const char *msgid, int convert, size_t *lengthp) #endif { struct loaded_domain *domain; nls_uint32 nstrings; size_t act; char *result; size_t resultlen; if (domain_file->decided <= 0) _nl_load_domain (domain_file, domainbinding); if (domain_file->data == NULL) return NULL; domain = (struct loaded_domain *) domain_file->data; nstrings = domain->nstrings; /* Locate the MSGID and its translation. */ if (domain->hash_tab != NULL) { /* Use the hashing table. */ nls_uint32 len = strlen (msgid); nls_uint32 hash_val = __hash_string (msgid); nls_uint32 idx = hash_val % domain->hash_size; nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); while (1) { nls_uint32 nstr = W (domain->must_swap_hash_tab, domain->hash_tab[idx]); if (nstr == 0) /* Hash table entry is empty. */ return NULL; nstr--; /* Compare msgid with the original string at index nstr. We compare the lengths with >=, not ==, because plural entries are represented by strings with an embedded NUL. */ if (nstr < nstrings ? W (domain->must_swap, domain->orig_tab[nstr].length) >= len && (strcmp (msgid, domain->data + W (domain->must_swap, domain->orig_tab[nstr].offset)) == 0) : domain->orig_sysdep_tab[nstr - nstrings].length > len && (strcmp (msgid, domain->orig_sysdep_tab[nstr - nstrings].pointer) == 0)) { act = nstr; goto found; } if (idx >= domain->hash_size - incr) idx -= domain->hash_size - incr; else idx += incr; } /* NOTREACHED */ } else { /* Try the default method: binary search in the sorted array of messages. */ size_t top, bottom; bottom = 0; top = nstrings; while (bottom < top) { int cmp_val; act = (bottom + top) / 2; cmp_val = strcmp (msgid, (domain->data + W (domain->must_swap, domain->orig_tab[act].offset))); if (cmp_val < 0) top = act; else if (cmp_val > 0) bottom = act + 1; else goto found; } /* No translation was found. */ return NULL; } found: /* The translation was found at index ACT. If we have to convert the string to use a different character set, this is the time. */ if (act < nstrings) { result = (char *) (domain->data + W (domain->must_swap, domain->trans_tab[act].offset)); resultlen = W (domain->must_swap, domain->trans_tab[act].length) + 1; } else { result = (char *) domain->trans_sysdep_tab[act - nstrings].pointer; resultlen = domain->trans_sysdep_tab[act - nstrings].length; } #if defined _LIBC || HAVE_ICONV # ifdef IN_LIBGLOCALE if (encoding != NULL) # else if (convert) # endif { /* We are supposed to do a conversion. */ # ifndef IN_LIBGLOCALE const char *encoding = get_output_charset (domainbinding); # endif size_t nconversions; struct converted_domain *convd; size_t i; /* Protect against reallocation of the table. */ gl_rwlock_rdlock (domain->conversions_lock); /* Search whether a table with converted translations for this encoding has already been allocated. */ nconversions = domain->nconversions; convd = NULL; for (i = nconversions; i > 0; ) { i--; if (strcmp (domain->conversions[i].encoding, encoding) == 0) { convd = &domain->conversions[i]; break; } } gl_rwlock_unlock (domain->conversions_lock); if (convd == NULL) { /* We have to allocate a new conversions table. */ gl_rwlock_wrlock (domain->conversions_lock); /* Maybe in the meantime somebody added the translation. Recheck. */ for (i = nconversions; i > 0; ) { i--; if (strcmp (domain->conversions[i].encoding, encoding) == 0) { convd = &domain->conversions[i]; goto found_convd; } } { /* Allocate a table for the converted translations for this encoding. */ struct converted_domain *new_conversions = (struct converted_domain *) (domain->conversions != NULL ? realloc (domain->conversions, (nconversions + 1) * sizeof (struct converted_domain)) : malloc ((nconversions + 1) * sizeof (struct converted_domain))); if (__builtin_expect (new_conversions == NULL, 0)) { /* Nothing we can do, no more memory. We cannot use the translation because it might be encoded incorrectly. */ unlock_fail: gl_rwlock_unlock (domain->conversions_lock); return (char *) -1; } domain->conversions = new_conversions; /* Copy the 'encoding' string to permanent storage. */ encoding = strdup (encoding); if (__builtin_expect (encoding == NULL, 0)) /* Nothing we can do, no more memory. We cannot use the translation because it might be encoded incorrectly. */ goto unlock_fail; convd = &new_conversions[nconversions]; convd->encoding = encoding; /* Find out about the character set the file is encoded with. This can be found (in textual form) in the entry "". If this entry does not exist or if this does not contain the 'charset=' information, we will assume the charset matches the one the current locale and we don't have to perform any conversion. */ # ifdef _LIBC convd->conv = (__gconv_t) -1; # else # if HAVE_ICONV convd->conv = (iconv_t) -1; # endif # endif { char *nullentry; size_t nullentrylen; /* Get the header entry. This is a recursion, but it doesn't reallocate domain->conversions because we pass encoding = NULL or convert = 0, respectively. */ nullentry = # ifdef IN_LIBGLOCALE _nl_find_msg (domain_file, domainbinding, NULL, "", &nullentrylen); # else _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen); # endif if (nullentry != NULL) { const char *charsetstr; charsetstr = strstr (nullentry, "charset="); if (charsetstr != NULL) { size_t len; char *charset; const char *outcharset; charsetstr += strlen ("charset="); len = strcspn (charsetstr, " \t\n"); charset = (char *) alloca (len + 1); # if defined _LIBC || HAVE_MEMPCPY *((char *) mempcpy (charset, charsetstr, len)) = '\0'; # else memcpy (charset, charsetstr, len); charset[len] = '\0'; # endif outcharset = encoding; # ifdef _LIBC /* We always want to use transliteration. */ outcharset = norm_add_slashes (outcharset, "TRANSLIT"); charset = norm_add_slashes (charset, ""); int r = __gconv_open (outcharset, charset, &convd->conv, GCONV_AVOID_NOCONV); if (__builtin_expect (r != __GCONV_OK, 0)) { /* If the output encoding is the same there is nothing to do. Otherwise do not use the translation at all. */ if (__builtin_expect (r != __GCONV_NULCONV, 1)) { gl_rwlock_unlock (domain->conversions_lock); free ((char *) encoding); return NULL; } convd->conv = (__gconv_t) -1; } # else # if HAVE_ICONV /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5, we want to use transliteration. */ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \ || _LIBICONV_VERSION >= 0x0105 if (strchr (outcharset, '/') == NULL) { char *tmp; len = strlen (outcharset); tmp = (char *) alloca (len + 10 + 1); memcpy (tmp, outcharset, len); memcpy (tmp + len, "//TRANSLIT", 10 + 1); outcharset = tmp; convd->conv = iconv_open (outcharset, charset); freea (outcharset); } else # endif convd->conv = iconv_open (outcharset, charset); # endif # endif freea (charset); } } } convd->conv_tab = NULL; /* Here domain->conversions is still == new_conversions. */ domain->nconversions++; } found_convd: gl_rwlock_unlock (domain->conversions_lock); } if ( # ifdef _LIBC convd->conv != (__gconv_t) -1 # else # if HAVE_ICONV convd->conv != (iconv_t) -1 # endif # endif ) { /* We are supposed to do a conversion. First allocate an appropriate table with the same structure as the table of translations in the file, where we can put the pointers to the converted strings in. There is a slight complication with plural entries. They are represented by consecutive NUL terminated strings. We handle this case by converting RESULTLEN bytes, including NULs. */ if (convd->conv_tab == NULL && ((convd->conv_tab = (char **) calloc (nstrings + domain->n_sysdep_strings, sizeof (char *))) == NULL)) /* Mark that we didn't succeed allocating a table. */ convd->conv_tab = (char **) -1; if (__builtin_expect (convd->conv_tab == (char **) -1, 0)) /* Nothing we can do, no more memory. We cannot use the translation because it might be encoded incorrectly. */ return (char *) -1; if (convd->conv_tab[act] == NULL) { /* We haven't used this string so far, so it is not translated yet. Do this now. */ /* We use a bit more efficient memory handling. We allocate always larger blocks which get used over time. This is faster than many small allocations. */ __libc_lock_define_initialized (static, lock) # define INITIAL_BLOCK_SIZE 4080 static unsigned char *freemem; static size_t freemem_size; const unsigned char *inbuf; unsigned char *outbuf; int malloc_count; # ifndef _LIBC transmem_block_t *transmem_list = NULL; # endif __libc_lock_lock (lock); inbuf = (const unsigned char *) result; outbuf = freemem + sizeof (size_t); malloc_count = 0; while (1) { transmem_block_t *newmem; # ifdef _LIBC size_t non_reversible; int res; if (freemem_size < sizeof (size_t)) goto resize_freemem; res = __gconv (convd->conv, &inbuf, inbuf + resultlen, &outbuf, outbuf + freemem_size - sizeof (size_t), &non_reversible); if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT) break; if (res != __GCONV_FULL_OUTPUT) { /* We should not use the translation at all, it is incorrectly encoded. */ __libc_lock_unlock (lock); return NULL; } inbuf = (const unsigned char *) result; # else # if HAVE_ICONV const char *inptr = (const char *) inbuf; size_t inleft = resultlen; char *outptr = (char *) outbuf; size_t outleft; if (freemem_size < sizeof (size_t)) goto resize_freemem; outleft = freemem_size - sizeof (size_t); if (iconv (convd->conv, (ICONV_CONST char **) &inptr, &inleft, &outptr, &outleft) != (size_t) (-1)) { outbuf = (unsigned char *) outptr; break; } if (errno != E2BIG) { __libc_lock_unlock (lock); return NULL; } # endif # endif resize_freemem: /* We must allocate a new buffer or resize the old one. */ if (malloc_count > 0) { ++malloc_count; freemem_size = malloc_count * INITIAL_BLOCK_SIZE; newmem = (transmem_block_t *) realloc (transmem_list, freemem_size); # ifdef _LIBC if (newmem != NULL) transmem_list = transmem_list->next; else { struct transmem_list *old = transmem_list; transmem_list = transmem_list->next; free (old); } # endif } else { malloc_count = 1; freemem_size = INITIAL_BLOCK_SIZE; newmem = (transmem_block_t *) malloc (freemem_size); } if (__builtin_expect (newmem == NULL, 0)) { freemem = NULL; freemem_size = 0; __libc_lock_unlock (lock); return (char *) -1; } # ifdef _LIBC /* Add the block to the list of blocks we have to free at some point. */ newmem->next = transmem_list; transmem_list = newmem; freemem = (unsigned char *) newmem->data; freemem_size -= offsetof (struct transmem_list, data); # else transmem_list = newmem; freemem = newmem; # endif outbuf = freemem + sizeof (size_t); } /* We have now in our buffer a converted string. Put this into the table of conversions. */ *(size_t *) freemem = outbuf - freemem - sizeof (size_t); convd->conv_tab[act] = (char *) freemem; /* Shrink freemem, but keep it aligned. */ freemem_size -= outbuf - freemem; freemem = outbuf; freemem += freemem_size & (alignof (size_t) - 1); freemem_size = freemem_size & ~ (alignof (size_t) - 1); __libc_lock_unlock (lock); } /* Now convd->conv_tab[act] contains the translation of all the plural variants. */ result = convd->conv_tab[act] + sizeof (size_t); resultlen = *(size_t *) convd->conv_tab[act]; } } /* The result string is converted. */ #endif /* _LIBC || HAVE_ICONV */ *lengthp = resultlen; return result; } /* Look up a plural variant. */ static char * internal_function plural_lookup (struct loaded_l10nfile *domain, unsigned long int n, const char *translation, size_t translation_len) { struct loaded_domain *domaindata = (struct loaded_domain *) domain->data; unsigned long int index; const char *p; index = plural_eval (domaindata->plural, n); if (index >= domaindata->nplurals) /* This should never happen. It means the plural expression and the given maximum value do not match. */ index = 0; /* Skip INDEX strings at TRANSLATION. */ p = translation; while (index-- > 0) { #ifdef _LIBC p = __rawmemchr (p, '\0'); #else p = strchr (p, '\0'); #endif /* And skip over the NUL byte. */ p++; if (p >= translation + translation_len) /* This should never happen. It means the plural expression evaluated to a value larger than the number of variants available for MSGID1. */ return (char *) translation; } return (char *) p; } #ifndef _LIBC /* Return string representation of locale CATEGORY. */ static const char * internal_function category_to_name (int category) { const char *retval; switch (category) { #ifdef LC_COLLATE case LC_COLLATE: retval = "LC_COLLATE"; break; #endif #ifdef LC_CTYPE case LC_CTYPE: retval = "LC_CTYPE"; break; #endif #ifdef LC_MONETARY case LC_MONETARY: retval = "LC_MONETARY"; break; #endif #ifdef LC_NUMERIC case LC_NUMERIC: retval = "LC_NUMERIC"; break; #endif #ifdef LC_TIME case LC_TIME: retval = "LC_TIME"; break; #endif #ifdef LC_MESSAGES case LC_MESSAGES: retval = "LC_MESSAGES"; break; #endif #ifdef LC_RESPONSE case LC_RESPONSE: retval = "LC_RESPONSE"; break; #endif #ifdef LC_ALL case LC_ALL: /* This might not make sense but is perhaps better than any other value. */ retval = "LC_ALL"; break; #endif default: /* If you have a better idea for a default value let me know. */ retval = "LC_XXX"; } return retval; } #endif /* Guess value of current locale from value of the environment variables or system-dependent defaults. */ static const char * internal_function #ifdef IN_LIBGLOCALE guess_category_value (int category, const char *categoryname, const char *locale) #else guess_category_value (int category, const char *categoryname) #endif { const char *language; #ifndef IN_LIBGLOCALE const char *locale; # ifndef _LIBC const char *language_default; int locale_defaulted; # endif #endif /* We use the settings in the following order: 1. The value of the environment variable 'LANGUAGE'. This is a GNU extension. Its value can be a colon-separated list of locale names. 2. The value of the environment variable 'LC_ALL', 'LC_xxx', or 'LANG'. More precisely, the first among these that is set to a non-empty value. This is how POSIX specifies it. The value is a single locale name. 3. A system-dependent preference list of languages. Its value can be a colon-separated list of locale names. 4. A system-dependent default locale name. This way: - System-dependent settings can be overridden by environment variables. - If the system provides both a list of languages and a default locale, the former is used. */ #ifndef IN_LIBGLOCALE /* Fetch the locale name, through the POSIX method of looking to `LC_ALL', `LC_xxx', and `LANG'. On some systems this can be done by the `setlocale' function itself. */ # ifdef _LIBC locale = __current_locale_name (category); # else # if HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS /* The __names field is not public glibc API and must therefore not be used in code that is installed in public locations. */ locale_t thread_locale = uselocale (NULL); if (thread_locale != LC_GLOBAL_LOCALE) { locale = thread_locale->__names[category]; locale_defaulted = 0; } else # endif { locale = _nl_locale_name_posix (category, categoryname); locale_defaulted = 0; if (locale == NULL) { locale = _nl_locale_name_default (); locale_defaulted = 1; } } # endif #endif /* Ignore LANGUAGE and its system-dependent analogon if the locale is set to "C" because 1. "C" locale usually uses the ASCII encoding, and most international messages use non-ASCII characters. These characters get displayed as question marks (if using glibc's iconv()) or as invalid 8-bit characters (because other iconv()s refuse to convert most non-ASCII characters to ASCII). In any case, the output is ugly. 2. The precise output of some programs in the "C" locale is specified by POSIX and should not depend on environment variables like "LANGUAGE" or system-dependent information. We allow such programs to use gettext(). */ if (strcmp (locale, "C") == 0) return locale; /* The highest priority value is the value of the 'LANGUAGE' environment variable. */ language = getenv ("LANGUAGE"); if (language != NULL && language[0] != '\0') return language; #if !defined IN_LIBGLOCALE && !defined _LIBC /* The next priority value is the locale name, if not defaulted. */ if (locale_defaulted) { /* The next priority value is the default language preferences list. */ language_default = _nl_language_preferences_default (); if (language_default != NULL) return language_default; } /* The least priority value is the locale name, if defaulted. */ #endif return locale; } #if (defined _LIBC || HAVE_ICONV) && !defined IN_LIBGLOCALE /* Returns the output charset. */ static const char * internal_function get_output_charset (struct binding *domainbinding) { /* The output charset should normally be determined by the locale. But sometimes the locale is not used or not correctly set up, so we provide a possibility for the user to override this: the OUTPUT_CHARSET environment variable. Moreover, the value specified through bind_textdomain_codeset overrides both. */ if (domainbinding != NULL && domainbinding->codeset != NULL) return domainbinding->codeset; else { /* For speed reasons, we look at the value of OUTPUT_CHARSET only once. This is a user variable that is not supposed to change during a program run. */ static char *output_charset_cache; static int output_charset_cached; if (!output_charset_cached) { const char *value = getenv ("OUTPUT_CHARSET"); if (value != NULL && value[0] != '\0') { size_t len = strlen (value) + 1; char *value_copy = (char *) malloc (len); if (value_copy != NULL) memcpy (value_copy, value, len); output_charset_cache = value_copy; } output_charset_cached = 1; } if (output_charset_cache != NULL) return output_charset_cache; else { # ifdef _LIBC return _NL_CURRENT (LC_CTYPE, CODESET); # else # if HAVE_ICONV return locale_charset (); # endif # endif } } } #endif /* @@ begin of epilog @@ */ /* We don't want libintl.a to depend on any other library. So we avoid the non-standard function stpcpy. In GNU C Library this function is available, though. Also allow the symbol HAVE_STPCPY to be defined. */ #if !_LIBC && !HAVE_STPCPY static char * stpcpy (char *dest, const char *src) { while ((*dest++ = *src++) != '\0') /* Do nothing. */ ; return dest - 1; } #endif #if !_LIBC && !HAVE_MEMPCPY static void * mempcpy (void *dest, const void *src, size_t n) { return (void *) ((char *) memcpy (dest, src, n) + n); } #endif #if !_LIBC && !HAVE_TSEARCH # include "tsearch.c" #endif #ifdef _LIBC /* If we want to free all resources we have to do some work at program's end. */ libc_freeres_fn (free_mem) { void *old; while (_nl_domain_bindings != NULL) { struct binding *oldp = _nl_domain_bindings; _nl_domain_bindings = _nl_domain_bindings->next; if (oldp->dirname != _nl_default_dirname) /* Yes, this is a pointer comparison. */ free (oldp->dirname); free (oldp->codeset); free (oldp); } if (_nl_current_default_domain != _nl_default_default_domain) /* Yes, again a pointer comparison. */ free ((char *) _nl_current_default_domain); /* Remove the search tree with the known translations. */ __tdestroy (root, free); root = NULL; while (transmem_list != NULL) { old = transmem_list; transmem_list = transmem_list->next; free (old); } } #endif cadaver-0.23.3/lib/intl/Makefile.in0000644000076400007640000005042111312007552016403 0ustar jortonjorton# Makefile for directory with message catalog handling library of GNU gettext # Copyright (C) 1995-1998, 2000-2007 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = /bin/sh srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = ../.. # The VPATH variables allows builds with $builddir != $srcdir, assuming a # 'make' program that supports VPATH (such as GNU make). This line is removed # by autoconf automatically when "$(srcdir)" = ".". # In this directory, the VPATH handling is particular: # 1. If INTL_LIBTOOL_SUFFIX_PREFIX is 'l' (indicating a build with libtool), # the .c -> .lo rules carefully use $(srcdir), so that VPATH can be omitted. # 2. If PACKAGE = gettext-tools, VPATH _must_ be omitted, because otherwise # 'make' does the wrong thing if GNU gettext was configured with # "./configure --srcdir=`pwd`", namely it gets confused by the .lo and .la # files it finds in srcdir = ../../gettext-runtime/intl. VPATH = $(srcdir) prefix = @prefix@ exec_prefix = @exec_prefix@ transform = @program_transform_name@ libdir = @libdir@ includedir = @includedir@ datarootdir = @datarootdir@ datadir = @datadir@ localedir = $(datadir)/locale gettextsrcdir = $(datadir)/gettext/intl aliaspath = $(localedir) subdir = intl INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, # @install_sh@ does not start with $(SHELL), so we add it. # In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. mkinstalldirs = $(SHELL) @install_sh@ -d install_sh = $(SHELL) @install_sh@ MKDIR_P = @MKDIR_P@ mkdir_p = @mkdir_p@ l = @INTL_LIBTOOL_SUFFIX_PREFIX@ AR = ar CC = @CC@ LIBTOOL = @LIBTOOL@ RANLIB = @RANLIB@ YACC = @INTLBISON@ -y -d YFLAGS = --name-prefix=__gettext WINDRES = @WINDRES@ # -DBUILDING_LIBINTL: Change expansion of LIBINTL_DLL_EXPORTED macro. # -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro. DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \ -DLIBDIR=\"$(libdir)\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL \ -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \ -Dset_relocation_prefix=libintl_set_relocation_prefix \ -Drelocate=libintl_relocate \ -DDEPENDS_ON_LIBICONV=1 @DEFS@ CPPFLAGS = @CPPFLAGS@ CFLAGS = @CFLAGS@ @CFLAG_VISIBILITY@ LDFLAGS = @LDFLAGS@ $(LDFLAGS_@WOE32DLL@) LDFLAGS_yes = -Wl,--export-all-symbols LDFLAGS_no = LIBS = @LIBS@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) HEADERS = \ gmo.h \ gettextP.h \ hash-string.h \ loadinfo.h \ plural-exp.h \ eval-plural.h \ localcharset.h \ lock.h \ relocatable.h \ tsearch.h tsearch.c \ xsize.h \ printf-args.h printf-args.c \ printf-parse.h wprintf-parse.h printf-parse.c \ vasnprintf.h vasnwprintf.h vasnprintf.c \ os2compat.h \ libgnuintl.h.in SOURCES = \ bindtextdom.c \ dcgettext.c \ dgettext.c \ gettext.c \ finddomain.c \ hash-string.c \ loadmsgcat.c \ localealias.c \ textdomain.c \ l10nflist.c \ explodename.c \ dcigettext.c \ dcngettext.c \ dngettext.c \ ngettext.c \ plural.y \ plural-exp.c \ localcharset.c \ lock.c \ relocatable.c \ langprefs.c \ localename.c \ log.c \ printf.c \ version.c \ osdep.c \ os2compat.c \ intl-exports.c \ intl-compat.c OBJECTS = \ bindtextdom.$lo \ dcgettext.$lo \ dgettext.$lo \ gettext.$lo \ finddomain.$lo \ hash-string.$lo \ loadmsgcat.$lo \ localealias.$lo \ textdomain.$lo \ l10nflist.$lo \ explodename.$lo \ dcigettext.$lo \ dcngettext.$lo \ dngettext.$lo \ ngettext.$lo \ plural.$lo \ plural-exp.$lo \ localcharset.$lo \ lock.$lo \ relocatable.$lo \ langprefs.$lo \ localename.$lo \ log.$lo \ printf.$lo \ version.$lo \ osdep.$lo \ intl-compat.$lo OBJECTS_RES_yes = libintl.res OBJECTS_RES_no = DISTFILES.common = Makefile.in \ config.charset locale.alias ref-add.sin ref-del.sin export.h libintl.rc \ $(HEADERS) $(SOURCES) DISTFILES.generated = plural.c DISTFILES.normal = VERSION DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc README.woe32 DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \ COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h \ libgnuintl.h_vms Makefile.vms libgnuintl.h.msvc-static \ libgnuintl.h.msvc-shared Makefile.msvc all: all-@USE_INCLUDED_LIBINTL@ all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed all-no: all-no-@BUILD_INCLUDED_LIBINTL@ all-no-yes: libgnuintl.$la all-no-no: libintl.a libgnuintl.a: $(OBJECTS) rm -f $@ $(AR) cru $@ $(OBJECTS) $(RANLIB) $@ libintl.la libgnuintl.la: $(OBJECTS) $(OBJECTS_RES_@WOE32@) $(LIBTOOL) --mode=link \ $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \ $(OBJECTS) @LTLIBICONV@ @INTL_MACOSX_LIBS@ $(LIBS) @LTLIBTHREAD@ @LTLIBC@ \ $(OBJECTS_RES_@WOE32@) \ -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ -rpath $(libdir) \ -no-undefined # Libtool's library version information for libintl. # Before making a gettext release, the gettext maintainer must change this # according to the libtool documentation, section "Library interface versions". # Maintainers of other packages that include the intl directory must *not* # change these values. LTV_CURRENT=8 LTV_REVISION=2 LTV_AGE=0 .SUFFIXES: .SUFFIXES: .c .y .o .lo .sin .sed .c.o: $(COMPILE) $< .y.c: $(YACC) $(YFLAGS) --output $@ $< rm -f $*.h bindtextdom.lo: $(srcdir)/bindtextdom.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/bindtextdom.c dcgettext.lo: $(srcdir)/dcgettext.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcgettext.c dgettext.lo: $(srcdir)/dgettext.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dgettext.c gettext.lo: $(srcdir)/gettext.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/gettext.c finddomain.lo: $(srcdir)/finddomain.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/finddomain.c hash-string.lo: $(srcdir)/hash-string.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/hash-string.c loadmsgcat.lo: $(srcdir)/loadmsgcat.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c localealias.lo: $(srcdir)/localealias.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localealias.c textdomain.lo: $(srcdir)/textdomain.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/textdomain.c l10nflist.lo: $(srcdir)/l10nflist.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/l10nflist.c explodename.lo: $(srcdir)/explodename.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/explodename.c dcigettext.lo: $(srcdir)/dcigettext.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcigettext.c dcngettext.lo: $(srcdir)/dcngettext.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcngettext.c dngettext.lo: $(srcdir)/dngettext.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dngettext.c ngettext.lo: $(srcdir)/ngettext.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/ngettext.c plural.lo: $(srcdir)/plural.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural.c plural-exp.lo: $(srcdir)/plural-exp.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural-exp.c localcharset.lo: $(srcdir)/localcharset.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c lock.lo: $(srcdir)/lock.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/lock.c relocatable.lo: $(srcdir)/relocatable.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/relocatable.c langprefs.lo: $(srcdir)/langprefs.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/langprefs.c localename.lo: $(srcdir)/localename.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localename.c log.lo: $(srcdir)/log.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/log.c printf.lo: $(srcdir)/printf.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/printf.c version.lo: $(srcdir)/version.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/version.c osdep.lo: $(srcdir)/osdep.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/osdep.c intl-compat.lo: $(srcdir)/intl-compat.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/intl-compat.c # This rule is executed only on Woe32 systems. # The following sed expressions come from the windres-options script. They are # inlined here, so that they can be written in a Makefile without requiring a # temporary file. They must contain literal newlines rather than semicolons, # so that they work with the sed-3.02 that is shipped with MSYS. We can use # GNU bash's $'\n' syntax to obtain such a newline. libintl.res: $(srcdir)/libintl.rc nl=$$'\n'; \ sed_extract_major='/^[0-9]/{'$${nl}'s/^\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \ sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \ sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{'$${nl}'s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p'$${nl}q$${nl}'}'$${nl}'c\'$${nl}0$${nl}q; \ $(WINDRES) \ "-DPACKAGE_VERSION_STRING=\\\"$(VERSION)\\\"" \ "-DPACKAGE_VERSION_MAJOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_major"` \ "-DPACKAGE_VERSION_MINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_minor"` \ "-DPACKAGE_VERSION_SUBMINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_subminor"` \ -i $(srcdir)/libintl.rc -o libintl.res --output-format=coff ref-add.sed: $(srcdir)/ref-add.sin sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-ref-add.sed mv t-ref-add.sed ref-add.sed ref-del.sed: $(srcdir)/ref-del.sin sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-ref-del.sed mv t-ref-del.sed ref-del.sed INCLUDES = -I. -I$(srcdir) -I.. libgnuintl.h: $(srcdir)/libgnuintl.h.in sed -e '/IN_LIBGLOCALE/d' \ -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \ -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \ -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \ -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \ < $(srcdir)/libgnuintl.h.in \ | if test '@WOE32DLL@' = yes; then \ sed -e 's/extern \([^()]*\);/extern __declspec (dllimport) \1;/'; \ else \ cat; \ fi \ | sed -e 's/extern \([^"]\)/extern LIBINTL_DLL_EXPORTED \1/' \ -e "/#define _LIBINTL_H/r $(srcdir)/export.h" \ | sed -e 's,@''HAVE_VISIBILITY''@,@HAVE_VISIBILITY@,g' \ > libgnuintl.h libintl.h: $(srcdir)/libgnuintl.h.in sed -e '/IN_LIBGLOCALE/d' \ -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \ -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \ -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \ -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \ < $(srcdir)/libgnuintl.h.in > libintl.h charset.alias: $(srcdir)/config.charset $(SHELL) $(srcdir)/config.charset '@host@' > t-$@ mv t-$@ $@ check: all # We must not install the libintl.h/libintl.a files if we are on a # system which has the GNU gettext() function in its C library or in a # separate library. # If you want to use the one which comes with this version of the # package, you have to use `configure --with-included-gettext'. install: install-exec install-data install-exec: all if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \ && test '@USE_INCLUDED_LIBINTL@' = yes; then \ $(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \ $(LIBTOOL) --mode=install \ $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \ if test "@RELOCATABLE@" = yes; then \ dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl.la | sed -e "s,^',," -e "s,'\$$,,"`; \ if test -n "$$dependencies"; then \ rm -f $(DESTDIR)$(libdir)/libintl.la; \ fi; \ fi; \ else \ : ; \ fi if test "$(PACKAGE)" = "gettext-tools" \ && test '@USE_INCLUDED_LIBINTL@' = no \ && test @GLIBC2@ != no; then \ $(mkdir_p) $(DESTDIR)$(libdir); \ $(LIBTOOL) --mode=install \ $(INSTALL_DATA) libgnuintl.$la $(DESTDIR)$(libdir)/libgnuintl.$la; \ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \ $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so; \ $(LIBTOOL) --mode=uninstall \ rm -f $(DESTDIR)$(libdir)/libgnuintl.$la; \ else \ : ; \ fi if test '@USE_INCLUDED_LIBINTL@' = yes; then \ test @GLIBC21@ != no || $(mkdir_p) $(DESTDIR)$(libdir); \ temp=$(DESTDIR)$(libdir)/t-charset.alias; \ dest=$(DESTDIR)$(libdir)/charset.alias; \ if test -f $(DESTDIR)$(libdir)/charset.alias; then \ orig=$(DESTDIR)$(libdir)/charset.alias; \ sed -f ref-add.sed $$orig > $$temp; \ $(INSTALL_DATA) $$temp $$dest; \ rm -f $$temp; \ else \ if test @GLIBC21@ = no; then \ orig=charset.alias; \ sed -f ref-add.sed $$orig > $$temp; \ $(INSTALL_DATA) $$temp $$dest; \ rm -f $$temp; \ fi; \ fi; \ $(mkdir_p) $(DESTDIR)$(localedir); \ test -f $(DESTDIR)$(localedir)/locale.alias \ && orig=$(DESTDIR)$(localedir)/locale.alias \ || orig=$(srcdir)/locale.alias; \ temp=$(DESTDIR)$(localedir)/t-locale.alias; \ dest=$(DESTDIR)$(localedir)/locale.alias; \ sed -f ref-add.sed $$orig > $$temp; \ $(INSTALL_DATA) $$temp $$dest; \ rm -f $$temp; \ else \ : ; \ fi install-data: all if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \ $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \ dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \ for file in $$dists; do \ $(INSTALL_DATA) $(srcdir)/$$file \ $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \ dists="$(DISTFILES.generated)"; \ for file in $$dists; do \ if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ $(INSTALL_DATA) $$dir/$$file \ $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ dists="$(DISTFILES.obsolete)"; \ for file in $$dists; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi install-strip: install install-dvi install-html install-info install-ps install-pdf: installdirs: if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \ && test '@USE_INCLUDED_LIBINTL@' = yes; then \ $(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ else \ : ; \ fi if test "$(PACKAGE)" = "gettext-tools" \ && test '@USE_INCLUDED_LIBINTL@' = no \ && test @GLIBC2@ != no; then \ $(mkdir_p) $(DESTDIR)$(libdir); \ else \ : ; \ fi if test '@USE_INCLUDED_LIBINTL@' = yes; then \ test @GLIBC21@ != no || $(mkdir_p) $(DESTDIR)$(libdir); \ $(mkdir_p) $(DESTDIR)$(localedir); \ else \ : ; \ fi if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ else \ : ; \ fi # Define this as empty until I found a useful application. installcheck: uninstall: if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \ && test '@USE_INCLUDED_LIBINTL@' = yes; then \ rm -f $(DESTDIR)$(includedir)/libintl.h; \ $(LIBTOOL) --mode=uninstall \ rm -f $(DESTDIR)$(libdir)/libintl.$la; \ else \ : ; \ fi if test "$(PACKAGE)" = "gettext-tools" \ && test '@USE_INCLUDED_LIBINTL@' = no \ && test @GLIBC2@ != no; then \ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \ else \ : ; \ fi if test '@USE_INCLUDED_LIBINTL@' = yes; then \ if test -f $(DESTDIR)$(libdir)/charset.alias; then \ temp=$(DESTDIR)$(libdir)/t-charset.alias; \ dest=$(DESTDIR)$(libdir)/charset.alias; \ sed -f ref-del.sed $$dest > $$temp; \ if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ rm -f $$dest; \ else \ $(INSTALL_DATA) $$temp $$dest; \ fi; \ rm -f $$temp; \ fi; \ if test -f $(DESTDIR)$(localedir)/locale.alias; then \ temp=$(DESTDIR)$(localedir)/t-locale.alias; \ dest=$(DESTDIR)$(localedir)/locale.alias; \ sed -f ref-del.sed $$dest > $$temp; \ if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ rm -f $$dest; \ else \ $(INSTALL_DATA) $$temp $$dest; \ fi; \ rm -f $$temp; \ fi; \ else \ : ; \ fi if test "$(PACKAGE)" = "gettext-tools"; then \ for file in VERSION ChangeLog COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi info dvi ps pdf html: $(OBJECTS): ../../config.h libgnuintl.h bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: $(srcdir)/gettextP.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h hash-string.$lo dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h explodename.$lo l10nflist.$lo: $(srcdir)/loadinfo.h dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h dcigettext.$lo: $(srcdir)/eval-plural.h localcharset.$lo: $(srcdir)/localcharset.h bindtextdom.$lo dcigettext.$lo finddomain.$lo loadmsgcat.$lo localealias.$lo lock.$lo log.$lo: $(srcdir)/lock.h localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c # A bison-2.1 generated plural.c includes if ENABLE_NLS. PLURAL_DEPS_yes = libintl.h PLURAL_DEPS_no = plural.$lo: $(PLURAL_DEPS_@USE_INCLUDED_LIBINTL@) tags: TAGS TAGS: $(HEADERS) $(SOURCES) here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES) ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) here=`pwd`; cd $(srcdir) && ctags -o $$here/CTAGS $(HEADERS) $(SOURCES) id: ID ID: $(HEADERS) $(SOURCES) here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES) mostlyclean: rm -f *.a *.la *.o *.obj *.lo libintl.res core core.* rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed rm -f -r .libs _libs clean: mostlyclean distclean: clean rm -f Makefile ID TAGS if test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; then \ rm -f ChangeLog.inst $(DISTFILES.normal); \ else \ : ; \ fi maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." # GNU gettext needs not contain the file `VERSION' but contains some # other files which should not be distributed in other packages. distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: Makefile if test "$(PACKAGE)" = "gettext-tools"; then \ : ; \ else \ if test "$(PACKAGE)" = "gettext-runtime"; then \ additional="$(DISTFILES.gettext)"; \ else \ additional="$(DISTFILES.normal)"; \ fi; \ $(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \ for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \ if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ cp -p $$dir/$$file $(distdir) || test $$file = Makefile.in || exit 1; \ done; \ fi Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status # This would be more efficient, but doesn't work any more with autoconf-2.57, # when AC_CONFIG_FILES([intl/Makefile:somedir/Makefile.in]) is used. # cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cadaver-0.23.3/lib/intl/ChangeLog0000644000076400007640000000010711312007552016104 0ustar jortonjorton2007-11-07 GNU * Version 0.17 released. cadaver-0.23.3/lib/intl/export.h0000644000076400007640000000023511312007552016026 0ustar jortonjorton #if @HAVE_VISIBILITY@ && BUILDING_LIBINTL #define LIBINTL_DLL_EXPORTED __attribute__((__visibility__("default"))) #else #define LIBINTL_DLL_EXPORTED #endif cadaver-0.23.3/lib/intl/dcgettext.c0000644000076400007640000000342111312007552016473 0ustar jortonjorton/* Implementation of the dcgettext(3) function. Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include "gettextP.h" #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* @@ end of prolog @@ */ /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define DCGETTEXT __dcgettext # define DCIGETTEXT __dcigettext #else # define DCGETTEXT libintl_dcgettext # define DCIGETTEXT libintl_dcigettext #endif /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ char * DCGETTEXT (const char *domainname, const char *msgid, int category) { return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category); } #ifdef _LIBC /* Alias for function name in GNU C Library. */ INTDEF(__dcgettext) weak_alias (__dcgettext, dcgettext); #endif cadaver-0.23.3/lib/intl/vasnprintf.h0000644000076400007640000000544311312007552016705 0ustar jortonjorton/* vsprintf with automatic memory allocation. Copyright (C) 2002-2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _VASNPRINTF_H #define _VASNPRINTF_H /* Get va_list. */ #include /* Get size_t. */ #include #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define __format__ format # define __printf__ printf # endif #endif #ifdef __cplusplus extern "C" { #endif /* Write formatted output to a string dynamically allocated with malloc(). You can pass a preallocated buffer for the result in RESULTBUF and its size in *LENGTHP; otherwise you pass RESULTBUF = NULL. If successful, return the address of the string (this may be = RESULTBUF if no dynamic memory allocation was necessary) and set *LENGTHP to the number of resulting bytes, excluding the trailing NUL. Upon error, set errno and return NULL. When dynamic memory allocation occurs, the preallocated buffer is left alone (with possibly modified contents). This makes it possible to use a statically allocated or stack-allocated buffer, like this: char buf[100]; size_t len = sizeof (buf); char *output = vasnprintf (buf, &len, format, args); if (output == NULL) ... error handling ...; else { ... use the output string ...; if (output != buf) free (output); } */ extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) __attribute__ ((__format__ (__printf__, 3, 0))); #ifdef __cplusplus } #endif #endif /* _VASNPRINTF_H */ cadaver-0.23.3/lib/intl/libgnuintl.h.in0000644000076400007640000003415311312007552017267 0ustar jortonjorton/* Message catalogs for internationalization. Copyright (C) 1995-1997, 2000-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBINTL_H #define _LIBINTL_H 1 #include /* The LC_MESSAGES locale category is the category used by the functions gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. On systems that don't define it, use an arbitrary value instead. On Solaris, defines __LOCALE_H (or _LOCALE_H in Solaris 2.5) then includes (i.e. this file!) and then only defines LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES in this case. */ #if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun)) # define LC_MESSAGES 1729 #endif /* We define an additional symbol to signal that we use the GNU implementation of gettext. */ #define __USE_GNU_GETTEXT 1 /* Provide information about the supported file formats. Returns the maximum minor revision number supported for a given major revision. */ #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \ ((major) == 0 || (major) == 1 ? 1 : -1) /* Resolve a platform specific conflict on DJGPP. GNU gettext takes precedence over _conio_gettext. */ #ifdef __DJGPP__ # undef gettext #endif #ifdef __cplusplus extern "C" { #endif /* Version number: (major<<16) + (minor<<8) + subminor */ #define LIBINTL_VERSION 0x001100 extern int libintl_version; /* We redirect the functions to those prefixed with "libintl_". This is necessary, because some systems define gettext/textdomain/... in the C library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer). If we used the unprefixed names, there would be cases where the definition in the C library would override the one in the libintl.so shared library. Recall that on ELF systems, the symbols are looked up in the following order: 1. in the executable, 2. in the shared libraries specified on the link command line, in order, 3. in the dependencies of the shared libraries specified on the link command line, 4. in the dlopen()ed shared libraries, in the order in which they were dlopen()ed. The definition in the C library would override the one in libintl.so if either * -lc is given on the link command line and -lintl isn't, or * -lc is given on the link command line before -lintl, or * libintl.so is a dependency of a dlopen()ed shared library but not linked to the executable at link time. Since Solaris gettext() behaves differently than GNU gettext(), this would be unacceptable. The redirection happens by default through macros in C, so that &gettext is independent of the compilation unit, but through inline functions in C++, in order not to interfere with the name mangling of class fields or class methods called 'gettext'. */ /* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS. If he doesn't, we choose the method. A third possible method is _INTL_REDIRECT_ASM, supported only by GCC. */ #if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS) # if __GNUC__ >= 2 && !(__APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus) # define _INTL_REDIRECT_ASM # else # ifdef __cplusplus # define _INTL_REDIRECT_INLINE # else # define _INTL_REDIRECT_MACROS # endif # endif #endif /* Auxiliary macros. */ #ifdef _INTL_REDIRECT_ASM # define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname)) # define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring # define _INTL_STRINGIFY(prefix) #prefix #else # define _INTL_ASM(cname) #endif /* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return its n-th argument literally. This enables GCC to warn for example about printf (gettext ("foo %y")). */ #if __GNUC__ >= 3 && !(__APPLE_CC__ > 1 && defined __cplusplus) # define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n))) #else # define _INTL_MAY_RETURN_STRING_ARG(n) #endif /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_gettext (const char *__msgid) _INTL_MAY_RETURN_STRING_ARG (1); static inline char *gettext (const char *__msgid) { return libintl_gettext (__msgid); } #else #ifdef _INTL_REDIRECT_MACROS # define gettext libintl_gettext #endif extern char *gettext (const char *__msgid) _INTL_ASM (libintl_gettext) _INTL_MAY_RETURN_STRING_ARG (1); #endif /* Look up MSGID in the DOMAINNAME message catalog for the current LC_MESSAGES locale. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dgettext (const char *__domainname, const char *__msgid) _INTL_MAY_RETURN_STRING_ARG (2); static inline char *dgettext (const char *__domainname, const char *__msgid) { return libintl_dgettext (__domainname, __msgid); } #else #ifdef _INTL_REDIRECT_MACROS # define dgettext libintl_dgettext #endif extern char *dgettext (const char *__domainname, const char *__msgid) _INTL_ASM (libintl_dgettext) _INTL_MAY_RETURN_STRING_ARG (2); #endif /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dcgettext (const char *__domainname, const char *__msgid, int __category) _INTL_MAY_RETURN_STRING_ARG (2); static inline char *dcgettext (const char *__domainname, const char *__msgid, int __category) { return libintl_dcgettext (__domainname, __msgid, __category); } #else #ifdef _INTL_REDIRECT_MACROS # define dcgettext libintl_dcgettext #endif extern char *dcgettext (const char *__domainname, const char *__msgid, int __category) _INTL_ASM (libintl_dcgettext) _INTL_MAY_RETURN_STRING_ARG (2); #endif /* Similar to `gettext' but select the plural form corresponding to the number N. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n) _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2); static inline char *ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n) { return libintl_ngettext (__msgid1, __msgid2, __n); } #else #ifdef _INTL_REDIRECT_MACROS # define ngettext libintl_ngettext #endif extern char *ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n) _INTL_ASM (libintl_ngettext) _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2); #endif /* Similar to `dgettext' but select the plural form corresponding to the number N. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n) _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); static inline char *dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n) { return libintl_dngettext (__domainname, __msgid1, __msgid2, __n); } #else #ifdef _INTL_REDIRECT_MACROS # define dngettext libintl_dngettext #endif extern char *dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n) _INTL_ASM (libintl_dngettext) _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); #endif /* Similar to `dcgettext' but select the plural form corresponding to the number N. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); static inline char *dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) { return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category); } #else #ifdef _INTL_REDIRECT_MACROS # define dcngettext libintl_dcngettext #endif extern char *dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) _INTL_ASM (libintl_dcngettext) _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); #endif #ifndef IN_LIBGLOCALE /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_textdomain (const char *__domainname); static inline char *textdomain (const char *__domainname) { return libintl_textdomain (__domainname); } #else #ifdef _INTL_REDIRECT_MACROS # define textdomain libintl_textdomain #endif extern char *textdomain (const char *__domainname) _INTL_ASM (libintl_textdomain); #endif /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_bindtextdomain (const char *__domainname, const char *__dirname); static inline char *bindtextdomain (const char *__domainname, const char *__dirname) { return libintl_bindtextdomain (__domainname, __dirname); } #else #ifdef _INTL_REDIRECT_MACROS # define bindtextdomain libintl_bindtextdomain #endif extern char *bindtextdomain (const char *__domainname, const char *__dirname) _INTL_ASM (libintl_bindtextdomain); #endif /* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ #ifdef _INTL_REDIRECT_INLINE extern char *libintl_bind_textdomain_codeset (const char *__domainname, const char *__codeset); static inline char *bind_textdomain_codeset (const char *__domainname, const char *__codeset) { return libintl_bind_textdomain_codeset (__domainname, __codeset); } #else #ifdef _INTL_REDIRECT_MACROS # define bind_textdomain_codeset libintl_bind_textdomain_codeset #endif extern char *bind_textdomain_codeset (const char *__domainname, const char *__codeset) _INTL_ASM (libintl_bind_textdomain_codeset); #endif #endif /* IN_LIBGLOCALE */ /* Support for format strings with positions in *printf(), following the POSIX/XSI specification. Note: These replacements for the *printf() functions are visible only in source files that #include or #include "gettext.h". Packages that use *printf() in source files that don't refer to _() or gettext() but for which the format string could be the return value of _() or gettext() need to add this #include. Oh well. */ #if !@HAVE_POSIX_PRINTF@ #include #include /* Get va_list. */ #if __STDC__ || defined __cplusplus || defined _MSC_VER # include #else # include #endif #undef fprintf #define fprintf libintl_fprintf extern int fprintf (FILE *, const char *, ...); #undef vfprintf #define vfprintf libintl_vfprintf extern int vfprintf (FILE *, const char *, va_list); #undef printf #if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__ /* Don't break __attribute__((format(printf,M,N))). This redefinition is only possible because the libc in NetBSD, Cygwin, mingw does not have a function __printf__. */ # define libintl_printf __printf__ #endif #define printf libintl_printf extern int printf (const char *, ...); #undef vprintf #define vprintf libintl_vprintf extern int vprintf (const char *, va_list); #undef sprintf #define sprintf libintl_sprintf extern int sprintf (char *, const char *, ...); #undef vsprintf #define vsprintf libintl_vsprintf extern int vsprintf (char *, const char *, va_list); #if @HAVE_SNPRINTF@ #undef snprintf #define snprintf libintl_snprintf extern int snprintf (char *, size_t, const char *, ...); #undef vsnprintf #define vsnprintf libintl_vsnprintf extern int vsnprintf (char *, size_t, const char *, va_list); #endif #if @HAVE_ASPRINTF@ #undef asprintf #define asprintf libintl_asprintf extern int asprintf (char **, const char *, ...); #undef vasprintf #define vasprintf libintl_vasprintf extern int vasprintf (char **, const char *, va_list); #endif #if @HAVE_WPRINTF@ #undef fwprintf #define fwprintf libintl_fwprintf extern int fwprintf (FILE *, const wchar_t *, ...); #undef vfwprintf #define vfwprintf libintl_vfwprintf extern int vfwprintf (FILE *, const wchar_t *, va_list); #undef wprintf #define wprintf libintl_wprintf extern int wprintf (const wchar_t *, ...); #undef vwprintf #define vwprintf libintl_vwprintf extern int vwprintf (const wchar_t *, va_list); #undef swprintf #define swprintf libintl_swprintf extern int swprintf (wchar_t *, size_t, const wchar_t *, ...); #undef vswprintf #define vswprintf libintl_vswprintf extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list); #endif #endif /* Support for relocatable packages. */ /* Sets the original and the current installation prefix of the package. Relocation simply replaces a pathname starting with the original prefix by the corresponding pathname with the current prefix instead. Both prefixes should be directory names without trailing slash (i.e. use "" instead of "/"). */ #define libintl_set_relocation_prefix libintl_set_relocation_prefix extern void libintl_set_relocation_prefix (const char *orig_prefix, const char *curr_prefix); #ifdef __cplusplus } #endif #endif /* libintl.h */ cadaver-0.23.3/lib/intl/locale.alias0000644000076400007640000000510611312007552016610 0ustar jortonjorton# Locale name alias data base. # Copyright (C) 1996-2001,2003,2007 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. # The format of this file is the same as for the corresponding file of # the X Window System, which normally can be found in # /usr/lib/X11/locale/locale.alias # A single line contains two fields: an alias and a substitution value. # All entries are case independent. # Note: This file is obsolete and is kept around for the time being for # backward compatibility. Nobody should rely on the names defined here. # Locales should always be specified by their full name. # Packages using this file: bokmal nb_NO.ISO-8859-1 bokmål nb_NO.ISO-8859-1 catalan ca_ES.ISO-8859-1 croatian hr_HR.ISO-8859-2 czech cs_CZ.ISO-8859-2 danish da_DK.ISO-8859-1 dansk da_DK.ISO-8859-1 deutsch de_DE.ISO-8859-1 dutch nl_NL.ISO-8859-1 eesti et_EE.ISO-8859-1 estonian et_EE.ISO-8859-1 finnish fi_FI.ISO-8859-1 français fr_FR.ISO-8859-1 french fr_FR.ISO-8859-1 galego gl_ES.ISO-8859-1 galician gl_ES.ISO-8859-1 german de_DE.ISO-8859-1 greek el_GR.ISO-8859-7 hebrew he_IL.ISO-8859-8 hrvatski hr_HR.ISO-8859-2 hungarian hu_HU.ISO-8859-2 icelandic is_IS.ISO-8859-1 italian it_IT.ISO-8859-1 japanese ja_JP.eucJP japanese.euc ja_JP.eucJP ja_JP ja_JP.eucJP ja_JP.ujis ja_JP.eucJP japanese.sjis ja_JP.SJIS korean ko_KR.eucKR korean.euc ko_KR.eucKR ko_KR ko_KR.eucKR lithuanian lt_LT.ISO-8859-13 no_NO nb_NO.ISO-8859-1 no_NO.ISO-8859-1 nb_NO.ISO-8859-1 norwegian nb_NO.ISO-8859-1 nynorsk nn_NO.ISO-8859-1 polish pl_PL.ISO-8859-2 portuguese pt_PT.ISO-8859-1 romanian ro_RO.ISO-8859-2 russian ru_RU.ISO-8859-5 slovak sk_SK.ISO-8859-2 slovene sl_SI.ISO-8859-2 slovenian sl_SI.ISO-8859-2 spanish es_ES.ISO-8859-1 swedish sv_SE.ISO-8859-1 thai th_TH.TIS-620 turkish tr_TR.ISO-8859-9 cadaver-0.23.3/lib/intl/version.c0000644000076400007640000000173111312007552016167 0ustar jortonjorton/* libintl library version. Copyright (C) 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include "libgnuintl.h" /* Version number: (major<<16) + (minor<<8) + subminor */ int libintl_version = LIBINTL_VERSION; cadaver-0.23.3/lib/intl/gettext.c0000644000076400007640000000355411312007552016173 0ustar jortonjorton/* Implementation of gettext(3) function. Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #ifdef _LIBC # define __need_NULL # include #else # include /* Just for NULL. */ #endif #include "gettextP.h" #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* @@ end of prolog @@ */ /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define GETTEXT __gettext # define DCGETTEXT INTUSE(__dcgettext) #else # define GETTEXT libintl_gettext # define DCGETTEXT libintl_dcgettext #endif /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ char * GETTEXT (const char *msgid) { return DCGETTEXT (NULL, msgid, LC_MESSAGES); } #ifdef _LIBC /* Alias for function name in GNU C Library. */ weak_alias (__gettext, gettext); #endif cadaver-0.23.3/lib/intl/os2compat.h0000644000076400007640000000302611312007552016415 0ustar jortonjorton/* OS/2 compatibility defines. This file is intended to be included from config.h Copyright (C) 2001-2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* When included from os2compat.h we need all the original definitions */ #ifndef OS2_AWARE #undef LIBDIR #define LIBDIR _nlos2_libdir extern char *_nlos2_libdir; #undef LOCALEDIR #define LOCALEDIR _nlos2_localedir extern char *_nlos2_localedir; #undef LOCALE_ALIAS_PATH #define LOCALE_ALIAS_PATH _nlos2_localealiaspath extern char *_nlos2_localealiaspath; #endif #undef HAVE_STRCASECMP #define HAVE_STRCASECMP 1 #define strcasecmp stricmp #define strncasecmp strnicmp /* We have our own getenv() which works even if library is compiled as DLL */ #define getenv _nl_getenv /* Older versions of gettext used -1 as the value of LC_MESSAGES */ #define LC_MESSAGES_COMPAT (-1) cadaver-0.23.3/lib/intl/hash-string.c0000644000076400007640000000315111312007552016727 0ustar jortonjorton/* Implements a string hashing function. Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif /* Specification. */ #include "hash-string.h" /* Defines the so called `hashpjw' function by P.J. Weinberger [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, 1986, 1987 Bell Telephone Laboratories, Inc.] */ unsigned long int __hash_string (const char *str_param) { unsigned long int hval, g; const char *str = str_param; /* Compute the hash value for the given string. */ hval = 0; while (*str != '\0') { hval <<= 4; hval += (unsigned char) *str++; g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4)); if (g != 0) { hval ^= g >> (HASHWORDBITS - 8); hval ^= g; } } return hval; } cadaver-0.23.3/lib/intl/intl-compat.c0000644000076400007640000000662411312007552016737 0ustar jortonjorton/* intl-compat.c - Stub functions to call gettext functions from GNU gettext Library. Copyright (C) 1995, 2000-2003, 2005 Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include "gettextP.h" /* @@ end of prolog @@ */ /* This file redirects the gettext functions (without prefix) to those defined in the included GNU libintl library (with "libintl_" prefix). It is compiled into libintl in order to make the AM_GNU_GETTEXT test of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which has the redirections primarily in the include file. It is also compiled into libgnuintl so that libgnuintl.so can be used as LD_PRELOADable library on glibc systems, to provide the extra features that the functions in the libc don't have (namely, logging). */ #undef gettext #undef dgettext #undef dcgettext #undef ngettext #undef dngettext #undef dcngettext #undef textdomain #undef bindtextdomain #undef bind_textdomain_codeset /* When building a DLL, we must export some functions. Note that because the functions are only defined for binary backward compatibility, we don't need to use __declspec(dllimport) in any case. */ #if HAVE_VISIBILITY && BUILDING_DLL # define DLL_EXPORTED __attribute__((__visibility__("default"))) #elif defined _MSC_VER && BUILDING_DLL # define DLL_EXPORTED __declspec(dllexport) #else # define DLL_EXPORTED #endif DLL_EXPORTED char * gettext (const char *msgid) { return libintl_gettext (msgid); } DLL_EXPORTED char * dgettext (const char *domainname, const char *msgid) { return libintl_dgettext (domainname, msgid); } DLL_EXPORTED char * dcgettext (const char *domainname, const char *msgid, int category) { return libintl_dcgettext (domainname, msgid, category); } DLL_EXPORTED char * ngettext (const char *msgid1, const char *msgid2, unsigned long int n) { return libintl_ngettext (msgid1, msgid2, n); } DLL_EXPORTED char * dngettext (const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n) { return libintl_dngettext (domainname, msgid1, msgid2, n); } DLL_EXPORTED char * dcngettext (const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category) { return libintl_dcngettext (domainname, msgid1, msgid2, n, category); } DLL_EXPORTED char * textdomain (const char *domainname) { return libintl_textdomain (domainname); } DLL_EXPORTED char * bindtextdomain (const char *domainname, const char *dirname) { return libintl_bindtextdomain (domainname, dirname); } DLL_EXPORTED char * bind_textdomain_codeset (const char *domainname, const char *codeset) { return libintl_bind_textdomain_codeset (domainname, codeset); } cadaver-0.23.3/lib/intl/COPYING.LIB-2.10000644000076400007640000006366111312007552016306 0ustar jortonjorton GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! cadaver-0.23.3/lib/intl/VERSION0000644000076400007640000000004611312007552015404 0ustar jortonjortonGNU gettext library from gettext-0.17 cadaver-0.23.3/lib/intl/dngettext.c0000644000076400007640000000354611312007552016516 0ustar jortonjorton/* Implementation of the dngettext(3) function. Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include "gettextP.h" #include #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* @@ end of prolog @@ */ /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define DNGETTEXT __dngettext # define DCNGETTEXT __dcngettext #else # define DNGETTEXT libintl_dngettext # define DCNGETTEXT libintl_dcngettext #endif /* Look up MSGID in the DOMAINNAME message catalog of the current LC_MESSAGES locale and skip message according to the plural form. */ char * DNGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n) { return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES); } #ifdef _LIBC /* Alias for function name in GNU C Library. */ weak_alias (__dngettext, dngettext); #endif cadaver-0.23.3/lib/intl/wprintf-parse.h0000644000076400007640000000426311312007552017313 0ustar jortonjorton/* Parse printf format string. Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _WPRINTF_PARSE_H #define _WPRINTF_PARSE_H #include "printf-args.h" /* Flags */ #define FLAG_GROUP 1 /* ' flag */ #define FLAG_LEFT 2 /* - flag */ #define FLAG_SHOWSIGN 4 /* + flag */ #define FLAG_SPACE 8 /* space flag */ #define FLAG_ALT 16 /* # flag */ #define FLAG_ZERO 32 /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) /* A parsed directive. */ typedef struct { const wchar_t* dir_start; const wchar_t* dir_end; int flags; const wchar_t* width_start; const wchar_t* width_end; size_t width_arg_index; const wchar_t* precision_start; const wchar_t* precision_end; size_t precision_arg_index; wchar_t conversion; /* d i o u x X f e E g G c s p n U % but not C S */ size_t arg_index; } wchar_t_directive; /* A parsed format string. */ typedef struct { size_t count; wchar_t_directive *dir; size_t max_width_length; size_t max_precision_length; } wchar_t_directives; /* Parses the format string. Fills in the number N of directives, and fills in directives[0], ..., directives[N-1], and sets directives[N].dir_start to the end of the format string. Also fills in the arg_type fields of the arguments and the needed count of arguments. */ #ifdef STATIC STATIC #else extern #endif int wprintf_parse (const wchar_t *format, wchar_t_directives *d, arguments *a); #endif /* _WPRINTF_PARSE_H */ cadaver-0.23.3/lib/intl/relocatable.h0000644000076400007640000000543211312007552016766 0ustar jortonjorton/* Provide relocatable packages. Copyright (C) 2003, 2005 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _RELOCATABLE_H #define _RELOCATABLE_H #ifdef __cplusplus extern "C" { #endif /* This can be enabled through the configure --enable-relocatable option. */ #if ENABLE_RELOCATABLE /* When building a DLL, we must export some functions. Note that because this is a private .h file, we don't need to use __declspec(dllimport) in any case. */ #if HAVE_VISIBILITY && BUILDING_DLL # define RELOCATABLE_DLL_EXPORTED __attribute__((__visibility__("default"))) #elif defined _MSC_VER && BUILDING_DLL # define RELOCATABLE_DLL_EXPORTED __declspec(dllexport) #else # define RELOCATABLE_DLL_EXPORTED #endif /* Sets the original and the current installation prefix of the package. Relocation simply replaces a pathname starting with the original prefix by the corresponding pathname with the current prefix instead. Both prefixes should be directory names without trailing slash (i.e. use "" instead of "/"). */ extern RELOCATABLE_DLL_EXPORTED void set_relocation_prefix (const char *orig_prefix, const char *curr_prefix); /* Returns the pathname, relocated according to the current installation directory. */ extern const char * relocate (const char *pathname); /* Memory management: relocate() leaks memory, because it has to construct a fresh pathname. If this is a problem because your program calls relocate() frequently, think about caching the result. */ /* Convenience function: Computes the current installation prefix, based on the original installation prefix, the original installation directory of a particular file, and the current pathname of this file. Returns NULL upon failure. */ extern const char * compute_curr_prefix (const char *orig_installprefix, const char *orig_installdir, const char *curr_pathname); #else /* By default, we use the hardwired pathnames. */ #define relocate(pathname) (pathname) #endif #ifdef __cplusplus } #endif #endif /* _RELOCATABLE_H */ cadaver-0.23.3/lib/intl/finddomain.c0000644000076400007640000001367311312007552016622 0ustar jortonjorton/* Handle list of needed message catalogs Copyright (C) 1995-1999, 2000-2001, 2003-2007 Free Software Foundation, Inc. Written by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #if defined HAVE_UNISTD_H || defined _LIBC # include #endif #include "gettextP.h" #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* Handle multi-threaded applications. */ #ifdef _LIBC # include # define gl_rwlock_define_initialized __libc_rwlock_define_initialized # define gl_rwlock_rdlock __libc_rwlock_rdlock # define gl_rwlock_wrlock __libc_rwlock_wrlock # define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif /* @@ end of prolog @@ */ /* List of already loaded domains. */ static struct loaded_l10nfile *_nl_loaded_domains; /* Return a data structure describing the message catalog described by the DOMAINNAME and CATEGORY parameters with respect to the currently established bindings. */ struct loaded_l10nfile * internal_function _nl_find_domain (const char *dirname, char *locale, const char *domainname, struct binding *domainbinding) { struct loaded_l10nfile *retval; const char *language; const char *modifier; const char *territory; const char *codeset; const char *normalized_codeset; const char *alias_value; int mask; /* LOCALE can consist of up to four recognized parts for the XPG syntax: language[_territory][.codeset][@modifier] Beside the first part all of them are allowed to be missing. If the full specified locale is not found, the less specific one are looked for. The various parts will be stripped off according to the following order: (1) codeset (2) normalized codeset (3) territory (4) modifier */ /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ gl_rwlock_define_initialized (static, lock); gl_rwlock_rdlock (lock); /* If we have already tested for this locale entry there has to be one data set in the list of loaded domains. */ retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, strlen (dirname) + 1, 0, locale, NULL, NULL, NULL, NULL, domainname, 0); gl_rwlock_unlock (lock); if (retval != NULL) { /* We know something about this locale. */ int cnt; if (retval->decided <= 0) _nl_load_domain (retval, domainbinding); if (retval->data != NULL) return retval; for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) { if (retval->successor[cnt]->decided <= 0) _nl_load_domain (retval->successor[cnt], domainbinding); if (retval->successor[cnt]->data != NULL) break; } return retval; /* NOTREACHED */ } /* See whether the locale value is an alias. If yes its value *overwrites* the alias name. No test for the original value is done. */ alias_value = _nl_expand_alias (locale); if (alias_value != NULL) { #if defined _LIBC || defined HAVE_STRDUP locale = strdup (alias_value); if (locale == NULL) return NULL; #else size_t len = strlen (alias_value) + 1; locale = (char *) malloc (len); if (locale == NULL) return NULL; memcpy (locale, alias_value, len); #endif } /* Now we determine the single parts of the locale name. First look for the language. Termination symbols are `_', '.', and `@'. */ mask = _nl_explode_name (locale, &language, &modifier, &territory, &codeset, &normalized_codeset); if (mask == -1) /* This means we are out of core. */ return NULL; /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ gl_rwlock_wrlock (lock); /* Create all possible locale entries which might be interested in generalization. */ retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, strlen (dirname) + 1, mask, language, territory, codeset, normalized_codeset, modifier, domainname, 1); gl_rwlock_unlock (lock); if (retval == NULL) /* This means we are out of core. */ goto out; if (retval->decided <= 0) _nl_load_domain (retval, domainbinding); if (retval->data == NULL) { int cnt; for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) { if (retval->successor[cnt]->decided <= 0) _nl_load_domain (retval->successor[cnt], domainbinding); if (retval->successor[cnt]->data != NULL) break; } } /* The room for an alias was dynamically allocated. Free it now. */ if (alias_value != NULL) free (locale); out: /* The space for normalized_codeset is dynamically allocated. Free it. */ if (mask & XPG_NORM_CODESET) free ((void *) normalized_codeset); return retval; } #ifdef _LIBC /* This is called from iconv/gconv_db.c's free_mem, as locales must be freed before freeing gconv steps arrays. */ void __libc_freeres_fn_section _nl_finddomain_subfreeres () { struct loaded_l10nfile *runp = _nl_loaded_domains; while (runp != NULL) { struct loaded_l10nfile *here = runp; if (runp->data != NULL) _nl_unload_domain ((struct loaded_domain *) runp->data); runp = runp->next; free ((char *) here->filename); free (here); } } #endif cadaver-0.23.3/lib/intl/gmo.h0000644000076400007640000001151211312007552015267 0ustar jortonjorton/* Description of GNU message catalog format: general file layout. Copyright (C) 1995, 1997, 2000-2002, 2004, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETTEXT_H #define _GETTEXT_H 1 #include /* @@ end of prolog @@ */ /* The magic number of the GNU message catalog format. */ #define _MAGIC 0x950412de #define _MAGIC_SWAPPED 0xde120495 /* Revision number of the currently used .mo (binary) file format. */ #define MO_REVISION_NUMBER 0 #define MO_REVISION_NUMBER_WITH_SYSDEP_I 1 /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work when cross-compiling. */ #if __STDC__ # define UINT_MAX_32_BITS 4294967295U #else # define UINT_MAX_32_BITS 0xFFFFFFFF #endif /* If UINT_MAX isn't defined, assume it's a 32-bit type. This should be valid for all systems GNU cares about because that doesn't include 16-bit systems, and only modern systems (that certainly have ) have 64+-bit integral types. */ #ifndef UINT_MAX # define UINT_MAX UINT_MAX_32_BITS #endif #if UINT_MAX == UINT_MAX_32_BITS typedef unsigned nls_uint32; #else # if USHRT_MAX == UINT_MAX_32_BITS typedef unsigned short nls_uint32; # else # if ULONG_MAX == UINT_MAX_32_BITS typedef unsigned long nls_uint32; # else /* The following line is intended to throw an error. Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." # endif # endif #endif /* Header for binary .mo file format. */ struct mo_file_header { /* The magic number. */ nls_uint32 magic; /* The revision number of the file format. */ nls_uint32 revision; /* The following are only used in .mo files with major revision 0 or 1. */ /* The number of strings pairs. */ nls_uint32 nstrings; /* Offset of table with start offsets of original strings. */ nls_uint32 orig_tab_offset; /* Offset of table with start offsets of translated strings. */ nls_uint32 trans_tab_offset; /* Size of hash table. */ nls_uint32 hash_tab_size; /* Offset of first hash table entry. */ nls_uint32 hash_tab_offset; /* The following are only used in .mo files with minor revision >= 1. */ /* The number of system dependent segments. */ nls_uint32 n_sysdep_segments; /* Offset of table describing system dependent segments. */ nls_uint32 sysdep_segments_offset; /* The number of system dependent strings pairs. */ nls_uint32 n_sysdep_strings; /* Offset of table with start offsets of original sysdep strings. */ nls_uint32 orig_sysdep_tab_offset; /* Offset of table with start offsets of translated sysdep strings. */ nls_uint32 trans_sysdep_tab_offset; }; /* Descriptor for static string contained in the binary .mo file. */ struct string_desc { /* Length of addressed string, not including the trailing NUL. */ nls_uint32 length; /* Offset of string in file. */ nls_uint32 offset; }; /* The following are only used in .mo files with minor revision >= 1. */ /* Descriptor for system dependent string segment. */ struct sysdep_segment { /* Length of addressed string, including the trailing NUL. */ nls_uint32 length; /* Offset of string in file. */ nls_uint32 offset; }; /* Pair of a static and a system dependent segment, in struct sysdep_string. */ struct segment_pair { /* Size of static segment. */ nls_uint32 segsize; /* Reference to system dependent string segment, or ~0 at the end. */ nls_uint32 sysdepref; }; /* Descriptor for system dependent string. */ struct sysdep_string { /* Offset of static string segments in file. */ nls_uint32 offset; /* Alternating sequence of static and system dependent segments. The last segment is a static segment, including the trailing NUL. */ struct segment_pair segments[1]; }; /* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF, regardless whether 'int' is 16 bit, 32 bit, or 64 bit. */ #define SEGMENTS_END ((nls_uint32) ~0) /* @@ begin of epilog @@ */ #endif /* gettext.h */ cadaver-0.23.3/lib/intl/loadinfo.h0000644000076400007640000001211311312007552016276 0ustar jortonjorton/* Copyright (C) 1996-1999, 2000-2003, 2005-2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LOADINFO_H #define _LOADINFO_H 1 /* Declarations of locale dependent catalog lookup functions. Implemented in localealias.c Possibly replace a locale name by another. explodename.c Split a locale name into its various fields. l10nflist.c Generate a list of filenames of possible message catalogs. finddomain.c Find and open the relevant message catalogs. The main function _nl_find_domain() in finddomain.c is declared in gettextP.h. */ #ifndef internal_function # define internal_function #endif #ifndef LIBINTL_DLL_EXPORTED # define LIBINTL_DLL_EXPORTED #endif /* Tell the compiler when a conditional or integer expression is almost always true or almost always false. */ #ifndef HAVE_BUILTIN_EXPECT # define __builtin_expect(expr, val) (expr) #endif /* Separator in PATH like lists of pathnames. */ #if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__ /* Win32, OS/2, DOS */ # define PATH_SEPARATOR ';' #else /* Unix */ # define PATH_SEPARATOR ':' #endif /* Encoding of locale name parts. */ #define XPG_NORM_CODESET 1 #define XPG_CODESET 2 #define XPG_TERRITORY 4 #define XPG_MODIFIER 8 struct loaded_l10nfile { const char *filename; int decided; const void *data; struct loaded_l10nfile *next; struct loaded_l10nfile *successor[1]; }; /* Normalize codeset name. There is no standard for the codeset names. Normalization allows the user to use any of the common names. The return value is dynamically allocated and has to be freed by the caller. */ extern const char *_nl_normalize_codeset (const char *codeset, size_t name_len); /* Lookup a locale dependent file. *L10NFILE_LIST denotes a pool of lookup results of locale dependent files of the same kind, sorted in decreasing order of ->filename. DIRLIST and DIRLIST_LEN are an argz list of directories in which to look, containing at least one directory (i.e. DIRLIST_LEN > 0). MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER are the pieces of the locale name, as produced by _nl_explode_name(). FILENAME is the filename suffix. The return value is the lookup result, either found in *L10NFILE_LIST, or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL. If the return value is non-NULL, it is added to *L10NFILE_LIST, and its ->next field denotes the chaining inside *L10NFILE_LIST, and furthermore its ->successor[] field contains a list of other lookup results from which this lookup result inherits. */ extern struct loaded_l10nfile * _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, const char *dirlist, size_t dirlist_len, int mask, const char *language, const char *territory, const char *codeset, const char *normalized_codeset, const char *modifier, const char *filename, int do_allocate); /* Lookup the real locale name for a locale alias NAME, or NULL if NAME is not a locale alias (but possibly a real locale name). The return value is statically allocated and must not be freed. */ /* Part of the libintl ABI only for the sake of the gettext.m4 macro. */ extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name); /* Split a locale name NAME into its pieces: language, modifier, territory, codeset. NAME gets destructively modified: NUL bytes are inserted here and there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY, *CODESET gets assigned either a pointer into the old NAME string, or NULL. *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it is different from *CODESET; this one is dynamically allocated and has to be freed by the caller. The return value is a bitmask, where each bit corresponds to one filled-in value: XPG_MODIFIER for *MODIFIER, XPG_TERRITORY for *TERRITORY, XPG_CODESET for *CODESET, XPG_NORM_CODESET for *NORMALIZED_CODESET. */ extern int _nl_explode_name (char *name, const char **language, const char **modifier, const char **territory, const char **codeset, const char **normalized_codeset); #endif /* loadinfo.h */ cadaver-0.23.3/lib/intl/bindtextdom.c0000644000076400007640000002137211312007552017026 0ustar jortonjorton/* Implementation of the bindtextdomain(3) function Copyright (C) 1995-1998, 2000-2003, 2005-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "gettextP.h" #ifdef _LIBC # include #else # include "libgnuintl.h" #endif /* Handle multi-threaded applications. */ #ifdef _LIBC # include # define gl_rwlock_define __libc_rwlock_define # define gl_rwlock_wrlock __libc_rwlock_wrlock # define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif /* Some compilers, like SunOS4 cc, don't have offsetof in . */ #ifndef offsetof # define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) #endif /* @@ end of prolog @@ */ /* Lock variable to protect the global data in the gettext implementation. */ gl_rwlock_define (extern, _nl_state_lock attribute_hidden) /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define BINDTEXTDOMAIN __bindtextdomain # define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset # ifndef strdup # define strdup(str) __strdup (str) # endif #else # define BINDTEXTDOMAIN libintl_bindtextdomain # define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset #endif /* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP to be used for the DOMAINNAME message catalog. If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not modified, only the current value is returned. If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither modified nor returned. */ static void set_binding_values (const char *domainname, const char **dirnamep, const char **codesetp) { struct binding *binding; int modified; /* Some sanity checks. */ if (domainname == NULL || domainname[0] == '\0') { if (dirnamep) *dirnamep = NULL; if (codesetp) *codesetp = NULL; return; } gl_rwlock_wrlock (_nl_state_lock); modified = 0; for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) { int compare = strcmp (domainname, binding->domainname); if (compare == 0) /* We found it! */ break; if (compare < 0) { /* It is not in the list. */ binding = NULL; break; } } if (binding != NULL) { if (dirnamep) { const char *dirname = *dirnamep; if (dirname == NULL) /* The current binding has be to returned. */ *dirnamep = binding->dirname; else { /* The domain is already bound. If the new value and the old one are equal we simply do nothing. Otherwise replace the old binding. */ char *result = binding->dirname; if (strcmp (dirname, result) != 0) { if (strcmp (dirname, _nl_default_dirname) == 0) result = (char *) _nl_default_dirname; else { #if defined _LIBC || defined HAVE_STRDUP result = strdup (dirname); #else size_t len = strlen (dirname) + 1; result = (char *) malloc (len); if (__builtin_expect (result != NULL, 1)) memcpy (result, dirname, len); #endif } if (__builtin_expect (result != NULL, 1)) { if (binding->dirname != _nl_default_dirname) free (binding->dirname); binding->dirname = result; modified = 1; } } *dirnamep = result; } } if (codesetp) { const char *codeset = *codesetp; if (codeset == NULL) /* The current binding has be to returned. */ *codesetp = binding->codeset; else { /* The domain is already bound. If the new value and the old one are equal we simply do nothing. Otherwise replace the old binding. */ char *result = binding->codeset; if (result == NULL || strcmp (codeset, result) != 0) { #if defined _LIBC || defined HAVE_STRDUP result = strdup (codeset); #else size_t len = strlen (codeset) + 1; result = (char *) malloc (len); if (__builtin_expect (result != NULL, 1)) memcpy (result, codeset, len); #endif if (__builtin_expect (result != NULL, 1)) { if (binding->codeset != NULL) free (binding->codeset); binding->codeset = result; modified = 1; } } *codesetp = result; } } } else if ((dirnamep == NULL || *dirnamep == NULL) && (codesetp == NULL || *codesetp == NULL)) { /* Simply return the default values. */ if (dirnamep) *dirnamep = _nl_default_dirname; if (codesetp) *codesetp = NULL; } else { /* We have to create a new binding. */ size_t len = strlen (domainname) + 1; struct binding *new_binding = (struct binding *) malloc (offsetof (struct binding, domainname) + len); if (__builtin_expect (new_binding == NULL, 0)) goto failed; memcpy (new_binding->domainname, domainname, len); if (dirnamep) { const char *dirname = *dirnamep; if (dirname == NULL) /* The default value. */ dirname = _nl_default_dirname; else { if (strcmp (dirname, _nl_default_dirname) == 0) dirname = _nl_default_dirname; else { char *result; #if defined _LIBC || defined HAVE_STRDUP result = strdup (dirname); if (__builtin_expect (result == NULL, 0)) goto failed_dirname; #else size_t len = strlen (dirname) + 1; result = (char *) malloc (len); if (__builtin_expect (result == NULL, 0)) goto failed_dirname; memcpy (result, dirname, len); #endif dirname = result; } } *dirnamep = dirname; new_binding->dirname = (char *) dirname; } else /* The default value. */ new_binding->dirname = (char *) _nl_default_dirname; if (codesetp) { const char *codeset = *codesetp; if (codeset != NULL) { char *result; #if defined _LIBC || defined HAVE_STRDUP result = strdup (codeset); if (__builtin_expect (result == NULL, 0)) goto failed_codeset; #else size_t len = strlen (codeset) + 1; result = (char *) malloc (len); if (__builtin_expect (result == NULL, 0)) goto failed_codeset; memcpy (result, codeset, len); #endif codeset = result; } *codesetp = codeset; new_binding->codeset = (char *) codeset; } else new_binding->codeset = NULL; /* Now enqueue it. */ if (_nl_domain_bindings == NULL || strcmp (domainname, _nl_domain_bindings->domainname) < 0) { new_binding->next = _nl_domain_bindings; _nl_domain_bindings = new_binding; } else { binding = _nl_domain_bindings; while (binding->next != NULL && strcmp (domainname, binding->next->domainname) > 0) binding = binding->next; new_binding->next = binding->next; binding->next = new_binding; } modified = 1; /* Here we deal with memory allocation failures. */ if (0) { failed_codeset: if (new_binding->dirname != _nl_default_dirname) free (new_binding->dirname); failed_dirname: free (new_binding); failed: if (dirnamep) *dirnamep = NULL; if (codesetp) *codesetp = NULL; } } /* If we modified any binding, we flush the caches. */ if (modified) ++_nl_msg_cat_cntr; gl_rwlock_unlock (_nl_state_lock); } /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ char * BINDTEXTDOMAIN (const char *domainname, const char *dirname) { set_binding_values (domainname, &dirname, NULL); return (char *) dirname; } /* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ char * BIND_TEXTDOMAIN_CODESET (const char *domainname, const char *codeset) { set_binding_values (domainname, NULL, &codeset); return (char *) codeset; } #ifdef _LIBC /* Aliases for function names in GNU C Library. */ weak_alias (__bindtextdomain, bindtextdomain); weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset); #endif cadaver-0.23.3/lib/intl/relocatable.c0000644000076400007640000003353411312007552016765 0ustar jortonjorton/* Provide relocatable packages. Copyright (C) 2003-2006 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Tell glibc's to provide a prototype for getline(). This must come before because may include , and once has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #include /* Specification. */ #include "relocatable.h" #if ENABLE_RELOCATABLE #include #include #include #include #ifdef NO_XMALLOC # define xmalloc malloc #else # include "xalloc.h" #endif #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ # define WIN32_LEAN_AND_MEAN # include #endif #if DEPENDS_ON_LIBCHARSET # include #endif #if DEPENDS_ON_LIBICONV && HAVE_ICONV # include #endif #if DEPENDS_ON_LIBINTL && ENABLE_NLS # include #endif /* Faked cheap 'bool'. */ #undef bool #undef false #undef true #define bool int #define false 0 #define true 1 /* Pathname support. ISSLASH(C) tests whether C is a directory separator character. IS_PATH_WITH_DIR(P) tests whether P contains a directory specification. */ #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Win32, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') # define HAS_DEVICE(P) \ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ && (P)[1] == ':') # define IS_PATH_WITH_DIR(P) \ (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P)) # define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0) #else /* Unix */ # define ISSLASH(C) ((C) == '/') # define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL) # define FILE_SYSTEM_PREFIX_LEN(P) 0 #endif /* Original installation prefix. */ static char *orig_prefix; static size_t orig_prefix_len; /* Current installation prefix. */ static char *curr_prefix; static size_t curr_prefix_len; /* These prefixes do not end in a slash. Anything that will be concatenated to them must start with a slash. */ /* Sets the original and the current installation prefix of this module. Relocation simply replaces a pathname starting with the original prefix by the corresponding pathname with the current prefix instead. Both prefixes should be directory names without trailing slash (i.e. use "" instead of "/"). */ static void set_this_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg) { if (orig_prefix_arg != NULL && curr_prefix_arg != NULL /* Optimization: if orig_prefix and curr_prefix are equal, the relocation is a nop. */ && strcmp (orig_prefix_arg, curr_prefix_arg) != 0) { /* Duplicate the argument strings. */ char *memory; orig_prefix_len = strlen (orig_prefix_arg); curr_prefix_len = strlen (curr_prefix_arg); memory = (char *) xmalloc (orig_prefix_len + 1 + curr_prefix_len + 1); #ifdef NO_XMALLOC if (memory != NULL) #endif { memcpy (memory, orig_prefix_arg, orig_prefix_len + 1); orig_prefix = memory; memory += orig_prefix_len + 1; memcpy (memory, curr_prefix_arg, curr_prefix_len + 1); curr_prefix = memory; return; } } orig_prefix = NULL; curr_prefix = NULL; /* Don't worry about wasted memory here - this function is usually only called once. */ } /* Sets the original and the current installation prefix of the package. Relocation simply replaces a pathname starting with the original prefix by the corresponding pathname with the current prefix instead. Both prefixes should be directory names without trailing slash (i.e. use "" instead of "/"). */ void set_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg) { set_this_relocation_prefix (orig_prefix_arg, curr_prefix_arg); /* Now notify all dependent libraries. */ #if DEPENDS_ON_LIBCHARSET libcharset_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg); #endif #if DEPENDS_ON_LIBICONV && HAVE_ICONV && _LIBICONV_VERSION >= 0x0109 libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg); #endif #if DEPENDS_ON_LIBINTL && ENABLE_NLS && defined libintl_set_relocation_prefix libintl_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg); #endif } #if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR) /* Convenience function: Computes the current installation prefix, based on the original installation prefix, the original installation directory of a particular file, and the current pathname of this file. Returns NULL upon failure. */ #ifdef IN_LIBRARY #define compute_curr_prefix local_compute_curr_prefix static #endif const char * compute_curr_prefix (const char *orig_installprefix, const char *orig_installdir, const char *curr_pathname) { const char *curr_installdir; const char *rel_installdir; if (curr_pathname == NULL) return NULL; /* Determine the relative installation directory, relative to the prefix. This is simply the difference between orig_installprefix and orig_installdir. */ if (strncmp (orig_installprefix, orig_installdir, strlen (orig_installprefix)) != 0) /* Shouldn't happen - nothing should be installed outside $(prefix). */ return NULL; rel_installdir = orig_installdir + strlen (orig_installprefix); /* Determine the current installation directory. */ { const char *p_base = curr_pathname + FILE_SYSTEM_PREFIX_LEN (curr_pathname); const char *p = curr_pathname + strlen (curr_pathname); char *q; while (p > p_base) { p--; if (ISSLASH (*p)) break; } q = (char *) xmalloc (p - curr_pathname + 1); #ifdef NO_XMALLOC if (q == NULL) return NULL; #endif memcpy (q, curr_pathname, p - curr_pathname); q[p - curr_pathname] = '\0'; curr_installdir = q; } /* Compute the current installation prefix by removing the trailing rel_installdir from it. */ { const char *rp = rel_installdir + strlen (rel_installdir); const char *cp = curr_installdir + strlen (curr_installdir); const char *cp_base = curr_installdir + FILE_SYSTEM_PREFIX_LEN (curr_installdir); while (rp > rel_installdir && cp > cp_base) { bool same = false; const char *rpi = rp; const char *cpi = cp; while (rpi > rel_installdir && cpi > cp_base) { rpi--; cpi--; if (ISSLASH (*rpi) || ISSLASH (*cpi)) { if (ISSLASH (*rpi) && ISSLASH (*cpi)) same = true; break; } /* Do case-insensitive comparison if the filesystem is always or often case-insensitive. It's better to accept the comparison if the difference is only in case, rather than to fail. */ #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Win32, Cygwin, OS/2, DOS - case insignificant filesystem */ if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi) != (*cpi >= 'a' && *cpi <= 'z' ? *cpi - 'a' + 'A' : *cpi)) break; #else if (*rpi != *cpi) break; #endif } if (!same) break; /* The last pathname component was the same. opi and cpi now point to the slash before it. */ rp = rpi; cp = cpi; } if (rp > rel_installdir) /* Unexpected: The curr_installdir does not end with rel_installdir. */ return NULL; { size_t curr_prefix_len = cp - curr_installdir; char *curr_prefix; curr_prefix = (char *) xmalloc (curr_prefix_len + 1); #ifdef NO_XMALLOC if (curr_prefix == NULL) return NULL; #endif memcpy (curr_prefix, curr_installdir, curr_prefix_len); curr_prefix[curr_prefix_len] = '\0'; return curr_prefix; } } } #endif /* !IN_LIBRARY || PIC */ #if defined PIC && defined INSTALLDIR /* Full pathname of shared library, or NULL. */ static char *shared_library_fullname; #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ /* Determine the full pathname of the shared library when it is loaded. */ BOOL WINAPI DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved) { (void) reserved; if (event == DLL_PROCESS_ATTACH) { /* The DLL is being loaded into an application's address range. */ static char location[MAX_PATH]; if (!GetModuleFileName (module_handle, location, sizeof (location))) /* Shouldn't happen. */ return FALSE; if (!IS_PATH_WITH_DIR (location)) /* Shouldn't happen. */ return FALSE; { #if defined __CYGWIN__ /* On Cygwin, we need to convert paths coming from Win32 system calls to the Unix-like slashified notation. */ static char location_as_posix_path[2 * MAX_PATH]; /* There's no error return defined for cygwin_conv_to_posix_path. See cygwin-api/func-cygwin-conv-to-posix-path.html. Does it overflow the buffer of expected size MAX_PATH or does it truncate the path? I don't know. Let's catch both. */ cygwin_conv_to_posix_path (location, location_as_posix_path); location_as_posix_path[MAX_PATH - 1] = '\0'; if (strlen (location_as_posix_path) >= MAX_PATH - 1) /* A sign of buffer overflow or path truncation. */ return FALSE; shared_library_fullname = strdup (location_as_posix_path); #else shared_library_fullname = strdup (location); #endif } } return TRUE; } #else /* Unix except Cygwin */ static void find_shared_library_fullname () { #if defined __linux__ && __GLIBC__ >= 2 /* Linux has /proc/self/maps. glibc 2 has the getline() function. */ FILE *fp; /* Open the current process' maps file. It describes one VMA per line. */ fp = fopen ("/proc/self/maps", "r"); if (fp) { unsigned long address = (unsigned long) &find_shared_library_fullname; for (;;) { unsigned long start, end; int c; if (fscanf (fp, "%lx-%lx", &start, &end) != 2) break; if (address >= start && address <= end - 1) { /* Found it. Now see if this line contains a filename. */ while (c = getc (fp), c != EOF && c != '\n' && c != '/') continue; if (c == '/') { size_t size; int len; ungetc (c, fp); shared_library_fullname = NULL; size = 0; len = getline (&shared_library_fullname, &size, fp); if (len >= 0) { /* Success: filled shared_library_fullname. */ if (len > 0 && shared_library_fullname[len - 1] == '\n') shared_library_fullname[len - 1] = '\0'; } } break; } while (c = getc (fp), c != EOF && c != '\n') continue; } fclose (fp); } #endif } #endif /* (WIN32 or Cygwin) / (Unix except Cygwin) */ /* Return the full pathname of the current shared library. Return NULL if unknown. Guaranteed to work only on Linux, Cygwin and Woe32. */ static char * get_shared_library_fullname () { #if !(defined _WIN32 || defined __WIN32__ || defined __CYGWIN__) static bool tried_find_shared_library_fullname; if (!tried_find_shared_library_fullname) { find_shared_library_fullname (); tried_find_shared_library_fullname = true; } #endif return shared_library_fullname; } #endif /* PIC */ /* Returns the pathname, relocated according to the current installation directory. */ const char * relocate (const char *pathname) { #if defined PIC && defined INSTALLDIR static int initialized; /* Initialization code for a shared library. */ if (!initialized) { /* At this point, orig_prefix and curr_prefix likely have already been set through the main program's set_program_name_and_installdir function. This is sufficient in the case that the library has initially been installed in the same orig_prefix. But we can do better, to also cover the cases that 1. it has been installed in a different prefix before being moved to orig_prefix and (later) to curr_prefix, 2. unlike the program, it has not moved away from orig_prefix. */ const char *orig_installprefix = INSTALLPREFIX; const char *orig_installdir = INSTALLDIR; const char *curr_prefix_better; curr_prefix_better = compute_curr_prefix (orig_installprefix, orig_installdir, get_shared_library_fullname ()); if (curr_prefix_better == NULL) curr_prefix_better = curr_prefix; set_relocation_prefix (orig_installprefix, curr_prefix_better); initialized = 1; } #endif /* Note: It is not necessary to perform case insensitive comparison here, even for DOS-like filesystems, because the pathname argument was typically created from the same Makefile variable as orig_prefix came from. */ if (orig_prefix != NULL && curr_prefix != NULL && strncmp (pathname, orig_prefix, orig_prefix_len) == 0) { if (pathname[orig_prefix_len] == '\0') /* pathname equals orig_prefix. */ return curr_prefix; if (ISSLASH (pathname[orig_prefix_len])) { /* pathname starts with orig_prefix. */ const char *pathname_tail = &pathname[orig_prefix_len]; char *result = (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1); #ifdef NO_XMALLOC if (result != NULL) #endif { memcpy (result, curr_prefix, curr_prefix_len); strcpy (result + curr_prefix_len, pathname_tail); return result; } } } /* Nothing to relocate. */ return pathname; } #endif cadaver-0.23.3/lib/intl/printf-parse.h0000644000076400007640000000421311312007552017117 0ustar jortonjorton/* Parse printf format string. Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _PRINTF_PARSE_H #define _PRINTF_PARSE_H #include "printf-args.h" /* Flags */ #define FLAG_GROUP 1 /* ' flag */ #define FLAG_LEFT 2 /* - flag */ #define FLAG_SHOWSIGN 4 /* + flag */ #define FLAG_SPACE 8 /* space flag */ #define FLAG_ALT 16 /* # flag */ #define FLAG_ZERO 32 /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) /* A parsed directive. */ typedef struct { const char* dir_start; const char* dir_end; int flags; const char* width_start; const char* width_end; size_t width_arg_index; const char* precision_start; const char* precision_end; size_t precision_arg_index; char conversion; /* d i o u x X f e E g G c s p n U % but not C S */ size_t arg_index; } char_directive; /* A parsed format string. */ typedef struct { size_t count; char_directive *dir; size_t max_width_length; size_t max_precision_length; } char_directives; /* Parses the format string. Fills in the number N of directives, and fills in directives[0], ..., directives[N-1], and sets directives[N].dir_start to the end of the format string. Also fills in the arg_type fields of the arguments and the needed count of arguments. */ #ifdef STATIC STATIC #else extern #endif int printf_parse (const char *format, char_directives *d, arguments *a); #endif /* _PRINTF_PARSE_H */ cadaver-0.23.3/lib/intl/plural-exp.c0000644000076400007640000000773211312007552016602 0ustar jortonjorton/* Expression parsing for plural form selection. Copyright (C) 2000-2001, 2003, 2005-2007 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "plural-exp.h" #if (defined __GNUC__ && !(__APPLE_CC__ > 1) && !defined __cplusplus) \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) /* These structs are the constant expression for the germanic plural form determination. It represents the expression "n != 1". */ static const struct expression plvar = { .nargs = 0, .operation = var, }; static const struct expression plone = { .nargs = 0, .operation = num, .val = { .num = 1 } }; struct expression GERMANIC_PLURAL = { .nargs = 2, .operation = not_equal, .val = { .args = { [0] = (struct expression *) &plvar, [1] = (struct expression *) &plone } } }; # define INIT_GERMANIC_PLURAL() #else /* For compilers without support for ISO C 99 struct/union initializers: Initialization at run-time. */ static struct expression plvar; static struct expression plone; struct expression GERMANIC_PLURAL; static void init_germanic_plural () { if (plone.val.num == 0) { plvar.nargs = 0; plvar.operation = var; plone.nargs = 0; plone.operation = num; plone.val.num = 1; GERMANIC_PLURAL.nargs = 2; GERMANIC_PLURAL.operation = not_equal; GERMANIC_PLURAL.val.args[0] = &plvar; GERMANIC_PLURAL.val.args[1] = &plone; } } # define INIT_GERMANIC_PLURAL() init_germanic_plural () #endif void internal_function EXTRACT_PLURAL_EXPRESSION (const char *nullentry, const struct expression **pluralp, unsigned long int *npluralsp) { if (nullentry != NULL) { const char *plural; const char *nplurals; plural = strstr (nullentry, "plural="); nplurals = strstr (nullentry, "nplurals="); if (plural == NULL || nplurals == NULL) goto no_plural; else { char *endp; unsigned long int n; struct parse_args args; /* First get the number. */ nplurals += 9; while (*nplurals != '\0' && isspace ((unsigned char) *nplurals)) ++nplurals; if (!(*nplurals >= '0' && *nplurals <= '9')) goto no_plural; #if defined HAVE_STRTOUL || defined _LIBC n = strtoul (nplurals, &endp, 10); #else for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++) n = n * 10 + (*endp - '0'); #endif if (nplurals == endp) goto no_plural; *npluralsp = n; /* Due to the restrictions bison imposes onto the interface of the scanner function we have to put the input string and the result passed up from the parser into the same structure which address is passed down to the parser. */ plural += 7; args.cp = plural; if (PLURAL_PARSE (&args) != 0) goto no_plural; *pluralp = args.res; } } else { /* By default we are using the Germanic form: singular form only for `one', the plural form otherwise. Yes, this is also what English is using since English is a Germanic language. */ no_plural: INIT_GERMANIC_PLURAL (); *pluralp = &GERMANIC_PLURAL; *npluralsp = 2; } } cadaver-0.23.3/lib/intl/osdep.c0000644000076400007640000000174111312007552015615 0ustar jortonjorton/* OS dependent parts of libintl. Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if defined __CYGWIN__ # include "intl-exports.c" #elif defined __EMX__ # include "os2compat.c" #else /* Avoid AIX compiler warning. */ typedef int dummy; #endif cadaver-0.23.3/lib/intl/intl-exports.c0000644000076400007640000000273311312007552017155 0ustar jortonjorton/* List of exported symbols of libintl on Cygwin. Copyright (C) 2006 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* IMP(x) is a symbol that contains the address of x. */ #define IMP(x) _imp__##x /* Ensure that the variable x is exported from the library, and that a pseudo-variable IMP(x) is available. */ #define VARIABLE(x) \ /* Export x without redefining x. This code was found by compiling a \ snippet: \ extern __declspec(dllexport) int x; int x = 42; */ \ asm (".section .drectve\n"); \ asm (".ascii \" -export:" #x ",data\"\n"); \ asm (".data\n"); \ /* Allocate a pseudo-variable IMP(x). */ \ extern int x; \ void * IMP(x) = &x; VARIABLE(libintl_version) cadaver-0.23.3/lib/intl/vasnprintf.c0000644000076400007640000035070311312007552016702 0ustar jortonjorton/* vsprintf with automatic memory allocation. Copyright (C) 1999, 2002-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file can be parametrized with the following macros: VASNPRINTF The name of the function being defined. FCHAR_T The element type of the format string. DCHAR_T The element type of the destination (result) string. FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters in the format string are ASCII. MUST be set if FCHAR_T and DCHAR_T are not the same type. DIRECTIVE Structure denoting a format directive. Depends on FCHAR_T. DIRECTIVES Structure denoting the set of format directives of a format string. Depends on FCHAR_T. PRINTF_PARSE Function that parses a format string. Depends on FCHAR_T. DCHAR_CPY memcpy like function for DCHAR_T[] arrays. DCHAR_SET memset like function for DCHAR_T[] arrays. DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. SNPRINTF The system's snprintf (or similar) function. This may be either snprintf or swprintf. TCHAR_T The element type of the argument and result string of the said SNPRINTF function. This may be either char or wchar_t. The code exploits that sizeof (TCHAR_T) | sizeof (DCHAR_T) and alignof (TCHAR_T) <= alignof (DCHAR_T). DCHAR_IS_TCHAR Set to 1 if DCHAR_T and TCHAR_T are the same type. DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[]. DCHAR_IS_UINT8_T Set to 1 if DCHAR_T is uint8_t. DCHAR_IS_UINT16_T Set to 1 if DCHAR_T is uint16_t. DCHAR_IS_UINT32_T Set to 1 if DCHAR_T is uint32_t. */ /* Tell glibc's to provide a prototype for snprintf(). This must come before because may include , and once has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #ifndef VASNPRINTF # include #endif #ifndef IN_LIBINTL # include #endif /* Specification. */ #ifndef VASNPRINTF # if WIDE_CHAR_VERSION # include "vasnwprintf.h" # else # include "vasnprintf.h" # endif #endif #include /* localeconv() */ #include /* snprintf(), sprintf() */ #include /* abort(), malloc(), realloc(), free() */ #include /* memcpy(), strlen() */ #include /* errno */ #include /* CHAR_BIT */ #include /* DBL_MAX_EXP, LDBL_MAX_EXP */ #if HAVE_NL_LANGINFO # include #endif #ifndef VASNPRINTF # if WIDE_CHAR_VERSION # include "wprintf-parse.h" # else # include "printf-parse.h" # endif #endif /* Checked size_t computations. */ #include "xsize.h" #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL # include # include "float+.h" #endif #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL # include # include "isnan.h" #endif #if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL # include # include "isnanl-nolibm.h" # include "fpucw.h" #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL # include # include "isnan.h" # include "printf-frexp.h" #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL # include # include "isnanl-nolibm.h" # include "printf-frexpl.h" # include "fpucw.h" #endif /* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ #ifndef EOVERFLOW # define EOVERFLOW E2BIG #endif #if HAVE_WCHAR_T # if HAVE_WCSLEN # define local_wcslen wcslen # else /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid a dependency towards this library, here is a local substitute. Define this substitute only once, even if this file is included twice in the same compilation unit. */ # ifndef local_wcslen_defined # define local_wcslen_defined 1 static size_t local_wcslen (const wchar_t *s) { const wchar_t *ptr; for (ptr = s; *ptr != (wchar_t) 0; ptr++) ; return ptr - s; } # endif # endif #endif /* Default parameters. */ #ifndef VASNPRINTF # if WIDE_CHAR_VERSION # define VASNPRINTF vasnwprintf # define FCHAR_T wchar_t # define DCHAR_T wchar_t # define TCHAR_T wchar_t # define DCHAR_IS_TCHAR 1 # define DIRECTIVE wchar_t_directive # define DIRECTIVES wchar_t_directives # define PRINTF_PARSE wprintf_parse # define DCHAR_CPY wmemcpy # else # define VASNPRINTF vasnprintf # define FCHAR_T char # define DCHAR_T char # define TCHAR_T char # define DCHAR_IS_TCHAR 1 # define DIRECTIVE char_directive # define DIRECTIVES char_directives # define PRINTF_PARSE printf_parse # define DCHAR_CPY memcpy # endif #endif #if WIDE_CHAR_VERSION /* TCHAR_T is wchar_t. */ # define USE_SNPRINTF 1 # if HAVE_DECL__SNWPRINTF /* On Windows, the function swprintf() has a different signature than on Unix; we use the _snwprintf() function instead. */ # define SNPRINTF _snwprintf # else /* Unix. */ # define SNPRINTF swprintf # endif #else /* TCHAR_T is char. */ # /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. But don't use it on BeOS, since BeOS snprintf produces no output if the size argument is >= 0x3000000. */ # if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ # define USE_SNPRINTF 1 # else # define USE_SNPRINTF 0 # endif # if HAVE_DECL__SNPRINTF /* Windows. */ # define SNPRINTF _snprintf # else /* Unix. */ # define SNPRINTF snprintf /* Here we need to call the native snprintf, not rpl_snprintf. */ # undef snprintf # endif #endif /* Here we need to call the native sprintf, not rpl_sprintf. */ #undef sprintf #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL /* Determine the decimal-point character according to the current locale. */ # ifndef decimal_point_char_defined # define decimal_point_char_defined 1 static char decimal_point_char () { const char *point; /* Determine it in a multithread-safe way. We know nl_langinfo is multithread-safe on glibc systems, but is not required to be multithread- safe by POSIX. sprintf(), however, is multithread-safe. localeconv() is rarely multithread-safe. */ # if HAVE_NL_LANGINFO && __GLIBC__ point = nl_langinfo (RADIXCHAR); # elif 1 char pointbuf[5]; sprintf (pointbuf, "%#.0f", 1.0); point = &pointbuf[1]; # else point = localeconv () -> decimal_point; # endif /* The decimal point is always a single byte: either '.' or ','. */ return (point[0] != '\0' ? point[0] : '.'); } # endif #endif #if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ static int is_infinite_or_zero (double x) { return isnan (x) || x + x == x; } #endif #if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL /* Equivalent to !isfinite(x), but does not require libm. */ static int is_infinitel (long double x) { return isnanl (x) || (x + x == x && x != 0.0L); } #endif #if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL /* Converting 'long double' to decimal without rare rounding bugs requires real bignums. We use the naming conventions of GNU gmp, but vastly simpler (and slower) algorithms. */ typedef unsigned int mp_limb_t; # define GMP_LIMB_BITS 32 typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1]; typedef unsigned long long mp_twolimb_t; # define GMP_TWOLIMB_BITS 64 typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1]; /* Representation of a bignum >= 0. */ typedef struct { size_t nlimbs; mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc(). */ } mpn_t; /* Compute the product of two bignums >= 0. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * multiply (mpn_t src1, mpn_t src2, mpn_t *dest) { const mp_limb_t *p1; const mp_limb_t *p2; size_t len1; size_t len2; if (src1.nlimbs <= src2.nlimbs) { len1 = src1.nlimbs; p1 = src1.limbs; len2 = src2.nlimbs; p2 = src2.limbs; } else { len1 = src2.nlimbs; p1 = src2.limbs; len2 = src1.nlimbs; p2 = src1.limbs; } /* Now 0 <= len1 <= len2. */ if (len1 == 0) { /* src1 or src2 is zero. */ dest->nlimbs = 0; dest->limbs = (mp_limb_t *) malloc (1); } else { /* Here 1 <= len1 <= len2. */ size_t dlen; mp_limb_t *dp; size_t k, i, j; dlen = len1 + len2; dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); if (dp == NULL) return NULL; for (k = len2; k > 0; ) dp[--k] = 0; for (i = 0; i < len1; i++) { mp_limb_t digit1 = p1[i]; mp_twolimb_t carry = 0; for (j = 0; j < len2; j++) { mp_limb_t digit2 = p2[j]; carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; carry += dp[i + j]; dp[i + j] = (mp_limb_t) carry; carry = carry >> GMP_LIMB_BITS; } dp[i + len2] = (mp_limb_t) carry; } /* Normalise. */ while (dlen > 0 && dp[dlen - 1] == 0) dlen--; dest->nlimbs = dlen; dest->limbs = dp; } return dest->limbs; } /* Compute the quotient of a bignum a >= 0 and a bignum b > 0. a is written as a = q * b + r with 0 <= r < b. q is the quotient, r the remainder. Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, q is incremented. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * divide (mpn_t a, mpn_t b, mpn_t *q) { /* Algorithm: First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]] with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS). If m=n=1, perform a single-precision division: r:=0, j:=m, while j>0 do {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j = = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r=n>1, perform a multiple-precision division: We have a/b < beta^(m-n+1). s:=intDsize-1-(hightest bit in b[n-1]), 0<=s=beta/2. For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} Compute q* : q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]). In case of overflow (q* >= beta) set q* := beta-1. Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2] and c3 := b[n-2] * q*. {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow occurred. Furthermore 0 <= c3 < beta^2. If there was overflow and r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2, the next test can be skipped.} While c3 > c2, {Here 0 <= c2 < c3 < beta^2} Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2]. If q* > 0: Put r := r - b * q* * beta^j. In detail: [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]]. hence: u:=0, for i:=0 to n-1 do u := u + q* * b[i], r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry), u:=u div beta (+ 1, if carry in subtraction) r[n+j]:=r[n+j]-u. {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1 < q* + 1 <= beta, the carry u does not overflow.} If a negative carry occurs, put q* := q* - 1 and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]]. Set q[j] := q*. Normalise [q[m-n],..,q[0]]; this yields the quotient q. Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the rest r. The room for q[j] can be allocated at the memory location of r[n+j]. Finally, round-to-even: Shift r left by 1 bit. If r > b or if r = b and q[0] is odd, q := q+1. */ const mp_limb_t *a_ptr = a.limbs; size_t a_len = a.nlimbs; const mp_limb_t *b_ptr = b.limbs; size_t b_len = b.nlimbs; mp_limb_t *roomptr; mp_limb_t *tmp_roomptr = NULL; mp_limb_t *q_ptr; size_t q_len; mp_limb_t *r_ptr; size_t r_len; /* Allocate room for a_len+2 digits. (Need a_len+1 digits for the real division and 1 more digit for the final rounding of q.) */ roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); if (roomptr == NULL) return NULL; /* Normalise a. */ while (a_len > 0 && a_ptr[a_len - 1] == 0) a_len--; /* Normalise b. */ for (;;) { if (b_len == 0) /* Division by zero. */ abort (); if (b_ptr[b_len - 1] == 0) b_len--; else break; } /* Here m = a_len >= 0 and n = b_len > 0. */ if (a_len < b_len) { /* m beta^(m-2) <= a/b < beta^m */ r_ptr = roomptr; q_ptr = roomptr + 1; { mp_limb_t den = b_ptr[0]; mp_limb_t remainder = 0; const mp_limb_t *sourceptr = a_ptr + a_len; mp_limb_t *destptr = q_ptr + a_len; size_t count; for (count = a_len; count > 0; count--) { mp_twolimb_t num = ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; *--destptr = num / den; remainder = num % den; } /* Normalise and store r. */ if (remainder > 0) { r_ptr[0] = remainder; r_len = 1; } else r_len = 0; /* Normalise q. */ q_len = a_len; if (q_ptr[q_len - 1] == 0) q_len--; } } else { /* n>1: multiple precision division. beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> beta^(m-n-1) <= a/b < beta^(m-n+1). */ /* Determine s. */ size_t s; { mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ s = 31; if (msd >= 0x10000) { msd = msd >> 16; s -= 16; } if (msd >= 0x100) { msd = msd >> 8; s -= 8; } if (msd >= 0x10) { msd = msd >> 4; s -= 4; } if (msd >= 0x4) { msd = msd >> 2; s -= 2; } if (msd >= 0x2) { msd = msd >> 1; s -= 1; } } /* 0 <= s < GMP_LIMB_BITS. Copy b, shifting it left by s bits. */ if (s > 0) { tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); if (tmp_roomptr == NULL) { free (roomptr); return NULL; } { const mp_limb_t *sourceptr = b_ptr; mp_limb_t *destptr = tmp_roomptr; mp_twolimb_t accu = 0; size_t count; for (count = b_len; count > 0; count--) { accu += (mp_twolimb_t) *sourceptr++ << s; *destptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } /* accu must be zero, since that was how s was determined. */ if (accu != 0) abort (); } b_ptr = tmp_roomptr; } /* Copy a, shifting it left by s bits, yields r. Memory layout: At the beginning: r = roomptr[0..a_len], at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ r_ptr = roomptr; if (s == 0) { memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); r_ptr[a_len] = 0; } else { const mp_limb_t *sourceptr = a_ptr; mp_limb_t *destptr = r_ptr; mp_twolimb_t accu = 0; size_t count; for (count = a_len; count > 0; count--) { accu += (mp_twolimb_t) *sourceptr++ << s; *destptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } *destptr++ = (mp_limb_t) accu; } q_ptr = roomptr + b_len; q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */ { size_t j = a_len - b_len; /* m-n */ mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; /* Division loop, traversed m-n+1 times. j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ for (;;) { mp_limb_t q_star; mp_limb_t c1; if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ { /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ mp_twolimb_t num = ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) | r_ptr[j + b_len - 1]; q_star = num / b_msd; c1 = num % b_msd; } else { /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) {<= beta !}. If yes, jump directly to the subtraction loop. (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ if (r_ptr[j + b_len] > b_msd || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) /* r[j+n] >= b[n-1]+1 or r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a carry. */ goto subtract; } /* q_star = q*, c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, 0, decrease it by b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 this can happen only twice. */ if (c3 > c2) { q_star = q_star - 1; /* q* := q* - 1 */ if (c3 - c2 > b_msdd) q_star = q_star - 1; /* q* := q* - 1 */ } } if (q_star > 0) subtract: { /* Subtract r := r - b * q* * beta^j. */ mp_limb_t cr; { const mp_limb_t *sourceptr = b_ptr; mp_limb_t *destptr = r_ptr + j; mp_twolimb_t carry = 0; size_t count; for (count = b_len; count > 0; count--) { /* Here 0 <= carry <= q*. */ carry = carry + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ + (mp_limb_t) ~(*destptr); /* Here 0 <= carry <= beta*q* + beta-1. */ *destptr++ = ~(mp_limb_t) carry; carry = carry >> GMP_LIMB_BITS; /* <= q* */ } cr = (mp_limb_t) carry; } /* Subtract cr from r_ptr[j + b_len], then forget about r_ptr[j + b_len]. */ if (cr > r_ptr[j + b_len]) { /* Subtraction gave a carry. */ q_star = q_star - 1; /* q* := q* - 1 */ /* Add b back. */ { const mp_limb_t *sourceptr = b_ptr; mp_limb_t *destptr = r_ptr + j; mp_limb_t carry = 0; size_t count; for (count = b_len; count > 0; count--) { mp_limb_t source1 = *sourceptr++; mp_limb_t source2 = *destptr; *destptr++ = source1 + source2 + carry; carry = (carry ? source1 >= (mp_limb_t) ~source2 : source1 > (mp_limb_t) ~source2); } } /* Forget about the carry and about r[j+n]. */ } } /* q* is determined. Store it as q[j]. */ q_ptr[j] = q_star; if (j == 0) break; j--; } } r_len = b_len; /* Normalise q. */ if (q_ptr[q_len - 1] == 0) q_len--; # if 0 /* Not needed here, since we need r only to compare it with b/2, and b is shifted left by s bits. */ /* Shift r right by s bits. */ if (s > 0) { mp_limb_t ptr = r_ptr + r_len; mp_twolimb_t accu = 0; size_t count; for (count = r_len; count > 0; count--) { accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); } } # endif /* Normalise r. */ while (r_len > 0 && r_ptr[r_len - 1] == 0) r_len--; } /* Compare r << 1 with b. */ if (r_len > b_len) goto increment_q; { size_t i; for (i = b_len;;) { mp_limb_t r_i = (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) | (i < r_len ? r_ptr[i] << 1 : 0); mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); if (r_i > b_i) goto increment_q; if (r_i < b_i) goto keep_q; if (i == 0) break; i--; } } if (q_len > 0 && ((q_ptr[0] & 1) != 0)) /* q is odd. */ increment_q: { size_t i; for (i = 0; i < q_len; i++) if (++(q_ptr[i]) != 0) goto keep_q; q_ptr[q_len++] = 1; } keep_q: if (tmp_roomptr != NULL) free (tmp_roomptr); q->limbs = q_ptr; q->nlimbs = q_len; return roomptr; } /* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal representation. Destroys the contents of a. Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * convert_to_decimal (mpn_t a, size_t extra_zeroes) { mp_limb_t *a_ptr = a.limbs; size_t a_len = a.nlimbs; /* 0.03345 is slightly larger than log(2)/(9*log(10)). */ size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1); char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes)); if (c_ptr != NULL) { char *d_ptr = c_ptr; for (; extra_zeroes > 0; extra_zeroes--) *d_ptr++ = '0'; while (a_len > 0) { /* Divide a by 10^9, in-place. */ mp_limb_t remainder = 0; mp_limb_t *ptr = a_ptr + a_len; size_t count; for (count = a_len; count > 0; count--) { mp_twolimb_t num = ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; *ptr = num / 1000000000; remainder = num % 1000000000; } /* Store the remainder as 9 decimal digits. */ for (count = 9; count > 0; count--) { *d_ptr++ = '0' + (remainder % 10); remainder = remainder / 10; } /* Normalize a. */ if (a_ptr[a_len - 1] == 0) a_len--; } /* Remove leading zeroes. */ while (d_ptr > c_ptr && d_ptr[-1] == '0') d_ptr--; /* But keep at least one zero. */ if (d_ptr == c_ptr) *d_ptr++ = '0'; /* Terminate the string. */ *d_ptr = '\0'; } return c_ptr; } # if NEED_PRINTF_LONG_DOUBLE /* Assuming x is finite and >= 0: write x as x = 2^e * m, where m is a bignum. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * decode_long_double (long double x, int *ep, mpn_t *mp) { mpn_t m; int exp; long double y; size_t i; /* Allocate memory for result. */ m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); if (m.limbs == NULL) return NULL; /* Split into exponential part and mantissa. */ y = frexpl (x, &exp); if (!(y >= 0.0L && y < 1.0L)) abort (); /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the latter is an integer. */ /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs. I'm not sure whether it's safe to cast a 'long double' value between 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', doesn't matter). */ # if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 # if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2)); hi = (int) y; y -= hi; if (!(y >= 0.0L && y < 1.0L)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0L && y < 1.0L)) abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; } # else { mp_limb_t d; y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS); d = (int) y; y -= d; if (!(y >= 0.0L && y < 1.0L)) abort (); m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; } # endif # endif for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); hi = (int) y; y -= hi; if (!(y >= 0.0L && y < 1.0L)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0L && y < 1.0L)) abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } if (!(y == 0.0L)) abort (); /* Normalise. */ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) m.nlimbs--; *mp = m; *ep = exp - LDBL_MANT_BIT; return m.limbs; } # endif # if NEED_PRINTF_DOUBLE /* Assuming x is finite and >= 0: write x as x = 2^e * m, where m is a bignum. Return the allocated memory in case of success, NULL in case of memory allocation failure. */ static void * decode_double (double x, int *ep, mpn_t *mp) { mpn_t m; int exp; double y; size_t i; /* Allocate memory for result. */ m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); if (m.limbs == NULL) return NULL; /* Split into exponential part and mantissa. */ y = frexp (x, &exp); if (!(y >= 0.0 && y < 1.0)) abort (); /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the latter is an integer. */ /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs. I'm not sure whether it's safe to cast a 'double' value between 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', doesn't matter). */ # if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0 # if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2)); hi = (int) y; y -= hi; if (!(y >= 0.0 && y < 1.0)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0 && y < 1.0)) abort (); m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; } # else { mp_limb_t d; y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS); d = (int) y; y -= d; if (!(y >= 0.0 && y < 1.0)) abort (); m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d; } # endif # endif for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) { mp_limb_t hi, lo; y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); hi = (int) y; y -= hi; if (!(y >= 0.0 && y < 1.0)) abort (); y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); lo = (int) y; y -= lo; if (!(y >= 0.0 && y < 1.0)) abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } if (!(y == 0.0)) abort (); /* Normalise. */ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) m.nlimbs--; *mp = m; *ep = exp - DBL_MANT_BIT; return m.limbs; } # endif /* Assuming x = 2^e * m is finite and >= 0, and n is an integer: Returns the decimal representation of round (x * 10^n). Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) { int s; size_t extra_zeroes; unsigned int abs_n; unsigned int abs_s; mp_limb_t *pow5_ptr; size_t pow5_len; unsigned int s_limbs; unsigned int s_bits; mpn_t pow5; mpn_t z; void *z_memory; char *digits; if (memory == NULL) return NULL; /* x = 2^e * m, hence y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) = round (2^s * 5^n * m). */ s = e + n; extra_zeroes = 0; /* Factor out a common power of 10 if possible. */ if (s > 0 && n > 0) { extra_zeroes = (s < n ? s : n); s -= extra_zeroes; n -= extra_zeroes; } /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes. Before converting to decimal, we need to compute z = round (2^s * 5^n * m). */ /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same sign. 2.322 is slightly larger than log(5)/log(2). */ abs_n = (n >= 0 ? n : -n); abs_s = (s >= 0 ? s : -s); pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 + abs_s / GMP_LIMB_BITS + 1) * sizeof (mp_limb_t)); if (pow5_ptr == NULL) { free (memory); return NULL; } /* Initialize with 1. */ pow5_ptr[0] = 1; pow5_len = 1; /* Multiply with 5^|n|. */ if (abs_n > 0) { static mp_limb_t const small_pow5[13 + 1] = { 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 48828125, 244140625, 1220703125 }; unsigned int n13; for (n13 = 0; n13 <= abs_n; n13 += 13) { mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; size_t j; mp_twolimb_t carry = 0; for (j = 0; j < pow5_len; j++) { mp_limb_t digit2 = pow5_ptr[j]; carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; pow5_ptr[j] = (mp_limb_t) carry; carry = carry >> GMP_LIMB_BITS; } if (carry > 0) pow5_ptr[pow5_len++] = (mp_limb_t) carry; } } s_limbs = abs_s / GMP_LIMB_BITS; s_bits = abs_s % GMP_LIMB_BITS; if (n >= 0 ? s >= 0 : s <= 0) { /* Multiply with 2^|s|. */ if (s_bits > 0) { mp_limb_t *ptr = pow5_ptr; mp_twolimb_t accu = 0; size_t count; for (count = pow5_len; count > 0; count--) { accu += (mp_twolimb_t) *ptr << s_bits; *ptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } if (accu > 0) { *ptr = (mp_limb_t) accu; pow5_len++; } } if (s_limbs > 0) { size_t count; for (count = pow5_len; count > 0;) { count--; pow5_ptr[s_limbs + count] = pow5_ptr[count]; } for (count = s_limbs; count > 0;) { count--; pow5_ptr[count] = 0; } pow5_len += s_limbs; } pow5.limbs = pow5_ptr; pow5.nlimbs = pow5_len; if (n >= 0) { /* Multiply m with pow5. No division needed. */ z_memory = multiply (m, pow5, &z); } else { /* Divide m by pow5 and round. */ z_memory = divide (m, pow5, &z); } } else { pow5.limbs = pow5_ptr; pow5.nlimbs = pow5_len; if (n >= 0) { /* n >= 0, s < 0. Multiply m with pow5, then divide by 2^|s|. */ mpn_t numerator; mpn_t denominator; void *tmp_memory; tmp_memory = multiply (m, pow5, &numerator); if (tmp_memory == NULL) { free (pow5_ptr); free (memory); return NULL; } /* Construct 2^|s|. */ { mp_limb_t *ptr = pow5_ptr + pow5_len; size_t i; for (i = 0; i < s_limbs; i++) ptr[i] = 0; ptr[s_limbs] = (mp_limb_t) 1 << s_bits; denominator.limbs = ptr; denominator.nlimbs = s_limbs + 1; } z_memory = divide (numerator, denominator, &z); free (tmp_memory); } else { /* n < 0, s > 0. Multiply m with 2^s, then divide by pow5. */ mpn_t numerator; mp_limb_t *num_ptr; num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) * sizeof (mp_limb_t)); if (num_ptr == NULL) { free (pow5_ptr); free (memory); return NULL; } { mp_limb_t *destptr = num_ptr; { size_t i; for (i = 0; i < s_limbs; i++) *destptr++ = 0; } if (s_bits > 0) { const mp_limb_t *sourceptr = m.limbs; mp_twolimb_t accu = 0; size_t count; for (count = m.nlimbs; count > 0; count--) { accu += (mp_twolimb_t) *sourceptr++ << s_bits; *destptr++ = (mp_limb_t) accu; accu = accu >> GMP_LIMB_BITS; } if (accu > 0) *destptr++ = (mp_limb_t) accu; } else { const mp_limb_t *sourceptr = m.limbs; size_t count; for (count = m.nlimbs; count > 0; count--) *destptr++ = *sourceptr++; } numerator.limbs = num_ptr; numerator.nlimbs = destptr - num_ptr; } z_memory = divide (numerator, pow5, &z); free (num_ptr); } } free (pow5_ptr); free (memory); /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ if (z_memory == NULL) return NULL; digits = convert_to_decimal (z, extra_zeroes); free (z_memory); return digits; } # if NEED_PRINTF_LONG_DOUBLE /* Assuming x is finite and >= 0, and n is an integer: Returns the decimal representation of round (x * 10^n). Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * scale10_round_decimal_long_double (long double x, int n) { int e; mpn_t m; void *memory = decode_long_double (x, &e, &m); return scale10_round_decimal_decoded (e, m, memory, n); } # endif # if NEED_PRINTF_DOUBLE /* Assuming x is finite and >= 0, and n is an integer: Returns the decimal representation of round (x * 10^n). Return the allocated memory - containing the decimal digits in low-to-high order, terminated with a NUL character - in case of success, NULL in case of memory allocation failure. */ static char * scale10_round_decimal_double (double x, int n) { int e; mpn_t m; void *memory = decode_double (x, &e, &m); return scale10_round_decimal_decoded (e, m, memory, n); } # endif # if NEED_PRINTF_LONG_DOUBLE /* Assuming x is finite and > 0: Return an approximation for n with 10^n <= x < 10^(n+1). The approximation is usually the right n, but may be off by 1 sometimes. */ static int floorlog10l (long double x) { int exp; long double y; double z; double l; /* Split into exponential part and mantissa. */ y = frexpl (x, &exp); if (!(y >= 0.0L && y < 1.0L)) abort (); if (y == 0.0L) return INT_MIN; if (y < 0.5L) { while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) { y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); exp -= GMP_LIMB_BITS; } if (y < (1.0L / (1 << 16))) { y *= 1.0L * (1 << 16); exp -= 16; } if (y < (1.0L / (1 << 8))) { y *= 1.0L * (1 << 8); exp -= 8; } if (y < (1.0L / (1 << 4))) { y *= 1.0L * (1 << 4); exp -= 4; } if (y < (1.0L / (1 << 2))) { y *= 1.0L * (1 << 2); exp -= 2; } if (y < (1.0L / (1 << 1))) { y *= 1.0L * (1 << 1); exp -= 1; } } if (!(y >= 0.5L && y < 1.0L)) abort (); /* Compute an approximation for l = log2(x) = exp + log2(y). */ l = exp; z = y; if (z < 0.70710678118654752444) { z *= 1.4142135623730950488; l -= 0.5; } if (z < 0.8408964152537145431) { z *= 1.1892071150027210667; l -= 0.25; } if (z < 0.91700404320467123175) { z *= 1.0905077326652576592; l -= 0.125; } if (z < 0.9576032806985736469) { z *= 1.0442737824274138403; l -= 0.0625; } /* Now 0.95 <= z <= 1.01. */ z = 1 - z; /* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ... Four terms are enough to get an approximation with error < 10^-7. */ l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); /* Finally multiply with log(2)/log(10), yields an approximation for log10(x). */ l *= 0.30102999566398119523; /* Round down to the next integer. */ return (int) l + (l < 0 ? -1 : 0); } # endif # if NEED_PRINTF_DOUBLE /* Assuming x is finite and > 0: Return an approximation for n with 10^n <= x < 10^(n+1). The approximation is usually the right n, but may be off by 1 sometimes. */ static int floorlog10 (double x) { int exp; double y; double z; double l; /* Split into exponential part and mantissa. */ y = frexp (x, &exp); if (!(y >= 0.0 && y < 1.0)) abort (); if (y == 0.0) return INT_MIN; if (y < 0.5) { while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) { y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); exp -= GMP_LIMB_BITS; } if (y < (1.0 / (1 << 16))) { y *= 1.0 * (1 << 16); exp -= 16; } if (y < (1.0 / (1 << 8))) { y *= 1.0 * (1 << 8); exp -= 8; } if (y < (1.0 / (1 << 4))) { y *= 1.0 * (1 << 4); exp -= 4; } if (y < (1.0 / (1 << 2))) { y *= 1.0 * (1 << 2); exp -= 2; } if (y < (1.0 / (1 << 1))) { y *= 1.0 * (1 << 1); exp -= 1; } } if (!(y >= 0.5 && y < 1.0)) abort (); /* Compute an approximation for l = log2(x) = exp + log2(y). */ l = exp; z = y; if (z < 0.70710678118654752444) { z *= 1.4142135623730950488; l -= 0.5; } if (z < 0.8408964152537145431) { z *= 1.1892071150027210667; l -= 0.25; } if (z < 0.91700404320467123175) { z *= 1.0905077326652576592; l -= 0.125; } if (z < 0.9576032806985736469) { z *= 1.0442737824274138403; l -= 0.0625; } /* Now 0.95 <= z <= 1.01. */ z = 1 - z; /* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ... Four terms are enough to get an approximation with error < 10^-7. */ l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); /* Finally multiply with log(2)/log(10), yields an approximation for log10(x). */ l *= 0.30102999566398119523; /* Round down to the next integer. */ return (int) l + (l < 0 ? -1 : 0); } # endif #endif DCHAR_T * VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, const FCHAR_T *format, va_list args) { DIRECTIVES d; arguments a; if (PRINTF_PARSE (format, &d, &a) < 0) /* errno is already set. */ return NULL; #define CLEANUP() \ free (d.dir); \ if (a.arg) \ free (a.arg); if (PRINTF_FETCHARGS (args, &a) < 0) { CLEANUP (); errno = EINVAL; return NULL; } { size_t buf_neededlength; TCHAR_T *buf; TCHAR_T *buf_malloced; const FCHAR_T *cp; size_t i; DIRECTIVE *dp; /* Output string accumulator. */ DCHAR_T *result; size_t allocated; size_t length; /* Allocate a small buffer that will hold a directive passed to sprintf or snprintf. */ buf_neededlength = xsum4 (7, d.max_width_length, d.max_precision_length, 6); #if HAVE_ALLOCA if (buf_neededlength < 4000 / sizeof (TCHAR_T)) { buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); buf_malloced = NULL; } else #endif { size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); if (size_overflow_p (buf_memsize)) goto out_of_memory_1; buf = (TCHAR_T *) malloc (buf_memsize); if (buf == NULL) goto out_of_memory_1; buf_malloced = buf; } if (resultbuf != NULL) { result = resultbuf; allocated = *lengthp; } else { result = NULL; allocated = 0; } length = 0; /* Invariants: result is either == resultbuf or == NULL or malloc-allocated. If length > 0, then result != NULL. */ /* Ensures that allocated >= needed. Aborts through a jump to out_of_memory if needed is SIZE_MAX or otherwise too big. */ #define ENSURE_ALLOCATION(needed) \ if ((needed) > allocated) \ { \ size_t memory_size; \ DCHAR_T *memory; \ \ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ if ((needed) > allocated) \ allocated = (needed); \ memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ if (size_overflow_p (memory_size)) \ goto out_of_memory; \ if (result == resultbuf || result == NULL) \ memory = (DCHAR_T *) malloc (memory_size); \ else \ memory = (DCHAR_T *) realloc (result, memory_size); \ if (memory == NULL) \ goto out_of_memory; \ if (result == resultbuf && length > 0) \ DCHAR_CPY (memory, result, length); \ result = memory; \ } for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) { if (cp != dp->dir_start) { size_t n = dp->dir_start - cp; size_t augmented_length = xsum (length, n); ENSURE_ALLOCATION (augmented_length); /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we need that the format string contains only ASCII characters if FCHAR_T and DCHAR_T are not the same type. */ if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) { DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); length = augmented_length; } else { do result[length++] = (unsigned char) *cp++; while (--n > 0); } } if (i == d.count) break; /* Execute a single directive. */ if (dp->conversion == '%') { size_t augmented_length; if (!(dp->arg_index == ARG_NONE)) abort (); augmented_length = xsum (length, 1); ENSURE_ALLOCATION (augmented_length); result[length] = '%'; length = augmented_length; } else { if (!(dp->arg_index != ARG_NONE)) abort (); if (dp->conversion == 'n') { switch (a.arg[dp->arg_index].type) { case TYPE_COUNT_SCHAR_POINTER: *a.arg[dp->arg_index].a.a_count_schar_pointer = length; break; case TYPE_COUNT_SHORT_POINTER: *a.arg[dp->arg_index].a.a_count_short_pointer = length; break; case TYPE_COUNT_INT_POINTER: *a.arg[dp->arg_index].a.a_count_int_pointer = length; break; case TYPE_COUNT_LONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longint_pointer = length; break; #if HAVE_LONG_LONG_INT case TYPE_COUNT_LONGLONGINT_POINTER: *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; break; #endif default: abort (); } } #if ENABLE_UNISTDIO /* The unistdio extensions. */ else if (dp->conversion == 'U') { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; int has_width; size_t width; int has_precision; size_t precision; has_width = 0; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = (unsigned int) (-arg); } else width = arg; } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } has_width = 1; } has_precision = 0; precision = 0; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } switch (type) { case TYPE_U8_STRING: { const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; const uint8_t *arg_end; size_t characters; if (has_precision) { /* Use only PRECISION characters, from the left. */ arg_end = arg; characters = 0; for (; precision > 0; precision--) { int count = u8_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else if (has_width) { /* Use the entire string, and count the number of characters. */ arg_end = arg; characters = 0; for (;;) { int count = u8_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else { /* Use the entire string. */ arg_end = arg + u8_strlen (arg); /* The number of characters doesn't matter. */ characters = 0; } if (has_width && width > characters && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_UINT8_T { size_t n = arg_end - arg; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_CPY (result + length, arg, n); length += n; } # else { /* Convert. */ DCHAR_T *converted = result + length; size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR /* Convert from UTF-8 to locale encoding. */ if (u8_conv_to_encoding (locale_charset (), iconveh_question_mark, arg, arg_end - arg, NULL, &converted, &converted_len) < 0) # else /* Convert from UTF-8 to UTF-16/UTF-32. */ converted = U8_TO_DCHAR (arg, arg_end - arg, converted, &converted_len); if (converted == NULL) # endif { int saved_errno = errno; if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = saved_errno; return NULL; } if (converted != result + length) { ENSURE_ALLOCATION (xsum (length, converted_len)); DCHAR_CPY (result + length, converted, converted_len); free (converted); } length += converted_len; } # endif if (has_width && width > characters && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } break; case TYPE_U16_STRING: { const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; const uint16_t *arg_end; size_t characters; if (has_precision) { /* Use only PRECISION characters, from the left. */ arg_end = arg; characters = 0; for (; precision > 0; precision--) { int count = u16_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else if (has_width) { /* Use the entire string, and count the number of characters. */ arg_end = arg; characters = 0; for (;;) { int count = u16_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else { /* Use the entire string. */ arg_end = arg + u16_strlen (arg); /* The number of characters doesn't matter. */ characters = 0; } if (has_width && width > characters && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_UINT16_T { size_t n = arg_end - arg; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_CPY (result + length, arg, n); length += n; } # else { /* Convert. */ DCHAR_T *converted = result + length; size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR /* Convert from UTF-16 to locale encoding. */ if (u16_conv_to_encoding (locale_charset (), iconveh_question_mark, arg, arg_end - arg, NULL, &converted, &converted_len) < 0) # else /* Convert from UTF-16 to UTF-8/UTF-32. */ converted = U16_TO_DCHAR (arg, arg_end - arg, converted, &converted_len); if (converted == NULL) # endif { int saved_errno = errno; if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = saved_errno; return NULL; } if (converted != result + length) { ENSURE_ALLOCATION (xsum (length, converted_len)); DCHAR_CPY (result + length, converted, converted_len); free (converted); } length += converted_len; } # endif if (has_width && width > characters && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } break; case TYPE_U32_STRING: { const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; const uint32_t *arg_end; size_t characters; if (has_precision) { /* Use only PRECISION characters, from the left. */ arg_end = arg; characters = 0; for (; precision > 0; precision--) { int count = u32_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else if (has_width) { /* Use the entire string, and count the number of characters. */ arg_end = arg; characters = 0; for (;;) { int count = u32_strmblen (arg_end); if (count == 0) break; if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EILSEQ; return NULL; } arg_end += count; characters++; } } else { /* Use the entire string. */ arg_end = arg + u32_strlen (arg); /* The number of characters doesn't matter. */ characters = 0; } if (has_width && width > characters && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } # if DCHAR_IS_UINT32_T { size_t n = arg_end - arg; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_CPY (result + length, arg, n); length += n; } # else { /* Convert. */ DCHAR_T *converted = result + length; size_t converted_len = allocated - length; # if DCHAR_IS_TCHAR /* Convert from UTF-32 to locale encoding. */ if (u32_conv_to_encoding (locale_charset (), iconveh_question_mark, arg, arg_end - arg, NULL, &converted, &converted_len) < 0) # else /* Convert from UTF-32 to UTF-8/UTF-16. */ converted = U32_TO_DCHAR (arg, arg_end - arg, converted, &converted_len); if (converted == NULL) # endif { int saved_errno = errno; if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = saved_errno; return NULL; } if (converted != result + length) { ENSURE_ALLOCATION (xsum (length, converted_len)); DCHAR_CPY (result + length, converted, converted_len); free (converted); } length += converted_len; } # endif if (has_width && width > characters && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); DCHAR_SET (result + length, ' ', n); length += n; } } break; default: abort (); } } #endif #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL else if ((dp->conversion == 'a' || dp->conversion == 'A') # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) && (0 # if NEED_PRINTF_DOUBLE || a.arg[dp->arg_index].type == TYPE_DOUBLE # endif # if NEED_PRINTF_LONG_DOUBLE || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE # endif ) # endif ) { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; int has_width; size_t width; int has_precision; size_t precision; size_t tmp_length; DCHAR_T tmpbuf[700]; DCHAR_T *tmp; DCHAR_T *pad_ptr; DCHAR_T *p; has_width = 0; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = (unsigned int) (-arg); } else width = arg; } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } has_width = 1; } has_precision = 0; precision = 0; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } /* Allocate a temporary buffer of sufficient size. */ if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) ((LDBL_DIG + 1) * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) ((DBL_DIG + 1) * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); if (tmp_length < width) tmp_length = width; tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) tmp = tmpbuf; else { size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; tmp = (DCHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } pad_ptr = NULL; p = tmp; if (type == TYPE_LONGDOUBLE) { # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE long double arg = a.arg[dp->arg_index].a.a_longdouble; if (isnanl (arg)) { if (dp->conversion == 'A') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); if (signbit (arg)) /* arg < 0.0L or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0L && arg + arg == arg) { if (dp->conversion == 'A') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { int exponent; long double mantissa; if (arg > 0.0L) mantissa = printf_frexpl (arg, &exponent); else { exponent = 0; mantissa = 0.0L; } if (has_precision && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1) { /* Round the mantissa. */ long double tail = mantissa; size_t q; for (q = precision; ; q--) { int digit = (int) tail; tail -= digit; if (q == 0) { if (digit & 1 ? tail >= 0.5L : tail > 0.5L) tail = 1 - tail; else tail = - tail; break; } tail *= 16.0L; } if (tail != 0.0L) for (q = precision; q > 0; q--) tail *= 0.0625L; mantissa += tail; } *p++ = '0'; *p++ = dp->conversion - 'A' + 'X'; pad_ptr = p; { int digit; digit = (int) mantissa; mantissa -= digit; *p++ = '0' + digit; if ((flags & FLAG_ALT) || mantissa > 0.0L || precision > 0) { *p++ = decimal_point_char (); /* This loop terminates because we assume that FLT_RADIX is a power of 2. */ while (mantissa > 0.0L) { mantissa *= 16.0L; digit = (int) mantissa; mantissa -= digit; *p++ = digit + (digit < 10 ? '0' : dp->conversion - 10); if (precision > 0) precision--; } while (precision > 0) { *p++ = '0'; precision--; } } } *p++ = dp->conversion - 'A' + 'P'; # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } END_LONG_DOUBLE_ROUNDING (); } # else abort (); # endif } else { # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE double arg = a.arg[dp->arg_index].a.a_double; if (isnan (arg)) { if (dp->conversion == 'A') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; if (signbit (arg)) /* arg < 0.0 or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0 && arg + arg == arg) { if (dp->conversion == 'A') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { int exponent; double mantissa; if (arg > 0.0) mantissa = printf_frexp (arg, &exponent); else { exponent = 0; mantissa = 0.0; } if (has_precision && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) { /* Round the mantissa. */ double tail = mantissa; size_t q; for (q = precision; ; q--) { int digit = (int) tail; tail -= digit; if (q == 0) { if (digit & 1 ? tail >= 0.5 : tail > 0.5) tail = 1 - tail; else tail = - tail; break; } tail *= 16.0; } if (tail != 0.0) for (q = precision; q > 0; q--) tail *= 0.0625; mantissa += tail; } *p++ = '0'; *p++ = dp->conversion - 'A' + 'X'; pad_ptr = p; { int digit; digit = (int) mantissa; mantissa -= digit; *p++ = '0' + digit; if ((flags & FLAG_ALT) || mantissa > 0.0 || precision > 0) { *p++ = decimal_point_char (); /* This loop terminates because we assume that FLT_RADIX is a power of 2. */ while (mantissa > 0.0) { mantissa *= 16.0; digit = (int) mantissa; mantissa -= digit; *p++ = digit + (digit < 10 ? '0' : dp->conversion - 10); if (precision > 0) precision--; } while (precision > 0) { *p++ = '0'; precision--; } } } *p++ = dp->conversion - 'A' + 'P'; # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } } # else abort (); # endif } /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ if (has_width && p - tmp < width) { size_t pad = width - (p - tmp); DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) { /* Pad with spaces on the right. */ for (; pad > 0; pad--) *p++ = ' '; } else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ DCHAR_T *q = end; while (p > pad_ptr) *--q = *--p; for (; pad > 0; pad--) *p++ = '0'; } else { /* Pad with spaces on the left. */ DCHAR_T *q = end; while (p > tmp) *--q = *--p; for (; pad > 0; pad--) *p++ = ' '; } p = end; } { size_t count = p - tmp; if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); /* Make room for the result. */ if (count >= allocated - length) { size_t n = xsum (length, count); ENSURE_ALLOCATION (n); } /* Append the result. */ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); if (tmp != tmpbuf) free (tmp); length += count; } } #endif #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL else if ((dp->conversion == 'f' || dp->conversion == 'F' || dp->conversion == 'e' || dp->conversion == 'E' || dp->conversion == 'g' || dp->conversion == 'G' || dp->conversion == 'a' || dp->conversion == 'A') && (0 # if NEED_PRINTF_DOUBLE || a.arg[dp->arg_index].type == TYPE_DOUBLE # elif NEED_PRINTF_INFINITE_DOUBLE || (a.arg[dp->arg_index].type == TYPE_DOUBLE /* The systems (mingw) which produce wrong output for Inf, -Inf, and NaN also do so for -0.0. Therefore we treat this case here as well. */ && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) # endif # if NEED_PRINTF_LONG_DOUBLE || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE # elif NEED_PRINTF_INFINITE_LONG_DOUBLE || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE /* Some systems produce wrong output for Inf, -Inf, and NaN. */ && is_infinitel (a.arg[dp->arg_index].a.a_longdouble)) # endif )) { # if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) arg_type type = a.arg[dp->arg_index].type; # endif int flags = dp->flags; int has_width; size_t width; int has_precision; size_t precision; size_t tmp_length; DCHAR_T tmpbuf[700]; DCHAR_T *tmp; DCHAR_T *pad_ptr; DCHAR_T *p; has_width = 0; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = (unsigned int) (-arg); } else width = arg; } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } has_width = 1; } has_precision = 0; precision = 0; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } /* POSIX specifies the default precision to be 6 for %f, %F, %e, %E, but not for %g, %G. Implementations appear to use the same default precision also for %g, %G. */ if (!has_precision) precision = 6; /* Allocate a temporary buffer of sufficient size. */ # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); # elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); # elif NEED_PRINTF_LONG_DOUBLE tmp_length = LDBL_DIG + 1; # elif NEED_PRINTF_DOUBLE tmp_length = DBL_DIG + 1; # else tmp_length = 0; # endif if (tmp_length < precision) tmp_length = precision; # if NEED_PRINTF_LONG_DOUBLE # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE if (type == TYPE_LONGDOUBLE) # endif if (dp->conversion == 'f' || dp->conversion == 'F') { long double arg = a.arg[dp->arg_index].a.a_longdouble; if (!(isnanl (arg) || arg + arg == arg)) { /* arg is finite and nonzero. */ int exponent = floorlog10l (arg < 0 ? -arg : arg); if (exponent >= 0 && tmp_length < exponent + precision) tmp_length = exponent + precision; } } # endif # if NEED_PRINTF_DOUBLE # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE if (type == TYPE_DOUBLE) # endif if (dp->conversion == 'f' || dp->conversion == 'F') { double arg = a.arg[dp->arg_index].a.a_double; if (!(isnan (arg) || arg + arg == arg)) { /* arg is finite and nonzero. */ int exponent = floorlog10 (arg < 0 ? -arg : arg); if (exponent >= 0 && tmp_length < exponent + precision) tmp_length = exponent + precision; } } # endif /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); if (tmp_length < width) tmp_length = width; tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) tmp = tmpbuf; else { size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; tmp = (DCHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } pad_ptr = NULL; p = tmp; # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE if (type == TYPE_LONGDOUBLE) # endif { long double arg = a.arg[dp->arg_index].a.a_longdouble; if (isnanl (arg)) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); if (signbit (arg)) /* arg < 0.0L or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0L && arg + arg == arg) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { # if NEED_PRINTF_LONG_DOUBLE pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { char *digits; size_t ndigits; digits = scale10_round_decimal_long_double (arg, precision); if (digits == NULL) { END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } ndigits = strlen (digits); if (ndigits > precision) do { --ndigits; *p++ = digits[ndigits]; } while (ndigits > precision); else *p++ = '0'; /* Here ndigits <= precision. */ if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > ndigits; precision--) *p++ = '0'; while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } else if (dp->conversion == 'e' || dp->conversion == 'E') { int exponent; if (arg == 0.0L) { exponent = 0; *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } } else { /* arg > 0.0L. */ int adjusted; char *digits; size_t ndigits; exponent = floorlog10l (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_long_double (arg, (int)precision - exponent); if (digits == NULL) { END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } ndigits = strlen (digits); if (ndigits == precision + 1) break; if (ndigits < precision || ndigits > precision + 2) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits == precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision+1. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } *p++ = dp->conversion; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', '.', '2', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+.2d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+.2d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } else if (dp->conversion == 'g' || dp->conversion == 'G') { if (precision == 0) precision = 1; /* precision >= 1. */ if (arg == 0.0L) /* The exponent is 0, >= -4, < precision. Use fixed-point notation. */ { size_t ndigits = precision; /* Number of trailing zeroes that have to be dropped. */ size_t nzeroes = (flags & FLAG_ALT ? 0 : precision - 1); --ndigits; *p++ = '0'; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = '0'; } } } else { /* arg > 0.0L. */ int exponent; int adjusted; char *digits; size_t ndigits; size_t nzeroes; exponent = floorlog10l (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_long_double (arg, (int)(precision - 1) - exponent); if (digits == NULL) { END_LONG_DOUBLE_ROUNDING (); goto out_of_memory; } ndigits = strlen (digits); if (ndigits == precision) break; if (ndigits < precision - 1 || ndigits > precision + 1) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits < precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision. */ /* Determine the number of trailing zeroes that have to be dropped. */ nzeroes = 0; if ((flags & FLAG_ALT) == 0) while (nzeroes < ndigits && digits[nzeroes] == '0') nzeroes++; /* The exponent is now determined. */ if (exponent >= -4 && exponent < (long)precision) { /* Fixed-point notation: max(exponent,0)+1 digits, then the decimal point, then the remaining digits without trailing zeroes. */ if (exponent >= 0) { size_t count = exponent + 1; /* Note: count <= precision = ndigits. */ for (; count > 0; count--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { size_t count = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); for (; count > 0; count--) *p++ = '0'; while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { /* Exponential notation. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', '.', '2', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, "%+.2d", exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, "%+.2d", exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } # endif } free (digits); } } else abort (); # else /* arg is finite. */ abort (); # endif } END_LONG_DOUBLE_ROUNDING (); } } # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE else # endif # endif # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE { double arg = a.arg[dp->arg_index].a.a_double; if (isnan (arg)) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; } else { *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; } } else { int sign = 0; if (signbit (arg)) /* arg < 0.0 or negative zero */ { sign = -1; arg = -arg; } if (sign < 0) *p++ = '-'; else if (flags & FLAG_SHOWSIGN) *p++ = '+'; else if (flags & FLAG_SPACE) *p++ = ' '; if (arg > 0.0 && arg + arg == arg) { if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } else { *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; } } else { # if NEED_PRINTF_DOUBLE pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { char *digits; size_t ndigits; digits = scale10_round_decimal_double (arg, precision); if (digits == NULL) goto out_of_memory; ndigits = strlen (digits); if (ndigits > precision) do { --ndigits; *p++ = digits[ndigits]; } while (ndigits > precision); else *p++ = '0'; /* Here ndigits <= precision. */ if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > ndigits; precision--) *p++ = '0'; while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } else if (dp->conversion == 'e' || dp->conversion == 'E') { int exponent; if (arg == 0.0) { exponent = 0; *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } } else { /* arg > 0.0. */ int adjusted; char *digits; size_t ndigits; exponent = floorlog10 (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_double (arg, (int)precision - exponent); if (digits == NULL) goto out_of_memory; ndigits = strlen (digits); if (ndigits == precision + 1) break; if (ndigits < precision || ndigits > precision + 2) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits == precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision+1. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); while (ndigits > 0) { --ndigits; *p++ = digits[ndigits]; } } free (digits); } *p++ = dp->conversion; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ { '%', '+', '.', '3', 'd', '\0' }; # else { '%', '+', '.', '2', 'd', '\0' }; # endif SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else { static const char decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ "%+.3d"; # else "%+.2d"; # endif if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, decimal_format, exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, decimal_format, exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } } # endif } else if (dp->conversion == 'g' || dp->conversion == 'G') { if (precision == 0) precision = 1; /* precision >= 1. */ if (arg == 0.0) /* The exponent is 0, >= -4, < precision. Use fixed-point notation. */ { size_t ndigits = precision; /* Number of trailing zeroes that have to be dropped. */ size_t nzeroes = (flags & FLAG_ALT ? 0 : precision - 1); --ndigits; *p++ = '0'; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = '0'; } } } else { /* arg > 0.0. */ int exponent; int adjusted; char *digits; size_t ndigits; size_t nzeroes; exponent = floorlog10 (arg); adjusted = 0; for (;;) { digits = scale10_round_decimal_double (arg, (int)(precision - 1) - exponent); if (digits == NULL) goto out_of_memory; ndigits = strlen (digits); if (ndigits == precision) break; if (ndigits < precision - 1 || ndigits > precision + 1) /* The exponent was not guessed precisely enough. */ abort (); if (adjusted) /* None of two values of exponent is the right one. Prevent an endless loop. */ abort (); free (digits); if (ndigits < precision) exponent -= 1; else exponent += 1; adjusted = 1; } /* Here ndigits = precision. */ /* Determine the number of trailing zeroes that have to be dropped. */ nzeroes = 0; if ((flags & FLAG_ALT) == 0) while (nzeroes < ndigits && digits[nzeroes] == '0') nzeroes++; /* The exponent is now determined. */ if (exponent >= -4 && exponent < (long)precision) { /* Fixed-point notation: max(exponent,0)+1 digits, then the decimal point, then the remaining digits without trailing zeroes. */ if (exponent >= 0) { size_t count = exponent + 1; /* Note: count <= precision = ndigits. */ for (; count > 0; count--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { size_t count = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); for (; count > 0; count--) *p++ = '0'; while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } } else { /* Exponential notation. */ *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); while (ndigits > nzeroes) { --ndigits; *p++ = digits[ndigits]; } } *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ # if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ { '%', '+', '.', '3', 'd', '\0' }; # else { '%', '+', '.', '2', 'd', '\0' }; # endif SNPRINTF (p, 6 + 1, decimal_format, exponent); } while (*p != '\0') p++; # else { static const char decimal_format[] = /* Produce the same number of exponent digits as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ "%+.3d"; # else "%+.2d"; # endif if (sizeof (DCHAR_T) == 1) { sprintf ((char *) p, decimal_format, exponent); while (*p != '\0') p++; } else { char expbuf[6 + 1]; const char *ep; sprintf (expbuf, decimal_format, exponent); for (ep = expbuf; (*p = *ep) != '\0'; ep++) p++; } } # endif } free (digits); } } else abort (); # else /* arg is finite. */ if (!(arg == 0.0)) abort (); pad_ptr = p; if (dp->conversion == 'f' || dp->conversion == 'F') { *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } } else if (dp->conversion == 'e' || dp->conversion == 'E') { *p++ = '0'; if ((flags & FLAG_ALT) || precision > 0) { *p++ = decimal_point_char (); for (; precision > 0; precision--) *p++ = '0'; } *p++ = dp->conversion; /* 'e' or 'E' */ *p++ = '+'; /* Produce the same number of exponent digits as the native printf implementation. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ *p++ = '0'; # endif *p++ = '0'; *p++ = '0'; } else if (dp->conversion == 'g' || dp->conversion == 'G') { *p++ = '0'; if (flags & FLAG_ALT) { size_t ndigits = (precision > 0 ? precision - 1 : 0); *p++ = decimal_point_char (); for (; ndigits > 0; --ndigits) *p++ = '0'; } } else abort (); # endif } } } # endif /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ if (has_width && p - tmp < width) { size_t pad = width - (p - tmp); DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) { /* Pad with spaces on the right. */ for (; pad > 0; pad--) *p++ = ' '; } else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ DCHAR_T *q = end; while (p > pad_ptr) *--q = *--p; for (; pad > 0; pad--) *p++ = '0'; } else { /* Pad with spaces on the left. */ DCHAR_T *q = end; while (p > tmp) *--q = *--p; for (; pad > 0; pad--) *p++ = ' '; } p = end; } { size_t count = p - tmp; if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); /* Make room for the result. */ if (count >= allocated - length) { size_t n = xsum (length, count); ENSURE_ALLOCATION (n); } /* Append the result. */ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); if (tmp != tmpbuf) free (tmp); length += count; } } #endif else { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int has_width; size_t width; #endif #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION int has_precision; size_t precision; #endif #if NEED_PRINTF_UNBOUNDED_PRECISION int prec_ourselves; #else # define prec_ourselves 0 #endif #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int pad_ourselves; #else # define pad_ourselves 0 #endif TCHAR_T *fbp; unsigned int prefix_count; int prefixes[2]; #if !USE_SNPRINTF size_t tmp_length; TCHAR_T tmpbuf[700]; TCHAR_T *tmp; #endif #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 0; width = 0; if (dp->width_start != dp->width_end) { if (dp->width_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; width = (unsigned int) (-arg); } else width = arg; } else { const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } has_width = 1; } #endif #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION has_precision = 0; precision = 6; if (dp->precision_start != dp->precision_end) { if (dp->precision_arg_index != ARG_NONE) { int arg; if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->precision_arg_index].a.a_int; /* "A negative precision is taken as if the precision were omitted." */ if (arg >= 0) { precision = arg; has_precision = 1; } } else { const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) precision = xsum (xtimes (precision, 10), *digitp++ - '0'); has_precision = 1; } } #endif #if !USE_SNPRINTF /* Allocate a temporary buffer of sufficient size for calling sprintf. */ { switch (dp->conversion) { case 'd': case 'i': case 'u': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Multiply by 2, as an estimate for FLAG_GROUP. */ tmp_length = xsum (tmp_length, tmp_length); /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'o': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'x': case 'X': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 2, to account for a leading sign or alternate form. */ tmp_length = xsum (tmp_length, 2); break; case 'f': case 'F': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ else tmp_length = (unsigned int) (DBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ tmp_length = xsum (tmp_length, precision); break; case 'e': case 'E': case 'g': case 'G': tmp_length = 12; /* sign, decimal point, exponent etc. */ tmp_length = xsum (tmp_length, precision); break; case 'a': case 'A': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (DBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); break; case 'c': # if HAVE_WINT_T && !WIDE_CHAR_VERSION if (type == TYPE_WIDE_CHAR) tmp_length = MB_CUR_MAX; else # endif tmp_length = 1; break; case 's': # if HAVE_WCHAR_T if (type == TYPE_WIDE_STRING) { tmp_length = local_wcslen (a.arg[dp->arg_index].a.a_wide_string); # if !WIDE_CHAR_VERSION tmp_length = xtimes (tmp_length, MB_CUR_MAX); # endif } else # endif tmp_length = strlen (a.arg[dp->arg_index].a.a_string); break; case 'p': tmp_length = (unsigned int) (sizeof (void *) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1 /* turn floor into ceil */ + 2; /* account for leading 0x */ break; default: abort (); } # if ENABLE_UNISTDIO /* Padding considers the number of characters, therefore the number of elements after padding may be > max (tmp_length, width) but is certainly <= tmp_length + width. */ tmp_length = xsum (tmp_length, width); # else /* Padding considers the number of elements, says POSIX. */ if (tmp_length < width) tmp_length = width; # endif tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ } if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) tmp = tmpbuf; else { size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; tmp = (TCHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } #endif /* Decide whether to handle the precision ourselves. */ #if NEED_PRINTF_UNBOUNDED_PRECISION switch (dp->conversion) { case 'd': case 'i': case 'u': case 'o': case 'x': case 'X': case 'p': prec_ourselves = has_precision && (precision > 0); break; default: prec_ourselves = 0; break; } #endif /* Decide whether to perform the padding ourselves. */ #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION switch (dp->conversion) { # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need to perform the padding after this conversion. Functions with unistdio extensions perform the padding based on character count rather than element count. */ case 'c': case 's': # endif # if NEED_PRINTF_FLAG_ZERO case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': # endif pad_ourselves = 1; break; default: pad_ourselves = prec_ourselves; break; } #endif /* Construct the format string for calling snprintf or sprintf. */ fbp = buf; *fbp++ = '%'; #if NEED_PRINTF_FLAG_GROUPING /* The underlying implementation doesn't support the ' flag. Produce no grouping characters in this case; this is acceptable because the grouping is locale dependent. */ #else if (flags & FLAG_GROUP) *fbp++ = '\''; #endif if (flags & FLAG_LEFT) *fbp++ = '-'; if (flags & FLAG_SHOWSIGN) *fbp++ = '+'; if (flags & FLAG_SPACE) *fbp++ = ' '; if (flags & FLAG_ALT) *fbp++ = '#'; if (!pad_ourselves) { if (flags & FLAG_ZERO) *fbp++ = '0'; if (dp->width_start != dp->width_end) { size_t n = dp->width_end - dp->width_start; /* The width specification is known to consist only of standard ASCII characters. */ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) { memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); fbp += n; } else { const FCHAR_T *mp = dp->width_start; do *fbp++ = (unsigned char) *mp++; while (--n > 0); } } } if (!prec_ourselves) { if (dp->precision_start != dp->precision_end) { size_t n = dp->precision_end - dp->precision_start; /* The precision specification is known to consist only of standard ASCII characters. */ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) { memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); fbp += n; } else { const FCHAR_T *mp = dp->precision_start; do *fbp++ = (unsigned char) *mp++; while (--n > 0); } } } switch (type) { #if HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ *fbp++ = 'I'; *fbp++ = '6'; *fbp++ = '4'; break; # else *fbp++ = 'l'; /*FALLTHROUGH*/ # endif #endif case TYPE_LONGINT: case TYPE_ULONGINT: #if HAVE_WINT_T case TYPE_WIDE_CHAR: #endif #if HAVE_WCHAR_T case TYPE_WIDE_STRING: #endif *fbp++ = 'l'; break; case TYPE_LONGDOUBLE: *fbp++ = 'L'; break; default: break; } #if NEED_PRINTF_DIRECTIVE_F if (dp->conversion == 'F') *fbp = 'f'; else #endif *fbp = dp->conversion; #if USE_SNPRINTF # if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) fbp[1] = '%'; fbp[2] = 'n'; fbp[3] = '\0'; # else /* On glibc2 systems from glibc >= 2.3 - probably also older ones - we know that snprintf's returns value conforms to ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. Therefore we can avoid using %n in this situation. On glibc2 systems from 2004-10-18 or newer, the use of %n in format strings in writable memory may crash the program (if compiled with _FORTIFY_SOURCE=2), so we should avoid it in this situation. */ fbp[1] = '\0'; # endif #else fbp[1] = '\0'; #endif /* Construct the arguments for calling snprintf or sprintf. */ prefix_count = 0; if (!pad_ourselves && dp->width_arg_index != ARG_NONE) { if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; } if (dp->precision_arg_index != ARG_NONE) { if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) abort (); prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; } #if USE_SNPRINTF /* The SNPRINTF result is appended after result[0..length]. The latter is an array of DCHAR_T; SNPRINTF appends an array of TCHAR_T to it. This is possible because sizeof (TCHAR_T) divides sizeof (DCHAR_T) and alignof (TCHAR_T) <= alignof (DCHAR_T). */ # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) /* Prepare checking whether snprintf returns the count via %n. */ ENSURE_ALLOCATION (xsum (length, 1)); *(TCHAR_T *) (result + length) = '\0'; #endif for (;;) { int count = -1; #if USE_SNPRINTF int retcount = 0; size_t maxlen = allocated - length; /* SNPRINTF can fail if its second argument is > INT_MAX. */ if (maxlen > INT_MAX / TCHARS_PER_DCHAR) maxlen = INT_MAX / TCHARS_PER_DCHAR; maxlen = maxlen * TCHARS_PER_DCHAR; # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ case 0: \ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ maxlen, buf, \ arg, &count); \ break; \ case 1: \ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ maxlen, buf, \ prefixes[0], arg, &count); \ break; \ case 2: \ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ maxlen, buf, \ prefixes[0], prefixes[1], arg, \ &count); \ break; \ default: \ abort (); \ } #else # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ case 0: \ count = sprintf (tmp, buf, arg); \ break; \ case 1: \ count = sprintf (tmp, buf, prefixes[0], arg); \ break; \ case 2: \ count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ arg); \ break; \ default: \ abort (); \ } #endif switch (type) { case TYPE_SCHAR: { int arg = a.arg[dp->arg_index].a.a_schar; SNPRINTF_BUF (arg); } break; case TYPE_UCHAR: { unsigned int arg = a.arg[dp->arg_index].a.a_uchar; SNPRINTF_BUF (arg); } break; case TYPE_SHORT: { int arg = a.arg[dp->arg_index].a.a_short; SNPRINTF_BUF (arg); } break; case TYPE_USHORT: { unsigned int arg = a.arg[dp->arg_index].a.a_ushort; SNPRINTF_BUF (arg); } break; case TYPE_INT: { int arg = a.arg[dp->arg_index].a.a_int; SNPRINTF_BUF (arg); } break; case TYPE_UINT: { unsigned int arg = a.arg[dp->arg_index].a.a_uint; SNPRINTF_BUF (arg); } break; case TYPE_LONGINT: { long int arg = a.arg[dp->arg_index].a.a_longint; SNPRINTF_BUF (arg); } break; case TYPE_ULONGINT: { unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; SNPRINTF_BUF (arg); } break; #if HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: { long long int arg = a.arg[dp->arg_index].a.a_longlongint; SNPRINTF_BUF (arg); } break; case TYPE_ULONGLONGINT: { unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; SNPRINTF_BUF (arg); } break; #endif case TYPE_DOUBLE: { double arg = a.arg[dp->arg_index].a.a_double; SNPRINTF_BUF (arg); } break; case TYPE_LONGDOUBLE: { long double arg = a.arg[dp->arg_index].a.a_longdouble; SNPRINTF_BUF (arg); } break; case TYPE_CHAR: { int arg = a.arg[dp->arg_index].a.a_char; SNPRINTF_BUF (arg); } break; #if HAVE_WINT_T case TYPE_WIDE_CHAR: { wint_t arg = a.arg[dp->arg_index].a.a_wide_char; SNPRINTF_BUF (arg); } break; #endif case TYPE_STRING: { const char *arg = a.arg[dp->arg_index].a.a_string; SNPRINTF_BUF (arg); } break; #if HAVE_WCHAR_T case TYPE_WIDE_STRING: { const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; SNPRINTF_BUF (arg); } break; #endif case TYPE_POINTER: { void *arg = a.arg[dp->arg_index].a.a_pointer; SNPRINTF_BUF (arg); } break; default: abort (); } #if USE_SNPRINTF /* Portability: Not all implementations of snprintf() are ISO C 99 compliant. Determine the number of bytes that snprintf() has produced or would have produced. */ if (count >= 0) { /* Verify that snprintf() has NUL-terminated its result. */ if (count < maxlen && ((TCHAR_T *) (result + length)) [count] != '\0') abort (); /* Portability hack. */ if (retcount > count) count = retcount; } else { /* snprintf() doesn't understand the '%n' directive. */ if (fbp[1] != '\0') { /* Don't use the '%n' directive; instead, look at the snprintf() return value. */ fbp[1] = '\0'; continue; } else { /* Look at the snprintf() return value. */ if (retcount < 0) { /* HP-UX 10.20 snprintf() is doubly deficient: It doesn't understand the '%n' directive, *and* it returns -1 (rather than the length that would have been required) when the buffer is too small. */ size_t bigger_need = xsum (xtimes (allocated, 2), 12); ENSURE_ALLOCATION (bigger_need); continue; } else count = retcount; } } #endif /* Attempt to handle failure. */ if (count < 0) { if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EINVAL; return NULL; } #if USE_SNPRINTF /* Handle overflow of the allocated buffer. If such an overflow occurs, a C99 compliant snprintf() returns a count >= maxlen. However, a non-compliant snprintf() function returns only count = maxlen - 1. To cover both cases, test whether count >= maxlen - 1. */ if ((unsigned int) count + 1 >= maxlen) { /* If maxlen already has attained its allowed maximum, allocating more memory will not increase maxlen. Instead of looping, bail out. */ if (maxlen == INT_MAX / TCHARS_PER_DCHAR) goto overflow; else { /* Need at least count * sizeof (TCHAR_T) bytes. But allocate proportionally, to avoid looping eternally if snprintf() reports a too small count. */ size_t n = xmax (xsum (length, (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR), xtimes (allocated, 2)); ENSURE_ALLOCATION (n); continue; } } #endif #if NEED_PRINTF_UNBOUNDED_PRECISION if (prec_ourselves) { /* Handle the precision. */ TCHAR_T *prec_ptr = # if USE_SNPRINTF (TCHAR_T *) (result + length); # else tmp; # endif size_t prefix_count; size_t move; prefix_count = 0; /* Put the additional zeroes after the sign. */ if (count >= 1 && (*prec_ptr == '-' || *prec_ptr == '+' || *prec_ptr == ' ')) prefix_count = 1; /* Put the additional zeroes after the 0x prefix if (flags & FLAG_ALT) || (dp->conversion == 'p'). */ else if (count >= 2 && prec_ptr[0] == '0' && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) prefix_count = 2; move = count - prefix_count; if (precision > move) { /* Insert zeroes. */ size_t insert = precision - move; TCHAR_T *prec_end; # if USE_SNPRINTF size_t n = xsum (length, (count + insert + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR); length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; ENSURE_ALLOCATION (n); length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; prec_ptr = (TCHAR_T *) (result + length); # endif prec_end = prec_ptr + count; prec_ptr += prefix_count; while (prec_end > prec_ptr) { prec_end--; prec_end[insert] = prec_end[0]; } prec_end += insert; do *--prec_end = '0'; while (prec_end > prec_ptr); count += insert; } } #endif #if !DCHAR_IS_TCHAR # if !USE_SNPRINTF if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); # endif /* Convert from TCHAR_T[] to DCHAR_T[]. */ if (dp->conversion == 'c' || dp->conversion == 's') { /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING TYPE_WIDE_STRING. The result string is not certainly ASCII. */ const TCHAR_T *tmpsrc; DCHAR_T *tmpdst; size_t tmpdst_len; /* This code assumes that TCHAR_T is 'char'. */ typedef int TCHAR_T_verify [2 * (sizeof (TCHAR_T) == 1) - 1]; # if USE_SNPRINTF tmpsrc = (TCHAR_T *) (result + length); # else tmpsrc = tmp; # endif tmpdst = NULL; tmpdst_len = 0; if (DCHAR_CONV_FROM_ENCODING (locale_charset (), iconveh_question_mark, tmpsrc, count, NULL, &tmpdst, &tmpdst_len) < 0) { int saved_errno = errno; if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = saved_errno; return NULL; } ENSURE_ALLOCATION (xsum (length, tmpdst_len)); DCHAR_CPY (result + length, tmpdst, tmpdst_len); free (tmpdst); count = tmpdst_len; } else { /* The result string is ASCII. Simple 1:1 conversion. */ # if USE_SNPRINTF /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a no-op conversion, in-place on the array starting at (result + length). */ if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) # endif { const TCHAR_T *tmpsrc; DCHAR_T *tmpdst; size_t n; # if USE_SNPRINTF if (result == resultbuf) { tmpsrc = (TCHAR_T *) (result + length); /* ENSURE_ALLOCATION will not move tmpsrc (because it's part of resultbuf). */ ENSURE_ALLOCATION (xsum (length, count)); } else { /* ENSURE_ALLOCATION will move the array (because it uses realloc(). */ ENSURE_ALLOCATION (xsum (length, count)); tmpsrc = (TCHAR_T *) (result + length); } # else tmpsrc = tmp; ENSURE_ALLOCATION (xsum (length, count)); # endif tmpdst = result + length; /* Copy backwards, because of overlapping. */ tmpsrc += count; tmpdst += count; for (n = count; n > 0; n--) *--tmpdst = (unsigned char) *--tmpsrc; } } #endif #if DCHAR_IS_TCHAR && !USE_SNPRINTF /* Make room for the result. */ if (count > allocated - length) { /* Need at least count elements. But allocate proportionally. */ size_t n = xmax (xsum (length, count), xtimes (allocated, 2)); ENSURE_ALLOCATION (n); } #endif /* Here count <= allocated - length. */ /* Perform padding. */ #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION if (pad_ourselves && has_width) { size_t w; # if ENABLE_UNISTDIO /* Outside POSIX, it's preferrable to compare the width against the number of _characters_ of the converted value. */ w = DCHAR_MBSNLEN (result + length, count); # else /* The width is compared against the number of _bytes_ of the converted value, says POSIX. */ w = count; # endif if (w < width) { size_t pad = width - w; # if USE_SNPRINTF /* Make room for the result. */ if (xsum (count, pad) > allocated - length) { /* Need at least count + pad elements. But allocate proportionally. */ size_t n = xmax (xsum3 (length, count, pad), xtimes (allocated, 2)); length += count; ENSURE_ALLOCATION (n); length -= count; } /* Here count + pad <= allocated - length. */ # endif { # if !DCHAR_IS_TCHAR || USE_SNPRINTF DCHAR_T * const rp = result + length; # else DCHAR_T * const rp = tmp; # endif DCHAR_T *p = rp + count; DCHAR_T *end = p + pad; # if NEED_PRINTF_FLAG_ZERO DCHAR_T *pad_ptr; # if !DCHAR_IS_TCHAR if (dp->conversion == 'c' || dp->conversion == 's') /* No zero-padding for string directives. */ pad_ptr = NULL; else # endif { pad_ptr = (*rp == '-' ? rp + 1 : rp); /* No zero-padding of "inf" and "nan". */ if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) pad_ptr = NULL; } # endif /* The generated string now extends from rp to p, with the zero padding insertion point being at pad_ptr. */ count = count + pad; /* = end - rp */ if (flags & FLAG_LEFT) { /* Pad with spaces on the right. */ for (; pad > 0; pad--) *p++ = ' '; } # if NEED_PRINTF_FLAG_ZERO else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ DCHAR_T *q = end; while (p > pad_ptr) *--q = *--p; for (; pad > 0; pad--) *p++ = '0'; } # endif else { /* Pad with spaces on the left. */ DCHAR_T *q = end; while (p > rp) *--q = *--p; for (; pad > 0; pad--) *p++ = ' '; } } } } #endif #if DCHAR_IS_TCHAR && !USE_SNPRINTF if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); #endif /* Here still count <= allocated - length. */ #if !DCHAR_IS_TCHAR || USE_SNPRINTF /* The snprintf() result did fit. */ #else /* Append the sprintf() result. */ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); #endif #if !USE_SNPRINTF if (tmp != tmpbuf) free (tmp); #endif #if NEED_PRINTF_DIRECTIVE_F if (dp->conversion == 'F') { /* Convert the %f result to upper case for %F. */ DCHAR_T *rp = result + length; size_t rc; for (rc = count; rc > 0; rc--, rp++) if (*rp >= 'a' && *rp <= 'z') *rp = *rp - 'a' + 'A'; } #endif length += count; break; } } } } /* Add the final NUL. */ ENSURE_ALLOCATION (xsum (length, 1)); result[length] = '\0'; if (result != resultbuf && length + 1 < allocated) { /* Shrink the allocated memory if possible. */ DCHAR_T *memory; memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); if (memory != NULL) result = memory; } if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); *lengthp = length; /* Note that we can produce a big string of a length > INT_MAX. POSIX says that snprintf() fails with errno = EOVERFLOW in this case, but that's only because snprintf() returns an 'int'. This function does not have this limitation. */ return result; overflow: if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); errno = EOVERFLOW; return NULL; out_of_memory: if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); out_of_memory_1: CLEANUP (); errno = ENOMEM; return NULL; } } #undef TCHARS_PER_DCHAR #undef SNPRINTF #undef USE_SNPRINTF #undef DCHAR_CPY #undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE #undef DCHAR_IS_TCHAR #undef TCHAR_T #undef DCHAR_T #undef FCHAR_T #undef VASNPRINTF cadaver-0.23.3/lib/intl/l10nflist.c0000644000076400007640000002557211312007552016327 0ustar jortonjorton/* Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Tell glibc's to provide a prototype for stpcpy(). This must come before because may include , and once has been included, it's too late. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif #ifdef HAVE_CONFIG_H # include #endif #include #if defined _LIBC || defined HAVE_ARGZ_H # include #endif #include #include #include #include "loadinfo.h" /* On some strange systems still no definition of NULL is found. Sigh! */ #ifndef NULL # if defined __STDC__ && __STDC__ # define NULL ((void *) 0) # else # define NULL 0 # endif #endif /* @@ end of prolog @@ */ #ifdef _LIBC /* Rename the non ANSI C functions. This is required by the standard because some ANSI C functions will require linking with this object file and the name space must not be polluted. */ # ifndef stpcpy # define stpcpy(dest, src) __stpcpy(dest, src) # endif #else # ifndef HAVE_STPCPY static char *stpcpy (char *dest, const char *src); # endif #endif /* Pathname support. ISSLASH(C) tests whether C is a directory separator character. IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not, it may be concatenated to a directory pathname. */ #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Win32, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') # define HAS_DEVICE(P) \ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ && (P)[1] == ':') # define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P)) #else /* Unix */ # define ISSLASH(C) ((C) == '/') # define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0]) #endif /* Define function which are usually not available. */ #ifdef _LIBC # define __argz_count(argz, len) INTUSE(__argz_count) (argz, len) #elif defined HAVE_ARGZ_COUNT # undef __argz_count # define __argz_count argz_count #else /* Returns the number of strings in ARGZ. */ static size_t argz_count__ (const char *argz, size_t len) { size_t count = 0; while (len > 0) { size_t part_len = strlen (argz); argz += part_len + 1; len -= part_len + 1; count++; } return count; } # undef __argz_count # define __argz_count(argz, len) argz_count__ (argz, len) #endif /* !_LIBC && !HAVE_ARGZ_COUNT */ #ifdef _LIBC # define __argz_stringify(argz, len, sep) \ INTUSE(__argz_stringify) (argz, len, sep) #elif defined HAVE_ARGZ_STRINGIFY # undef __argz_stringify # define __argz_stringify argz_stringify #else /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's except the last into the character SEP. */ static void argz_stringify__ (char *argz, size_t len, int sep) { while (len > 0) { size_t part_len = strlen (argz); argz += part_len; len -= part_len + 1; if (len > 0) *argz++ = sep; } } # undef __argz_stringify # define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep) #endif /* !_LIBC && !HAVE_ARGZ_STRINGIFY */ #ifdef _LIBC #elif defined HAVE_ARGZ_NEXT # undef __argz_next # define __argz_next argz_next #else static char * argz_next__ (char *argz, size_t argz_len, const char *entry) { if (entry) { if (entry < argz + argz_len) entry = strchr (entry, '\0') + 1; return entry >= argz + argz_len ? NULL : (char *) entry; } else if (argz_len > 0) return argz; else return 0; } # undef __argz_next # define __argz_next(argz, len, entry) argz_next__ (argz, len, entry) #endif /* !_LIBC && !HAVE_ARGZ_NEXT */ /* Return number of bits set in X. */ static inline int pop (int x) { /* We assume that no more than 16 bits are used. */ x = ((x & ~0x5555) >> 1) + (x & 0x5555); x = ((x & ~0x3333) >> 2) + (x & 0x3333); x = ((x >> 4) + x) & 0x0f0f; x = ((x >> 8) + x) & 0xff; return x; } struct loaded_l10nfile * _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, const char *dirlist, size_t dirlist_len, int mask, const char *language, const char *territory, const char *codeset, const char *normalized_codeset, const char *modifier, const char *filename, int do_allocate) { char *abs_filename; struct loaded_l10nfile **lastp; struct loaded_l10nfile *retval; char *cp; size_t dirlist_count; size_t entries; int cnt; /* If LANGUAGE contains an absolute directory specification, we ignore DIRLIST. */ if (IS_ABSOLUTE_PATH (language)) dirlist_len = 0; /* Allocate room for the full file name. */ abs_filename = (char *) malloc (dirlist_len + strlen (language) + ((mask & XPG_TERRITORY) != 0 ? strlen (territory) + 1 : 0) + ((mask & XPG_CODESET) != 0 ? strlen (codeset) + 1 : 0) + ((mask & XPG_NORM_CODESET) != 0 ? strlen (normalized_codeset) + 1 : 0) + ((mask & XPG_MODIFIER) != 0 ? strlen (modifier) + 1 : 0) + 1 + strlen (filename) + 1); if (abs_filename == NULL) return NULL; /* Construct file name. */ cp = abs_filename; if (dirlist_len > 0) { memcpy (cp, dirlist, dirlist_len); __argz_stringify (cp, dirlist_len, PATH_SEPARATOR); cp += dirlist_len; cp[-1] = '/'; } cp = stpcpy (cp, language); if ((mask & XPG_TERRITORY) != 0) { *cp++ = '_'; cp = stpcpy (cp, territory); } if ((mask & XPG_CODESET) != 0) { *cp++ = '.'; cp = stpcpy (cp, codeset); } if ((mask & XPG_NORM_CODESET) != 0) { *cp++ = '.'; cp = stpcpy (cp, normalized_codeset); } if ((mask & XPG_MODIFIER) != 0) { *cp++ = '@'; cp = stpcpy (cp, modifier); } *cp++ = '/'; stpcpy (cp, filename); /* Look in list of already loaded domains whether it is already available. */ lastp = l10nfile_list; for (retval = *l10nfile_list; retval != NULL; retval = retval->next) if (retval->filename != NULL) { int compare = strcmp (retval->filename, abs_filename); if (compare == 0) /* We found it! */ break; if (compare < 0) { /* It's not in the list. */ retval = NULL; break; } lastp = &retval->next; } if (retval != NULL || do_allocate == 0) { free (abs_filename); return retval; } dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1); /* Allocate a new loaded_l10nfile. */ retval = (struct loaded_l10nfile *) malloc (sizeof (*retval) + (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0)) * sizeof (struct loaded_l10nfile *))); if (retval == NULL) { free (abs_filename); return NULL; } retval->filename = abs_filename; /* We set retval->data to NULL here; it is filled in later. Setting retval->decided to 1 here means that retval does not correspond to a real file (dirlist_count > 1) or is not worth looking up (if an unnormalized codeset was specified). */ retval->decided = (dirlist_count > 1 || ((mask & XPG_CODESET) != 0 && (mask & XPG_NORM_CODESET) != 0)); retval->data = NULL; retval->next = *lastp; *lastp = retval; entries = 0; /* Recurse to fill the inheritance list of RETVAL. If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL entry does not correspond to a real file; retval->filename contains colons. In this case we loop across all elements of DIRLIST and across all bit patterns dominated by MASK. If the DIRLIST is a single directory or entirely redundant (i.e. DIRLIST_COUNT == 1), we loop across all bit patterns dominated by MASK, excluding MASK itself. In either case, we loop down from MASK to 0. This has the effect that the extra bits in the locale name are dropped in this order: first the modifier, then the territory, then the codeset, then the normalized_codeset. */ for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt) if ((cnt & ~mask) == 0 && !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0)) { if (dirlist_count > 1) { /* Iterate over all elements of the DIRLIST. */ char *dir = NULL; while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir)) != NULL) retval->successor[entries++] = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, language, territory, codeset, normalized_codeset, modifier, filename, 1); } else retval->successor[entries++] = _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, cnt, language, territory, codeset, normalized_codeset, modifier, filename, 1); } retval->successor[entries] = NULL; return retval; } /* Normalize codeset name. There is no standard for the codeset names. Normalization allows the user to use any of the common names. The return value is dynamically allocated and has to be freed by the caller. */ const char * _nl_normalize_codeset (const char *codeset, size_t name_len) { int len = 0; int only_digit = 1; char *retval; char *wp; size_t cnt; for (cnt = 0; cnt < name_len; ++cnt) if (isalnum ((unsigned char) codeset[cnt])) { ++len; if (isalpha ((unsigned char) codeset[cnt])) only_digit = 0; } retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); if (retval != NULL) { if (only_digit) wp = stpcpy (retval, "iso"); else wp = retval; for (cnt = 0; cnt < name_len; ++cnt) if (isalpha ((unsigned char) codeset[cnt])) *wp++ = tolower ((unsigned char) codeset[cnt]); else if (isdigit ((unsigned char) codeset[cnt])) *wp++ = codeset[cnt]; *wp = '\0'; } return (const char *) retval; } /* @@ begin of epilog @@ */ /* We don't want libintl.a to depend on any other library. So we avoid the non-standard function stpcpy. In GNU C Library this function is available, though. Also allow the symbol HAVE_STPCPY to be defined. */ #if !_LIBC && !HAVE_STPCPY static char * stpcpy (char *dest, const char *src) { while ((*dest++ = *src++) != '\0') /* Do nothing. */ ; return dest - 1; } #endif cadaver-0.23.3/lib/intl/libintl.rc0000644000076400007640000000323311312007552016320 0ustar jortonjorton/* Resources for intl.dll */ #include VS_VERSION_INFO VERSIONINFO FILEVERSION PACKAGE_VERSION_MAJOR,PACKAGE_VERSION_MINOR,PACKAGE_VERSION_SUBMINOR,0 PRODUCTVERSION PACKAGE_VERSION_MAJOR,PACKAGE_VERSION_MINOR,PACKAGE_VERSION_SUBMINOR,0 FILEFLAGSMASK 0x3fL /* VS_FFI_FILEFLAGSMASK */ #ifdef _DEBUG FILEFLAGS 0x1L /* VS_FF_DEBUG */ #else FILEFLAGS 0x0L #endif FILEOS 0x10004L /* VOS_DOS_WINDOWS32 */ FILETYPE 0x2L /* VFT_DLL */ FILESUBTYPE 0x0L /* VFT2_UNKNOWN */ BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "04090000" /* Lang = US English, Charset = ASCII */ BEGIN VALUE "Comments", "This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\0" VALUE "CompanyName", "Free Software Foundation\0" VALUE "FileDescription", "LGPLed libintl for Windows NT/2000/XP/Vista and Windows 95/98/ME\0" VALUE "FileVersion", PACKAGE_VERSION_STRING "\0" VALUE "InternalName", "intl.dll\0" VALUE "LegalCopyright", "Copyright (C) 1995-2007\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "intl.dll\0" VALUE "ProductName", "libintl: accessing NLS message catalogs\0" VALUE "ProductVersion", PACKAGE_VERSION_STRING "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x0409, 0 /* US English, ASCII */ END END cadaver-0.23.3/lib/intl/localcharset.c0000644000076400007640000003031411312007552017145 0ustar jortonjorton/* Determine a canonical name for the current locale's character encoding. Copyright (C) 2000-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Bruno Haible . */ #include /* Specification. */ #include "localcharset.h" #include #include #include #include #if defined _WIN32 || defined __WIN32__ # define WIN32_NATIVE #endif #if defined __EMX__ /* Assume EMX program runs on OS/2, even if compiled under DOS. */ # define OS2 #endif #if !defined WIN32_NATIVE # if HAVE_LANGINFO_CODESET # include # else # if 0 /* see comment below */ # include # endif # endif # ifdef __CYGWIN__ # define WIN32_LEAN_AND_MEAN # include # endif #elif defined WIN32_NATIVE # define WIN32_LEAN_AND_MEAN # include #endif #if defined OS2 # define INCL_DOS # include #endif #if ENABLE_RELOCATABLE # include "relocatable.h" #else # define relocate(pathname) (pathname) #endif /* Get LIBDIR. */ #ifndef LIBDIR # include "configmake.h" #endif #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ /* Win32, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') #endif #ifndef DIRECTORY_SEPARATOR # define DIRECTORY_SEPARATOR '/' #endif #ifndef ISSLASH # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) #endif #if HAVE_DECL_GETC_UNLOCKED # undef getc # define getc getc_unlocked #endif /* The following static variable is declared 'volatile' to avoid a possible multithread problem in the function get_charset_aliases. If we are running in a threaded environment, and if two threads initialize 'charset_aliases' simultaneously, both will produce the same value, and everything will be ok if the two assignments to 'charset_aliases' are atomic. But I don't know what will happen if the two assignments mix. */ #if __STDC__ != 1 # define volatile /* empty */ #endif /* Pointer to the contents of the charset.alias file, if it has already been read, else NULL. Its format is: ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */ static const char * volatile charset_aliases; /* Return a pointer to the contents of the charset.alias file. */ static const char * get_charset_aliases (void) { const char *cp; cp = charset_aliases; if (cp == NULL) { #if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) FILE *fp; const char *dir; const char *base = "charset.alias"; char *file_name; /* Make it possible to override the charset.alias location. This is necessary for running the testsuite before "make install". */ dir = getenv ("CHARSETALIASDIR"); if (dir == NULL || dir[0] == '\0') dir = relocate (LIBDIR); /* Concatenate dir and base into freshly allocated file_name. */ { size_t dir_len = strlen (dir); size_t base_len = strlen (base); int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1])); file_name = (char *) malloc (dir_len + add_slash + base_len + 1); if (file_name != NULL) { memcpy (file_name, dir, dir_len); if (add_slash) file_name[dir_len] = DIRECTORY_SEPARATOR; memcpy (file_name + dir_len + add_slash, base, base_len + 1); } } if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL) /* Out of memory or file not found, treat it as empty. */ cp = ""; else { /* Parse the file's contents. */ char *res_ptr = NULL; size_t res_size = 0; for (;;) { int c; char buf1[50+1]; char buf2[50+1]; size_t l1, l2; char *old_res_ptr; c = getc (fp); if (c == EOF) break; if (c == '\n' || c == ' ' || c == '\t') continue; if (c == '#') { /* Skip comment, to end of line. */ do c = getc (fp); while (!(c == EOF || c == '\n')); if (c == EOF) break; continue; } ungetc (c, fp); if (fscanf (fp, "%50s %50s", buf1, buf2) < 2) break; l1 = strlen (buf1); l2 = strlen (buf2); old_res_ptr = res_ptr; if (res_size == 0) { res_size = l1 + 1 + l2 + 1; res_ptr = (char *) malloc (res_size + 1); } else { res_size += l1 + 1 + l2 + 1; res_ptr = (char *) realloc (res_ptr, res_size + 1); } if (res_ptr == NULL) { /* Out of memory. */ res_size = 0; if (old_res_ptr != NULL) free (old_res_ptr); break; } strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); strcpy (res_ptr + res_size - (l2 + 1), buf2); } fclose (fp); if (res_size == 0) cp = ""; else { *(res_ptr + res_size) = '\0'; cp = res_ptr; } } if (file_name != NULL) free (file_name); #else # if defined VMS /* To avoid the troubles of an extra file charset.alias_vms in the sources of many GNU packages, simply inline the aliases here. */ /* The list of encodings is taken from the OpenVMS 7.3-1 documentation "Compaq C Run-Time Library Reference Manual for OpenVMS systems" section 10.7 "Handling Different Character Sets". */ cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" "ISO8859-2" "\0" "ISO-8859-2" "\0" "ISO8859-5" "\0" "ISO-8859-5" "\0" "ISO8859-7" "\0" "ISO-8859-7" "\0" "ISO8859-8" "\0" "ISO-8859-8" "\0" "ISO8859-9" "\0" "ISO-8859-9" "\0" /* Japanese */ "eucJP" "\0" "EUC-JP" "\0" "SJIS" "\0" "SHIFT_JIS" "\0" "DECKANJI" "\0" "DEC-KANJI" "\0" "SDECKANJI" "\0" "EUC-JP" "\0" /* Chinese */ "eucTW" "\0" "EUC-TW" "\0" "DECHANYU" "\0" "DEC-HANYU" "\0" "DECHANZI" "\0" "GB2312" "\0" /* Korean */ "DECKOREAN" "\0" "EUC-KR" "\0"; # endif # if defined WIN32_NATIVE || defined __CYGWIN__ /* To avoid the troubles of installing a separate file in the same directory as the DLL and of retrieving the DLL's directory at runtime, simply inline the aliases here. */ cp = "CP936" "\0" "GBK" "\0" "CP1361" "\0" "JOHAB" "\0" "CP20127" "\0" "ASCII" "\0" "CP20866" "\0" "KOI8-R" "\0" "CP20936" "\0" "GB2312" "\0" "CP21866" "\0" "KOI8-RU" "\0" "CP28591" "\0" "ISO-8859-1" "\0" "CP28592" "\0" "ISO-8859-2" "\0" "CP28593" "\0" "ISO-8859-3" "\0" "CP28594" "\0" "ISO-8859-4" "\0" "CP28595" "\0" "ISO-8859-5" "\0" "CP28596" "\0" "ISO-8859-6" "\0" "CP28597" "\0" "ISO-8859-7" "\0" "CP28598" "\0" "ISO-8859-8" "\0" "CP28599" "\0" "ISO-8859-9" "\0" "CP28605" "\0" "ISO-8859-15" "\0" "CP38598" "\0" "ISO-8859-8" "\0" "CP51932" "\0" "EUC-JP" "\0" "CP51936" "\0" "GB2312" "\0" "CP51949" "\0" "EUC-KR" "\0" "CP51950" "\0" "EUC-TW" "\0" "CP54936" "\0" "GB18030" "\0" "CP65001" "\0" "UTF-8" "\0"; # endif #endif charset_aliases = cp; } return cp; } /* Determine the current locale's character encoding, and canonicalize it into one of the canonical names listed in config.charset. The result must not be freed; it is statically allocated. If the canonical name cannot be determined, the result is a non-canonical name. */ #ifdef STATIC STATIC #endif const char * locale_charset (void) { const char *codeset; const char *aliases; #if !(defined WIN32_NATIVE || defined OS2) # if HAVE_LANGINFO_CODESET /* Most systems support nl_langinfo (CODESET) nowadays. */ codeset = nl_langinfo (CODESET); # ifdef __CYGWIN__ /* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always returns "US-ASCII". As long as this is not fixed, return the suffix of the locale name from the environment variables (if present) or the codepage as a number. */ if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0) { const char *locale; static char buf[2 + 10 + 1]; locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') locale = getenv ("LANG"); } if (locale != NULL && locale[0] != '\0') { /* If the locale name contains an encoding after the dot, return it. */ const char *dot = strchr (locale, '.'); if (dot != NULL) { const char *modifier; dot++; /* Look for the possible @... trailer and remove it, if any. */ modifier = strchr (dot, '@'); if (modifier == NULL) return dot; if (modifier - dot < sizeof (buf)) { memcpy (buf, dot, modifier - dot); buf [modifier - dot] = '\0'; return buf; } } } /* Woe32 has a function returning the locale's codepage as a number. */ sprintf (buf, "CP%u", GetACP ()); codeset = buf; } # endif # else /* On old systems which lack it, use setlocale or getenv. */ const char *locale = NULL; /* But most old systems don't have a complete set of locales. Some (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't use setlocale here; it would return "C" when it doesn't support the locale name the user has set. */ # if 0 locale = setlocale (LC_CTYPE, NULL); # endif if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') locale = getenv ("LANG"); } } /* On some old systems, one used to set locale = "iso8859_1". On others, you set it to "language_COUNTRY.charset". In any case, we resolve it through the charset.alias file. */ codeset = locale; # endif #elif defined WIN32_NATIVE static char buf[2 + 10 + 1]; /* Woe32 has a function returning the locale's codepage as a number. */ sprintf (buf, "CP%u", GetACP ()); codeset = buf; #elif defined OS2 const char *locale; static char buf[2 + 10 + 1]; ULONG cp[3]; ULONG cplen; /* Allow user to override the codeset, as set in the operating system, with standard language environment variables. */ locale = getenv ("LC_ALL"); if (locale == NULL || locale[0] == '\0') { locale = getenv ("LC_CTYPE"); if (locale == NULL || locale[0] == '\0') locale = getenv ("LANG"); } if (locale != NULL && locale[0] != '\0') { /* If the locale name contains an encoding after the dot, return it. */ const char *dot = strchr (locale, '.'); if (dot != NULL) { const char *modifier; dot++; /* Look for the possible @... trailer and remove it, if any. */ modifier = strchr (dot, '@'); if (modifier == NULL) return dot; if (modifier - dot < sizeof (buf)) { memcpy (buf, dot, modifier - dot); buf [modifier - dot] = '\0'; return buf; } } /* Resolve through the charset.alias file. */ codeset = locale; } else { /* OS/2 has a function returning the locale's codepage as a number. */ if (DosQueryCp (sizeof (cp), cp, &cplen)) codeset = ""; else { sprintf (buf, "CP%u", cp[0]); codeset = buf; } } #endif if (codeset == NULL) /* The canonical name cannot be determined. */ codeset = ""; /* Resolve alias. */ for (aliases = get_charset_aliases (); *aliases != '\0'; aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1) if (strcmp (codeset, aliases) == 0 || (aliases[0] == '*' && aliases[1] == '\0')) { codeset = aliases + strlen (aliases) + 1; break; } /* Don't return an empty string. GNU libc and GNU libiconv interpret the empty string as denoting "the locale's character encoding", thus GNU libiconv would call this function a second time. */ if (codeset[0] == '\0') codeset = "ASCII"; return codeset; } cadaver-0.23.3/lib/intl/log.c0000644000076400007640000000623111312007552015263 0ustar jortonjorton/* Log file output. Copyright (C) 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Bruno Haible . */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include /* Handle multi-threaded applications. */ #ifdef _LIBC # include #else # include "lock.h" #endif /* Print an ASCII string with quotes and escape sequences where needed. */ static void print_escaped (FILE *stream, const char *str) { putc ('"', stream); for (; *str != '\0'; str++) if (*str == '\n') { fputs ("\\n\"", stream); if (str[1] == '\0') return; fputs ("\n\"", stream); } else { if (*str == '"' || *str == '\\') putc ('\\', stream); putc (*str, stream); } putc ('"', stream); } static char *last_logfilename = NULL; static FILE *last_logfile = NULL; __libc_lock_define_initialized (static, lock) static inline void _nl_log_untranslated_locked (const char *logfilename, const char *domainname, const char *msgid1, const char *msgid2, int plural) { FILE *logfile; /* Can we reuse the last opened logfile? */ if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0) { /* Close the last used logfile. */ if (last_logfilename != NULL) { if (last_logfile != NULL) { fclose (last_logfile); last_logfile = NULL; } free (last_logfilename); last_logfilename = NULL; } /* Open the logfile. */ last_logfilename = (char *) malloc (strlen (logfilename) + 1); if (last_logfilename == NULL) return; strcpy (last_logfilename, logfilename); last_logfile = fopen (logfilename, "a"); if (last_logfile == NULL) return; } logfile = last_logfile; fprintf (logfile, "domain "); print_escaped (logfile, domainname); fprintf (logfile, "\nmsgid "); print_escaped (logfile, msgid1); if (plural) { fprintf (logfile, "\nmsgid_plural "); print_escaped (logfile, msgid2); fprintf (logfile, "\nmsgstr[0] \"\"\n"); } else fprintf (logfile, "\nmsgstr \"\"\n"); putc ('\n', logfile); } /* Add to the log file an entry denoting a failed translation. */ void _nl_log_untranslated (const char *logfilename, const char *domainname, const char *msgid1, const char *msgid2, int plural) { __libc_lock_lock (lock); _nl_log_untranslated_locked (logfilename, domainname, msgid1, msgid2, plural); __libc_lock_unlock (lock); } cadaver-0.23.3/lib/intl/ngettext.c0000644000076400007640000000367411312007552016354 0ustar jortonjorton/* Implementation of ngettext(3) function. Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #ifdef _LIBC # define __need_NULL # include #else # include /* Just for NULL. */ #endif #include "gettextP.h" #ifdef _LIBC # include #else # include "libgnuintl.h" #endif #include /* @@ end of prolog @@ */ /* Names for the libintl functions are a problem. They must not clash with existing names and they should follow ANSI C. But this source code is also used in GNU C Library where the names have a __ prefix. So we have to make a difference here. */ #ifdef _LIBC # define NGETTEXT __ngettext # define DCNGETTEXT __dcngettext #else # define NGETTEXT libintl_ngettext # define DCNGETTEXT libintl_dcngettext #endif /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ char * NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n) { return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES); } #ifdef _LIBC /* Alias for function name in GNU C Library. */ weak_alias (__ngettext, ngettext); #endif cadaver-0.23.3/lib/intl/lock.h0000644000076400007640000012735611312007552015453 0ustar jortonjorton/* Locking in multithreaded situations. Copyright (C) 2005-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Bruno Haible , 2005. Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, gthr-win32.h. */ /* This file contains locking primitives for use with a given thread library. It does not contain primitives for creating threads or for other synchronization primitives. Normal (non-recursive) locks: Type: gl_lock_t Declaration: gl_lock_define(extern, name) Initializer: gl_lock_define_initialized(, name) Initialization: gl_lock_init (name); Taking the lock: gl_lock_lock (name); Releasing the lock: gl_lock_unlock (name); De-initialization: gl_lock_destroy (name); Read-Write (non-recursive) locks: Type: gl_rwlock_t Declaration: gl_rwlock_define(extern, name) Initializer: gl_rwlock_define_initialized(, name) Initialization: gl_rwlock_init (name); Taking the lock: gl_rwlock_rdlock (name); gl_rwlock_wrlock (name); Releasing the lock: gl_rwlock_unlock (name); De-initialization: gl_rwlock_destroy (name); Recursive locks: Type: gl_recursive_lock_t Declaration: gl_recursive_lock_define(extern, name) Initializer: gl_recursive_lock_define_initialized(, name) Initialization: gl_recursive_lock_init (name); Taking the lock: gl_recursive_lock_lock (name); Releasing the lock: gl_recursive_lock_unlock (name); De-initialization: gl_recursive_lock_destroy (name); Once-only execution: Type: gl_once_t Initializer: gl_once_define(extern, name) Execution: gl_once (name, initfunction); */ #ifndef _LOCK_H #define _LOCK_H /* ========================================================================= */ #if USE_POSIX_THREADS /* Use the POSIX threads library. */ # include # include # ifdef __cplusplus extern "C" { # endif # if PTHREAD_IN_USE_DETECTION_HARD /* The pthread_in_use() detection needs to be done at runtime. */ # define pthread_in_use() \ glthread_in_use () extern int glthread_in_use (void); # endif # if USE_POSIX_THREADS_WEAK /* Use weak references to the POSIX threads library. */ /* Weak references avoid dragging in external libraries if the other parts of the program don't use them. Here we use them, because we don't want every program that uses libintl to depend on libpthread. This assumes that libpthread would not be loaded after libintl; i.e. if libintl is loaded first, by an executable that does not depend on libpthread, and then a module is dynamically loaded that depends on libpthread, libintl will not be multithread-safe. */ /* The way to test at runtime whether libpthread is present is to test whether a function pointer's value, such as &pthread_mutex_init, is non-NULL. However, some versions of GCC have a bug through which, in PIC mode, &foo != NULL always evaluates to true if there is a direct call to foo(...) in the same function. To avoid this, we test the address of a function in libpthread that we don't use. */ # pragma weak pthread_mutex_init # pragma weak pthread_mutex_lock # pragma weak pthread_mutex_unlock # pragma weak pthread_mutex_destroy # pragma weak pthread_rwlock_init # pragma weak pthread_rwlock_rdlock # pragma weak pthread_rwlock_wrlock # pragma weak pthread_rwlock_unlock # pragma weak pthread_rwlock_destroy # pragma weak pthread_once # pragma weak pthread_cond_init # pragma weak pthread_cond_wait # pragma weak pthread_cond_signal # pragma weak pthread_cond_broadcast # pragma weak pthread_cond_destroy # pragma weak pthread_mutexattr_init # pragma weak pthread_mutexattr_settype # pragma weak pthread_mutexattr_destroy # ifndef pthread_self # pragma weak pthread_self # endif # if !PTHREAD_IN_USE_DETECTION_HARD # pragma weak pthread_cancel # define pthread_in_use() (pthread_cancel != NULL) # endif # else # if !PTHREAD_IN_USE_DETECTION_HARD # define pthread_in_use() 1 # endif # endif /* -------------------------- gl_lock_t datatype -------------------------- */ typedef pthread_mutex_t gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer; # define gl_lock_initializer \ PTHREAD_MUTEX_INITIALIZER # define gl_lock_init(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) \ abort (); \ } \ while (0) # define gl_lock_lock(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_lock_unlock(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_lock_destroy(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) \ abort (); \ } \ while (0) /* ------------------------- gl_rwlock_t datatype ------------------------- */ # if HAVE_PTHREAD_RWLOCK # ifdef PTHREAD_RWLOCK_INITIALIZER typedef pthread_rwlock_t gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ PTHREAD_RWLOCK_INITIALIZER # define gl_rwlock_init(NAME) \ do \ { \ if (pthread_in_use () && pthread_rwlock_init (&NAME, NULL) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_rdlock(NAME) \ do \ { \ if (pthread_in_use () && pthread_rwlock_rdlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_wrlock(NAME) \ do \ { \ if (pthread_in_use () && pthread_rwlock_wrlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_unlock(NAME) \ do \ { \ if (pthread_in_use () && pthread_rwlock_unlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_destroy(NAME) \ do \ { \ if (pthread_in_use () && pthread_rwlock_destroy (&NAME) != 0) \ abort (); \ } \ while (0) # else typedef struct { int initialized; pthread_mutex_t guard; /* protects the initialization */ pthread_rwlock_t rwlock; /* read-write lock */ } gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ { 0, PTHREAD_MUTEX_INITIALIZER } # define gl_rwlock_init(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_init (&NAME); \ } \ while (0) # define gl_rwlock_rdlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_rdlock (&NAME); \ } \ while (0) # define gl_rwlock_wrlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_wrlock (&NAME); \ } \ while (0) # define gl_rwlock_unlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_unlock (&NAME); \ } \ while (0) # define gl_rwlock_destroy(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_destroy (&NAME); \ } \ while (0) extern void glthread_rwlock_init (gl_rwlock_t *lock); extern void glthread_rwlock_rdlock (gl_rwlock_t *lock); extern void glthread_rwlock_wrlock (gl_rwlock_t *lock); extern void glthread_rwlock_unlock (gl_rwlock_t *lock); extern void glthread_rwlock_destroy (gl_rwlock_t *lock); # endif # else typedef struct { pthread_mutex_t lock; /* protects the remaining fields */ pthread_cond_t waiting_readers; /* waiting readers */ pthread_cond_t waiting_writers; /* waiting writers */ unsigned int waiting_writers_count; /* number of waiting writers */ int runcount; /* number of readers running, or -1 when a writer runs */ } gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 } # define gl_rwlock_init(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_init (&NAME); \ } \ while (0) # define gl_rwlock_rdlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_rdlock (&NAME); \ } \ while (0) # define gl_rwlock_wrlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_wrlock (&NAME); \ } \ while (0) # define gl_rwlock_unlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_unlock (&NAME); \ } \ while (0) # define gl_rwlock_destroy(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_rwlock_destroy (&NAME); \ } \ while (0) extern void glthread_rwlock_init (gl_rwlock_t *lock); extern void glthread_rwlock_rdlock (gl_rwlock_t *lock); extern void glthread_rwlock_wrlock (gl_rwlock_t *lock); extern void glthread_rwlock_unlock (gl_rwlock_t *lock); extern void glthread_rwlock_destroy (gl_rwlock_t *lock); # endif /* --------------------- gl_recursive_lock_t datatype --------------------- */ # if HAVE_PTHREAD_MUTEX_RECURSIVE # if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP typedef pthread_mutex_t gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer; # ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER # define gl_recursive_lock_initializer \ PTHREAD_RECURSIVE_MUTEX_INITIALIZER # else # define gl_recursive_lock_initializer \ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP # endif # define gl_recursive_lock_init(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) \ abort (); \ } \ while (0) # define gl_recursive_lock_lock(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_recursive_lock_unlock(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_recursive_lock_destroy(NAME) \ do \ { \ if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) \ abort (); \ } \ while (0) # else typedef struct { pthread_mutex_t recmutex; /* recursive mutex */ pthread_mutex_t guard; /* protects the initialization */ int initialized; } gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 } # define gl_recursive_lock_init(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_init (&NAME); \ } \ while (0) # define gl_recursive_lock_lock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_lock (&NAME); \ } \ while (0) # define gl_recursive_lock_unlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_unlock (&NAME); \ } \ while (0) # define gl_recursive_lock_destroy(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_destroy (&NAME); \ } \ while (0) extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); # endif # else /* Old versions of POSIX threads on Solaris did not have recursive locks. We have to implement them ourselves. */ typedef struct { pthread_mutex_t mutex; pthread_t owner; unsigned long depth; } gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 } # define gl_recursive_lock_init(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_init (&NAME); \ } \ while (0) # define gl_recursive_lock_lock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_lock (&NAME); \ } \ while (0) # define gl_recursive_lock_unlock(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_unlock (&NAME); \ } \ while (0) # define gl_recursive_lock_destroy(NAME) \ do \ { \ if (pthread_in_use ()) \ glthread_recursive_lock_destroy (&NAME); \ } \ while (0) extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); # endif /* -------------------------- gl_once_t datatype -------------------------- */ typedef pthread_once_t gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT; # define gl_once(NAME, INITFUNCTION) \ do \ { \ if (pthread_in_use ()) \ { \ if (pthread_once (&NAME, INITFUNCTION) != 0) \ abort (); \ } \ else \ { \ if (glthread_once_singlethreaded (&NAME)) \ INITFUNCTION (); \ } \ } \ while (0) extern int glthread_once_singlethreaded (pthread_once_t *once_control); # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if USE_PTH_THREADS /* Use the GNU Pth threads library. */ # include # include # ifdef __cplusplus extern "C" { # endif # if USE_PTH_THREADS_WEAK /* Use weak references to the GNU Pth threads library. */ # pragma weak pth_mutex_init # pragma weak pth_mutex_acquire # pragma weak pth_mutex_release # pragma weak pth_rwlock_init # pragma weak pth_rwlock_acquire # pragma weak pth_rwlock_release # pragma weak pth_once # pragma weak pth_cancel # define pth_in_use() (pth_cancel != NULL) # else # define pth_in_use() 1 # endif /* -------------------------- gl_lock_t datatype -------------------------- */ typedef pth_mutex_t gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS pth_mutex_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pth_mutex_t NAME = gl_lock_initializer; # define gl_lock_initializer \ PTH_MUTEX_INIT # define gl_lock_init(NAME) \ do \ { \ if (pth_in_use() && !pth_mutex_init (&NAME)) \ abort (); \ } \ while (0) # define gl_lock_lock(NAME) \ do \ { \ if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) \ abort (); \ } \ while (0) # define gl_lock_unlock(NAME) \ do \ { \ if (pth_in_use() && !pth_mutex_release (&NAME)) \ abort (); \ } \ while (0) # define gl_lock_destroy(NAME) \ (void)(&NAME) /* ------------------------- gl_rwlock_t datatype ------------------------- */ typedef pth_rwlock_t gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS pth_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ PTH_RWLOCK_INIT # define gl_rwlock_init(NAME) \ do \ { \ if (pth_in_use() && !pth_rwlock_init (&NAME)) \ abort (); \ } \ while (0) # define gl_rwlock_rdlock(NAME) \ do \ { \ if (pth_in_use() \ && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RD, 0, NULL)) \ abort (); \ } \ while (0) # define gl_rwlock_wrlock(NAME) \ do \ { \ if (pth_in_use() \ && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RW, 0, NULL)) \ abort (); \ } \ while (0) # define gl_rwlock_unlock(NAME) \ do \ { \ if (pth_in_use() && !pth_rwlock_release (&NAME)) \ abort (); \ } \ while (0) # define gl_rwlock_destroy(NAME) \ (void)(&NAME) /* --------------------- gl_recursive_lock_t datatype --------------------- */ /* In Pth, mutexes are recursive by default. */ typedef pth_mutex_t gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS pth_mutex_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ PTH_MUTEX_INIT # define gl_recursive_lock_init(NAME) \ do \ { \ if (pth_in_use() && !pth_mutex_init (&NAME)) \ abort (); \ } \ while (0) # define gl_recursive_lock_lock(NAME) \ do \ { \ if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) \ abort (); \ } \ while (0) # define gl_recursive_lock_unlock(NAME) \ do \ { \ if (pth_in_use() && !pth_mutex_release (&NAME)) \ abort (); \ } \ while (0) # define gl_recursive_lock_destroy(NAME) \ (void)(&NAME) /* -------------------------- gl_once_t datatype -------------------------- */ typedef pth_once_t gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT; # define gl_once(NAME, INITFUNCTION) \ do \ { \ if (pth_in_use ()) \ { \ void (*gl_once_temp) (void) = INITFUNCTION; \ if (!pth_once (&NAME, glthread_once_call, &gl_once_temp)) \ abort (); \ } \ else \ { \ if (glthread_once_singlethreaded (&NAME)) \ INITFUNCTION (); \ } \ } \ while (0) extern void glthread_once_call (void *arg); extern int glthread_once_singlethreaded (pth_once_t *once_control); # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if USE_SOLARIS_THREADS /* Use the old Solaris threads library. */ # include # include # include # ifdef __cplusplus extern "C" { # endif # if USE_SOLARIS_THREADS_WEAK /* Use weak references to the old Solaris threads library. */ # pragma weak mutex_init # pragma weak mutex_lock # pragma weak mutex_unlock # pragma weak mutex_destroy # pragma weak rwlock_init # pragma weak rw_rdlock # pragma weak rw_wrlock # pragma weak rw_unlock # pragma weak rwlock_destroy # pragma weak thr_self # pragma weak thr_suspend # define thread_in_use() (thr_suspend != NULL) # else # define thread_in_use() 1 # endif /* -------------------------- gl_lock_t datatype -------------------------- */ typedef mutex_t gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS mutex_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS mutex_t NAME = gl_lock_initializer; # define gl_lock_initializer \ DEFAULTMUTEX # define gl_lock_init(NAME) \ do \ { \ if (thread_in_use () && mutex_init (&NAME, USYNC_THREAD, NULL) != 0) \ abort (); \ } \ while (0) # define gl_lock_lock(NAME) \ do \ { \ if (thread_in_use () && mutex_lock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_lock_unlock(NAME) \ do \ { \ if (thread_in_use () && mutex_unlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_lock_destroy(NAME) \ do \ { \ if (thread_in_use () && mutex_destroy (&NAME) != 0) \ abort (); \ } \ while (0) /* ------------------------- gl_rwlock_t datatype ------------------------- */ typedef rwlock_t gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ DEFAULTRWLOCK # define gl_rwlock_init(NAME) \ do \ { \ if (thread_in_use () && rwlock_init (&NAME, USYNC_THREAD, NULL) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_rdlock(NAME) \ do \ { \ if (thread_in_use () && rw_rdlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_wrlock(NAME) \ do \ { \ if (thread_in_use () && rw_wrlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_unlock(NAME) \ do \ { \ if (thread_in_use () && rw_unlock (&NAME) != 0) \ abort (); \ } \ while (0) # define gl_rwlock_destroy(NAME) \ do \ { \ if (thread_in_use () && rwlock_destroy (&NAME) != 0) \ abort (); \ } \ while (0) /* --------------------- gl_recursive_lock_t datatype --------------------- */ /* Old Solaris threads did not have recursive locks. We have to implement them ourselves. */ typedef struct { mutex_t mutex; thread_t owner; unsigned long depth; } gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ { DEFAULTMUTEX, (thread_t) 0, 0 } # define gl_recursive_lock_init(NAME) \ do \ { \ if (thread_in_use ()) \ glthread_recursive_lock_init (&NAME); \ } \ while (0) # define gl_recursive_lock_lock(NAME) \ do \ { \ if (thread_in_use ()) \ glthread_recursive_lock_lock (&NAME); \ } \ while (0) # define gl_recursive_lock_unlock(NAME) \ do \ { \ if (thread_in_use ()) \ glthread_recursive_lock_unlock (&NAME); \ } \ while (0) # define gl_recursive_lock_destroy(NAME) \ do \ { \ if (thread_in_use ()) \ glthread_recursive_lock_destroy (&NAME); \ } \ while (0) extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); /* -------------------------- gl_once_t datatype -------------------------- */ typedef struct { volatile int inited; mutex_t mutex; } gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS gl_once_t NAME = { 0, DEFAULTMUTEX }; # define gl_once(NAME, INITFUNCTION) \ do \ { \ if (thread_in_use ()) \ { \ glthread_once (&NAME, INITFUNCTION); \ } \ else \ { \ if (glthread_once_singlethreaded (&NAME)) \ INITFUNCTION (); \ } \ } \ while (0) extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void)); extern int glthread_once_singlethreaded (gl_once_t *once_control); # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if USE_WIN32_THREADS # include # ifdef __cplusplus extern "C" { # endif /* We can use CRITICAL_SECTION directly, rather than the Win32 Event, Mutex, Semaphore types, because - we need only to synchronize inside a single process (address space), not inter-process locking, - we don't need to support trylock operations. (TryEnterCriticalSection does not work on Windows 95/98/ME. Packages that need trylock usually define their own mutex type.) */ /* There is no way to statically initialize a CRITICAL_SECTION. It needs to be done lazily, once only. For this we need spinlocks. */ typedef struct { volatile int done; volatile long started; } gl_spinlock_t; /* -------------------------- gl_lock_t datatype -------------------------- */ typedef struct { gl_spinlock_t guard; /* protects the initialization */ CRITICAL_SECTION lock; } gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_lock_t NAME; # define gl_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_lock_t NAME = gl_lock_initializer; # define gl_lock_initializer \ { { 0, -1 } } # define gl_lock_init(NAME) \ glthread_lock_init (&NAME) # define gl_lock_lock(NAME) \ glthread_lock_lock (&NAME) # define gl_lock_unlock(NAME) \ glthread_lock_unlock (&NAME) # define gl_lock_destroy(NAME) \ glthread_lock_destroy (&NAME) extern void glthread_lock_init (gl_lock_t *lock); extern void glthread_lock_lock (gl_lock_t *lock); extern void glthread_lock_unlock (gl_lock_t *lock); extern void glthread_lock_destroy (gl_lock_t *lock); /* ------------------------- gl_rwlock_t datatype ------------------------- */ /* It is impossible to implement read-write locks using plain locks, without introducing an extra thread dedicated to managing read-write locks. Therefore here we need to use the low-level Event type. */ typedef struct { HANDLE *array; /* array of waiting threads, each represented by an event */ unsigned int count; /* number of waiting threads */ unsigned int alloc; /* length of allocated array */ unsigned int offset; /* index of first waiting thread in array */ } gl_waitqueue_t; typedef struct { gl_spinlock_t guard; /* protects the initialization */ CRITICAL_SECTION lock; /* protects the remaining fields */ gl_waitqueue_t waiting_readers; /* waiting readers */ gl_waitqueue_t waiting_writers; /* waiting writers */ int runcount; /* number of readers running, or -1 when a writer runs */ } gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME; # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ { { 0, -1 } } # define gl_rwlock_init(NAME) \ glthread_rwlock_init (&NAME) # define gl_rwlock_rdlock(NAME) \ glthread_rwlock_rdlock (&NAME) # define gl_rwlock_wrlock(NAME) \ glthread_rwlock_wrlock (&NAME) # define gl_rwlock_unlock(NAME) \ glthread_rwlock_unlock (&NAME) # define gl_rwlock_destroy(NAME) \ glthread_rwlock_destroy (&NAME) extern void glthread_rwlock_init (gl_rwlock_t *lock); extern void glthread_rwlock_rdlock (gl_rwlock_t *lock); extern void glthread_rwlock_wrlock (gl_rwlock_t *lock); extern void glthread_rwlock_unlock (gl_rwlock_t *lock); extern void glthread_rwlock_destroy (gl_rwlock_t *lock); /* --------------------- gl_recursive_lock_t datatype --------------------- */ /* The Win32 documentation says that CRITICAL_SECTION already implements a recursive lock. But we need not rely on it: It's easy to implement a recursive lock without this assumption. */ typedef struct { gl_spinlock_t guard; /* protects the initialization */ DWORD owner; unsigned long depth; CRITICAL_SECTION lock; } gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME; # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; # define gl_recursive_lock_initializer \ { { 0, -1 }, 0, 0 } # define gl_recursive_lock_init(NAME) \ glthread_recursive_lock_init (&NAME) # define gl_recursive_lock_lock(NAME) \ glthread_recursive_lock_lock (&NAME) # define gl_recursive_lock_unlock(NAME) \ glthread_recursive_lock_unlock (&NAME) # define gl_recursive_lock_destroy(NAME) \ glthread_recursive_lock_destroy (&NAME) extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); /* -------------------------- gl_once_t datatype -------------------------- */ typedef struct { volatile int inited; volatile long started; CRITICAL_SECTION lock; } gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS gl_once_t NAME = { -1, -1 }; # define gl_once(NAME, INITFUNCTION) \ glthread_once (&NAME, INITFUNCTION) extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void)); # ifdef __cplusplus } # endif #endif /* ========================================================================= */ #if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS) /* Provide dummy implementation if threads are not supported. */ /* -------------------------- gl_lock_t datatype -------------------------- */ typedef int gl_lock_t; # define gl_lock_define(STORAGECLASS, NAME) # define gl_lock_define_initialized(STORAGECLASS, NAME) # define gl_lock_init(NAME) # define gl_lock_lock(NAME) # define gl_lock_unlock(NAME) /* ------------------------- gl_rwlock_t datatype ------------------------- */ typedef int gl_rwlock_t; # define gl_rwlock_define(STORAGECLASS, NAME) # define gl_rwlock_define_initialized(STORAGECLASS, NAME) # define gl_rwlock_init(NAME) # define gl_rwlock_rdlock(NAME) # define gl_rwlock_wrlock(NAME) # define gl_rwlock_unlock(NAME) /* --------------------- gl_recursive_lock_t datatype --------------------- */ typedef int gl_recursive_lock_t; # define gl_recursive_lock_define(STORAGECLASS, NAME) # define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) # define gl_recursive_lock_init(NAME) # define gl_recursive_lock_lock(NAME) # define gl_recursive_lock_unlock(NAME) /* -------------------------- gl_once_t datatype -------------------------- */ typedef int gl_once_t; # define gl_once_define(STORAGECLASS, NAME) \ STORAGECLASS gl_once_t NAME = 0; # define gl_once(NAME, INITFUNCTION) \ do \ { \ if (NAME == 0) \ { \ NAME = ~ 0; \ INITFUNCTION (); \ } \ } \ while (0) #endif /* ========================================================================= */ #endif /* _LOCK_H */ cadaver-0.23.3/lib/intl/vasnwprintf.h0000644000076400007640000000330611312007552017070 0ustar jortonjorton/* vswprintf with automatic memory allocation. Copyright (C) 2002-2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _VASNWPRINTF_H #define _VASNWPRINTF_H /* Get va_list. */ #include /* Get wchar_t, size_t. */ #include #ifdef __cplusplus extern "C" { #endif /* Write formatted output to a string dynamically allocated with malloc(). You can pass a preallocated buffer for the result in RESULTBUF and its size in *LENGTHP; otherwise you pass RESULTBUF = NULL. If successful, return the address of the string (this may be = RESULTBUF if no dynamic memory allocation was necessary) and set *LENGTHP to the number of resulting bytes, excluding the trailing NUL. Upon error, set errno and return NULL. */ extern wchar_t * asnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, ...); extern wchar_t * vasnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, va_list args); #ifdef __cplusplus } #endif #endif /* _VASNWPRINTF_H */ cadaver-0.23.3/lib/intl/explodename.c0000644000076400007640000000654611312007552017014 0ustar jortonjorton/* Copyright (C) 1995-1998, 2000-2001, 2003, 2005, 2007 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "loadinfo.h" /* On some strange systems still no definition of NULL is found. Sigh! */ #ifndef NULL # if defined __STDC__ && __STDC__ # define NULL ((void *) 0) # else # define NULL 0 # endif #endif /* @@ end of prolog @@ */ /* Split a locale name NAME into a leading language part and all the rest. Return a pointer to the first character after the language, i.e. to the first byte of the rest. */ static char *_nl_find_language (const char *name); static char * _nl_find_language (const char *name) { while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '.') ++name; return (char *) name; } int _nl_explode_name (char *name, const char **language, const char **modifier, const char **territory, const char **codeset, const char **normalized_codeset) { char *cp; int mask; *modifier = NULL; *territory = NULL; *codeset = NULL; *normalized_codeset = NULL; /* Now we determine the single parts of the locale name. First look for the language. Termination symbols are `_', '.', and `@'. */ mask = 0; *language = cp = name; cp = _nl_find_language (*language); if (*language == cp) /* This does not make sense: language has to be specified. Use this entry as it is without exploding. Perhaps it is an alias. */ cp = strchr (*language, '\0'); else { if (cp[0] == '_') { /* Next is the territory. */ cp[0] = '\0'; *territory = ++cp; while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@') ++cp; mask |= XPG_TERRITORY; } if (cp[0] == '.') { /* Next is the codeset. */ cp[0] = '\0'; *codeset = ++cp; while (cp[0] != '\0' && cp[0] != '@') ++cp; mask |= XPG_CODESET; if (*codeset != cp && (*codeset)[0] != '\0') { *normalized_codeset = _nl_normalize_codeset (*codeset, cp - *codeset); if (*normalized_codeset == NULL) return -1; else if (strcmp (*codeset, *normalized_codeset) == 0) free ((char *) *normalized_codeset); else mask |= XPG_NORM_CODESET; } } } if (cp[0] == '@') { /* Next is the modifier. */ cp[0] = '\0'; *modifier = ++cp; if (cp[0] != '\0') mask |= XPG_MODIFIER; } if (*territory != NULL && (*territory)[0] == '\0') mask &= ~XPG_TERRITORY; if (*codeset != NULL && (*codeset)[0] == '\0') mask &= ~XPG_CODESET; return mask; } cadaver-0.23.3/doc/0000775000076400007640000000000011312007506013366 5ustar jortonjortoncadaver-0.23.3/doc/cadaver.10000664000076400007640000001075211077634262015077 0ustar jortonjorton.TH cadaver 1 "January 2002" Unix "User Manuals" .SH NAME cadaver \- A command\-line WebDAV client for Unix. .SH SYNOPSIS cadaver [-trp[-r file][-p host[:port]]][-V][-h] http://hostname[:port]/path .SH DESCRIPTION .B cadaver supports file upload, download, on-screen display, namespace operations (move and copy), collection creation and deletion, and locking operations. Its operation is similar to the standard BSD .BR ftp (1) client and the Samba Project's .BR smbclient (1). A user familiar with these tools should be quite comfortable with cadaver. .B cadaver supports automatically logging in to servers requiring authentication via a .netrc file (similar to .BR ftp (1) - see section "THE .netrc FILE" below). .SH OPTIONS .IP "-t, --tolerant" Allow cd/open into non-WebDAV enabled collection; use if the server or proxy server has WebDAV compliance problems. .IP "-r, --rcfile=file" Use this rcfile rather than the default of .I ~/.cadaverrc .IP "-p, --proxy=host[:port]" Connect using the proxy host "host" and optional proxy port "port". .IP "-V, --version" Display version information and exit. .IP "-h, --help" Display this help message and exit. .SH COMMAND REFERENCE .IP "ls [path]" List contents of current [or other] collection .IP "cd path" Change to specified collection .IP "pwd" Display name of current collection .IP "put local [remote]" Upload local file .IP "get remote [local]" Download remote resource .IP "mget remote..." Download many remote resources .IP "mput local..." Upload many local files .IP "edit resource" Edit given resource .IP "less remote..." Display remote resource through pager .IP "mkcol remote..." Create remote collection(s) .IP "cat remote..." Display remote resource(s) .IP "delete remote..." Delete non-collection resource(s) .IP "rmcol remote..." Delete remote collections and ALL contents .IP "copy source... dest" Copy resource(s) from source to dest .IP "move source... dest" Move resource(s) from source to dest .IP "lock resource" Lock given resource .IP "unlock resource" Unlock given resource .IP "discover resource" Display lock information for resource .IP "steal resource" Steal lock token for resource .IP "showlocks" Display list of owned locks .IP "propnames res" Names of properties defined on resource .IP "chexec [+|-] remote" Change isexecutable property of resource .IP "propget res [propname]" Retrieve properties of resource .IP "propset res propname value" Set property on resource .IP "set [option] [value]" Set an option, or display options .IP "open URL" Open connection to given URL .IP "close" Close current connection .IP "quit" Exit program .IP "unset [option] [value]" Unsets or clears value from option. .IP "lcd [directory]" Change local working directory .IP "lls [options]" Display local directory listing .IP "lpwd" Print local working directory .IP "logout" Logout of authentication session .IP "help [command]" Display help message .SH THE .netrc FILE The file .I ~/.netrc may be used to automatically login to a server requiring authentication. The following tokens (separated by spaces, tabs or newlines) may be used: .B machine .I host .RS Identify a remote machine .I host which is compared with the hostname given on the command line or as an argument to the .B open command. Any subsequent tokens up to the end of file or the next .B machine or .B default token are associated with this entry. .RE .B default .RS This is equivalent to the .B machine token but matches any hostname. Only one .B default token may be used and it must be after all .B machine tokens. .RE .B login .I username .RS Specifies the username to use when logging in to the remote machine. .RE .B password .I string .br .B passwd .I string .RS Specifies the password to use when logging in to the remote machine. .RE Any other tokens (as described in ftp(1)) are ignored. .SH EXAMPLES .IP "cadaver http://dav.example.com/" Connects to the server myserver.example.com, opening the root collection. .IP "cadaver http://zope.example.com:8022/Users/fred/" Connects to the server zope.example.com using port 8022, opening the collection "/Users/fred/". .IP "cadaver https://secure.example.com/" Connects to a server called secure.example.com using SSL. .IP .SH FILES .IP "~/.cadaverrc" Individual user settings that can override cadaver defaults and to script cadaver. Can be changed by the "--rcfile" option. .IP "~/.netrc" Login and initialization information used by the auto-login process. See section "THE .netrc FILE" for details. .SH AUTHOR Joe Orton .SH SEE ALSO ftp(1), smbclient(1) cadaver-0.23.3/m4/0000775000076400007640000000000011312007541013140 5ustar jortonjortoncadaver-0.23.3/m4/check-decl.m40000664000076400007640000000267710132320456015402 0ustar jortonjorton#serial 18 dnl This is just a wrapper function to encapsulate this kludge. dnl Putting it in a separate file like this helps share it between dnl different packages. AC_DEFUN([jm_CHECK_DECLS], [ AC_REQUIRE([_jm_DECL_HEADERS]) AC_REQUIRE([AC_HEADER_TIME]) headers=' #include #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #else # if HAVE_STRINGS_H # include # endif #endif #if HAVE_STDLIB_H # include #endif #if HAVE_UNISTD_H # include #endif #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #if HAVE_UTMP_H # include #endif #if HAVE_GRP_H # include #endif #if HAVE_PWD_H # include #endif ' AC_CHECK_DECLS([ free, getenv, geteuid, getgrgid, getlogin, getpwuid, getuid, getutent, lseek, malloc, memchr, memrchr, nanosleep, realloc, stpcpy, strndup, strnlen, strstr, strtoul, strtoull, ttyname], , , $headers) ]) dnl FIXME: when autoconf has support for it. dnl This is a little helper so we can require these header checks. AC_DEFUN([_jm_DECL_HEADERS], [ AC_REQUIRE([AC_HEADER_STDC]) AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \ unistd.h sys/time.h utmp.h utmpx.h) ]) cadaver-0.23.3/m4/prereq.m40000664000076400007640000001423310132320456014705 0ustar jortonjorton#serial 26 dnl These are the prerequisite macros for files in the lib/ dnl directories of the fileutils, sh-utils, and textutils packages. AC_DEFUN([jm_PREREQ], [ jm_PREREQ_ADDEXT jm_PREREQ_C_STACK jm_PREREQ_CANON_HOST jm_PREREQ_DIRNAME jm_PREREQ_ERROR jm_PREREQ_EXCLUDE jm_PREREQ_GETPAGESIZE jm_PREREQ_HARD_LOCALE jm_PREREQ_HASH jm_PREREQ_HUMAN jm_PREREQ_MBSWIDTH jm_PREREQ_MEMCHR jm_PREREQ_PHYSMEM jm_PREREQ_POSIXVER jm_PREREQ_QUOTEARG jm_PREREQ_READUTMP jm_PREREQ_REGEX jm_PREREQ_STAT jm_PREREQ_STRNLEN jm_PREREQ_TEMPNAME # called by mkstemp jm_PREREQ_XGETCWD jm_PREREQ_XREADLINK ]) AC_DEFUN([jm_PREREQ_ADDEXT], [ dnl For addext.c. AC_SYS_LONG_FILE_NAMES AC_CHECK_FUNCS(pathconf) AC_CHECK_HEADERS(limits.h string.h unistd.h) ]) AC_DEFUN([jm_PREREQ_CANON_HOST], [ dnl Add any libraries as early as possible. dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1, dnl so we have to add -lnsl to LIBS before checking for that function. AC_SEARCH_LIBS(gethostbyname, [inet nsl]) dnl These come from -lnsl on Solaris5.5.1. AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa) AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa) AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \ netinet/in.h arpa/inet.h) ]) AC_DEFUN([jm_PREREQ_DIRNAME], [ AC_HEADER_STDC AC_CHECK_HEADERS(string.h) ]) AC_DEFUN([jm_PREREQ_EXCLUDE], [ AC_FUNC_FNMATCH_GNU AC_HEADER_STDBOOL ]) AC_DEFUN([jm_PREREQ_GETPAGESIZE], [ AC_CHECK_FUNCS(getpagesize) AC_CHECK_HEADERS(OS.h unistd.h) ]) AC_DEFUN([jm_PREREQ_HARD_LOCALE], [ AC_CHECK_HEADERS(locale.h stdlib.h string.h) AC_CHECK_FUNCS(setlocale) AM_C_PROTOTYPES ]) AC_DEFUN([jm_PREREQ_HASH], [ AC_CHECK_HEADERS(stdlib.h) AC_HEADER_STDBOOL AC_REQUIRE([jm_CHECK_DECLS]) ]) # If you use human.c, you need the following files: # inttypes.m4 ulonglong.m4 AC_DEFUN([jm_PREREQ_HUMAN], [ AC_CHECK_HEADERS(limits.h stdlib.h string.h) AC_CHECK_DECLS([getenv]) AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) ]) AC_DEFUN([jm_PREREQ_MEMCHR], [ AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h) ]) AC_DEFUN([jm_PREREQ_PHYSMEM], [ AC_CHECK_HEADERS(sys/pstat.h unistd.h) AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic) ]) AC_DEFUN([jm_PREREQ_POSIXVER], [ AC_CHECK_HEADERS(unistd.h) AC_CHECK_DECLS([getenv]) ]) AC_DEFUN([jm_PREREQ_QUOTEARG], [ AC_CHECK_FUNCS(isascii iswprint) jm_FUNC_MBRTOWC AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h) AC_HEADER_STDC AC_C_BACKSLASH_A AC_TYPE_MBSTATE_T AM_C_PROTOTYPES ]) AC_DEFUN([jm_PREREQ_READUTMP], [ AC_HEADER_STDC AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h) AC_CHECK_FUNCS(utmpname) AC_CHECK_FUNCS(utmpxname) AM_C_PROTOTYPES if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then utmp_includes="\ $ac_includes_default #ifdef HAVE_UTMPX_H # include #endif #ifdef HAVE_UTMP_H # include #endif " AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmpx.ut_exit],,,[$utmp_includes]) AC_CHECK_MEMBERS([struct utmp.ut_exit],,,[$utmp_includes]) AC_LIBOBJ(readutmp) fi ]) AC_DEFUN([jm_PREREQ_REGEX], [ dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it. dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary dnl to get them. AC_CHECK_FUNCS(bzero bcopy isascii btowc) AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h) AC_HEADER_STDC AC_FUNC_ALLOCA ]) AC_DEFUN([jm_PREREQ_STAT], [ AC_CHECK_HEADERS(sys/sysmacros.h sys/statvfs.h sys/vfs.h inttypes.h) AC_CHECK_HEADERS(sys/param.h sys/mount.h) AC_CHECK_FUNCS(statvfs) jm_AC_TYPE_LONG_LONG statxfs_includes="\ $ac_includes_default #if HAVE_SYS_STATVFS_H # include #endif #if HAVE_SYS_VFS_H # include #endif #if ( ! HAVE_SYS_STATVFS_H && ! HAVE_SYS_VFS_H && HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H ) /* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */ # include # include #endif " AC_CHECK_MEMBERS([struct statfs.f_basetype],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statvfs.f_basetype],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_type],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statvfs.f_type],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statvfs.f_fsid.__val],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes]) ]) AC_DEFUN([jm_PREREQ_STRNLEN], [ AC_FUNC_STRNLEN AC_HEADER_STDC AC_CHECK_HEADERS(memory.h) AC_CHECK_DECLS([memchr]) # This is necessary because automake-1.6.1 doesn't understand # that the above use of AC_FUNC_STRNLEN means we may have to use # lib/strnlen.c. test $ac_cv_func_strnlen_working = yes \ && AC_LIBOBJ(strnlen) ]) AC_DEFUN([jm_PREREQ_TEMPNAME], [ AC_HEADER_STDC AC_HEADER_STAT AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h) AC_CHECK_FUNCS(__secure_getenv gettimeofday) AC_CHECK_DECLS([getenv]) AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) ]) AC_DEFUN([jm_PREREQ_XGETCWD], [ AC_C_PROTOTYPES AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h) AC_CHECK_FUNCS(getcwd) AC_FUNC_GETCWD_NULL ]) AC_DEFUN([jm_PREREQ_XREADLINK], [ AC_C_PROTOTYPES AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h) ]) cadaver-0.23.3/m4/README0000664000076400007640000000014210132320456014017 0ustar jortonjorton m4 files imported from fileutils/textutils/sh-utils, to support library files imported likewise. cadaver-0.23.3/m4/neon/0000775000076400007640000000000011312007542014100 5ustar jortonjortoncadaver-0.23.3/m4/neon/ld-version-script.m40000664000076400007640000000262611247501715017744 0ustar jortonjorton# ld-version-script.m4 serial 1 dnl Copyright (C) 2008, 2009 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 Simon Josefsson # FIXME: The test below returns a false positive for mingw # cross-compiles, 'local:' statements does not reduce number of # exported symbols in a DLL. Use --disable-ld-version-script to work # around the problem. # gl_LD_VERSION_SCRIPT # -------------------- # Check if LD supports linker scripts, and define automake conditional # HAVE_LD_VERSION_SCRIPT if so. AC_DEFUN([gl_LD_VERSION_SCRIPT], [ AC_ARG_ENABLE([ld-version-script], AS_HELP_STRING([--enable-ld-version-script], [enable linker version script (default is enabled when possible)]), [have_ld_version_script=$enableval], []) if test -z "$have_ld_version_script"; then AC_MSG_CHECKING([if LD -Wl,--version-script works]) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" cat > conftest.map < -*- autoconf -*- # Copyright (C) 2004 Aleix Conchillo Flaque # # This file is free software; you may copy and/or distribute it with # or without modifications, as long as this notice is preserved. # This software 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. # The above license applies to THIS FILE ONLY, the neon library code # itself may be copied and distributed under the terms of the GNU # LGPL, see COPYING.LIB for more details # This file is part of the neon HTTP/WebDAV client library. # See http://www.webdav.org/neon/ for the latest version. # Please send any feedback to # # Usage: # # NEON_LIBRARY # or NEON_BUNDLED(srcdir, [ACTIONS-IF-BUNDLED], [ACTIONS-IF-NOT_BUNDLED]) # or NEON_VPATH_BUNDLED(srcdir, builddir, # [ACTIONS-IF-BUNDLED], [ACTIONS-IF-NOT-BUNDLED]) # # where srcdir is the location of bundled neon 'src' directory. # If using a VPATH-enabled build, builddir is the location of the # build directory corresponding to srcdir. # # If a bundled build *is* being used, ACTIONS-IF-BUNDLED will be # evaluated. These actions should ensure that 'make' is run # in srcdir, and that one of NEON_NORMAL_BUILD or NEON_LIBTOOL_BUILD # is called. # # After calling one of the above macros, if the NEON_NEED_XML_PARSER # variable is set to "yes", then you must configure an XML parser # too. You can do this your own way, or do it easily using the # NEON_XML_PARSER() macro. Example usage for where we have bundled the # neon sources in a directory called libneon, and bundled expat # sources in a directory called 'expat'. # # NEON_BUNDLED(libneon, [ # NEON_XML_PARSER(expat) # NEON_NORMAL_BUILD # ]) # # Alternatively, for a simple standalone app with neon as a # dependancy, use just: # # NEON_LIBRARY # # and rely on the user installing neon correctly. # # You are free to configure an XML parser any other way you like, # but the end result must be, either expat or libxml will get linked # in, and HAVE_EXPAT or HAVE_LIBXML is defined appropriately. # # To set up the bundled build environment, call # # NEON_NORMAL_BUILD # or # NEON_LIBTOOL_BUILD # # depending on whether you are using libtool to build, or not. # Both these macros take an optional argument specifying the set # of object files you wish to build: if the argument is not given, # all of neon will be built. AC_DEFUN([NEON_BUNDLED],[ neon_bundled_srcdir=$1 neon_bundled_builddir=$1 NEON_COMMON_BUNDLED([$2], [$3]) ]) AC_DEFUN([NEON_VPATH_BUNDLED],[ neon_bundled_srcdir=$1 neon_bundled_builddir=$2 NEON_COMMON_BUNDLED([$3], [$4]) ]) AC_DEFUN([NEON_COMMON_BUNDLED],[ AC_PREREQ(2.50) AC_ARG_WITH(included-neon, AS_HELP_STRING([--with-included-neon], [force use of included neon library]), [neon_force_included="$withval"], [neon_force_included="no"]) NEON_COMMON # The colons are here so there is something to evaluate # in case the argument was not passed. if test "$neon_force_included" = "yes"; then : $1 else : $2 fi ]) dnl Not got any bundled sources: AC_DEFUN([NEON_LIBRARY],[ AC_PREREQ(2.50) neon_force_included=no neon_bundled_srcdir= neon_bundled_builddir= NEON_COMMON ]) AC_DEFUN([NE_DEFINE_VERSIONS], [ NEON_VERSION="${NE_VERSION_MAJOR}.${NE_VERSION_MINOR}.${NE_VERSION_PATCH}${NE_VERSION_TAG}" AC_DEFINE_UNQUOTED([NEON_VERSION], ["${NEON_VERSION}"], [Define to be the neon version string]) AC_DEFINE_UNQUOTED([NE_VERSION_MAJOR], [(${NE_VERSION_MAJOR})], [Define to be neon library major version]) AC_DEFINE_UNQUOTED([NE_VERSION_MINOR], [(${NE_VERSION_MINOR})], [Define to be neon library minor version]) AC_DEFINE_UNQUOTED([NE_VERSION_PATCH], [(${NE_VERSION_PATCH})], [Define to be neon library patch version]) ]) AC_DEFUN([NE_VERSIONS_BUNDLED], [ # Define the current versions. NE_VERSION_MAJOR=0 NE_VERSION_MINOR=29 NE_VERSION_PATCH=1 NE_VERSION_TAG= # 0.29.x is backwards-compatible to 0.27.x, so AGE=2 NE_LIBTOOL_VERSINFO="29:${NE_VERSION_PATCH}:2" NE_DEFINE_VERSIONS ]) dnl Adds an ABI variation tag which will be added to the SONAME of dnl a shared library. e.g. NE_ADD_ABITAG(FOO) AC_DEFUN([NE_ADD_ABITAG], [ if test "x${NE_LIBTOOL_RELEASE}y" = "xy"; then NE_LIBTOOL_RELEASE="$1" else NE_LIBTOOL_RELEASE="${NE_LIBTOOL_RELEASE}-$1" fi ]) dnl Define the minimum required versions, usage: dnl NE_REQUIRE_VERSIONS([major-version], [minor-versions]) dnl e.g. dnl NE_REQUIRE_VERSIONS([0], [24 25]) dnl to require neon 0.24.x or neon 0.25.x. AC_DEFUN([NE_REQUIRE_VERSIONS], [ m4_define([ne_require_major], [$1]) m4_define([ne_require_minor], [$2]) ]) dnl Check that the external library found in a given location dnl matches the min. required version (if any). Requires that dnl NEON_CONFIG be set the the full path of a valid neon-config dnl script dnl dnl Usage: dnl NEON_CHECK_VERSION(ACTIONS-IF-OKAY, ACTIONS-IF-FAILURE) dnl AC_DEFUN([NEON_CHECK_VERSION], [ m4_ifdef([ne_require_major], [ # Check whether the library is of required version ne_save_LIBS="$LIBS" ne_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" LIBS="$LIBS `$NEON_CONFIG --libs`" ne_libver=`$NEON_CONFIG --version | sed -e "s/neon //g"` # Check whether it's possible to link against neon AC_CACHE_CHECK([linking against neon], [ne_cv_lib_neon], [AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[ne_version_match(0, 0);]])], [ne_cv_lib_neon=yes], [ne_cv_lib_neon=no])]) if test "$ne_cv_lib_neon" = "yes"; then ne_cv_lib_neonver=no for v in ne_require_minor; do case $ne_libver in ne_require_major.$v.*) ne_cv_lib_neonver=yes ;; esac done fi ne_goodver=$ne_cv_lib_neonver LIBS=$ne_save_LIBS CFLAGS=$ne_save_CFLAGS ], [ # NE_REQUIRE_VERSIONS not used; presume all versions OK! ne_goodver=yes ne_libver="(version unknown)" ]) if test "$ne_goodver" = "yes"; then AC_MSG_NOTICE([using neon library $ne_libver]) $1 else AC_MSG_NOTICE([incompatible neon library version $ne_libver: wanted ne_require_major.ne_require_minor]) $2 fi]) dnl NEON_CHECK_SUPPORT(feature, var, name) AC_DEFUN([NEON_CHECK_SUPPORT], [ if $NEON_CONFIG --support $1 >/dev/null; then NE_ENABLE_SUPPORT($2, [$3 is supported by neon]) else NE_DISABLE_SUPPORT($2, [$3 is not supported by neon]) fi ]) dnl enable support for feature $1 with define NE_HAVE_$1, message $2 AC_DEFUN([NE_ENABLE_SUPPORT], [ NE_FLAG_$1=yes AC_SUBST(NE_FLAG_$1) AC_DEFINE([NE_HAVE_]$1, 1, [Defined if $1 is supported]) m4_if([$2], [], [ne_$1_message="support enabled" AC_MSG_NOTICE([$1 support is enabled])], [ne_$1_message="$2" AC_MSG_NOTICE([$2])]) ]) dnl Disable support for feature $1, giving message $2 AC_DEFUN([NE_DISABLE_SUPPORT], [ NE_FLAG_$1=no AC_SUBST(NE_FLAG_$1) m4_if([$2], [], [ne_$1_message="not supported" AC_MSG_NOTICE([$1 support is not enabled])], [ne_$1_message="$2" AC_MSG_NOTICE([$2])]) ]) AC_DEFUN([NEON_USE_EXTERNAL], [ # Configure to use an external neon, given a neon-config script # found at $NEON_CONFIG. neon_prefix=`$NEON_CONFIG --prefix` NEON_CHECK_VERSION([ # Pick up CFLAGS and LIBS needed CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$NEON_CONFIG --libs`" # Pick up library version set dummy `$NEON_CONFIG --version | sed 's/\./ /g'` NE_VERSION_MAJOR=[$]3; NE_VERSION_MINOR=[$]4; NE_VERSION_PATCH=[$]5 NE_DEFINE_VERSIONS neon_library_message="library in ${neon_prefix} (${NEON_VERSION})" neon_xml_parser_message="using whatever neon uses" NEON_CHECK_SUPPORT([ssl], [SSL], [SSL]) NEON_CHECK_SUPPORT([zlib], [ZLIB], [zlib]) NEON_CHECK_SUPPORT([ipv6], [IPV6], [IPv6]) NEON_CHECK_SUPPORT([lfs], [LFS], [LFS]) NEON_CHECK_SUPPORT([ts_ssl], [TS_SSL], [thread-safe SSL]) neon_got_library=yes if test $NE_FLAG_LFS = yes; then NEON_FORMAT(off64_t) AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF64_T], [Define to be printf format string for ne_off_t]) else AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF_T]) fi ], [neon_got_library=no]) ]) AC_DEFUN([NEON_COMMON],[ AC_REQUIRE([NEON_COMMON_CHECKS]) AC_ARG_WITH(neon, [ --with-neon[[=DIR]] specify location of neon library], [case $withval in yes|no) neon_force_external=$withval; neon_ext_path= ;; *) neon_force_external=yes; neon_ext_path=$withval ;; esac;], [ neon_force_external=no neon_ext_path= ]) if test "$neon_force_included" = "no"; then # There is no included neon source directory, or --with-included-neon # wasn't given (so we're not forced to use it). # Default to no external neon. neon_got_library=no if test "x$neon_ext_path" = "x"; then AC_PATH_PROG([NEON_CONFIG], neon-config, none) if test "x${NEON_CONFIG}" = "xnone"; then AC_MSG_NOTICE([no external neon library found]) elif test -x "${NEON_CONFIG}"; then NEON_USE_EXTERNAL else AC_MSG_NOTICE([ignoring non-executable ${NEON_CONFIG}]) fi else AC_MSG_CHECKING([for neon library in $neon_ext_path]) NEON_CONFIG="$neon_ext_path/bin/neon-config" if test -x ${NEON_CONFIG}; then AC_MSG_RESULT([found]) NEON_USE_EXTERNAL else AC_MSG_RESULT([not found]) # ...will fail since force_external=yes fi fi if test "$neon_got_library" = "no"; then if test $neon_force_external = yes; then AC_MSG_ERROR([could not use external neon library]) elif test -n "$neon_bundled_srcdir"; then # Couldn't find external neon, forced to use bundled sources neon_force_included="yes" else # Couldn't find neon, and don't have bundled sources AC_MSG_ERROR(could not find neon) fi fi fi if test "$neon_force_included" = "yes"; then NE_VERSIONS_BUNDLED AC_MSG_NOTICE([using bundled neon ($NEON_VERSION)]) NEON_BUILD_BUNDLED="yes" LIBNEON_SOURCE_CHECKS CFLAGS="$CFLAGS -I$neon_bundled_srcdir" NEON_LIBS="-L$neon_bundled_builddir -lneon $NEON_LIBS" NEON_NEED_XML_PARSER=yes neon_library_message="included libneon (${NEON_VERSION})" else # Don't need to configure an XML parser NEON_NEED_XML_PARSER=no NEON_BUILD_BUNDLED=no fi AC_SUBST(NEON_BUILD_BUNDLED) ]) dnl AC_SEARCH_LIBS done differently. Usage: dnl NE_SEARCH_LIBS(function, libnames, [extralibs], [actions-if-not-found], dnl [actions-if-found]) dnl Tries to find 'function' by linking againt `-lLIB $NEON_LIBS' for each dnl LIB in libnames. If link fails and 'extralibs' is given, will also dnl try linking against `-lLIB extralibs $NEON_LIBS`. dnl Once link succeeds, `-lLIB [extralibs]` is prepended to $NEON_LIBS, and dnl `actions-if-found' are executed, if given. dnl If link never succeeds, run `actions-if-not-found', if given, else dnl give an error and fail configure. AC_DEFUN([NE_SEARCH_LIBS], [ AC_REQUIRE([NE_CHECK_OS]) AC_CACHE_CHECK([for library containing $1], [ne_cv_libsfor_$1], [ AC_LINK_IFELSE( [AC_LANG_PROGRAM([], [[$1();]])], [ne_cv_libsfor_$1="none needed"], [ ne_sl_save_LIBS=$LIBS ne_cv_libsfor_$1="not found" for lib in $2; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall $1();" ;; *) ne__code="$1();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$ne__code])], [ne_cv_libsfor_$1="-l$lib"; break]) m4_if($3, [], [], dnl If $3 is specified, then... [LIBS="$ne_sl_save_LIBS -l$lib $3 $NEON_LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$ne__code])], [ne_cv_libsfor_$1="-l$lib $3"; break])]) done LIBS=$ne_sl_save_LIBS])]) if test "$ne_cv_libsfor_$1" = "not found"; then m4_if([$4], [], [AC_MSG_ERROR([could not find library containing $1])], [$4]) elif test "$ne_cv_libsfor_$1" = "none needed"; then m4_if([$5], [], [:], [$5]) else NEON_LIBS="$ne_cv_libsfor_$1 $NEON_LIBS" $5 fi]) dnl Check for presence and suitability of zlib library AC_DEFUN([NEON_ZLIB], [ AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib], [disable zlib support]), ne_use_zlib=$withval, ne_use_zlib=yes) if test "$ne_use_zlib" = "yes"; then AC_CHECK_HEADER(zlib.h, [ AC_CHECK_LIB(z, inflate, [ NEON_LIBS="$NEON_LIBS -lz" NE_ENABLE_SUPPORT(ZLIB, [zlib support enabled, using -lz]) ], [NE_DISABLE_SUPPORT(ZLIB, [zlib library not found])]) ], [NE_DISABLE_SUPPORT(ZLIB, [zlib header not found])]) else NE_DISABLE_SUPPORT(ZLIB, [zlib not enabled]) fi ]) AC_DEFUN([NE_CHECK_OS], [ # Check for Darwin, which needs extra cpp and linker flags. AC_CACHE_CHECK([for uname], ne_cv_os_uname, [ ne_cv_os_uname=`uname -s 2>/dev/null` ]) if test "$ne_cv_os_uname" = "Darwin"; then CPPFLAGS="$CPPFLAGS -no-cpp-precomp" LDFLAGS="$LDFLAGS -flat_namespace" # poll has various issues in various Darwin releases if test x${ac_cv_func_poll+set} != xset; then ac_cv_func_poll=no fi fi ]) AC_DEFUN([NEON_COMMON_CHECKS], [ # These checks are done whether or not the bundled neon build # is used. ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_USE_SYSTEM_EXTENSIONS], [AC_ISC_POSIX]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_CONST]) AC_REQUIRE([AC_TYPE_SIZE_T]) AC_REQUIRE([AC_TYPE_OFF_T]) AC_REQUIRE([NE_CHECK_OS]) AC_REQUIRE([AC_PROG_MAKE_SET]) AC_REQUIRE([AC_HEADER_STDC]) AC_CHECK_HEADERS([errno.h stdarg.h string.h stdlib.h]) NEON_FORMAT(size_t,,u) dnl size_t is unsigned; use %u formats NEON_FORMAT(off_t) NEON_FORMAT(ssize_t) ]) AC_DEFUN([NEON_FORMAT_PREP], [ AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) if test "$GCC" = "yes"; then AC_CACHE_CHECK([for gcc -Wformat -Werror sanity], ne_cv_cc_werror, [ # See whether a simple test program will compile without errors. ne_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -Wformat -Werror" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include #include ]], [[int i = 42; printf("%d", i);]])], [ne_cv_cc_werror=yes], [ne_cv_cc_werror=no]) CPPFLAGS=$ne_save_CPPFLAGS]) ne_fmt_trycompile=$ne_cv_cc_werror else ne_fmt_trycompile=no fi ]) dnl Check for LFS support AC_DEFUN([NE_LARGEFILE], [ dnl Need the size of off_t AC_REQUIRE([NEON_COMMON_CHECKS]) if test -z "$ac_cv_sizeof_off_t"; then NE_DISABLE_SUPPORT(LFS, [LFS support omitted: off_t size unknown!]) elif test $ac_cv_sizeof_off_t != 4; then NE_DISABLE_SUPPORT(LFS, [LFS support unnecessary, off_t is not 32-bit]) AC_CHECK_FUNCS([strtoll strtoq], [break]) elif test -z "$ac_cv_sizeof_long_long"; then NE_DISABLE_SUPPORT(LFS, [LFS support omitted: long long size unknown]) elif test $ac_cv_sizeof_long_long != 8; then NE_DISABLE_SUPPORT(LFS, [LFS support omitted: long long not 64-bit]) else ne_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" AC_CHECK_TYPE(off64_t, [ NEON_FORMAT(off64_t) ne_lfsok=no AC_CHECK_FUNCS([strtoll strtoq], [ne_lfsok=yes; break]) AC_CHECK_FUNCS([lseek64 fstat64], [], [ne_lfsok=no; break]) if test x$ne_lfsok = xyes; then NE_ENABLE_SUPPORT(LFS, [LFS (large file) support enabled]) NEON_CFLAGS="$NEON_CFLAGS -D_LARGEFILE64_SOURCE -DNE_LFS" ne_save_CPPFLAGS="$CPPFLAGS -DNE_LFS" else NE_DISABLE_SUPPORT(LFS, [LFS support omitted: 64-bit support functions not found]) fi], [NE_DISABLE_SUPPORT(LFS, [LFS support omitted: off64_t type not found])]) CPPFLAGS=$ne_save_CPPFLAGS fi if test "$NE_FLAG_LFS" = "yes"; then AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF64_T], [Define to be printf format string for ne_off_t]) else AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF_T]) fi ]) dnl NEON_FORMAT(TYPE[, HEADERS[, [SPECIFIER]]) dnl dnl This macro finds out which modifier is needed to create a dnl printf format string suitable for printing integer type TYPE (which dnl may be an int, long, or long long). dnl The default specifier is 'd', if SPECIFIER is not given. dnl TYPE may be defined in HEADERS; sys/types.h is always used first. AC_DEFUN([NEON_FORMAT], [ AC_REQUIRE([NEON_FORMAT_PREP]) AC_CHECK_SIZEOF($1,, [AC_INCLUDES_DEFAULT $2]) dnl Work out which specifier character to use m4_ifdef([ne_spec], [m4_undefine([ne_spec])]) m4_if($#, 3, [m4_define(ne_spec,$3)], [m4_define(ne_spec,d)]) m4_ifdef([ne_cvar], [m4_undefine([ne_cvar])])dnl m4_define([ne_cvar], m4_translit(ne_cv_fmt_[$1], [ ], [_]))dnl AC_CACHE_CHECK([how to print $1], [ne_cvar], [ ne_cvar=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" dnl obscured for m4 quoting: "for str in d ld lld; do" for str in ne_spec l]ne_spec[ ll]ne_spec[; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include $2 #include ]], [[$1 i = 1; printf("%$str", i);]])], [ne_cvar=$str; break]) done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_]m4_translit($1, [ ], [_])[ in $ac_cv_sizeof_int) ne_cvar="ne_spec" ;; $ac_cv_sizeof_long) ne_cvar="l]ne_spec[" ;; $ac_cv_sizeof_long_long) ne_cvar="ll]ne_spec[" ;; esac fi ]) if test "x$ne_cvar" = "xnone"; then AC_MSG_ERROR([format string for $1 not found]) fi AC_DEFINE_UNQUOTED([NE_FMT_]m4_translit($1, [a-z ], [A-Z_]), "$ne_cvar", [Define to be printf format string for $1]) ]) dnl Wrapper for AC_CHECK_FUNCS; uses libraries from $NEON_LIBS. AC_DEFUN([NE_CHECK_FUNCS], [ ne_cf_save_LIBS=$LIBS LIBS="$LIBS $NEON_LIBS" AC_CHECK_FUNCS($@) LIBS=$ne_cf_save_LIBS]) dnl Checks needed when compiling the neon source. AC_DEFUN([LIBNEON_SOURCE_CHECKS], [ dnl Run all the normal C language/compiler tests AC_REQUIRE([NEON_COMMON_CHECKS]) dnl Needed for building the MD5 code. AC_REQUIRE([AC_C_BIGENDIAN]) dnl Is strerror_r present; if so, which variant AC_REQUIRE([AC_FUNC_STRERROR_R]) AC_CHECK_HEADERS([sys/time.h limits.h sys/select.h arpa/inet.h libintl.h \ signal.h sys/socket.h netinet/in.h netinet/tcp.h netdb.h sys/poll.h \ sys/limits.h fcntl.h iconv.h],,, [AC_INCLUDES_DEFAULT /* netinet/tcp.h requires netinet/in.h on some platforms. */ #ifdef HAVE_NETINET_IN_H #include #endif]) AC_REQUIRE([NE_SNPRINTF]) AC_CACHE_CHECK([for timezone global], ne_cv_cc_timezone, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include #include ]], [[time_t t = 0 - timezone; timezone = 1;]])], ne_cv_cc_timezone=yes, ne_cv_cc_timezone=no)]) if test "$ne_cv_cc_timezone" = "yes"; then AC_DEFINE([HAVE_TIMEZONE], 1, [Define if the timezone global is available]) fi dnl Check for large file support NE_LARGEFILE AC_REPLACE_FUNCS(strcasecmp) AC_CHECK_FUNCS(signal setvbuf setsockopt stpcpy poll fcntl getsockopt) if test "x${ac_cv_func_poll}${ac_cv_header_sys_poll_h}y" = "xyesyesy"; then AC_DEFINE([NE_USE_POLL], 1, [Define if poll() should be used]) fi if test "$ac_cv_func_stpcpy" = "yes"; then AC_CHECK_DECLS(stpcpy) fi # Modern AIXes with the "Linux-like" libc have an undeclared stpcpy AH_BOTTOM([#if defined(HAVE_STPCPY) && defined(HAVE_DECL_STPCPY) && !HAVE_DECL_STPCPY && !defined(stpcpy) char *stpcpy(char *, const char *); #endif]) # Unixware 7 can only link gethostbyname with -lnsl -lsocket # Pick up -lsocket first, then the gethostbyname check will work. # Haiku requires -lnetwork for socket functions. NE_SEARCH_LIBS(socket, socket inet ws2_32 network) # Enable getaddrinfo support if it, gai_strerror and inet_ntop are # all available. NE_SEARCH_LIBS(getaddrinfo, nsl,, [ne_enable_gai=no], [# HP-UX boxes commonly get into a state where getaddrinfo is present # but borked: http://marc.theaimsgroup.com/?l=apr-dev&m=107730955207120&w=2 case x`uname -sr 2>/dev/null`y in xHP-UX*11.[[01]]*y) AC_MSG_NOTICE([getaddrinfo support disabled on HP-UX 11.0x/11.1x]) ;; *) ne_enable_gai=yes NE_CHECK_FUNCS(gai_strerror getnameinfo inet_ntop inet_pton,, [ne_enable_gai=no; break]) ;; esac ]) if test $ne_enable_gai = yes; then NE_ENABLE_SUPPORT(IPV6, [IPv6 support is enabled]) AC_DEFINE(USE_GETADDRINFO, 1, [Define if getaddrinfo() should be used]) AC_CACHE_CHECK([for working AI_ADDRCONFIG], [ne_cv_gai_addrconfig], [ AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [struct addrinfo hints = {0}, *result; hints.ai_flags = AI_ADDRCONFIG; if (getaddrinfo("localhost", NULL, &hints, &result) != 0) return 1;])], ne_cv_gai_addrconfig=yes, ne_cv_gai_addrconfig=no, ne_cv_gai_addrconfig=no)]) if test $ne_cv_gai_addrconfig = yes; then AC_DEFINE(USE_GAI_ADDRCONFIG, 1, [Define if getaddrinfo supports AI_ADDRCONFIG]) fi else # Checks for non-getaddrinfo() based resolver interfaces. # QNX has gethostbyname in -lsocket. BeOS only has it in -lbind. # CygWin/Winsock2 has it in -lws2_32, allegedly. # Haiku requires -lnetwork for socket functions. NE_SEARCH_LIBS(gethostbyname, socket nsl bind ws2_32 network) NE_SEARCH_LIBS(hstrerror, resolv,,[:]) NE_CHECK_FUNCS(hstrerror) # Older Unixes don't declare h_errno. AC_CHECK_DECLS(h_errno,,,[#include ]) AC_CHECK_TYPE(in_addr_t,,[ AC_DEFINE([in_addr_t], [unsigned int], [Define if in_addr_t is not available])], [ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif ]) fi AC_CHECK_TYPES(socklen_t,, # Linux accept(2) says this should be size_t for SunOS 5... gah. [AC_DEFINE([socklen_t], [int], [Define if socklen_t is not available])],[ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif ]) AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, [#include ]) if test ${ac_cv_member_struct_tm_tm_gmtoff}${ac_cv_member_struct_tm___tm_gmtoff}${ne_cv_cc_timezone} = nonono; then AC_MSG_WARN([no timezone handling in date parsing on this platform]) fi ifdef([neon_no_zlib], [NE_DISABLE_SUPPORT(ZLIB, [zlib not supported])], [NEON_ZLIB()]) # Conditionally enable ACL support AC_MSG_CHECKING([whether to enable ACL support in neon]) if test "x$neon_no_acl" = "xyes"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_oldacl ne_acl3744" fi NEON_SSL() NEON_GSSAPI() NEON_LIBPROXY() AC_SUBST(NEON_CFLAGS) AC_SUBST(NEON_LIBS) AC_SUBST(NEON_LTLIBS) ]) dnl Call to put lib/snprintf.o in LIBOBJS and define HAVE_SNPRINTF_H dnl if snprintf isn't in libc. AC_DEFUN([NEON_REPLACE_SNPRINTF], [ # Check for snprintf AC_CHECK_FUNC(snprintf,,[ AC_DEFINE(HAVE_SNPRINTF_H, 1, [Define if need to include snprintf.h]) AC_LIBOBJ(lib/snprintf)]) ]) dnl turn off webdav, boo hoo. AC_DEFUN([NEON_WITHOUT_WEBDAV], [ neon_no_webdav=yes neon_no_acl=yes NEON_NEED_XML_PARSER=no neon_xml_parser_message="none needed" ]) dnl Turn off zlib support AC_DEFUN([NEON_WITHOUT_ZLIB], [ define(neon_no_zlib, yes) ]) AC_DEFUN([NEON_WITHOUT_ACL], [ # Turn off ACL support neon_no_acl=yes ]) dnl Common macro to NEON_LIBTOOL_BUILD and NEON_NORMAL_BUILD dnl Sets NEONOBJS appropriately if it has not already been set. dnl dnl NOT FOR EXTERNAL USE: use LIBTOOL_BUILD or NORMAL_BUILD. dnl AC_DEFUN([NEON_COMMON_BUILD], [ # Using the default set of object files to build. # Add the extension to EXTRAOBJS ne="$NEON_EXTRAOBJS" NEON_EXTRAOBJS= for o in $ne; do NEON_EXTRAOBJS="$NEON_EXTRAOBJS $o.$NEON_OBJEXT" done # Was DAV support explicitly turned off? if test "x$neon_no_webdav" = "xyes"; then # No WebDAV support NEONOBJS="$NEONOBJS \$(NEON_BASEOBJS)" NE_DISABLE_SUPPORT(DAV, [WebDAV support is not enabled]) NE_ADD_ABITAG(NODAV) else # WebDAV support NEONOBJS="$NEONOBJS \$(NEON_DAVOBJS)" NE_ENABLE_SUPPORT(DAV, [WebDAV support is enabled]) fi AC_SUBST(NEON_TARGET) AC_SUBST(NEON_OBJEXT) AC_SUBST(NEONOBJS) AC_SUBST(NEON_EXTRAOBJS) AC_SUBST(NEON_LINK_FLAGS) ]) # The libtoolized build case: AC_DEFUN([NEON_LIBTOOL_BUILD], [ NEON_TARGET=libneon.la NEON_OBJEXT=lo NEON_COMMON_BUILD($#, $*) ]) dnl Find 'ar' and 'ranlib', fail if ar isn't found. AC_DEFUN([NE_FIND_AR], [ # Search in /usr/ccs/bin for Solaris ne_PATH=$PATH:/usr/ccs/bin AC_PATH_TOOL(AR, ar, notfound, $ne_PATH) if test "x$AR" = "xnotfound"; then AC_MSG_ERROR([could not find ar tool]) fi AC_PATH_TOOL(RANLIB, ranlib, :, $ne_PATH) ]) # The non-libtool build case: AC_DEFUN([NEON_NORMAL_BUILD], [ NEON_TARGET=libneon.a NEON_OBJEXT=o AC_REQUIRE([NE_FIND_AR]) NEON_COMMON_BUILD($#, $*) ]) AC_DEFUN([NE_SNPRINTF], [ AC_CHECK_FUNCS(snprintf vsnprintf,,[ ne_save_LIBS=$LIBS LIBS="$LIBS -lm" # Always need -lm AC_CHECK_LIB(trio, trio_vsnprintf, [AC_CHECK_HEADERS(trio.h,, AC_MSG_ERROR([trio installation problem? libtrio found but not trio.h])) AC_MSG_NOTICE(using trio printf replacement library) NEON_LIBS="$NEON_LIBS -ltrio -lm" AC_DEFINE(HAVE_TRIO, 1, [Use trio printf replacement library])], [AC_MSG_NOTICE([no vsnprintf/snprintf detected in C library]) AC_MSG_ERROR([Install the trio library from http://daniel.haxx.se/projects/trio/])]) LIBS=$ne_save_LIBS break ])]) dnl Usage: NE_CHECK_OPENSSLVER(variable, version-string, version-hex) dnl Define 'variable' to 'yes' if OpenSSL version is >= version-hex AC_DEFUN([NE_CHECK_OPENSSLVER], [ AC_CACHE_CHECK([OpenSSL version is >= $2], $1, [ AC_EGREP_CPP(good, [#include #if OPENSSL_VERSION_NUMBER >= $3 good #endif], [$1=yes], [$1=no])])]) dnl Less noisy replacement for PKG_CHECK_MODULES AC_DEFUN([NE_PKG_CONFIG], [ m4_define([ne_cvar], m4_translit(ne_cv_pkg_[$2], [.-], [__]))dnl AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test "$PKG_CONFIG" = "no"; then : Not using pkg-config $4 else AC_CACHE_CHECK([for $2 pkg-config data], ne_cvar, [if $PKG_CONFIG $2; then ne_cvar=yes else ne_cvar=no fi]) if test "$ne_cvar" = "yes"; then $1_CFLAGS=`$PKG_CONFIG --cflags $2` $1_LIBS=`$PKG_CONFIG --libs $2` : Using provided pkg-config data $3 else : No pkg-config for $2 provided $4 fi fi m4_undefine([ne_cvar]) ]) dnl Check for an SSL library (GNU TLS or OpenSSL) AC_DEFUN([NEON_SSL], [ AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl=openssl|gnutls], [enable SSL support (default OpenSSL)])) AC_ARG_WITH(egd, [[ --with-egd[=PATH] enable EGD support [using EGD socket at PATH]]]) AC_ARG_WITH(pakchois, AS_HELP_STRING([--without-pakchois], [disable support for PKCS#11 using pakchois])) case $with_ssl in /*) AC_MSG_NOTICE([to use SSL libraries in non-standard locations, try --with-ssl --with-libs=$with_ssl]) AC_MSG_ERROR([--with-ssl does not take a path argument]) ;; yes|openssl) NE_PKG_CONFIG(NE_SSL, openssl, [AC_MSG_NOTICE(using SSL library configuration from pkg-config) CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}" NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}"], [# Either OpenSSL library may require -ldl if built with dynamic engine support NE_SEARCH_LIBS(RSA_new, crypto, -ldl) NE_SEARCH_LIBS(SSL_library_init, ssl, -ldl)]) AC_CHECK_HEADERS(openssl/ssl.h openssl/opensslv.h,, [AC_MSG_ERROR([OpenSSL headers not found, cannot enable SSL support])]) # Enable EGD support if using 0.9.7 or newer NE_CHECK_OPENSSLVER(ne_cv_lib_ssl097, 0.9.7, 0x00907000L) if test "$ne_cv_lib_ssl097" = "yes"; then AC_MSG_NOTICE([OpenSSL >= 0.9.7; EGD support not needed in neon]) NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using OpenSSL (0.9.7 or later)]) NE_CHECK_FUNCS(CRYPTO_set_idptr_callback SSL_SESSION_cmp) else # Fail if OpenSSL is older than 0.9.6 NE_CHECK_OPENSSLVER(ne_cv_lib_ssl096, 0.9.6, 0x00906000L) if test "$ne_cv_lib_ssl096" != "yes"; then AC_MSG_ERROR([OpenSSL 0.9.6 or later is required]) fi NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using OpenSSL (0.9.6 or later)]) case "$with_egd" in yes|no) ne_cv_lib_sslegd=$with_egd ;; /*) ne_cv_lib_sslegd=yes AC_DEFINE_UNQUOTED([EGD_PATH], "$with_egd", [Define to specific EGD socket path]) ;; *) # Guess whether EGD support is needed AC_CACHE_CHECK([whether to enable EGD support], [ne_cv_lib_sslegd], [if test -r /dev/random || test -r /dev/urandom; then ne_cv_lib_sslegd=no else ne_cv_lib_sslegd=yes fi]) ;; esac if test "$ne_cv_lib_sslegd" = "yes"; then AC_MSG_NOTICE([EGD support enabled for seeding OpenSSL PRNG]) AC_DEFINE([ENABLE_EGD], 1, [Define if EGD should be supported]) fi fi AC_DEFINE([HAVE_OPENSSL], 1, [Define if OpenSSL support is enabled]) NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_openssl" AC_DEFINE([HAVE_NTLM], 1, [Define if NTLM is supported]) ;; gnutls) NE_PKG_CONFIG(NE_SSL, gnutls, [AC_MSG_NOTICE(using GnuTLS configuration from pkg-config) CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}" NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}" ne_gnutls_ver=`$PKG_CONFIG --modversion gnutls` ], [ # Fall back on libgnutls-config script AC_PATH_PROG(GNUTLS_CONFIG, libgnutls-config, no) if test "$GNUTLS_CONFIG" = "no"; then AC_MSG_ERROR([could not find libgnutls-config in \$PATH]) fi CPPFLAGS="$CPPFLAGS `$GNUTLS_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$GNUTLS_CONFIG --libs`" ne_gnutls_ver=`$GNUTLS_CONFIG --version` ]) AC_CHECK_HEADER([gnutls/gnutls.h],, [AC_MSG_ERROR([could not find gnutls/gnutls.h in include path])]) NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using GnuTLS $ne_gnutls_ver]) NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_gnutls" AC_DEFINE([HAVE_GNUTLS], 1, [Define if GnuTLS support is enabled]) # Check for functions in later releases NE_CHECK_FUNCS([gnutls_session_get_data2 gnutls_x509_dn_get_rdn_ava \ gnutls_sign_callback_set \ gnutls_certificate_get_x509_cas \ gnutls_certificate_verify_peers2]) # fail if gnutls_certificate_verify_peers2 is not found if test x${ac_cv_func_gnutls_certificate_verify_peers2} != xyes; then AC_MSG_ERROR([GnuTLS version predates gnutls_certificate_verify_peers2, newer version required]) fi # Check for iconv support if using the new RDN access functions: if test ${ac_cv_func_gnutls_x509_dn_get_rdn_ava}X${ac_cv_header_iconv_h} = yesXyes; then AC_CHECK_FUNCS(iconv) fi ;; *) # Default to off; only create crypto-enabled binaries if requested. NE_DISABLE_SUPPORT(SSL, [SSL support is not enabled]) NE_DISABLE_SUPPORT(TS_SSL, [Thread-safe SSL support is not enabled]) NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_stubssl" ;; esac AC_SUBST(NEON_SUPPORTS_SSL) AC_ARG_WITH(ca-bundle, AS_HELP_STRING(--with-ca-bundle, specify filename of an SSL CA root bundle),, with_ca_bundle=no) case ${NE_FLAG_SSL}-${with_ca_bundle} in *-no) ;; yes-*) AC_DEFINE_UNQUOTED([NE_SSL_CA_BUNDLE], ["${with_ca_bundle}"], [Define to be filename of an SSL CA root bundle]) AC_MSG_NOTICE([Using ${with_ca_bundle} as default SSL CA bundle]) ;; esac AC_ARG_ENABLE(threadsafe-ssl, AS_HELP_STRING(--enable-threadsafe-ssl=posix, [enable SSL library thread-safety using POSIX threads: suitable CC/CFLAGS/LIBS must be used to make the POSIX library interfaces available]),, enable_threadsafe_ssl=no) case $enable_threadsafe_ssl in posix|yes) ne_pthr_ok=yes AC_CHECK_FUNCS([pthread_mutex_init pthread_mutex_lock],,[ne_pthr_ok=no]) if test "${ne_pthr_ok}" = "no"; then AC_MSG_ERROR([could not find POSIX mutex interfaces; (try CC="${CC} -pthread"?)]) fi NE_ENABLE_SUPPORT(TS_SSL, [Thread-safe SSL supported using POSIX threads]) ;; *) NE_DISABLE_SUPPORT(TS_SSL, [Thread-safe SSL not supported]) ;; esac case ${with_pakchois}X${ac_cv_func_gnutls_sign_callback_set}Y${ne_cv_lib_ssl097} in noX*Y*) ;; *X*Yyes|*XyesY*) # PKCS#11... ho! NE_PKG_CONFIG(NE_PK11, pakchois, [AC_MSG_NOTICE([[using pakchois for PKCS#11 support]]) AC_DEFINE(HAVE_PAKCHOIS, 1, [Define if pakchois library supported]) CPPFLAGS="$CPPFLAGS ${NE_PK11_CFLAGS}" NEON_LIBS="${NEON_LIBS} ${NE_PK11_LIBS}"], [AC_MSG_NOTICE([[pakchois library not found; no PKCS#11 support]])]) ;; esac ]) dnl -- end defun NEON_SSL dnl Check for Kerberos installation AC_DEFUN([NEON_GSSAPI], [ AC_ARG_WITH(gssapi, AS_HELP_STRING(--without-gssapi, disable GSSAPI support)) if test "$with_gssapi" != "no"; then AC_PATH_PROG([KRB5_CONFIG], krb5-config, none, $PATH:/usr/kerberos/bin) else KRB5_CONFIG=none fi if test "x$KRB5_CONFIG" != "xnone"; then ne_save_CPPFLAGS=$CPPFLAGS ne_save_LIBS=$NEON_LIBS NEON_LIBS="$NEON_LIBS `${KRB5_CONFIG} --libs gssapi`" CPPFLAGS="$CPPFLAGS `${KRB5_CONFIG} --cflags gssapi`" # MIT and Heimdal put gssapi.h in different places AC_CHECK_HEADERS(gssapi/gssapi.h gssapi.h, [ NE_CHECK_FUNCS(gss_init_sec_context, [ ne_save_CPPFLAGS=$CPPFLAGS ne_save_LIBS=$NEON_LIBS AC_MSG_NOTICE([GSSAPI authentication support enabled]) AC_DEFINE(HAVE_GSSAPI, 1, [Define if GSSAPI support is enabled]) AC_CHECK_HEADERS(gssapi/gssapi_generic.h) # Older versions of MIT Kerberos lack GSS_C_NT_HOSTBASED_SERVICE AC_CHECK_DECL([GSS_C_NT_HOSTBASED_SERVICE],, [AC_DEFINE([GSS_C_NT_HOSTBASED_SERVICE], gss_nt_service_name, [Define if GSS_C_NT_HOSTBASED_SERVICE is not defined otherwise])], [#ifdef HAVE_GSSAPI_GSSAPI_H #include #else #include #endif])]) break ]) CPPFLAGS=$ne_save_CPPFLAGS NEON_LIBS=$ne_save_LIBS fi]) AC_DEFUN([NEON_LIBPROXY], [ AC_ARG_WITH(libproxy, AS_HELP_STRING(--without-libproxy, disable libproxy support)) if test "x$with_libproxy" != "xno"; then NE_PKG_CONFIG(NE_PXY, libproxy-1.0, [AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is supported]) CPPFLAGS="$CPPFLAGS $NE_PXY_CFLAGS" NEON_LIBS="$NEON_LIBS ${NE_PXY_LIBS}" NE_ENABLE_SUPPORT(LIBPXY, [libproxy support enabled])], [NE_DISABLE_SUPPORT(LIBPXY, [libproxy support not enabled])]) else NE_DISABLE_SUPPORT(LIBPXY, [libproxy support not enabled]) fi ]) dnl Adds an --enable-warnings argument to configure to allow enabling dnl compiler warnings AC_DEFUN([NEON_WARNINGS],[ AC_REQUIRE([AC_PROG_CC]) dnl so that $GCC is set AC_ARG_ENABLE(warnings, AS_HELP_STRING(--enable-warnings, [enable compiler warnings])) if test "$enable_warnings" = "yes"; then case $GCC:`uname` in yes:*) CFLAGS="$CFLAGS -Wall -Wmissing-declarations -Wshadow -Wreturn-type -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wformat-security" if test -z "$with_ssl" -o "$with_ssl" = "no"; then # OpenSSL headers fail strict prototypes checks CFLAGS="$CFLAGS -Wstrict-prototypes" fi ;; no:OSF1) CFLAGS="$CFLAGS -check -msg_disable returnchecks -msg_disable alignment -msg_disable overflow" ;; no:IRIX) CFLAGS="$CFLAGS -fullwarn" ;; no:UnixWare) CFLAGS="$CFLAGS -v" ;; *) AC_MSG_WARN([warning flags unknown for compiler on this platform]) ;; esac fi ]) dnl Adds an --disable-debug argument to configure to allow disabling dnl debugging messages. dnl Usage: dnl NEON_WARNINGS([actions-if-debug-enabled], [actions-if-debug-disabled]) dnl AC_DEFUN([NEON_DEBUG], [ AC_ARG_ENABLE(debug, AS_HELP_STRING(--disable-debug,[disable runtime debugging messages])) # default is to enable debugging case $enable_debug in no) AC_MSG_NOTICE([debugging is disabled]) $2 ;; *) AC_MSG_NOTICE([debugging is enabled]) AC_DEFINE(NE_DEBUGGING, 1, [Define to enable debugging]) $1 ;; esac]) dnl Macro to optionally enable socks support AC_DEFUN([NEON_SOCKS], [ ]) AC_DEFUN([NEON_WITH_LIBS], [ AC_ARG_WITH([libs], [[ --with-libs=DIR[:DIR2...] look for support libraries in DIR/{bin,lib,include}]], [case $with_libs in yes|no) AC_MSG_ERROR([--with-libs must be passed a directory argument]) ;; *) ne_save_IFS=$IFS; IFS=: for dir in $with_libs; do ne_add_CPPFLAGS="$ne_add_CPPFLAGS -I${dir}/include" ne_add_LDFLAGS="$ne_add_LDFLAGS -L${dir}/lib" ne_add_PATH="${ne_add_PATH}${dir}/bin:" PKG_CONFIG_PATH=${PKG_CONFIG_PATH}${PKG_CONFIG_PATH+:}${dir}/lib/pkgconfig done IFS=$ne_save_IFS CPPFLAGS="${ne_add_CPPFLAGS} $CPPFLAGS" LDFLAGS="${ne_add_LDFLAGS} $LDFLAGS" PATH=${ne_add_PATH}$PATH export PKG_CONFIG_PATH ;; esac])]) AC_DEFUN([NEON_I18N], [ dnl Check for NLS iff libintl.h was detected. AC_ARG_ENABLE(nls, AS_HELP_STRING(--disable-nls, [disable internationalization support]),, [enable_nls=${ac_cv_header_libintl_h}]) if test x${enable_nls} = xyes; then # presume that dgettext() is available if bindtextdomain() is... # checking for dgettext() itself is awkward because gcc has a # builtin of that function, which confuses AC_CHECK_FUNCS et al. NE_SEARCH_LIBS(bindtextdomain, intl,,[enable_nls=no]) NE_CHECK_FUNCS(bind_textdomain_codeset) fi if test "$enable_nls" = "no"; then NE_DISABLE_SUPPORT(I18N, [Internationalization support not enabled]) else NE_ENABLE_SUPPORT(I18N, [Internationalization support enabled]) eval localedir="${datadir}/locale" AC_DEFINE_UNQUOTED([LOCALEDIR], "$localedir", [Define to be location of localedir]) fi ]) cadaver-0.23.3/m4/neon/neon-xml-parser.m40000664000076400007640000001215611040461043017374 0ustar jortonjorton# Copyright (C) 1998-2005, 2007 Joe Orton -*- autoconf -*- # # This file is free software; you may copy and/or distribute it with # or without modifications, as long as this notice is preserved. # This software 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. # The above license applies to THIS FILE ONLY, the neon library code # itself may be copied and distributed under the terms of the GNU # LGPL, see COPYING.LIB for more details # This file is part of the neon HTTP/WebDAV client library. # See http://www.webdav.org/neon/ for the latest version. # Please send any feedback to # Check for XML parser, supporting libxml 2.x and expat 1.95.x, # or a bundled copy of expat. # * Bundled expat if a directory name argument is passed # -> expat dir must contain minimal expat sources, i.e. # xmltok, xmlparse sub-directories. See sitecopy/cadaver for # examples of how to do this. # # Usage: # NEON_XML_PARSER() # or # NEON_XML_PARSER([expat-srcdir], [expat-builddir]) dnl Find expat: run $1 if found, else $2 AC_DEFUN([NE_XML_EXPAT], [ AC_CHECK_HEADER(expat.h, [AC_CHECK_LIB(expat, XML_SetXmlDeclHandler, [ AC_DEFINE(HAVE_EXPAT, 1, [Define if you have expat]) neon_xml_parser_message="expat" NEON_LIBS="$NEON_LIBS -lexpat" neon_xml_parser=expat AC_CHECK_TYPE(XML_Size, [NEON_FORMAT(XML_Size, [#include ])], [AC_DEFINE_UNQUOTED([NE_FMT_XML_SIZE], ["d"])], [#include ]) ], [$1])], [$1]) ]) dnl Find libxml2: run $1 if found, else $2 AC_DEFUN([NE_XML_LIBXML2], [ AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config) if test -n "$XML2_CONFIG"; then neon_xml_parser_message="libxml `$XML2_CONFIG --version`" AC_DEFINE(HAVE_LIBXML, 1, [Define if you have libxml]) # xml2-config in some versions erroneously includes -I/include # in the --cflags output. CPPFLAGS="$CPPFLAGS `$XML2_CONFIG --cflags | sed 's| -I/include||g'`" NEON_LIBS="$NEON_LIBS `$XML2_CONFIG --libs | sed 's|-L/usr/lib ||g'`" AC_CHECK_HEADERS(libxml/xmlversion.h libxml/parser.h,,[ AC_MSG_ERROR([could not find parser.h, libxml installation problem?])]) neon_xml_parser=libxml2 else $1 fi ]) dnl Configure for a bundled expat build. AC_DEFUN([NE_XML_BUNDLED_EXPAT], [ AC_REQUIRE([AC_C_BIGENDIAN]) # Define XML_BYTE_ORDER for expat sources. if test $ac_cv_c_bigendian = "yes"; then ne_xml_border=21 else ne_xml_border=12 fi # mini-expat doesn't pick up config.h CPPFLAGS="$CPPFLAGS -DXML_BYTE_ORDER=$ne_xml_border -DXML_DTD -I$1/xmlparse -I$1/xmltok" AC_DEFINE_UNQUOTED([NE_FMT_XML_SIZE], ["d"]) # Use the bundled expat sources AC_LIBOBJ($2/xmltok/xmltok) AC_LIBOBJ($2/xmltok/xmlrole) AC_LIBOBJ($2/xmlparse/xmlparse) AC_LIBOBJ($2/xmlparse/hashtable) AC_DEFINE(HAVE_EXPAT) AC_DEFINE(HAVE_XMLPARSE_H, 1, [Define if using expat which includes xmlparse.h]) ]) AC_DEFUN([NEON_XML_PARSER], [ dnl Switches to force choice of library AC_ARG_WITH([libxml2], AS_HELP_STRING([--with-libxml2], [force use of libxml 2.x])) AC_ARG_WITH([expat], AS_HELP_STRING([--with-expat], [force use of expat])) dnl Flag to force choice of included expat, if available. ifelse($#, 2, [ AC_ARG_WITH([included-expat], AS_HELP_STRING([--with-included-expat], [use bundled expat sources]),, with_included_expat=no)], with_included_expat=no) if test "$NEON_NEED_XML_PARSER" = "yes"; then # Find an XML parser neon_xml_parser=none # Forced choice of expat: case $with_expat in yes) NE_XML_EXPAT([AC_MSG_ERROR([expat library not found, cannot proceed])]) ;; no) ;; */libexpat.la) # Special case for Subversion ne_expdir=`echo $with_expat | sed 's:/libexpat.la$::'` AC_DEFINE(HAVE_EXPAT) AC_DEFINE_UNQUOTED([NE_FMT_XML_SIZE], ["d"]) CPPFLAGS="$CPPFLAGS -I$ne_expdir" if test "x${NEON_TARGET}" = "xlibneon.la"; then NEON_LTLIBS=$with_expat else # no dependency on libexpat => crippled libneon, so do partial install ALLOW_INSTALL=lib fi neon_xml_parser=expat neon_xml_parser_message="expat in $ne_expdir" ;; /*) AC_MSG_ERROR([--with-expat does not take a directory argument]) ;; esac # If expat wasn't specifically enabled and libxml was: if test "${neon_xml_parser}-${with_libxml2}-${with_included_expat}" = "none-yes-no"; then NE_XML_LIBXML2( [AC_MSG_ERROR([libxml2.x library not found, cannot proceed])]) fi # Otherwise, by default search for expat then libxml2: if test "${neon_xml_parser}-${with_included_expat}" = "none-no"; then NE_XML_EXPAT([NE_XML_LIBXML2([:])]) fi # If an XML parser still has not been found, fail or use the bundled expat if test "$neon_xml_parser" = "none"; then m4_if($1, [], [AC_MSG_ERROR([no XML parser was found: expat or libxml 2.x required])], [# Configure the bundled copy of expat NE_XML_BUNDLED_EXPAT($@) neon_xml_parser_message="bundled expat in $1"]) fi AC_MSG_NOTICE([XML parser used: $neon_xml_parser_message]) fi ]) cadaver-0.23.3/m4/neon/ChangeLog0000664000076400007640000010234210127601723015660 0ustar jortonjortonSun Sep 12 18:38:13 2004 Joe Orton * neon.m4 (NEON_USE_EXTERNAL): Check for IDNA, LFS, SOCKS support. (NEON_SOCKS): Use common feature code for SOCKSv5 support. Fri Sep 10 20:52:54 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Safer autoheader template for declaring stpcpy as necessary for bundled neon builds. (NEON_WARNINGS): Drop -Winline. Wed Aug 25 19:44:26 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for poll. Sat Jul 3 11:39:01 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Pick up gethostbyname in -lsocket for QNX. Fri Apr 16 11:43:10 2004 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): If built using libtool, and --with-expat specifies a libexpat.la file, add the libexpat.la to NEON_LTLIBS. * neon.m4 (NEON_COMMON_CHECKS): Substitute NEON_LTLIBS. Tue Apr 13 20:51:59 2004 Joe Orton * neon.m4 (NEON_GSSAPI): Check for presence of gssapi/gssapi_generic.h. Wed Apr 7 13:16:33 2004 Joe Orton * neon.m4 (NE_LARGEFILE): Check for strtoq. Mon Mar 15 19:59:36 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Be safer around getaddrinfo blacklist for HP-UX and reference why it's needed. Sun Mar 7 11:15:44 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Use NE_LARGEFILE in-place rather than AC_REQUIRE'ing it. (NE_LARGEFILE): Add NE_LFS to CPPFLAGS for use in bundled builds. Mon Feb 23 23:02:54 2004 Joe Orton * neon.m4 (NE_SNPRINTF): Define HAVE_TRIO if trio is used. Mon Feb 23 00:22:39 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Give INCLUDES argument to AC_CHECK_HEADERS; prevent warning from cpp test for netinet/in.h on some platforms. Sun Feb 22 17:52:42 2004 Joe Orton * neon.m4 (NE_SEARCH_LIBS): Fix to run actions-if-found if function is found without needing additional libraries. (LIBNEON_SOURCE_CHECKS): Only check for gethostbyname if getaddrinfo is not found. Disable getaddrinfo on HP-UX 11.[01]* here rather than ne_socket.c. Sat Jan 24 17:49:50 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Also check for __tm_gmtoff in struct tm. Sat Jan 24 17:16:48 2004 Joe Orton * neon.m4: Remove -ansi-pedantic and -Wimplicit-prototypes for gcc 3.4 compatibility (thanks to Olaf Hering). Sat Jan 3 14:11:14 2004 Joe Orton * neon-test.m4: Check for stdint.h. Sat Jan 3 13:17:21 2004 Joe Orton * neon.m4 (NE_LARGEFILE): Add NE_LFS to neon-config --cflags output. Thu Jan 1 18:42:56 2004 Joe Orton * neon.m4 (NEON_FORMAT): Use C99 'll' rather than non-standard 'q' length modifier. Thu Jan 1 17:36:39 2004 Joe Orton * neon.m4 (NE_LARGEFILE): New macro. (LIBNEON_SOURCE_CHECKS): Call it. Sat Nov 15 09:25:43 2003 Joe Orton * neon.m4, neon-xml-parser.m4: Update for latest autoconf best-practice: s/AC_HELP_STRING/AS_HELP_STRING, replace AC_TRY_RUN with AC_RUN_IFELSE, AC_TRY_LINK_FUNC with AC_LINK_IFELSE, AC_TRY_COMPILE with AC_COMPILE_IFELSE, remove AC_LANG_C and AC_PROG_CC_STDC, Fri Nov 14 13:12:10 2003 Joe Orton * neon.m4 (NEON_LIBIDN): New macro. (LIBNEON_SOURCE_CHECKS): Use NEON_LIBIDN. Fri Nov 14 11:28:58 2003 Joe Orton * neon.m4 (NE_ENABLE_SUPPORT, NE_DISABLE_SUPPORT): New macros. Use throughout to flag support or lack of support for optional features. Thu Nov 13 20:25:28 2003 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for gethostbyname in -lbind too. Tue Oct 7 21:20:16 2003 Joe Orton * neon-test.m4 (NEON_TEST): Check for shutdown. Mon Sep 22 21:20:37 2003 Joe Orton * neon.m4 (NE_CHECK_FUNCS, NE_SEARCH_LIBS): Avoid clobbering ne_save_{LIBS,CPPFLAGS}. Sun Sep 14 10:51:34 2003 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for working AI_ADDRCONFIG flag for getaddrinfo(). Wed Sep 10 21:45:10 2003 Joe Orton * neon.m4 (NEON_GSSAPI): Restore CPPFLAGS and NEON_LIBS if GSSAPI detection fails. Thu Sep 4 21:29:06 2003 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for netinet/tcp.h. Wed Jul 23 21:17:40 2003 Joe Orton * neon.m4 (NEON_GSSAPI): New macro. Mon Apr 21 18:24:12 2003 Joe Orton * neon-xml-parser.m4 (HAVE_EXPAT): Fail if --with-expat is given but expat.h is not found. Wed Mar 26 20:29:11 2003 Joe Orton * neon.m4 (NEON_SSL): And add ne_stubssl to NEON_EXTRAOBJS for non-SSL build. Tue Mar 25 20:43:01 2003 Joe Orton * neon.m4 (NEON_SSL): Add ne_openssl to NEON_EXTRAOBJS. Mon Mar 17 20:34:55 2003 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for netdb.h. Sun Mar 16 14:22:02 2003 Joe Orton * neon-xml-parser.m4 (NE_XML_BUNDLED_EXPAT): Define HAVE_XMLPARSE_H. Sun Mar 16 11:47:35 2003 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Also fix non-included-expat build for when included expat is not an option. Sun Mar 16 11:20:23 2003 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Fix non-included-expat build broken in previous commit. Sun Mar 16 09:06:41 2003 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Fix --with-included-expat support. Sun Mar 9 10:08:57 2003 Joe Orton * neon.m4 (NEON_SSL): Fail if --with-ssl is given an argument. Sun Mar 9 08:55:04 2003 Joe Orton * neon.m4 (NE_SEARCH_LIBS): Bug fix to always compare against `extras' if given. Add support for optional `actions-if-found' argument. * neon-xml-parser.m4: Largely rewritten. Drop support for libxml 1.x; require expat 1.95.x. Sun Mar 9 08:50:22 2003 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for stpcpy. Mon Mar 3 22:15:56 2003 Joe Orton * neon.m4 (NE_CHECK_FUNCS): Check whether h_errno is declared. Wed Feb 19 21:35:20 2003 Joe Orton * neon.m4 (NEON_FORMAT): Revert use of 'z' modifier; breaks on CygWin. Tue Jan 14 17:06:07 2003 Joe Orton * neon.m4 (NEON_FORMAT): Prefer the C99 'z' modifier to printf size_t/ssize_t values where available. Fri Jan 3 23:12:20 2003 Joe Orton * neon.m4 (NE_PKG_CONFIG): New macro. (NEON_SSL): Use NE_PKG_CONFIG rather than PKG_CHECK_MODULES. Mon Dec 16 20:02:45 2002 Joe Orton * neon.m4 (NEON_SSL): Only check for OpenSSL <=0.9.6 if version is known to be <=0.9.7. Mon Dec 16 19:01:57 2002 Joe Orton * neon.m4: Use pkg-config data to determine location OpenSSL libraries/headers, if available. Tue Nov 19 11:21:31 2002 Joe Orton * neon-test.m4 (NEON_TEST): Suggest this macro is run before NEON_XML_PARSER. Mon Oct 7 22:22:12 2002 Joe Orton * neon.m4 (NE_CHECK_SSLVER): New macro. (NEON_SSL): Use NE_CHECK_SSLVER. Add --with-egd argument; conditionally enable EGD, optionally using only a specific EGD socket path, and only if using OpenSSL before 0.9.7. Tue Sep 24 21:36:01 2002 Joe Orton * neon.m4 (NE_ZLIB_VERSION): Removed macro. (NEON_ZLIB): Removed --with-force-zlib flag; don't check zlib version. (NEON_SSL): Removed --with-force-ssl flag, only require OpenSSL 0.9.6 or later. Sat Aug 31 17:28:15 2002 Joe Orton * neon.m4 (NEON_FORMAT_PREP): Add check for gcc -Wformat -Werror sanity. (NEON_FORMAT): Only use gcc -Wformat -Werror if sanity is assured. Fri Aug 30 22:07:59 2002 Joe Orton * neon.m4: Set NEON_INTERFACE_VERSION according to NEON_VERSION_MINOR, NEON_VERSION_RELEASE, for the duration of neon 0.x releases. Sun Aug 25 23:52:38 2002 Joe Orton * neon.m4 (NE_CHECK_FUNCS): New macro. (LIBNEON_SOURCE_CHECKS): Use NE_CHECK_FUNCS rather than AC_CHECK_FUNCS, so $NEON_LIBS are searched. Sun Aug 25 11:53:20 2002 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Require inet_ntop as well for USE_GETADDRINFO test. Sun Aug 18 22:50:09 2002 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Remove redundant check for SIGPIPE definition. Sun Aug 18 22:41:15 2002 Joe Orton * neon.m4 (NE_SEARCH_LIBS): Take optional fourth argument. (LIBNEON_SOURCE_CHECKS): Define USE_GETADDRINFO if getaddrinfo and gai_strerror are present. Otherwise, check for hstrerror, possibly in -lresolv. * neon-test.m4: Don't check for hstrerror(). Sun Aug 18 22:31:13 2002 Joe Orton * neon-xml-parser.m4 (NEON_FIND_PARSER_H, NEON_XML_LIBXML2): Re-order checks to skip redundant tests, speeding up common case. Fri Aug 9 19:47:14 2002 Joe Orton * neon.m4 (NEON_SSL): Require OpenSSL 0.9.6f or later. Wed Jul 31 23:01:17 2002 Joe Orton * strftime.m4, readline.m4: Removed from neon/macros CVS module. Tue Jul 30 19:09:20 2002 Joe Orton * neon.m4 (NEON_COMMON_CHECKS): Require AC_TYPE_SIZE_T, AC_TYPE_OFF_T. * neon-test.m4 (NEON_TEST): Require AC_TYPE_PID_T. Tue Jul 30 19:06:48 2002 Joe Orton * neon.m4 (NEON_SSL): Require OpenSSL 0.9.6e or later for security fixes; add --with-force-ssl to override version check. Fri Jul 26 00:01:07 2002 Joe Orton * neon.m4 (NE_MACOSX): Just check for any Darwin system. Sat Jul 20 10:40:29 2002 Joe Orton * neon.m4 (NEON_WITH_LIBS): Allow a colon-separated list of directories for --with-libs argument. Thu Jul 18 20:07:43 2002 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Require AC_FUNC_STRERROR_R. Wed Jul 17 23:26:51 2002 Joe Orton * neon.m4 (NEON_CHECK_VERSION): Rewrite to cache results, simplify, and use new ne_version_match. (NE_ZLIB_VERSION): Cache result. Fri Jul 5 12:57:56 2002 Joe Orton * neon.m4 (NEON_SSL): Fail if openssl/opensslv.h header is not found, or if OpenSSL version is earlier than 0.9.6. Sun Jun 16 14:04:18 2002 Joe Orton * neon.m4 (NEON_FORMAT): Take optional third argument giving format string specifier to use. (NEON_COMMON_CHECKS): Get format string for ssize_t; fix to use 'u' specifier for size_t format string. Thu Jun 13 20:34:35 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Undocument use of =DIR parameter to --with-expat, as it gives false expectations. Wed Jun 12 23:26:40 2002 Joe Orton * neon.m4 (NEON_WITH_LIBS): New macro. Mon Jun 10 22:31:50 2002 Joe Orton * neon.m4 (NEON_WARNINGS): Replace -ansi-pedantic with -pedantic. Sun May 26 19:08:12 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_LIBXML2): Check for libxml/xmlversion.h header too. Wed May 22 09:54:42 2002 Joe Orton * neon.m4 (NE_MACOSX): Cache result. (NE_COMMON_CHECKS): Simplify tm_gmtoff check further: use AC_CHECK_MEMBERS. Mon May 20 21:18:06 2002 Joe Orton * neon.m4 (NE_SEARCH_LIBS): Cache results. Mon May 20 20:55:04 2002 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Use AC_CACHE_CHECK to check for SIGPIPE in signal.h; don't invade the ac_ namespace with cache variables. Cache results of tm_gmtoff test too. Mon May 20 20:35:22 2002 Joe Orton * neon.m4 (NE_SNPRINTF): Simplify logic. Sun May 19 20:23:55 2002 Joe Orton * neon.m4 (NEON_WARNINGS): Remove with_warnings variable; simplify. Wed May 19 08:36:44 2004 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Declare stpcpy on modern "Linux-like" AIXes. Sun May 19 09:35:08 2002 Joe Orton * neon.m4 (NE_FIND_AR): Fix $PATH handling on some Linux platforms. Sun May 19 09:05:22 2002 Joe Orton * neon.m4 (NE_FIND_AR): New macro. (NEON_NORMAL_BUILD): Require NE_FIND_AR. * neon-test.m4: Require NE_FIND_AR. Check for hstrerror(). Fri May 17 23:37:19 2002 Joe Orton * neon.m4 (NEON_SSL): Allow --without-ssl again. Wed May 15 21:00:15 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_LIBXML2): sed '-L/usr/lib ' out of xml2-config --libs output. Sat May 11 15:30:38 2002 Joe Orton * neon.m4 (NEON_SOCKS): Moved and simplified from neon-socks.m4. Drop support for specifying directory argument; fail if --with-socks is given and socks.h is not found. * neon-socks.m4: Removed file. Sat May 11 15:22:36 2002 Joe Orton * neon.m4 (NEON_DEBUG): Moved and simplified from neon-debug.m4. * neon-debug.m4: Removed file. Sat May 11 13:40:29 2002 Joe Orton * neon.m4 (NEON_WARNINGS): Moved and simplified from neon-warnings.m4. * neon-warnings.m4: Removed file. Sat May 11 13:26:00 2002 Joe Orton * neon.m4 (NEON_SSL): Simplified version of NEON_SSL from neon-ssl.m4. Check for ssl.h; detect OpenSSL ENGINE correctly when -lcrypto requries -ldl. * neon-ssl.m4: Removed file. Sat May 11 13:16:27 2002 Joe Orton * neon.m4 (NE_SEARCH_LIBS): Allow passing 'extralibs' to include in library list when link against a specified library fails. Prepend found library/libraries to $NEON_LIBS. Sat May 11 12:40:24 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER), * neon.m4 (NEON_REPLACE_SNPRINTF): Use AC_LIBOBJ rather than modify LIBOBJS directly, to appease autoconf 2.53. Wed May 1 22:32:10 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_LIBXML1): Fix syntax error in libxml 1.x detection causing spurious or missing warning message. Thu Apr 25 07:38:33 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_EXTERNAL_EXPAT): Check for expat.h too, to support expat 1.95.x (Branko Èibej). Tue Apr 23 21:09:55 2002 Joe Orton * neon-xml-parser.m4 (NEON_FIND_PARSER_H): New macro, factored out from NEON_XML_LIBXML2. (NEON_XML_LIBXML2, NEON_XML_LIBXML1): Use it. Tue Apr 23 20:54:30 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_LIBXML2): Check for parser.h or libxml/parser.h, or fail. Sat Apr 13 22:35:01 2002 Joe Orton * neon.m4 (NE_SNPRINTF): Define NEON_TRIO in NEON_CFLAGS, export it from 'neon-config --cflags' output. Fri Apr 5 23:40:00 2002 Joe Orton * neon.m4 (NEON_ZLIB, NE_ZLIB_VERSION): Add --with-force-zlib, to skip zlib version check. Simplify neon_zlib_message handling a little. Tue Mar 12 00:18:00 2002 Joe Orton * neon.m4 (NE_ZLIB_VERSION): New macro. (NEON_ZLIB): Use it to require zlib 1.1.4. Sun Mar 10 22:05:26 2002 Joe Orton * neon.m4 (NEON_ZLIB): Don't add ne_compress to NEON_EXTRAOBJS. Mon Mar 4 21:04:28 2002 Joe Orton * neon-ssl.m4 (NEON_SSL): Avoid adding -I/usr/include to CFLAGS during build as well as not exporting it via neon-config. Tue Feb 19 21:30:50 2002 Joe Orton * neon-socks.m4 (NEON_SOCKS): Fix configure argument name, export -L argument in NEON_LIBS, check for socks.h not sock.h, define NEON_SOCKS. Sun Jan 13 20:07:51 2002 Joe Orton * neon.m4 (NE_MACOSX): New macro. (NEON_COMMON_CHECKS): Call it. Sun Jan 6 21:35:08 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Add XML_BYTE_ORDER to CPPFLAGS; mini-expat doesn't pick up config.h. Tue Jan 1 23:30:03 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Set XML_BYTE_ORDER appropriately. Tue Jan 1 22:50:15 2002 Joe Orton * neon.m4 (NEON_CHECK_VERSION): Don't add libs for external neon to NEON_LIBS here. Tue Jan 1 22:44:05 2002 Joe Orton * neon-xml-parser.m4 (NEON_XML_LIBXML2, NEON_XML_LIBXML1): Alter CPPFLAGS only, not CFLAGS. Tue Jan 1 21:49:16 2002 Joe Orton * neon.m4 (NEON_USE_EXTERNAL): Factored out from NEON_COMMON. (NEON_COMMON): Use NEON_USE_EXTERNAL; simplify, improve reporting. * neon.m4 (NEON_COMMON_CHECKS): Move check for common headers here... (LIBNEON_SOURCE_CHECKS): from here. Tue Jan 1 21:44:33 2002 Joe Orton * neon-test.m4 (NEON_TEST): Check for AR and RANLIB. Fri Dec 14 22:39:57 2001 Joe Orton * neon-test.m4 (NEON_TEST): Pick up time_t definition from sys/time.h if present (fix for Solaris 2.6 and probably elsewhere). Fri Dec 14 22:39:32 2001 Joe Orton * neon.m4 (NEON_FORMAT): Allow passing in headers where type may be defined. Mon Dec 10 07:36:26 2001 Joe Orton * neon.m4 (NEON_COMMON): Fix --with-neon=PATH again. Sun Dec 9 21:40:47 2001 Joe Orton * neon-test.m4 (NEON_TEST): Determine how to print time_t. Sun Dec 9 11:50:03 2001 Joe Orton * neon.m4 (NEON_WITHOUT_ACL): New macro. (LIBNEON_SOURCE_CHECKS): Conditionally build ACL support. Sun Dec 9 01:06:32 2001 Joe Orton * neon.m4 (NEON_CHECK_VERSION): Use NEON_CONFIG as config script, drop first argument. Better error message if the link failed. (NEON_COMMON): Cleanup. Check for neon-config in PATH. Stop if --with-neon was given, and the external neon wasn't good enough. Sun Dec 9 00:17:19 2001 Joe Orton * neon-test.m4 (NEON_TEST): Requires NEON_COMMON_CHECKS. * neon-warnings.m4 (NEON_WARNINGS): Requires AC_PROG_CC. Sun Dec 9 00:13:47 2001 Joe Orton * neon.m4 (NEON_COMMON_CHECKS): New macro; runs common C language/compiler checks, which may be useful to neon applications regardless of whether a bundled or external neon is being used. Use AC_REQUIRE to prevent macros being expanded more than once. (LIBNEON_SOURCE_CHECKS, NEON_COMMON): Require NEON_COMMON_CHECKS to have been expanded. Sat Dec 8 00:56:34 2001 Joe Orton * neon.m4 (NEON_FORMAT): Rewrite to use cache results (should fix for cross-compiling), and for GCC, actually test for warnings - fix for Linux. Sat Dec 8 00:15:44 2001 Joe Orton * neon.m4 (NEON_CHECK_SUPPORT): Send --support output to /dev/null, in case it is from pre-0.18 and prints the usage message. Sat Dec 8 00:13:55 2001 Joe Orton * neon.m4 (NEON_COMMON): Prepend -lneon to NEON_LIBS rather than overwriting it when using bundled build. Mon Dec 3 19:49:28 2001 Joe Orton * neon.m4 (NEON_FORMAT_PREP, NEON_FORMAT): New macros. (LIBNEON_SOURCE_CHECKS): Call them. Mon Dec 3 19:43:11 2001 Joe Orton Fix gethostbyname() detection on Unixware 7: * neon.m4 (NEON_COMMON): Add -lneon to NEON_LIBS after performing source checks. (NE_SEARCH_LIBS): Test using libraries from NEON_LIBS too. Sat Nov 24 20:33:11 2001 Joe Orton * neon.m4 (NEON_CHECK_SUPPORT): New macro. (NEON_COMMON): Define NEON_SUPPORTS_{SSL,ZLIB} when using an external neon. Sat Nov 24 20:25:15 2001 Joe Orton * neon.m4 (NEON_WITHOUT_ZLIB): New function. (LIBNEON_SOURCE_CHECKS): Conditionally enable zlib support. Sun Nov 18 12:29:08 2001 Joe Orton * neon-ssl.m4 (NEON_SSL): Don't add -I/usr/include to NEON_CFLAGS. Sat Oct 27 12:20:08 2001 Joe Orton * neon.m4, neon-ssl.m4: Substitute NEON_SUPPORTS_ZLIB, NEON_SUPPORTS_DAV, NEON_SUPPORTS_SSL as "yes" or "no" appropriately. Thu Oct 25 14:29:53 2001 Mo DeJong * neon.m4 (NEON_NORMAL_BUILD): Use AC_CHECK_TOOL instead of AC_PATH_PROG so that cross compilation works properly. Sat Oct 6 13:36:58 2001 Joe Orton * neon.m4 (NEON_ZLIB): New macro. (LIBNEON_SOURCE_CHECKS): print warning if struct tm lacks tm_gmtoff. Sat Oct 6 12:39:09 2001 Joe Orton * neon.m4: Require autoconf 2.50. Use AC_HELP_STRING where possible, and AC_MSG_NOTICE instead of 'echo'. * neon-ssl.m4, neon-xml-parser.m4, neon-socks.m4: Quoting fixes for help strings. Tue Oct 2 21:13:24 2001 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for tm_gmtoff in struct tm. Sun Sep 30 23:35:03 2001 Joe Orton * neon.m4 (NE_SEARCH_LIBS): AC_SEARCH_LIBS replacement, adds found libraries to NEON_LIBS instead. Sun Sep 30 11:11:19 2001 Joe Orton * neon-test.m4: New file. Sun Sep 30 11:09:58 2001 Joe Orton * neon.m4, neon-xml-parser.m4: Always add libs to $LIBS rather than $NEONLIBS. * neon.m4: Export NEON_CFLAGS. Sat Sep 29 14:12:53 2001 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for zlib (zlib.h, inflate in -lz). Add ne_compress to NEON_EXTRAOBJS. Tue Sep 25 07:31:53 2001 Mo DeJong * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for instead of . Define HAVE_SIGPIPE if SIGPIPE is defined in . Mon Sep 24 20:16:47 2001 Joe Orton * neon-xml-parser.m4 (NEON_XML_EXTERNAL_EXPAT): Fix broken AC_DEFINE (Mo DeJong). Mon Sep 24 17:24:42 2001 Joe Orton * ac_c_bigendian_cross.m4: New file. * neon.m4: Use AC_C_BIGENDIAN_CROSS rather than AC_C_BIGENDIAN. Mon Sep 17 23:29:11 2001 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Check for setvbuf(). Sun Sep 16 20:39:05 2001 Joe Orton * neon-ssl.m4 (NEON_SSL): Put SSL libs in LIBS rather than NEONLIBS (and lib paths). Sun Sep 16 20:36:53 2001 Joe Orton * neon.m4 (NEON_COMMON): Add library paths to NEONLIBS rather than LDFLAGS. Sat Jun 9 22:06:25 2001 Joe Orton * neon-debug.m4: New file. Thu May 31 00:04:51 2001 Joe Orton * neon.m4 (NEON_COMMON_BUILD): Update filenames. (NEON_CHECK_VERSION): Do simple AC_TRY_LINK and warn appropriately before checking version. Thu May 31 00:03:40 2001 Joe Orton * neon-warnings.m4: Add -Wbad-function-cast. Wed May 30 23:37:48 2001 Joe Orton * neon-xml-parser.m4: Added --with-libxml1 and --with-libxml2 arguments. Tue Apr 17 23:06:25 2001 Joe Orton * neon-ssl.m4: Define neon_ssl_message for configure output. Wed Apr 11 23:14:33 2001 Joe Orton * neon.m4 (NEON_COMMON_BUILD): Fix specifying a list of object files. Fri Apr 6 23:09:58 2001 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Call NEON_SOCKS. Fri Apr 6 23:08:39 2001 Joe Orton * neon-socks.m4: Add basic SOCKSv5 support (untested). Mon Apr 2 21:42:40 2001 Joe Orton * neon.m4: Version is 0.13.0, interface version 13:0:0. Mon Apr 2 00:27:37 2001 Joe Orton * neon.m4: Move check for 'ar' program to NEON_NORMAL_BUILD, it's not necessary for libtool build. Mon Apr 2 00:17:58 2001 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Check for xmlversion.h header from libxml2. Sun Apr 1 21:23:26 2001 Joe Orton * neon-xml-parser.m4: Add expat2 support (Sam TH ). Wed Mar 21 10:56:03 2001 Joe Orton * neon-xml-parser.m4: Add libxml2 support. Sun Mar 4 15:45:21 2001 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Use an m4 ifelse rather than a shell test to code the conditional on whether an argument was passed to the macro or not. Sun Mar 4 15:23:47 2001 Joe Orton * neon.m4: Add "actions if not bundled" argument to *_BUNDLED macros. Mon Feb 26 22:52:24 2001 Joe Orton * neon.m4: Version is 0.12.0. Mon Feb 26 22:06:13 2001 Joe Orton * neon.m4: Versionn is 0.12.0-dev. Sun Feb 25 17:12:49 2001 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Add checks for endianness (for md5 code), inline, and const. Sun Feb 25 17:00:07 2001 Joe Orton * neon.m4 (NEON_COMMON): Rename NEON_IS_BUNDLED to NEON_BUILD_BUNDLED. Sun Feb 25 16:52:19 2001 Joe Orton * neon.m4 (NEON_COMMON): Define NEON_IS_BUNDLED to "yes" or "no" appropriately. Sat Feb 24 00:06:09 2001 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Don't set NEON_NEED_XML_PARSER here. (NEON_COMMON): ... set it here instead. (NEON_WITHOUT_WEBDAV): New macro to disable WebDAV support. (NEON_COMMON_BUILD): Select default set of object files to build depending on whether DAV is enabled or not. Fri Feb 23 23:28:09 2001 Joe Orton * neon.m4 (NEON_COMMON_BUILD): Use an m4 'ifelse' for the number of args test. * neon.m4 (NEON_LIBTOOL_BUILD, NEON_NORMAL_BUILD, NEON_COMMON_BUILD): Set NEON_OBJEXT correctly (fixes dependancies). Sun Feb 4 14:55:10 2001 Joe Orton * neon.m4: Version is 0.11.0, interface version is 11:0:0. Sun Jan 28 17:16:27 2001 Joe Orton * neon.m4 (NEON_CHECK_VERSION): Run actions-if-okay if NEON_REQUIRE has not been called. Sun Jan 28 14:53:57 2001 Joe Orton * neon.m4 (NEON_REQUIRE, NEON_CHECK_VERSION): New macros. (NEON_COMMON): If a required version is defined, check that an external neon library matches it. Sun Jan 28 10:39:31 2001 Joe Orton * neon.m4: Define NEON_VERSION, NEON_VERSION_{MAJOR,MINOR} in config.h rather than substituting into neon_config.h. Sat Jan 27 22:55:42 2001 Joe Orton * neon.m4: Include version string in library message. Tue Jan 23 23:14:33 2001 Joe Orton * neon.m4 (NEON_VERSIONS): New macro. (NEON_COMMON): Call it from here. Mon Jan 15 22:26:54 2001 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Append rather than overwrite CFLAGS. Thu Jan 11 20:49:12 2001 Joe Orton * neon-ssl.m4: Check for OpenSSL in /usr too. Thu Jan 11 20:05:34 2001 Joe Orton * neon.m4 (NEON_VPATH_BUNDLED): New macro. (NEON_BUNDLED): Call NEON_COMMON_BUNDLED. (NEON_COMMON_BUNDLED): Abstracted from NEON_BUNDLED. Wed Jan 10 22:44:37 2001 Joe Orton * neon.m4 (NEON_LIBTOOL_BUILD, NEON_NORMAL_BUILD): Pass optional set of objects to build to these macros. Else, all objects go in NEONOBJS. (NEON_COMMON_BUILD): Implement that. Also substitute NEON_LINK_FLAGS. Mon Jan 8 22:23:51 2001 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Put XML parser libs in $NEONLIBS rather than $LIBS. Mon Jan 8 22:20:51 2001 Joe Orton * neon-ssl.m4 (NEON_SSL): Put OpenSSL libs in $NEONLIBS rather than LIBS. Sun Jan 7 17:30:54 2001 Joe Orton * neon.m4 (NEON_BUNDLED): Add optional second argument to specify builddir of bundled sources (Peter Moulder ). Wed Jan 3 21:33:05 2001 Joe Orton * neon.m4: Place libraries needed to use neon in NEONLIBS. Adding them to LIBS breaks bundled builds since libneon doesn't exist at configure-time, and configure uses $LIBS. Wed Jan 3 21:17:00 2001 Joe Orton * neon.m4 (NEON_COMMON_BUILD): Don't set top_builddir using 'pwd'. Wed Jan 3 21:15:04 2001 Joe Orton * neon.m4 (NEON_COMMON): If using bundled neon, add -L to LDFLAGS, and -lneon to LIBS. Fri Dec 22 23:13:39 2000 Joe Orton * neon.m4 (NEON_NORMAL_BUILD, NEON_COMMON_BUILD): New macros. Tue Dec 19 22:13:18 2000 Joe Orton * neon.m4 (NEON_LIBTOOL_BUILD): New macro. Wed Dec 13 22:07:07 2000 Joe Orton * neon.m4: Add a decent interface: NEON_LIBRARY for non-bundled case, NEON_BUNDLED for the bundled case. (LIBNEON_SOURCE_CHECKS): Always set NEON_NEED_XML_PARSER. * neon-xml-parser.m4 (NEON_XML_PARSER): Only execute if "$NEON_NEED_XML_PARSER" = "yes". Sun Nov 19 22:52:56 2000 Joe Orton * neon.m4, neon-ssl.m4, neon-warnings.m4, neon-xml-parser.m4: Clarify that the more liberal license applies to the m4 files only, not neon in general. Sun Nov 19 22:40:01 2000 Joe Orton * neon.m4 (NEON_LIBRARY): Don't call NEON_XML_PARSER, set NEON_NEED_XML_PARSER to "yes" if it needs to be called. Sun Nov 19 22:31:26 2000 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Switch to useing NEON_INCLUDED_EXPAT m4 macro rather than passing arguments. Sun Nov 19 22:20:36 2000 Joe Orton * neon.m4 (NEON_LIBRARY): Switch to using NEON_INCLUDED_SOURCE m4 macro rather than passing arguments to the NEON_LIBRARY macro. Sun Nov 5 23:26:18 2000 Joe Orton * neon-xml-parser.m4: Never set LIBS if using a libtool-built libexpat.la (Greg Stein). 2000-10-10 Joe Orton * neon-xml-parser.m4: If libexpat.la is included in the --with-expat parameter, then use a libtool-friendly LIBS. (Greg Stein) Sat Oct 7 19:16:08 2000 Joe Orton * neon-xml-parser.m4: Link against a libexpat.la if found in --with-expat location. (Greg Stein). Mon Sep 11 15:05:58 2000 Joe Orton * neon.m4: Use AC_SEARCH_LIBS for finding gethostbyname() and socket(). Mon Sep 11 15:03:45 2000 Joe Orton * neon.m4 (NEON_REPLACE_SNPRINTF): New macro. Fri Sep 8 14:30:37 2000 Joe Orton * neon.m4: Check for socket() in -lsocket, -linet. Thu Sep 7 00:11:51 2000 Joe Orton * neon-xml-parser.m4: Added --with-expat flag (patch by Greg Stein). Sun Aug 13 11:12:41 2000 Joe Orton * strftime.m4: New file, from fileutils-4.0i. Thu Jul 27 19:59:18 2000 Joe Orton * neon-ssl.m4: Append the SSL libs on the end of $LIBS rather than redefining it completely. Thu Jul 27 19:43:38 2000 Joe Orton * neon.m4: Define variable neon_library_message to describe what neon library is being used. Mon Jul 24 16:56:34 2000 Joe Orton * neon-ssl.m4: Put -lssl before -lcrypto in LIBS. Thu Jul 20 15:12:14 2000 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Pass directory name containing bundled expat sources as $1. * neon.m4 (NEON_LIBRARY): Pass directory name containing bundled neon sources as $1, and $2 is passed to NEON_XML_PARSER for similar use. Thu Jul 20 15:04:49 2000 Joe Orton * neon-ssl.m4: Rewritten from scratch. Support OpenSSL only. Thu Jul 20 12:41:23 2000 Joe Orton * neon.m4, neon-xml-parser.m4, neon_warnings.m4: Added licensing information. Wed Jul 19 19:30:24 2000 Joe Orton * neon-warnings.m4: New file. (NEON_WARNINGS): Macro for doing --enable-warnings. Sun Jun 18 12:12:23 2000 Joe Orton * neon.m4: Only add --with-included-neon flag if neon is bundled. Sun Jun 18 12:08:23 2000 Joe Orton * gnome-x-checks.m4: Imported from GNOME CVS macros module, adding: descriptive args to AC_DEFINE HAVE_LIBSM call, requiring Gtk 1.2.8 and the Gtk 'gthread' module. Mon May 29 15:10:24 2000 Joe Orton * neon.m4 (LIBNEON_SOURCE_CHECKS): Call NEON_SSL. Tue May 23 19:11:29 2000 Joe Orton * neon.m4: Renamed from neon-checks.m4. Sun May 21 23:52:27 2000 Joe Orton * neon-ssl.m4: New file. Sat May 13 21:08:54 2000 Joe Orton * acconfig.h: Added HAVE_LC_MESSAGE (my lcmessage.m4 is missing the appropriate description arguments). Sat May 13 21:08:40 2000 Joe Orton * acconfig.h: Added PACKAGE and VERSION. Sat May 13 21:02:29 2000 Joe Orton * socklen-arg-type.m4: Added file, modified from a KDE configure.in. Sat May 13 20:44:56 2000 Joe Orton * gnome-x-checks.m4: Added description arguments to AC_DEFINE(HAVE_LIBSM). Wed May 10 19:18:14 2000 Joe Orton * neon-xml-parser.m4: Error if no XML parser is found. Wed May 10 14:33:21 2000 Joe Orton * neon-checks.m4: New file. Wed May 10 14:26:57 2000 Joe Orton * neon-xml-parser.m4 (NEON_XML_PARSER): Use "neon_" prefix for variables. Wed May 10 13:47:04 2000 Joe Orton * acconfig.h: New file. Wed May 10 13:42:16 2000 Joe Orton * neon-xml-parser.m4: New file. Sun May 7 21:57:32 2000 Joe Orton * gnome-x-checks.m4 (GNOME_X_CHECKS): Check for Gtk 1.2.7 or later, passing "gthread" module argument. cadaver-0.23.3/m4/neon/socklen-arg-type.m40000664000076400007640000000170310127573646017547 0ustar jortonjortondnl This function is (C) 1997,98,99 Stephan Kulow (coolo@kde.org) dnl Modifications (C) Joe Orton 1999,2000 AC_DEFUN([SOCKLEN_ARG_TYPE],[ dnl Check for the type of the third argument of getsockname AC_MSG_CHECKING(for the third argument of getsockname) AC_CACHE_VAL(ac_cv_ksize_t, [AC_TRY_COMPILE([ #include #include ],[ socklen_t a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_ksize_t=socklen_t, ac_cv_ksize_t=) if test -z "$ac_cv_ksize_t"; then ac_safe_cflags="$CFLAGS" if test "$GCC" = "yes"; then CFLAGS="-Werror $CFLAGS" fi AC_TRY_COMPILE([ #include #include ],[ int a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_ksize_t=int, ac_cv_ksize_t=size_t) CFLAGS="$ac_safe_cflags" fi ]) if test -z "$ac_cv_ksize_t"; then ac_cv_ksize_t=int fi AC_MSG_RESULT($ac_cv_ksize_t) AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t, [Define to be the type of the third argument to getsockname]) ])cadaver-0.23.3/m4/neon/neon-test.m40000664000076400007640000000262711040461043016263 0ustar jortonjorton# Copyright (C) 2001-2006 Joe Orton -*- autoconf -*- # # This file is free software; you may copy and/or distribute it with # or without modifications, as long as this notice is preserved. # This software 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. # The above license applies to THIS FILE ONLY, the neon library code # itself may be copied and distributed under the terms of the GNU # LGPL, see COPYING.LIB for more details # This file is part of the neon HTTP/WebDAV client library. # See http://www.webdav.org/neon/ for the latest version. # Please send any feedback to # Tests needed for the neon-test common test code. AC_DEFUN([NE_FORMAT_TIMET], [ NEON_FORMAT(time_t, [ #ifdef HAVE_SYS_TIME_H #include #endif]) ]) AC_DEFUN([NEON_TEST], [ AC_REQUIRE([NEON_COMMON_CHECKS]) AC_REQUIRE([NE_FORMAT_TIMET]) AC_REQUIRE([AC_TYPE_PID_T]) AC_REQUIRE([AC_HEADER_TIME]) dnl NEON_XML_PARSER may add things (e.g. -I/usr/local/include) to dnl CPPFLAGS which make "gcc -Werror" fail in NEON_FORMAT; suggest dnl this macro is used first. AC_BEFORE([$0], [NEON_XML_PARSER]) AC_CHECK_HEADERS(sys/time.h stdint.h locale.h) AC_CHECK_FUNCS(pipe isatty usleep shutdown setlocale) AC_REQUIRE([NE_FIND_AR]) ]) cadaver-0.23.3/m4/readline.m40000664000076400007640000000141310132320456015166 0ustar jortonjorton dnl CHECK_READLINE checks for presence of readline on the dnl system. AC_DEFUN([CHECK_READLINE], [ AC_ARG_ENABLE(readline, [ --disable-readline disable readline support ], [use_readline=$enableval], [use_readline=yes]) dnl Defaults to ON (if found) if test "$use_readline" = "yes"; then AC_CHECK_LIB(curses, tputs, LIBS="$LIBS -lcurses", AC_CHECK_LIB(ncurses, tputs)) AC_CHECK_LIB(readline, readline) AC_SEARCH_LIBS(add_history, history, AC_DEFINE(HAVE_ADD_HISTORY, 1, [Define if you have the add_history function]) ) AC_CHECK_HEADERS(history.h readline/history.h readline.h readline/readline.h) # Check for rl_completion_matches as in readline 4.2 AC_CHECK_FUNCS(rl_completion_matches) msg_readline="enabled" else msg_readline="disabled" fi ]) cadaver-0.23.3/m4/strftime.m40000664000076400007640000000721710224563256015261 0ustar jortonjorton#serial 6 dnl This macro is intended to be used solely in this file. dnl These are the prerequisite macros for GNU's strftime.c replacement. dnl FIXME: the list is far from complete AC_DEFUN([_jm_STRFTIME_PREREQS], [ dnl strftime.c uses localtime_r if it exists. Check for it. AC_CHECK_FUNCS(localtime_r) dnl FIXME: add tests for everything in strftime.c: e.g., HAVE_BCOPY, dnl HAVE_TZNAME, HAVE_TZSET, HAVE_TM_ZONE, etc. ]) dnl Determine if the strftime function has all the features of the GNU one. dnl dnl From Jim Meyering. dnl AC_DEFUN([jm_FUNC_GNU_STRFTIME], [AC_REQUIRE([AC_HEADER_TIME])dnl _jm_STRFTIME_PREREQS AC_REQUIRE([AC_C_CONST])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_CHECK_HEADERS(sys/time.h) AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime, [AC_TRY_RUN( changequote(<<, >>)dnl << /* Ulrich Drepper provided parts of the test program. */ #if STDC_HEADERS # include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif static int compare (const char *fmt, const struct tm *tm, const char *expected) { char buf[99]; strftime (buf, 99, fmt, tm); if (strcmp (buf, expected)) { #ifdef SHOW_FAILURES printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n", fmt, expected, buf); #endif return 1; } return 0; } int main () { int n_fail = 0; struct tm *tm; time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */ tm = gmtime (&t); /* This is necessary to make strftime give consistent zone strings and e.g., seconds since the epoch (%s). */ putenv ("TZ=GMT0"); #undef CMP #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected)) CMP ("%-m", "1"); /* GNU */ CMP ("%A", "Friday"); CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */ CMP ("%B", "January"); CMP ("%^B", "JANUARY"); CMP ("%C", "19"); /* POSIX.2 */ CMP ("%D", "01/09/70"); /* POSIX.2 */ CMP ("%F", "1970-01-09"); CMP ("%G", "1970"); /* GNU */ CMP ("%H", "13"); CMP ("%I", "01"); CMP ("%M", "06"); CMP ("%M", "06"); CMP ("%R", "13:06"); /* POSIX.2 */ CMP ("%S", "07"); CMP ("%T", "13:06:07"); /* POSIX.2 */ CMP ("%U", "01"); CMP ("%V", "02"); CMP ("%W", "01"); CMP ("%X", "13:06:07"); CMP ("%Y", "1970"); CMP ("%Z", "GMT"); CMP ("%_m", " 1"); /* GNU */ CMP ("%a", "Fri"); CMP ("%^a", "FRI"); CMP ("%b", "Jan"); CMP ("%^b", "JAN"); CMP ("%c", "Fri Jan 9 13:06:07 1970"); CMP ("%^c", "FRI JAN 9 13:06:07 1970"); CMP ("%d", "09"); CMP ("%e", " 9"); /* POSIX.2 */ CMP ("%g", "70"); /* GNU */ CMP ("%h", "Jan"); /* POSIX.2 */ CMP ("%^h", "JAN"); CMP ("%j", "009"); CMP ("%k", "13"); /* GNU */ CMP ("%l", " 1"); /* GNU */ CMP ("%m", "01"); CMP ("%n", "\n"); /* POSIX.2 */ CMP ("%p", "PM"); CMP ("%r", "01:06:07 PM"); /* POSIX.2 */ CMP ("%s", "738367"); /* GNU */ CMP ("%t", "\t"); /* POSIX.2 */ CMP ("%u", "5"); /* POSIX.2 */ CMP ("%w", "5"); CMP ("%x", "01/09/70"); CMP ("%y", "70"); CMP ("%z", "+0000"); /* GNU */ exit (n_fail ? 1 : 0); } >>, changequote([, ])dnl jm_cv_func_working_gnu_strftime=yes, jm_cv_func_working_gnu_strftime=no, dnl When crosscompiling, assume strftime is missing or broken. jm_cv_func_working_gnu_strftime=no) ]) if test $jm_cv_func_working_gnu_strftime = no; then AC_SUBST(LIBOBJS) LIBOBJS="$LIBOBJS strftime.$ac_objext" AC_DEFINE_UNQUOTED(strftime, gnu_strftime, [Define to gnu_strftime if the replacement function should be used.]) fi ]) AC_DEFUN([jm_FUNC_STRFTIME], [ _jm_STRFTIME_PREREQS AC_REPLACE_FUNCS(strftime) ]) cadaver-0.23.3/m4/mkstemp.m40000664000076400007640000000220310132320456015061 0ustar jortonjorton#serial 1 # On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the # silly limit that it can create no more than 26 files from a given template. # Other systems lack mkstemp altogether. On either type of system, arrange # to use the replacement function. AC_DEFUN([UTILS_FUNC_MKSTEMP], [dnl AC_REPLACE_FUNCS(mkstemp) if test $ac_cv_func_mkstemp = no; then utils_cv_func_mkstemp_limitations=yes else AC_CACHE_CHECK([for mkstemp limitations], utils_cv_func_mkstemp_limitations, [ AC_TRY_RUN([ # include int main () { int i; for (i = 0; i < 30; i++) { char template[] = "conftestXXXXXX"; int fd = mkstemp (template); if (fd == -1) exit (1); close (fd); } exit (0); } ], utils_cv_func_mkstemp_limitations=no, utils_cv_func_mkstemp_limitations=yes, utils_cv_func_mkstemp_limitations=yes ) ] ) fi if test $utils_cv_func_mkstemp_limitations = yes; then AC_LIBOBJ(mkstemp) AC_LIBOBJ(tempname) AC_DEFINE(mkstemp, rpl_mkstemp, [Define to rpl_mkstemp if the replacement function should be used.]) fi ]) cadaver-0.23.3/m4/inttypes.m40000664000076400007640000000157210132320456015270 0ustar jortonjorton#serial 6 dnl From Paul Eggert. AC_PREREQ(2.52) # Define intmax_t to long or long long if doesn't define. AC_DEFUN([jm_AC_TYPE_INTMAX_T], [ AC_REQUIRE([jm_AC_TYPE_LONG_LONG]) AC_CHECK_TYPE(intmax_t, , [test $ac_cv_type_long_long = yes \ && ac_type='long long' \ || ac_type='long' AC_DEFINE_UNQUOTED(intmax_t, $ac_type, [Define to widest signed type if doesn't define.])]) ]) # Define uintmax_t to unsigned long or unsigned long long # if doesn't define. AC_DEFUN([jm_AC_TYPE_UINTMAX_T], [ AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) AC_CHECK_TYPE(uintmax_t, , [test $ac_cv_type_unsigned_long_long = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, [Define to widest unsigned type if doesn't define.])]) ]) cadaver-0.23.3/m4/longlong.m40000664000076400007640000000213410132320456015223 0ustar jortonjorton#serial 2 dnl From Paul Eggert. # Define HAVE_LONG_LONG if 'long long' works. AC_DEFUN([jm_AC_TYPE_LONG_LONG], [ AC_CACHE_CHECK([for long long], ac_cv_type_long_long, [AC_TRY_LINK([long long ll = 1; int i = 63;], [long long llmax = (long long) -1; return ll << i | ll >> i | llmax / ll | llmax % ll;], ac_cv_type_long_long=yes, ac_cv_type_long_long=no)]) if test $ac_cv_type_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the long long type.]) fi ]) # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], [ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], [unsigned long long ullmax = (unsigned long long) -1; return ull << i | ull >> i | ullmax / ull | ullmax % ull;], ac_cv_type_unsigned_long_long=yes, ac_cv_type_unsigned_long_long=no)]) if test $ac_cv_type_unsigned_long_long = yes; then AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, [Define if you have the unsigned long long type.]) fi ]) cadaver-0.23.3/Makefile.in0000664000076400007640000000614310754021641014677 0ustar jortonjorton# cadaver Makefile: generated from Makefile.in PACKAGE = @PACKAGE_NAME@ VERSION = @PACKAGE_VERSION@ SHELL = @SHELL@ @SET_MAKE@ # Installation paths. prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ man1dir = $(mandir)/man1 datarootdir = @datarootdir@ datadir = $(prefix)/share docdir = $(prefix)/doc/cadaver # intl stuff localedir = $(datadir)/locale gnulocaledir = $(prefix)/share/locale gettextsrcdir = $(prefix)/share/gettext aliaspath = $(localedir):. # Build paths top_srcdir = @top_srcdir@ top_builddir = . VPATH = @srcdir@ # Toolchain settings. CC = @CC@ INCLUDES = -I$(top_srcdir)/src CPPFLAGS = @DEFS@ @CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" CFLAGS = @CFLAGS@ ALL_CFLAGS = $(CPPFLAGS) $(INCLUDES) $(CFLAGS) LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ @NEON_LIBS@ TARGET = $(PACKAGE) SUBDIRS = lib/neon lib/intl OBJECTS = src/cadaver.o src/common.o src/commands.o src/ls.o \ src/cmdline.o src/options.o src/utils.o src/edit.o \ src/version.o src/search.o LIBOBJS = lib/basename.o lib/dirname.o lib/rpmatch.o lib/yesno.o \ lib/glob.o lib/getpass.o lib/tempname.o lib/mkstemp.o \ @LIBOBJS@ ALLOBJS = $(OBJECTS) $(LIBOBJS) # Installation programs INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL = @INSTALL@ all: $(TARGET) .PHONY: subdirs install clean distclean $(TARGET): $(ALLOBJS) subdirs $(CC) $(LDFLAGS) -o $(TARGET) $(ALLOBJS) $(LIBS) .c.o: $(CC) $(ALL_CFLAGS) -o $@ -c $< subdirs: for d in $(SUBDIRS); do (cd $$d; $(MAKE)); done clean: rm -f $(OBJECTS) $(LIBOBJS) $(TARGET) *~ for d in $(SUBDIRS); do (cd $$d; $(MAKE) clean); done distclean: clean rm -f Makefile config.* for d in $(SUBDIRS); do (cd $$d; $(MAKE) distclean); done install: $(TARGET) install-nls @echo "Creating directories..." $(INSTALL) -d $(DESTDIR)$(bindir) $(INSTALL) -d $(DESTDIR)$(man1dir) @echo "Installing $(TARGET) executable..." $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)/$(TARGET) @echo "Installing man page..." $(INSTALL_DATA) $(top_srcdir)/doc/cadaver.1 $(DESTDIR)$(man1dir)/cadaver.1 install-nls: @cd po && $(MAKE) install Makefile: Makefile.in @./config.status Makefile # Deps src/cadaver.o: src/cadaver.c config.h src/common.h \ src/options.h src/cmdline.h src/commands.h src/cadaver.h src/options.o: src/options.c config.h src/options.h src/cadaver.h src/common.h src/cmdline.o: src/cmdline.c src/cmdline.h src/cadaver.h lib/basename.h \ lib/glob.h src/commands.h src/common.h src/commands.o: src/commands.c src/commands.h src/cadaver.h \ lib/basename.h src/options.h src/common.h src/edit.o: src/edit.c src/cadaver.h src/options.h src/common.h src/common.o: src/common.c src/common.h config.h src/ls.o: src/ls.c src/commands.h src/cadaver.h config.h src/search.o: src/search.c src/commands.h src/cadaver.h config.h src/utils.o: src/utils.c src/utils.h src/cadaver.h config.h src/version.o: src/version.c src/utils.h src/cadaver.h config.h lib/netrc.o: lib/netrc.c lib/netrc.h config.h lib/getpass.o: lib/getpass.c lib/getpass.h config.h lib/tempname.o: lib/tempname.c config.h lib/mkstemp.o: lib/mkstemp.c src/common.h config.h lib/yesno.o: lib/yesno.c src/common.h config.h cadaver-0.23.3/ChangeLog0000664000076400007640000021466710132320456014414 0ustar jortonjortonThu Jan 8 20:57:28 2004 Joe Orton * src/cadaver.c (supply_creds_server): Only use credentials from netrc on first attempt to authenticate. Thu Jul 31 20:52:01 2003 Joe Orton * configure.in: Fix included getopt build. Tue Jul 1 22:32:21 2003 Joe Orton * src/commands.c (execute_mkcol): Cleanup. (execute_get): Handle close() failure. Tue Jul 1 22:12:19 2003 Joe Orton * src/commands.c (out_start): Tue Jul 1 22:08:53 2003 Joe Orton * src/ls.c (fetch_resource_list): Update for final neon 0.24 API. Tue Jul 1 22:07:21 2003 Joe Orton * src/commands.c (multi_mput): Use resolve_path not clever_path; fix mput into collection with escaped URI. Sun Jun 22 20:53:25 2003 Joe Orton * src/cadaver.c (cert_verify): Update for neon final 0.24 SSL API. (read_command): Unescape path before printing in prompt. Sun Jun 22 20:50:33 2003 Joe Orton * src/commands.c (resolve_path): Fix URI-escaping for path=".". Wed Apr 23 14:38:29 2003 Joe Orton * src/cadaver.c (privkey_prompt): Removed. (cert_verify, setup_ssl): Adapt for new neon 0.24 SSL API. (provide_clicert): New function. * src/options.c: Replace opt_cert, opt_certkey with opt_clicert. Wed Apr 23 14:35:54 2003 Joe Orton Temporarily disable DeltaV and DASL code until ported to new XML API. * src/commands.c (commands): Disable DeltaV and DASL commands until ported to new XML API. * Makefile.in (OBJECTS): Remove search.o and version.o. Wed Apr 23 14:34:01 2003 Joe Orton Update `ls' code for new XML API: * src/ls.c (ls_idmap): Replaces complex_elms. (ls_startelm): New function, replaces end_element and check_context. (ls_props): Remove displayname. (free_resource): Remove displayname. (fetch_resource_list Wed Apr 23 14:07:53 2003 Joe Orton * src/cadaver.c (main): Call init_rcfile last. Tue Feb 11 20:53:14 2003 Joe Orton * src/options.c (find_option, execute_describe): New functions. Sun Jan 12 14:34:59 2003 Joe Orton * src/commands.c (clever_path): When appending basename of src to a dest collection, escape the basename first. (fixes 'mput' of filenames which contain spaces). Fri Aug 30 23:48:59 2002 Joe Orton * src/cadaver.c (privkey_prompt, supply_creds_server): Use strnzcpy. * src/cmdline.c (davglob_readdir): Use ne_strnzcpy. Wed Aug 21 15:57:11 2002 Joe Orton * src/cadaver.c (open_connection): Use session error string for NE_CONNECT and NE_LOOKUP errors too. Mon Aug 12 13:13:17 2002 Joe Orton * src/edit.c (execute_edit): Don't include extension in temporary file name if there is a slash after the dot. Sat Aug 3 22:37:25 2002 Joe Orton * Makefile.in (all): Add before .PHONY to prevent problems with non-GNU makes. (.PHONY): Also include install, again, clean. Wed Jul 31 23:32:23 2002 Joe Orton * configure.in: Use jm_PREREQ_TEMPNAME for lib/tempname.c checks. Wed Jul 31 23:27:09 2002 Joe Orton * src/cadaver.c (init_options): Set 'quiet' option to on by default. Wed Jul 31 23:25:46 2002 Joe Orton * m4/prereq.m4 (jm_PREREQ_TEMPNAME): Require jm_AC_TYPE_UINTMAX_T. Fri Jul 26 22:42:42 2002 Joe Orton * src/commands.c: Don't declare commands[] array as static; fix non-GCC build. Sun Jul 14 18:14:35 2002 Joe Orton * src/commands.c (execute_less, execute_cat): Use ne_get in favour of ne_read_file. Sun May 26 11:44:30 2002 Joe Orton * src/edit.c (ed_valid, ed_startelm, ed_endelm, free_srclist, this_server, examine): New functions. (is_lockable): Removed. (execute_edit): Edit the source resource if one is defined, using the {DAV:}source-set property proposal. Drop support for editing non-LOCK-able resources. Thu May 23 19:41:07 2002 Joe Orton * src/options.c (do_debug): Update for neon 0.21 ne_token API. Sun May 19 18:30:03 2002 Joe Orton * src/cadaver.c (main): Update for neon 0.21 socket API; use ne_sock_init. Also call ne_sock_exit() before returning. Drop redirect support. Thu May 16 20:19:24 2002 Joe Orton * src/commands.c (cad_utf8_encode, cad_utf8_decode): Add back this hack in a difference place, compensating for disappearance of ne_utf8_{encode,decode}. (utf8_encode, utf8_decode): Use them. Wed May 15 20:50:42 2002 Joe Orton * configure.in: Use AC_LIBOBJ; check for __secure_getenv for lib/tempname.c, don't generate intl/Makefile. Wed May 15 20:49:33 2002 Joe Orton * lib/tempname.c: Fix all the warnings: s/_LIBC/defined(_LIBC), prototype __path_search, __gen_tempname. (__gen_tempname): Remove unused variable. Thu May 2 07:51:54 2002 Joe Orton * src/commands.c (out_result): Replace NE_AUTHPROXY with NE_PROXYAUTH for neon 0.20. Wed May 1 22:05:38 2002 Joe Orton * src/cadaver.c (cert_verify): Don't prompt if !isatty(stdin). (open_connection): Adjust for neon 0.20 default port from ne_uri_parse. Thu Mar 28 10:58:30 2002 Joe Orton * configure.in: Always enable checks for mkstemp replacement. Thu Mar 14 22:14:03 2002 Joe Orton * src/commands.c (execute_cd): Disallow "cd -" when no previous collection is set. Thu Mar 14 22:10:01 2002 Joe Orton * src/commands.c (choose_pager): Allow pager option to over-ride env vars. * src/options.h, src/options.c: Add opt_pager. Sun Mar 10 12:11:00 2002 Joe Orton * src/commands.c (execute_lock, execute_unlock): Use ne_lock_create, ne_lock_destroy, and fix leaks. Sun Mar 10 12:09:21 2002 Joe Orton * src/cadaver.c (remote_completion): Remove double-malloc. Sat Mar 9 13:36:15 2002 Joe Orton * src/commands.c (execute_version): Include readline version. Sat Mar 9 08:48:24 2002 Joe Orton * src/commands.c (print_lock): Don't use print_uri, unparse directly. Thu Mar 7 21:27:51 2002 Joe Orton * src/cadaver.c (open_connection): Better error handling for NE_CONNECT and NE_LOOKUP errors. Thu Mar 7 20:06:06 2002 Joe Orton * src/commands.c (execute_pwd): Print current collection URL. Fri Mar 1 23:05:46 2002 Joe Orton * src/edit.c: New file. * src/commands.c (getowner): Make public. (run_editor, is_lockable, execute_edit): Split out from commands.c. * src/cadaver.h (execute_edit): Add prototype. * src/commands.h (getowner): Add prototype. Fri Mar 1 23:04:26 2002 Joe Orton * lib/mkstemp.c (cad_mkstemp): Renamed from rpl_mkstemp. Fri Mar 1 23:03:27 2002 Joe Orton * lib/tempname.c (__gen_tempname): Allow XXXXXX's to appear somewhere other than the end of the filename. Fri Mar 1 22:43:27 2002 Joe Orton * src/commands.c (do_discover): Factored out from execute_steal, execute_discover. (execute_steal, execute_discover): Use do_discover. Sat Feb 23 15:22:44 2002 Joe Orton Update for neon 0.19 API: * src/cadaver.c (privkey_prompt): Remove filename argument. (make_dn_string, cert_verify): New functions. (setup_ssl, open_connection): Adjust for API changes. (init_rcfile, readline): Use ne_shave rather than STRIP_EOL. Tue Feb 19 21:41:49 2002 Joe Orton * configure.in: Comment NLS section to remove dubious quoting. Sat Jan 26 15:48:27 2002 Joe Orton * src/cadaver.c (completion): Only do remote completion when connection is established. Sun Jan 20 20:16:09 2002 Joe Orton * src/commands.c (execute_delete): Remove locks if delete succeeds. 2002-01-19 Joe Orton * src/options.c (do_debug): Clear debug mask if unset given with no arguments. Tue Jan 15 00:57:39 2002 Joe Orton * src/cadaver.c (close_connection, open_connection): Use lockstore option. (init_options): Fix initialization of lockscope option. (main): Initialize lockstore option. Tue Jan 15 00:51:33 2002 Joe Orton * src/options.c (options): Add lockstore option. (display_options): Vertically align. Mon Jan 14 22:54:14 2002 Joe Orton * src/cadaver.c (init_locking, finish_locking): Moved to and made private here. Mon Jan 14 22:48:16 2002 Joe Orton * src/cadaver.h: Don't export execute_*, multi_*. * src/cadaver.c: Made execute_*, multi_* static. Mon Jan 14 22:40:15 2002 Joe Orton * src/commands.c: Move commands[] array here. For GCC, add type-safety in initialization. (execute_version): Moved here. * src/cadaver.h (struct command): Add union for command functions. * src/cadaver.c (execute_command): Eliminate casts of function pointers. (open_connection, close_connection): Made public. Mon Jan 14 20:45:56 2002 Joe Orton * src/options.c: Add `quiet' option. * src/cadaver.c (connection_status): If quiet is set, do nothing. Mon Jan 14 20:38:43 2002 Joe Orton * src/commands.c (print_lock): Print depth on the second line. (get_timeout): Print 'seconds' for a seconds value. (execute_lock): In-line true_path; use lockdepth setting for any non-collection resource. Mon Jan 14 20:00:47 2002 Joe Orton * Makefile.in (OBJECTS): Add utils.o. (Makefile): New target. (install): Install man page. Mon Jan 14 19:59:11 2002 Joe Orton * src/utils.c: New file. (getrestype): Moved from src/commands.c:is_collection; returns resource type. * src/commands.c, src/cadaver.c, src/cmdline.c: All callers changed. Tue Jan 8 20:57:27 2002 Joe Orton * src/commands.c (execute_get): Fix local file permissions. Sun Jan 6 21:23:47 2002 Joe Orton * src/options.c: Add overwrite, lockdepth, lockscope options. Tue Jan 1 22:38:05 2002 Joe Orton * Makefile.in: Cleanups, fixes for VPATH builds, use CPPFLAGS properly. Tue Jan 1 14:03:09 2002 Joe Orton * src/commands.c (propop): Factored out from execute_propset. (execute_propset): Use propop. (execute_propdel): New function. Sat Nov 24 11:41:37 2001 Joe Orton * src/cadaver.c (remote_completion): New function (from Sean Treadway). (completion): Fixes for readline 4.2. Mon Nov 12 15:53:48 2001 Joe Orton * src/ls.c (execute_ls): Resolve path to a collection. Tue Oct 30 20:23:07 2001 Joe Orton * src/commands.c (discover_results, steal_result, execute_steal, execute_discover): Count number of locks found, and adjust output accordingly. Wed Jun 20 21:49:41 2001 Joe Orton * src/ls.c (results): Fix detecting the 'executable' property. Sun Jun 3 23:39:54 2001 Joe Orton * src/commands.c (execute_edit): Adjust for FILE * -> int fd change of ne_put/get. Sun Jun 3 23:31:51 2001 Joe Orton * src/options.c (do_debug): Use ne_token. Sat Jun 2 23:32:28 2001 Joe Orton * lib/glob.h: Kill -Wundef warning from '#if _FILE_OFFSET_BITS != 64' conditional. Sat Jun 2 23:30:02 2001 Joe Orton * src/options.c, src/ls.c, src/commands.c, src/cadaver.c: s/http_/ne_/g etc for neon 0.15 API. Sun Apr 22 16:50:42 2001 Joe Orton * src/ls.c (fetch_resource_list, results): Updated for neon 0.14 properties API. Mon Apr 2 21:12:52 2001 Joe Orton * src/ls.c (check_context): Fix return codes: decline everything we don't like. Tue Mar 20 23:11:02 2001 Joe Orton * src/commands.c (execute_propget, execute_propset, pget_results, all_iterator): Perform utf8_encode/decode on property names too. Tue Mar 20 23:10:07 2001 Joe Orton * src/ls.c (display_ls_line): Unescape URI since neon doesn't do it for us any more. Tue Mar 20 22:39:31 2001 Joe Orton * src/commands.c (utf8_decode, utf8_encode): Perform UTF8 decoding/encoding if utf8 option is set. (execute_propset, all_iterator, pget_results): Use utf8_encode/decode. Tue Mar 20 22:37:39 2001 Joe Orton * src/commands.c (resolve_path): Escape paths too. Tue Mar 20 20:31:59 2001 Joe Orton * src/cadaver.c (init_options): Turn on utf8 option if the string "UTF-8" is found in one of the locale environment variables, in accordance with the Markus Kahn Unicode Unicode FAQ. Tue Mar 20 20:30:48 2001 Joe Orton * src/cadaver.c: Adjust for neon 0.13 connection status/progress API. Mon Mar 19 18:41:59 2001 Joe Orton * src/options.c (get_bool_option): New function. Mon Mar 19 18:41:53 2001 Joe Orton * src/options.c: Add utf8 option. Mon Mar 19 18:28:22 2001 Joe Orton * src/commands.c (execute_propnames, propname_results, propname_iterator): New functions. Mon Mar 5 00:24:05 2001 Joe Orton * src/cadaver.c (supply_creds_proxy, supply_creds_server): Removed hostname argument as per neon 0.13 change. Mon Mar 5 00:05:04 2001 Joe Orton * src/commands.c (execute_logout): New function. Tue Feb 27 09:22:14 2001 Joe Orton * configure.in: Bumped version to 0.17.1. Tue Feb 27 09:18:31 2001 Joe Orton * configure.in: Add -lintl to LIBS if using included libintl. Turn off NLS. Mon Feb 26 22:08:14 2001 Joe Orton * configure.in: Bumped version to 0.17.0. Mon Feb 26 22:02:39 2001 Joe Orton * configure.in: Remove checks duplicated with neon.m4. Sun Feb 25 18:11:23 2001 Joe Orton * src/options.c: Added 'opt_namespace' string option. * src/cadaver.c (DEFAULT_NAMESPACE): New macro. (init_options): Set default for namespace. * src/commands.c (execute_propset, execute_propget): Use opt_namespace as default namespace. Sun Feb 25 17:51:37 2001 Joe Orton * src/commands.c (execute_propset): New command. * src/cadaver.c: Added 'propset' command. Fri Feb 23 23:02:19 2001 Joe Orton * src/cadaver.c: Allow one or two argument to propget to allow allprop requests. Fri Feb 23 22:59:50 2001 Joe Orton * src/commands.c (pget_results): If NULL list of propnames is given, use the allprop iterator. (execute_propget): Use dav_simple_propfind. Fri Feb 23 22:35:14 2001 Joe Orton * src/cadaver.c (close_connection): Call finish_locking to avoid leaking the locking session. Thu Feb 22 21:22:28 2001 Joe Orton * src/commands.c (pget_results): Handle NULL return from dav_propset_status. (execute_propget): Fail if the property name has a ':' in it, until namespace support is there. Thu Feb 22 21:16:55 2001 Joe Orton * src/cadaver.c: Fix netrc support. (supply_creds_server): Check whether server_username and server_password are set, if so, pass creds straight back. Thu Feb 15 23:03:24 2001 Joe Orton * configure.in: Add AC_C_BIGENDIAN. Sun Feb 4 14:34:47 2001 Joe Orton * src/cadaver.c (give_creds): Handle fm_getpassword returning NULL. Zero out password buffer after copying it. Sun Feb 4 14:33:34 2001 Joe Orton * src/cadaver.c (privkey_prompt): New function. (setup_ssl): New function, split down from open_connection. Sets privkey_prompt as private key password callback. Sun Feb 4 14:14:51 2001 Joe Orton * lib/getpass.c (fm_getpassword): If EOF is encountered, return NULL. Sun Feb 4 11:49:22 2001 Joe Orton * configure.in: Now require neon 0.11. Sun Feb 4 11:45:47 2001 Joe Orton * src/cadaver.c: Make nssl_context live as long as an http_session. Sun Feb 4 10:57:44 2001 Joe Orton * src/cadaver.c (open_connection): Create an SSL context. If cert option set, set the client cert, and pass the SSL context through the the HTTP session. Sun Feb 4 10:56:05 2001 Joe Orton * src/options.c: Added 'cert' and 'certkey' options. Sun Feb 4 10:50:09 2001 Joe Orton * src/cmdline.c (davglob_opendir): Store the length of the root collection in the context. (davglob_readdir): Don't put the root collection in the d_name of the returned dirent object. Sun Jan 28 22:53:00 2001 Joe Orton * Makefile.in: Remove obsoleted NLS stuff. Sun Jan 28 22:52:24 2001 Joe Orton * configure.in: Add intl and po to SUBDIRS for NLS builds, use NEON_REQUIRE to require neon 0.10 or later. Sun Jan 28 22:51:12 2001 Joe Orton * lib/getpass.c: Include stdlib.h to fix 'exit undefined' warning. Thu Jan 18 00:05:16 2001 Joe Orton * configure.in: Use top_builddir prefix in bundled expat path. Thu Jan 18 00:03:39 2001 Joe Orton * po/Makefile.in.in: Make cat-id-tbl.c and stamp-cat-id target names always have $(srcdir) prefix. Thu Jan 18 00:02:30 2001 Joe Orton * Makefile.in (clean): Recurse into SUBDIRS too. Wed Jan 17 23:39:21 2001 Joe Orton * configure.in: Don't check for getlogin_r at all, it's not portable. Wed Jan 17 23:22:49 2001 Joe Orton * Makefile.in: Modified for neon 0.10 recursive make. Wed Jan 17 23:17:01 2001 Joe Orton * src/ls.c (results): Don't leak the private structure when skipping the target resource. Wed Jan 17 23:01:15 2001 Joe Orton * lib/glob.c (glob): Only use sysconf if _SC_LOGIN_NAME_MAX is defined, else default the buffer size to 20 chars. Wed Jan 17 20:00:01 2001 Joe Orton * src/commands.c (execute_edit): Don't give up if the edit fails, allowing edit to create new content. (Tres Seaver ) Wed Jan 17 19:59:33 2001 Joe Orton * src/commands.c (execute_edit): Use mkstemp() to create temporary file (so the security warning goes away). Wed Jan 17 19:45:32 2001 Joe Orton * src/ls.c (create_private): New function. (fetch_resource_list): Change for dav_propfind_set_complex from neon 0.10. Thu Jan 11 20:41:24 2001 Joe Orton * configure.in: Use even newer NEON_VPATH_BUNDLED macro to build neon. Sun Jan 7 21:31:33 2001 Joe Orton * configure.in: Use new NEON_BUNDLED macro for building. Moved readline stuff into the CHECK_READLINE macro in macros/readline.m4. Sun Jan 7 00:04:04 2001 Joe Orton * src/cadaver.c (execute_propget): New command. Sat Jan 6 23:52:23 2001 Joe Orton * src/cadaver.c: Don't cast the command function to (void *) everywhere, since this is incorrect. Sat Jan 6 23:49:40 2001 Joe Orton * src/ls.c: Ported to neon 0.9 dav_propfind_* API. Sat Jan 6 22:55:50 2001 Joe Orton * src/commands.c (steal_result, discover_result): New functions. (execute_discover, execute_steal): Ported to neon 0.9 lock discovery API. Sat Jan 6 22:46:41 2001 Joe Orton * src/cadaver.h (struct command): Make the handler function a void (*handler)() - a function pointer, so should be compatible. Sun Nov 5 20:34:36 2000 Joe Orton * configure.in: Bumped version to 0.15.4. Sun Nov 5 20:34:05 2000 Joe Orton * src/cadaver.c: 'showlocks' command only allowed when connected. Sun Nov 5 14:45:33 2000 Joe Orton * configure.in: Bumped version to 0.15.3. Thu Oct 26 22:51:08 2000 Joe Orton * configure.in: Bumped version to 0.15.2. Thu Oct 26 22:40:58 2000 Joe Orton * src/cadaver.c (open_connection): Only use the scheme-default port if a specific port is not given (Jeff Costlow ). Sat Oct 14 20:00:53 2000 Joe Orton * src/cadaver.c (parse_args): Fix proxy option (Sunny Gulati ). Sun Sep 17 18:49:15 2000 Joe Orton * src/cadaver.c (supply_creds_server, supply_creds_proxy): Switch messages round. Mon Sep 11 20:24:36 2000 Joe Orton * configure.in: Bumped version to 0.15.1. Mon Sep 11 20:22:11 2000 Joe Orton * src/cadaver.c (readline): Don't print prompt if it is NULL. Mon Sep 11 20:19:17 2000 Joe Orton * src/cadaver.c (open_connection): Un-#if 0 out the trailing slash test. Mon Sep 11 17:50:55 2000 Joe Orton * configure.in: Bumped version to 0.15.0. Mon Sep 11 17:42:42 2000 Joe Orton * src/cadaver.c (supply_creds): Use fm_getpassword rather than getpass. * src/cadaver.c (redirect_notify): Notify user of a redirect. (open_connection): Register redirect notify callback, and allow automatic redirections. * src/cadaver.c (usage): Updated, you have to pass a whole URL on the command-line now. Mon Sep 11 17:42:07 2000 Joe Orton * src/commands.c (execute_delete): Only remove locks after use if the DELETE succeeds. Mon Sep 11 17:40:25 2000 Joe Orton * src/ls.c (compare_alpha): Removed function. * src/ls.c (fetch_resource_list): Call dav_propfind_destroy to destroy PROPFIND handler. Mon Sep 11 17:37:54 2000 Joe Orton * configure.in: Add extra headers to AC_CHECK_HEADERS for getpass.o build. * lib/strftime.c: New file. * configure.in: Call jm_FUNC_STRFTIME() to see whether strftime needs replacing. Mon Sep 11 17:34:59 2000 Joe Orton * Makefile.in (NEONOBJS): Added http_redirect.o. (LIBOBJS): Added lib/getpass.o. (lib/getpass.o): Added deps. Mon Sep 11 17:32:15 2000 Joe Orton * lib/glob.c (glob): Patch to enable BeOS build (from David Reid ) Mon Sep 11 17:27:37 2000 Joe Orton * lib/getpass.c (fm_getpassword): const the prompt parameter. Mon Sep 11 17:27:05 2000 Joe Orton * lib/getpass.c: New file, Carl Harris's getpass replacement, from fetchmail. Sat Aug 5 00:32:23 2000 Joe Orton * src/commands.c (execute_delete): Only forget the locks if the delete succeeds. Thu Aug 3 10:34:14 2000 Joe Orton * configure.in: Bump version to 0.14.1. Thu Aug 3 10:07:31 2000 Joe Orton * Makefile.in: Replace xalloc.h with ne_alloc.o in NEONOBJS. Thu Aug 3 09:55:42 2000 Joe Orton * src/*.c: Use ne_* allocation functions rather than x*. Thu Aug 3 09:47:17 2000 Joe Orton * configure.in: Add check for 'filename_completion_function'. Only checks for readline headers if readline is enabled. Wed Aug 2 23:40:28 2000 Joe Orton * src/ls.c: Include string.h for strrchr prototype. Wed Aug 2 02:17:42 2000 Joe Orton * src/cadaver.c: Remove cookie hooks. (transfer_progress): Use 'off_t' not 'size_t'. (completion): Conditionally compile if HAVE_FILENAME_COMPLETION_FUCNCTION. Wed Aug 2 02:16:47 2000 Joe Orton * src/commands.c (execute_edit): Fixed. Wed Aug 2 01:55:30 2000 Joe Orton * src/commands.c (execute_lock): Use exclusive lock not shared. Fri Jul 28 12:23:30 2000 Joe Orton * configure.in: Bump version to 0.14.0. Fri Jul 28 12:22:44 2000 Joe Orton * configure.in: Substitute SDEFS. * Makefile.in: Add @SDEFS@ to CFLAGS. Fri Jul 28 12:21:53 2000 Joe Orton * src/commands.c (execute_edit): Zero-out lock structure. Fri Jul 28 11:48:04 2000 Joe Orton * src/cadaver.c (main): Call bindtextdomain/textdomain if NLS is enabled. Fri Jul 28 11:45:56 2000 Joe Orton * configure.in: Bumped version to 0.14.0. Fri Jul 28 11:45:05 2000 Joe Orton * Makefile.in: Changes for intl/ build. Fri Jul 28 11:41:21 2000 Joe Orton * src/cadaver.c (parse_args): Allow passing no argumemts again. Fri Jul 28 11:40:29 2000 Joe Orton * src/common.h: Always define DEBUG_FILES. Fri Jul 28 11:34:43 2000 Joe Orton * configure.in: Added gettext stuff, and build configuration message. Thu Jul 27 17:00:57 2000 Joe Orton * src/i18n.h: New file. Thu Jul 27 16:22:00 2000 Joe Orton * src/cmdline.c (davglob_closedir): Free resource list after use. Thu Jul 27 16:20:48 2000 Joe Orton * configure.in: Use NEON_WARNINGS macro for --enable-warnings. Added --disable-readline option. Thu Jul 20 15:28:35 2000 Joe Orton * src/cadaver.c (completion): Free command name after use. Thu Jul 20 15:23:01 2000 Joe Orton * configure.in: Pass correct parameters for new NEON_LIBRARY. Sun Jul 16 16:30:55 2000 Joe Orton * src/common.c (debug): Removed function. Sun Jul 16 16:29:28 2000 Joe Orton * src/commands.c (execute_lock, execute_discover, execute_showlocks, execute_unlock): Ported to new neon locking code. * src/davlocks.[ch]: Moved into neon. Sun Jul 16 16:26:32 2000 Joe Orton * Makefile.in: Update for neon builds. * configure.in: Mostly moved into neon macros. Tue May 23 20:50:51 2000 Joe Orton * src/cadaver.c, src/commands.c, cmdline.c, src/options.c: Ported to neon. * src/ls.c: New file. * src/davfetch.c, src/protocol.h, src/frontend.h, src/davprops.[ch], src/socket.[ch], src/httpdav.[ch]: Removed files. Tue Mar 21 15:17:21 2000 Joe Orton * src/options.c: Fix options initializer. Tue Mar 21 15:15:42 2000 Joe Orton * configure.in: Added --enable-libxml option to skip expat check. Tue Mar 21 14:11:10 2000 Joe Orton * configure.in: Bumped version to 0.13.0. Tue Mar 21 14:06:24 2000 Joe Orton * src/cmdline.c (davglob_opendir): Set errno to EACCES for auth failures, else ENOENT. Tue Mar 21 14:04:12 2000 Joe Orton * src/davfetch.c (dav_fetch): Return errors from http_request as-is. Tue Mar 21 13:48:33 2000 Joe Orton * src/socket.c: Use ssize_t appropriately. Don't call perror(). Tue Mar 21 13:43:09 2000 Joe Orton * src/httpdav.c (http_response_read): Use strtol not sscanf for reading chunk size. (http_request): Ripped out "can authenticate" state. Handle dead connections better. Read Proxy-Auth.-Info header. Authenticate server response before reading challenges. Mon Mar 20 19:05:22 2000 Joe Orton * lib/string_utils.c (split_string_c, pair_string): Return NULL on malloc failure. Wed Mar 15 18:50:42 2000 Joe Orton * src/httpdav.c (http_response_read): Display response body blocks using DEBUG_HTTPBODY channel. Wed Mar 15 18:49:35 2000 Joe Orton * src/options.c: Added "proxy" and "proxy-port" options. Added "httpbody" debug channel. Wed Mar 15 18:41:15 2000 Joe Orton * src/httpdav.c (http_request_init): Store abs_path and absoluteURI separately. (http_request) Use absoluteURI for proxy authentication, and abs_path for server authentication. Send absoluteURI as Request-URI to proxy, or abs_path to server. Wed Mar 15 18:37:11 2000 Joe Orton * src/davfetch.c: Use DEBUG_XML debugging channel not DEBUG_HTTP. Wed Mar 15 18:33:57 2000 Joe Orton * src/cadaver.c (open_connection): Support proxy server. (set_proxy): New function. (fe_login): Support new authentication interface. (parse_args): Support --proxy option. (fe_connection): Minor cosmetics. Mon Mar 13 15:06:06 2000 Joe Orton * src/httpdav.c (http_request): Use an sbuffer for reading request headers (unlimited length possible). Close the connection if the server is < HTTP/1.1 compliant and doesn't send a Keep-Alive. Added proxy authentication. Send no-cache directive if sending a If: header. [USE_BROKEN_PROPFIND]: Removed all code. Mon Mar 13 14:26:03 2000 Joe Orton * lib/string_utils.c (pair_string, pair_string_free): Fix the leaks. Mon Mar 13 14:24:53 2000 Joe Orton * lib/string_utils.c (sbuffer_grow): Made public. (sbuffer_create_sized): New function. (sbuffer_create): Use it. Wed Mar 8 20:39:43 2000 Joe Orton * configure.in: Bumped versio to 0.12.2. Wed Mar 8 20:37:35 2000 Joe Orton * src/davlocks.c, src/httpdav.h: Renamed 'lock_list' -> 'submit_locks'. src/davlocks.c (dav_submit_lock): Take request target URI. (dav_lock_ifheader): Use request target URI not lock URI in tagged-list. Wed Mar 8 20:29:26 2000 Joe Orton * lib/dates.c: Relicensed LGPL/GPL dual. Wed Mar 8 20:27:23 2000 Joe Orton * lib/string_utils.c: Relicensed LGPL/GPL dual. Wed Mar 8 20:24:51 2000 Joe Orton * lib/base64.c: Relicensed LGPL/GPL dual. Wed Mar 8 14:33:17 2000 Joe Orton * src/davlocks.c (dav_submit_lock): Renamed from dav_locklist_add. Wed Mar 8 14:30:45 2000 Joe Orton * src/davfetch.c (dav_fetch): Fixed error cases. Wed Mar 8 14:25:00 2000 Joe Orton * Makefile.in, configure.in: Move OBJECTS and LIBOBJS into Makefile.in. Sun Mar 5 21:28:23 2000 Joe Orton * lib/glob.h: Define __PMT if it is not already. Fri Mar 3 23:38:59 2000 Joe Orton * configure.in: Bumped version to 0.12.1. Fri Mar 3 23:20:02 2000 Joe Orton * src/cmdline.c (davglob_errfunc, parse_command): Minor globbing feedback fixes. Fri Mar 3 23:17:16 2000 Joe Orton * src/cadaver.c (set_path): New function, from the heart of execute_cd. (open_connection): Insist on using a proper path segment (trailing and leading slashes). Use set_path. * src/commands.c (execute_cd): Use set_path. Fri Mar 3 23:16:37 2000 Joe Orton * lib/string_utils.h (SAFE_FREE): New macro, copy of HTTP_FREE. Fri Mar 3 22:37:53 2000 Joe Orton * src/cadaver.c: Don't include inttypes.h. (fe_transfer_progress): Use plain progress bar if total file size is not known. Tue Feb 29 19:27:43 2000 Joe Orton * src/cmdline.c (gettoken): Ignore everything after a '#' in non-quoted text. Tue Feb 29 19:26:50 2000 Joe Orton * src/cadaver.c (fe_login): Print auth required message on a new line if we are doing a pretty progress bar. Tue Feb 22 23:43:05 2000 Joe Orton * configure.in: Bumped version to 0.12.0. Tue Feb 22 23:40:37 2000 Joe Orton * src/davfetch.c (dav_fetch): Don't return PROTO_FAILED. Tue Feb 22 00:15:10 2000 Joe Orton * src/cadaver.c [!HAVE_LIBREADLINE] (readline): Simple readline() replacement. Mon Feb 21 23:21:09 2000 Joe Orton * src/commands.c (out_handle): New function. (out_failed): Removed function. (many): Replaced calls to out_success + out_failed with out_handle. Mon Feb 21 23:17:21 2000 Joe Orton * src/cadaver.c (sub_timeval, pretty_progress_bar): New functions. (fe_transfer_progress): Pretty or plain progress bars. Mon Feb 21 23:14:07 2000 Joe Orton * src/httpdav.c (http_request) [HTTP_HANDLE_ERROR]: New macro. Write meaningful error string in some cases. Return PROTO_AUTH if status is 401. (http_get): Pass request structure to get callback. (http_get_callback): Pass true response body length to fe_transfer_progress. Thu Feb 17 18:15:59 2000 Joe Orton * src/davlocks.c (dav_lock): Lower-case "I" in "infinity" for the Depth: header. Thu Feb 17 16:52:46 2000 Joe Orton * src/socket.c (read_line): Use sock_recv. (transfer): Call fe_transfer_progress at end of transfer. Thu Feb 17 15:16:45 2000 Joe Orton * src/commands.c (compare_alpha, sort_files_list): New functions. (execute_ls): Use them. Wed Feb 16 17:50:52 2000 Joe Orton * src/commands.c (out_start, out_success, out_failed): New functions. (many places): Call them. Wed Feb 16 17:07:26 2000 Joe Orton * src/httpdav.c (dav_207_write_errors): Fix segfault and new-lines problem. Wed Feb 16 17:05:32 2000 Joe Orton * src/frontend.h (fe_login): Return integer value. * src/httpdav.c: Return fe_login value. * src/cadaver.c (fe_login): Return error if readline() returns NULL, else success. Wed Feb 16 17:03:19 2000 Joe Orton * src/davfetch.c (fetch_free): Fix segfault. Wed Feb 16 17:01:23 2000 Joe Orton * lib/string_utils.h (STRIP_EOL): Use strrchr rather than strchr. Wed Feb 16 16:27:47 2000 Joe Orton * src/davlocks.c (dav_lock_using_resource): Check whether resource is the child of a depth-infinity collection lock. (dav_locklist_free): New function. Wed Feb 16 16:24:21 2000 Joe Orton * src/cmdline.c (parse_command): Use output() for "Matching..." message. Wed Feb 16 16:23:34 2000 Joe Orton * src/cadaver.c (main): Quit if getenv("HOME") fails. Wed Feb 16 16:22:57 2000 Joe Orton * src/cadaver.[ch]: Renamed globscope to parmscope. Wed Feb 16 15:37:27 2000 Joe Orton * src/cadaver.c: Added out_state, removed transfer_state. (output): New function. (fe_*): Rewritten to use out_state. * src/commands.c (everywhere): Use output() for output messages. (out_handle): Easy handling of output messages using output(). Wed Feb 16 15:18:03 2000 Joe Orton * src/httpdav.c (dav_mkcol): Got rid of MKDIR/dummy PUT. Sat Feb 12 16:42:12 2000 Joe Orton * src/httpdav.c (http_request): Set error string if the connection cannot be opened. Fri Feb 11 17:39:46 2000 Joe Orton * src/httpdav.c (dav_mkcol): Back out bad http_request_end call. Fri Feb 11 17:25:54 2000 Joe Orton * cadaver.spec.in: RPM specfile from Lee Mallabone . Fri Feb 11 17:14:02 2000 Joe Orton * src/options.c: Added editor option. Fri Feb 11 17:09:34 2000 Joe Orton * src/cadaver.c: Added dav_collection global. (init_readline): New function. (parse_args): Allow the connection to stay open if previously opened. (read_command): Use '?' in prompt if dav_collections is false, else '>'. (execute_command): More descriptive help message when the needs_connection precondition fails. (completion): New function. (init_options): New function. (main): Call init_options and init_readline appropriately. Fri Feb 11 13:39:08 2000 Joe Orton * src/davlocks.c: Store a list of locks to be submitted in the If: header. (dav_locklist_add, dav_locklist_find): New functions. (dav_lock_using_resource, dav_lock_using_parent): Manipulate the lock list, never submit a lock twice. (dav_lock_using_resource): Submit the locktoken for a depth-infinity collection lock which is a parent of the given resource. (dav_lock): Pass back the correct lock timeout and depth. (dav_lock_ifheader): Build the header from the lock list. Fri Feb 11 13:35:23 2000 Joe Orton * src/commands.c (clever_path): Free temporary variable. (execute_pwd): New function. (command_generator): New function, command name geneator for readline completion. (format_time, display_ls_line): New functions. (execute_ls): Use display_ls_line. (get_depth): "infinity" not "infinite". (run_editor): Use editor option. Thu Feb 10 19:59:58 2000 Joe Orton * src/httpdav.c (http_request_init): Default to a want_body of 2xx. (http_request): Presume we always have a want_body callback. (dav_mkcol): Always call http_request_end. Wed Feb 9 13:56:08 2000 Joe Orton * lib/string_utils.c (sbuffer_finish): New function. Wed Feb 9 13:20:35 2000 Joe Orton * src/cmdline.c (parse_command): Free a token which was glob-expanded. Wed Feb 9 13:14:23 2000 Joe Orton * src/cmdline.c (davglob_closedir): Free context. Wed Feb 9 00:36:12 2000 Joe Orton * src/davlocks.c (dav_lock_discover, dav_lock): Send Content-Type header with request. Tue Feb 8 15:06:55 2000 Joe Orton * configure.in: Bumped version to 0.11.0. Tue Feb 8 14:53:45 2000 Joe Orton * src/cadaver.c (execute_command): Display incorrect # of arguments message correctly if no short help for the command. Tue Feb 8 13:58:45 2000 Joe Orton * src/commands.c (execute_edit): Free locks properly. If locking fails, return. Tue Feb 8 13:54:49 2000 Joe Orton * src/davlocks.c (dav_lock_using_parent): Do nothing if URI has no parent. Tue Feb 8 13:13:11 2000 Joe Orton * configure.in: Added lib/rpmatch.o and lib/yesno.o. * lib/rpmatch.c, lib/yesno.c: New files. Tue Feb 8 13:12:15 2000 Joe Orton * src/options.c (display_options): Display 'unset' for string options. Tue Feb 8 13:11:26 2000 Joe Orton * src/httpdav.c (http_get): Pass flags and mode to open() as arguments. Tue Feb 8 13:00:30 2000 Joe Orton * src/commands.c: (execute_cat): Only display error message if the download fails. (execute_edit, run_editor): New functions. (execute_lock): Don't display locktoken. (execute_get): Use new http_get arguments. Sat Feb 5 11:07:38 2000 Joe Orton * src/cadaver.c (parse_args): Accept an http: URL, parse out the hostport and abspath segments. Wed Feb 2 22:14:44 2000 Joe Orton * src/davfetch.c (check_context, endelm_props, dav_fetch): Added DAV:redirectref resource type. Wed Feb 2 22:10:27 2000 Joe Orton * src/commands.c (execute_delete): Friendly message if the user tries to use 'rm' on a collection. Wed Feb 2 21:55:29 2000 Joe Orton * src/davlocks.c (endelm_locks, parse_timeout): Parse lock timeout correctly. (dav_lock_free): New function. (dav_lock, dav_lock_discover): Call http_request_end. Wed Feb 2 21:49:07 2000 Joe Orton * src/httpdav.c (http_request): Don't send a newline after the request body. Inverted response values for http_auth_verify_response and http_auth_challenge. (dav_mkref, dav_chref, dav_rmref): Removed functions. Sun Jan 30 21:37:31 2000 Joe Orton * src/commands.c (simple_put, execute_get): Better error messages. Sat Jan 29 20:25:10 2000 Joe Orton * lib/string_utils.[ch]: Made sbuffer_grow private. Sat Jan 29 20:23:24 2000 Joe Orton * lib/string_utils.[ch]: sbuffer is a pointer to a private type. (sbuffer_size, sbuffer_data): New functions. * src/davlocks.c, src/httpdav.[ch]: Changed for above. Sat Jan 29 18:25:58 2000 Joe Orton * lib/string_utils.h (CONCAT*): Check for malloc() returning NULL. Sat Jan 29 18:07:58 2000 Joe Orton * src/cadaver.c (init_rcfile): Only display error message if rcfile exists bug cannot be opened. Sat Jan 29 16:51:54 2000 Joe Orton * lib/string_utils.[ch]: Added sbuffer handling, renamed from http_buffer, made type definition private. * src/httpdav.[ch]: Converted from http_buffer to sbuffer. * src/davlocks.c: Similarly. Sat Jan 29 16:19:30 2000 Joe Orton * lib/string_utils.c (pair_string_free, split_string_free): Free the array too. Sat Jan 29 16:10:42 2000 Joe Orton * src/davfetch.c (dav_fetch, check_context): Ignore unknown elements in DAV:prop. Sat Jan 29 13:53:53 2000 Joe Orton * src/httpdav.[ch]: Added http_webdav_locking global. (http_options): Set http_webdav_locking if server reports class 2 compliance. Mon Jan 24 21:45:15 2000 Joe Orton * src/options.[ch]: Simplified options interface. * src/cadaver.c, src/commands.c: Use it. Mon Jan 24 21:21:58 2000 Joe Orton * src/davprops.c (dav_prop_getnames): Return PROTO_ERROR on request error / non-207 return status. Mon Jan 24 21:21:13 2000 Joe Orton * src/common.h: bool clashes with curses bool, redefine as char for the time being. Mon Jan 24 21:19:02 2000 Joe Orton * src/commands.c (execute_propnames): Cosmetics. (getowner): Return lock owner from option. Mon Jan 24 21:15:56 2000 Joe Orton * src/cadaver.c: Update help message for 'copy'. (init_signals): Global scope not local. (init_rcfile): New function. (main): Set lockowner to $USER@$HOSTNAME by default. (fe_connection): Inline reconnection messages properly when mid-upload. (fe_transfer_progress, fe_login): Don't display anything when in curses interface. Mon Jan 24 21:14:50 2000 Joe Orton * src/httpdav.c (http_parse_status, http_request): Use STRIP_EOL. Mon Jan 24 21:12:47 2000 Joe Orton * configure.in, config.h.in: Check for ncurses.h, define HAVE_NCURSES_H appropriately. Mon Jan 24 21:09:36 2000 Joe Orton * src/davlocks.c (dav_lock_ifheader): Don't submit empty If: headers. (endelm_locks): Renamed from got_element. Mon Jan 24 21:05:29 2000 Joe Orton * lib/string_utils.h (STRIP_EOL): New macro. (CONCAT[2-4]): Made inline-safe. Tue Jan 18 14:45:36 2000 Joe Orton * libdav/ChangeLog: Started new ChangeLog. Wed Jan 12 20:43:05 2000 Joe Orton * libdav/hip_xml.c (hip_xml_currentline): New function. [CURRENT_LINE]: Removed macro. (start_element): Pass name and atributes to start-element callback. (everywhere): Changed many debugging messages to use DEBUG_XMLPARSE for clearer output. * libdav/dav_207.c (dav_207_getcurrentpropstat): New function. (dav_207_startelm): Changed for startelm prototype. * src/davfetch.c (dav_fetch): Use dav_207_gcp, and changed for startelm prototype. * src/davprops.c (startelm_getnames): Changed for startelm prototype, and use dav_207_gcp. Wed Jan 12 20:19:12 2000 Joe Orton * src/davprops.c (dav_prop_getnames): Changed for 207 rejig. Wed Jan 12 20:12:16 2000 Joe Orton * libdav/http_utils.[ch]: Added 'struct http_status'. (http_parse_statusline): New function. * libdav/dav_207.[ch]: Added http_status structure to dav_propstat and dav_response. (dav_207_endelm): Parse DAV:status cdata into status structure. Wed Jan 12 20:09:21 2000 Joe Orton * libdav/dav_207.[ch]: Renamed dav_207context to dav_207_parser. (dav_207_init, dav_207_finish, dav_207_free): Changed as above. * src/davfetch (dav_fetch): Changed as above. * src/davlocks.c (dav_lock, dav_lock_discover): Changed as above. * src/httpdav.c (init_207errors, finish_207errors): Changed as above. Wed Jan 12 00:40:12 2000 Joe Orton * src/davprops.[ch]: New files. (dav_prop_getnames): New function. * src/cadaver.[ch]: Added 'propnames' command * src/commands.[ch] (execute_propnames): New function. Wed Jan 12 00:39:17 2000 Joe Orton * src/davfetch.c (dav_fetch): Added static to const members. Tue Jan 11 20:36:37 2000 Joe Orton * */*.[ch]: Added Y2K to copyright notices. Mon Jan 10 23:47:57 2000 Joe Orton * configure.in: Bumped version to 0.10.0. Mon Jan 10 23:40:32 2000 Joe Orton * src/davfetch.c (dav_fetch): Correct error handling. * libdav/hip_xml.c (start_element): Use descriptive errors. Mon Jan 10 23:29:19 2000 Joe Orton * src/davlocks.c (dav_lock, dav_lock_discover): Rewritten for 207 response handling changes. * libdav/dav_207.c (dav_207_init, dav_207_finish): Put the element list on the end of the supplied one rather than the beginning. * src/httpdav.[ch] (dav_207_write_errors): New function. Mon Jan 10 11:46:05 2000 Joe Orton * libdav/dav_207.[ch], src/davfetch.c, src/davlocks.c, src/httpdav.[ch]: Renaming dav_xml_* to hip_xml_*. Mon Jan 10 11:29:34 2000 Joe Orton * libdav/hip_xml.[ch]: Renamed from dav_xml.[ch]. dav_xml_* renamed to hip_xml_*. Implemented libxml SAX interface as alternative to expat. (everywhere): Use 'hip_xml_char' as character type. (parse_element): Accept NULL attributes list. (hip_xml_finish): Initialize expat or libxml push parser appropriately. (hip_xml_parse): Call expat or libxml parsing function appropriately. (CURRENT_LINE): New macro, returns current parse line for given parser. (hip_xml_parse_v): Cast 'const char *' input to 'const hip_xml_char *'. (hip_xml_finish): Free expat or libxml parser appropriately. * Makefile.in, configure.in: Modified for file rename as above. * configure.in: Check for libxml if no expat. * config.h.in: Added HAVE_LIBXML. Sun Jan 9 21:06:48 2000 Joe Orton * src/davfetch.c (dav_fetch): Pass only 207 responses to parser. Use parser error if parse failed. Thu Jan 6 19:50:02 2000 Joe Orton * src/cadaver.c: Renamed version() to execute_version. Added cmd_version. Tue Jan 4 10:58:55 2000 Joe Orton * libdav/dav_207.[ch] (dav_207_free): New function. Tue Jan 4 10:57:48 2000 Joe Orton * libdav/http_utils.h: Define min(x,y) macro. Tue Jan 4 10:54:53 2000 Joe Orton * src/httpdav.c (http_request): Finer grained control over whether the response body callback is passed the body. (init_207errors, finish_207errors, dummy_check): New functions. (dav_copy, dav_mkcol, dav_move, http_delete): Use 207 error handling. Mon Jan 3 14:52:07 2000 Joe Orton * src/httpdav.h (dav_free_fileslist): New function. (http_request_end) [USE_DAV_LOCKS]: Destroy the if_header buffer. * src/davfetch.c (dav_free_fileslist): Implementation. * src/cmdline.c (davglob_opendir): Use it. * src/commands.c (is_collection): Use it. * src/davfetch.c (fetch_free): Fix leaks. Mon Jan 3 14:27:16 2000 Joe Orton * src/common.h (DEBUG_FATAL): New macro. Mon Jan 3 14:21:47 2000 Joe Orton * libdav/uri.c (uri_compare): Treat a URI with a trailing slash and one with as equivalent. Mon Jan 3 14:19:03 2000 Joe Orton * libdav/dav_xml.[ch]: Rewritten for multiple handlers. * libdav/dav_207.[ch]: Implementation of generic 207 response handling. * src/davfetch.c: Reimplemented to use above. Fri Dec 31 01:12:56 1999 Joe Orton * libdav/dav_207.[ch]: New files. Thu Dec 30 19:19:53 1999 Joe Orton * lib/dirname.[ch]: Deprecated by uri_parent. Thu Dec 30 19:18:57 1999 Joe Orton * src/commands.c (clever_path): Use uri_parent. Thu Dec 30 19:18:19 1999 Joe Orton * src/davfetch.c (dav_fetch): Use dav_lock_using_resource. Thu Dec 30 19:15:59 1999 Joe Orton * src/davlocks.c (dav_lock_using_resource, dav_lock_using_parent): New functions. * src/httpdav.c (all methods): Indicate which resources the method operates on, and whether it needs to read or write to them, using above functions. Thu Dec 30 19:14:42 1999 Joe Orton * libdav/uri.h (uri_childof): Switched return values. (uri_parent): New function. Thu Dec 30 13:52:44 1999 Joe Orton * libdav/uri.h (uri_has_trailing_slash): New function. * src/commands.c (has_trailing_slash): Removed function. (true_path, execute_lock): Use uri_ form. Thu Dec 30 13:29:33 1999 Joe Orton * configure.in: Bumped version to 0.9.0. Thu Dec 30 13:26:20 1999 Joe Orton * src/davlocks.c (execute_lock): Submit depth header. Thu Dec 30 13:23:32 1999 Joe Orton * src/commands.c (print_lock): New function. (execute_discover, execute_showlocks): Use it. Thu Dec 30 12:16:31 1999 Joe Orton * libdav/dav_xml.c (dav_xml_finish): Don't free the root state twice. Thu Dec 30 12:03:04 1999 Joe Orton * src/commands.c (execute_discover): Handle PROTO_NONE return code appropriately. Thu Dec 30 11:58:38 1999 Joe Orton * libdav/dav_xml.c: Added 'error' field to parser structure. (parse_element): Write error description in failure cases. (dav_xml_parse): Write expat error string if parse fails. * src/protocol.h: Added new return code PROTO_NONE. * src/davlocks.c (dav_lock_discover): Return PROTO_NONE if no locks found. Write parser error to http_error if parse failed. Thu Dec 30 11:01:36 1999 Joe Orton * src/cadaver.c (main): Call init_locking and finish_locking. * src/commands.c (finish_locking): New function. Thu Dec 30 10:57:54 1999 Joe Orton * configure.in: Added AC_HEADER_DIRENT, AC_TYPE_SIGNAL. * config.h.in: Defines for above. * src/commands.c (quit_handler): Return type RETSIGTYPE. Thu Dec 30 10:49:03 1999 Joe Orton * src/davlocks.[ch]: Removed lock_list. (dav_lock_add, dav_lock_remove, dav_lock_find): Pass lock list as argument. (dav_lock_ifheader): Search whole lock list for matches. * src/httpdav.[ch]: Added dav_lock_list global. (http_request, dav_copy, dav_move): Pass dav_lock_list to ifheader. * src/commands.c: Added lock_list global. (init_locking): New function. (execute_lock, execute_unlock): Pass lock_list. Thu Dec 30 10:46:49 1999 Joe Orton * src/options.c (execute_unset): Allow passing no value to unset, display error if handler returns NULL. (do_debug): Return NULL if no value passed. Thu Dec 30 10:09:35 1999 Joe Orton * src/commands.c (get_timeout, get_lockscope, get_locktype): New functions. (execute_discover): Use above. (getowner): Return "". (execute_showlocks): New function. * src/cadaver.[ch]: Added showlocks command. Wed Dec 29 17:52:46 1999 Joe Orton * src/cadaver.c: Added steal and discover commands. * src/commands.[ch] (execute_steal, execute_discover): New functions. * src/davlocks.[ch] (dav_lock_discover): New function. Wed Dec 29 17:52:19 1999 Joe Orton * src/cadaver.c (open_connection): Do allow the initial OPTIONS. Wed Dec 29 16:38:58 1999 Joe Orton * src/common.h: Added DEBUG_XMLPARSE debugging channel. * libdav/dav_xml.c: Use DEBUG_XMLPARSE for namespace handling etc. * src/options.c: Added xmlparse debug option. Wed Dec 29 15:18:57 1999 Joe Orton * src/commands.c (execute_unlock): Don't accept zero-length locktoken from user. Wed Dec 29 15:08:34 1999 Joe Orton * libdav/uri.[ch] (uri_compare, uri_childof): New functions. * src/davlocks.c (dav_lock_find): Use above, check for infinite-depth locks. Wed Dec 29 15:05:38 1999 Joe Orton * src/commands.c (true_path, has_trailing_slash): New functions. (execute_lock): Use above, set lock depth to infinite for collections. (execute_unlock): Use above. (execute_rmcol): Force trailing slash in resolve_path. Wed Dec 29 14:25:48 1999 Joe Orton * src/httpdav.c (dav_copy, dav_move) [USE_DAV_LOCKS]: Supply If: header if any locks cover destination URI. Wed Dec 29 14:20:26 1999 Joe Orton * src/cadaver.c: Added lock and unlock commands. * src/commands.[ch] (execute_lock, execute_unlock): New functions. * src/davlocks.[ch]: New files, basic locking implementation. * src/httpdav.c (http_request) [USE_DAV_LOCKS]: Get If: header for any locked resource at Request-URI. * src/options.c: Added 'locks' debug option. Wed Dec 29 14:20:07 1999 Joe Orton * src/cadaver.c (parse_args): Fixed options parsing. Mon Dec 27 21:50:49 1999 Joe Orton * configure.in (OBJECTS): Updated for new sources. * Makefile.in: Update deps for new sources. Mon Dec 27 21:49:58 1999 Joe Orton * libdav/dav_xml.c (dav_xml_finish): Free placeholder root element. Mon Dec 27 21:46:11 1999 Joe Orton * src/davfetch.c: New file, reimplementation of dav_fetch() using generic XML handling routines. * src/httpdav.c: Removed all XML handling. (dav_fetch, dav_fetch_*, dav_xml_*): Removed. Mon Dec 27 21:45:44 1999 Joe Orton * libdav/uri.[ch]: New files. * src/httpdav.c (uri_*): Removed functions. Mon Dec 27 21:44:35 1999 Joe Orton * libdav/http_utils.c (http_buffer_create): Create buffer initially. * libdav/http_utils.h (http_buffer_clear): Wipe buffer clean. Mon Dec 27 21:08:53 1999 Joe Orton * libdav/dav_xml.c (destroy_state): New function. (exp_endelm, dav_xml_finish): Use it. Mon Dec 27 21:07:58 1999 Joe Orton * libdav/http_utils.c (http_buffer_create): Initialize buffer to NULL. Mon Dec 27 19:01:12 1999 Joe Orton * src/httpdav.c (http_dateparse): Removed function. Mon Dec 27 18:11:18 1999 Joe Orton * libdav/dav_xml.[ch]: Generic WebDAV XML response handling. * libdav/http_utils.[ch]: Utility functions. * configure.in, Makefile.in: Build changes for above. Mon Dec 27 11:19:35 1999 Joe Orton * configure.in: Bumped version to 0.8.0. Mon Dec 27 11:12:17 1999 Joe Orton * src/cadaver.[ch]: Added rmcol command. * src/commands.c: Added rmcol alias. (execute_rmcol, multi_rmcol): New functions. Mon Dec 27 11:06:33 1999 Joe Orton * src/commands.c (execute_delete): Refuse to delete collection resources. Mon Dec 27 10:59:39 1999 Joe Orton * src/commands.c (is_collection): Check resource type properly. (execute_ls): Modified for dav_fetch change. * src/cmdline.c (davglob_opendir): Modified for dav_fetch change. (davglob_stat): Use is_collection. Mon Dec 27 10:57:48 1999 Joe Orton * src/httpdav.[ch] (dav_fetch, dav_fetch_gotresource): Added flag to include/exclude resource at Request-URI in list of resources returned by PROPFIND. Mon Dec 27 10:33:21 1999 Joe Orton * lib/glob.c: Fix the broken fix (Ulrich Drepper). Mon Dec 27 10:24:29 1999 Joe Orton * configure.in: Added check for libncurses if libcurses isn't found. * Makefile.in: Added 'install' target. Mon Dec 27 01:02:19 1999 Joe Orton * src/commands.c (dispatch, dispatch2): New functions. (execute_{mkcol,delete}, simple_{copy,move}): Consistent output using dispatch[2]. Mon Dec 27 01:01:48 1999 Joe Orton * lib/glob.c: Only define __P if it's not already defined. Mon Dec 27 00:15:15 1999 Joe Orton * src/commands.c (display_help_message): Only display help message if there is one. Thu Dec 23 01:25:50 1999 Joe Orton * configure.in: Bumped version to 0.7.3. Thu Dec 23 01:25:18 1999 Joe Orton * lib/glob.c: Make __P be (). Thu Dec 23 01:13:30 1999 Joe Orton * src/cadaver.c: Cast the handler value to (void *) to quieten some compiler warnings on SunOS cc. Thu Dec 23 00:21:06 1999 Joe Orton * lib/glob.c: Moved the __glob_pattern_p prototype below glob.h so we have __P. * configure.in, config.h.in: Added checks for many dir*.h's. Added fnmatch check. * src/httpauth.c: snprint.h->snprintf.h, typo fixed. * lib/fnmatch.[ch]: New files, needed by glob(). Wed Dec 22 23:56:39 1999 Joe Orton * configure.in: Bumped version to 0.7.1. Wed Dec 22 23:49:15 1999 Joe Orton * src/commands.c, src/cadaver.c, src/httpauth.c [!HAVE_SNPRINTF]: Include snprintf.h. * configure.in: Add check for stdarg.h. * Makefile.in: Pick up the correct CC from configure. Wed Dec 22 21:03:38 1999 Joe Orton * configure.in: Bumped version to 0.7.0. Wed Dec 22 20:58:03 1999 Joe Orton * src/cadaver.c: 'copy' takes multiple arguments. * src/commands.c (do_copymove): Handler for multiple-arg copy/move. (multi_move): Use it. (multi_copy): New function. Wed Dec 22 20:15:23 1999 Joe Orton * src/cadaver.[ch]: Added mget, mput commands. * src/commands.[ch] (simple_put, multi_mget, multi_mput): New functions. Wed Dec 22 19:56:05 1999 Joe Orton * configure.in (LIBOBJS): Added lib/glob.o Wed Dec 22 19:54:57 1999 Joe Orton * src/options.c: Added "files" debugging option, for debugging the globbing functions. Wed Dec 22 19:47:56 1999 Joe Orton * src/cadaver.[ch]: Added globbing scope (local,remote,none) to commands. * src/cmdline.c (parse_command): Removed old globbing interface. Glob locally or remotely according to the scope of the command. Wed Dec 22 18:41:55 1999 Joe Orton * src/cmdline.c [ENABLE_FULL_GLOBBING]: Proper remote filename globbing. (davglob_{opendir,readdir,closedir,stat,errfunc}): New functions. (parse_command): Use glob to expand globs. Wed Dec 22 18:38:05 1999 Joe Orton * src/commands.c (execute_ls): Free the resource filename after displaying it. (simple_move, execute_copy): Display status message on the same line as action message. Wed Dec 22 18:37:09 1999 Joe Orton * src/httpdav.c (dav_fetch): Free the temporary resource store when we're done. Wed Dec 22 18:31:31 1999 Joe Orton * src/cadaver.c (execute_command): Don't leak the tokens list. Wed Dec 22 18:19:14 1999 Joe Orton * src/httpdav.c (dav_fetch): Free the resource name of the root collection, which we skip. Wed Dec 22 18:13:51 1999 Joe Orton * src/httpdav.c (dav_fetch): Free the cdata buffer when we're done. Wed Dec 22 18:07:11 1999 Joe Orton * src/httpdav.c (dav_xml_endelm): Free namespace name/value strings too, we were leaking them. Wed Dec 22 17:37:15 1999 Joe Orton * lib/glob.c: Define SHELL. Wed Dec 22 17:25:44 1999 Joe Orton * lib/glob.[ch]: Added from glibc-2.1.2. Modified to pass down alternate dirfuncs correctly, and to build cleanly outside of glibc source tree. Tue Dec 21 21:30:38 1999 Joe Orton * configure.in: Bumped version to 0.6.0. Tue Dec 21 21:10:39 1999 Joe Orton * Makefile.in (again): Added new target. Tue Dec 21 21:04:05 1999 Joe Orton * doc/cadaver.1: Added skeleton man page. Tue Dec 21 20:44:25 1999 Joe Orton * src/options.c: Added help message for debug options. Added cleartext debug option. (execute_set): Display help message when no value given for handled debug options. (execute_set): Likewise. Tue Dec 21 20:40:41 1999 Joe Orton * src/cadaver.c: Removed command_names array. (get_command): Removed function. * src/command.c: Added command_names array. (get_command): Added function. (execute_help): Optionally takes one argument. Sun Dec 19 02:21:19 1999 Joe Orton * src/cadaver.c (execute_command): Say 'no arguments' instead of 'at most 0 arguments'. Sun Dec 19 01:47:01 1999 Joe Orton * INSTALL: Added generic install file. Sun Dec 19 01:33:04 1999 Joe Orton * src/commands.[ch] (execute_debug): Removed function. * src/cadaver.[ch]: Removed cmd_debug. Thu Dec 16 17:10:51 1999 Joe Orton * src/cmdline.[ch], src/commands.[ch], src/options.[ch], src/cadaver.h: New files. * src/cadaver.c: Split out command execution, command-line parser interface, and options handling. * configure.in (OBJECTS): Added new files. * Makefile.in: Added dependancies for new files. Thu Dec 16 16:58:01 1999 Joe Orton * src/cadaver.c: Options implemented: boolean or specific handler. (execute_set, execute_unset): Altered accordingly. (set_debug, unset_debug, disp_debug, do_debug): Handling for 'debug' option. Path handling: if path is NULL, no path available. (read_command, close_connection, open_connection): Altered accordingly Wed Dec 15 00:36:03 1999 Joe Orton * src/cadaver.c (parse_args): Added --tolerant (-t) option. Tue Dec 14 23:58:24 1999 Joe Orton * src/cadaver.c: Placed command help in data structure. (execute_help): Rewriten for this. (execute_command): Display help message if incorrect # of arguments given. Tue Dec 14 23:29:50 1999 Joe Orton * src/cadaver.c (parse_args) [HAVE_ADD_HISTORY]: Add an 'open' command into history list equivalent to the invocation arguments. Tue Dec 14 23:28:24 1999 Joe Orton * lib/string_utils.h: Added CONCAT4. Tue Dec 14 23:08:41 1999 Joe Orton * src/cadaver.c (execute_set, display_options): New functions. (execute_lls): Takes multiple arguments. (execute_cd): Tolerate non-WebDAV collections if 'tolerant' option is set. (parse_command): Only try to expand globs if we have a connection. Sat Dec 11 18:54:45 1999 Joe Orton * src/cadaver.c: Fixed quitting. Sat Dec 11 17:07:29 1999 Joe Orton * src/cadaver.c (multi_move, simple_move, map_multi): New functions. (multi_{mkcol,delete,cat,less}): New functions. (is_collection): New function. (execute_cd): Use is_collection. (execute_move): Removed function. (has_glob_pattern): New function. (parse_command): Use has_glob_pattern. Sat Dec 11 14:42:24 1999 Joe Orton * src/cadaver.c (parse_args): Handle path properly. Sat Dec 11 14:40:29 1999 Joe Orton * Makefile.in: Added clean target. Sat Dec 11 02:13:07 1999 Joe Orton * src/cadaver.c (open_connection): Use execute_cd to check for DAV-enabled collection. Sat Dec 11 02:04:43 1999 Joe Orton * src/cadaver.c (execute_cd): Moved set_path logic here. Check for DAV-enabled collection using PROPFIND/depth=0. Sat Dec 11 01:53:30 1999 Joe Orton * src/httpdav.c (dav_fetch): Take depth argument (0,1,infinite). Sat Dec 11 01:15:32 1999 Joe Orton * src/cadaver.c (gettoken, parse_command): New command-line parser. Expands globs where appropriate using dav_fetch. (execute_command): Modified to use parse_command. * src/cadaver.c: Commands can take 'many' arguments (as an array). (execute_command): Modified for this. (execute_echo): Demo this. Fri Dec 10 17:42:03 1999 Joe Orton * configure.in: Bumped version to 0.5.0. Fri Dec 10 17:38:08 1999 Joe Orton * src/cadaver.c (execute_ls): Don't leak the files list. Fri Dec 10 17:06:44 1999 Joe Orton * src/cadaver.c (execute_command): Fix leaks. Fri Dec 10 16:42:02 1999 Joe Orton * src/cadaver.c: Lemons extracted, and other cosmetics. (execute_lcd): If no argument given, change to home directory. Fri Dec 10 16:00:28 1999 Joe Orton * src/cadaver.c (execute_put, execute_get): Close the bracket in the output on failure. (execute_command): Control flow slightly simplified. Trim zero-length strings from split_string return list. Fri Dec 10 15:00:41 1999 Joe Orton * src/cadaver.c (execute_command): Pluralize "incorrect arguments" message correctly. Fri Dec 10 14:54:58 1999 Joe Orton * src/cadaver.c: Command structure specifies minimum and maximum number of arguments, and a handler function. (execute_command): Call handler function appropriately. (set_path): Save previous path in old_path. Swap previous path and current if argument is "-". Fri Dec 10 13:25:13 1999 Joe Orton * lib/string_utils.c (pair_string): Use split_string_c. Fri Dec 10 13:21:38 1999 Joe Orton * lib/string_utils.h (split_string_c): Like split_string except gives the count of items too. Fri Dec 10 13:16:02 1999 Joe Orton * src/cadaver.c: Split command struct and name->command mappings. (get_command): Modified accordingly. Tue Nov 30 01:28:14 1999 Joe Orton * configure.in: Bumped version to 0.4.0. Tue Nov 30 01:15:30 1999 Joe Orton * src/cadaver.c: Added exit,bye,h,? aliases. (execute_command): Added 'lls', 'lpwd', 'lcd' commands. Better unknown command message. (main): Print newline on CTRL-D. Wed Nov 24 17:08:42 1999 Joe Orton * configure.in: Bumped version to 0.3.4. Wed Nov 24 17:07:06 1999 Joe Orton * configure.in: Check for socket in -lsocket or -linet. Wed Nov 24 17:06:00 1999 Joe Orton * configure.in: Check for gethostbyname in -lnsl. Wed Nov 24 17:04:00 1999 Joe Orton * src/cadaver.c (main): Quit when read_command returns NULL. Sun Nov 21 23:13:12 1999 Joe Orton * configure.in: Bumped version to 0.3.3. Sun Nov 21 23:10:57 1999 Joe Orton * src/cadaver.c (resolve_path): Ignore '/../' as leading segment in paths. Sat Oct 9 14:43:53 1999 Joe Orton * configure.in: Bumped version to 0.3.2. Sat Oct 9 14:32:18 1999 Joe Orton * src/cadaver.c (resolve_path): Resolve filename of `.' as equal to path, so `cat .' etc does get on current collection. Wed Oct 6 15:26:59 1999 Joe Orton * src/cadaver.c (init_signals): Don't trap SIGTSTP. (resolve_path): Remove `/./' segments. Fri Oct 1 17:20:39 1999 Joe Orton * configure.in: Bumped version to 0.3.1. Fri Oct 1 17:20:08 1999 Joe Orton * Makefile.in (.c.o): New target, should fix non-GNU make builds. Fri Oct 1 09:08:13 1999 Joe Orton * configure.in: Bumped version to 0.3.0. Thu Sep 30 22:47:42 1999 Joe Orton * src/cadaver.c (init_netrc): New function. (main) Call init_netrc. (open_connection): Check for username/password in netrc entries. * lib/netrc.c, lib/netrc.h: New files. * configure.in, config.h.in: netrc support, compile-time option. Thu Sep 30 19:03:44 1999 Joe Orton * src/httpdav.c (dav_move, dav_copy): Send the 'Overwrite: F' header. Thu Sep 30 18:39:30 1999 Joe Orton * src/cadaver.c (choose_pager, spawn_pager, execute_less, execute_cat): 'cat' and 'less' commands implemented. (quit_handler): Ignore signals when a child is running. (execute_move, execute_copy, clever_path): 'move' and 'copy' commands implemented. Thu Sep 30 16:25:22 1999 Joe Orton * src/httpdav.c (dav_copy): New function. Thu Sep 30 16:17:49 1999 Joe Orton * src/httpdav.c (http_request): Don't pass a second 401 challenge on to the auth code. Thu Sep 30 15:48:01 1999 Joe Orton * src/cadaver.c: Updated help string. Use collection/resource not directory/file when talking about the server. Allow opening connections with no specific path, defaulting to '/'. Thu Sep 30 15:42:52 1999 Joe Orton * Makefile.in: Added dependancies. Thu Sep 30 15:35:05 1999 Joe Orton * config.h.in, configure.in: Added history.h location, add_history() presence. * src/cadaver.c (main) [HAVE_ADD_HISTORY]: Use add_history. Thu Sep 30 15:33:33 1999 Joe Orton * configure.in: Bumped version to 0.2.0. Thu Sep 30 13:29:15 1999 Joe Orton * src/cadaver.c (execute_put, execute_get, execute_mkcol, execute_delete, resolve_path): New functions. Thu Sep 30 00:16:46 1999 Joe Orton * src/cadaver.c (parse_args): Added long options. Thu Sep 30 00:02:00 1999 Joe Orton * src/httpdav.c (http_give_creds): Modified for interactive prompting. (dav_fetch): Modified for depth: infinite or depth: 1. Thu Sep 30 00:00:44 1999 Joe Orton * src/*, lib/*, configure.in, config.h.in: Mostly ripped from sitecopy. Wed Sep 29 23:59:31 1999 Joe Orton * Makefile.in, README: Initial version. Wed Sep 29 23:58:53 1999 Joe Orton * src/cadaver.c: Initial version. cadaver-0.23.3/mkinstalldirs0000775000076400007640000000123710355466427015453 0ustar jortonjorton#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id$ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here cadaver-0.23.3/config.sub0000755000076400007640000010224011267054423014612 0ustar jortonjorton#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2009-04-17' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # 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 2 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, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # 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. # 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 $0 [OPTION] 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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) 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) os= basic_machine=$1 ;; -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*) 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 \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | 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 \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | 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 \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-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-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | 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-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | 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-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | 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 ;; 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 ;; 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) 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 ;; 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'm not sure what "Sysv32" means. Should this be sysv3.2? 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 ;; 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 ;; mingw32) basic_machine=i386-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 ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; 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 ;; 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) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) 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 | ppc64-le | powerpc64-little) 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) 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 ;; 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 ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-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 ;; 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. -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* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -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* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -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*) # 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 ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -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 ;; # 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 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; 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 ;; -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: cadaver-0.23.3/INSTALL0000664000076400007640000001722610132320456013663 0ustar jortonjortonBasic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it cannot guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. cadaver-0.23.3/configure.ac0000664000076400007640000000577611312003563015125 0ustar jortonjortondnl configure script AC_PREREQ(2.53) AC_INIT(cadaver, 0.23.3, cadaver@webdav.org) AC_CONFIG_SRCDIR(src/cadaver.c) AC_CONFIG_HEADER(config.h) AC_DEFINE([_GNU_SOURCE], 1, [Define to enable GNU extensions]) NEON_WITH_LIBS AC_ISC_POSIX AC_PROG_CC AC_PROG_INSTALL AC_LANG_C AC_SET_MAKE AC_PROG_RANLIB AC_HEADER_STDC AC_ARG_ENABLE(debugging, AC_HELP_STRING([--disable-debugging],[disable runtime debugging messages]),, enable_debug=yes) if test "$enable_debug" = "yes"; then AC_DEFINE(NE_DEBUGGING, 1, [Define to enable debugging]) fi CHECK_READLINE() AC_ARG_ENABLE(netrc, AC_HELP_STRING([--disable-netrc], [enable .netrc support]),, enable_netrc=yes) NE_REQUIRE_VERSIONS([0], [27 28 29]) dnl Don't enable zlib or ACL support in neon NEON_WITHOUT_ZLIB NEON_WITHOUT_ACL AC_PROVIDE([NE_SNPRINTF]) dnl Build neon. We support a VPATH build. NEON_VPATH_BUNDLED(['$(top_srcdir)/lib/neon'], [lib/neon], [ # We are using a bundled build, do the necessary stuff... # we have a bundled expat, and we don't need zlib support NEON_XML_PARSER([\$(top_srcdir)/lib/expat], [\$(top_builddir)/lib/expat]) NEON_NORMAL_BUILD ], [ # Not using a bundled build... do stuff. AC_C_CONST AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h) ]) NE_FORMAT_TIMET if test "$enable_netrc" = "yes"; then AC_LIBOBJ(lib/netrc) AC_DEFINE(ENABLE_NETRC, 1, [Define to enable netrc support]) AC_MSG_NOTICE(.netrc support is enabled) else AC_MSG_NOTICE(.netrc support is not enabled) fi dnl Check for getopt_long AC_CHECK_FUNC(getopt_long,,[AC_LIBOBJ(lib/getopt) AC_LIBOBJ(lib/getopt1)]) dnl Check for strcasecmp AC_CHECK_FUNC(strcasecmp,,[AC_LIBOBJ(lib/strcasecmp)]) AC_HEADER_TIME jm_PREREQ_TEMPNAME NEON_REPLACE_SNPRINTF() AC_FUNC_FNMATCH if test $ac_cv_func_fnmatch_works = no; then AC_LIBOBJ(lib/fnmatch) fi AC_HEADER_DIRENT AC_TYPE_SIGNAL AC_TYPE_UNSIGNED_LONG_LONG_INT AC_CHECK_FUNCS(strdup strerror memcpy strcoll tcsetattr getpass stty fchmod strtoull) AC_CHECK_HEADERS(sys/time.h pwd.h stdarg.h vmsdir.h memory.h alloca.h ncurses.h sgtty.h termios.h termio.h) jm_FUNC_STRFTIME() AM_GNU_GETTEXT([no-libtool],,[\$(top_builddir)/lib/intl]) if test "$USE_NLS" = "yes"; then if test "$USE_INCLUDED_LIBINTL" = "yes"; then nls_msg="Built using included libintl" CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/lib/intl" else nls_msg="Built using native support" fi LIBS="$LIBS $LIBINTL" else nls_msg="Not built" fi NEON_WARNINGS # Pick up config.h etc; and before any other paths. CPPFLAGS="-I\$(top_builddir) -I\$(top_srcdir)/lib $CPPFLAGS" AC_CONFIG_FILES([Makefile lib/neon/Makefile lib/intl/Makefile \ po/Makefile.in]) AC_OUTPUT AC_MSG_NOTICE([Configured to build cadaver ${PACKAGE_VERSION}: Install prefix: ${prefix} Compiler: ${CC} Neon library: ${neon_library_message} XML Parser: ${neon_xml_parser_message} SSL library: ${ne_SSL_message} Internationalization: ${nls_msg} GNU readline support: ${msg_readline} ]) test -d src || mkdir src cadaver-0.23.3/FAQ0000664000076400007640000000241610132320456013157 0ustar jortonjorton Frequently Asked Questions -------------------------- -> Why this horrible name? It's a play on words: WebDAV - DAV - caDAVer. Gettit? -> Why not something... nicer? Suggestions are very welcome: if you can come up with something better, I'm willing to change the name. -> Why doesn't the "edit" command work with gvim? Because gvim forks and runs in the background by default. Set the EDITOR environment variable to "gvim -f", or put in ~/.cadaverrc set editor "gvim -f" to make the edit command work properly. (thanks to Joshua Penix ) -> How do I read my HotMail e-mail using cadaver? Run: ./cadaver -t http://law14.oe.hotmail.com/cgi-bin/hmdata/foobar@hotmail.com/folders/ACTIVE/ replacing 'foobar' with your real account name. Login when prompted using your username (without @hotmail.com) and your password. Then use 'ls' and you'll get a mailbox listing. Use 'less' or 'cat' to display message contents. 'cd ..' to get a list of your folders. You MUST use the '-t' switch to cadaver since the HotMail servers support a specific subset of DAV operations. You MUST also have built against libxml, otherwise you get XML encoding errors. -> That's a really horrible way of reading e-mail though Yup. Now go add WebDAV support to fetchmail. cadaver-0.23.3/NEWS0000664000076400007640000003566111312003563013332 0ustar jortonjortonChanges in release 0.23.3: * Update to neon 0.29.1. Changes in release 0.23.2: * Fix "make install" with NLS builds. Changes in release 0.23.1: * Update to neon 0.28.0. Changes in release 0.23.0: * Update to neon 0.27.0; drop support for older versions of neon. * Fix "search contains" (thanks to Jack Bates) * Add DESTDIR support to "make install" (Dr Volker Zell) Changes in release 0.22.5: * Update to neon 0.26.3: - fix security issue in URI parser, CVE-2007-0157 * Document netrc support in man page (Sebastian Harl) Changes in release 0.22.4: * Update to neon 0.26.2 (thanks to Peter O'Gorman). * Fixes for OS/2 EMX (Andrew Belov). Changes in release 0.22.3: * Update to neon 0.25.4: - fix support for handling multiple authentication challenges - add support for the Negotiate (GSSAPI/Kerberos) protocol * Enable i18n support again. Changes in release 0.22.2: * Fix build issues on AIX (Tony Bennett). * Fix DeltaV commands on locked resources. * Update to neon 0.24.6: - SECURITY (CVE CAN-2004-0398): fix for sscanf overflow in date parsing Changes in release 0.22.1: * Restore DASL/DeltaV support (GRASE team). * Fix to only use netrc on first attempt at authentication. * Update to neon 0.24.5: - SECURITY (CVE CAN-2004-0179): fix for format string vulnerabilities Changes in release 0.22.0: * Fix build on BSD platforms, or if using bundled expat library. * Fixes for some URI encoding issues. * Update to neon 0.24.1: - only support PKCS#12-encoded client certs, using the "client-cert" option. * Support --with-libs argument to configure. * (Drop DASL/DeltaV support temporarily). Changes in release 0.21.0: * Added DASL searching and DeltaV basic versioning support, contributed by the GRASE team . New commands 'version', 'checkin', 'checkout', 'uncheckout', 'label', 'history', 'search'. * Enable netrc support by default. * Fix 'mput' for filenames with spaces. Changes in release 0.20.5: * Fix 'edit' on a path like `/one.two/three' * Updated to neon 0.23.0: - IPv6 support if getaddrinfo() is supported, based on work by Noriaki Takamiya - for a hostname with multiple addresses, each address is tried in turn until a connection is made. - support for seeding OpenSSL's PRNG via $EGDSOCKET or $HOME/.entropy, to enable SSL on platforms which lack a /dev/random device. - fix interop with buggy SSL implementation in Tomcat 3.2. - RFC2818 compliance for certificate identity checks in SSL Changes in release 0.20.4: * Fix segfault in resolve_path (Dan Mullen). * Update to final neon 0.22.0 release: - persistent connection handling fixes - require OpenSSL >=0.9.6f for latest security fixes (use --with-force-ssl to override the version check) Changes in release 0.20.3: * Fix for segfault if SSL is used with a proxy server, Changes in release 0.20.2: * Quiet mode is now on by default. * Portability fixes for lib/tempname.c build. * Require OpenSSL 0.9.6e or later for SSL support. Changes in release 0.20.1: * Fix for configure not finding po/Makefile.in. Changes in release 0.20.0: * Changes to 'edit' command: - use extension of URI in temporary file name, to help the editor determine the file type. * Fix local filename prompt for 'get'. * configure quoting fixes for Solaris etc. * Add 'pager' option to set pager command for 'more'/'less' commands. * Make 'unset debug' clear all debugging flags rather than segfault. * Nicer 'set' output. * Upgrade to neon 0.22.0-dev: - many SSL improvements, including prompt for untrusted certs - load default CA certs provided by OpenSSL. - SOCKSv5 support (thanks to Torsten Kalix ) - fix 'ls' output corruption when server gives 404 for getlastmodifed or getcontentlength properties (e.g. mod_dav_svn). - fix support for newer libxml2 releases. Changes in release 0.19.1: * Fix permissions of local file downloaded using 'get' (Dan Mullen). * Add man page (Jules ) * Fix build on Mac OS X 10.1. * lockdepth option is used for any non-collection resource. * Add 'quiet' option; when set, connection status messages are supressed. Changes in release 0.19.0: * Remote filename completion from Sean Treadway . * Cosmetic and bug fixes for 'steal' and 'discover' commands. * Added 'propdel' command to remove properties. * Added 'overwrite', 'lockdepth', 'lockscope' options from dan@mullen.net. * Fix for resolving paths passed to 'ls' command (e.g. ".."). * Retry authentication once if it fails. * Fixes for readline 4.2 compatibility: - may have broken readline 2 compatibility; please shout if so! * Add mkstemp() replacement for platforms where necessary. * Incorporate RPM spec file changes from Red Hat (by Nalin Dahyabhai). * Updated to neon 0.18: - timezone handling fixes in date parsing on some platforms - fixes for lock handling - portability fixes Changes in release 0.18.0: * Added 'logout' command, to clear cached authentication details. * Added 'propnames' command. * Added 'utf8' option, to presume terminal I/O is UTF-8. e.g. xterm -u8 mode. * Handle UTF-8 encoding/decoding of property names/values better when not in utf8 mode. * Added FAQ entry on how to read your HotMail e-mail using cadaver. * Updated to neon 0.16: - libxml2, expat2 support (can force with --with-libxml[12]) - Untested SOCKSv5 support (--with-socks) * Fix 'ls' listing the 'executable' property. * Disable i18n support by default to prevent portability problems. * Added FAQ entry on using 'edit' with gvim. Changes in release 0.17.0: * Support for PEM-encoded SSL client certificates, options 'cert' and 'certkey' For example: set cert /some/where/me.crt set certkey /some/where/me.key * Fix remote glob expansion. * Fix --enable-netrc. * Fix possible SEGV from propget if server did not return a response for the requested property. * Make property name argument to propget optional: if it is ommitted, all properties defined on the resource will be displayed. * Added 'propset' command, for setting custom properties. e.g. propset myfile.txt creator "Jim Bloggs" * Added 'namespace' option, which is used as the property namespace for propset and propget commands. * neon updated to 0.12: - Fix interop problem against Xythos servers when using libxml parser. Changes in release 0.16.0: * Added 'propget' command. * Fix for lib/glob.c compile problem on FreeBSD 4.x systems (and probably elsewhere). * Improvements in readline library detection. * Allow the 'edit' command to create a new resource (patch by Tres Seaver ). * Disallow 'edit' on a collection. Use mkstemp() to create temporary file, to avoid /tmp races. * neon updated to 0.10: - Improved --with-ssl to check in /usr as well. - Fix bugs and leaks in locking code. - Build not dependant on GNU make any more Changes in release 0.15.4: * Disallow using 'showlocks' when not connected. Changes in release 0.15.3: * Fix segfaults when using locking code. Changes in release 0.15.2: * Correct handling of non-default ports with SSL (Jeff Costlow ) - Should fix "infinite loop on connect behaviour" * Updated neon: - Various SSL fixes (thanks to Jeff Costlow and David Sloat) Changes in release 0.15.1: * Ensure that a collection URL has a trailing slash before cd/open'ing it. * Fix for SEGV from 'get' when the local file already exists, and the readline() replacement is being used. Changes in release 0.15.0: * Requires neon 0.7.2. * Fix link failure due to double lib/snprintf.o. * If 'delete' fails, don't forget any locks on the resource. * Fixes for BeOS from David Reid . * Use a replacement getpass() function from fetchmail (thanks to Carl Harris who wrote the original code). * Follow automatic 302/301 redirects (only on the same host). Changes in release 0.14.1: * Fixes for readline support: - Check for presence of 'filename_completion_function'. - Don't use xmalloc etc symbols which clash with readline. * Fixes for 'edit' command. * Fix for 'lock' which was creating a shared lock not an exclusive one. * Remove cookies support which was accidentally added. Changes in release 0.14.0: * Ported to neon HTTP/WebDAV client library. Build against bundled copy, or separate 0.4.0 or later (specify location with --with-neon=...). * SSL support (if built into neon); use https: URL. * Support for 'isexecutable' property according to the mod_dav schema: - Print a "*" before name in 'ls' listing if a resource's isexecutable property is true. - New 'chexec' command. * New '--disable-readline' configure option to unconditionally disable readline support. * Internationalization of user-visible messages. Changes in release 0.13.2: * Handle empty elements in PROPFIND response Changes in release 0.13.1: * Build fix: added strndup() replacement. Changes in release 0.13.0: * Persistent connection handling improved (better HTTP/1.0 support). * Support proxy servers, with --proxy=server.com:port, or proxy/proxy-port options. * Support proxy authentication (basic or digest). * Digest authentication improvements. Changes in release 0.12.2: * Compile fix * Report errors correctly for PROPFIND failure cases. * Locking fix * Some modules of DAV client code are now offered under the LGPL as an alternative to the GPL. Changes in release 0.12.1: * Path handling fixes * Build fix * Allow #-commented lines in rcfile Changes in release 0.12.0: * 'ls' listings sorted, clearer. * Percentage-complete progress bar for upload/download. * Cleaner and more consistent output: less intrusive connection status messages ("Connecting to server..." etc). * Several locking fixes. * Added missing Content-Type in some requests (better against PyDAV). * Tab completion for command names. * New editor option, overrides $EDITOR for the 'edit' command. * RPM .spec file contributed by Lee Mallabone . * Prompt changes to a '?' if in a non-DAV-enabled collection. * Built-in dumb readline() replacement used if none on system. * Bug and memory leak fixes. Changes in release 0.11.0: * New lockowner option, a URI to identify the user. * Default to using a lockowner of "mailto:$USER@$HOSTNAME" * rcfile: any commands listed in $HOME/.cadaverrc are run at startup. e.g. set lockowner http://www.my.com/homepage/ * New 'edit' command, does LOCK/GET/edit using $EDITOR/PUT/UNLOCK - thanks to Brendan Quinn for the suggestion. * Don't send empty 'If:' header (works against IIS5 again). * Fixes for 207 response handling (works against MyDocsOnline). * Ignore unwanted properties in PROPFIND response (works against DriveWay). * Don't send an extra newline after a request body (works against PyDAV). * Recognise resources of type DAV:redirectref. * Accept a URL on the command-line, e.g. 'cadaver http://wherever.com/' * Many cosmetic changes and bug fixes. Changes in release 0.10.0 * Improved locking support. * 'If' headers should be correct for all cases. * Better error messages for 207 failure responses to standard DAV methods. * Support libxml as XML parser. * Rewrite of XML response handling. * Debian packaging information from Bernd Eckenfels. Changes in release 0.9.0 * Skeleton locking support using 'lock' and 'unlock' commands. (exclusive locks only, no depth 0 for collections) * Lock-tokens supplied via 'If' headers as needed (limited support). * Lock discovery using 'discover' command (depth 0 only). * Steal a locktoken using 'steal' command. * 'showlocks' to display list of currently owned locks. Changes in release 0.8.0 * Better output messages: only display HTTP Status-Line on error. * Added 'install' target to Makefile. * Check for ncurses if curses isn't found. * Fix local globbing again (thanks to Ulrich Drepper). * Test for "is a collection" actually checks resource type. * 'delete' will only delete non-collection resources. * New command: 'rmcol', to delete collection resources. (rationale: cadaver 'rm' was previously equivalent to Unix 'rm -r') Changes in release 0.7.3 * Yet more little portability fixes Changes in release 0.7.2: * More portability fixes. Changes in release 0.7.1: * Pick up CC from configure. * Fixes for building snprintf. Changes in release 0.7.0: * Better remote globbing: thanks to GNU for their glob() extensions. So, you can now do things like "mv /*/*.html /foo/bar/". * Do remote or local globbing depending on the command in use. * Several memory leaks fixed: thanks to Owen Taylor for the excellent memprof tool. * New commands: 'mget' and 'mput': for batch file downloads/uploads. * 'copy' can take multiple arguments. (e.g. "cp *.html /wherever/") Changes in release 0.6.0: * Check for a DAV-enabled collection is now a PROPFIND with Depth=0. * Run-time option selection: use 'set' and 'unset'. * Can only 'cd' or 'open' into a DAV-enabled collection, unless 'tolerant' option is set. * New --tolerant (or -t) option. * New options interface: 'set', 'unset' commands. * New command line parser: - handles quotes, so you can do "rm 'foo bar'" - backslash literal escaping, so you can do "rm foo\ bar" - and BASIC globbing on remote filenames. These will only match against the contents of the current collection, so, for instance, "../*.html" will NOT WORK as intended. Note also that patterns are never matched against LOCAL filenames. * New 'echo' command, to test how a globbing pattern expands. * move, mkcol, less, cat, delete can all take multiple arguments. Usage, e.g.: "mkcol a b c d e", "rm *.html", "mv *.html /elsewhere" * Fixed quitting and problems with multiple 'open's in a session. * New per-command help using 'help command'. * 'lls' can take multiple arguments. Changes in release 0.5.0: * 'lls' can take a single argument * 'cd -' will swap between current and previous collection. * 'lcd' with no path changes cwd to $HOME * Whitespace in command line ignored. * Cosmetic cleanups, and leaks fixed. Changes in release 0.4.0: * Added 'lls', 'lcd', 'lpwd' commands. * Added some extra aliases. Changes in release 0.3.4: * Quit on CTRL-D rather than segfault. * Added autoconf checks for socket and gethostbyname locations. Changes in release 0.3.3: * Ignore '/../' as a leading segment in paths. Changes in release 0.3.2: * Don't trap CTRL-Z * Better handling of '.' in filenames. Changes in release 0.3.1: * Makefile fix, should build with non-GNU 'make' now. Changes in release 0.3.0: * Readline history support. * Default to '/' if no path given on 'open', or at startup. * 'open' only succeeds for real DAV-enabled collections (i.e., ones where OPTIONS returns '1' in the 'DAV:' header). * New commands: move, copy, (both with overwrite: f) cat, less. * Won't prompt for username/password twice if you get it wrong the first time. * ~/.netrc support, compile-time option, use not recommended since your DAV password on a machine probably isn't the same as your FTP password. * Misc bug fixes and cosmetic tidyups. Changes in release 0.2.0: * Allow startup with no hostname/path * New commands: open, close, get, put, mkcol, delete * Cope with `..' in paths. * Better feedback on errors, display HTTP status-line when appropriate. * A bit of signal handling * configure fixes cadaver-0.23.3/INTEROP0000664000076400007640000000254710132320456013675 0ustar jortonjorton Known interop problems: mod_dav (0.9.14) - Collection locking broken (fixed in mod_dav-0.9.15): If a lockowner is sent, 'discover' and 'steal' will fail on the resource. IIS (as at dav.ics.uci.edu) - Can DELETE a LOCK'ed resource without submitting locktoken (fixed in cadaver-0.11.0): All methods broken, sending empty If: header webfolders.mydocsonline.com - MKCOL fails 501 - COPY creates a duplicate resource in the collection, with the same name as the *original* resource. It also appears some kind of ghost resource appears at the Destination, which PROPFIND reports is a DAV:collection... - PROPFIND on a non-existent resource gives a 500 error, should be 404. www.driveway.com (fixed in cadaver-0.11.0) 'ls' broken due to unwanted properties in PROPFIND response - MKCOL fails 500 - COPY returns 204 but doesn't copy anything - GET/PROPFIND against non-existent resource gives 422, should be 404. Zope - Several reports about problems against Zope 2.1, but nobody will send me details! PyDAV (sandbox.xerox.com:8080) - Broken due to use of "Keep-Alive: " request-header field with no value. (fixed in cadaver-0.11.0): Extra newline after request body broke any requests with bodies. (fixed in cadaver-0.12.0): 'lock' and 'discover' broken due to missing Content-Type header in requests. (fixed in cadaver-0.12.0): 'lock' broken due upper-case I in infinity. cadaver-0.23.3/BUGS0000664000076400007640000000060110256625362013315 0ustar jortonjorton * 'propnames' has confusing output * screwy for collections served by mod_dav_svn * 'history' doesn't fail appropriately for 501 etc responses. * mv hello/ jello -> fails with 301 on 2.0, no trailing slash on dest * doesn't care about the standard $http_proxy environment variable (wget e.g. honors this) * the -p option isn't documented (neither in the manpage nor with -h). cadaver-0.23.3/.release.sh0000775000076400007640000000017710355474417014702 0ustar jortonjorton#!/bin/bash -ex # Release script run before generating a release tarball. # Usage: ./.release.sh VERSION exec ./.update-po.sh cadaver-0.23.3/cadaver.lsm.in0000664000076400007640000000072110132320456015351 0ustar jortonjortonBegin3 Title: cadaver Version: @VERSION@ Entered-date: @DATE@ Description: Command-line WebDAV client. Supports file upload/download, display and editing, namespace operations (move/copy), collection creation and deletion, and locking operations. Keywords: WebDAV Author: joe@manyfish.co.uk (Joe Orton) Primary-site: sunsite.unc.edu /pub/Linux/apps/www/misc/ @SIZE@ cadaver-@VERSION@.tar.gz Platforms: Linux, SunOS, maybe others... Copying-policy: GPL End cadaver-0.23.3/po/0000775000076400007640000000000011312007543013240 5ustar jortonjortoncadaver-0.23.3/po/LINGUAS0000664000076400007640000000001610355466427014302 0ustar jortonjortones it en@quot cadaver-0.23.3/po/it.po0000664000076400007640000012312411312006131014207 0ustar jortonjorton# Italian messages for cadaver. # Copyright (C) 2004 Free Software Foundation, Inc. # Cristian Rigamonti , 2004. # msgid "" msgstr "" "Project-Id-Version: cadaver 0.22\n" "Report-Msgid-Bugs-To: cadaver@webdav.org\n" "POT-Creation-Date: 2009-12-15 22:22+0000\n" "PO-Revision-Date: 2004-03-31 15:01+0200\n" "Last-Translator: Cristian Rigamonti \n" "Language-Team: Italian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" #: lib/getopt.c:680 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: lib/getopt.c:704 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:709 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:726 lib/getopt.c:899 #, fuzzy, c-format msgid "%s: option `%s' requires an argument\n" msgstr "Il comando \"%s\" richiede %d argomenti%s" #: lib/getopt.c:755 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #: lib/getopt.c:759 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #: lib/getopt.c:785 #, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: lib/getopt.c:788 #, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: lib/getopt.c:818 lib/getopt.c:948 #, fuzzy, c-format msgid "%s: option requires an argument -- %c\n" msgstr "Il comando \"%s\" richiede %d argomenti%s" #: lib/getopt.c:865 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "" #: lib/getopt.c:883 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "" #: lib/getpass.c:73 msgid "ERROR: no support for getpassword() routine\n" msgstr "" #: lib/getpass.c:201 #, c-format msgid "" "\n" "Caught SIGINT... bailing out.\n" msgstr "" #: lib/rpmatch.c:75 msgid "^[yY]" msgstr "" #: lib/rpmatch.c:78 msgid "^[nN]" msgstr "" #: lib/neon/ne_207.c:198 #, c-format msgid "" "Invalid HTTP status line in status element at line %d of response:\n" "Status line was: %s" msgstr "" #: lib/neon/ne_auth.c:134 #, fuzzy, c-format msgid "Could not authenticate to server: %s" msgstr "" "Impossibile contattare il server:\n" "%s\n" #: lib/neon/ne_auth.c:139 #, fuzzy, c-format msgid "Could not authenticate to proxy server: %s" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_auth.c:374 #, c-format msgid "rejected %s challenge" msgstr "" #: lib/neon/ne_auth.c:390 msgid "missing realm in Basic challenge" msgstr "" #: lib/neon/ne_auth.c:485 msgid "invalid Negotiate token" msgstr "" #: lib/neon/ne_auth.c:508 #, fuzzy msgid "GSSAPI authentication error: " msgstr "Autenticazione interrotta!\n" #: lib/neon/ne_auth.c:521 #, c-format msgid "GSSAPI failure (code %u)" msgstr "" #: lib/neon/ne_auth.c:556 msgid "ignoring empty Negotiate continuation" msgstr "" #: lib/neon/ne_auth.c:571 msgid "Negotiate response verification failed: invalid response header token" msgstr "" #: lib/neon/ne_auth.c:593 #, c-format msgid "Negotiate response verification failure: %s" msgstr "" #: lib/neon/ne_auth.c:762 msgid "unknown algorithm in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:766 msgid "incompatible algorithm in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:770 msgid "missing parameter in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:774 msgid "initial Digest challenge was stale" msgstr "" #: lib/neon/ne_auth.c:781 msgid "stale Digest challenge with new algorithm or realm" msgstr "" #: lib/neon/ne_auth.c:793 msgid "could not parse domain in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:1102 msgid "Digest mutual authentication failure: missing parameters" msgstr "" #: lib/neon/ne_auth.c:1107 msgid "Digest mutual authentication failure: client nonce mismatch" msgstr "" #: lib/neon/ne_auth.c:1117 msgid "Digest mutual authentication failure: could not parse nonce count" msgstr "" #: lib/neon/ne_auth.c:1122 #, c-format msgid "Digest mutual authentication failure: nonce count mismatch (%u not %u)" msgstr "" #: lib/neon/ne_auth.c:1165 msgid "Digest mutual authentication failure: request-digest mismatch" msgstr "" #: lib/neon/ne_auth.c:1296 #, c-format msgid "ignored %s challenge" msgstr "" #: lib/neon/ne_auth.c:1375 #, fuzzy msgid "could not parse challenge" msgstr "Impossibile leggere l'URL \"%s\"\n" #: lib/neon/ne_basic.c:98 #, fuzzy, c-format msgid "Could not determine file size: %s" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_basic.c:149 msgid "Response did not include requested range" msgstr "" #: lib/neon/ne_basic.c:183 msgid "Range is not satisfiable" msgstr "" #: lib/neon/ne_basic.c:188 msgid "Resource does not support ranged GET requests" msgstr "" #: lib/neon/ne_compress.c:184 #, c-format msgid "%s: %s (code %d)" msgstr "" #: lib/neon/ne_compress.c:232 #, fuzzy msgid "Could not inflate data" msgstr "Impossibile aprire il file: %s\n" #: lib/neon/ne_compress.c:293 #, fuzzy msgid "Could not initialize zlib" msgstr "Impossibile fare stat sul file: %s\n" #: lib/neon/ne_gnutls.c:172 #, c-format msgid "[unprintable:#%lu]" msgstr "" #: lib/neon/ne_gnutls.c:201 msgid "[unprintable]" msgstr "" #: lib/neon/ne_gnutls.c:817 msgid "signed using insecure algorithm" msgstr "" #: lib/neon/ne_gnutls.c:820 #, c-format msgid "unrecognized errors (%u)" msgstr "" #: lib/neon/ne_gnutls.c:865 lib/neon/ne_openssl.c:467 msgid "Server certificate was missing commonName attribute in subject name" msgstr "" #: lib/neon/ne_gnutls.c:879 #, fuzzy, c-format msgid "Could not verify server certificate: %s" msgstr "Impossibile fare stat sul file: %s\n" #: lib/neon/ne_gnutls.c:891 lib/neon/ne_openssl.c:454 #, c-format msgid "Certificate verification error: %s" msgstr "" #: lib/neon/ne_gnutls.c:924 lib/neon/ne_openssl.c:673 #, c-format msgid "SSL handshake failed, client certificate was requested: %s" msgstr "" #: lib/neon/ne_gnutls.c:929 lib/neon/ne_openssl.c:678 #, fuzzy, c-format msgid "SSL handshake failed: %s" msgstr "autenticazione fallita.\n" #: lib/neon/ne_gnutls.c:939 #, fuzzy msgid "Server did not send certificate chain" msgstr "Il server non ha restituito alcun risultato per %s\n" #: lib/neon/ne_locks.c:584 msgid "LOCK response missing Lock-Token header" msgstr "" #: lib/neon/ne_locks.c:759 #, c-format msgid "Response missing activelock for %s" msgstr "" #: lib/neon/ne_locks.c:801 #, c-format msgid "No activelock for <%s> returned in LOCK refresh response" msgstr "" #: lib/neon/ne_openssl.c:698 msgid "SSL server did not present certificate" msgstr "" #: lib/neon/ne_openssl.c:707 msgid "Server certificate changed: connection intercepted?" msgstr "" #: lib/neon/ne_props.c:371 lib/neon/ne_props.c:435 msgid "Response exceeds maximum property count" msgstr "" #: lib/neon/ne_redirect.c:92 #, fuzzy msgid "Could not parse redirect destination URL" msgstr "Impossibile leggere l'URL \"%s\"\n" #: lib/neon/ne_request.c:194 #, fuzzy, c-format msgid "%s: connection was closed by proxy server" msgstr "Connessione a \"%s\" chiusa.\n" #: lib/neon/ne_request.c:197 #, fuzzy, c-format msgid "%s: connection was closed by server" msgstr "Connessione a \"%s\" chiusa.\n" #: lib/neon/ne_request.c:202 #, fuzzy, c-format msgid "%s: connection timed out" msgstr "connessione scaduta.\n" #: lib/neon/ne_request.c:311 #, fuzzy msgid "offset invalid" msgstr "invalido" #: lib/neon/ne_request.c:316 #, fuzzy, c-format msgid "Could not seek to offset %s of request body file: %s" msgstr "Impossibile fare stat sul file: %s\n" #: lib/neon/ne_request.c:364 #, fuzzy msgid "Could not send request body" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_request.c:707 #, fuzzy msgid "Could not read chunk size" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_request.c:714 #, fuzzy msgid "Could not parse chunk size" msgstr "Impossibile leggere l'URL \"%s\"\n" #: lib/neon/ne_request.c:751 #, fuzzy msgid "Could not read response body" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_request.c:767 #, fuzzy msgid "Could not read chunk delimiter" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_request.c:770 msgid "Chunk delimiter was invalid" msgstr "" #: lib/neon/ne_request.c:875 #, fuzzy msgid "Could not read status line" msgstr "Impossibile fare stat sul file: %s\n" #: lib/neon/ne_request.c:897 #, fuzzy msgid "Could not parse response status line" msgstr "Impossibile leggere l'URL \"%s\"\n" #: lib/neon/ne_request.c:909 #, fuzzy msgid "Could not read interim response headers" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_request.c:943 #, fuzzy msgid "Could not send request" msgstr "Impossibile aprire il file: %s\n" #: lib/neon/ne_request.c:991 lib/neon/ne_request.c:1009 #: lib/neon/ne_request.c:1019 msgid "Error reading response headers" msgstr "" #: lib/neon/ne_request.c:1037 msgid "Response header too long" msgstr "" #: lib/neon/ne_request.c:1119 msgid "Response exceeded maximum number of header fields" msgstr "" #: lib/neon/ne_request.c:1134 #, fuzzy, c-format msgid "Could not resolve hostname `%s': %s" msgstr "Impossibile risolvere l'hostname del server \"%s\".\n" #: lib/neon/ne_request.c:1265 msgid "Unknown transfer-coding in response" msgstr "" #: lib/neon/ne_request.c:1278 msgid "Invalid Content-Length in response" msgstr "" #: lib/neon/ne_request.c:1351 src/commands.c:980 #, fuzzy, c-format msgid "Could not write to file: %s" msgstr "Impossibile fare stat sul file: %s\n" #: lib/neon/ne_request.c:1424 #, fuzzy, c-format msgid "Could not create SSL connection through proxy server: %s" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_request.c:1463 #, fuzzy msgid "Could not create socket" msgstr "Impossibile fare stat sul file: %s\n" #: lib/neon/ne_request.c:1496 #, fuzzy msgid "Could not connect to server" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_request.c:1498 #, fuzzy msgid "Could not connect to proxy server" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_request.c:1541 #, c-format msgid "Could not find IPv4 address of hostname %s for SOCKS v4 proxy" msgstr "" #: lib/neon/ne_request.c:1599 #, fuzzy, c-format msgid "Could not establish connection from SOCKS proxy (%s:%u): %s" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_session.c:528 lib/neon/ne_session.c:539 #, fuzzy msgid "[invalid date]" msgstr "invalido" #: lib/neon/ne_session.c:552 msgid "certificate is not yet valid" msgstr "" #: lib/neon/ne_session.c:553 msgid "certificate has expired" msgstr "" #: lib/neon/ne_session.c:554 msgid "certificate issued for a different hostname" msgstr "" #: lib/neon/ne_session.c:555 msgid "issuer is not trusted" msgstr "" #: lib/neon/ne_session.c:556 #, fuzzy msgid "bad certificate chain" msgstr "Il server non ha restituito alcun risultato per %s\n" #: lib/neon/ne_session.c:557 msgid "certificate has been revoked" msgstr "" #: lib/neon/ne_session.c:562 msgid "Server certificate verification failed: " msgstr "" #: lib/neon/ne_socket.c:516 lib/neon/ne_socket.c:612 lib/neon/ne_socket.c:716 #, fuzzy msgid "Connection closed" msgstr "Connessione a \"%s\" chiusa.\n" #: lib/neon/ne_socket.c:622 lib/neon/ne_socket.c:728 #, fuzzy msgid "Secure connection truncated" msgstr "Chiude la connessione in corso" #: lib/neon/ne_socket.c:634 lib/neon/ne_socket.c:740 #, c-format msgid "SSL error: %s" msgstr "" #: lib/neon/ne_socket.c:637 #, c-format msgid "SSL error code %d/%d/%lu" msgstr "" #: lib/neon/ne_socket.c:721 #, c-format msgid "SSL alert received: %s" msgstr "" #: lib/neon/ne_socket.c:736 msgid "SSL socket read failed" msgstr "" #: lib/neon/ne_socket.c:867 msgid "Line too long" msgstr "" #: lib/neon/ne_socket.c:1012 lib/neon/ne_socket.c:1018 msgid "Host not found" msgstr "" #: lib/neon/ne_socket.c:1221 #, fuzzy msgid "Connection timed out" msgstr "connessione scaduta.\n" #: lib/neon/ne_socket.c:1412 msgid "Socket descriptor number exceeds FD_SETSIZE" msgstr "" #: lib/neon/ne_socket.c:1474 msgid "Socket family not supported" msgstr "" #: lib/neon/ne_socket.c:1701 msgid "Client certificate verification failed" msgstr "" #: lib/neon/ne_socket.c:1717 msgid "SSL disabled due to lack of entropy" msgstr "" #: lib/neon/ne_socket.c:1724 msgid "SSL disabled due to library version mismatch" msgstr "" #: lib/neon/ne_socket.c:1730 #, fuzzy msgid "Could not create SSL structure" msgstr "" "Impossibile creare il file temporaneo %s:\n" "%s\n" #: lib/neon/ne_socks.c:65 msgid "failure" msgstr "" #: lib/neon/ne_socks.c:68 #, fuzzy msgid "connection not permitted" msgstr "connessione scaduta.\n" #: lib/neon/ne_socks.c:71 msgid "network unreachable" msgstr "" #: lib/neon/ne_socks.c:74 msgid "host unreachable" msgstr "" #: lib/neon/ne_socks.c:77 msgid "TTL expired" msgstr "" #: lib/neon/ne_socks.c:80 msgid "command not supported" msgstr "" #: lib/neon/ne_socks.c:83 msgid "address type not supported" msgstr "" #: lib/neon/ne_socks.c:86 #, c-format msgid "%s: unrecognized error (%u)" msgstr "" #: lib/neon/ne_socks.c:128 lib/neon/ne_socks.c:328 #, fuzzy msgid "Could not send message to proxy" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_socks.c:133 #, fuzzy msgid "Could not read initial response from proxy" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_socks.c:136 msgid "Invalid version in proxy response" msgstr "" #: lib/neon/ne_socks.c:157 #, fuzzy msgid "Could not send login message" msgstr "Impossibile aprire il file: %s\n" #: lib/neon/ne_socks.c:162 #, fuzzy msgid "Could not read login reply" msgstr "Impossibile fare stat sul file: %s\n" #: lib/neon/ne_socks.c:165 msgid "Invalid version in login reply" msgstr "" #: lib/neon/ne_socks.c:168 #, fuzzy msgid "Authentication failed" msgstr "autenticazione fallita.\n" #: lib/neon/ne_socks.c:172 msgid "No acceptable authentication method" msgstr "" #: lib/neon/ne_socks.c:174 msgid "Unexpected authentication method chosen" msgstr "" #: lib/neon/ne_socks.c:210 #, fuzzy msgid "Could not send connect request" msgstr "Impossibile aprire il file: %s\n" #: lib/neon/ne_socks.c:215 #, fuzzy msgid "Could not read connect reply" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_socks.c:218 msgid "Invalid version in connect reply" msgstr "" #: lib/neon/ne_socks.c:221 lib/neon/ne_socks.c:337 #, fuzzy msgid "Could not connect" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_socks.c:235 msgid "Could not read FQDN length in connect reply" msgstr "" #: lib/neon/ne_socks.c:240 msgid "Unknown address type in connect reply" msgstr "" #: lib/neon/ne_socks.c:245 #, fuzzy msgid "Could not read address in connect reply" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_socks.c:266 msgid "request rejected or failed" msgstr "" #: lib/neon/ne_socks.c:269 #, fuzzy msgid "could not establish connection to identd" msgstr "impossibile connettersi al server.\n" #: lib/neon/ne_socks.c:272 msgid "rejected due to identd user mismatch" msgstr "" #: lib/neon/ne_socks.c:275 #, c-format msgid "%s: unrecognized failure (%u)" msgstr "" #: lib/neon/ne_socks.c:333 #, fuzzy msgid "Could not read response from proxy" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: lib/neon/ne_xml.c:280 #, c-format msgid "XML parse error at line %d: invalid element name" msgstr "" #: lib/neon/ne_xml.c:474 #, fuzzy msgid "Unknown error" msgstr "Errore sconosciuto" #: lib/neon/ne_xml.c:579 msgid "Invalid Byte Order Mark" msgstr "" #: lib/neon/ne_xml.c:667 #, c-format msgid "XML parse error at line %d: %s" msgstr "" #: lib/neon/ne_xmlreq.c:36 #, fuzzy, c-format msgid "Could not parse response: %s" msgstr "Impossibile leggere l'URL \"%s\"\n" #: src/cadaver.c:128 #, fuzzy, c-format msgid "" "Usage: %s [OPTIONS] http://hostname[:port]/path\n" " Port defaults to 80, path defaults to '/'\n" "Options:\n" " -t, --tolerant Allow cd/open into non-WebDAV enabled " "collection.\n" " -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc.\n" " -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port " "PORT.\n" " -V, --version Display version information.\n" " -h, --help Display this help message.\n" "Please send bug reports and feature requests to \n" msgstr "" "Uso: %s [OPZIONI] http://hostname[:porta]/percorso\n" " Il valore predefinito per la porta è 80, per il percorso è '/'\n" "Opzioni:\n" " -e, --expect100 Trasmette l'header \"Expect: 100-continue\".\n" " Attenzione: per server Apache, usare solo con versioni successive a " "1.3.9.\n" " -t, --tolerant Permette cd/open su collezioni non abilitate a WebDAV.\n" " -V, --version Mostra informazioni sulla versione.\n" " -h, --help Mostra questo messaggio di aiuto.\n" "Spedire richieste di miglioramento e notifiche di errore a \n" #: src/cadaver.c:155 #, c-format msgid "Connection to `%s' closed.\n" msgstr "Connessione a \"%s\" chiusa.\n" #: src/cadaver.c:171 #, c-format msgid "" "Ignored error: %s not WebDAV-enabled:\n" "%s\n" msgstr "" "Errore ignorato: %s non è abilitato per WebDAV:\n" "%s\n" #: src/cadaver.c:178 #, c-format msgid "" "Could not access %s (not WebDAV-enabled?):\n" "%s\n" msgstr "" "Impossibile accedere a %s (non abilitato per WebDAV?):\n" "%s\n" #: src/cadaver.c:192 #, c-format msgid "WARNING: Untrusted server certificate presented for `%s':\n" msgstr "" #: src/cadaver.c:195 msgid "WARNING: Untrusted server certificate presented:\n" msgstr "" #: src/cadaver.c:198 #, c-format msgid "Certificate was issued to hostname `%s' rather than `%s'\n" msgstr "" #: src/cadaver.c:200 #, c-format msgid "This connection could have been intercepted.\n" msgstr "" #: src/cadaver.c:206 #, c-format msgid "Issued to: %s\n" msgstr "" #: src/cadaver.c:207 #, c-format msgid "Issued by: %s\n" msgstr "" #: src/cadaver.c:210 #, c-format msgid "Certificate is valid from %s to %s\n" msgstr "" #: src/cadaver.c:213 #, c-format msgid "Do you wish to accept the certificate? (y/n) " msgstr "" #: src/cadaver.c:216 #, c-format msgid "Certificate rejected.\n" msgstr "" #: src/cadaver.c:247 msgid "Decryption password: " msgstr "" #: src/cadaver.c:318 #, c-format msgid "Could not parse URL `%s'\n" msgstr "Impossibile leggere l'URL \"%s\"\n" #: src/cadaver.c:330 #, c-format msgid "SSL is not enabled.\n" msgstr "" #: src/cadaver.c:405 src/cadaver.c:408 #, fuzzy, c-format msgid "" "Could not connect to `%s' on port %d:\n" "%s\n" msgstr "Impossibile connettersi all'host remoto.\n" #: src/cadaver.c:416 #, fuzzy, c-format msgid "" "Could not open collection:\n" "%s\n" msgstr "Impossibile aprire il file: %s\n" #: src/cadaver.c:456 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "Usare \"%s --help\" per maggiori informazioni.\n" #: src/cadaver.c:505 #, c-format msgid "Unrecognised command. Type 'help' for a list of commands.\n" msgstr "Comando sconosciuto. Usare \"help\" per la lista dei comandi.\n" #: src/cadaver.c:507 #, c-format msgid "The `%s' command requires %d argument%s" msgstr "Il comando \"%s\" richiede %d argomenti%s" #: src/cadaver.c:510 src/cadaver.c:522 #, c-format msgid "" ":\n" " %s : %s\n" msgstr "" ":\n" " %s : %s\n" #: src/cadaver.c:516 #, c-format msgid "The `%s' command takes at most %d argument%s" msgstr "Il comando \"%s\" richiede al massimo %d argomenti%s" #: src/cadaver.c:519 #, c-format msgid "The `%s' command takes no arguments" msgstr "Il comando \"%s\" non richiede argomenti" #: src/cadaver.c:527 #, c-format msgid "" "The `%s' command can only be used when connected to the server.\n" "Try running `open' first (see `help open' for more details).\n" msgstr "" "Il comando \"%s\" può essere usato solo se si è connessi al server.\n" "Provare prima `open' (si veda `help open' per maggiori dettagli).\n" #: src/cadaver.c:572 #, c-format msgid "Terminated by signal %d.\n" msgstr "Terminato dal segnale %d.\n" #: src/cadaver.c:615 #, c-format msgid "Could not read rcfile %s: %s\n" msgstr "Impossibile leggere il file di configurazione %s: %s\n" #: src/cadaver.c:870 #, c-format msgid "Environment variable $HOME needs to be set!\n" msgstr "Occorre impostare la variabile di ambiente $HOME!\n" #: src/cadaver.c:932 #, c-format msgid "Looking up hostname... " msgstr "Ricerca dell'hostname... " #: src/cadaver.c:935 #, c-format msgid "Connecting to server... " msgstr "Connessione al server... " #: src/cadaver.c:938 #, c-format msgid "connected.\n" msgstr "connesso.\n" #: src/cadaver.c:950 #, c-format msgid " (reconnecting..." msgstr " (riconnessione..." #: src/cadaver.c:954 #, c-format msgid "done)" msgstr "fatto)" #: src/cadaver.c:980 #, c-format msgid "] reconnecting: " msgstr "] riconnessione: " #: src/cadaver.c:983 #, c-format msgid "okay [" msgstr "ok [" #: src/cadaver.c:1000 #, c-format msgid "\rTransfer timed out, reconnecting... " msgstr "\rTrasferimento scaduto, riconnessione... " #: src/cadaver.c:1003 #, c-format msgid "okay." msgstr "ok." #: src/cadaver.c:1062 #, c-format msgid "\rProgress: [" msgstr "\rProgresso: [" #: src/cadaver.c:1067 #, fuzzy msgid "] %5.1f%% of %" msgstr "] %5.1f%% di %ld byte" #: src/cadaver.c:1094 msgid "Username: " msgstr "Nome utente: " #: src/cadaver.c:1096 #, c-format msgid "\rAuthentication aborted!\n" msgstr "\rAutenticazione interrotta!\n" #: src/cadaver.c:1099 #, c-format msgid "\rUsername too long (>%d)\n" msgstr "" #: src/cadaver.c:1107 msgid "Password: " msgstr "Password: " #: src/cadaver.c:1109 #, c-format msgid "Authentication aborted!\n" msgstr "Autenticazione interrotta!\n" #: src/cadaver.c:1112 #, c-format msgid "\rPassword too long (>%d)\n" msgstr "" #: src/cadaver.c:1123 #, c-format msgid "Retrying:" msgstr "Nuovo tentativo:" #: src/cadaver.c:1127 #, c-format msgid "Retrying [" msgstr "Nuovo tentativo [" #: src/cadaver.c:1150 #, c-format msgid "Authentication required for %s on server `%s':\n" msgstr "Autenticazione richiesta per %s sul server \"%s\":\n" #: src/cadaver.c:1161 #, c-format msgid "Authentication required for %s on proxy server `%s':\n" msgstr "Autenticazione richiesta per %s sul server proxy \"%s\":\n" #: src/cmdline.c:286 msgid "[Matching..." msgstr "[Ricerca corrispondenze..." #: src/cmdline.c:313 #, fuzzy, c-format msgid "%ld matches.]\n" msgstr "%d corrispondenze.]\n" #: src/cmdline.c:315 msgid "1 match.]\n" msgstr "1 corrispondenza.]\n" # (sottinteso: autenticazione) #: src/commands.c:122 msgid "succeeded.\n" msgstr "completata.\n" #: src/commands.c:133 msgid "authentication failed.\n" msgstr "autenticazione fallita.\n" #: src/commands.c:136 msgid "could not connect to server.\n" msgstr "impossibile connettersi al server.\n" #: src/commands.c:139 msgid "connection timed out.\n" msgstr "connessione scaduta.\n" #: src/commands.c:146 #, fuzzy, c-format msgid "redirect to %s\n" msgstr "Directory locale: %s\n" #: src/commands.c:151 src/commands.c:974 #, c-format msgid "" "failed:\n" "%s\n" msgstr "" "fallito:\n" "%s\n" # Le stringhe successive si riferiscono al tipo di lock #: src/commands.c:328 msgid "exclusive" msgstr "esclusivo" #: src/commands.c:329 msgid "shared" msgstr "condiviso" #: src/commands.c:330 src/commands.c:339 src/ls.c:119 msgid "unknown" msgstr "sconosciuto" #: src/commands.c:337 msgid "write" msgstr "scrittura" #: src/commands.c:347 msgid "infinite" msgstr "infinito" #: src/commands.c:348 src/commands.c:366 msgid "invalid" msgstr "invalido" #: src/commands.c:350 #, c-format msgid "%ld seconds" msgstr "" #: src/commands.c:359 msgid "infinity" msgstr "infinità" #: src/commands.c:380 #, fuzzy, c-format msgid "" "Lock token <%s>:\n" " Depth %s on `%s'\n" " Scope: %s Type: %s Timeout: %s\n" " Owner: %s\n" msgstr "" "Lock <%s> su %s:\n" " Ampiezza: %s Tipo: %s Scadenza: %s\n" " Proprietario: %s Profondità: %s\n" #: src/commands.c:387 msgid "(none)" msgstr "(nessuno)" #: src/commands.c:403 src/commands.c:422 #, c-format msgid "Failed on %s: %d %s\n" msgstr "Fallito su %s: %d %s\n" #: src/commands.c:450 msgid "Discovering locks on" msgstr "Mostra i lock su" #: src/commands.c:455 msgid "Stealing locks on" msgstr "Ruba i lock su" #: src/commands.c:469 #, c-format msgid "No owned locks.\n" msgstr "Nessun lock posseduto.\n" #: src/commands.c:487 #, fuzzy msgid "Locking collection" msgstr "Elenco della collezione" #: src/commands.c:489 msgid "Locking" msgstr "Lock in corso" #: src/commands.c:521 msgid "Unlocking" msgstr "Rimozione del lock in corso" #: src/commands.c:525 msgid "Enter locktoken: " msgstr "Inserire il token del lock: " #: src/commands.c:546 #, fuzzy msgid "Creating" msgstr "Cancellazione" #: src/commands.c:560 #, fuzzy, c-format msgid "%s %s failed: %s\n" msgstr "" "fallito:\n" "%s\n" #: src/commands.c:587 #, c-format msgid "Value of %s is: %s\n" msgstr "Il valore di %s è: %s\n" #: src/commands.c:593 #, c-format msgid "Could not fetch property: %d %s\n" msgstr "Impossibile recuperare la proprietà: %d %s\n" #: src/commands.c:596 #, c-format msgid "Server did not return result for %s\n" msgstr "Il server non ha restituito alcun risultato per %s\n" #: src/commands.c:637 #, fuzzy msgid "Setting property on" msgstr "Impostazione della proprietà per " #: src/commands.c:642 #, fuzzy msgid "Deleting property on" msgstr "Impostazione della proprietà per " #: src/commands.c:660 msgid "Fetching properties for" msgstr "Recupero delle proprietà per" #: src/commands.c:691 #, fuzzy msgid "Fetching property names" msgstr "Recupero delle proprietà per" #: src/commands.c:720 msgid "Deleting" msgstr "Cancellazione" #: src/commands.c:723 #, c-format msgid "" "is a collection resource.\n" "The `rm' command cannot be used to delete a collection.\n" "Use `rmcol %s' to delete this collection and ALL its contents.\n" msgstr "" "è una collezione.\n" "Il comando `rm' non può essere usato per cancellare una collezione.\n" "Si usi `rmcol %s' per cancellare questa collezione e TUTTI i suoi " "contenuti.\n" #: src/commands.c:739 msgid "Deleting collection" msgstr "Cancellazione della collezione" #: src/commands.c:742 #, c-format msgid "" "is not a collection.\n" "The `rmcol' command can only be used to delete collections.\n" "Use `rm %s' to delete this resource.\n" msgstr "" "non è una collezione.\n" "Il comando `rmcol' può essere usato solo per cancellare collezioni.\n" "Si usi `rm %s' per cancellare questa risorsa.\n" #: src/commands.c:826 src/commands.c:843 #, c-format msgid "Displaying `%s':\n" msgstr "Visualizzazione di \"%s\":\n" #: src/commands.c:829 #, c-format msgid "" "Error! Could not spawn pager `%s':\n" "%s\n" msgstr "" "Errore! Impossibile eseguire il paginatore \"%s\":\n" "%s\n" #: src/commands.c:845 #, c-format msgid "Failed: %s\n" msgstr "Fallito: %s\n" #: src/commands.c:864 #, c-format msgid "%s: %s and %s are the same resource.\n" msgstr "" #: src/commands.c:873 #, c-format msgid "When %s multiple resources, the last argument must be a collection.\n" msgstr "" "Quando si %s più risorse, l'ultimo argomento dev'essere una collezione.\n" #: src/commands.c:889 #, c-format msgid "Moving `%s' to `%s': " msgstr "Spostamento di \"%s\" in \"%s\": " #: src/commands.c:895 #, c-format msgid "Copying `%s' to `%s': " msgstr "Copia di \"%s\" in \"%s\": " #: src/commands.c:955 #, c-format msgid "Enter local filename for `%s': " msgstr "Inserire il nome di file locale per \"%s\": " #: src/commands.c:960 #, c-format msgid "cancelled.\n" msgstr "cancellato.\n" #: src/commands.c:972 #, c-format msgid "Downloading `%s' to %s:" msgstr "Scaricamento di \"%s\" in %s:" #: src/commands.c:993 #, c-format msgid "Uploading %s to `%s':" msgstr "Caricamento di %s in \"%s\":" #: src/commands.c:995 #, c-format msgid "Could not open file: %s\n" msgstr "Impossibile aprire il file: %s\n" # Piccola acrobazia necessaria... #: src/commands.c:1027 msgid "copying" msgstr "copiano" #: src/commands.c:1027 msgid "copy" msgstr "copia" # Piccola acrobazia necessaria... #: src/commands.c:1032 msgid "moving" msgstr "spostano" #: src/commands.c:1032 msgid "move" msgstr "sposta" #: src/commands.c:1093 #, c-format msgid "" "Use:\n" " chexec + %s to make the resource executable\n" "or chexec - %s to make the resource unexecutable\n" msgstr "" "Uso:\n" " chexec + %s per rendere la risorsa eseguibile\n" " o chexec - %s per rendere la risorsa non eseguibile\n" #: src/commands.c:1102 msgid "Setting isexecutable" msgstr "Impostazione di isexecutable" #: src/commands.c:1108 msgid "The server does not support the 'isexecutable' property." msgstr "Il server non supporta la proprietà 'isexecutable'." #: src/commands.c:1123 #, c-format msgid "Local directory: %s\n" msgstr "Directory locale: %s\n" #: src/commands.c:1139 #, c-format msgid "Error executing ls: %s\n" msgstr "Errore nell'esecuzione di ls: %s\n" #: src/commands.c:1143 #, c-format msgid "Error forking ls: %s\n" msgstr "Errore nel fork di ls: %s\n" #: src/commands.c:1160 #, c-format msgid "Could not determine home directory from environment.\n" msgstr "Impossibile determinare la directory home dall'ambiente.\n" #: src/commands.c:1165 #, c-format msgid "" "Could not change local directory:\n" "chdir: %s\n" msgstr "" "Impossibile cambiare la directory locale:\n" "chdir: %s\n" #: src/commands.c:1173 #, fuzzy, c-format msgid "Current collection is `%s'.\n" msgstr "La collezione attuale è \"%s\", sul server \"%s\"\n" #: src/commands.c:1183 #, fuzzy, c-format msgid "No previous collection.\n" msgstr "Elenco della collezione" #: src/commands.c:1225 #, c-format msgid "" "Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye\n" msgstr "" "Alias: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye\n" #: src/commands.c:1237 #, fuzzy, c-format msgid " `%s' %s\n" msgstr "" ":\n" " %s : %s\n" #: src/commands.c:1239 #, c-format msgid "This command can only be used when connected to a server.\n" msgstr "Questo comando può essere usato solo se si è connessi a un server.\n" #: src/commands.c:1242 #, c-format msgid "Command name not known: %s\n" msgstr "Nome di comando sconosciuto: %s\n" #: src/commands.c:1299 msgid "ls [path]" msgstr "ls [percorso]" #: src/commands.c:1299 msgid "List contents of current [or other] collection" msgstr "Elenca il contenuto della collezione corrente [o di un'altra]" #: src/commands.c:1300 msgid "cd path" msgstr "cd percorso" #: src/commands.c:1300 msgid "Change to specified collection" msgstr "Entra nella collezione specificata" #: src/commands.c:1302 msgid "Display name of current collection" msgstr "Mostra il nome della collezione corrente" #: src/commands.c:1304 msgid "put local [remote]" msgstr "put locale [remoto]" #: src/commands.c:1304 msgid "Upload local file" msgstr "Carica un file locale" #: src/commands.c:1306 msgid "get remote [local]" msgstr "get remoto [locale]" #: src/commands.c:1306 msgid "Download remote resource" msgstr "Scarica una risorsa remota" #: src/commands.c:1307 msgid "mget remote..." msgstr "mget remoto..." #: src/commands.c:1307 msgid "Download many remote resources" msgstr "Scarica molte risorse remote" #: src/commands.c:1309 msgid "mput local..." msgstr "mput locale..." #: src/commands.c:1309 msgid "Upload many local files" msgstr "Carica molti file locali" #: src/commands.c:1310 msgid "edit resource" msgstr "edit risorsa" #: src/commands.c:1310 msgid "Edit given resource" msgstr "Modifica la risorsa specificata" #: src/commands.c:1311 msgid "less remote..." msgstr "less remoto..." #: src/commands.c:1311 msgid "Display remote resource through pager" msgstr "Mostra una risorsa remota attraverso il paginatore" #: src/commands.c:1312 msgid "mkcol remote..." msgstr "mkcol remoto..." #: src/commands.c:1312 msgid "Create remote collection(s)" msgstr "Crea una o più collezioni remote" #: src/commands.c:1313 msgid "cat remote..." msgstr "cat remoto..." #: src/commands.c:1313 msgid "Display remote resource(s)" msgstr "Mostra una o più risorse remote" #: src/commands.c:1314 msgid "delete remote..." msgstr "delete remoto..." #: src/commands.c:1314 msgid "Delete non-collection resource(s)" msgstr "Cancella risorse (non collezioni)" #: src/commands.c:1315 msgid "rmcol remote..." msgstr "rmcol remoto..." #: src/commands.c:1315 msgid "Delete remote collections and ALL contents" msgstr "Cancella collezioni remote e TUTTI i loro contenuti" #: src/commands.c:1316 msgid "copy source... dest" msgstr "copy origine... destinazione" #: src/commands.c:1316 msgid "Copy resource(s) from source to dest" msgstr "Copia risorse dall'origine alla destinazione" #: src/commands.c:1317 msgid "move source... dest" msgstr "move origine... destinazione" #: src/commands.c:1317 msgid "Move resource(s) from source to dest" msgstr "Sposta risorse dall'origine alla destinazione" #: src/commands.c:1323 msgid "lock resource" msgstr "lock risorsa" #: src/commands.c:1323 msgid "Lock given resource" msgstr "Fa il lock della risorsa specificata" #: src/commands.c:1324 msgid "unlock resource" msgstr "unlock risorsa" #: src/commands.c:1324 msgid "Unlock given resource" msgstr "Rimuove il lock dalla risorsa specificata" #: src/commands.c:1325 msgid "discover resource" msgstr "discover risorsa" #: src/commands.c:1325 msgid "Display lock information for resource" msgstr "Mostra le informazioni di lock per la risorsa" #: src/commands.c:1326 msgid "steal resource" msgstr "steal risorsa" #: src/commands.c:1326 msgid "Steal lock token for resource" msgstr "Ruba il lock per la risorsa" #: src/commands.c:1328 msgid "Display list of owned locks" msgstr "Mostra la lista dei lock posseduti" #: src/commands.c:1331 #, fuzzy msgid "verrsion resource" msgstr "edit risorsa" #: src/commands.c:1331 msgid "Place given resource under version control" msgstr "" #: src/commands.c:1332 #, fuzzy msgid "checkin resource" msgstr "lock risorsa" #: src/commands.c:1332 #, fuzzy msgid "Checkin given resource" msgstr "Fa il lock della risorsa specificata" #: src/commands.c:1333 #, fuzzy msgid "checkout resource" msgstr "lock risorsa" #: src/commands.c:1333 #, fuzzy msgid "Checkout given resource" msgstr "Fa il lock della risorsa specificata" #: src/commands.c:1334 #, fuzzy msgid "uncheckin resource" msgstr "unlock risorsa" #: src/commands.c:1334 #, fuzzy msgid "Uncheckout given resource" msgstr "Rimuove il lock dalla risorsa specificata" #: src/commands.c:1335 #, fuzzy msgid "history resource" msgstr "discover risorsa" #: src/commands.c:1335 #, fuzzy msgid "Show version history of resource" msgstr "Imposta le proprietà su una risorsa" #: src/commands.c:1338 msgid "label res [add|set|remove] labelname" msgstr "" #: src/commands.c:1339 #, fuzzy msgid "Set/Del/Edit label on resource" msgstr "Modifica la risorsa specificata" #: src/commands.c:1343 #, fuzzy msgid "Names of properties defined on resource" msgstr "Imposta le proprietà su una risorsa" #: src/commands.c:1346 msgid "chexec [+|-] remote" msgstr "chexec [+|-] remoto" #: src/commands.c:1346 msgid "Change isexecutable property of resource" msgstr "Modifica la proprietà \"isexecutable\" per una risorsa" #: src/commands.c:1349 #, fuzzy msgid "propget res [propname]" msgstr "propget risorsa [proprietà]" #: src/commands.c:1350 msgid "Retrieve properties of resource" msgstr "Recupera le proprietà di una risorsa" #: src/commands.c:1352 #, fuzzy msgid "propdel res propname" msgstr "propget risorsa [proprietà]" #: src/commands.c:1353 #, fuzzy msgid "Delete property from resource" msgstr "Imposta le proprietà su una risorsa" #: src/commands.c:1355 #, fuzzy msgid "propset res propname value" msgstr "propset risorsa proprietà valore" #: src/commands.c:1356 msgid "Set property on resource" msgstr "Imposta le proprietà su una risorsa" #: src/commands.c:1359 msgid "search query" msgstr "" #: src/commands.c:1360 msgid "" "DASL Search resource in current collection\n" "\n" " Examples:\n" " - search where content length is smaller than 100:\n" " > search getcontentlength < 100\n" " - search where author is Smith or Jones\n" " > search author = Smith or author = Jones\n" " Available operators and keywords:\n" " - and, or , (, ), =, <, >, <=, >=, like\n" " (See also variables searchdepth, searchorder, searchdorder)\n" msgstr "" #: src/commands.c:1371 msgid "set [option] [value]" msgstr "set [opzione] [valore]" #: src/commands.c:1371 msgid "Set an option, or display options" msgstr "Imposta un'opzione o mostra le opzioni" #: src/commands.c:1373 msgid "Open connection to given URL" msgstr "Apre la connessione all'URL specificato" #: src/commands.c:1375 msgid "Close current connection" msgstr "Chiude la connessione in corso" #: src/commands.c:1379 msgid "Exit program" msgstr "Esce dal programma" #: src/commands.c:1382 msgid "unset [option] [value]" msgstr "unset [opzione] [valore]" #: src/commands.c:1382 msgid "Unsets or clears value from option." msgstr "Disabilita o cancella il valore di un'opzione" #: src/commands.c:1384 msgid "lcd [directory]" msgstr "lcd [directory]" #: src/commands.c:1384 msgid "Change local working directory" msgstr "Cambia la directory di lavoro locale" #: src/commands.c:1386 msgid "lls [options]" msgstr "lls [opzioni]" #: src/commands.c:1386 msgid "Display local directory listing" msgstr "Mostra l'elenco della directory locale" #: src/commands.c:1387 msgid "Print local working directory" msgstr "Mostra la directory di lavoro locale" #: src/commands.c:1389 msgid "Logout of authentication session" msgstr "" #: src/commands.c:1390 msgid "help [command]" msgstr "help [comando]" #: src/commands.c:1390 msgid "Display help message" msgstr "Mostra un messaggio di aiuto" #: src/commands.c:1392 msgid "Describe an option variable" msgstr "" #: src/commands.c:1393 msgid "Information about this version of cadaver" msgstr "" #: src/common.c:46 #, fuzzy msgid "Unknown system error" msgstr "Errore sconosciuto" #: src/edit.c:68 #, c-format msgid "Could not stat file: %s\n" msgstr "Impossibile fare stat sul file: %s\n" #: src/edit.c:74 #, c-format msgid "Error! Could not examine temporary file: %s\n" msgstr "Errore! Impossibile esaminare il file temporaneo: %s\n" #: src/edit.c:80 #, c-format msgid "No changes were made.\n" msgstr "Nessun cambiamento effettuato.\n" #: src/edit.c:83 #, c-format msgid "Changes were made.\n" msgstr "Sono stati effettuati cambiamenti.\n" #: src/edit.c:130 #, c-format msgid "You cannot edit a collection resource (%s).\n" msgstr "Impossibile modificare una collezione (%s).\n" #: src/edit.c:147 #, c-format msgid "" "Could not create temporary file %s:\n" "%s\n" msgstr "" "Impossibile creare il file temporaneo %s:\n" "%s\n" #: src/edit.c:158 #, c-format msgid "" "Could not set file permissions for %s:\n" "%s\n" msgstr "" "Impossibile impostare i permessi sul file %s:\n" "%s\n" #: src/edit.c:185 #, c-format msgid "Downloading `%s' to %s" msgstr "Scaricamento di \"%s\" in %s" #: src/edit.c:191 #, c-format msgid "Error writing to temporary file: %s\n" msgstr "Errore nella scrittura del file temporaneo: %s\n" #: src/edit.c:200 #, c-format msgid "Could not re-open temporary file: %s\n" msgstr "Impossibile ri-aprire il file temporaneo: %s\n" #: src/edit.c:204 #, c-format msgid "Uploading changes to `%s'" msgstr "Caricamento delle modifiche a \"%s\"" #: src/edit.c:211 #, c-format msgid "Try uploading again (y/n)? " msgstr "Provare a caricare un'altra volta (y/n)? " #: src/edit.c:222 #, c-format msgid "" "Could not delete temporary file %s:\n" "%s\n" msgstr "" "Impossibile cancellare il file temporaneo %s:\n" "%s\n" #: src/ls.c:99 msgid "Ref:" msgstr "Rif:" #: src/ls.c:100 msgid "Coll:" msgstr "Coll:" #: src/ls.c:118 #, c-format msgid "Error: %-30s %d %s\n" msgstr "Errore: %-30s %d %s\n" #: src/ls.c:143 msgid "Listing collection" msgstr "Elenco della collezione" #: src/ls.c:148 msgid "collection is empty.\n" msgstr "la collezione è vuota.\n" #: src/ls.c:208 msgid "Authorization Required" msgstr "Autorizzazione richiesta" #: src/ls.c:210 msgid "Redirect" msgstr "Redirezione" #: src/ls.c:212 msgid "Server Error" msgstr "Errore del server" #: src/ls.c:214 msgid "Unknown Error" msgstr "Errore sconosciuto" #: src/search.c:666 #, c-format msgid "Using query: " msgstr "" #: src/utils.c:50 msgid "Did not find a collection resource." msgstr "Nessuna collezione trovata." #: src/version.c:339 msgid "Versioning" msgstr "" #: src/version.c:344 msgid "Checking in" msgstr "" #: src/version.c:349 msgid "Checking out" msgstr "" #: src/version.c:354 msgid "Cancelling check out of" msgstr "" #: src/version.c:366 #, c-format msgid " %d version%s in history:\n" msgstr "" #: src/version.c:430 msgid "Version history of" msgstr "" #: src/version.c:456 #, c-format msgid "Invalid action `%s' given.\n" msgstr "" #: src/version.c:466 msgid "Labelling" msgstr "" #, fuzzy #~ msgid "%s: %s" #~ msgstr "" #~ ":\n" #~ " %s : %s\n" #~ msgid "Using secure connection: %s\n" #~ msgstr "Connessione sicura in uso: %s\n" #~ msgid "Enter private key password for `%s': " #~ msgstr "Inserire la password della chiave privata per \"%s\": " #~ msgid "Private key password must be 4 or more characters!\n" #~ msgstr "" #~ "La password della chiave privata deve essere lunga almeno 4 caratteri!\n" #~ msgid "" #~ "SSL support has not be compiled into this application.\n" #~ "URLs beginning with \"https:\" cannot be used!\n" #~ msgstr "" #~ "Il supporto SSL non è stato compilato.\n" #~ "Gli URL inizianti per \"https:\" non possono essere usati!\n" #~ msgid "Could not use client certificate `%s' (wrong password)?\n" #~ msgstr "" #~ "Impossibile usare il certificato del client \"%s\" (password sbagliata?)\n" #~ msgid "Using client certificate `%s'.\n" #~ msgstr "Certificato del client in uso: \"%s\".\n" #~ msgid "Unrecognized URL scheme `%s'.\n" #~ msgstr "Schema di URL non riconosciuto \"%s\".\n" #~ msgid "Could not resolve proxy server hostname `%s'.\n" #~ msgstr "Impossibile risolvere l'hostname del server proxy \"%s\".\n" #~ msgid "List of owned locks:\n" #~ msgstr "Elenco dei lock posseduti:\n" #~ msgid "Namespaces are not supported by propget yet, sorry.\n" #~ msgstr "Purtroppo i namespace non sono ancora supportati da propget.\n" #~ msgid "Not a collection resource." #~ msgstr "Non è una collezione." #~ msgid "Could not fdopen temporary file: %s\n" #~ msgstr "Impossibile fare fdopen sul file temporaneo: %s\n" cadaver-0.23.3/po/en@quot.po0000664000076400007640000012727711312006131015223 0ustar jortonjorton# English translations for cadaver package. # Copyright (C) 2009 Joe Orton # This file is distributed under the same license as the cadaver package. # Automatically generated, 2009. # # All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # msgid "" msgstr "" "Project-Id-Version: @PACKAGE@ @VERSION@\n" "Report-Msgid-Bugs-To: cadaver@webdav.org\n" "POT-Creation-Date: 2009-12-15 22:22+0000\n" "PO-Revision-Date: 2009-12-15 22:22+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/getopt.c:680 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: option ‘%s’ is ambiguous\n" #: lib/getopt.c:704 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: option ‘--%s’ doesn't allow an argument\n" #: lib/getopt.c:709 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: option ‘%c%s’ doesn't allow an argument\n" #: lib/getopt.c:726 lib/getopt.c:899 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: option ‘%s’ requires an argument\n" #: lib/getopt.c:755 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: unrecognized option ‘--%s’\n" #: lib/getopt.c:759 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: unrecognized option ‘%c%s’\n" #: lib/getopt.c:785 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: illegal option -- %c\n" #: lib/getopt.c:788 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: invalid option -- %c\n" #: lib/getopt.c:818 lib/getopt.c:948 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: option requires an argument -- %c\n" #: lib/getopt.c:865 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: option ‘-W %s’ is ambiguous\n" #: lib/getopt.c:883 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: option ‘-W %s’ doesn't allow an argument\n" #: lib/getpass.c:73 msgid "ERROR: no support for getpassword() routine\n" msgstr "ERROR: no support for getpassword() routine\n" #: lib/getpass.c:201 #, c-format msgid "" "\n" "Caught SIGINT... bailing out.\n" msgstr "" "\n" "Caught SIGINT... bailing out.\n" #: lib/rpmatch.c:75 msgid "^[yY]" msgstr "^[yY]" #: lib/rpmatch.c:78 msgid "^[nN]" msgstr "^[nN]" #: lib/neon/ne_207.c:198 #, c-format msgid "" "Invalid HTTP status line in status element at line %d of response:\n" "Status line was: %s" msgstr "" "Invalid HTTP status line in status element at line %d of response:\n" "Status line was: %s" #: lib/neon/ne_auth.c:134 #, c-format msgid "Could not authenticate to server: %s" msgstr "Could not authenticate to server: %s" #: lib/neon/ne_auth.c:139 #, c-format msgid "Could not authenticate to proxy server: %s" msgstr "Could not authenticate to proxy server: %s" #: lib/neon/ne_auth.c:374 #, c-format msgid "rejected %s challenge" msgstr "rejected %s challenge" #: lib/neon/ne_auth.c:390 msgid "missing realm in Basic challenge" msgstr "missing realm in Basic challenge" #: lib/neon/ne_auth.c:485 msgid "invalid Negotiate token" msgstr "invalid Negotiate token" #: lib/neon/ne_auth.c:508 msgid "GSSAPI authentication error: " msgstr "GSSAPI authentication error: " #: lib/neon/ne_auth.c:521 #, c-format msgid "GSSAPI failure (code %u)" msgstr "GSSAPI failure (code %u)" #: lib/neon/ne_auth.c:556 msgid "ignoring empty Negotiate continuation" msgstr "ignoring empty Negotiate continuation" #: lib/neon/ne_auth.c:571 msgid "Negotiate response verification failed: invalid response header token" msgstr "Negotiate response verification failed: invalid response header token" #: lib/neon/ne_auth.c:593 #, c-format msgid "Negotiate response verification failure: %s" msgstr "Negotiate response verification failure: %s" #: lib/neon/ne_auth.c:762 msgid "unknown algorithm in Digest challenge" msgstr "unknown algorithm in Digest challenge" #: lib/neon/ne_auth.c:766 msgid "incompatible algorithm in Digest challenge" msgstr "incompatible algorithm in Digest challenge" #: lib/neon/ne_auth.c:770 msgid "missing parameter in Digest challenge" msgstr "missing parameter in Digest challenge" #: lib/neon/ne_auth.c:774 msgid "initial Digest challenge was stale" msgstr "initial Digest challenge was stale" #: lib/neon/ne_auth.c:781 msgid "stale Digest challenge with new algorithm or realm" msgstr "stale Digest challenge with new algorithm or realm" #: lib/neon/ne_auth.c:793 msgid "could not parse domain in Digest challenge" msgstr "could not parse domain in Digest challenge" #: lib/neon/ne_auth.c:1102 msgid "Digest mutual authentication failure: missing parameters" msgstr "Digest mutual authentication failure: missing parameters" #: lib/neon/ne_auth.c:1107 msgid "Digest mutual authentication failure: client nonce mismatch" msgstr "Digest mutual authentication failure: client nonce mismatch" #: lib/neon/ne_auth.c:1117 msgid "Digest mutual authentication failure: could not parse nonce count" msgstr "Digest mutual authentication failure: could not parse nonce count" #: lib/neon/ne_auth.c:1122 #, c-format msgid "Digest mutual authentication failure: nonce count mismatch (%u not %u)" msgstr "Digest mutual authentication failure: nonce count mismatch (%u not %u)" #: lib/neon/ne_auth.c:1165 msgid "Digest mutual authentication failure: request-digest mismatch" msgstr "Digest mutual authentication failure: request-digest mismatch" #: lib/neon/ne_auth.c:1296 #, c-format msgid "ignored %s challenge" msgstr "ignored %s challenge" #: lib/neon/ne_auth.c:1375 msgid "could not parse challenge" msgstr "could not parse challenge" #: lib/neon/ne_basic.c:98 #, c-format msgid "Could not determine file size: %s" msgstr "Could not determine file size: %s" #: lib/neon/ne_basic.c:149 msgid "Response did not include requested range" msgstr "Response did not include requested range" #: lib/neon/ne_basic.c:183 msgid "Range is not satisfiable" msgstr "Range is not satisfiable" #: lib/neon/ne_basic.c:188 msgid "Resource does not support ranged GET requests" msgstr "Resource does not support ranged GET requests" #: lib/neon/ne_compress.c:184 #, c-format msgid "%s: %s (code %d)" msgstr "%s: %s (code %d)" #: lib/neon/ne_compress.c:232 msgid "Could not inflate data" msgstr "Could not inflate data" #: lib/neon/ne_compress.c:293 msgid "Could not initialize zlib" msgstr "Could not initialize zlib" #: lib/neon/ne_gnutls.c:172 #, c-format msgid "[unprintable:#%lu]" msgstr "[unprintable:#%lu]" #: lib/neon/ne_gnutls.c:201 msgid "[unprintable]" msgstr "[unprintable]" #: lib/neon/ne_gnutls.c:817 msgid "signed using insecure algorithm" msgstr "signed using insecure algorithm" #: lib/neon/ne_gnutls.c:820 #, c-format msgid "unrecognized errors (%u)" msgstr "unrecognized errors (%u)" #: lib/neon/ne_gnutls.c:865 lib/neon/ne_openssl.c:467 msgid "Server certificate was missing commonName attribute in subject name" msgstr "Server certificate was missing commonName attribute in subject name" #: lib/neon/ne_gnutls.c:879 #, c-format msgid "Could not verify server certificate: %s" msgstr "Could not verify server certificate: %s" #: lib/neon/ne_gnutls.c:891 lib/neon/ne_openssl.c:454 #, c-format msgid "Certificate verification error: %s" msgstr "Certificate verification error: %s" #: lib/neon/ne_gnutls.c:924 lib/neon/ne_openssl.c:673 #, c-format msgid "SSL handshake failed, client certificate was requested: %s" msgstr "SSL handshake failed, client certificate was requested: %s" #: lib/neon/ne_gnutls.c:929 lib/neon/ne_openssl.c:678 #, c-format msgid "SSL handshake failed: %s" msgstr "SSL handshake failed: %s" #: lib/neon/ne_gnutls.c:939 msgid "Server did not send certificate chain" msgstr "Server did not send certificate chain" #: lib/neon/ne_locks.c:584 msgid "LOCK response missing Lock-Token header" msgstr "LOCK response missing Lock-Token header" #: lib/neon/ne_locks.c:759 #, c-format msgid "Response missing activelock for %s" msgstr "Response missing activelock for %s" #: lib/neon/ne_locks.c:801 #, c-format msgid "No activelock for <%s> returned in LOCK refresh response" msgstr "No activelock for <%s> returned in LOCK refresh response" #: lib/neon/ne_openssl.c:698 msgid "SSL server did not present certificate" msgstr "SSL server did not present certificate" #: lib/neon/ne_openssl.c:707 msgid "Server certificate changed: connection intercepted?" msgstr "Server certificate changed: connection intercepted?" #: lib/neon/ne_props.c:371 lib/neon/ne_props.c:435 msgid "Response exceeds maximum property count" msgstr "Response exceeds maximum property count" #: lib/neon/ne_redirect.c:92 msgid "Could not parse redirect destination URL" msgstr "Could not parse redirect destination URL" #: lib/neon/ne_request.c:194 #, c-format msgid "%s: connection was closed by proxy server" msgstr "%s: connection was closed by proxy server" #: lib/neon/ne_request.c:197 #, c-format msgid "%s: connection was closed by server" msgstr "%s: connection was closed by server" #: lib/neon/ne_request.c:202 #, c-format msgid "%s: connection timed out" msgstr "%s: connection timed out" #: lib/neon/ne_request.c:311 msgid "offset invalid" msgstr "offset invalid" #: lib/neon/ne_request.c:316 #, c-format msgid "Could not seek to offset %s of request body file: %s" msgstr "Could not seek to offset %s of request body file: %s" #: lib/neon/ne_request.c:364 msgid "Could not send request body" msgstr "Could not send request body" #: lib/neon/ne_request.c:707 msgid "Could not read chunk size" msgstr "Could not read chunk size" #: lib/neon/ne_request.c:714 msgid "Could not parse chunk size" msgstr "Could not parse chunk size" #: lib/neon/ne_request.c:751 msgid "Could not read response body" msgstr "Could not read response body" #: lib/neon/ne_request.c:767 msgid "Could not read chunk delimiter" msgstr "Could not read chunk delimiter" #: lib/neon/ne_request.c:770 msgid "Chunk delimiter was invalid" msgstr "Chunk delimiter was invalid" #: lib/neon/ne_request.c:875 msgid "Could not read status line" msgstr "Could not read status line" #: lib/neon/ne_request.c:897 msgid "Could not parse response status line" msgstr "Could not parse response status line" #: lib/neon/ne_request.c:909 msgid "Could not read interim response headers" msgstr "Could not read interim response headers" #: lib/neon/ne_request.c:943 msgid "Could not send request" msgstr "Could not send request" #: lib/neon/ne_request.c:991 lib/neon/ne_request.c:1009 #: lib/neon/ne_request.c:1019 msgid "Error reading response headers" msgstr "Error reading response headers" #: lib/neon/ne_request.c:1037 msgid "Response header too long" msgstr "Response header too long" #: lib/neon/ne_request.c:1119 msgid "Response exceeded maximum number of header fields" msgstr "Response exceeded maximum number of header fields" #: lib/neon/ne_request.c:1134 #, c-format msgid "Could not resolve hostname `%s': %s" msgstr "Could not resolve hostname ‘%s’: %s" #: lib/neon/ne_request.c:1265 msgid "Unknown transfer-coding in response" msgstr "Unknown transfer-coding in response" #: lib/neon/ne_request.c:1278 msgid "Invalid Content-Length in response" msgstr "Invalid Content-Length in response" #: lib/neon/ne_request.c:1351 src/commands.c:980 #, c-format msgid "Could not write to file: %s" msgstr "Could not write to file: %s" #: lib/neon/ne_request.c:1424 #, c-format msgid "Could not create SSL connection through proxy server: %s" msgstr "Could not create SSL connection through proxy server: %s" #: lib/neon/ne_request.c:1463 msgid "Could not create socket" msgstr "Could not create socket" #: lib/neon/ne_request.c:1496 msgid "Could not connect to server" msgstr "Could not connect to server" #: lib/neon/ne_request.c:1498 msgid "Could not connect to proxy server" msgstr "Could not connect to proxy server" #: lib/neon/ne_request.c:1541 #, c-format msgid "Could not find IPv4 address of hostname %s for SOCKS v4 proxy" msgstr "Could not find IPv4 address of hostname %s for SOCKS v4 proxy" #: lib/neon/ne_request.c:1599 #, c-format msgid "Could not establish connection from SOCKS proxy (%s:%u): %s" msgstr "Could not establish connection from SOCKS proxy (%s:%u): %s" #: lib/neon/ne_session.c:528 lib/neon/ne_session.c:539 msgid "[invalid date]" msgstr "[invalid date]" #: lib/neon/ne_session.c:552 msgid "certificate is not yet valid" msgstr "certificate is not yet valid" #: lib/neon/ne_session.c:553 msgid "certificate has expired" msgstr "certificate has expired" #: lib/neon/ne_session.c:554 msgid "certificate issued for a different hostname" msgstr "certificate issued for a different hostname" #: lib/neon/ne_session.c:555 msgid "issuer is not trusted" msgstr "issuer is not trusted" #: lib/neon/ne_session.c:556 msgid "bad certificate chain" msgstr "bad certificate chain" #: lib/neon/ne_session.c:557 msgid "certificate has been revoked" msgstr "certificate has been revoked" #: lib/neon/ne_session.c:562 msgid "Server certificate verification failed: " msgstr "Server certificate verification failed: " #: lib/neon/ne_socket.c:516 lib/neon/ne_socket.c:612 lib/neon/ne_socket.c:716 msgid "Connection closed" msgstr "Connection closed" #: lib/neon/ne_socket.c:622 lib/neon/ne_socket.c:728 msgid "Secure connection truncated" msgstr "Secure connection truncated" #: lib/neon/ne_socket.c:634 lib/neon/ne_socket.c:740 #, c-format msgid "SSL error: %s" msgstr "SSL error: %s" #: lib/neon/ne_socket.c:637 #, c-format msgid "SSL error code %d/%d/%lu" msgstr "SSL error code %d/%d/%lu" #: lib/neon/ne_socket.c:721 #, c-format msgid "SSL alert received: %s" msgstr "SSL alert received: %s" #: lib/neon/ne_socket.c:736 msgid "SSL socket read failed" msgstr "SSL socket read failed" #: lib/neon/ne_socket.c:867 msgid "Line too long" msgstr "Line too long" #: lib/neon/ne_socket.c:1012 lib/neon/ne_socket.c:1018 msgid "Host not found" msgstr "Host not found" #: lib/neon/ne_socket.c:1221 msgid "Connection timed out" msgstr "Connection timed out" #: lib/neon/ne_socket.c:1412 msgid "Socket descriptor number exceeds FD_SETSIZE" msgstr "Socket descriptor number exceeds FD_SETSIZE" #: lib/neon/ne_socket.c:1474 msgid "Socket family not supported" msgstr "Socket family not supported" #: lib/neon/ne_socket.c:1701 msgid "Client certificate verification failed" msgstr "Client certificate verification failed" #: lib/neon/ne_socket.c:1717 msgid "SSL disabled due to lack of entropy" msgstr "SSL disabled due to lack of entropy" #: lib/neon/ne_socket.c:1724 msgid "SSL disabled due to library version mismatch" msgstr "SSL disabled due to library version mismatch" #: lib/neon/ne_socket.c:1730 msgid "Could not create SSL structure" msgstr "Could not create SSL structure" #: lib/neon/ne_socks.c:65 msgid "failure" msgstr "failure" #: lib/neon/ne_socks.c:68 msgid "connection not permitted" msgstr "connection not permitted" #: lib/neon/ne_socks.c:71 msgid "network unreachable" msgstr "network unreachable" #: lib/neon/ne_socks.c:74 msgid "host unreachable" msgstr "host unreachable" #: lib/neon/ne_socks.c:77 msgid "TTL expired" msgstr "TTL expired" #: lib/neon/ne_socks.c:80 msgid "command not supported" msgstr "command not supported" #: lib/neon/ne_socks.c:83 msgid "address type not supported" msgstr "address type not supported" #: lib/neon/ne_socks.c:86 #, c-format msgid "%s: unrecognized error (%u)" msgstr "%s: unrecognized error (%u)" #: lib/neon/ne_socks.c:128 lib/neon/ne_socks.c:328 msgid "Could not send message to proxy" msgstr "Could not send message to proxy" #: lib/neon/ne_socks.c:133 msgid "Could not read initial response from proxy" msgstr "Could not read initial response from proxy" #: lib/neon/ne_socks.c:136 msgid "Invalid version in proxy response" msgstr "Invalid version in proxy response" #: lib/neon/ne_socks.c:157 msgid "Could not send login message" msgstr "Could not send login message" #: lib/neon/ne_socks.c:162 msgid "Could not read login reply" msgstr "Could not read login reply" #: lib/neon/ne_socks.c:165 msgid "Invalid version in login reply" msgstr "Invalid version in login reply" #: lib/neon/ne_socks.c:168 msgid "Authentication failed" msgstr "Authentication failed" #: lib/neon/ne_socks.c:172 msgid "No acceptable authentication method" msgstr "No acceptable authentication method" #: lib/neon/ne_socks.c:174 msgid "Unexpected authentication method chosen" msgstr "Unexpected authentication method chosen" #: lib/neon/ne_socks.c:210 msgid "Could not send connect request" msgstr "Could not send connect request" #: lib/neon/ne_socks.c:215 msgid "Could not read connect reply" msgstr "Could not read connect reply" #: lib/neon/ne_socks.c:218 msgid "Invalid version in connect reply" msgstr "Invalid version in connect reply" #: lib/neon/ne_socks.c:221 lib/neon/ne_socks.c:337 msgid "Could not connect" msgstr "Could not connect" #: lib/neon/ne_socks.c:235 msgid "Could not read FQDN length in connect reply" msgstr "Could not read FQDN length in connect reply" #: lib/neon/ne_socks.c:240 msgid "Unknown address type in connect reply" msgstr "Unknown address type in connect reply" #: lib/neon/ne_socks.c:245 msgid "Could not read address in connect reply" msgstr "Could not read address in connect reply" #: lib/neon/ne_socks.c:266 msgid "request rejected or failed" msgstr "request rejected or failed" #: lib/neon/ne_socks.c:269 msgid "could not establish connection to identd" msgstr "could not establish connection to identd" #: lib/neon/ne_socks.c:272 msgid "rejected due to identd user mismatch" msgstr "rejected due to identd user mismatch" #: lib/neon/ne_socks.c:275 #, c-format msgid "%s: unrecognized failure (%u)" msgstr "%s: unrecognized failure (%u)" #: lib/neon/ne_socks.c:333 msgid "Could not read response from proxy" msgstr "Could not read response from proxy" #: lib/neon/ne_xml.c:280 #, c-format msgid "XML parse error at line %d: invalid element name" msgstr "XML parse error at line %d: invalid element name" #: lib/neon/ne_xml.c:474 msgid "Unknown error" msgstr "Unknown error" #: lib/neon/ne_xml.c:579 msgid "Invalid Byte Order Mark" msgstr "Invalid Byte Order Mark" #: lib/neon/ne_xml.c:667 #, c-format msgid "XML parse error at line %d: %s" msgstr "XML parse error at line %d: %s" #: lib/neon/ne_xmlreq.c:36 #, c-format msgid "Could not parse response: %s" msgstr "Could not parse response: %s" #: src/cadaver.c:128 #, c-format msgid "" "Usage: %s [OPTIONS] http://hostname[:port]/path\n" " Port defaults to 80, path defaults to '/'\n" "Options:\n" " -t, --tolerant Allow cd/open into non-WebDAV enabled " "collection.\n" " -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc.\n" " -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port " "PORT.\n" " -V, --version Display version information.\n" " -h, --help Display this help message.\n" "Please send bug reports and feature requests to \n" msgstr "" "Usage: %s [OPTIONS] http://hostname[:port]/path\n" " Port defaults to 80, path defaults to ‘/’\n" "Options:\n" " -t, --tolerant Allow cd/open into non-WebDAV enabled " "collection.\n" " -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc.\n" " -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port " "PORT.\n" " -V, --version Display version information.\n" " -h, --help Display this help message.\n" "Please send bug reports and feature requests to \n" #: src/cadaver.c:155 #, c-format msgid "Connection to `%s' closed.\n" msgstr "Connection to ‘%s’ closed.\n" #: src/cadaver.c:171 #, c-format msgid "" "Ignored error: %s not WebDAV-enabled:\n" "%s\n" msgstr "" "Ignored error: %s not WebDAV-enabled:\n" "%s\n" #: src/cadaver.c:178 #, c-format msgid "" "Could not access %s (not WebDAV-enabled?):\n" "%s\n" msgstr "" "Could not access %s (not WebDAV-enabled?):\n" "%s\n" #: src/cadaver.c:192 #, c-format msgid "WARNING: Untrusted server certificate presented for `%s':\n" msgstr "WARNING: Untrusted server certificate presented for ‘%s’:\n" #: src/cadaver.c:195 msgid "WARNING: Untrusted server certificate presented:\n" msgstr "WARNING: Untrusted server certificate presented:\n" #: src/cadaver.c:198 #, c-format msgid "Certificate was issued to hostname `%s' rather than `%s'\n" msgstr "Certificate was issued to hostname ‘%s’ rather than ‘%s’\n" #: src/cadaver.c:200 #, c-format msgid "This connection could have been intercepted.\n" msgstr "This connection could have been intercepted.\n" #: src/cadaver.c:206 #, c-format msgid "Issued to: %s\n" msgstr "Issued to: %s\n" #: src/cadaver.c:207 #, c-format msgid "Issued by: %s\n" msgstr "Issued by: %s\n" #: src/cadaver.c:210 #, c-format msgid "Certificate is valid from %s to %s\n" msgstr "Certificate is valid from %s to %s\n" #: src/cadaver.c:213 #, c-format msgid "Do you wish to accept the certificate? (y/n) " msgstr "Do you wish to accept the certificate? (y/n) " #: src/cadaver.c:216 #, c-format msgid "Certificate rejected.\n" msgstr "Certificate rejected.\n" #: src/cadaver.c:247 msgid "Decryption password: " msgstr "Decryption password: " #: src/cadaver.c:318 #, c-format msgid "Could not parse URL `%s'\n" msgstr "Could not parse URL ‘%s’\n" #: src/cadaver.c:330 #, c-format msgid "SSL is not enabled.\n" msgstr "SSL is not enabled.\n" #: src/cadaver.c:405 src/cadaver.c:408 #, c-format msgid "" "Could not connect to `%s' on port %d:\n" "%s\n" msgstr "" "Could not connect to ‘%s’ on port %d:\n" "%s\n" #: src/cadaver.c:416 #, c-format msgid "" "Could not open collection:\n" "%s\n" msgstr "" "Could not open collection:\n" "%s\n" #: src/cadaver.c:456 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "Try ‘%s --help’ for more information.\n" #: src/cadaver.c:505 #, c-format msgid "Unrecognised command. Type 'help' for a list of commands.\n" msgstr "Unrecognised command. Type ‘help’ for a list of commands.\n" #: src/cadaver.c:507 #, c-format msgid "The `%s' command requires %d argument%s" msgstr "The ‘%s’ command requires %d argument%s" #: src/cadaver.c:510 src/cadaver.c:522 #, c-format msgid "" ":\n" " %s : %s\n" msgstr "" ":\n" " %s : %s\n" #: src/cadaver.c:516 #, c-format msgid "The `%s' command takes at most %d argument%s" msgstr "The ‘%s’ command takes at most %d argument%s" #: src/cadaver.c:519 #, c-format msgid "The `%s' command takes no arguments" msgstr "The ‘%s’ command takes no arguments" #: src/cadaver.c:527 #, c-format msgid "" "The `%s' command can only be used when connected to the server.\n" "Try running `open' first (see `help open' for more details).\n" msgstr "" "The ‘%s’ command can only be used when connected to the server.\n" "Try running ‘open’ first (see ‘help open’ for more details).\n" #: src/cadaver.c:572 #, c-format msgid "Terminated by signal %d.\n" msgstr "Terminated by signal %d.\n" #: src/cadaver.c:615 #, c-format msgid "Could not read rcfile %s: %s\n" msgstr "Could not read rcfile %s: %s\n" #: src/cadaver.c:870 #, c-format msgid "Environment variable $HOME needs to be set!\n" msgstr "Environment variable $HOME needs to be set!\n" #: src/cadaver.c:932 #, c-format msgid "Looking up hostname... " msgstr "Looking up hostname... " #: src/cadaver.c:935 #, c-format msgid "Connecting to server... " msgstr "Connecting to server... " #: src/cadaver.c:938 #, c-format msgid "connected.\n" msgstr "connected.\n" #: src/cadaver.c:950 #, c-format msgid " (reconnecting..." msgstr " (reconnecting..." #: src/cadaver.c:954 #, c-format msgid "done)" msgstr "done)" #: src/cadaver.c:980 #, c-format msgid "] reconnecting: " msgstr "] reconnecting: " #: src/cadaver.c:983 #, c-format msgid "okay [" msgstr "okay [" #: src/cadaver.c:1000 #, c-format msgid "\rTransfer timed out, reconnecting... " msgstr "\rTransfer timed out, reconnecting... " #: src/cadaver.c:1003 #, c-format msgid "okay." msgstr "okay." #: src/cadaver.c:1062 #, c-format msgid "\rProgress: [" msgstr "\rProgress: [" #: src/cadaver.c:1067 msgid "] %5.1f%% of %" msgstr "] %5.1f%% of %" #: src/cadaver.c:1094 msgid "Username: " msgstr "Username: " #: src/cadaver.c:1096 #, c-format msgid "\rAuthentication aborted!\n" msgstr "\rAuthentication aborted!\n" #: src/cadaver.c:1099 #, c-format msgid "\rUsername too long (>%d)\n" msgstr "\rUsername too long (>%d)\n" #: src/cadaver.c:1107 msgid "Password: " msgstr "Password: " #: src/cadaver.c:1109 #, c-format msgid "Authentication aborted!\n" msgstr "Authentication aborted!\n" #: src/cadaver.c:1112 #, c-format msgid "\rPassword too long (>%d)\n" msgstr "\rPassword too long (>%d)\n" #: src/cadaver.c:1123 #, c-format msgid "Retrying:" msgstr "Retrying:" #: src/cadaver.c:1127 #, c-format msgid "Retrying [" msgstr "Retrying [" #: src/cadaver.c:1150 #, c-format msgid "Authentication required for %s on server `%s':\n" msgstr "Authentication required for %s on server ‘%s’:\n" #: src/cadaver.c:1161 #, c-format msgid "Authentication required for %s on proxy server `%s':\n" msgstr "Authentication required for %s on proxy server ‘%s’:\n" #: src/cmdline.c:286 msgid "[Matching..." msgstr "[Matching..." #: src/cmdline.c:313 #, c-format msgid "%ld matches.]\n" msgstr "%ld matches.]\n" #: src/cmdline.c:315 msgid "1 match.]\n" msgstr "1 match.]\n" #: src/commands.c:122 msgid "succeeded.\n" msgstr "succeeded.\n" #: src/commands.c:133 msgid "authentication failed.\n" msgstr "authentication failed.\n" #: src/commands.c:136 msgid "could not connect to server.\n" msgstr "could not connect to server.\n" #: src/commands.c:139 msgid "connection timed out.\n" msgstr "connection timed out.\n" #: src/commands.c:146 #, c-format msgid "redirect to %s\n" msgstr "redirect to %s\n" #: src/commands.c:151 src/commands.c:974 #, c-format msgid "" "failed:\n" "%s\n" msgstr "" "failed:\n" "%s\n" #: src/commands.c:328 msgid "exclusive" msgstr "exclusive" #: src/commands.c:329 msgid "shared" msgstr "shared" #: src/commands.c:330 src/commands.c:339 src/ls.c:119 msgid "unknown" msgstr "unknown" #: src/commands.c:337 msgid "write" msgstr "write" #: src/commands.c:347 msgid "infinite" msgstr "infinite" #: src/commands.c:348 src/commands.c:366 msgid "invalid" msgstr "invalid" #: src/commands.c:350 #, c-format msgid "%ld seconds" msgstr "%ld seconds" #: src/commands.c:359 msgid "infinity" msgstr "infinity" #: src/commands.c:380 #, c-format msgid "" "Lock token <%s>:\n" " Depth %s on `%s'\n" " Scope: %s Type: %s Timeout: %s\n" " Owner: %s\n" msgstr "" "Lock token <%s>:\n" " Depth %s on ‘%s’\n" " Scope: %s Type: %s Timeout: %s\n" " Owner: %s\n" #: src/commands.c:387 msgid "(none)" msgstr "(none)" #: src/commands.c:403 src/commands.c:422 #, c-format msgid "Failed on %s: %d %s\n" msgstr "Failed on %s: %d %s\n" #: src/commands.c:450 msgid "Discovering locks on" msgstr "Discovering locks on" #: src/commands.c:455 msgid "Stealing locks on" msgstr "Stealing locks on" #: src/commands.c:469 #, c-format msgid "No owned locks.\n" msgstr "No owned locks.\n" #: src/commands.c:487 msgid "Locking collection" msgstr "Locking collection" #: src/commands.c:489 msgid "Locking" msgstr "Locking" #: src/commands.c:521 msgid "Unlocking" msgstr "Unlocking" #: src/commands.c:525 msgid "Enter locktoken: " msgstr "Enter locktoken: " #: src/commands.c:546 msgid "Creating" msgstr "Creating" #: src/commands.c:560 #, c-format msgid "%s %s failed: %s\n" msgstr "%s %s failed: %s\n" #: src/commands.c:587 #, c-format msgid "Value of %s is: %s\n" msgstr "Value of %s is: %s\n" #: src/commands.c:593 #, c-format msgid "Could not fetch property: %d %s\n" msgstr "Could not fetch property: %d %s\n" #: src/commands.c:596 #, c-format msgid "Server did not return result for %s\n" msgstr "Server did not return result for %s\n" #: src/commands.c:637 msgid "Setting property on" msgstr "Setting property on" #: src/commands.c:642 msgid "Deleting property on" msgstr "Deleting property on" #: src/commands.c:660 msgid "Fetching properties for" msgstr "Fetching properties for" #: src/commands.c:691 msgid "Fetching property names" msgstr "Fetching property names" #: src/commands.c:720 msgid "Deleting" msgstr "Deleting" #: src/commands.c:723 #, c-format msgid "" "is a collection resource.\n" "The `rm' command cannot be used to delete a collection.\n" "Use `rmcol %s' to delete this collection and ALL its contents.\n" msgstr "" "is a collection resource.\n" "The ‘rm’ command cannot be used to delete a collection.\n" "Use ‘rmcol %s’ to delete this collection and ALL its contents.\n" #: src/commands.c:739 msgid "Deleting collection" msgstr "Deleting collection" #: src/commands.c:742 #, c-format msgid "" "is not a collection.\n" "The `rmcol' command can only be used to delete collections.\n" "Use `rm %s' to delete this resource.\n" msgstr "" "is not a collection.\n" "The ‘rmcol’ command can only be used to delete collections.\n" "Use ‘rm %s’ to delete this resource.\n" #: src/commands.c:826 src/commands.c:843 #, c-format msgid "Displaying `%s':\n" msgstr "Displaying ‘%s’:\n" #: src/commands.c:829 #, c-format msgid "" "Error! Could not spawn pager `%s':\n" "%s\n" msgstr "" "Error! Could not spawn pager ‘%s’:\n" "%s\n" #: src/commands.c:845 #, c-format msgid "Failed: %s\n" msgstr "Failed: %s\n" #: src/commands.c:864 #, c-format msgid "%s: %s and %s are the same resource.\n" msgstr "%s: %s and %s are the same resource.\n" #: src/commands.c:873 #, c-format msgid "When %s multiple resources, the last argument must be a collection.\n" msgstr "When %s multiple resources, the last argument must be a collection.\n" #: src/commands.c:889 #, c-format msgid "Moving `%s' to `%s': " msgstr "Moving ‘%s’ to ‘%s’: " #: src/commands.c:895 #, c-format msgid "Copying `%s' to `%s': " msgstr "Copying ‘%s’ to ‘%s’: " #: src/commands.c:955 #, c-format msgid "Enter local filename for `%s': " msgstr "Enter local filename for ‘%s’: " #: src/commands.c:960 #, c-format msgid "cancelled.\n" msgstr "cancelled.\n" #: src/commands.c:972 #, c-format msgid "Downloading `%s' to %s:" msgstr "Downloading ‘%s’ to %s:" #: src/commands.c:993 #, c-format msgid "Uploading %s to `%s':" msgstr "Uploading %s to ‘%s’:" #: src/commands.c:995 #, c-format msgid "Could not open file: %s\n" msgstr "Could not open file: %s\n" #: src/commands.c:1027 msgid "copying" msgstr "copying" #: src/commands.c:1027 msgid "copy" msgstr "copy" #: src/commands.c:1032 msgid "moving" msgstr "moving" #: src/commands.c:1032 msgid "move" msgstr "move" #: src/commands.c:1093 #, c-format msgid "" "Use:\n" " chexec + %s to make the resource executable\n" "or chexec - %s to make the resource unexecutable\n" msgstr "" "Use:\n" " chexec + %s to make the resource executable\n" "or chexec - %s to make the resource unexecutable\n" #: src/commands.c:1102 msgid "Setting isexecutable" msgstr "Setting isexecutable" #: src/commands.c:1108 msgid "The server does not support the 'isexecutable' property." msgstr "The server does not support the ‘isexecutable’ property." #: src/commands.c:1123 #, c-format msgid "Local directory: %s\n" msgstr "Local directory: %s\n" #: src/commands.c:1139 #, c-format msgid "Error executing ls: %s\n" msgstr "Error executing ls: %s\n" #: src/commands.c:1143 #, c-format msgid "Error forking ls: %s\n" msgstr "Error forking ls: %s\n" #: src/commands.c:1160 #, c-format msgid "Could not determine home directory from environment.\n" msgstr "Could not determine home directory from environment.\n" #: src/commands.c:1165 #, c-format msgid "" "Could not change local directory:\n" "chdir: %s\n" msgstr "" "Could not change local directory:\n" "chdir: %s\n" #: src/commands.c:1173 #, c-format msgid "Current collection is `%s'.\n" msgstr "Current collection is ‘%s’.\n" #: src/commands.c:1183 #, c-format msgid "No previous collection.\n" msgstr "No previous collection.\n" #: src/commands.c:1225 #, c-format msgid "" "Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye\n" msgstr "" "Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye\n" #: src/commands.c:1237 #, c-format msgid " `%s' %s\n" msgstr " ‘%s’ %s\n" #: src/commands.c:1239 #, c-format msgid "This command can only be used when connected to a server.\n" msgstr "This command can only be used when connected to a server.\n" #: src/commands.c:1242 #, c-format msgid "Command name not known: %s\n" msgstr "Command name not known: %s\n" #: src/commands.c:1299 msgid "ls [path]" msgstr "ls [path]" #: src/commands.c:1299 msgid "List contents of current [or other] collection" msgstr "List contents of current [or other] collection" #: src/commands.c:1300 msgid "cd path" msgstr "cd path" #: src/commands.c:1300 msgid "Change to specified collection" msgstr "Change to specified collection" #: src/commands.c:1302 msgid "Display name of current collection" msgstr "Display name of current collection" #: src/commands.c:1304 msgid "put local [remote]" msgstr "put local [remote]" #: src/commands.c:1304 msgid "Upload local file" msgstr "Upload local file" #: src/commands.c:1306 msgid "get remote [local]" msgstr "get remote [local]" #: src/commands.c:1306 msgid "Download remote resource" msgstr "Download remote resource" #: src/commands.c:1307 msgid "mget remote..." msgstr "mget remote..." #: src/commands.c:1307 msgid "Download many remote resources" msgstr "Download many remote resources" #: src/commands.c:1309 msgid "mput local..." msgstr "mput local..." #: src/commands.c:1309 msgid "Upload many local files" msgstr "Upload many local files" #: src/commands.c:1310 msgid "edit resource" msgstr "edit resource" #: src/commands.c:1310 msgid "Edit given resource" msgstr "Edit given resource" #: src/commands.c:1311 msgid "less remote..." msgstr "less remote..." #: src/commands.c:1311 msgid "Display remote resource through pager" msgstr "Display remote resource through pager" #: src/commands.c:1312 msgid "mkcol remote..." msgstr "mkcol remote..." #: src/commands.c:1312 msgid "Create remote collection(s)" msgstr "Create remote collection(s)" #: src/commands.c:1313 msgid "cat remote..." msgstr "cat remote..." #: src/commands.c:1313 msgid "Display remote resource(s)" msgstr "Display remote resource(s)" #: src/commands.c:1314 msgid "delete remote..." msgstr "delete remote..." #: src/commands.c:1314 msgid "Delete non-collection resource(s)" msgstr "Delete non-collection resource(s)" #: src/commands.c:1315 msgid "rmcol remote..." msgstr "rmcol remote..." #: src/commands.c:1315 msgid "Delete remote collections and ALL contents" msgstr "Delete remote collections and ALL contents" #: src/commands.c:1316 msgid "copy source... dest" msgstr "copy source... dest" #: src/commands.c:1316 msgid "Copy resource(s) from source to dest" msgstr "Copy resource(s) from source to dest" #: src/commands.c:1317 msgid "move source... dest" msgstr "move source... dest" #: src/commands.c:1317 msgid "Move resource(s) from source to dest" msgstr "Move resource(s) from source to dest" #: src/commands.c:1323 msgid "lock resource" msgstr "lock resource" #: src/commands.c:1323 msgid "Lock given resource" msgstr "Lock given resource" #: src/commands.c:1324 msgid "unlock resource" msgstr "unlock resource" #: src/commands.c:1324 msgid "Unlock given resource" msgstr "Unlock given resource" #: src/commands.c:1325 msgid "discover resource" msgstr "discover resource" #: src/commands.c:1325 msgid "Display lock information for resource" msgstr "Display lock information for resource" #: src/commands.c:1326 msgid "steal resource" msgstr "steal resource" #: src/commands.c:1326 msgid "Steal lock token for resource" msgstr "Steal lock token for resource" #: src/commands.c:1328 msgid "Display list of owned locks" msgstr "Display list of owned locks" #: src/commands.c:1331 msgid "verrsion resource" msgstr "verrsion resource" #: src/commands.c:1331 msgid "Place given resource under version control" msgstr "Place given resource under version control" #: src/commands.c:1332 msgid "checkin resource" msgstr "checkin resource" #: src/commands.c:1332 msgid "Checkin given resource" msgstr "Checkin given resource" #: src/commands.c:1333 msgid "checkout resource" msgstr "checkout resource" #: src/commands.c:1333 msgid "Checkout given resource" msgstr "Checkout given resource" #: src/commands.c:1334 msgid "uncheckin resource" msgstr "uncheckin resource" #: src/commands.c:1334 msgid "Uncheckout given resource" msgstr "Uncheckout given resource" #: src/commands.c:1335 msgid "history resource" msgstr "history resource" #: src/commands.c:1335 msgid "Show version history of resource" msgstr "Show version history of resource" #: src/commands.c:1338 msgid "label res [add|set|remove] labelname" msgstr "label res [add|set|remove] labelname" #: src/commands.c:1339 msgid "Set/Del/Edit label on resource" msgstr "Set/Del/Edit label on resource" #: src/commands.c:1343 msgid "Names of properties defined on resource" msgstr "Names of properties defined on resource" #: src/commands.c:1346 msgid "chexec [+|-] remote" msgstr "chexec [+|-] remote" #: src/commands.c:1346 msgid "Change isexecutable property of resource" msgstr "Change isexecutable property of resource" #: src/commands.c:1349 msgid "propget res [propname]" msgstr "propget res [propname]" #: src/commands.c:1350 msgid "Retrieve properties of resource" msgstr "Retrieve properties of resource" #: src/commands.c:1352 msgid "propdel res propname" msgstr "propdel res propname" #: src/commands.c:1353 msgid "Delete property from resource" msgstr "Delete property from resource" #: src/commands.c:1355 msgid "propset res propname value" msgstr "propset res propname value" #: src/commands.c:1356 msgid "Set property on resource" msgstr "Set property on resource" #: src/commands.c:1359 msgid "search query" msgstr "search query" #: src/commands.c:1360 msgid "" "DASL Search resource in current collection\n" "\n" " Examples:\n" " - search where content length is smaller than 100:\n" " > search getcontentlength < 100\n" " - search where author is Smith or Jones\n" " > search author = Smith or author = Jones\n" " Available operators and keywords:\n" " - and, or , (, ), =, <, >, <=, >=, like\n" " (See also variables searchdepth, searchorder, searchdorder)\n" msgstr "" "DASL Search resource in current collection\n" "\n" " Examples:\n" " - search where content length is smaller than 100:\n" " > search getcontentlength < 100\n" " - search where author is Smith or Jones\n" " > search author = Smith or author = Jones\n" " Available operators and keywords:\n" " - and, or , (, ), =, <, >, <=, >=, like\n" " (See also variables searchdepth, searchorder, searchdorder)\n" #: src/commands.c:1371 msgid "set [option] [value]" msgstr "set [option] [value]" #: src/commands.c:1371 msgid "Set an option, or display options" msgstr "Set an option, or display options" #: src/commands.c:1373 msgid "Open connection to given URL" msgstr "Open connection to given URL" #: src/commands.c:1375 msgid "Close current connection" msgstr "Close current connection" #: src/commands.c:1379 msgid "Exit program" msgstr "Exit program" #: src/commands.c:1382 msgid "unset [option] [value]" msgstr "unset [option] [value]" #: src/commands.c:1382 msgid "Unsets or clears value from option." msgstr "Unsets or clears value from option." #: src/commands.c:1384 msgid "lcd [directory]" msgstr "lcd [directory]" #: src/commands.c:1384 msgid "Change local working directory" msgstr "Change local working directory" #: src/commands.c:1386 msgid "lls [options]" msgstr "lls [options]" #: src/commands.c:1386 msgid "Display local directory listing" msgstr "Display local directory listing" #: src/commands.c:1387 msgid "Print local working directory" msgstr "Print local working directory" #: src/commands.c:1389 msgid "Logout of authentication session" msgstr "Logout of authentication session" #: src/commands.c:1390 msgid "help [command]" msgstr "help [command]" #: src/commands.c:1390 msgid "Display help message" msgstr "Display help message" #: src/commands.c:1392 msgid "Describe an option variable" msgstr "Describe an option variable" #: src/commands.c:1393 msgid "Information about this version of cadaver" msgstr "Information about this version of cadaver" #: src/common.c:46 msgid "Unknown system error" msgstr "Unknown system error" #: src/edit.c:68 #, c-format msgid "Could not stat file: %s\n" msgstr "Could not stat file: %s\n" #: src/edit.c:74 #, c-format msgid "Error! Could not examine temporary file: %s\n" msgstr "Error! Could not examine temporary file: %s\n" #: src/edit.c:80 #, c-format msgid "No changes were made.\n" msgstr "No changes were made.\n" #: src/edit.c:83 #, c-format msgid "Changes were made.\n" msgstr "Changes were made.\n" #: src/edit.c:130 #, c-format msgid "You cannot edit a collection resource (%s).\n" msgstr "You cannot edit a collection resource (%s).\n" #: src/edit.c:147 #, c-format msgid "" "Could not create temporary file %s:\n" "%s\n" msgstr "" "Could not create temporary file %s:\n" "%s\n" #: src/edit.c:158 #, c-format msgid "" "Could not set file permissions for %s:\n" "%s\n" msgstr "" "Could not set file permissions for %s:\n" "%s\n" #: src/edit.c:185 #, c-format msgid "Downloading `%s' to %s" msgstr "Downloading ‘%s’ to %s" #: src/edit.c:191 #, c-format msgid "Error writing to temporary file: %s\n" msgstr "Error writing to temporary file: %s\n" #: src/edit.c:200 #, c-format msgid "Could not re-open temporary file: %s\n" msgstr "Could not re-open temporary file: %s\n" #: src/edit.c:204 #, c-format msgid "Uploading changes to `%s'" msgstr "Uploading changes to ‘%s’" #: src/edit.c:211 #, c-format msgid "Try uploading again (y/n)? " msgstr "Try uploading again (y/n)? " #: src/edit.c:222 #, c-format msgid "" "Could not delete temporary file %s:\n" "%s\n" msgstr "" "Could not delete temporary file %s:\n" "%s\n" #: src/ls.c:99 msgid "Ref:" msgstr "Ref:" #: src/ls.c:100 msgid "Coll:" msgstr "Coll:" #: src/ls.c:118 #, c-format msgid "Error: %-30s %d %s\n" msgstr "Error: %-30s %d %s\n" #: src/ls.c:143 msgid "Listing collection" msgstr "Listing collection" #: src/ls.c:148 msgid "collection is empty.\n" msgstr "collection is empty.\n" #: src/ls.c:208 msgid "Authorization Required" msgstr "Authorization Required" #: src/ls.c:210 msgid "Redirect" msgstr "Redirect" #: src/ls.c:212 msgid "Server Error" msgstr "Server Error" #: src/ls.c:214 msgid "Unknown Error" msgstr "Unknown Error" #: src/search.c:666 #, c-format msgid "Using query: " msgstr "Using query: " #: src/utils.c:50 msgid "Did not find a collection resource." msgstr "Did not find a collection resource." #: src/version.c:339 msgid "Versioning" msgstr "Versioning" #: src/version.c:344 msgid "Checking in" msgstr "Checking in" #: src/version.c:349 msgid "Checking out" msgstr "Checking out" #: src/version.c:354 msgid "Cancelling check out of" msgstr "Cancelling check out of" #: src/version.c:366 #, c-format msgid " %d version%s in history:\n" msgstr " %d version%s in history:\n" #: src/version.c:430 msgid "Version history of" msgstr "Version history of" #: src/version.c:456 #, c-format msgid "Invalid action `%s' given.\n" msgstr "Invalid action ‘%s’ given.\n" #: src/version.c:466 msgid "Labelling" msgstr "Labelling" cadaver-0.23.3/po/boldquot.sed0000664000076400007640000000033110355466427015603 0ustar jortonjortons/"\([^"]*\)"/“\1â€/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“â€/""/g s/“/“/g s/â€/â€/g s/‘/‘/g s/’/’/g cadaver-0.23.3/po/quot.sed0000664000076400007640000000023110355466427014741 0ustar jortonjortons/"\([^"]*\)"/“\1â€/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“â€/""/g cadaver-0.23.3/po/insert-header.sin0000664000076400007640000000124010355466427016522 0ustar jortonjorton# Sed script that inserts the file called HEADER before the header entry. # # At each occurrence of a line starting with "msgid ", we execute the following # commands. At the first occurrence, insert the file. At the following # occurrences, do nothing. The distinction between the first and the following # occurrences is achieved by looking at the hold space. /^msgid /{ x # Test if the hold space is empty. s/m/m/ ta # Yes it was empty. First occurrence. Read the file. r HEADER # Output the file's contents by reading the next line. But don't lose the # current line while doing this. g N bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } cadaver-0.23.3/po/POTFILES.in0000664000076400007640000000161411312006073015014 0ustar jortonjortonlib/basename.c lib/dirname.c lib/fnmatch.c lib/getopt1.c lib/getopt.c lib/getpass.c lib/glob.c lib/mkstemp.c lib/netrc.c lib/rpmatch.c lib/snprintf.c lib/strcasecmp.c lib/strftime.c lib/tempname.c lib/yesno.c lib/neon/ne_207.c lib/neon/ne_acl3744.c lib/neon/ne_alloc.c lib/neon/ne_auth.c lib/neon/ne_basic.c lib/neon/ne_compress.c lib/neon/ne_dates.c lib/neon/ne_gnutls.c lib/neon/ne_i18n.c lib/neon/ne_locks.c lib/neon/ne_md5.c lib/neon/ne_ntlm.c lib/neon/ne_oldacl.c lib/neon/ne_openssl.c lib/neon/ne_pkcs11.c lib/neon/ne_props.c lib/neon/ne_redirect.c lib/neon/ne_request.c lib/neon/ne_session.c lib/neon/ne_socket.c lib/neon/ne_socks.c lib/neon/ne_sspi.c lib/neon/ne_string.c lib/neon/ne_stubssl.c lib/neon/ne_uri.c lib/neon/ne_utils.c lib/neon/ne_xml.c lib/neon/ne_xmlreq.c src/cadaver.c src/cmdline.c src/commands.c src/common.c src/edit.c src/ls.c src/options.c src/search.c src/utils.c src/version.c cadaver-0.23.3/po/en@quot.header0000664000076400007640000000226310355466427016050 0ustar jortonjorton# All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # cadaver-0.23.3/po/es.gmo0000664000076400007640000003236211312007542014360 0ustar jortonjortonÞ•¨\㜠() C%Pvˆ  šL§ô5 /Cs(гÒñ$@Y$uš.±,à' '55] “´Í%ç *+Vo!‹*­Øá#õ.C_%"¥%Èî :Sj‚–¶,Èõ $#,H&uœ °½ ÒÞ)ö. Obw‹“$«Ðæý +6T]b ‚  —$¤!Éë7I}c'á, #68Z:“&Îõ  5:?#zž°ÈÞiø bmD,Æ ó ) 5CK_ u˜±¹×èú   $7FOX‘`vòiy ˆ – ¤®½ÍÒæ íû+@G Vbjz‘n—! !2-!`! r!|! Ž!J›!æ!;"5<"r"-ˆ"&¶"#Ý"##1#"6#Y#s#'#·#<Î#2 $,>$-k$<™$$Ö$ û$!%+>%&j%7‘%3É%ý%.&1K&}&†&*™&Ä&Ý&(ù&'"'+J'%v',œ'É'æ'!÷'(2(H(a(1x(ª(5½(ó( )*%)4P)1…)·)Ë)Þ) ô)*5*7S*‹*ž*´* Í*Ø*&ö*+4+O+g+ †+2“+ Æ+Ð+Õ+õ+ ,,*%,&P,w,•,­,É,Ý,ö,+‡-1³-(å-4.JC.)Ž.$¸.Ý.ï. /@/(Z/ƒ/"Ÿ/Â/Û/nø/g0{0N’05á0121C1 \1 h1v1~1’1 ¬1¸1Ñ1Ø1ï1!ø12+2<2 C2 P2 Z2g2z2‰2 ’2œ2™¥2|?3¼3 Í3Ù3 è3 õ3 ÿ3 44!484 A4O4V4\4o44 ”4 Ÿ4 ­4 ·4Ã4Ò4é4G<~I1d…3u>†ž¡=w *5Ž£ˆ CB{™l$Šh]J•Tg0V— ^ PH(ƒR"a`˜Xbz.4Ÿ8y’-€)›?¢š _F„rc!f|jA;pk‚vo§,ŒY+ 9#m¥‡&%‰67\: ¦‹ND”@LZx[2'–tnM/S}EOq‘¨QiK“WU¤sœe Authentication aborted! Progress: [ Transfer timed out, reconnecting... (reconnecting...(none)1 match.] : %s : %s Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye Authentication aborted! Authentication required for %s on proxy server `%s': Authentication required for %s on server `%s': Authorization RequiredChange isexecutable property of resourceChange local working directoryChange to specified collectionChanges were made. Close current connectionColl:Command name not known: %s Connecting to server... Connection to `%s' closed. Copy resource(s) from source to destCopying `%s' to `%s': Could not access %s (not WebDAV-enabled?): %s Could not change local directory: chdir: %s Could not create temporary file %s: %s Could not delete temporary file %s: %s Could not determine home directory from environment. Could not fetch property: %d %s Could not open file: %s Could not parse URL `%s' Could not re-open temporary file: %s Could not read rcfile %s: %s Could not set file permissions for %s: %s Could not stat file: %s Create remote collection(s)Delete non-collection resource(s)Delete remote collections and ALL contentsDeletingDeleting collectionDid not find a collection resource.Discovering locks onDisplay help messageDisplay list of owned locksDisplay local directory listingDisplay lock information for resourceDisplay name of current collectionDisplay remote resource through pagerDisplay remote resource(s)Displaying `%s': Download many remote resourcesDownload remote resourceDownloading `%s' to %sDownloading `%s' to %s:Edit given resourceEnter local filename for `%s': Enter locktoken: Environment variable $HOME needs to be set! Error executing ls: %s Error forking ls: %s Error writing to temporary file: %s Error! Could not examine temporary file: %s Error! Could not spawn pager `%s': %s Error: %-30s %d %s Exit programFailed on %s: %d %s Failed: %s Fetching properties forIgnored error: %s not WebDAV-enabled: %s List contents of current [or other] collectionListing collectionLocal directory: %s Lock given resourceLockingLooking up hostname... Move resource(s) from source to destMoving `%s' to `%s': No changes were made. No owned locks. Open connection to given URLPassword: Print local working directoryRedirectRef:Retrieve properties of resourceRetrying [Retrying:Server ErrorServer did not return result for %s Set an option, or display optionsSet property on resourceSetting isexecutableSteal lock token for resourceStealing locks onTerminated by signal %d. The `%s' command can only be used when connected to the server. Try running `open' first (see `help open' for more details). The `%s' command requires %d argument%sThe `%s' command takes at most %d argument%sThe `%s' command takes no argumentsThe server does not support the 'isexecutable' property.This command can only be used when connected to a server. Try `%s --help' for more information. Try uploading again (y/n)? Unknown ErrorUnlock given resourceUnlockingUnrecognised command. Type 'help' for a list of commands. Unsets or clears value from option.Upload local fileUpload many local filesUploading %s to `%s':Uploading changes to `%s'Use: chexec + %s to make the resource executable or chexec - %s to make the resource unexecutable Username: Value of %s is: %s When %s multiple resources, the last argument must be a collection. You cannot edit a collection resource (%s). [Matching...] reconnecting: authentication failed. cancelled. cat remote...cd pathchexec [+|-] remotecollection is empty. connected. connection timed out. copycopy source... destcopyingcould not connect to server. delete remote...discover resourcedone)edit resourceexclusivefailed: %s get remote [local]help [command]infiniteinfinityinvalidis a collection resource. The `rm' command cannot be used to delete a collection. Use `rmcol %s' to delete this collection and ALL its contents. is not a collection. The `rmcol' command can only be used to delete collections. Use `rm %s' to delete this resource. lcd [directory]less remote...lls [options]lock resourcels [path]mget remote...mkcol remote...movemove source... destmovingmput local...okay [okay.put local [remote]rmcol remote...set [option] [value]sharedsteal resourcesucceeded. unknownunlock resourceunset [option] [value]writeProject-Id-Version: cadaver 0.22.0 Report-Msgid-Bugs-To: cadaver@webdav.org POT-Creation-Date: 2009-12-15 22:22+0000 PO-Revision-Date: 2003-09-17 23:40+0200 Last-Translator: Ramón Rey Vicente Language-Team: Spanish Translation Team MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bits ¡Autenticación abortada! Progreso: [Tiempo de transferencia expirado, reconectando... (reconectando...(ninguno)1 coincidencia.] : %s : %s Alias: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye ¡Autenticación abortada! Autenticación requerida para %s en el servidor proxy '%s': Autenticación requerida para %s en el servidor '%s': Requiere autorizaciónCambiar la propiedad de ejecución del recursoCambiar al directorio de trabajo localCambiar a la colección especificadaSe realizarion cambios. Cerrar conexión actualCol:Nombre de comando desconocido: %s Conectando al servidor...Conexión con '%s' cerrada. Copiar recurso(s) del origen al destinoCopiando '%s' a '%s': No se puede acceder a %s (¿dispone de WebDAV activado?): %s No se pudo cambiar al directorio local: chdir: %s No se pudo crear el archivo temporal %s: %s No se pudo borrar el archivo temporal %s: %s No se pudo determinar el directorio de usuario del entorno. No se pudo obtener propiedad: %d %s No se pudo abrir el archivo: %s No se puede procesar la URL '%s' No se pudo reabrir el archivo temporal: %s No se puede leer el archivo rc %s: %s No se pudo asignar los permisos de archivo para %s: %s No se pudo obtener las propiedades del archivo: %s Crear collección(es) remota(s)Borrar recurso(s) que no estén en la colecciónBorrar colecciones remotas y TODOS sus contenidosBorrandoBorrando colecciónNo se encontró un recurso de la colección.Descubriendo bloqueos enMostrar el mensaje de ayudaMostrar la lista de los bloqueos propiosMostrar el listado del directorio localMuestra información del bloqueo del recursoMostrar nombre de la colección actualMostrar el recurso remoto mediante paginadorMostrar recurso(s) remoto(s)Mostrando '%s': Descargar muchos recursos remotosDescargar recurso remotoDescargando '%s' a %sDescargando '%s' a '%s':Editar el recurso dadoIntroduzca el nombre de archivo local para '%s': Introducir bloqueo¡La variable de entorno $HOME necesita ser definida! Error ejecutando ls: %s Error dividiendo ls: %s Error escribiendo al archivo temporal: %s ¡Error! No se pudo examinar el archivo temporal: %s ¡Error! No se pudo generar el paginador '%s': %s Error: %-30s %d %s Salir del programaFallado en %s: %d %s Fallado: %s Obteniendo propiedades paraError ignorado: %s no dispone de WebDAV activado: %s Lista los contenidos de la colección actual [o de otra]Listando colecciónDirectorio local: %s Bloquear el recurso dadoBloqueandoBuscando nombre de máquina...Mueve recurso(s) del origen al destinoMoviendo '%s' a '%s': No se realizaron cambios. No se poseen bloqueos. Abrir conexión con la URL dadaContraseña: Mostrar en pantalla el directorio de trabajo localRedirigirRef:Obtener propiedades del recursoReintentando [Reintentando:Error del servidorEl servidor no devolvió resultado para %s Activar una opción, o mostrar opcionesActivar propiedad del recursoConfigurando ejecutableRoba el bloqueo del recursoRobando bloqueos enTerminado por señal %d. El comando '%s' sólo puede ser usado cuando se está conectado al servidor. Pruebe a ejecutar 'open' primerp (ver 'help open para más detalles). El comando '%s' requiere %d el argumento %sEl comando '%s' acepta como mucho %d argumentos%sEl comando '%s' no toma ningún argumentoEl servidor no soporta la propiedad de 'ejecutable'.Este comando sólo puede ser usado cuando se está conectado a un servidor. Probar '%s --help' para más información. ¿Intentar transferir de nuevo (y/n)?Error desconocidoDesbloquear el recurso dadoDesbloqueandoComando desconocido, Teclear 'help' para una lista de comandos. Inactiva o borra el valor de una opción.Transfiere un archivo localTransferir muchos archivos localesTransferiendo %s a '%s':Transfiriendo cambios a '%s'Uso: chexec + %s para hacer ejecutable el recurso o chexec - %s para hacer no-ejecutable el recurso Nombre de usuario: El valor de %s es: %s Cuando hay %s múltiples recursos, el ultimo argumento debe ser una colección. No se puede editar un recurso de una colección (%s). Buscando coincidencias... ] reconectando: fallo de autenticación. cancelado. cat remoto...cd rutachexec [+|-] remotola colección está vacía. conectado. la conexión a expirado. copiarcopy origen... destinocopiandono se pudo conectar al servidor. delete remoto...discover recursohecho)edit recursoexclusivofallado: %s get remoto [local]help [comando]infinitoinfinidadinválidoes un recurso colección. El comando 'rm' no puede ser usado para borrar una colección. Use 'rmcol %s' para borrar esta colección y TODOS sus contenidos. no es una colección. El comando 'rmcol' sólo puede ser usado para borrar colecciones. Use 'rm %s' para borrar este recurso. lcd [directorio]less remotolls [opciones]lock recursols [ruta]mget remotomkcol remoto...movermove origen... destinomoviendomput local...bien [bien.put local [remoto]rmcol remoto...set [opción] [valor]compartidosteal recursoexitoso. desconicidounlock recursounset [opción] [valor]escribircadaver-0.23.3/po/Makevars0000664000076400007640000000211410355475302014742 0ustar jortonjorton# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = cadaver # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Joe Orton MSGID_BUGS_ADDRESS = cadaver@webdav.org # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = cadaver-0.23.3/po/es.po0000664000076400007640000012224311312006131014203 0ustar jortonjorton# Cadenas en español para cadaver. # Copyright (C) 2003 Free Software Foundation, Inc. # Ramón Rey Vicente , 2003. # msgid "" msgstr "" "Project-Id-Version: cadaver 0.22.0\n" "Report-Msgid-Bugs-To: cadaver@webdav.org\n" "POT-Creation-Date: 2009-12-15 22:22+0000\n" "PO-Revision-Date: 2003-09-17 23:40+0200\n" "Last-Translator: Ramón Rey Vicente \n" "Language-Team: Spanish Translation Team \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bits\n" #: lib/getopt.c:680 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: lib/getopt.c:704 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:709 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:726 lib/getopt.c:899 #, fuzzy, c-format msgid "%s: option `%s' requires an argument\n" msgstr "El comando '%s' requiere %d el argumento %s" #: lib/getopt.c:755 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #: lib/getopt.c:759 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #: lib/getopt.c:785 #, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: lib/getopt.c:788 #, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: lib/getopt.c:818 lib/getopt.c:948 #, fuzzy, c-format msgid "%s: option requires an argument -- %c\n" msgstr "El comando '%s' requiere %d el argumento %s" #: lib/getopt.c:865 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "" #: lib/getopt.c:883 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "" #: lib/getpass.c:73 msgid "ERROR: no support for getpassword() routine\n" msgstr "" #: lib/getpass.c:201 #, c-format msgid "" "\n" "Caught SIGINT... bailing out.\n" msgstr "" #: lib/rpmatch.c:75 msgid "^[yY]" msgstr "" #: lib/rpmatch.c:78 msgid "^[nN]" msgstr "" #: lib/neon/ne_207.c:198 #, c-format msgid "" "Invalid HTTP status line in status element at line %d of response:\n" "Status line was: %s" msgstr "" #: lib/neon/ne_auth.c:134 #, fuzzy, c-format msgid "Could not authenticate to server: %s" msgstr "" "No se puede contactar con el servidor:\n" "%s\n" #: lib/neon/ne_auth.c:139 #, fuzzy, c-format msgid "Could not authenticate to proxy server: %s" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_auth.c:374 #, c-format msgid "rejected %s challenge" msgstr "" #: lib/neon/ne_auth.c:390 msgid "missing realm in Basic challenge" msgstr "" #: lib/neon/ne_auth.c:485 msgid "invalid Negotiate token" msgstr "" #: lib/neon/ne_auth.c:508 #, fuzzy msgid "GSSAPI authentication error: " msgstr "¡Autenticación abortada!\n" #: lib/neon/ne_auth.c:521 #, c-format msgid "GSSAPI failure (code %u)" msgstr "" #: lib/neon/ne_auth.c:556 msgid "ignoring empty Negotiate continuation" msgstr "" #: lib/neon/ne_auth.c:571 msgid "Negotiate response verification failed: invalid response header token" msgstr "" #: lib/neon/ne_auth.c:593 #, c-format msgid "Negotiate response verification failure: %s" msgstr "" #: lib/neon/ne_auth.c:762 msgid "unknown algorithm in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:766 msgid "incompatible algorithm in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:770 msgid "missing parameter in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:774 msgid "initial Digest challenge was stale" msgstr "" #: lib/neon/ne_auth.c:781 msgid "stale Digest challenge with new algorithm or realm" msgstr "" #: lib/neon/ne_auth.c:793 msgid "could not parse domain in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:1102 msgid "Digest mutual authentication failure: missing parameters" msgstr "" #: lib/neon/ne_auth.c:1107 msgid "Digest mutual authentication failure: client nonce mismatch" msgstr "" #: lib/neon/ne_auth.c:1117 msgid "Digest mutual authentication failure: could not parse nonce count" msgstr "" #: lib/neon/ne_auth.c:1122 #, c-format msgid "Digest mutual authentication failure: nonce count mismatch (%u not %u)" msgstr "" #: lib/neon/ne_auth.c:1165 msgid "Digest mutual authentication failure: request-digest mismatch" msgstr "" #: lib/neon/ne_auth.c:1296 #, c-format msgid "ignored %s challenge" msgstr "" #: lib/neon/ne_auth.c:1375 #, fuzzy msgid "could not parse challenge" msgstr "No se puede procesar la URL '%s'\n" #: lib/neon/ne_basic.c:98 #, fuzzy, c-format msgid "Could not determine file size: %s" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_basic.c:149 msgid "Response did not include requested range" msgstr "" #: lib/neon/ne_basic.c:183 msgid "Range is not satisfiable" msgstr "" #: lib/neon/ne_basic.c:188 msgid "Resource does not support ranged GET requests" msgstr "" #: lib/neon/ne_compress.c:184 #, c-format msgid "%s: %s (code %d)" msgstr "" #: lib/neon/ne_compress.c:232 #, fuzzy msgid "Could not inflate data" msgstr "No se pudo abrir el archivo: %s\n" #: lib/neon/ne_compress.c:293 #, fuzzy msgid "Could not initialize zlib" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: lib/neon/ne_gnutls.c:172 #, c-format msgid "[unprintable:#%lu]" msgstr "" #: lib/neon/ne_gnutls.c:201 msgid "[unprintable]" msgstr "" #: lib/neon/ne_gnutls.c:817 msgid "signed using insecure algorithm" msgstr "" #: lib/neon/ne_gnutls.c:820 #, c-format msgid "unrecognized errors (%u)" msgstr "" #: lib/neon/ne_gnutls.c:865 lib/neon/ne_openssl.c:467 msgid "Server certificate was missing commonName attribute in subject name" msgstr "" #: lib/neon/ne_gnutls.c:879 #, fuzzy, c-format msgid "Could not verify server certificate: %s" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: lib/neon/ne_gnutls.c:891 lib/neon/ne_openssl.c:454 #, c-format msgid "Certificate verification error: %s" msgstr "" #: lib/neon/ne_gnutls.c:924 lib/neon/ne_openssl.c:673 #, c-format msgid "SSL handshake failed, client certificate was requested: %s" msgstr "" #: lib/neon/ne_gnutls.c:929 lib/neon/ne_openssl.c:678 #, fuzzy, c-format msgid "SSL handshake failed: %s" msgstr "fallo de autenticación.\n" #: lib/neon/ne_gnutls.c:939 #, fuzzy msgid "Server did not send certificate chain" msgstr "El servidor no devolvió resultado para %s\n" #: lib/neon/ne_locks.c:584 msgid "LOCK response missing Lock-Token header" msgstr "" #: lib/neon/ne_locks.c:759 #, c-format msgid "Response missing activelock for %s" msgstr "" #: lib/neon/ne_locks.c:801 #, c-format msgid "No activelock for <%s> returned in LOCK refresh response" msgstr "" #: lib/neon/ne_openssl.c:698 msgid "SSL server did not present certificate" msgstr "" #: lib/neon/ne_openssl.c:707 msgid "Server certificate changed: connection intercepted?" msgstr "" #: lib/neon/ne_props.c:371 lib/neon/ne_props.c:435 msgid "Response exceeds maximum property count" msgstr "" #: lib/neon/ne_redirect.c:92 #, fuzzy msgid "Could not parse redirect destination URL" msgstr "No se puede procesar la URL '%s'\n" #: lib/neon/ne_request.c:194 #, fuzzy, c-format msgid "%s: connection was closed by proxy server" msgstr "Conexión con '%s' cerrada.\n" #: lib/neon/ne_request.c:197 #, fuzzy, c-format msgid "%s: connection was closed by server" msgstr "Conexión con '%s' cerrada.\n" #: lib/neon/ne_request.c:202 #, fuzzy, c-format msgid "%s: connection timed out" msgstr "la conexión a expirado.\n" #: lib/neon/ne_request.c:311 #, fuzzy msgid "offset invalid" msgstr "inválido" #: lib/neon/ne_request.c:316 #, fuzzy, c-format msgid "Could not seek to offset %s of request body file: %s" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: lib/neon/ne_request.c:364 #, fuzzy msgid "Could not send request body" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_request.c:707 #, fuzzy msgid "Could not read chunk size" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_request.c:714 #, fuzzy msgid "Could not parse chunk size" msgstr "No se puede procesar la URL '%s'\n" #: lib/neon/ne_request.c:751 #, fuzzy msgid "Could not read response body" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_request.c:767 #, fuzzy msgid "Could not read chunk delimiter" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_request.c:770 msgid "Chunk delimiter was invalid" msgstr "" #: lib/neon/ne_request.c:875 #, fuzzy msgid "Could not read status line" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: lib/neon/ne_request.c:897 #, fuzzy msgid "Could not parse response status line" msgstr "No se puede procesar la URL '%s'\n" #: lib/neon/ne_request.c:909 #, fuzzy msgid "Could not read interim response headers" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_request.c:943 #, fuzzy msgid "Could not send request" msgstr "No se pudo abrir el archivo: %s\n" #: lib/neon/ne_request.c:991 lib/neon/ne_request.c:1009 #: lib/neon/ne_request.c:1019 msgid "Error reading response headers" msgstr "" #: lib/neon/ne_request.c:1037 msgid "Response header too long" msgstr "" #: lib/neon/ne_request.c:1119 msgid "Response exceeded maximum number of header fields" msgstr "" #: lib/neon/ne_request.c:1134 #, fuzzy, c-format msgid "Could not resolve hostname `%s': %s" msgstr "No se puede resolver el nombre del servidor '%s'.\n" #: lib/neon/ne_request.c:1265 msgid "Unknown transfer-coding in response" msgstr "" #: lib/neon/ne_request.c:1278 msgid "Invalid Content-Length in response" msgstr "" #: lib/neon/ne_request.c:1351 src/commands.c:980 #, fuzzy, c-format msgid "Could not write to file: %s" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: lib/neon/ne_request.c:1424 #, fuzzy, c-format msgid "Could not create SSL connection through proxy server: %s" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_request.c:1463 #, fuzzy msgid "Could not create socket" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: lib/neon/ne_request.c:1496 #, fuzzy msgid "Could not connect to server" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_request.c:1498 #, fuzzy msgid "Could not connect to proxy server" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_request.c:1541 #, c-format msgid "Could not find IPv4 address of hostname %s for SOCKS v4 proxy" msgstr "" #: lib/neon/ne_request.c:1599 #, fuzzy, c-format msgid "Could not establish connection from SOCKS proxy (%s:%u): %s" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_session.c:528 lib/neon/ne_session.c:539 #, fuzzy msgid "[invalid date]" msgstr "inválido" #: lib/neon/ne_session.c:552 msgid "certificate is not yet valid" msgstr "" #: lib/neon/ne_session.c:553 msgid "certificate has expired" msgstr "" #: lib/neon/ne_session.c:554 msgid "certificate issued for a different hostname" msgstr "" #: lib/neon/ne_session.c:555 msgid "issuer is not trusted" msgstr "" #: lib/neon/ne_session.c:556 #, fuzzy msgid "bad certificate chain" msgstr "El servidor no devolvió resultado para %s\n" #: lib/neon/ne_session.c:557 msgid "certificate has been revoked" msgstr "" #: lib/neon/ne_session.c:562 msgid "Server certificate verification failed: " msgstr "" #: lib/neon/ne_socket.c:516 lib/neon/ne_socket.c:612 lib/neon/ne_socket.c:716 #, fuzzy msgid "Connection closed" msgstr "Conexión con '%s' cerrada.\n" #: lib/neon/ne_socket.c:622 lib/neon/ne_socket.c:728 #, fuzzy msgid "Secure connection truncated" msgstr "Cerrar conexión actual" #: lib/neon/ne_socket.c:634 lib/neon/ne_socket.c:740 #, c-format msgid "SSL error: %s" msgstr "" #: lib/neon/ne_socket.c:637 #, c-format msgid "SSL error code %d/%d/%lu" msgstr "" #: lib/neon/ne_socket.c:721 #, c-format msgid "SSL alert received: %s" msgstr "" #: lib/neon/ne_socket.c:736 msgid "SSL socket read failed" msgstr "" #: lib/neon/ne_socket.c:867 msgid "Line too long" msgstr "" #: lib/neon/ne_socket.c:1012 lib/neon/ne_socket.c:1018 msgid "Host not found" msgstr "" #: lib/neon/ne_socket.c:1221 #, fuzzy msgid "Connection timed out" msgstr "la conexión a expirado.\n" #: lib/neon/ne_socket.c:1412 msgid "Socket descriptor number exceeds FD_SETSIZE" msgstr "" #: lib/neon/ne_socket.c:1474 msgid "Socket family not supported" msgstr "" #: lib/neon/ne_socket.c:1701 msgid "Client certificate verification failed" msgstr "" #: lib/neon/ne_socket.c:1717 msgid "SSL disabled due to lack of entropy" msgstr "" #: lib/neon/ne_socket.c:1724 msgid "SSL disabled due to library version mismatch" msgstr "" #: lib/neon/ne_socket.c:1730 #, fuzzy msgid "Could not create SSL structure" msgstr "" "No se pudo crear el archivo temporal %s:\n" "%s\n" #: lib/neon/ne_socks.c:65 msgid "failure" msgstr "" #: lib/neon/ne_socks.c:68 #, fuzzy msgid "connection not permitted" msgstr "la conexión a expirado.\n" #: lib/neon/ne_socks.c:71 msgid "network unreachable" msgstr "" #: lib/neon/ne_socks.c:74 msgid "host unreachable" msgstr "" #: lib/neon/ne_socks.c:77 msgid "TTL expired" msgstr "" #: lib/neon/ne_socks.c:80 msgid "command not supported" msgstr "" #: lib/neon/ne_socks.c:83 msgid "address type not supported" msgstr "" #: lib/neon/ne_socks.c:86 #, c-format msgid "%s: unrecognized error (%u)" msgstr "" #: lib/neon/ne_socks.c:128 lib/neon/ne_socks.c:328 #, fuzzy msgid "Could not send message to proxy" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_socks.c:133 #, fuzzy msgid "Could not read initial response from proxy" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_socks.c:136 msgid "Invalid version in proxy response" msgstr "" #: lib/neon/ne_socks.c:157 #, fuzzy msgid "Could not send login message" msgstr "No se pudo abrir el archivo: %s\n" #: lib/neon/ne_socks.c:162 #, fuzzy msgid "Could not read login reply" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: lib/neon/ne_socks.c:165 msgid "Invalid version in login reply" msgstr "" #: lib/neon/ne_socks.c:168 #, fuzzy msgid "Authentication failed" msgstr "fallo de autenticación.\n" #: lib/neon/ne_socks.c:172 msgid "No acceptable authentication method" msgstr "" #: lib/neon/ne_socks.c:174 msgid "Unexpected authentication method chosen" msgstr "" #: lib/neon/ne_socks.c:210 #, fuzzy msgid "Could not send connect request" msgstr "No se pudo abrir el archivo: %s\n" #: lib/neon/ne_socks.c:215 #, fuzzy msgid "Could not read connect reply" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_socks.c:218 msgid "Invalid version in connect reply" msgstr "" #: lib/neon/ne_socks.c:221 lib/neon/ne_socks.c:337 #, fuzzy msgid "Could not connect" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_socks.c:235 msgid "Could not read FQDN length in connect reply" msgstr "" #: lib/neon/ne_socks.c:240 msgid "Unknown address type in connect reply" msgstr "" #: lib/neon/ne_socks.c:245 #, fuzzy msgid "Could not read address in connect reply" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_socks.c:266 msgid "request rejected or failed" msgstr "" #: lib/neon/ne_socks.c:269 #, fuzzy msgid "could not establish connection to identd" msgstr "no se pudo conectar al servidor.\n" #: lib/neon/ne_socks.c:272 msgid "rejected due to identd user mismatch" msgstr "" #: lib/neon/ne_socks.c:275 #, c-format msgid "%s: unrecognized failure (%u)" msgstr "" #: lib/neon/ne_socks.c:333 #, fuzzy msgid "Could not read response from proxy" msgstr "No se puede leer el archivo rc %s: %s\n" #: lib/neon/ne_xml.c:280 #, c-format msgid "XML parse error at line %d: invalid element name" msgstr "" #: lib/neon/ne_xml.c:474 #, fuzzy msgid "Unknown error" msgstr "Error desconocido" #: lib/neon/ne_xml.c:579 msgid "Invalid Byte Order Mark" msgstr "" #: lib/neon/ne_xml.c:667 #, c-format msgid "XML parse error at line %d: %s" msgstr "" #: lib/neon/ne_xmlreq.c:36 #, fuzzy, c-format msgid "Could not parse response: %s" msgstr "No se puede procesar la URL '%s'\n" #: src/cadaver.c:128 #, fuzzy, c-format msgid "" "Usage: %s [OPTIONS] http://hostname[:port]/path\n" " Port defaults to 80, path defaults to '/'\n" "Options:\n" " -t, --tolerant Allow cd/open into non-WebDAV enabled " "collection.\n" " -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc.\n" " -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port " "PORT.\n" " -V, --version Display version information.\n" " -h, --help Display this help message.\n" "Please send bug reports and feature requests to \n" msgstr "" "Uso: %s [OPCIONES] http://nombre_de_máquina[:puerto]/ruta\n" " El puerto por defecto es 80, la ruta por defecto es '/'\n" "Opciones:\n" " -e, --expect100 Activar el envío de la cabecera `Expect: 100-continue'.\n" " *** Aviso: para servidores Apeache, usar sólo con versión 1.3.9 y \n" "posteriores\n" " -t, --tolerant Permitir cd/open dentro de una colección no-WebDAV.\n" " -V, --version Mostrar información de versión.\n" " -h, --help Mostrar este mensaje de ayuda,\n" "Por favor, envie informes de errores y peticiones de características a " "\n" #: src/cadaver.c:155 #, c-format msgid "Connection to `%s' closed.\n" msgstr "Conexión con '%s' cerrada.\n" #: src/cadaver.c:171 #, c-format msgid "" "Ignored error: %s not WebDAV-enabled:\n" "%s\n" msgstr "" "Error ignorado: %s no dispone de WebDAV activado:\n" "%s\n" #: src/cadaver.c:178 #, c-format msgid "" "Could not access %s (not WebDAV-enabled?):\n" "%s\n" msgstr "" "No se puede acceder a %s (¿dispone de WebDAV activado?):\n" "%s\n" #: src/cadaver.c:192 #, c-format msgid "WARNING: Untrusted server certificate presented for `%s':\n" msgstr "" #: src/cadaver.c:195 msgid "WARNING: Untrusted server certificate presented:\n" msgstr "" #: src/cadaver.c:198 #, c-format msgid "Certificate was issued to hostname `%s' rather than `%s'\n" msgstr "" #: src/cadaver.c:200 #, c-format msgid "This connection could have been intercepted.\n" msgstr "" #: src/cadaver.c:206 #, c-format msgid "Issued to: %s\n" msgstr "" #: src/cadaver.c:207 #, c-format msgid "Issued by: %s\n" msgstr "" #: src/cadaver.c:210 #, c-format msgid "Certificate is valid from %s to %s\n" msgstr "" #: src/cadaver.c:213 #, c-format msgid "Do you wish to accept the certificate? (y/n) " msgstr "" #: src/cadaver.c:216 #, c-format msgid "Certificate rejected.\n" msgstr "" #: src/cadaver.c:247 msgid "Decryption password: " msgstr "" #: src/cadaver.c:318 #, c-format msgid "Could not parse URL `%s'\n" msgstr "No se puede procesar la URL '%s'\n" #: src/cadaver.c:330 #, c-format msgid "SSL is not enabled.\n" msgstr "" #: src/cadaver.c:405 src/cadaver.c:408 #, fuzzy, c-format msgid "" "Could not connect to `%s' on port %d:\n" "%s\n" msgstr "No se puede conectar a la máquina remota.\n" #: src/cadaver.c:416 #, fuzzy, c-format msgid "" "Could not open collection:\n" "%s\n" msgstr "No se pudo abrir el archivo: %s\n" #: src/cadaver.c:456 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "Probar '%s --help' para más información.\n" #: src/cadaver.c:505 #, c-format msgid "Unrecognised command. Type 'help' for a list of commands.\n" msgstr "Comando desconocido, Teclear 'help' para una lista de comandos.\n" #: src/cadaver.c:507 #, c-format msgid "The `%s' command requires %d argument%s" msgstr "El comando '%s' requiere %d el argumento %s" #: src/cadaver.c:510 src/cadaver.c:522 #, c-format msgid "" ":\n" " %s : %s\n" msgstr "" ":\n" " %s : %s\n" #: src/cadaver.c:516 #, c-format msgid "The `%s' command takes at most %d argument%s" msgstr "El comando '%s' acepta como mucho %d argumentos%s" #: src/cadaver.c:519 #, c-format msgid "The `%s' command takes no arguments" msgstr "El comando '%s' no toma ningún argumento" #: src/cadaver.c:527 #, c-format msgid "" "The `%s' command can only be used when connected to the server.\n" "Try running `open' first (see `help open' for more details).\n" msgstr "" "El comando '%s' sólo puede ser usado cuando se está conectado al servidor.\n" "Pruebe a ejecutar 'open' primerp (ver 'help open para más detalles).\n" #: src/cadaver.c:572 #, c-format msgid "Terminated by signal %d.\n" msgstr "Terminado por señal %d.\n" #: src/cadaver.c:615 #, c-format msgid "Could not read rcfile %s: %s\n" msgstr "No se puede leer el archivo rc %s: %s\n" #: src/cadaver.c:870 #, c-format msgid "Environment variable $HOME needs to be set!\n" msgstr "¡La variable de entorno $HOME necesita ser definida!\n" #: src/cadaver.c:932 #, c-format msgid "Looking up hostname... " msgstr "Buscando nombre de máquina..." #: src/cadaver.c:935 #, c-format msgid "Connecting to server... " msgstr "Conectando al servidor..." #: src/cadaver.c:938 #, c-format msgid "connected.\n" msgstr "conectado.\n" #: src/cadaver.c:950 #, c-format msgid " (reconnecting..." msgstr " (reconectando..." #: src/cadaver.c:954 #, c-format msgid "done)" msgstr "hecho)" #: src/cadaver.c:980 #, c-format msgid "] reconnecting: " msgstr "] reconectando: " #: src/cadaver.c:983 #, c-format msgid "okay [" msgstr "bien [" #: src/cadaver.c:1000 #, c-format msgid "\rTransfer timed out, reconnecting... " msgstr "Tiempo de transferencia expirado, reconectando... " #: src/cadaver.c:1003 #, c-format msgid "okay." msgstr "bien." #: src/cadaver.c:1062 #, c-format msgid "\rProgress: [" msgstr " Progreso: [" #: src/cadaver.c:1067 #, fuzzy msgid "] %5.1f%% of %" msgstr "] %5.1f%% de %ld bytes" #: src/cadaver.c:1094 msgid "Username: " msgstr "Nombre de usuario: " #: src/cadaver.c:1096 #, c-format msgid "\rAuthentication aborted!\n" msgstr "¡Autenticación abortada!\n" #: src/cadaver.c:1099 #, c-format msgid "\rUsername too long (>%d)\n" msgstr "" #: src/cadaver.c:1107 msgid "Password: " msgstr "Contraseña: " #: src/cadaver.c:1109 #, c-format msgid "Authentication aborted!\n" msgstr "¡Autenticación abortada!\n" #: src/cadaver.c:1112 #, c-format msgid "\rPassword too long (>%d)\n" msgstr "" #: src/cadaver.c:1123 #, c-format msgid "Retrying:" msgstr "Reintentando:" #: src/cadaver.c:1127 #, c-format msgid "Retrying [" msgstr "Reintentando [" #: src/cadaver.c:1150 #, c-format msgid "Authentication required for %s on server `%s':\n" msgstr "Autenticación requerida para %s en el servidor '%s':\n" #: src/cadaver.c:1161 #, c-format msgid "Authentication required for %s on proxy server `%s':\n" msgstr "Autenticación requerida para %s en el servidor proxy '%s':\n" #: src/cmdline.c:286 msgid "[Matching..." msgstr "Buscando coincidencias... " #: src/cmdline.c:313 #, fuzzy, c-format msgid "%ld matches.]\n" msgstr "%d coincidencias.]\n" #: src/cmdline.c:315 msgid "1 match.]\n" msgstr "1 coincidencia.]\n" #: src/commands.c:122 msgid "succeeded.\n" msgstr "exitoso.\n" #: src/commands.c:133 msgid "authentication failed.\n" msgstr "fallo de autenticación.\n" #: src/commands.c:136 msgid "could not connect to server.\n" msgstr "no se pudo conectar al servidor.\n" #: src/commands.c:139 msgid "connection timed out.\n" msgstr "la conexión a expirado.\n" #: src/commands.c:146 #, fuzzy, c-format msgid "redirect to %s\n" msgstr "Directorio local: %s\n" #: src/commands.c:151 src/commands.c:974 #, c-format msgid "" "failed:\n" "%s\n" msgstr "" "fallado:\n" "%s\n" #: src/commands.c:328 msgid "exclusive" msgstr "exclusivo" #: src/commands.c:329 msgid "shared" msgstr "compartido" #: src/commands.c:330 src/commands.c:339 src/ls.c:119 msgid "unknown" msgstr "desconicido" #: src/commands.c:337 msgid "write" msgstr "escribir" #: src/commands.c:347 msgid "infinite" msgstr "infinito" #: src/commands.c:348 src/commands.c:366 msgid "invalid" msgstr "inválido" #: src/commands.c:350 #, c-format msgid "%ld seconds" msgstr "" #: src/commands.c:359 msgid "infinity" msgstr "infinidad" #: src/commands.c:380 #, fuzzy, c-format msgid "" "Lock token <%s>:\n" " Depth %s on `%s'\n" " Scope: %s Type: %s Timeout: %s\n" " Owner: %s\n" msgstr "" "Bloquear <%s> en %s:\n" " Alcance: %s Tipo: %s Timeout: %s\n" " Propietario: %s Depth: %s\n" #: src/commands.c:387 msgid "(none)" msgstr "(ninguno)" #: src/commands.c:403 src/commands.c:422 #, c-format msgid "Failed on %s: %d %s\n" msgstr "Fallado en %s: %d %s\n" #: src/commands.c:450 msgid "Discovering locks on" msgstr "Descubriendo bloqueos en" #: src/commands.c:455 msgid "Stealing locks on" msgstr "Robando bloqueos en" #: src/commands.c:469 #, c-format msgid "No owned locks.\n" msgstr "No se poseen bloqueos.\n" #: src/commands.c:487 #, fuzzy msgid "Locking collection" msgstr "Listando colección" #: src/commands.c:489 msgid "Locking" msgstr "Bloqueando" #: src/commands.c:521 msgid "Unlocking" msgstr "Desbloqueando" #: src/commands.c:525 msgid "Enter locktoken: " msgstr "Introducir bloqueo" #: src/commands.c:546 #, fuzzy msgid "Creating" msgstr "Borrando" #: src/commands.c:560 #, fuzzy, c-format msgid "%s %s failed: %s\n" msgstr "" "fallado:\n" "%s\n" #: src/commands.c:587 #, c-format msgid "Value of %s is: %s\n" msgstr "El valor de %s es: %s\n" #: src/commands.c:593 #, c-format msgid "Could not fetch property: %d %s\n" msgstr "No se pudo obtener propiedad: %d %s\n" #: src/commands.c:596 #, c-format msgid "Server did not return result for %s\n" msgstr "El servidor no devolvió resultado para %s\n" #: src/commands.c:637 #, fuzzy msgid "Setting property on" msgstr "Activando propiedad en" #: src/commands.c:642 #, fuzzy msgid "Deleting property on" msgstr "Activando propiedad en" #: src/commands.c:660 msgid "Fetching properties for" msgstr "Obteniendo propiedades para" #: src/commands.c:691 #, fuzzy msgid "Fetching property names" msgstr "Obteniendo propiedades para" #: src/commands.c:720 msgid "Deleting" msgstr "Borrando" #: src/commands.c:723 #, c-format msgid "" "is a collection resource.\n" "The `rm' command cannot be used to delete a collection.\n" "Use `rmcol %s' to delete this collection and ALL its contents.\n" msgstr "" "es un recurso colección.\n" "El comando 'rm' no puede ser usado para borrar una colección.\n" "Use 'rmcol %s' para borrar esta colección y TODOS sus contenidos.\n" #: src/commands.c:739 msgid "Deleting collection" msgstr "Borrando colección" #: src/commands.c:742 #, c-format msgid "" "is not a collection.\n" "The `rmcol' command can only be used to delete collections.\n" "Use `rm %s' to delete this resource.\n" msgstr "" "no es una colección.\n" "El comando 'rmcol' sólo puede ser usado para borrar colecciones.\n" "Use 'rm %s' para borrar este recurso.\n" #: src/commands.c:826 src/commands.c:843 #, c-format msgid "Displaying `%s':\n" msgstr "Mostrando '%s':\n" #: src/commands.c:829 #, c-format msgid "" "Error! Could not spawn pager `%s':\n" "%s\n" msgstr "" "¡Error! No se pudo generar el paginador '%s':\n" "%s\n" #: src/commands.c:845 #, c-format msgid "Failed: %s\n" msgstr "Fallado: %s\n" #: src/commands.c:864 #, c-format msgid "%s: %s and %s are the same resource.\n" msgstr "" #: src/commands.c:873 #, c-format msgid "When %s multiple resources, the last argument must be a collection.\n" msgstr "" "Cuando hay %s múltiples recursos, el ultimo argumento debe ser una " "colección.\n" #: src/commands.c:889 #, c-format msgid "Moving `%s' to `%s': " msgstr "Moviendo '%s' a '%s': " #: src/commands.c:895 #, c-format msgid "Copying `%s' to `%s': " msgstr "Copiando '%s' a '%s': " #: src/commands.c:955 #, c-format msgid "Enter local filename for `%s': " msgstr "Introduzca el nombre de archivo local para '%s': " #: src/commands.c:960 #, c-format msgid "cancelled.\n" msgstr "cancelado.\n" #: src/commands.c:972 #, c-format msgid "Downloading `%s' to %s:" msgstr "Descargando '%s' a '%s':" #: src/commands.c:993 #, c-format msgid "Uploading %s to `%s':" msgstr "Transferiendo %s a '%s':" #: src/commands.c:995 #, c-format msgid "Could not open file: %s\n" msgstr "No se pudo abrir el archivo: %s\n" #: src/commands.c:1027 msgid "copying" msgstr "copiando" #: src/commands.c:1027 msgid "copy" msgstr "copiar" #: src/commands.c:1032 msgid "moving" msgstr "moviendo" #: src/commands.c:1032 msgid "move" msgstr "mover" #: src/commands.c:1093 #, c-format msgid "" "Use:\n" " chexec + %s to make the resource executable\n" "or chexec - %s to make the resource unexecutable\n" msgstr "" "Uso:\n" " chexec + %s para hacer ejecutable el recurso\n" "o chexec - %s para hacer no-ejecutable el recurso\n" #: src/commands.c:1102 msgid "Setting isexecutable" msgstr "Configurando ejecutable" #: src/commands.c:1108 msgid "The server does not support the 'isexecutable' property." msgstr "El servidor no soporta la propiedad de 'ejecutable'." #: src/commands.c:1123 #, c-format msgid "Local directory: %s\n" msgstr "Directorio local: %s\n" #: src/commands.c:1139 #, c-format msgid "Error executing ls: %s\n" msgstr "Error ejecutando ls: %s\n" #: src/commands.c:1143 #, c-format msgid "Error forking ls: %s\n" msgstr "Error dividiendo ls: %s\n" #: src/commands.c:1160 #, c-format msgid "Could not determine home directory from environment.\n" msgstr "No se pudo determinar el directorio de usuario del entorno.\n" #: src/commands.c:1165 #, c-format msgid "" "Could not change local directory:\n" "chdir: %s\n" msgstr "" "No se pudo cambiar al directorio local:\n" "chdir: %s\n" #: src/commands.c:1173 #, fuzzy, c-format msgid "Current collection is `%s'.\n" msgstr "La colección actual es '%s', en el servidor '%s'\n" #: src/commands.c:1183 #, fuzzy, c-format msgid "No previous collection.\n" msgstr "Listando colección" #: src/commands.c:1225 #, c-format msgid "" "Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye\n" msgstr "" "Alias: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye\n" #: src/commands.c:1237 #, fuzzy, c-format msgid " `%s' %s\n" msgstr "" ":\n" " %s : %s\n" #: src/commands.c:1239 #, c-format msgid "This command can only be used when connected to a server.\n" msgstr "" "Este comando sólo puede ser usado cuando se está conectado a un servidor.\n" #: src/commands.c:1242 #, c-format msgid "Command name not known: %s\n" msgstr "Nombre de comando desconocido: %s\n" #: src/commands.c:1299 msgid "ls [path]" msgstr "ls [ruta]" #: src/commands.c:1299 msgid "List contents of current [or other] collection" msgstr "Lista los contenidos de la colección actual [o de otra]" #: src/commands.c:1300 msgid "cd path" msgstr "cd ruta" #: src/commands.c:1300 msgid "Change to specified collection" msgstr "Cambiar a la colección especificada" #: src/commands.c:1302 msgid "Display name of current collection" msgstr "Mostrar nombre de la colección actual" #: src/commands.c:1304 msgid "put local [remote]" msgstr "put local [remoto]" #: src/commands.c:1304 msgid "Upload local file" msgstr "Transfiere un archivo local" #: src/commands.c:1306 msgid "get remote [local]" msgstr "get remoto [local]" #: src/commands.c:1306 msgid "Download remote resource" msgstr "Descargar recurso remoto" #: src/commands.c:1307 msgid "mget remote..." msgstr "mget remoto" #: src/commands.c:1307 msgid "Download many remote resources" msgstr "Descargar muchos recursos remotos" #: src/commands.c:1309 msgid "mput local..." msgstr "mput local..." #: src/commands.c:1309 msgid "Upload many local files" msgstr "Transferir muchos archivos locales" #: src/commands.c:1310 msgid "edit resource" msgstr "edit recurso" #: src/commands.c:1310 msgid "Edit given resource" msgstr "Editar el recurso dado" #: src/commands.c:1311 msgid "less remote..." msgstr "less remoto" #: src/commands.c:1311 msgid "Display remote resource through pager" msgstr "Mostrar el recurso remoto mediante paginador" #: src/commands.c:1312 msgid "mkcol remote..." msgstr "mkcol remoto..." #: src/commands.c:1312 msgid "Create remote collection(s)" msgstr "Crear collección(es) remota(s)" #: src/commands.c:1313 msgid "cat remote..." msgstr "cat remoto..." #: src/commands.c:1313 msgid "Display remote resource(s)" msgstr "Mostrar recurso(s) remoto(s)" #: src/commands.c:1314 msgid "delete remote..." msgstr "delete remoto..." #: src/commands.c:1314 msgid "Delete non-collection resource(s)" msgstr "Borrar recurso(s) que no estén en la colección" #: src/commands.c:1315 msgid "rmcol remote..." msgstr "rmcol remoto..." #: src/commands.c:1315 msgid "Delete remote collections and ALL contents" msgstr "Borrar colecciones remotas y TODOS sus contenidos" #: src/commands.c:1316 msgid "copy source... dest" msgstr "copy origen... destino" #: src/commands.c:1316 msgid "Copy resource(s) from source to dest" msgstr "Copiar recurso(s) del origen al destino" #: src/commands.c:1317 msgid "move source... dest" msgstr "move origen... destino" #: src/commands.c:1317 msgid "Move resource(s) from source to dest" msgstr "Mueve recurso(s) del origen al destino" #: src/commands.c:1323 msgid "lock resource" msgstr "lock recurso" #: src/commands.c:1323 msgid "Lock given resource" msgstr "Bloquear el recurso dado" #: src/commands.c:1324 msgid "unlock resource" msgstr "unlock recurso" #: src/commands.c:1324 msgid "Unlock given resource" msgstr "Desbloquear el recurso dado" #: src/commands.c:1325 msgid "discover resource" msgstr "discover recurso" #: src/commands.c:1325 msgid "Display lock information for resource" msgstr "Muestra información del bloqueo del recurso" #: src/commands.c:1326 msgid "steal resource" msgstr "steal recurso" #: src/commands.c:1326 msgid "Steal lock token for resource" msgstr "Roba el bloqueo del recurso" #: src/commands.c:1328 msgid "Display list of owned locks" msgstr "Mostrar la lista de los bloqueos propios" #: src/commands.c:1331 #, fuzzy msgid "verrsion resource" msgstr "edit recurso" #: src/commands.c:1331 msgid "Place given resource under version control" msgstr "" #: src/commands.c:1332 #, fuzzy msgid "checkin resource" msgstr "lock recurso" #: src/commands.c:1332 #, fuzzy msgid "Checkin given resource" msgstr "Bloquear el recurso dado" #: src/commands.c:1333 #, fuzzy msgid "checkout resource" msgstr "lock recurso" #: src/commands.c:1333 #, fuzzy msgid "Checkout given resource" msgstr "Bloquear el recurso dado" #: src/commands.c:1334 #, fuzzy msgid "uncheckin resource" msgstr "unlock recurso" #: src/commands.c:1334 #, fuzzy msgid "Uncheckout given resource" msgstr "Desbloquear el recurso dado" #: src/commands.c:1335 #, fuzzy msgid "history resource" msgstr "discover recurso" #: src/commands.c:1335 #, fuzzy msgid "Show version history of resource" msgstr "Activar propiedad del recurso" #: src/commands.c:1338 msgid "label res [add|set|remove] labelname" msgstr "" #: src/commands.c:1339 #, fuzzy msgid "Set/Del/Edit label on resource" msgstr "Editar el recurso dado" #: src/commands.c:1343 #, fuzzy msgid "Names of properties defined on resource" msgstr "Activar propiedad del recurso" #: src/commands.c:1346 msgid "chexec [+|-] remote" msgstr "chexec [+|-] remoto" #: src/commands.c:1346 msgid "Change isexecutable property of resource" msgstr "Cambiar la propiedad de ejecución del recurso" #: src/commands.c:1349 #, fuzzy msgid "propget res [propname]" msgstr "propget recurso [nombre_de_propiedad]" #: src/commands.c:1350 msgid "Retrieve properties of resource" msgstr "Obtener propiedades del recurso" #: src/commands.c:1352 #, fuzzy msgid "propdel res propname" msgstr "propget recurso [nombre_de_propiedad]" #: src/commands.c:1353 #, fuzzy msgid "Delete property from resource" msgstr "Activar propiedad del recurso" #: src/commands.c:1355 #, fuzzy msgid "propset res propname value" msgstr "propset recurso nombre_de_propiedad valor" #: src/commands.c:1356 msgid "Set property on resource" msgstr "Activar propiedad del recurso" #: src/commands.c:1359 msgid "search query" msgstr "" #: src/commands.c:1360 msgid "" "DASL Search resource in current collection\n" "\n" " Examples:\n" " - search where content length is smaller than 100:\n" " > search getcontentlength < 100\n" " - search where author is Smith or Jones\n" " > search author = Smith or author = Jones\n" " Available operators and keywords:\n" " - and, or , (, ), =, <, >, <=, >=, like\n" " (See also variables searchdepth, searchorder, searchdorder)\n" msgstr "" #: src/commands.c:1371 msgid "set [option] [value]" msgstr "set [opción] [valor]" #: src/commands.c:1371 msgid "Set an option, or display options" msgstr "Activar una opción, o mostrar opciones" #: src/commands.c:1373 msgid "Open connection to given URL" msgstr "Abrir conexión con la URL dada" #: src/commands.c:1375 msgid "Close current connection" msgstr "Cerrar conexión actual" #: src/commands.c:1379 msgid "Exit program" msgstr "Salir del programa" #: src/commands.c:1382 msgid "unset [option] [value]" msgstr "unset [opción] [valor]" #: src/commands.c:1382 msgid "Unsets or clears value from option." msgstr "Inactiva o borra el valor de una opción." #: src/commands.c:1384 msgid "lcd [directory]" msgstr "lcd [directorio]" #: src/commands.c:1384 msgid "Change local working directory" msgstr "Cambiar al directorio de trabajo local" #: src/commands.c:1386 msgid "lls [options]" msgstr "lls [opciones]" #: src/commands.c:1386 msgid "Display local directory listing" msgstr "Mostrar el listado del directorio local" #: src/commands.c:1387 msgid "Print local working directory" msgstr "Mostrar en pantalla el directorio de trabajo local" #: src/commands.c:1389 msgid "Logout of authentication session" msgstr "" #: src/commands.c:1390 msgid "help [command]" msgstr "help [comando]" #: src/commands.c:1390 msgid "Display help message" msgstr "Mostrar el mensaje de ayuda" #: src/commands.c:1392 msgid "Describe an option variable" msgstr "" #: src/commands.c:1393 msgid "Information about this version of cadaver" msgstr "" #: src/common.c:46 #, fuzzy msgid "Unknown system error" msgstr "Error desconocido" #: src/edit.c:68 #, c-format msgid "Could not stat file: %s\n" msgstr "No se pudo obtener las propiedades del archivo: %s\n" #: src/edit.c:74 #, c-format msgid "Error! Could not examine temporary file: %s\n" msgstr "¡Error! No se pudo examinar el archivo temporal: %s\n" #: src/edit.c:80 #, c-format msgid "No changes were made.\n" msgstr "No se realizaron cambios.\n" #: src/edit.c:83 #, c-format msgid "Changes were made.\n" msgstr "Se realizarion cambios.\n" #: src/edit.c:130 #, c-format msgid "You cannot edit a collection resource (%s).\n" msgstr "No se puede editar un recurso de una colección (%s).\n" #: src/edit.c:147 #, c-format msgid "" "Could not create temporary file %s:\n" "%s\n" msgstr "" "No se pudo crear el archivo temporal %s:\n" "%s\n" #: src/edit.c:158 #, c-format msgid "" "Could not set file permissions for %s:\n" "%s\n" msgstr "" "No se pudo asignar los permisos de archivo para %s:\n" "%s\n" #: src/edit.c:185 #, c-format msgid "Downloading `%s' to %s" msgstr "Descargando '%s' a %s" #: src/edit.c:191 #, c-format msgid "Error writing to temporary file: %s\n" msgstr "Error escribiendo al archivo temporal: %s\n" #: src/edit.c:200 #, c-format msgid "Could not re-open temporary file: %s\n" msgstr "No se pudo reabrir el archivo temporal: %s\n" #: src/edit.c:204 #, c-format msgid "Uploading changes to `%s'" msgstr "Transfiriendo cambios a '%s'" #: src/edit.c:211 #, c-format msgid "Try uploading again (y/n)? " msgstr "¿Intentar transferir de nuevo (y/n)?" #: src/edit.c:222 #, c-format msgid "" "Could not delete temporary file %s:\n" "%s\n" msgstr "" "No se pudo borrar el archivo temporal %s:\n" "%s\n" #: src/ls.c:99 msgid "Ref:" msgstr "Ref:" #: src/ls.c:100 msgid "Coll:" msgstr "Col:" #: src/ls.c:118 #, c-format msgid "Error: %-30s %d %s\n" msgstr "Error: %-30s %d %s\n" #: src/ls.c:143 msgid "Listing collection" msgstr "Listando colección" #: src/ls.c:148 msgid "collection is empty.\n" msgstr "la colección está vacía.\n" #: src/ls.c:208 msgid "Authorization Required" msgstr "Requiere autorización" #: src/ls.c:210 msgid "Redirect" msgstr "Redirigir" #: src/ls.c:212 msgid "Server Error" msgstr "Error del servidor" #: src/ls.c:214 msgid "Unknown Error" msgstr "Error desconocido" #: src/search.c:666 #, c-format msgid "Using query: " msgstr "" #: src/utils.c:50 msgid "Did not find a collection resource." msgstr "No se encontró un recurso de la colección." #: src/version.c:339 msgid "Versioning" msgstr "" #: src/version.c:344 msgid "Checking in" msgstr "" #: src/version.c:349 msgid "Checking out" msgstr "" #: src/version.c:354 msgid "Cancelling check out of" msgstr "" #: src/version.c:366 #, c-format msgid " %d version%s in history:\n" msgstr "" #: src/version.c:430 msgid "Version history of" msgstr "" #: src/version.c:456 #, c-format msgid "Invalid action `%s' given.\n" msgstr "" #: src/version.c:466 msgid "Labelling" msgstr "" #, fuzzy #~ msgid "%s: %s" #~ msgstr "" #~ ":\n" #~ " %s : %s\n" #~ msgid "Using secure connection: %s\n" #~ msgstr "Usar conexión segura: %s\n" #~ msgid "Enter private key password for `%s': " #~ msgstr "Introduzca la contraseña de la clave privada para '%s': " #~ msgid "Private key password must be 4 or more characters!\n" #~ msgstr "" #~ "¡La contraseña de la clave privada debe ser de 4 ó más caracteres!\n" #~ msgid "" #~ "SSL support has not be compiled into this application.\n" #~ "URLs beginning with \"https:\" cannot be used!\n" #~ msgstr "" #~ "El soporte SSL no ha sido compilado en esta aplicación.\n" #~ "¡Las URLs que comiencen con \"https\" no podrán ser usadas!\n" #~ msgid "Could not use client certificate `%s' (wrong password)?\n" #~ msgstr "" #~ "No se puede usar el certificado del cliente '%s' (¿contraseña errónea?)\n" #~ msgid "Using client certificate `%s'.\n" #~ msgstr "Usando certificado del cliente '%s'.\n" #~ msgid "Unrecognized URL scheme `%s'.\n" #~ msgstr "Protocolo de la URL desconocido '%s'.\n" #~ msgid "Could not resolve proxy server hostname `%s'.\n" #~ msgstr "No se puede resolver el nombre del servidor proxy '%s'.\n" #~ msgid "List of owned locks:\n" #~ msgstr "Lista de bloqueos propios:\n" #~ msgid "Namespaces are not supported by propget yet, sorry.\n" #~ msgstr "Los espacios de nombres no están soportados por propget todavia.\n" #~ msgid "Not a collection resource." #~ msgstr "No es un recurso de la colección." #~ msgid "Could not fdopen temporary file: %s\n" #~ msgstr "No se pudo abrir archivo temporal: %s\n" cadaver-0.23.3/po/remove-potcdate.sed0000664000076400007640000000007211312007542017031 0ustar jortonjorton/^"POT-Creation-Date: .*"$/{ x s/P/P/ ta g d bb :a x :b } cadaver-0.23.3/po/remove-potcdate.sin0000664000076400007640000000066010355466427017073 0ustar jortonjorton# Sed script that remove the POT-Creation-Date line in the header entry # from a POT file. # # The distinction between the first and the following occurrences of the # pattern is achieved by looking at the hold space. /^"POT-Creation-Date: .*"$/{ x # Test if the hold space is empty. s/P/P/ ta # Yes it was empty. First occurrence. Remove the line. g d bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } cadaver-0.23.3/po/Rules-quot0000664000076400007640000000337610355466427015274 0ustar jortonjorton# Special Makefile rules for English message catalogs with quotation marks. DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot .SUFFIXES: .insert-header .po-update-en en@quot.po-create: $(MAKE) en@quot.po-update en@boldquot.po-create: $(MAKE) en@boldquot.po-update en@quot.po-update: en@quot.po-update-en en@boldquot.po-update: en@boldquot.po-update-en .insert-header.po-update-en: @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ ll=`echo $$lang | sed -e 's/@.*//'`; \ LC_ALL=C; export LC_ALL; \ cd $(srcdir); \ if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "creation of $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi en@quot.insert-header: insert-header.sin sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header en@boldquot.insert-header: insert-header.sin sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header mostlyclean: mostlyclean-quot mostlyclean-quot: rm -f *.insert-header cadaver-0.23.3/po/cadaver.pot0000664000076400007640000007521511312006131015373 0ustar jortonjorton# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Joe Orton # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: @PACKAGE@ @VERSION@\n" "Report-Msgid-Bugs-To: cadaver@webdav.org\n" "POT-Creation-Date: 2009-12-15 22:22+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: lib/getopt.c:680 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: lib/getopt.c:704 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:709 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:726 lib/getopt.c:899 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "" #: lib/getopt.c:755 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #: lib/getopt.c:759 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #: lib/getopt.c:785 #, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: lib/getopt.c:788 #, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: lib/getopt.c:818 lib/getopt.c:948 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "" #: lib/getopt.c:865 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "" #: lib/getopt.c:883 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "" #: lib/getpass.c:73 msgid "ERROR: no support for getpassword() routine\n" msgstr "" #: lib/getpass.c:201 #, c-format msgid "" "\n" "Caught SIGINT... bailing out.\n" msgstr "" #: lib/rpmatch.c:75 msgid "^[yY]" msgstr "" #: lib/rpmatch.c:78 msgid "^[nN]" msgstr "" #: lib/neon/ne_207.c:198 #, c-format msgid "" "Invalid HTTP status line in status element at line %d of response:\n" "Status line was: %s" msgstr "" #: lib/neon/ne_auth.c:134 #, c-format msgid "Could not authenticate to server: %s" msgstr "" #: lib/neon/ne_auth.c:139 #, c-format msgid "Could not authenticate to proxy server: %s" msgstr "" #: lib/neon/ne_auth.c:374 #, c-format msgid "rejected %s challenge" msgstr "" #: lib/neon/ne_auth.c:390 msgid "missing realm in Basic challenge" msgstr "" #: lib/neon/ne_auth.c:485 msgid "invalid Negotiate token" msgstr "" #: lib/neon/ne_auth.c:508 msgid "GSSAPI authentication error: " msgstr "" #: lib/neon/ne_auth.c:521 #, c-format msgid "GSSAPI failure (code %u)" msgstr "" #: lib/neon/ne_auth.c:556 msgid "ignoring empty Negotiate continuation" msgstr "" #: lib/neon/ne_auth.c:571 msgid "Negotiate response verification failed: invalid response header token" msgstr "" #: lib/neon/ne_auth.c:593 #, c-format msgid "Negotiate response verification failure: %s" msgstr "" #: lib/neon/ne_auth.c:762 msgid "unknown algorithm in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:766 msgid "incompatible algorithm in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:770 msgid "missing parameter in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:774 msgid "initial Digest challenge was stale" msgstr "" #: lib/neon/ne_auth.c:781 msgid "stale Digest challenge with new algorithm or realm" msgstr "" #: lib/neon/ne_auth.c:793 msgid "could not parse domain in Digest challenge" msgstr "" #: lib/neon/ne_auth.c:1102 msgid "Digest mutual authentication failure: missing parameters" msgstr "" #: lib/neon/ne_auth.c:1107 msgid "Digest mutual authentication failure: client nonce mismatch" msgstr "" #: lib/neon/ne_auth.c:1117 msgid "Digest mutual authentication failure: could not parse nonce count" msgstr "" #: lib/neon/ne_auth.c:1122 #, c-format msgid "Digest mutual authentication failure: nonce count mismatch (%u not %u)" msgstr "" #: lib/neon/ne_auth.c:1165 msgid "Digest mutual authentication failure: request-digest mismatch" msgstr "" #: lib/neon/ne_auth.c:1296 #, c-format msgid "ignored %s challenge" msgstr "" #: lib/neon/ne_auth.c:1375 msgid "could not parse challenge" msgstr "" #: lib/neon/ne_basic.c:98 #, c-format msgid "Could not determine file size: %s" msgstr "" #: lib/neon/ne_basic.c:149 msgid "Response did not include requested range" msgstr "" #: lib/neon/ne_basic.c:183 msgid "Range is not satisfiable" msgstr "" #: lib/neon/ne_basic.c:188 msgid "Resource does not support ranged GET requests" msgstr "" #: lib/neon/ne_compress.c:184 #, c-format msgid "%s: %s (code %d)" msgstr "" #: lib/neon/ne_compress.c:232 msgid "Could not inflate data" msgstr "" #: lib/neon/ne_compress.c:293 msgid "Could not initialize zlib" msgstr "" #: lib/neon/ne_gnutls.c:172 #, c-format msgid "[unprintable:#%lu]" msgstr "" #: lib/neon/ne_gnutls.c:201 msgid "[unprintable]" msgstr "" #: lib/neon/ne_gnutls.c:817 msgid "signed using insecure algorithm" msgstr "" #: lib/neon/ne_gnutls.c:820 #, c-format msgid "unrecognized errors (%u)" msgstr "" #: lib/neon/ne_gnutls.c:865 lib/neon/ne_openssl.c:467 msgid "Server certificate was missing commonName attribute in subject name" msgstr "" #: lib/neon/ne_gnutls.c:879 #, c-format msgid "Could not verify server certificate: %s" msgstr "" #: lib/neon/ne_gnutls.c:891 lib/neon/ne_openssl.c:454 #, c-format msgid "Certificate verification error: %s" msgstr "" #: lib/neon/ne_gnutls.c:924 lib/neon/ne_openssl.c:673 #, c-format msgid "SSL handshake failed, client certificate was requested: %s" msgstr "" #: lib/neon/ne_gnutls.c:929 lib/neon/ne_openssl.c:678 #, c-format msgid "SSL handshake failed: %s" msgstr "" #: lib/neon/ne_gnutls.c:939 msgid "Server did not send certificate chain" msgstr "" #: lib/neon/ne_locks.c:584 msgid "LOCK response missing Lock-Token header" msgstr "" #: lib/neon/ne_locks.c:759 #, c-format msgid "Response missing activelock for %s" msgstr "" #: lib/neon/ne_locks.c:801 #, c-format msgid "No activelock for <%s> returned in LOCK refresh response" msgstr "" #: lib/neon/ne_openssl.c:698 msgid "SSL server did not present certificate" msgstr "" #: lib/neon/ne_openssl.c:707 msgid "Server certificate changed: connection intercepted?" msgstr "" #: lib/neon/ne_props.c:371 lib/neon/ne_props.c:435 msgid "Response exceeds maximum property count" msgstr "" #: lib/neon/ne_redirect.c:92 msgid "Could not parse redirect destination URL" msgstr "" #: lib/neon/ne_request.c:194 #, c-format msgid "%s: connection was closed by proxy server" msgstr "" #: lib/neon/ne_request.c:197 #, c-format msgid "%s: connection was closed by server" msgstr "" #: lib/neon/ne_request.c:202 #, c-format msgid "%s: connection timed out" msgstr "" #: lib/neon/ne_request.c:311 msgid "offset invalid" msgstr "" #: lib/neon/ne_request.c:316 #, c-format msgid "Could not seek to offset %s of request body file: %s" msgstr "" #: lib/neon/ne_request.c:364 msgid "Could not send request body" msgstr "" #: lib/neon/ne_request.c:707 msgid "Could not read chunk size" msgstr "" #: lib/neon/ne_request.c:714 msgid "Could not parse chunk size" msgstr "" #: lib/neon/ne_request.c:751 msgid "Could not read response body" msgstr "" #: lib/neon/ne_request.c:767 msgid "Could not read chunk delimiter" msgstr "" #: lib/neon/ne_request.c:770 msgid "Chunk delimiter was invalid" msgstr "" #: lib/neon/ne_request.c:875 msgid "Could not read status line" msgstr "" #: lib/neon/ne_request.c:897 msgid "Could not parse response status line" msgstr "" #: lib/neon/ne_request.c:909 msgid "Could not read interim response headers" msgstr "" #: lib/neon/ne_request.c:943 msgid "Could not send request" msgstr "" #: lib/neon/ne_request.c:991 lib/neon/ne_request.c:1009 #: lib/neon/ne_request.c:1019 msgid "Error reading response headers" msgstr "" #: lib/neon/ne_request.c:1037 msgid "Response header too long" msgstr "" #: lib/neon/ne_request.c:1119 msgid "Response exceeded maximum number of header fields" msgstr "" #: lib/neon/ne_request.c:1134 #, c-format msgid "Could not resolve hostname `%s': %s" msgstr "" #: lib/neon/ne_request.c:1265 msgid "Unknown transfer-coding in response" msgstr "" #: lib/neon/ne_request.c:1278 msgid "Invalid Content-Length in response" msgstr "" #: lib/neon/ne_request.c:1351 src/commands.c:980 #, c-format msgid "Could not write to file: %s" msgstr "" #: lib/neon/ne_request.c:1424 #, c-format msgid "Could not create SSL connection through proxy server: %s" msgstr "" #: lib/neon/ne_request.c:1463 msgid "Could not create socket" msgstr "" #: lib/neon/ne_request.c:1496 msgid "Could not connect to server" msgstr "" #: lib/neon/ne_request.c:1498 msgid "Could not connect to proxy server" msgstr "" #: lib/neon/ne_request.c:1541 #, c-format msgid "Could not find IPv4 address of hostname %s for SOCKS v4 proxy" msgstr "" #: lib/neon/ne_request.c:1599 #, c-format msgid "Could not establish connection from SOCKS proxy (%s:%u): %s" msgstr "" #: lib/neon/ne_session.c:528 lib/neon/ne_session.c:539 msgid "[invalid date]" msgstr "" #: lib/neon/ne_session.c:552 msgid "certificate is not yet valid" msgstr "" #: lib/neon/ne_session.c:553 msgid "certificate has expired" msgstr "" #: lib/neon/ne_session.c:554 msgid "certificate issued for a different hostname" msgstr "" #: lib/neon/ne_session.c:555 msgid "issuer is not trusted" msgstr "" #: lib/neon/ne_session.c:556 msgid "bad certificate chain" msgstr "" #: lib/neon/ne_session.c:557 msgid "certificate has been revoked" msgstr "" #: lib/neon/ne_session.c:562 msgid "Server certificate verification failed: " msgstr "" #: lib/neon/ne_socket.c:516 lib/neon/ne_socket.c:612 lib/neon/ne_socket.c:716 msgid "Connection closed" msgstr "" #: lib/neon/ne_socket.c:622 lib/neon/ne_socket.c:728 msgid "Secure connection truncated" msgstr "" #: lib/neon/ne_socket.c:634 lib/neon/ne_socket.c:740 #, c-format msgid "SSL error: %s" msgstr "" #: lib/neon/ne_socket.c:637 #, c-format msgid "SSL error code %d/%d/%lu" msgstr "" #: lib/neon/ne_socket.c:721 #, c-format msgid "SSL alert received: %s" msgstr "" #: lib/neon/ne_socket.c:736 msgid "SSL socket read failed" msgstr "" #: lib/neon/ne_socket.c:867 msgid "Line too long" msgstr "" #: lib/neon/ne_socket.c:1012 lib/neon/ne_socket.c:1018 msgid "Host not found" msgstr "" #: lib/neon/ne_socket.c:1221 msgid "Connection timed out" msgstr "" #: lib/neon/ne_socket.c:1412 msgid "Socket descriptor number exceeds FD_SETSIZE" msgstr "" #: lib/neon/ne_socket.c:1474 msgid "Socket family not supported" msgstr "" #: lib/neon/ne_socket.c:1701 msgid "Client certificate verification failed" msgstr "" #: lib/neon/ne_socket.c:1717 msgid "SSL disabled due to lack of entropy" msgstr "" #: lib/neon/ne_socket.c:1724 msgid "SSL disabled due to library version mismatch" msgstr "" #: lib/neon/ne_socket.c:1730 msgid "Could not create SSL structure" msgstr "" #: lib/neon/ne_socks.c:65 msgid "failure" msgstr "" #: lib/neon/ne_socks.c:68 msgid "connection not permitted" msgstr "" #: lib/neon/ne_socks.c:71 msgid "network unreachable" msgstr "" #: lib/neon/ne_socks.c:74 msgid "host unreachable" msgstr "" #: lib/neon/ne_socks.c:77 msgid "TTL expired" msgstr "" #: lib/neon/ne_socks.c:80 msgid "command not supported" msgstr "" #: lib/neon/ne_socks.c:83 msgid "address type not supported" msgstr "" #: lib/neon/ne_socks.c:86 #, c-format msgid "%s: unrecognized error (%u)" msgstr "" #: lib/neon/ne_socks.c:128 lib/neon/ne_socks.c:328 msgid "Could not send message to proxy" msgstr "" #: lib/neon/ne_socks.c:133 msgid "Could not read initial response from proxy" msgstr "" #: lib/neon/ne_socks.c:136 msgid "Invalid version in proxy response" msgstr "" #: lib/neon/ne_socks.c:157 msgid "Could not send login message" msgstr "" #: lib/neon/ne_socks.c:162 msgid "Could not read login reply" msgstr "" #: lib/neon/ne_socks.c:165 msgid "Invalid version in login reply" msgstr "" #: lib/neon/ne_socks.c:168 msgid "Authentication failed" msgstr "" #: lib/neon/ne_socks.c:172 msgid "No acceptable authentication method" msgstr "" #: lib/neon/ne_socks.c:174 msgid "Unexpected authentication method chosen" msgstr "" #: lib/neon/ne_socks.c:210 msgid "Could not send connect request" msgstr "" #: lib/neon/ne_socks.c:215 msgid "Could not read connect reply" msgstr "" #: lib/neon/ne_socks.c:218 msgid "Invalid version in connect reply" msgstr "" #: lib/neon/ne_socks.c:221 lib/neon/ne_socks.c:337 msgid "Could not connect" msgstr "" #: lib/neon/ne_socks.c:235 msgid "Could not read FQDN length in connect reply" msgstr "" #: lib/neon/ne_socks.c:240 msgid "Unknown address type in connect reply" msgstr "" #: lib/neon/ne_socks.c:245 msgid "Could not read address in connect reply" msgstr "" #: lib/neon/ne_socks.c:266 msgid "request rejected or failed" msgstr "" #: lib/neon/ne_socks.c:269 msgid "could not establish connection to identd" msgstr "" #: lib/neon/ne_socks.c:272 msgid "rejected due to identd user mismatch" msgstr "" #: lib/neon/ne_socks.c:275 #, c-format msgid "%s: unrecognized failure (%u)" msgstr "" #: lib/neon/ne_socks.c:333 msgid "Could not read response from proxy" msgstr "" #: lib/neon/ne_xml.c:280 #, c-format msgid "XML parse error at line %d: invalid element name" msgstr "" #: lib/neon/ne_xml.c:474 msgid "Unknown error" msgstr "" #: lib/neon/ne_xml.c:579 msgid "Invalid Byte Order Mark" msgstr "" #: lib/neon/ne_xml.c:667 #, c-format msgid "XML parse error at line %d: %s" msgstr "" #: lib/neon/ne_xmlreq.c:36 #, c-format msgid "Could not parse response: %s" msgstr "" #: src/cadaver.c:128 #, c-format msgid "" "Usage: %s [OPTIONS] http://hostname[:port]/path\n" " Port defaults to 80, path defaults to '/'\n" "Options:\n" " -t, --tolerant Allow cd/open into non-WebDAV enabled " "collection.\n" " -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc.\n" " -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port " "PORT.\n" " -V, --version Display version information.\n" " -h, --help Display this help message.\n" "Please send bug reports and feature requests to \n" msgstr "" #: src/cadaver.c:155 #, c-format msgid "Connection to `%s' closed.\n" msgstr "" #: src/cadaver.c:171 #, c-format msgid "" "Ignored error: %s not WebDAV-enabled:\n" "%s\n" msgstr "" #: src/cadaver.c:178 #, c-format msgid "" "Could not access %s (not WebDAV-enabled?):\n" "%s\n" msgstr "" #: src/cadaver.c:192 #, c-format msgid "WARNING: Untrusted server certificate presented for `%s':\n" msgstr "" #: src/cadaver.c:195 msgid "WARNING: Untrusted server certificate presented:\n" msgstr "" #: src/cadaver.c:198 #, c-format msgid "Certificate was issued to hostname `%s' rather than `%s'\n" msgstr "" #: src/cadaver.c:200 #, c-format msgid "This connection could have been intercepted.\n" msgstr "" #: src/cadaver.c:206 #, c-format msgid "Issued to: %s\n" msgstr "" #: src/cadaver.c:207 #, c-format msgid "Issued by: %s\n" msgstr "" #: src/cadaver.c:210 #, c-format msgid "Certificate is valid from %s to %s\n" msgstr "" #: src/cadaver.c:213 #, c-format msgid "Do you wish to accept the certificate? (y/n) " msgstr "" #: src/cadaver.c:216 #, c-format msgid "Certificate rejected.\n" msgstr "" #: src/cadaver.c:247 msgid "Decryption password: " msgstr "" #: src/cadaver.c:318 #, c-format msgid "Could not parse URL `%s'\n" msgstr "" #: src/cadaver.c:330 #, c-format msgid "SSL is not enabled.\n" msgstr "" #: src/cadaver.c:405 src/cadaver.c:408 #, c-format msgid "" "Could not connect to `%s' on port %d:\n" "%s\n" msgstr "" #: src/cadaver.c:416 #, c-format msgid "" "Could not open collection:\n" "%s\n" msgstr "" #: src/cadaver.c:456 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "" #: src/cadaver.c:505 #, c-format msgid "Unrecognised command. Type 'help' for a list of commands.\n" msgstr "" #: src/cadaver.c:507 #, c-format msgid "The `%s' command requires %d argument%s" msgstr "" #: src/cadaver.c:510 src/cadaver.c:522 #, c-format msgid "" ":\n" " %s : %s\n" msgstr "" #: src/cadaver.c:516 #, c-format msgid "The `%s' command takes at most %d argument%s" msgstr "" #: src/cadaver.c:519 #, c-format msgid "The `%s' command takes no arguments" msgstr "" #: src/cadaver.c:527 #, c-format msgid "" "The `%s' command can only be used when connected to the server.\n" "Try running `open' first (see `help open' for more details).\n" msgstr "" #: src/cadaver.c:572 #, c-format msgid "Terminated by signal %d.\n" msgstr "" #: src/cadaver.c:615 #, c-format msgid "Could not read rcfile %s: %s\n" msgstr "" #: src/cadaver.c:870 #, c-format msgid "Environment variable $HOME needs to be set!\n" msgstr "" #: src/cadaver.c:932 #, c-format msgid "Looking up hostname... " msgstr "" #: src/cadaver.c:935 #, c-format msgid "Connecting to server... " msgstr "" #: src/cadaver.c:938 #, c-format msgid "connected.\n" msgstr "" #: src/cadaver.c:950 #, c-format msgid " (reconnecting..." msgstr "" #: src/cadaver.c:954 #, c-format msgid "done)" msgstr "" #: src/cadaver.c:980 #, c-format msgid "] reconnecting: " msgstr "" #: src/cadaver.c:983 #, c-format msgid "okay [" msgstr "" #: src/cadaver.c:1000 #, c-format msgid "\rTransfer timed out, reconnecting... " msgstr "" #: src/cadaver.c:1003 #, c-format msgid "okay." msgstr "" #: src/cadaver.c:1062 #, c-format msgid "\rProgress: [" msgstr "" #: src/cadaver.c:1067 msgid "] %5.1f%% of %" msgstr "" #: src/cadaver.c:1094 msgid "Username: " msgstr "" #: src/cadaver.c:1096 #, c-format msgid "\rAuthentication aborted!\n" msgstr "" #: src/cadaver.c:1099 #, c-format msgid "\rUsername too long (>%d)\n" msgstr "" #: src/cadaver.c:1107 msgid "Password: " msgstr "" #: src/cadaver.c:1109 #, c-format msgid "Authentication aborted!\n" msgstr "" #: src/cadaver.c:1112 #, c-format msgid "\rPassword too long (>%d)\n" msgstr "" #: src/cadaver.c:1123 #, c-format msgid "Retrying:" msgstr "" #: src/cadaver.c:1127 #, c-format msgid "Retrying [" msgstr "" #: src/cadaver.c:1150 #, c-format msgid "Authentication required for %s on server `%s':\n" msgstr "" #: src/cadaver.c:1161 #, c-format msgid "Authentication required for %s on proxy server `%s':\n" msgstr "" #: src/cmdline.c:286 msgid "[Matching..." msgstr "" #: src/cmdline.c:313 #, c-format msgid "%ld matches.]\n" msgstr "" #: src/cmdline.c:315 msgid "1 match.]\n" msgstr "" #: src/commands.c:122 msgid "succeeded.\n" msgstr "" #: src/commands.c:133 msgid "authentication failed.\n" msgstr "" #: src/commands.c:136 msgid "could not connect to server.\n" msgstr "" #: src/commands.c:139 msgid "connection timed out.\n" msgstr "" #: src/commands.c:146 #, c-format msgid "redirect to %s\n" msgstr "" #: src/commands.c:151 src/commands.c:974 #, c-format msgid "" "failed:\n" "%s\n" msgstr "" #: src/commands.c:328 msgid "exclusive" msgstr "" #: src/commands.c:329 msgid "shared" msgstr "" #: src/commands.c:330 src/commands.c:339 src/ls.c:119 msgid "unknown" msgstr "" #: src/commands.c:337 msgid "write" msgstr "" #: src/commands.c:347 msgid "infinite" msgstr "" #: src/commands.c:348 src/commands.c:366 msgid "invalid" msgstr "" #: src/commands.c:350 #, c-format msgid "%ld seconds" msgstr "" #: src/commands.c:359 msgid "infinity" msgstr "" #: src/commands.c:380 #, c-format msgid "" "Lock token <%s>:\n" " Depth %s on `%s'\n" " Scope: %s Type: %s Timeout: %s\n" " Owner: %s\n" msgstr "" #: src/commands.c:387 msgid "(none)" msgstr "" #: src/commands.c:403 src/commands.c:422 #, c-format msgid "Failed on %s: %d %s\n" msgstr "" #: src/commands.c:450 msgid "Discovering locks on" msgstr "" #: src/commands.c:455 msgid "Stealing locks on" msgstr "" #: src/commands.c:469 #, c-format msgid "No owned locks.\n" msgstr "" #: src/commands.c:487 msgid "Locking collection" msgstr "" #: src/commands.c:489 msgid "Locking" msgstr "" #: src/commands.c:521 msgid "Unlocking" msgstr "" #: src/commands.c:525 msgid "Enter locktoken: " msgstr "" #: src/commands.c:546 msgid "Creating" msgstr "" #: src/commands.c:560 #, c-format msgid "%s %s failed: %s\n" msgstr "" #: src/commands.c:587 #, c-format msgid "Value of %s is: %s\n" msgstr "" #: src/commands.c:593 #, c-format msgid "Could not fetch property: %d %s\n" msgstr "" #: src/commands.c:596 #, c-format msgid "Server did not return result for %s\n" msgstr "" #: src/commands.c:637 msgid "Setting property on" msgstr "" #: src/commands.c:642 msgid "Deleting property on" msgstr "" #: src/commands.c:660 msgid "Fetching properties for" msgstr "" #: src/commands.c:691 msgid "Fetching property names" msgstr "" #: src/commands.c:720 msgid "Deleting" msgstr "" #: src/commands.c:723 #, c-format msgid "" "is a collection resource.\n" "The `rm' command cannot be used to delete a collection.\n" "Use `rmcol %s' to delete this collection and ALL its contents.\n" msgstr "" #: src/commands.c:739 msgid "Deleting collection" msgstr "" #: src/commands.c:742 #, c-format msgid "" "is not a collection.\n" "The `rmcol' command can only be used to delete collections.\n" "Use `rm %s' to delete this resource.\n" msgstr "" #: src/commands.c:826 src/commands.c:843 #, c-format msgid "Displaying `%s':\n" msgstr "" #: src/commands.c:829 #, c-format msgid "" "Error! Could not spawn pager `%s':\n" "%s\n" msgstr "" #: src/commands.c:845 #, c-format msgid "Failed: %s\n" msgstr "" #: src/commands.c:864 #, c-format msgid "%s: %s and %s are the same resource.\n" msgstr "" #: src/commands.c:873 #, c-format msgid "When %s multiple resources, the last argument must be a collection.\n" msgstr "" #: src/commands.c:889 #, c-format msgid "Moving `%s' to `%s': " msgstr "" #: src/commands.c:895 #, c-format msgid "Copying `%s' to `%s': " msgstr "" #: src/commands.c:955 #, c-format msgid "Enter local filename for `%s': " msgstr "" #: src/commands.c:960 #, c-format msgid "cancelled.\n" msgstr "" #: src/commands.c:972 #, c-format msgid "Downloading `%s' to %s:" msgstr "" #: src/commands.c:993 #, c-format msgid "Uploading %s to `%s':" msgstr "" #: src/commands.c:995 #, c-format msgid "Could not open file: %s\n" msgstr "" #: src/commands.c:1027 msgid "copying" msgstr "" #: src/commands.c:1027 msgid "copy" msgstr "" #: src/commands.c:1032 msgid "moving" msgstr "" #: src/commands.c:1032 msgid "move" msgstr "" #: src/commands.c:1093 #, c-format msgid "" "Use:\n" " chexec + %s to make the resource executable\n" "or chexec - %s to make the resource unexecutable\n" msgstr "" #: src/commands.c:1102 msgid "Setting isexecutable" msgstr "" #: src/commands.c:1108 msgid "The server does not support the 'isexecutable' property." msgstr "" #: src/commands.c:1123 #, c-format msgid "Local directory: %s\n" msgstr "" #: src/commands.c:1139 #, c-format msgid "Error executing ls: %s\n" msgstr "" #: src/commands.c:1143 #, c-format msgid "Error forking ls: %s\n" msgstr "" #: src/commands.c:1160 #, c-format msgid "Could not determine home directory from environment.\n" msgstr "" #: src/commands.c:1165 #, c-format msgid "" "Could not change local directory:\n" "chdir: %s\n" msgstr "" #: src/commands.c:1173 #, c-format msgid "Current collection is `%s'.\n" msgstr "" #: src/commands.c:1183 #, c-format msgid "No previous collection.\n" msgstr "" #: src/commands.c:1225 #, c-format msgid "" "Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye\n" msgstr "" #: src/commands.c:1237 #, c-format msgid " `%s' %s\n" msgstr "" #: src/commands.c:1239 #, c-format msgid "This command can only be used when connected to a server.\n" msgstr "" #: src/commands.c:1242 #, c-format msgid "Command name not known: %s\n" msgstr "" #: src/commands.c:1299 msgid "ls [path]" msgstr "" #: src/commands.c:1299 msgid "List contents of current [or other] collection" msgstr "" #: src/commands.c:1300 msgid "cd path" msgstr "" #: src/commands.c:1300 msgid "Change to specified collection" msgstr "" #: src/commands.c:1302 msgid "Display name of current collection" msgstr "" #: src/commands.c:1304 msgid "put local [remote]" msgstr "" #: src/commands.c:1304 msgid "Upload local file" msgstr "" #: src/commands.c:1306 msgid "get remote [local]" msgstr "" #: src/commands.c:1306 msgid "Download remote resource" msgstr "" #: src/commands.c:1307 msgid "mget remote..." msgstr "" #: src/commands.c:1307 msgid "Download many remote resources" msgstr "" #: src/commands.c:1309 msgid "mput local..." msgstr "" #: src/commands.c:1309 msgid "Upload many local files" msgstr "" #: src/commands.c:1310 msgid "edit resource" msgstr "" #: src/commands.c:1310 msgid "Edit given resource" msgstr "" #: src/commands.c:1311 msgid "less remote..." msgstr "" #: src/commands.c:1311 msgid "Display remote resource through pager" msgstr "" #: src/commands.c:1312 msgid "mkcol remote..." msgstr "" #: src/commands.c:1312 msgid "Create remote collection(s)" msgstr "" #: src/commands.c:1313 msgid "cat remote..." msgstr "" #: src/commands.c:1313 msgid "Display remote resource(s)" msgstr "" #: src/commands.c:1314 msgid "delete remote..." msgstr "" #: src/commands.c:1314 msgid "Delete non-collection resource(s)" msgstr "" #: src/commands.c:1315 msgid "rmcol remote..." msgstr "" #: src/commands.c:1315 msgid "Delete remote collections and ALL contents" msgstr "" #: src/commands.c:1316 msgid "copy source... dest" msgstr "" #: src/commands.c:1316 msgid "Copy resource(s) from source to dest" msgstr "" #: src/commands.c:1317 msgid "move source... dest" msgstr "" #: src/commands.c:1317 msgid "Move resource(s) from source to dest" msgstr "" #: src/commands.c:1323 msgid "lock resource" msgstr "" #: src/commands.c:1323 msgid "Lock given resource" msgstr "" #: src/commands.c:1324 msgid "unlock resource" msgstr "" #: src/commands.c:1324 msgid "Unlock given resource" msgstr "" #: src/commands.c:1325 msgid "discover resource" msgstr "" #: src/commands.c:1325 msgid "Display lock information for resource" msgstr "" #: src/commands.c:1326 msgid "steal resource" msgstr "" #: src/commands.c:1326 msgid "Steal lock token for resource" msgstr "" #: src/commands.c:1328 msgid "Display list of owned locks" msgstr "" #: src/commands.c:1331 msgid "verrsion resource" msgstr "" #: src/commands.c:1331 msgid "Place given resource under version control" msgstr "" #: src/commands.c:1332 msgid "checkin resource" msgstr "" #: src/commands.c:1332 msgid "Checkin given resource" msgstr "" #: src/commands.c:1333 msgid "checkout resource" msgstr "" #: src/commands.c:1333 msgid "Checkout given resource" msgstr "" #: src/commands.c:1334 msgid "uncheckin resource" msgstr "" #: src/commands.c:1334 msgid "Uncheckout given resource" msgstr "" #: src/commands.c:1335 msgid "history resource" msgstr "" #: src/commands.c:1335 msgid "Show version history of resource" msgstr "" #: src/commands.c:1338 msgid "label res [add|set|remove] labelname" msgstr "" #: src/commands.c:1339 msgid "Set/Del/Edit label on resource" msgstr "" #: src/commands.c:1343 msgid "Names of properties defined on resource" msgstr "" #: src/commands.c:1346 msgid "chexec [+|-] remote" msgstr "" #: src/commands.c:1346 msgid "Change isexecutable property of resource" msgstr "" #: src/commands.c:1349 msgid "propget res [propname]" msgstr "" #: src/commands.c:1350 msgid "Retrieve properties of resource" msgstr "" #: src/commands.c:1352 msgid "propdel res propname" msgstr "" #: src/commands.c:1353 msgid "Delete property from resource" msgstr "" #: src/commands.c:1355 msgid "propset res propname value" msgstr "" #: src/commands.c:1356 msgid "Set property on resource" msgstr "" #: src/commands.c:1359 msgid "search query" msgstr "" #: src/commands.c:1360 msgid "" "DASL Search resource in current collection\n" "\n" " Examples:\n" " - search where content length is smaller than 100:\n" " > search getcontentlength < 100\n" " - search where author is Smith or Jones\n" " > search author = Smith or author = Jones\n" " Available operators and keywords:\n" " - and, or , (, ), =, <, >, <=, >=, like\n" " (See also variables searchdepth, searchorder, searchdorder)\n" msgstr "" #: src/commands.c:1371 msgid "set [option] [value]" msgstr "" #: src/commands.c:1371 msgid "Set an option, or display options" msgstr "" #: src/commands.c:1373 msgid "Open connection to given URL" msgstr "" #: src/commands.c:1375 msgid "Close current connection" msgstr "" #: src/commands.c:1379 msgid "Exit program" msgstr "" #: src/commands.c:1382 msgid "unset [option] [value]" msgstr "" #: src/commands.c:1382 msgid "Unsets or clears value from option." msgstr "" #: src/commands.c:1384 msgid "lcd [directory]" msgstr "" #: src/commands.c:1384 msgid "Change local working directory" msgstr "" #: src/commands.c:1386 msgid "lls [options]" msgstr "" #: src/commands.c:1386 msgid "Display local directory listing" msgstr "" #: src/commands.c:1387 msgid "Print local working directory" msgstr "" #: src/commands.c:1389 msgid "Logout of authentication session" msgstr "" #: src/commands.c:1390 msgid "help [command]" msgstr "" #: src/commands.c:1390 msgid "Display help message" msgstr "" #: src/commands.c:1392 msgid "Describe an option variable" msgstr "" #: src/commands.c:1393 msgid "Information about this version of cadaver" msgstr "" #: src/common.c:46 msgid "Unknown system error" msgstr "" #: src/edit.c:68 #, c-format msgid "Could not stat file: %s\n" msgstr "" #: src/edit.c:74 #, c-format msgid "Error! Could not examine temporary file: %s\n" msgstr "" #: src/edit.c:80 #, c-format msgid "No changes were made.\n" msgstr "" #: src/edit.c:83 #, c-format msgid "Changes were made.\n" msgstr "" #: src/edit.c:130 #, c-format msgid "You cannot edit a collection resource (%s).\n" msgstr "" #: src/edit.c:147 #, c-format msgid "" "Could not create temporary file %s:\n" "%s\n" msgstr "" #: src/edit.c:158 #, c-format msgid "" "Could not set file permissions for %s:\n" "%s\n" msgstr "" #: src/edit.c:185 #, c-format msgid "Downloading `%s' to %s" msgstr "" #: src/edit.c:191 #, c-format msgid "Error writing to temporary file: %s\n" msgstr "" #: src/edit.c:200 #, c-format msgid "Could not re-open temporary file: %s\n" msgstr "" #: src/edit.c:204 #, c-format msgid "Uploading changes to `%s'" msgstr "" #: src/edit.c:211 #, c-format msgid "Try uploading again (y/n)? " msgstr "" #: src/edit.c:222 #, c-format msgid "" "Could not delete temporary file %s:\n" "%s\n" msgstr "" #: src/ls.c:99 msgid "Ref:" msgstr "" #: src/ls.c:100 msgid "Coll:" msgstr "" #: src/ls.c:118 #, c-format msgid "Error: %-30s %d %s\n" msgstr "" #: src/ls.c:143 msgid "Listing collection" msgstr "" #: src/ls.c:148 msgid "collection is empty.\n" msgstr "" #: src/ls.c:208 msgid "Authorization Required" msgstr "" #: src/ls.c:210 msgid "Redirect" msgstr "" #: src/ls.c:212 msgid "Server Error" msgstr "" #: src/ls.c:214 msgid "Unknown Error" msgstr "" #: src/search.c:666 #, c-format msgid "Using query: " msgstr "" #: src/utils.c:50 msgid "Did not find a collection resource." msgstr "" #: src/version.c:339 msgid "Versioning" msgstr "" #: src/version.c:344 msgid "Checking in" msgstr "" #: src/version.c:349 msgid "Checking out" msgstr "" #: src/version.c:354 msgid "Cancelling check out of" msgstr "" #: src/version.c:366 #, c-format msgid " %d version%s in history:\n" msgstr "" #: src/version.c:430 msgid "Version history of" msgstr "" #: src/version.c:456 #, c-format msgid "Invalid action `%s' given.\n" msgstr "" #: src/version.c:466 msgid "Labelling" msgstr "" cadaver-0.23.3/po/Makefile.in.in0000664000076400007640000003552410754021641015727 0ustar jortonjorton# Makefile for PO directory in any package using GNU gettext. # Copyright (C) 1995-1997, 2000-2007 by Ulrich Drepper # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public # License but which still want to provide support for the GNU gettext # functionality. # Please note that the actual code of GNU gettext is covered by the GNU # General Public License and is *not* in the public domain. # # Origin: gettext-0.17 GETTEXT_MACRO_VERSION = 0.17 PACKAGE = @PACKAGE@ VERSION = @VERSION@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ SHELL = /bin/sh @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ datadir = @datadir@ localedir = @localedir@ gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, # @install_sh@ does not start with $(SHELL), so we add it. # In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. mkinstalldirs = $(SHELL) @install_sh@ -d install_sh = $(SHELL) @install_sh@ MKDIR_P = @MKDIR_P@ mkdir_p = @mkdir_p@ GMSGFMT_ = @GMSGFMT@ GMSGFMT_no = @GMSGFMT@ GMSGFMT_yes = @GMSGFMT_015@ GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) MSGFMT_ = @MSGFMT@ MSGFMT_no = @MSGFMT@ MSGFMT_yes = @MSGFMT_015@ MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) XGETTEXT_ = @XGETTEXT@ XGETTEXT_no = @XGETTEXT@ XGETTEXT_yes = @XGETTEXT_015@ XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) MSGMERGE = msgmerge MSGMERGE_UPDATE = @MSGMERGE@ --update MSGINIT = msginit MSGCONV = msgconv MSGFILTER = msgfilter POFILES = @POFILES@ GMOFILES = @GMOFILES@ UPDATEPOFILES = @UPDATEPOFILES@ DUMMYPOFILES = @DUMMYPOFILES@ DISTFILES.common = Makefile.in.in remove-potcdate.sin \ $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ $(POFILES) $(GMOFILES) \ $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) POTFILES = \ CATALOGS = @CATALOGS@ # Makevars gets inserted here. (Don't remove this line!) .SUFFIXES: .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update .po.mo: @echo "$(MSGFMT) -c -o $@ $<"; \ $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ .po.gmo: @lang=`echo $* | sed -e 's,.*/,,'`; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo .sin.sed: sed -e '/^#/d' $< > t-$@ mv t-$@ $@ all: check-macro-version all-@USE_NLS@ all-yes: stamp-po all-no: # Ensure that the gettext macros and this Makefile.in.in are in sync. check-macro-version: @test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ exit 1; \ } # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because # we don't want to bother translators with empty POT files). We assume that # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. # In this case, stamp-po is a nop (i.e. a phony target). # stamp-po is a timestamp denoting the last time at which the CATALOGS have # been loosely updated. Its purpose is that when a developer or translator # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent # invocations of "make" will do nothing. This timestamp would not be necessary # if updating the $(CATALOGS) would always touch them; however, the rule for # $(POFILES) has been designed to not touch files that don't need to be # changed. stamp-po: $(srcdir)/$(DOMAIN).pot test ! -f $(srcdir)/$(DOMAIN).pot || \ test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) @test ! -f $(srcdir)/$(DOMAIN).pot || { \ echo "touch stamp-po" && \ echo timestamp > stamp-poT && \ mv stamp-poT stamp-po; \ } # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', # otherwise packages like GCC can not be built if only parts of the source # have been downloaded. # This target rebuilds $(DOMAIN).pot; it is an expensive operation. # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \ package_gnu='GNU '; \ else \ package_gnu=''; \ fi; \ if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ else \ msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ fi; \ case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --msgid-bugs-address="$$msgid_bugs_address" \ ;; \ *) \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --package-name="$${package_gnu}@PACKAGE@" \ --package-version='@VERSION@' \ --msgid-bugs-address="$$msgid_bugs_address" \ ;; \ esac test ! -f $(DOMAIN).po || { \ if test -f $(srcdir)/$(DOMAIN).pot; then \ sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ else \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ else \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ } # This rule has no dependencies: we don't need to update $(DOMAIN).pot at # every "make" invocation, only create it when it is missing. # Only "make $(DOMAIN).pot-update" or "make dist" will force an update. $(srcdir)/$(DOMAIN).pot: $(MAKE) $(DOMAIN).pot-update # This target rebuilds a PO file if $(DOMAIN).pot has changed. # Note that a PO file is not touched if it doesn't need to be changed. $(POFILES): $(srcdir)/$(DOMAIN).pot @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ if test -f "$(srcdir)/$${lang}.po"; then \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ else \ $(MAKE) $${lang}.po-create; \ fi install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ for file in $(DISTFILES.common) Makevars.template; do \ $(INSTALL_DATA) $(srcdir)/$$file \ $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ for file in Makevars; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi install-data-no: all install-data-yes: all $(mkdir_p) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $(DESTDIR)$$dir; \ if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ fi; \ done; \ done install-strip: install installdirs: installdirs-exec installdirs-data installdirs-exec: installdirs-data: installdirs-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ else \ : ; \ fi installdirs-data-no: installdirs-data-yes: $(mkdir_p) $(DESTDIR)$(datadir) @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $(DESTDIR)$$dir; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ fi; \ done; \ done # Define this as empty until I found a useful application. installcheck: uninstall: uninstall-exec uninstall-data uninstall-exec: uninstall-data: uninstall-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ for file in $(DISTFILES.common) Makevars.template; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi uninstall-data-no: uninstall-data-yes: catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ done; \ done check: all info dvi ps pdf html tags TAGS ctags CTAGS ID: mostlyclean: rm -f remove-potcdate.sed rm -f stamp-poT rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po rm -fr *.o clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES *.mo maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f stamp-po $(GMOFILES) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(MAKE) update-po @$(MAKE) dist2 # This is a separate target because 'update-po' must be executed before. dist2: stamp-po $(DISTFILES) dists="$(DISTFILES)"; \ if test "$(PACKAGE)" = "gettext-tools"; then \ dists="$$dists Makevars.template"; \ fi; \ if test -f $(srcdir)/$(DOMAIN).pot; then \ dists="$$dists $(DOMAIN).pot stamp-po"; \ fi; \ if test -f $(srcdir)/ChangeLog; then \ dists="$$dists ChangeLog"; \ fi; \ for i in 0 1 2 3 4 5 6 7 8 9; do \ if test -f $(srcdir)/ChangeLog.$$i; then \ dists="$$dists ChangeLog.$$i"; \ fi; \ done; \ if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ for file in $$dists; do \ if test -f $$file; then \ cp -p $$file $(distdir) || exit 1; \ else \ cp -p $(srcdir)/$$file $(distdir) || exit 1; \ fi; \ done update-po: Makefile $(MAKE) $(DOMAIN).pot-update test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) $(MAKE) update-gmo # General rule for creating PO files. .nop.po-create: @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ exit 1 # General rule for updating PO files. .nop.po-update: @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ cd $(srcdir); \ if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi $(DUMMYPOFILES): update-gmo: Makefile $(GMOFILES) @: Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ cd $(top_builddir) \ && $(SHELL) ./config.status $(subdir)/$@.in po-directories force: # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cadaver-0.23.3/po/it.gmo0000664000076400007640000003257111312007542014367 0ustar jortonjortonÞ•¨\㜠() C%Pvˆ  šL§ô5 /Cs(гÒñ$@Y$uš.±,à' '55] “´Í%ç *+Vo!‹*­Øá#õ.C_%"¥%Èî :Sj‚–¶,Èõ $#,H&uœ °½ ÒÞ)ö. Obw‹“$«Ðæý +6T]b ‚  —$¤!Éë7I}c'á, #68Z:“&Îõ  5:?#zž°ÈÞiø bmD,Æ ó ) 5CK_ u˜±¹×èú   $7FOX‘`vòiy ˆ – ¤®½ÍÒæ íû+@G Vbjz‘X—ð !)!E! X!b! v!Jƒ!Î!7ê!1""T"4m"$¢""Ç"#ê"#-# 3#T#n#,Š#·#:Ï#4 $-?$1m$9Ÿ$+Ù$%%%-E%5s%1©%#Û% ÿ%! &3B& v&„&£&¿&Ð&"í&&'-7'(e'2Ž'Á'á'û'(3(N(j(*Š(µ(2Ò(!)')/B)5r)4¨)Ý)ò)* *(*3E*=y*·*Ï*$å* ++-2+`+~+ž+'¶+ Þ+$é+ ,,$,D,V,g,3y,&­,#Ô,ø,-1-@-„[-'à-2.&;.3b.C–.-Ú.)/2/)E/o/<‹/-È/ö/ 0%0"@0oc0 Ó0á0Hø0,A1n1‰1›1 ´1 Á1 Ï1Û1ï1 22(2.2K2#S2w2ˆ2™2  2 ­2 ·2Ä2Ø2ç2ð2ù2£3ˆ¦3/4?4 N4 \4 i4w4†4–44º4Ã4Ò4×4Û4ï4ÿ4 5 5 .5 ;5G5V5 o5G<~I1d…3u>†ž¡=w *5Ž£ˆ CB{™l$Šh]J•Tg0V— ^ PH(ƒR"a`˜Xbz.4Ÿ8y’-€)›?¢š _F„rc!f|jA;pk‚vo§,ŒY+ 9#m¥‡&%‰67\: ¦‹ND”@LZx[2'–tnM/S}EOq‘¨QiK“WU¤sœe Authentication aborted! Progress: [ Transfer timed out, reconnecting... (reconnecting...(none)1 match.] : %s : %s Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye Authentication aborted! Authentication required for %s on proxy server `%s': Authentication required for %s on server `%s': Authorization RequiredChange isexecutable property of resourceChange local working directoryChange to specified collectionChanges were made. Close current connectionColl:Command name not known: %s Connecting to server... Connection to `%s' closed. Copy resource(s) from source to destCopying `%s' to `%s': Could not access %s (not WebDAV-enabled?): %s Could not change local directory: chdir: %s Could not create temporary file %s: %s Could not delete temporary file %s: %s Could not determine home directory from environment. Could not fetch property: %d %s Could not open file: %s Could not parse URL `%s' Could not re-open temporary file: %s Could not read rcfile %s: %s Could not set file permissions for %s: %s Could not stat file: %s Create remote collection(s)Delete non-collection resource(s)Delete remote collections and ALL contentsDeletingDeleting collectionDid not find a collection resource.Discovering locks onDisplay help messageDisplay list of owned locksDisplay local directory listingDisplay lock information for resourceDisplay name of current collectionDisplay remote resource through pagerDisplay remote resource(s)Displaying `%s': Download many remote resourcesDownload remote resourceDownloading `%s' to %sDownloading `%s' to %s:Edit given resourceEnter local filename for `%s': Enter locktoken: Environment variable $HOME needs to be set! Error executing ls: %s Error forking ls: %s Error writing to temporary file: %s Error! Could not examine temporary file: %s Error! Could not spawn pager `%s': %s Error: %-30s %d %s Exit programFailed on %s: %d %s Failed: %s Fetching properties forIgnored error: %s not WebDAV-enabled: %s List contents of current [or other] collectionListing collectionLocal directory: %s Lock given resourceLockingLooking up hostname... Move resource(s) from source to destMoving `%s' to `%s': No changes were made. No owned locks. Open connection to given URLPassword: Print local working directoryRedirectRef:Retrieve properties of resourceRetrying [Retrying:Server ErrorServer did not return result for %s Set an option, or display optionsSet property on resourceSetting isexecutableSteal lock token for resourceStealing locks onTerminated by signal %d. The `%s' command can only be used when connected to the server. Try running `open' first (see `help open' for more details). The `%s' command requires %d argument%sThe `%s' command takes at most %d argument%sThe `%s' command takes no argumentsThe server does not support the 'isexecutable' property.This command can only be used when connected to a server. Try `%s --help' for more information. Try uploading again (y/n)? Unknown ErrorUnlock given resourceUnlockingUnrecognised command. Type 'help' for a list of commands. Unsets or clears value from option.Upload local fileUpload many local filesUploading %s to `%s':Uploading changes to `%s'Use: chexec + %s to make the resource executable or chexec - %s to make the resource unexecutable Username: Value of %s is: %s When %s multiple resources, the last argument must be a collection. You cannot edit a collection resource (%s). [Matching...] reconnecting: authentication failed. cancelled. cat remote...cd pathchexec [+|-] remotecollection is empty. connected. connection timed out. copycopy source... destcopyingcould not connect to server. delete remote...discover resourcedone)edit resourceexclusivefailed: %s get remote [local]help [command]infiniteinfinityinvalidis a collection resource. The `rm' command cannot be used to delete a collection. Use `rmcol %s' to delete this collection and ALL its contents. is not a collection. The `rmcol' command can only be used to delete collections. Use `rm %s' to delete this resource. lcd [directory]less remote...lls [options]lock resourcels [path]mget remote...mkcol remote...movemove source... destmovingmput local...okay [okay.put local [remote]rmcol remote...set [option] [value]sharedsteal resourcesucceeded. unknownunlock resourceunset [option] [value]writeProject-Id-Version: cadaver 0.22 Report-Msgid-Bugs-To: cadaver@webdav.org POT-Creation-Date: 2009-12-15 22:22+0000 PO-Revision-Date: 2004-03-31 15:01+0200 Last-Translator: Cristian Rigamonti Language-Team: Italian MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Autenticazione interrotta! Progresso: [ Trasferimento scaduto, riconnessione... (riconnessione...(nessuno)1 corrispondenza.] : %s : %s Alias: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye Autenticazione interrotta! Autenticazione richiesta per %s sul server proxy "%s": Autenticazione richiesta per %s sul server "%s": Autorizzazione richiestaModifica la proprietà "isexecutable" per una risorsaCambia la directory di lavoro localeEntra nella collezione specificataSono stati effettuati cambiamenti. Chiude la connessione in corsoColl:Nome di comando sconosciuto: %s Connessione al server... Connessione a "%s" chiusa. Copia risorse dall'origine alla destinazioneCopia di "%s" in "%s": Impossibile accedere a %s (non abilitato per WebDAV?): %s Impossibile cambiare la directory locale: chdir: %s Impossibile creare il file temporaneo %s: %s Impossibile cancellare il file temporaneo %s: %s Impossibile determinare la directory home dall'ambiente. Impossibile recuperare la proprietà: %d %s Impossibile aprire il file: %s Impossibile leggere l'URL "%s" Impossibile ri-aprire il file temporaneo: %s Impossibile leggere il file di configurazione %s: %s Impossibile impostare i permessi sul file %s: %s Impossibile fare stat sul file: %s Crea una o più collezioni remoteCancella risorse (non collezioni)Cancella collezioni remote e TUTTI i loro contenutiCancellazioneCancellazione della collezioneNessuna collezione trovata.Mostra i lock suMostra un messaggio di aiutoMostra la lista dei lock possedutiMostra l'elenco della directory localeMostra le informazioni di lock per la risorsaMostra il nome della collezione correnteMostra una risorsa remota attraverso il paginatoreMostra una o più risorse remoteVisualizzazione di "%s": Scarica molte risorse remoteScarica una risorsa remotaScaricamento di "%s" in %sScaricamento di "%s" in %s:Modifica la risorsa specificataInserire il nome di file locale per "%s": Inserire il token del lock: Occorre impostare la variabile di ambiente $HOME! Errore nell'esecuzione di ls: %s Errore nel fork di ls: %s Errore nella scrittura del file temporaneo: %s Errore! Impossibile esaminare il file temporaneo: %s Errore! Impossibile eseguire il paginatore "%s": %s Errore: %-30s %d %s Esce dal programmaFallito su %s: %d %s Fallito: %s Recupero delle proprietà perErrore ignorato: %s non è abilitato per WebDAV: %s Elenca il contenuto della collezione corrente [o di un'altra]Elenco della collezioneDirectory locale: %s Fa il lock della risorsa specificataLock in corsoRicerca dell'hostname... Sposta risorse dall'origine alla destinazioneSpostamento di "%s" in "%s": Nessun cambiamento effettuato. Nessun lock posseduto. Apre la connessione all'URL specificatoPassword: Mostra la directory di lavoro localeRedirezioneRif:Recupera le proprietà di una risorsaNuovo tentativo [Nuovo tentativo:Errore del serverIl server non ha restituito alcun risultato per %s Imposta un'opzione o mostra le opzioniImposta le proprietà su una risorsaImpostazione di isexecutableRuba il lock per la risorsaRuba i lock suTerminato dal segnale %d. Il comando "%s" può essere usato solo se si è connessi al server. Provare prima `open' (si veda `help open' per maggiori dettagli). Il comando "%s" richiede %d argomenti%sIl comando "%s" richiede al massimo %d argomenti%sIl comando "%s" non richiede argomentiIl server non supporta la proprietà 'isexecutable'.Questo comando può essere usato solo se si è connessi a un server. Usare "%s --help" per maggiori informazioni. Provare a caricare un'altra volta (y/n)? Errore sconosciutoRimuove il lock dalla risorsa specificataRimozione del lock in corsoComando sconosciuto. Usare "help" per la lista dei comandi. Disabilita o cancella il valore di un'opzioneCarica un file localeCarica molti file localiCaricamento di %s in "%s":Caricamento delle modifiche a "%s"Uso: chexec + %s per rendere la risorsa eseguibile o chexec - %s per rendere la risorsa non eseguibile Nome utente: Il valore di %s è: %s Quando si %s più risorse, l'ultimo argomento dev'essere una collezione. Impossibile modificare una collezione (%s). [Ricerca corrispondenze...] riconnessione: autenticazione fallita. cancellato. cat remoto...cd percorsochexec [+|-] remotola collezione è vuota. connesso. connessione scaduta. copiacopy origine... destinazionecopianoimpossibile connettersi al server. delete remoto...discover risorsafatto)edit risorsaesclusivofallito: %s get remoto [locale]help [comando]infinitoinfinitàinvalidoè una collezione. Il comando `rm' non può essere usato per cancellare una collezione. Si usi `rmcol %s' per cancellare questa collezione e TUTTI i suoi contenuti. non è una collezione. Il comando `rmcol' può essere usato solo per cancellare collezioni. Si usi `rm %s' per cancellare questa risorsa. lcd [directory]less remoto...lls [opzioni]lock risorsals [percorso]mget remoto...mkcol remoto...spostamove origine... destinazionespostanomput locale...ok [ok.put locale [remoto]rmcol remoto...set [opzione] [valore]condivisosteal risorsacompletata. sconosciutounlock risorsaunset [opzione] [valore]scritturacadaver-0.23.3/po/en@quot.gmo0000664000076400007640000007762211312007543015375 0ustar jortonjortonÞ•{ô ýÌÀÁáû  %" H b } › ª ¶ È %Ù ÿ )!#B!f!€!,š!Ç!%å!, "-8" f"&‡"®"Ê"è"#(# /# :#LG#”#­#5Ã#/ù#)$@$#X$|$"“$9¶$(ð$%8%W%k% ‚% Ž%›%³%&Ï%ö%&&1&J&\&q&$&²&.É&*ø&$#',H'u')‡'!±'Ó'8ï'((G('_('‡(!¯(5Ñ(;) C)=d)¢)¹)Ó)ò) *%*(@*$i*Ž*%«*+Ñ*'ý*%+D+^+*{+'¦+Î+é+,"$,G,#b,4†,»,Ú,÷,-.-*J-u-'Ž-¶-Ò-î-÷-{./!¦/È/*æ/00.0C0#_0;ƒ0A¿081F:1=1¿1Ô1é12%%2"K2%n2”2¯2-Á2ï23'3>3,V3ƒ3—3·3,É3ö34$4$C4,h4&•4¼4 Ð4Ý4 ò4þ45.5L5e5)t5)ž5È5"à5V6Z6 v6—6!¶6Ø6ç6'ö6 7 (7.67e7x77S¡7õ7ý7 818$I8n8'„8E¬8+ò8#98B9{9’9£9¼9 Ù9*ä9:-:F:O:-T:(‚:1«:'Ý:;";A; a; l;v;#;,±;Þ; ÷;:<@<Y<&n<•<¬< È<3Õ<( =C2=$v=%›=!Á=ã=ü=>0> D>+e>‘>­>Ë> Ý>é>}?'?,©?#Ö?8ú?:3@-n@&œ@Ã@ß@'ù@ !A%/A UAcA#xAœA ²A:¼A#÷AB-BEB[BuBixD âD íDûDE "E:-E1hEDšEßE0þE,/F \FiFxF ‹F™F¨F¹F¿FÅFàFøF G G(G0GMGeG+‚G®G¿GÑGåGûG HH6HMHRHfHnH(ŒHµH*ÏHúH II #I 1I ;IGIOIbIqI‚I“I%¨I*ÎIùIJ" J.J6J‘NJvàJWK$mK’K¢K ±K ¿K ÍK×K%æK L-L=LBLVL ]LkLLŽL•L›L°LÇLâLõLM$M@M[M kMxMM”M2´MçM öMNN%NCNSNlNƒN•Nd›NP P:P TP%aP‡P¡P¼PÎPÞP íPùP Q%QBQ)[Q#…Q©QÃQ0ÝQ!R)0R0ZR1‹R$½R&âR S%S#CS#gS‹S ’S SLªS÷ST9&T3`T”T«T#ÃTçT"þTA!U(cUŒU«UÊUÞU õU VV&V&BViV‚VˆV¤V½VÏVäV$W)W.HW*wW$¢W,ÇWôW-X!4XVX8rX«XÊX'âX' Y!2Y5TY;ŠY ÆY=çY%Zc-Tc‚c¡cºcÕc,ñcd#2dVd,hd•d­dÃd$âd,e*4e_e se€e •e¡e¹eÑeïef)f)Afkf"ƒfV¦fýf g>g!]ggŽg'g Åg Ïg.Ýg hh4hWHh h¨h »hÜh$ôhi'7iE_i+¥i#Ñi8õi.jEjVjoj Œj*—jÂjàjùjk-k(5k1^k'k¸k"Ñkôk l l)l#@l,dl‘l ªl:¸lól m&!mHm_m {m3ˆm(¼mCåm$)n%Nn!tn–n¯nÎnãn ÷n+oDo`o~o oœo‰¶o+@p0lp'p<Åp:q-=q*kq–q²q'Ìq ôq%r (r6r#Kror …r>r#Îròrss6sTsi[u Åu ÐuÞuòu v>v1OvDvÆv0åv,w CwPw_w rw€ww w¦w¬wÇwßw õw xxx4xLx+ix•x¦x¸xÌxâx øxyy4y9yMyUy(syœy*¶yáyòyz z z "z.z6zIzXzizzz%z*µzàzéz"òz{{™5{~Ï{N|$d|‰|™| ¨| ¶| Ä|Î|%Ý| }$}4}9}M} T}b}v}…}Œ}’}§}¾}Ù}ì}ü}$~7~R~ b~o~„~‹~2«~Þ~ í~ù~ %:JczŒHBN e\ö 6/÷Cu "KM6ë›¶áX£`+Œ¯þ²¾Èk™° 8ÔÆoé}mw±§¼_ÒØ!âô—]îÏb‹ÇõdPaC©³¢¥ÝQ;zlHk®!fG5>DP{ùž×ºiu4A¡¸n,Þe.)úAUü¬pûÛ0Oòx>FcÎÌV0~øÂ råY'ÿ É;J5‚p»˜@Z%RSi&T@SµzUF^ñdKa­ío%j8[J{' cý lày<( qãhrÁˆ`(g_çÙ9<ì)+2ŠÀ¤ ’Eq†è-¹–sÍ2¦3‘, #b$7WšÅŽïRy¨-Ë¿E?=‡|VXjêðm?«O‰œ*Ÿ´Zó]ÑGÄx„ÃDvÜ^L=1æ#½*Õ [Ú3&:7:YQ WÓ•äMf4Lw·.sƒ/”$ª91nvT\NIIÐ"tÊ…ÖB€tghß“ Caught SIGINT... bailing out. Authentication aborted! Password too long (>%d) Progress: [ Transfer timed out, reconnecting... Username too long (>%d) %d version%s in history: (reconnecting... `%s' %s %ld matches.] %ld seconds%s %s failed: %s %s: %s (code %d)%s: %s and %s are the same resource. %s: connection timed out%s: connection was closed by proxy server%s: connection was closed by server%s: illegal option -- %c %s: invalid option -- %c %s: option `%c%s' doesn't allow an argument %s: option `%s' is ambiguous %s: option `%s' requires an argument %s: option `--%s' doesn't allow an argument %s: option `-W %s' doesn't allow an argument %s: option `-W %s' is ambiguous %s: option requires an argument -- %c %s: unrecognized error (%u)%s: unrecognized failure (%u)%s: unrecognized option `%c%s' %s: unrecognized option `--%s' (none)1 match.] : %s : %s Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye Authentication aborted! Authentication failedAuthentication required for %s on proxy server `%s': Authentication required for %s on server `%s': Authorization RequiredCancelling check out ofCertificate is valid from %s to %s Certificate rejected. Certificate verification error: %sCertificate was issued to hostname `%s' rather than `%s' Change isexecutable property of resourceChange local working directoryChange to specified collectionChanges were made. Checkin given resourceChecking inChecking outCheckout given resourceChunk delimiter was invalidClient certificate verification failedClose current connectionColl:Command name not known: %s Connecting to server... Connection closedConnection timed outConnection to `%s' closed. Copy resource(s) from source to destCopying `%s' to `%s': Could not access %s (not WebDAV-enabled?): %s Could not authenticate to proxy server: %sCould not authenticate to server: %sCould not change local directory: chdir: %s Could not connectCould not connect to `%s' on port %d: %s Could not connect to proxy serverCould not connect to serverCould not create SSL connection through proxy server: %sCould not create SSL structureCould not create socketCould not create temporary file %s: %s Could not delete temporary file %s: %s Could not determine file size: %sCould not determine home directory from environment. Could not establish connection from SOCKS proxy (%s:%u): %sCould not fetch property: %d %s Could not find IPv4 address of hostname %s for SOCKS v4 proxyCould not inflate dataCould not initialize zlibCould not open collection: %s Could not open file: %s Could not parse URL `%s' Could not parse chunk sizeCould not parse redirect destination URLCould not parse response status lineCould not parse response: %sCould not re-open temporary file: %s Could not read FQDN length in connect replyCould not read address in connect replyCould not read chunk delimiterCould not read chunk sizeCould not read connect replyCould not read initial response from proxyCould not read interim response headersCould not read login replyCould not read rcfile %s: %s Could not read response bodyCould not read response from proxyCould not read status lineCould not resolve hostname `%s': %sCould not seek to offset %s of request body file: %sCould not send connect requestCould not send login messageCould not send message to proxyCould not send requestCould not send request bodyCould not set file permissions for %s: %s Could not stat file: %s Could not verify server certificate: %sCould not write to file: %sCreate remote collection(s)CreatingCurrent collection is `%s'. DASL Search resource in current collection Examples: - search where content length is smaller than 100: > search getcontentlength < 100 - search where author is Smith or Jones > search author = Smith or author = Jones Available operators and keywords: - and, or , (, ), =, <, >, <=, >=, like (See also variables searchdepth, searchorder, searchdorder) Decryption password: Delete non-collection resource(s)Delete property from resourceDelete remote collections and ALL contentsDeletingDeleting collectionDeleting property onDescribe an option variableDid not find a collection resource.Digest mutual authentication failure: client nonce mismatchDigest mutual authentication failure: could not parse nonce countDigest mutual authentication failure: missing parametersDigest mutual authentication failure: nonce count mismatch (%u not %u)Digest mutual authentication failure: request-digest mismatchDiscovering locks onDisplay help messageDisplay list of owned locksDisplay local directory listingDisplay lock information for resourceDisplay name of current collectionDisplay remote resource through pagerDisplay remote resource(s)Displaying `%s': Do you wish to accept the certificate? (y/n) Download many remote resourcesDownload remote resourceDownloading `%s' to %sDownloading `%s' to %s:ERROR: no support for getpassword() routine Edit given resourceEnter local filename for `%s': Enter locktoken: Environment variable $HOME needs to be set! Error executing ls: %s Error forking ls: %s Error reading response headersError writing to temporary file: %s Error! Could not examine temporary file: %s Error! Could not spawn pager `%s': %s Error: %-30s %d %s Exit programFailed on %s: %d %s Failed: %s Fetching properties forFetching property namesGSSAPI authentication error: GSSAPI failure (code %u)Host not foundIgnored error: %s not WebDAV-enabled: %s Information about this version of cadaverInvalid Byte Order MarkInvalid Content-Length in responseInvalid HTTP status line in status element at line %d of response: Status line was: %sInvalid action `%s' given. Invalid version in connect replyInvalid version in login replyInvalid version in proxy responseIssued by: %s Issued to: %s LOCK response missing Lock-Token headerLabellingLine too longList contents of current [or other] collectionListing collectionLocal directory: %s Lock given resourceLock token <%s>: Depth %s on `%s' Scope: %s Type: %s Timeout: %s Owner: %s LockingLocking collectionLogout of authentication sessionLooking up hostname... Move resource(s) from source to destMoving `%s' to `%s': Names of properties defined on resourceNegotiate response verification failed: invalid response header tokenNegotiate response verification failure: %sNo acceptable authentication methodNo activelock for <%s> returned in LOCK refresh responseNo changes were made. No owned locks. No previous collection. Open connection to given URLPassword: Place given resource under version controlPrint local working directoryRange is not satisfiableRedirectRef:Resource does not support ranged GET requestsResponse did not include requested rangeResponse exceeded maximum number of header fieldsResponse exceeds maximum property countResponse header too longResponse missing activelock for %sRetrieve properties of resourceRetrying [Retrying:SSL alert received: %sSSL disabled due to lack of entropySSL disabled due to library version mismatchSSL error code %d/%d/%luSSL error: %sSSL handshake failed, client certificate was requested: %sSSL handshake failed: %sSSL is not enabled. SSL server did not present certificateSSL socket read failedSecure connection truncatedServer ErrorServer certificate changed: connection intercepted?Server certificate verification failed: Server certificate was missing commonName attribute in subject nameServer did not return result for %s Server did not send certificate chainSet an option, or display optionsSet property on resourceSet/Del/Edit label on resourceSetting isexecutableSetting property onShow version history of resourceSocket descriptor number exceeds FD_SETSIZESocket family not supportedSteal lock token for resourceStealing locks onTTL expiredTerminated by signal %d. The `%s' command can only be used when connected to the server. Try running `open' first (see `help open' for more details). The `%s' command requires %d argument%sThe `%s' command takes at most %d argument%sThe `%s' command takes no argumentsThe server does not support the 'isexecutable' property.This command can only be used when connected to a server. This connection could have been intercepted. Try `%s --help' for more information. Try uploading again (y/n)? Uncheckout given resourceUnexpected authentication method chosenUnknown ErrorUnknown address type in connect replyUnknown errorUnknown system errorUnknown transfer-coding in responseUnlock given resourceUnlockingUnrecognised command. Type 'help' for a list of commands. Unsets or clears value from option.Upload local fileUpload many local filesUploading %s to `%s':Uploading changes to `%s'Usage: %s [OPTIONS] http://hostname[:port]/path Port defaults to 80, path defaults to '/' Options: -t, --tolerant Allow cd/open into non-WebDAV enabled collection. -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc. -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port PORT. -V, --version Display version information. -h, --help Display this help message. Please send bug reports and feature requests to Use: chexec + %s to make the resource executable or chexec - %s to make the resource unexecutable Username: Using query: Value of %s is: %s Version history ofVersioningWARNING: Untrusted server certificate presented for `%s': WARNING: Untrusted server certificate presented: When %s multiple resources, the last argument must be a collection. XML parse error at line %d: %sXML parse error at line %d: invalid element nameYou cannot edit a collection resource (%s). [Matching...[invalid date][unprintable:#%lu][unprintable]] %5.1f%% of %] reconnecting: ^[nN]^[yY]address type not supportedauthentication failed. bad certificate chaincancelled. cat remote...cd pathcertificate has been revokedcertificate has expiredcertificate is not yet validcertificate issued for a different hostnamecheckin resourcecheckout resourcechexec [+|-] remotecollection is empty. command not supportedconnected. connection not permittedconnection timed out. copycopy source... destcopyingcould not connect to server. could not establish connection to identdcould not parse challengecould not parse domain in Digest challengedelete remote...discover resourcedone)edit resourceexclusivefailed: %s failureget remote [local]help [command]history resourcehost unreachableignored %s challengeignoring empty Negotiate continuationincompatible algorithm in Digest challengeinfiniteinfinityinitial Digest challenge was staleinvalidinvalid Negotiate tokenis a collection resource. The `rm' command cannot be used to delete a collection. Use `rmcol %s' to delete this collection and ALL its contents. is not a collection. The `rmcol' command can only be used to delete collections. Use `rm %s' to delete this resource. issuer is not trustedlabel res [add|set|remove] labelnamelcd [directory]less remote...lls [options]lock resourcels [path]mget remote...missing parameter in Digest challengemissing realm in Basic challengemkcol remote...movemove source... destmovingmput local...network unreachableoffset invalidokay [okay.propdel res propnamepropget res [propname]propset res propname valueput local [remote]redirect to %s rejected %s challengerejected due to identd user mismatchrequest rejected or failedrmcol remote...search queryset [option] [value]sharedsigned using insecure algorithmstale Digest challenge with new algorithm or realmsteal resourcesucceeded. uncheckin resourceunknownunknown algorithm in Digest challengeunlock resourceunrecognized errors (%u)unset [option] [value]verrsion resourcewriteProject-Id-Version: @PACKAGE@ @VERSION@ Report-Msgid-Bugs-To: cadaver@webdav.org POT-Creation-Date: 2009-12-15 22:22+0000 PO-Revision-Date: 2009-12-15 22:22+0000 Last-Translator: Automatically generated Language-Team: none MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Caught SIGINT... bailing out. Authentication aborted! Password too long (>%d) Progress: [ Transfer timed out, reconnecting... Username too long (>%d) %d version%s in history: (reconnecting... ‘%s’ %s %ld matches.] %ld seconds%s %s failed: %s %s: %s (code %d)%s: %s and %s are the same resource. %s: connection timed out%s: connection was closed by proxy server%s: connection was closed by server%s: illegal option -- %c %s: invalid option -- %c %s: option ‘%c%s’ doesn't allow an argument %s: option ‘%s’ is ambiguous %s: option ‘%s’ requires an argument %s: option ‘--%s’ doesn't allow an argument %s: option ‘-W %s’ doesn't allow an argument %s: option ‘-W %s’ is ambiguous %s: option requires an argument -- %c %s: unrecognized error (%u)%s: unrecognized failure (%u)%s: unrecognized option ‘%c%s’ %s: unrecognized option ‘--%s’ (none)1 match.] : %s : %s Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye Authentication aborted! Authentication failedAuthentication required for %s on proxy server ‘%s’: Authentication required for %s on server ‘%s’: Authorization RequiredCancelling check out ofCertificate is valid from %s to %s Certificate rejected. Certificate verification error: %sCertificate was issued to hostname ‘%s’ rather than ‘%s’ Change isexecutable property of resourceChange local working directoryChange to specified collectionChanges were made. Checkin given resourceChecking inChecking outCheckout given resourceChunk delimiter was invalidClient certificate verification failedClose current connectionColl:Command name not known: %s Connecting to server... Connection closedConnection timed outConnection to ‘%s’ closed. Copy resource(s) from source to destCopying ‘%s’ to ‘%s’: Could not access %s (not WebDAV-enabled?): %s Could not authenticate to proxy server: %sCould not authenticate to server: %sCould not change local directory: chdir: %s Could not connectCould not connect to ‘%s’ on port %d: %s Could not connect to proxy serverCould not connect to serverCould not create SSL connection through proxy server: %sCould not create SSL structureCould not create socketCould not create temporary file %s: %s Could not delete temporary file %s: %s Could not determine file size: %sCould not determine home directory from environment. Could not establish connection from SOCKS proxy (%s:%u): %sCould not fetch property: %d %s Could not find IPv4 address of hostname %s for SOCKS v4 proxyCould not inflate dataCould not initialize zlibCould not open collection: %s Could not open file: %s Could not parse URL ‘%s’ Could not parse chunk sizeCould not parse redirect destination URLCould not parse response status lineCould not parse response: %sCould not re-open temporary file: %s Could not read FQDN length in connect replyCould not read address in connect replyCould not read chunk delimiterCould not read chunk sizeCould not read connect replyCould not read initial response from proxyCould not read interim response headersCould not read login replyCould not read rcfile %s: %s Could not read response bodyCould not read response from proxyCould not read status lineCould not resolve hostname ‘%s’: %sCould not seek to offset %s of request body file: %sCould not send connect requestCould not send login messageCould not send message to proxyCould not send requestCould not send request bodyCould not set file permissions for %s: %s Could not stat file: %s Could not verify server certificate: %sCould not write to file: %sCreate remote collection(s)CreatingCurrent collection is ‘%s’. DASL Search resource in current collection Examples: - search where content length is smaller than 100: > search getcontentlength < 100 - search where author is Smith or Jones > search author = Smith or author = Jones Available operators and keywords: - and, or , (, ), =, <, >, <=, >=, like (See also variables searchdepth, searchorder, searchdorder) Decryption password: Delete non-collection resource(s)Delete property from resourceDelete remote collections and ALL contentsDeletingDeleting collectionDeleting property onDescribe an option variableDid not find a collection resource.Digest mutual authentication failure: client nonce mismatchDigest mutual authentication failure: could not parse nonce countDigest mutual authentication failure: missing parametersDigest mutual authentication failure: nonce count mismatch (%u not %u)Digest mutual authentication failure: request-digest mismatchDiscovering locks onDisplay help messageDisplay list of owned locksDisplay local directory listingDisplay lock information for resourceDisplay name of current collectionDisplay remote resource through pagerDisplay remote resource(s)Displaying ‘%s’: Do you wish to accept the certificate? (y/n) Download many remote resourcesDownload remote resourceDownloading ‘%s’ to %sDownloading ‘%s’ to %s:ERROR: no support for getpassword() routine Edit given resourceEnter local filename for ‘%s’: Enter locktoken: Environment variable $HOME needs to be set! Error executing ls: %s Error forking ls: %s Error reading response headersError writing to temporary file: %s Error! Could not examine temporary file: %s Error! Could not spawn pager ‘%s’: %s Error: %-30s %d %s Exit programFailed on %s: %d %s Failed: %s Fetching properties forFetching property namesGSSAPI authentication error: GSSAPI failure (code %u)Host not foundIgnored error: %s not WebDAV-enabled: %s Information about this version of cadaverInvalid Byte Order MarkInvalid Content-Length in responseInvalid HTTP status line in status element at line %d of response: Status line was: %sInvalid action ‘%s’ given. Invalid version in connect replyInvalid version in login replyInvalid version in proxy responseIssued by: %s Issued to: %s LOCK response missing Lock-Token headerLabellingLine too longList contents of current [or other] collectionListing collectionLocal directory: %s Lock given resourceLock token <%s>: Depth %s on ‘%s’ Scope: %s Type: %s Timeout: %s Owner: %s LockingLocking collectionLogout of authentication sessionLooking up hostname... Move resource(s) from source to destMoving ‘%s’ to ‘%s’: Names of properties defined on resourceNegotiate response verification failed: invalid response header tokenNegotiate response verification failure: %sNo acceptable authentication methodNo activelock for <%s> returned in LOCK refresh responseNo changes were made. No owned locks. No previous collection. Open connection to given URLPassword: Place given resource under version controlPrint local working directoryRange is not satisfiableRedirectRef:Resource does not support ranged GET requestsResponse did not include requested rangeResponse exceeded maximum number of header fieldsResponse exceeds maximum property countResponse header too longResponse missing activelock for %sRetrieve properties of resourceRetrying [Retrying:SSL alert received: %sSSL disabled due to lack of entropySSL disabled due to library version mismatchSSL error code %d/%d/%luSSL error: %sSSL handshake failed, client certificate was requested: %sSSL handshake failed: %sSSL is not enabled. SSL server did not present certificateSSL socket read failedSecure connection truncatedServer ErrorServer certificate changed: connection intercepted?Server certificate verification failed: Server certificate was missing commonName attribute in subject nameServer did not return result for %s Server did not send certificate chainSet an option, or display optionsSet property on resourceSet/Del/Edit label on resourceSetting isexecutableSetting property onShow version history of resourceSocket descriptor number exceeds FD_SETSIZESocket family not supportedSteal lock token for resourceStealing locks onTTL expiredTerminated by signal %d. The ‘%s’ command can only be used when connected to the server. Try running ‘open’ first (see ‘help open’ for more details). The ‘%s’ command requires %d argument%sThe ‘%s’ command takes at most %d argument%sThe ‘%s’ command takes no argumentsThe server does not support the ‘isexecutable’ property.This command can only be used when connected to a server. This connection could have been intercepted. Try ‘%s --help’ for more information. Try uploading again (y/n)? Uncheckout given resourceUnexpected authentication method chosenUnknown ErrorUnknown address type in connect replyUnknown errorUnknown system errorUnknown transfer-coding in responseUnlock given resourceUnlockingUnrecognised command. Type ‘help’ for a list of commands. Unsets or clears value from option.Upload local fileUpload many local filesUploading %s to ‘%s’:Uploading changes to ‘%s’Usage: %s [OPTIONS] http://hostname[:port]/path Port defaults to 80, path defaults to ‘/’ Options: -t, --tolerant Allow cd/open into non-WebDAV enabled collection. -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc. -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port PORT. -V, --version Display version information. -h, --help Display this help message. Please send bug reports and feature requests to Use: chexec + %s to make the resource executable or chexec - %s to make the resource unexecutable Username: Using query: Value of %s is: %s Version history ofVersioningWARNING: Untrusted server certificate presented for ‘%s’: WARNING: Untrusted server certificate presented: When %s multiple resources, the last argument must be a collection. XML parse error at line %d: %sXML parse error at line %d: invalid element nameYou cannot edit a collection resource (%s). [Matching...[invalid date][unprintable:#%lu][unprintable]] %5.1f%% of %] reconnecting: ^[nN]^[yY]address type not supportedauthentication failed. bad certificate chaincancelled. cat remote...cd pathcertificate has been revokedcertificate has expiredcertificate is not yet validcertificate issued for a different hostnamecheckin resourcecheckout resourcechexec [+|-] remotecollection is empty. command not supportedconnected. connection not permittedconnection timed out. copycopy source... destcopyingcould not connect to server. could not establish connection to identdcould not parse challengecould not parse domain in Digest challengedelete remote...discover resourcedone)edit resourceexclusivefailed: %s failureget remote [local]help [command]history resourcehost unreachableignored %s challengeignoring empty Negotiate continuationincompatible algorithm in Digest challengeinfiniteinfinityinitial Digest challenge was staleinvalidinvalid Negotiate tokenis a collection resource. The ‘rm’ command cannot be used to delete a collection. Use ‘rmcol %s’ to delete this collection and ALL its contents. is not a collection. The ‘rmcol’ command can only be used to delete collections. Use ‘rm %s’ to delete this resource. issuer is not trustedlabel res [add|set|remove] labelnamelcd [directory]less remote...lls [options]lock resourcels [path]mget remote...missing parameter in Digest challengemissing realm in Basic challengemkcol remote...movemove source... destmovingmput local...network unreachableoffset invalidokay [okay.propdel res propnamepropget res [propname]propset res propname valueput local [remote]redirect to %s rejected %s challengerejected due to identd user mismatchrequest rejected or failedrmcol remote...search queryset [option] [value]sharedsigned using insecure algorithmstale Digest challenge with new algorithm or realmsteal resourcesucceeded. uncheckin resourceunknownunknown algorithm in Digest challengeunlock resourceunrecognized errors (%u)unset [option] [value]verrsion resourcewritecadaver-0.23.3/po/en@boldquot.header0000664000076400007640000000247110355466427016712 0ustar jortonjorton# All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # # This catalog furthermore displays the text between the quotation marks in # bold face, assuming the VT100/XTerm escape sequences. # cadaver-0.23.3/po/Makevars.template0000664000076400007640000000341610355466427016572 0ustar jortonjorton# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Free Software Foundation, Inc. # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = cadaver-0.23.3/configure0000775000076400007640000326176011312007552014550 0ustar jortonjorton#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for cadaver 0.23.3. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 # PATH needs CR # 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_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 if (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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false 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. 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); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. 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 # Name of the executable. 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'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF 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 : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF 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_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. 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 { (exit 1); exit 1; }; } # 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 } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi 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 -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' 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=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, 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= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='cadaver' PACKAGE_TARNAME='cadaver' PACKAGE_VERSION='0.23.3' PACKAGE_STRING='cadaver 0.23.3' PACKAGE_BUGREPORT='cadaver@webdav.org' ac_unique_file="src/cadaver.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" gt_needs= ac_subst_vars='LTLIBOBJS POSUB LTLIBINTL LIBINTL INTLLIBS INTL_LIBTOOL_SUFFIX_PREFIX INTLOBJS GENCAT INSTOBJEXT DATADIRNAME CATOBJEXT USE_INCLUDED_LIBINTL BUILD_INCLUDED_LIBINTL LTLIBC WINDRES WOE32 WOE32DLL HAVE_WPRINTF HAVE_SNPRINTF HAVE_ASPRINTF HAVE_POSIX_PRINTF INTL_MACOSX_LIBS GLIBC21 INTLBISON LTLIBICONV LIBICONV LTLIBMULTITHREAD LIBMULTITHREAD LTLIBTHREAD LIBTHREAD LIBPTH_PREFIX LTLIBPTH LIBPTH PRI_MACROS_BROKEN ALLOCA HAVE_VISIBILITY CFLAG_VISIBILITY GLIBC2 host_os host_vendor host_cpu host build_os build_vendor build_cpu build XGETTEXT_EXTRA_OPTIONS MSGMERGE XGETTEXT_015 XGETTEXT GMSGFMT_015 MSGFMT_015 GMSGFMT MSGFMT GETTEXT_MACRO_VERSION USE_NLS mkdir_p MKDIR_P NEON_LINK_FLAGS NEON_EXTRAOBJS NEONOBJS NEON_OBJEXT NEON_TARGET NE_FLAG_DAV AR XML2_CONFIG NEON_BUILD_BUNDLED NEON_LTLIBS NEON_LIBS NEON_CFLAGS NE_FLAG_LIBPXY KRB5_CONFIG NEON_SUPPORTS_SSL GNUTLS_CONFIG PKG_CONFIG LIBOBJS NE_FLAG_TS_SSL NE_FLAG_LFS NE_FLAG_IPV6 NE_FLAG_ZLIB NE_FLAG_SSL NEON_CONFIG EGREP GREP CPP RANLIB SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC 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 localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_libs enable_debugging enable_readline enable_netrc with_included_neon with_neon with_ssl with_egd with_pakchois with_ca_bundle enable_threadsafe_ssl with_gssapi with_libproxy with_libxml2 with_expat with_included_expat enable_nls enable_threads with_gnu_ld enable_rpath with_libpth_prefix with_libiconv_prefix with_included_gettext with_libintl_prefix enable_warnings ' ac_precious_vars='build_alias host_alias target_alias 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' 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=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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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 ;; -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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $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 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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } 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 $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 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_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # 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_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } 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 cadaver 0.23.3 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] --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/cadaver] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF 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 cadaver 0.23.3:";; 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] --disable-debugging disable runtime debugging messages --disable-readline disable readline support --disable-netrc enable .netrc support --enable-threadsafe-ssl=posix enable SSL library thread-safety using POSIX threads: suitable CC/CFLAGS/LIBS must be used to make the POSIX library interfaces available --disable-nls do not use Native Language Support --enable-threads={posix|solaris|pth|win32} specify multithreading API --disable-threads build without multithread safety --disable-rpath do not hardcode runtime library paths --enable-warnings enable compiler warnings Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-libs=DIR[:DIR2...] look for support libraries in DIR/{bin,lib,include} --with-included-neon force use of included neon library --with-neon[=DIR] specify location of neon library --with-ssl=openssl|gnutls enable SSL support (default OpenSSL) --with-egd[=PATH] enable EGD support [using EGD socket at PATH] --without-pakchois disable support for PKCS#11 using pakchois --with-ca-bundle specify filename of an SSL CA root bundle --without-gssapi disable GSSAPI support --without-libproxy disable libproxy support --with-libxml2 force use of libxml 2.x --with-expat force use of expat --with-included-expat use bundled expat sources --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libpth-prefix[=DIR] search for libpth in DIR/include and DIR/lib --without-libpth-prefix don't search for libpth in includedir and libdir --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-included-gettext use the GNU gettext library included here --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir Some influential environment variables: 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 C/C++/Objective 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 . _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 cadaver configure 0.23.3 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 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 cadaver $as_me 0.23.3, which was generated by GNU Autoconf 2.63. 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) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$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 ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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 cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX 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:$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= ;; #( *) $as_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 cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX 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 cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX 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 cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX 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'; { (exit 1); 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 # 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 # 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 ac_site_file1=$CONFIG_SITE 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 -r "$ac_site_file"; then { $as_echo "$as_me:$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" 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. if test -f "$cache_file"; then { $as_echo "$as_me:$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:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi gt_needs="$gt_needs " # 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:$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:$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:$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:$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:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$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. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } 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_config_headers="$ac_config_headers config.h" cat >>confdefs.h <<\_ACEOF #define _GNU_SOURCE 1 _ACEOF # Check whether --with-libs was given. if test "${with_libs+set}" = set; then withval=$with_libs; case $with_libs in yes|no) { { $as_echo "$as_me:$LINENO: error: --with-libs must be passed a directory argument" >&5 $as_echo "$as_me: error: --with-libs must be passed a directory argument" >&2;} { (exit 1); exit 1; }; } ;; *) ne_save_IFS=$IFS; IFS=: for dir in $with_libs; do ne_add_CPPFLAGS="$ne_add_CPPFLAGS -I${dir}/include" ne_add_LDFLAGS="$ne_add_LDFLAGS -L${dir}/lib" ne_add_PATH="${ne_add_PATH}${dir}/bin:" PKG_CONFIG_PATH=${PKG_CONFIG_PATH}${PKG_CONFIG_PATH+:}${dir}/lib/pkgconfig done IFS=$ne_save_IFS CPPFLAGS="${ne_add_CPPFLAGS} $CPPFLAGS" LDFLAGS="${ne_add_LDFLAGS} $LDFLAGS" PATH=${ne_add_PATH}$PATH export PKG_CONFIG_PATH ;; esac 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 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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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 { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* 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" 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac 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:$LINENO: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if test "${ac_cv_search_strerror+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_strerror=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_strerror+set}" = set; then break fi done if test "${ac_cv_search_strerror+set}" = set; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 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 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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* 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" 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac 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_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_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } 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:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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:$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' 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:$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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; 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:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$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 RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" 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:$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 test "${ac_cv_prog_CPP+set}" = set; 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f 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:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } 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:$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 test "${ac_cv_path_GREP+set}" = set; 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" { test -f "$ac_path_GREP" && $as_test_x "$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 ac_count=`expr $ac_count + 1` 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_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; 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" { test -f "$ac_path_EGREP" && $as_test_x "$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 ac_count=`expr $ac_count + 1` 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_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : 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 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # Check whether --enable-debugging was given. if test "${enable_debugging+set}" = set; then enableval=$enable_debugging; else enable_debug=yes fi if test "$enable_debug" = "yes"; then cat >>confdefs.h <<\_ACEOF #define NE_DEBUGGING 1 _ACEOF 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` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --enable-readline was given. if test "${enable_readline+set}" = set; then enableval=$enable_readline; use_readline=$enableval else use_readline=yes fi if test "$use_readline" = "yes"; then { $as_echo "$as_me:$LINENO: checking for tputs in -lcurses" >&5 $as_echo_n "checking for tputs in -lcurses... " >&6; } if test "${ac_cv_lib_curses_tputs+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 tputs (); int main () { return tputs (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_curses_tputs=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_tputs=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tputs" >&5 $as_echo "$ac_cv_lib_curses_tputs" >&6; } if test "x$ac_cv_lib_curses_tputs" = x""yes; then LIBS="$LIBS -lcurses" else { $as_echo "$as_me:$LINENO: checking for tputs in -lncurses" >&5 $as_echo_n "checking for tputs in -lncurses... " >&6; } if test "${ac_cv_lib_ncurses_tputs+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 tputs (); int main () { return tputs (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_ncurses_tputs=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_tputs=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tputs" >&5 $as_echo "$ac_cv_lib_ncurses_tputs" >&6; } if test "x$ac_cv_lib_ncurses_tputs" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBNCURSES 1 _ACEOF LIBS="-lncurses $LIBS" fi fi { $as_echo "$as_me:$LINENO: checking for readline in -lreadline" >&5 $as_echo_n "checking for readline in -lreadline... " >&6; } if test "${ac_cv_lib_readline_readline+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 readline (); int main () { return readline (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_readline_readline=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_readline=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5 $as_echo "$ac_cv_lib_readline_readline" >&6; } if test "x$ac_cv_lib_readline_readline" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBREADLINE 1 _ACEOF LIBS="-lreadline $LIBS" fi { $as_echo "$as_me:$LINENO: checking for library containing add_history" >&5 $as_echo_n "checking for library containing add_history... " >&6; } if test "${ac_cv_search_add_history+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 add_history (); int main () { return add_history (); ; return 0; } _ACEOF for ac_lib in '' history; 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_add_history=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_add_history+set}" = set; then break fi done if test "${ac_cv_search_add_history+set}" = set; then : else ac_cv_search_add_history=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_add_history" >&5 $as_echo "$ac_cv_search_add_history" >&6; } ac_res=$ac_cv_search_add_history if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_ADD_HISTORY 1 _ACEOF fi for ac_header in history.h readline/history.h readline.h readline/readline.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check for rl_completion_matches as in readline 4.2 for ac_func in rl_completion_matches do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done msg_readline="enabled" else msg_readline="disabled" fi # Check whether --enable-netrc was given. if test "${enable_netrc+set}" = set; then enableval=$enable_netrc; else enable_netrc=yes fi # Turn off ACL support neon_no_acl=yes { $as_echo "$as_me:$LINENO: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if test "${ac_cv_c_inline+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_inline=$ac_kw else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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 { $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* 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. */ char *t; 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 saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const /**/ _ACEOF fi { $as_echo "$as_me:$LINENO: checking for size_t" >&5 $as_echo_n "checking for size_t... " >&6; } if test "${ac_cv_type_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_size_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (size_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((size_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 $as_echo "$ac_cv_type_size_t" >&6; } if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:$LINENO: checking for off_t" >&5 $as_echo_n "checking for off_t... " >&6; } if test "${ac_cv_type_off_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_off_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (off_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((off_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 $as_echo "$ac_cv_type_off_t" >&6; } if test "x$ac_cv_type_off_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi # Check for Darwin, which needs extra cpp and linker flags. { $as_echo "$as_me:$LINENO: checking for uname" >&5 $as_echo_n "checking for uname... " >&6; } if test "${ne_cv_os_uname+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_os_uname=`uname -s 2>/dev/null` fi { $as_echo "$as_me:$LINENO: result: $ne_cv_os_uname" >&5 $as_echo "$ne_cv_os_uname" >&6; } if test "$ne_cv_os_uname" = "Darwin"; then CPPFLAGS="$CPPFLAGS -no-cpp-precomp" LDFLAGS="$LDFLAGS -flat_namespace" # poll has various issues in various Darwin releases if test x${ac_cv_func_poll+set} != xset; then ac_cv_func_poll=no fi fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if test "${ac_cv_sizeof_int+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (int)); } static unsigned long int ulongval () { return (long int) (sizeof (int)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (int))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (int)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (int)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_int=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if test "${ac_cv_sizeof_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (long)); } static unsigned long int ulongval () { return (long int) (sizeof (long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if test "${ac_cv_sizeof_long_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (long long)); } static unsigned long int ulongval () { return (long int) (sizeof (long long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (long long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (long long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (long long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF if test "$GCC" = "yes"; then { $as_echo "$as_me:$LINENO: checking for gcc -Wformat -Werror sanity" >&5 $as_echo_n "checking for gcc -Wformat -Werror sanity... " >&6; } if test "${ne_cv_cc_werror+set}" = set; then $as_echo_n "(cached) " >&6 else # See whether a simple test program will compile without errors. ne_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -Wformat -Werror" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { int i = 42; printf("%d", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_cc_werror=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_cv_cc_werror=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS=$ne_save_CPPFLAGS fi { $as_echo "$as_me:$LINENO: result: $ne_cv_cc_werror" >&5 $as_echo "$ne_cv_cc_werror" >&6; } ne_fmt_trycompile=$ne_cv_cc_werror else ne_fmt_trycompile=no fi # These checks are done whether or not the bundled neon build # is used. if test "${ac_cv_header_minix_config_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 $as_echo_n "checking for minix/config.h... " >&6; } if test "${ac_cv_header_minix_config_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 $as_echo "$ac_cv_header_minix_config_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5 $as_echo_n "checking minix/config.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5 $as_echo_n "checking minix/config.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 $as_echo_n "checking for minix/config.h... " >&6; } if test "${ac_cv_header_minix_config_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_minix_config_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 $as_echo "$ac_cv_header_minix_config_h" >&6; } fi if test "x$ac_cv_header_minix_config_h" = x""yes; then MINIX=yes else MINIX= fi if test "$MINIX" = yes; then cat >>confdefs.h <<\_ACEOF #define _POSIX_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_1_SOURCE 2 _ACEOF cat >>confdefs.h <<\_ACEOF #define _MINIX 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test "${ac_cv_safe_to_define___extensions__+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_safe_to_define___extensions__=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && cat >>confdefs.h <<\_ACEOF #define __EXTENSIONS__ 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _GNU_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _TANDEM_SOURCE 1 _ACEOF for ac_header in errno.h stdarg.h string.h stdlib.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } if test "${ac_cv_sizeof_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_size_t=$ac_lo;; '') if test "$ac_cv_type_size_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_size_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (size_t)); } static unsigned long int ulongval () { return (long int) (sizeof (size_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (size_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (size_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (size_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_size_t=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_size_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_size_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 $as_echo "$ac_cv_sizeof_size_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SIZE_T $ac_cv_sizeof_size_t _ACEOF { $as_echo "$as_me:$LINENO: checking how to print size_t" >&5 $as_echo_n "checking how to print size_t... " >&6; } if test "${ne_cv_fmt_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_size_t=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in u lu llu; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { size_t i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_size_t=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_size_t in $ac_cv_sizeof_int) ne_cv_fmt_size_t="u" ;; $ac_cv_sizeof_long) ne_cv_fmt_size_t="lu" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_size_t="llu" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_size_t" >&5 $as_echo "$ne_cv_fmt_size_t" >&6; } if test "x$ne_cv_fmt_size_t" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for size_t not found" >&5 $as_echo "$as_me: error: format string for size_t not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_SIZE_T "$ne_cv_fmt_size_t" _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } if test "${ac_cv_sizeof_off_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_off_t=$ac_lo;; '') if test "$ac_cv_type_off_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (off_t)); } static unsigned long int ulongval () { return (long int) (sizeof (off_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (off_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (off_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (off_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_off_t=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_off_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 $as_echo "$ac_cv_sizeof_off_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF_T $ac_cv_sizeof_off_t _ACEOF { $as_echo "$as_me:$LINENO: checking how to print off_t" >&5 $as_echo_n "checking how to print off_t... " >&6; } if test "${ne_cv_fmt_off_t+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_off_t=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { off_t i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_off_t=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_off_t in $ac_cv_sizeof_int) ne_cv_fmt_off_t="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_off_t="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_off_t="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_off_t" >&5 $as_echo "$ne_cv_fmt_off_t" >&6; } if test "x$ne_cv_fmt_off_t" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for off_t not found" >&5 $as_echo "$as_me: error: format string for off_t not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_OFF_T "$ne_cv_fmt_off_t" _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of ssize_t" >&5 $as_echo_n "checking size of ssize_t... " >&6; } if test "${ac_cv_sizeof_ssize_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_ssize_t=$ac_lo;; '') if test "$ac_cv_type_ssize_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (ssize_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_ssize_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (ssize_t)); } static unsigned long int ulongval () { return (long int) (sizeof (ssize_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ssize_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ssize_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ssize_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_ssize_t=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_ssize_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (ssize_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_ssize_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_ssize_t" >&5 $as_echo "$ac_cv_sizeof_ssize_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SSIZE_T $ac_cv_sizeof_ssize_t _ACEOF { $as_echo "$as_me:$LINENO: checking how to print ssize_t" >&5 $as_echo_n "checking how to print ssize_t... " >&6; } if test "${ne_cv_fmt_ssize_t+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_ssize_t=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { ssize_t i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_ssize_t=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_ssize_t in $ac_cv_sizeof_int) ne_cv_fmt_ssize_t="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_ssize_t="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_ssize_t="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_ssize_t" >&5 $as_echo "$ne_cv_fmt_ssize_t" >&6; } if test "x$ne_cv_fmt_ssize_t" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for ssize_t not found" >&5 $as_echo "$as_me: error: format string for ssize_t not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_SSIZE_T "$ne_cv_fmt_ssize_t" _ACEOF { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # Check for potential -arch flags. It is not universal unless # there are some -arch flags. Note that *ppc* also matches # ppc64. This check is also rather less than ideal. case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; esac else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to _BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then # Try to guess by grepping values from an object file. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no 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 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; #( no) ;; #( universal) cat >>confdefs.h <<\_ACEOF #define AC_APPLE_UNIVERSAL_BUILD 1 _ACEOF ;; #( *) { { $as_echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 $as_echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac { $as_echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 $as_echo_n "checking whether strerror_r is declared... " >&6; } if test "${ac_cv_have_decl_strerror_r+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef strerror_r (void) strerror_r; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_strerror_r=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_strerror_r=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 $as_echo "$ac_cv_have_decl_strerror_r" >&6; } if test "x$ac_cv_have_decl_strerror_r" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R 0 _ACEOF fi for ac_func in strerror_r do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if test "${ac_cv_func_strerror_r_char_p+set}" = set; 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_func_strerror_r_char_p=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strerror_r_char_p=yes 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 fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$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 cat >>confdefs.h <<\_ACEOF #define STRERROR_R_CHAR_P 1 _ACEOF fi # Search in /usr/ccs/bin for Solaris ne_PATH=$PATH:/usr/ccs/bin if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_AR+set}" = set; then $as_echo_n "(cached) " >&6 else case $AR in [\\/]* | ?:[\\/]*) ac_cv_path_AR="$AR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $ne_PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi AR=$ac_cv_path_AR if test -n "$AR"; then { $as_echo "$as_me:$LINENO: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_AR"; then ac_pt_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_ac_pt_AR+set}" = set; then $as_echo_n "(cached) " >&6 else case $ac_pt_AR in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $ne_PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_AR=$ac_cv_path_ac_pt_AR if test -n "$ac_pt_AR"; then { $as_echo "$as_me:$LINENO: result: $ac_pt_AR" >&5 $as_echo "$ac_pt_AR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_AR" = x; then AR="notfound" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$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 AR=$ac_pt_AR fi else AR="$ac_cv_path_AR" fi if test "x$AR" = "xnotfound"; then { { $as_echo "$as_me:$LINENO: error: could not find ar tool" >&5 $as_echo "$as_me: error: could not find ar tool" >&2;} { (exit 1); exit 1; }; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else case $RANLIB in [\\/]* | ?:[\\/]*) ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $ne_PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_RANLIB="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi RANLIB=$ac_cv_path_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_RANLIB"; then ac_pt_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_ac_pt_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else case $ac_pt_RANLIB in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_RANLIB="$ac_pt_RANLIB" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $ne_PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_RANLIB="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_RANLIB=$ac_cv_path_ac_pt_RANLIB if test -n "$ac_pt_RANLIB"; then { $as_echo "$as_me:$LINENO: result: $ac_pt_RANLIB" >&5 $as_echo "$ac_pt_RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$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 RANLIB=$ac_pt_RANLIB fi else RANLIB="$ac_cv_path_RANLIB" fi neon_bundled_srcdir='$(top_srcdir)/lib/neon' neon_bundled_builddir=lib/neon # Check whether --with-included-neon was given. if test "${with_included_neon+set}" = set; then withval=$with_included_neon; neon_force_included="$withval" else neon_force_included="no" fi # Check whether --with-neon was given. if test "${with_neon+set}" = set; then withval=$with_neon; case $withval in yes|no) neon_force_external=$withval; neon_ext_path= ;; *) neon_force_external=yes; neon_ext_path=$withval ;; esac; else neon_force_external=no neon_ext_path= fi if test "$neon_force_included" = "no"; then # There is no included neon source directory, or --with-included-neon # wasn't given (so we're not forced to use it). # Default to no external neon. neon_got_library=no if test "x$neon_ext_path" = "x"; then # Extract the first word of "neon-config", so it can be a program name with args. set dummy neon-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_NEON_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $NEON_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_NEON_CONFIG="$NEON_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_NEON_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_NEON_CONFIG" && ac_cv_path_NEON_CONFIG="none" ;; esac fi NEON_CONFIG=$ac_cv_path_NEON_CONFIG if test -n "$NEON_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $NEON_CONFIG" >&5 $as_echo "$NEON_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x${NEON_CONFIG}" = "xnone"; then { $as_echo "$as_me:$LINENO: no external neon library found" >&5 $as_echo "$as_me: no external neon library found" >&6;} elif test -x "${NEON_CONFIG}"; then # Configure to use an external neon, given a neon-config script # found at $NEON_CONFIG. neon_prefix=`$NEON_CONFIG --prefix` # Check whether the library is of required version ne_save_LIBS="$LIBS" ne_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" LIBS="$LIBS `$NEON_CONFIG --libs`" ne_libver=`$NEON_CONFIG --version | sed -e "s/neon //g"` # Check whether it's possible to link against neon { $as_echo "$as_me:$LINENO: checking linking against neon" >&5 $as_echo_n "checking linking against neon... " >&6; } if test "${ne_cv_lib_neon+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { ne_version_match(0, 0); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_lib_neon=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_cv_lib_neon=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_lib_neon" >&5 $as_echo "$ne_cv_lib_neon" >&6; } if test "$ne_cv_lib_neon" = "yes"; then ne_cv_lib_neonver=no for v in 27 28 29; do case $ne_libver in 0.$v.*) ne_cv_lib_neonver=yes ;; esac done fi ne_goodver=$ne_cv_lib_neonver LIBS=$ne_save_LIBS CFLAGS=$ne_save_CFLAGS if test "$ne_goodver" = "yes"; then { $as_echo "$as_me:$LINENO: using neon library $ne_libver" >&5 $as_echo "$as_me: using neon library $ne_libver" >&6;} # Pick up CFLAGS and LIBS needed CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$NEON_CONFIG --libs`" # Pick up library version set dummy `$NEON_CONFIG --version | sed 's/\./ /g'` NE_VERSION_MAJOR=$3; NE_VERSION_MINOR=$4; NE_VERSION_PATCH=$5 NEON_VERSION="${NE_VERSION_MAJOR}.${NE_VERSION_MINOR}.${NE_VERSION_PATCH}${NE_VERSION_TAG}" cat >>confdefs.h <<_ACEOF #define NEON_VERSION "${NEON_VERSION}" _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MAJOR (${NE_VERSION_MAJOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MINOR (${NE_VERSION_MINOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_PATCH (${NE_VERSION_PATCH}) _ACEOF neon_library_message="library in ${neon_prefix} (${NEON_VERSION})" neon_xml_parser_message="using whatever neon uses" if $NEON_CONFIG --support ssl >/dev/null; then NE_FLAG_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_SSL 1 _ACEOF ne_SSL_message="SSL is supported by neon" { $as_echo "$as_me:$LINENO: SSL is supported by neon" >&5 $as_echo "$as_me: SSL is supported by neon" >&6;} else NE_FLAG_SSL=no ne_SSL_message="SSL is not supported by neon" { $as_echo "$as_me:$LINENO: SSL is not supported by neon" >&5 $as_echo "$as_me: SSL is not supported by neon" >&6;} fi if $NEON_CONFIG --support zlib >/dev/null; then NE_FLAG_ZLIB=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_ZLIB 1 _ACEOF ne_ZLIB_message="zlib is supported by neon" { $as_echo "$as_me:$LINENO: zlib is supported by neon" >&5 $as_echo "$as_me: zlib is supported by neon" >&6;} else NE_FLAG_ZLIB=no ne_ZLIB_message="zlib is not supported by neon" { $as_echo "$as_me:$LINENO: zlib is not supported by neon" >&5 $as_echo "$as_me: zlib is not supported by neon" >&6;} fi if $NEON_CONFIG --support ipv6 >/dev/null; then NE_FLAG_IPV6=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_IPV6 1 _ACEOF ne_IPV6_message="IPv6 is supported by neon" { $as_echo "$as_me:$LINENO: IPv6 is supported by neon" >&5 $as_echo "$as_me: IPv6 is supported by neon" >&6;} else NE_FLAG_IPV6=no ne_IPV6_message="IPv6 is not supported by neon" { $as_echo "$as_me:$LINENO: IPv6 is not supported by neon" >&5 $as_echo "$as_me: IPv6 is not supported by neon" >&6;} fi if $NEON_CONFIG --support lfs >/dev/null; then NE_FLAG_LFS=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_LFS 1 _ACEOF ne_LFS_message="LFS is supported by neon" { $as_echo "$as_me:$LINENO: LFS is supported by neon" >&5 $as_echo "$as_me: LFS is supported by neon" >&6;} else NE_FLAG_LFS=no ne_LFS_message="LFS is not supported by neon" { $as_echo "$as_me:$LINENO: LFS is not supported by neon" >&5 $as_echo "$as_me: LFS is not supported by neon" >&6;} fi if $NEON_CONFIG --support ts_ssl >/dev/null; then NE_FLAG_TS_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_TS_SSL 1 _ACEOF ne_TS_SSL_message="thread-safe SSL is supported by neon" { $as_echo "$as_me:$LINENO: thread-safe SSL is supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is supported by neon" >&6;} else NE_FLAG_TS_SSL=no ne_TS_SSL_message="thread-safe SSL is not supported by neon" { $as_echo "$as_me:$LINENO: thread-safe SSL is not supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is not supported by neon" >&6;} fi neon_got_library=yes if test $NE_FLAG_LFS = yes; then # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of off64_t" >&5 $as_echo_n "checking size of off64_t... " >&6; } if test "${ac_cv_sizeof_off64_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_off64_t=$ac_lo;; '') if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off64_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (off64_t)); } static unsigned long int ulongval () { return (long int) (sizeof (off64_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (off64_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (off64_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (off64_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_off64_t=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off64_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off64_t" >&5 $as_echo "$ac_cv_sizeof_off64_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF64_T $ac_cv_sizeof_off64_t _ACEOF { $as_echo "$as_me:$LINENO: checking how to print off64_t" >&5 $as_echo_n "checking how to print off64_t... " >&6; } if test "${ne_cv_fmt_off64_t+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_off64_t=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { off64_t i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_off64_t=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_off64_t in $ac_cv_sizeof_int) ne_cv_fmt_off64_t="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_off64_t="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_off64_t="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_off64_t" >&5 $as_echo "$ne_cv_fmt_off64_t" >&6; } if test "x$ne_cv_fmt_off64_t" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for off64_t not found" >&5 $as_echo "$as_me: error: format string for off64_t not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_OFF64_T "$ne_cv_fmt_off64_t" _ACEOF cat >>confdefs.h <<_ACEOF #define NE_FMT_NE_OFF_T NE_FMT_OFF64_T _ACEOF else cat >>confdefs.h <<_ACEOF #define NE_FMT_NE_OFF_T NE_FMT_OFF_T _ACEOF fi else { $as_echo "$as_me:$LINENO: incompatible neon library version $ne_libver: wanted 0.27 28 29" >&5 $as_echo "$as_me: incompatible neon library version $ne_libver: wanted 0.27 28 29" >&6;} neon_got_library=no fi else { $as_echo "$as_me:$LINENO: ignoring non-executable ${NEON_CONFIG}" >&5 $as_echo "$as_me: ignoring non-executable ${NEON_CONFIG}" >&6;} fi else { $as_echo "$as_me:$LINENO: checking for neon library in $neon_ext_path" >&5 $as_echo_n "checking for neon library in $neon_ext_path... " >&6; } NEON_CONFIG="$neon_ext_path/bin/neon-config" if test -x ${NEON_CONFIG}; then { $as_echo "$as_me:$LINENO: result: found" >&5 $as_echo "found" >&6; } # Configure to use an external neon, given a neon-config script # found at $NEON_CONFIG. neon_prefix=`$NEON_CONFIG --prefix` # Check whether the library is of required version ne_save_LIBS="$LIBS" ne_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" LIBS="$LIBS `$NEON_CONFIG --libs`" ne_libver=`$NEON_CONFIG --version | sed -e "s/neon //g"` # Check whether it's possible to link against neon { $as_echo "$as_me:$LINENO: checking linking against neon" >&5 $as_echo_n "checking linking against neon... " >&6; } if test "${ne_cv_lib_neon+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { ne_version_match(0, 0); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_lib_neon=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_cv_lib_neon=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_lib_neon" >&5 $as_echo "$ne_cv_lib_neon" >&6; } if test "$ne_cv_lib_neon" = "yes"; then ne_cv_lib_neonver=no for v in 27 28 29; do case $ne_libver in 0.$v.*) ne_cv_lib_neonver=yes ;; esac done fi ne_goodver=$ne_cv_lib_neonver LIBS=$ne_save_LIBS CFLAGS=$ne_save_CFLAGS if test "$ne_goodver" = "yes"; then { $as_echo "$as_me:$LINENO: using neon library $ne_libver" >&5 $as_echo "$as_me: using neon library $ne_libver" >&6;} # Pick up CFLAGS and LIBS needed CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$NEON_CONFIG --libs`" # Pick up library version set dummy `$NEON_CONFIG --version | sed 's/\./ /g'` NE_VERSION_MAJOR=$3; NE_VERSION_MINOR=$4; NE_VERSION_PATCH=$5 NEON_VERSION="${NE_VERSION_MAJOR}.${NE_VERSION_MINOR}.${NE_VERSION_PATCH}${NE_VERSION_TAG}" cat >>confdefs.h <<_ACEOF #define NEON_VERSION "${NEON_VERSION}" _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MAJOR (${NE_VERSION_MAJOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MINOR (${NE_VERSION_MINOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_PATCH (${NE_VERSION_PATCH}) _ACEOF neon_library_message="library in ${neon_prefix} (${NEON_VERSION})" neon_xml_parser_message="using whatever neon uses" if $NEON_CONFIG --support ssl >/dev/null; then NE_FLAG_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_SSL 1 _ACEOF ne_SSL_message="SSL is supported by neon" { $as_echo "$as_me:$LINENO: SSL is supported by neon" >&5 $as_echo "$as_me: SSL is supported by neon" >&6;} else NE_FLAG_SSL=no ne_SSL_message="SSL is not supported by neon" { $as_echo "$as_me:$LINENO: SSL is not supported by neon" >&5 $as_echo "$as_me: SSL is not supported by neon" >&6;} fi if $NEON_CONFIG --support zlib >/dev/null; then NE_FLAG_ZLIB=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_ZLIB 1 _ACEOF ne_ZLIB_message="zlib is supported by neon" { $as_echo "$as_me:$LINENO: zlib is supported by neon" >&5 $as_echo "$as_me: zlib is supported by neon" >&6;} else NE_FLAG_ZLIB=no ne_ZLIB_message="zlib is not supported by neon" { $as_echo "$as_me:$LINENO: zlib is not supported by neon" >&5 $as_echo "$as_me: zlib is not supported by neon" >&6;} fi if $NEON_CONFIG --support ipv6 >/dev/null; then NE_FLAG_IPV6=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_IPV6 1 _ACEOF ne_IPV6_message="IPv6 is supported by neon" { $as_echo "$as_me:$LINENO: IPv6 is supported by neon" >&5 $as_echo "$as_me: IPv6 is supported by neon" >&6;} else NE_FLAG_IPV6=no ne_IPV6_message="IPv6 is not supported by neon" { $as_echo "$as_me:$LINENO: IPv6 is not supported by neon" >&5 $as_echo "$as_me: IPv6 is not supported by neon" >&6;} fi if $NEON_CONFIG --support lfs >/dev/null; then NE_FLAG_LFS=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_LFS 1 _ACEOF ne_LFS_message="LFS is supported by neon" { $as_echo "$as_me:$LINENO: LFS is supported by neon" >&5 $as_echo "$as_me: LFS is supported by neon" >&6;} else NE_FLAG_LFS=no ne_LFS_message="LFS is not supported by neon" { $as_echo "$as_me:$LINENO: LFS is not supported by neon" >&5 $as_echo "$as_me: LFS is not supported by neon" >&6;} fi if $NEON_CONFIG --support ts_ssl >/dev/null; then NE_FLAG_TS_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_TS_SSL 1 _ACEOF ne_TS_SSL_message="thread-safe SSL is supported by neon" { $as_echo "$as_me:$LINENO: thread-safe SSL is supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is supported by neon" >&6;} else NE_FLAG_TS_SSL=no ne_TS_SSL_message="thread-safe SSL is not supported by neon" { $as_echo "$as_me:$LINENO: thread-safe SSL is not supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is not supported by neon" >&6;} fi neon_got_library=yes if test $NE_FLAG_LFS = yes; then # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of off64_t" >&5 $as_echo_n "checking size of off64_t... " >&6; } if test "${ac_cv_sizeof_off64_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_off64_t=$ac_lo;; '') if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off64_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (off64_t)); } static unsigned long int ulongval () { return (long int) (sizeof (off64_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (off64_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (off64_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (off64_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_off64_t=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off64_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off64_t" >&5 $as_echo "$ac_cv_sizeof_off64_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF64_T $ac_cv_sizeof_off64_t _ACEOF { $as_echo "$as_me:$LINENO: checking how to print off64_t" >&5 $as_echo_n "checking how to print off64_t... " >&6; } if test "${ne_cv_fmt_off64_t+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_off64_t=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { off64_t i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_off64_t=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_off64_t in $ac_cv_sizeof_int) ne_cv_fmt_off64_t="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_off64_t="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_off64_t="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_off64_t" >&5 $as_echo "$ne_cv_fmt_off64_t" >&6; } if test "x$ne_cv_fmt_off64_t" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for off64_t not found" >&5 $as_echo "$as_me: error: format string for off64_t not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_OFF64_T "$ne_cv_fmt_off64_t" _ACEOF cat >>confdefs.h <<_ACEOF #define NE_FMT_NE_OFF_T NE_FMT_OFF64_T _ACEOF else cat >>confdefs.h <<_ACEOF #define NE_FMT_NE_OFF_T NE_FMT_OFF_T _ACEOF fi else { $as_echo "$as_me:$LINENO: incompatible neon library version $ne_libver: wanted 0.27 28 29" >&5 $as_echo "$as_me: incompatible neon library version $ne_libver: wanted 0.27 28 29" >&6;} neon_got_library=no fi else { $as_echo "$as_me:$LINENO: result: not found" >&5 $as_echo "not found" >&6; } # ...will fail since force_external=yes fi fi if test "$neon_got_library" = "no"; then if test $neon_force_external = yes; then { { $as_echo "$as_me:$LINENO: error: could not use external neon library" >&5 $as_echo "$as_me: error: could not use external neon library" >&2;} { (exit 1); exit 1; }; } elif test -n "$neon_bundled_srcdir"; then # Couldn't find external neon, forced to use bundled sources neon_force_included="yes" else # Couldn't find neon, and don't have bundled sources { { $as_echo "$as_me:$LINENO: error: could not find neon" >&5 $as_echo "$as_me: error: could not find neon" >&2;} { (exit 1); exit 1; }; } fi fi fi if test "$neon_force_included" = "yes"; then # Define the current versions. NE_VERSION_MAJOR=0 NE_VERSION_MINOR=29 NE_VERSION_PATCH=1 NE_VERSION_TAG= # 0.29.x is backwards-compatible to 0.27.x, so AGE=2 NE_LIBTOOL_VERSINFO="29:${NE_VERSION_PATCH}:2" NEON_VERSION="${NE_VERSION_MAJOR}.${NE_VERSION_MINOR}.${NE_VERSION_PATCH}${NE_VERSION_TAG}" cat >>confdefs.h <<_ACEOF #define NEON_VERSION "${NEON_VERSION}" _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MAJOR (${NE_VERSION_MAJOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MINOR (${NE_VERSION_MINOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_PATCH (${NE_VERSION_PATCH}) _ACEOF { $as_echo "$as_me:$LINENO: using bundled neon ($NEON_VERSION)" >&5 $as_echo "$as_me: using bundled neon ($NEON_VERSION)" >&6;} NEON_BUILD_BUNDLED="yes" for ac_header in sys/time.h limits.h sys/select.h arpa/inet.h libintl.h \ signal.h sys/socket.h netinet/in.h netinet/tcp.h netdb.h sys/poll.h \ sys/limits.h fcntl.h iconv.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default /* netinet/tcp.h requires netinet/in.h on some platforms. */ #ifdef HAVE_NETINET_IN_H #include #endif #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for timezone global" >&5 $as_echo_n "checking for timezone global... " >&6; } if test "${ne_cv_cc_timezone+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { time_t t = 0 - timezone; timezone = 1; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_cc_timezone=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_cv_cc_timezone=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_cc_timezone" >&5 $as_echo "$ne_cv_cc_timezone" >&6; } if test "$ne_cv_cc_timezone" = "yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_TIMEZONE 1 _ACEOF fi if test -z "$ac_cv_sizeof_off_t"; then NE_FLAG_LFS=no ne_LFS_message="LFS support omitted: off_t size unknown!" { $as_echo "$as_me:$LINENO: LFS support omitted: off_t size unknown!" >&5 $as_echo "$as_me: LFS support omitted: off_t size unknown!" >&6;} elif test $ac_cv_sizeof_off_t != 4; then NE_FLAG_LFS=no ne_LFS_message="LFS support unnecessary, off_t is not 32-bit" { $as_echo "$as_me:$LINENO: LFS support unnecessary, off_t is not 32-bit" >&5 $as_echo "$as_me: LFS support unnecessary, off_t is not 32-bit" >&6;} for ac_func in strtoll strtoq do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF break fi done elif test -z "$ac_cv_sizeof_long_long"; then NE_FLAG_LFS=no ne_LFS_message="LFS support omitted: long long size unknown" { $as_echo "$as_me:$LINENO: LFS support omitted: long long size unknown" >&5 $as_echo "$as_me: LFS support omitted: long long size unknown" >&6;} elif test $ac_cv_sizeof_long_long != 8; then NE_FLAG_LFS=no ne_LFS_message="LFS support omitted: long long not 64-bit" { $as_echo "$as_me:$LINENO: LFS support omitted: long long not 64-bit" >&5 $as_echo "$as_me: LFS support omitted: long long not 64-bit" >&6;} else ne_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" { $as_echo "$as_me:$LINENO: checking for off64_t" >&5 $as_echo_n "checking for off64_t... " >&6; } if test "${ac_cv_type_off64_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_off64_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (off64_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((off64_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off64_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_off64_t" >&5 $as_echo "$ac_cv_type_off64_t" >&6; } if test "x$ac_cv_type_off64_t" = x""yes; then # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of off64_t" >&5 $as_echo_n "checking size of off64_t... " >&6; } if test "${ac_cv_sizeof_off64_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_off64_t=$ac_lo;; '') if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off64_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (off64_t)); } static unsigned long int ulongval () { return (long int) (sizeof (off64_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (off64_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (off64_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (off64_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_off64_t=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (off64_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_off64_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off64_t" >&5 $as_echo "$ac_cv_sizeof_off64_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF64_T $ac_cv_sizeof_off64_t _ACEOF { $as_echo "$as_me:$LINENO: checking how to print off64_t" >&5 $as_echo_n "checking how to print off64_t... " >&6; } if test "${ne_cv_fmt_off64_t+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_off64_t=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { off64_t i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_off64_t=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_off64_t in $ac_cv_sizeof_int) ne_cv_fmt_off64_t="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_off64_t="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_off64_t="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_off64_t" >&5 $as_echo "$ne_cv_fmt_off64_t" >&6; } if test "x$ne_cv_fmt_off64_t" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for off64_t not found" >&5 $as_echo "$as_me: error: format string for off64_t not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_OFF64_T "$ne_cv_fmt_off64_t" _ACEOF ne_lfsok=no for ac_func in strtoll strtoq do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ne_lfsok=yes; break fi done for ac_func in lseek64 fstat64 do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else ne_lfsok=no; break fi done if test x$ne_lfsok = xyes; then NE_FLAG_LFS=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_LFS 1 _ACEOF ne_LFS_message="LFS (large file) support enabled" { $as_echo "$as_me:$LINENO: LFS (large file) support enabled" >&5 $as_echo "$as_me: LFS (large file) support enabled" >&6;} NEON_CFLAGS="$NEON_CFLAGS -D_LARGEFILE64_SOURCE -DNE_LFS" ne_save_CPPFLAGS="$CPPFLAGS -DNE_LFS" else NE_FLAG_LFS=no ne_LFS_message="LFS support omitted: 64-bit support functions not found" { $as_echo "$as_me:$LINENO: LFS support omitted: 64-bit support functions not found" >&5 $as_echo "$as_me: LFS support omitted: 64-bit support functions not found" >&6;} fi else NE_FLAG_LFS=no ne_LFS_message="LFS support omitted: off64_t type not found" { $as_echo "$as_me:$LINENO: LFS support omitted: off64_t type not found" >&5 $as_echo "$as_me: LFS support omitted: off64_t type not found" >&6;} fi CPPFLAGS=$ne_save_CPPFLAGS fi if test "$NE_FLAG_LFS" = "yes"; then cat >>confdefs.h <<_ACEOF #define NE_FMT_NE_OFF_T NE_FMT_OFF64_T _ACEOF else cat >>confdefs.h <<_ACEOF #define NE_FMT_NE_OFF_T NE_FMT_OFF_T _ACEOF fi for ac_func in strcasecmp do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else case " $LIBOBJS " in *" $ac_func.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; esac fi done for ac_func in signal setvbuf setsockopt stpcpy poll fcntl getsockopt do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x${ac_cv_func_poll}${ac_cv_header_sys_poll_h}y" = "xyesyesy"; then cat >>confdefs.h <<\_ACEOF #define NE_USE_POLL 1 _ACEOF fi if test "$ac_cv_func_stpcpy" = "yes"; then { $as_echo "$as_me:$LINENO: checking whether stpcpy is declared" >&5 $as_echo_n "checking whether stpcpy is declared... " >&6; } if test "${ac_cv_have_decl_stpcpy+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef stpcpy (void) stpcpy; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_stpcpy=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_stpcpy=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_stpcpy" >&5 $as_echo "$ac_cv_have_decl_stpcpy" >&6; } if test "x$ac_cv_have_decl_stpcpy" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STPCPY 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STPCPY 0 _ACEOF fi fi # Modern AIXes with the "Linux-like" libc have an undeclared stpcpy # Unixware 7 can only link gethostbyname with -lnsl -lsocket # Pick up -lsocket first, then the gethostbyname check will work. # Haiku requires -lnetwork for socket functions. { $as_echo "$as_me:$LINENO: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if test "${ne_cv_libsfor_socket+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { socket(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_socket="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_socket="not found" for lib in socket inet ws2_32 network; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall socket();" ;; *) ne__code="socket();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_socket="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_socket" >&5 $as_echo "$ne_cv_libsfor_socket" >&6; } if test "$ne_cv_libsfor_socket" = "not found"; then { { $as_echo "$as_me:$LINENO: error: could not find library containing socket" >&5 $as_echo "$as_me: error: could not find library containing socket" >&2;} { (exit 1); exit 1; }; } elif test "$ne_cv_libsfor_socket" = "none needed"; then : else NEON_LIBS="$ne_cv_libsfor_socket $NEON_LIBS" fi # Enable getaddrinfo support if it, gai_strerror and inet_ntop are # all available. { $as_echo "$as_me:$LINENO: checking for library containing getaddrinfo" >&5 $as_echo_n "checking for library containing getaddrinfo... " >&6; } if test "${ne_cv_libsfor_getaddrinfo+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { getaddrinfo(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_getaddrinfo="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_getaddrinfo="not found" for lib in nsl; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall getaddrinfo();" ;; *) ne__code="getaddrinfo();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_getaddrinfo="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_getaddrinfo" >&5 $as_echo "$ne_cv_libsfor_getaddrinfo" >&6; } if test "$ne_cv_libsfor_getaddrinfo" = "not found"; then ne_enable_gai=no elif test "$ne_cv_libsfor_getaddrinfo" = "none needed"; then # HP-UX boxes commonly get into a state where getaddrinfo is present # but borked: http://marc.theaimsgroup.com/?l=apr-dev&m=107730955207120&w=2 case x`uname -sr 2>/dev/null`y in xHP-UX*11.[01]*y) { $as_echo "$as_me:$LINENO: getaddrinfo support disabled on HP-UX 11.0x/11.1x" >&5 $as_echo "$as_me: getaddrinfo support disabled on HP-UX 11.0x/11.1x" >&6;} ;; *) ne_enable_gai=yes ne_cf_save_LIBS=$LIBS LIBS="$LIBS $NEON_LIBS" for ac_func in gai_strerror getnameinfo inet_ntop inet_pton do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else ne_enable_gai=no; break fi done LIBS=$ne_cf_save_LIBS ;; esac else NEON_LIBS="$ne_cv_libsfor_getaddrinfo $NEON_LIBS" # HP-UX boxes commonly get into a state where getaddrinfo is present # but borked: http://marc.theaimsgroup.com/?l=apr-dev&m=107730955207120&w=2 case x`uname -sr 2>/dev/null`y in xHP-UX*11.[01]*y) { $as_echo "$as_me:$LINENO: getaddrinfo support disabled on HP-UX 11.0x/11.1x" >&5 $as_echo "$as_me: getaddrinfo support disabled on HP-UX 11.0x/11.1x" >&6;} ;; *) ne_enable_gai=yes ne_cf_save_LIBS=$LIBS LIBS="$LIBS $NEON_LIBS" for ac_func in gai_strerror getnameinfo inet_ntop inet_pton do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else ne_enable_gai=no; break fi done LIBS=$ne_cf_save_LIBS ;; esac fi if test $ne_enable_gai = yes; then NE_FLAG_IPV6=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_IPV6 1 _ACEOF ne_IPV6_message="IPv6 support is enabled" { $as_echo "$as_me:$LINENO: IPv6 support is enabled" >&5 $as_echo "$as_me: IPv6 support is enabled" >&6;} cat >>confdefs.h <<\_ACEOF #define USE_GETADDRINFO 1 _ACEOF { $as_echo "$as_me:$LINENO: checking for working AI_ADDRCONFIG" >&5 $as_echo_n "checking for working AI_ADDRCONFIG... " >&6; } if test "${ne_cv_gai_addrconfig+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ne_cv_gai_addrconfig=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct addrinfo hints = {0}, *result; hints.ai_flags = AI_ADDRCONFIG; if (getaddrinfo("localhost", NULL, &hints, &result) != 0) return 1; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ne_cv_gai_addrconfig=yes 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 ( exit $ac_status ) ne_cv_gai_addrconfig=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_gai_addrconfig" >&5 $as_echo "$ne_cv_gai_addrconfig" >&6; } if test $ne_cv_gai_addrconfig = yes; then cat >>confdefs.h <<\_ACEOF #define USE_GAI_ADDRCONFIG 1 _ACEOF fi else # Checks for non-getaddrinfo() based resolver interfaces. # QNX has gethostbyname in -lsocket. BeOS only has it in -lbind. # CygWin/Winsock2 has it in -lws2_32, allegedly. # Haiku requires -lnetwork for socket functions. { $as_echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if test "${ne_cv_libsfor_gethostbyname+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { gethostbyname(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_gethostbyname="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_gethostbyname="not found" for lib in socket nsl bind ws2_32 network; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall gethostbyname();" ;; *) ne__code="gethostbyname();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_gethostbyname="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_gethostbyname" >&5 $as_echo "$ne_cv_libsfor_gethostbyname" >&6; } if test "$ne_cv_libsfor_gethostbyname" = "not found"; then { { $as_echo "$as_me:$LINENO: error: could not find library containing gethostbyname" >&5 $as_echo "$as_me: error: could not find library containing gethostbyname" >&2;} { (exit 1); exit 1; }; } elif test "$ne_cv_libsfor_gethostbyname" = "none needed"; then : else NEON_LIBS="$ne_cv_libsfor_gethostbyname $NEON_LIBS" fi { $as_echo "$as_me:$LINENO: checking for library containing hstrerror" >&5 $as_echo_n "checking for library containing hstrerror... " >&6; } if test "${ne_cv_libsfor_hstrerror+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { hstrerror(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_hstrerror="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_hstrerror="not found" for lib in resolv; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall hstrerror();" ;; *) ne__code="hstrerror();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_hstrerror="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_hstrerror" >&5 $as_echo "$ne_cv_libsfor_hstrerror" >&6; } if test "$ne_cv_libsfor_hstrerror" = "not found"; then : elif test "$ne_cv_libsfor_hstrerror" = "none needed"; then : else NEON_LIBS="$ne_cv_libsfor_hstrerror $NEON_LIBS" fi ne_cf_save_LIBS=$LIBS LIBS="$LIBS $NEON_LIBS" for ac_func in hstrerror do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS=$ne_cf_save_LIBS # Older Unixes don't declare h_errno. { $as_echo "$as_me:$LINENO: checking whether h_errno is declared" >&5 $as_echo_n "checking whether h_errno is declared... " >&6; } if test "${ac_cv_have_decl_h_errno+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef h_errno (void) h_errno; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_h_errno=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_h_errno=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_h_errno" >&5 $as_echo "$ac_cv_have_decl_h_errno" >&6; } if test "x$ac_cv_have_decl_h_errno" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_H_ERRNO 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_H_ERRNO 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for in_addr_t" >&5 $as_echo_n "checking for in_addr_t... " >&6; } if test "${ac_cv_type_in_addr_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_in_addr_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif int main () { if (sizeof (in_addr_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif int main () { if (sizeof ((in_addr_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_in_addr_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_in_addr_t" >&5 $as_echo "$ac_cv_type_in_addr_t" >&6; } if test "x$ac_cv_type_in_addr_t" = x""yes; then : else cat >>confdefs.h <<\_ACEOF #define in_addr_t unsigned int _ACEOF fi fi { $as_echo "$as_me:$LINENO: checking for socklen_t" >&5 $as_echo_n "checking for socklen_t... " >&6; } if test "${ac_cv_type_socklen_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_socklen_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif int main () { if (sizeof (socklen_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif int main () { if (sizeof ((socklen_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_socklen_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 $as_echo "$ac_cv_type_socklen_t" >&6; } if test "x$ac_cv_type_socklen_t" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_SOCKLEN_T 1 _ACEOF else # Linux accept(2) says this should be size_t for SunOS 5... gah. cat >>confdefs.h <<\_ACEOF #define socklen_t int _ACEOF fi { $as_echo "$as_me:$LINENO: checking for struct tm.tm_gmtoff" >&5 $as_echo_n "checking for struct tm.tm_gmtoff... " >&6; } if test "${ac_cv_member_struct_tm_tm_gmtoff+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static struct tm ac_aggr; if (ac_aggr.tm_gmtoff) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_gmtoff=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static struct tm ac_aggr; if (sizeof ac_aggr.tm_gmtoff) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_gmtoff=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm_tm_gmtoff=no 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 { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_gmtoff" >&5 $as_echo "$ac_cv_member_struct_tm_tm_gmtoff" >&6; } if test "x$ac_cv_member_struct_tm_tm_gmtoff" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_GMTOFF 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for struct tm.__tm_gmtoff" >&5 $as_echo_n "checking for struct tm.__tm_gmtoff... " >&6; } if test "${ac_cv_member_struct_tm___tm_gmtoff+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static struct tm ac_aggr; if (ac_aggr.__tm_gmtoff) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm___tm_gmtoff=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static struct tm ac_aggr; if (sizeof ac_aggr.__tm_gmtoff) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm___tm_gmtoff=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm___tm_gmtoff=no 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 { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm___tm_gmtoff" >&5 $as_echo "$ac_cv_member_struct_tm___tm_gmtoff" >&6; } if test "x$ac_cv_member_struct_tm___tm_gmtoff" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM___TM_GMTOFF 1 _ACEOF fi if test ${ac_cv_member_struct_tm_tm_gmtoff}${ac_cv_member_struct_tm___tm_gmtoff}${ne_cv_cc_timezone} = nonono; then { $as_echo "$as_me:$LINENO: WARNING: no timezone handling in date parsing on this platform" >&5 $as_echo "$as_me: WARNING: no timezone handling in date parsing on this platform" >&2;} fi NE_FLAG_ZLIB=no ne_ZLIB_message="zlib not supported" { $as_echo "$as_me:$LINENO: zlib not supported" >&5 $as_echo "$as_me: zlib not supported" >&6;} # Conditionally enable ACL support { $as_echo "$as_me:$LINENO: checking whether to enable ACL support in neon" >&5 $as_echo_n "checking whether to enable ACL support in neon... " >&6; } if test "x$neon_no_acl" = "xyes"; then { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } else { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_oldacl ne_acl3744" fi # Check whether --with-ssl was given. if test "${with_ssl+set}" = set; then withval=$with_ssl; fi # Check whether --with-egd was given. if test "${with_egd+set}" = set; then withval=$with_egd; fi # Check whether --with-pakchois was given. if test "${with_pakchois+set}" = set; then withval=$with_pakchois; fi case $with_ssl in /*) { $as_echo "$as_me:$LINENO: to use SSL libraries in non-standard locations, try --with-ssl --with-libs=$with_ssl" >&5 $as_echo "$as_me: to use SSL libraries in non-standard locations, try --with-ssl --with-libs=$with_ssl" >&6;} { { $as_echo "$as_me:$LINENO: error: --with-ssl does not take a path argument" >&5 $as_echo "$as_me: error: --with-ssl does not take a path argument" >&2;} { (exit 1); exit 1; }; } ;; yes|openssl) # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$PKG_CONFIG" = "no"; then : Not using pkg-config # Either OpenSSL library may require -ldl if built with dynamic engine support { $as_echo "$as_me:$LINENO: checking for library containing RSA_new" >&5 $as_echo_n "checking for library containing RSA_new... " >&6; } if test "${ne_cv_libsfor_RSA_new+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { RSA_new(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_RSA_new="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_RSA_new="not found" for lib in crypto; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall RSA_new();" ;; *) ne__code="RSA_new();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_RSA_new="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$ne_sl_save_LIBS -l$lib -ldl $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_RSA_new="-l$lib -ldl"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_RSA_new" >&5 $as_echo "$ne_cv_libsfor_RSA_new" >&6; } if test "$ne_cv_libsfor_RSA_new" = "not found"; then { { $as_echo "$as_me:$LINENO: error: could not find library containing RSA_new" >&5 $as_echo "$as_me: error: could not find library containing RSA_new" >&2;} { (exit 1); exit 1; }; } elif test "$ne_cv_libsfor_RSA_new" = "none needed"; then : else NEON_LIBS="$ne_cv_libsfor_RSA_new $NEON_LIBS" fi { $as_echo "$as_me:$LINENO: checking for library containing SSL_library_init" >&5 $as_echo_n "checking for library containing SSL_library_init... " >&6; } if test "${ne_cv_libsfor_SSL_library_init+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { SSL_library_init(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_SSL_library_init="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_SSL_library_init="not found" for lib in ssl; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall SSL_library_init();" ;; *) ne__code="SSL_library_init();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_SSL_library_init="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$ne_sl_save_LIBS -l$lib -ldl $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_SSL_library_init="-l$lib -ldl"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_SSL_library_init" >&5 $as_echo "$ne_cv_libsfor_SSL_library_init" >&6; } if test "$ne_cv_libsfor_SSL_library_init" = "not found"; then { { $as_echo "$as_me:$LINENO: error: could not find library containing SSL_library_init" >&5 $as_echo "$as_me: error: could not find library containing SSL_library_init" >&2;} { (exit 1); exit 1; }; } elif test "$ne_cv_libsfor_SSL_library_init" = "none needed"; then : else NEON_LIBS="$ne_cv_libsfor_SSL_library_init $NEON_LIBS" fi else { $as_echo "$as_me:$LINENO: checking for openssl pkg-config data" >&5 $as_echo_n "checking for openssl pkg-config data... " >&6; } if test "${ne_cv_pkg_openssl+set}" = set; then $as_echo_n "(cached) " >&6 else if $PKG_CONFIG openssl; then ne_cv_pkg_openssl=yes else ne_cv_pkg_openssl=no fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_pkg_openssl" >&5 $as_echo "$ne_cv_pkg_openssl" >&6; } if test "$ne_cv_pkg_openssl" = "yes"; then NE_SSL_CFLAGS=`$PKG_CONFIG --cflags openssl` NE_SSL_LIBS=`$PKG_CONFIG --libs openssl` : Using provided pkg-config data { $as_echo "$as_me:$LINENO: using SSL library configuration from pkg-config" >&5 $as_echo "$as_me: using SSL library configuration from pkg-config" >&6;} CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}" NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}" else : No pkg-config for openssl provided # Either OpenSSL library may require -ldl if built with dynamic engine support { $as_echo "$as_me:$LINENO: checking for library containing RSA_new" >&5 $as_echo_n "checking for library containing RSA_new... " >&6; } if test "${ne_cv_libsfor_RSA_new+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { RSA_new(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_RSA_new="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_RSA_new="not found" for lib in crypto; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall RSA_new();" ;; *) ne__code="RSA_new();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_RSA_new="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$ne_sl_save_LIBS -l$lib -ldl $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_RSA_new="-l$lib -ldl"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_RSA_new" >&5 $as_echo "$ne_cv_libsfor_RSA_new" >&6; } if test "$ne_cv_libsfor_RSA_new" = "not found"; then { { $as_echo "$as_me:$LINENO: error: could not find library containing RSA_new" >&5 $as_echo "$as_me: error: could not find library containing RSA_new" >&2;} { (exit 1); exit 1; }; } elif test "$ne_cv_libsfor_RSA_new" = "none needed"; then : else NEON_LIBS="$ne_cv_libsfor_RSA_new $NEON_LIBS" fi { $as_echo "$as_me:$LINENO: checking for library containing SSL_library_init" >&5 $as_echo_n "checking for library containing SSL_library_init... " >&6; } if test "${ne_cv_libsfor_SSL_library_init+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { SSL_library_init(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_SSL_library_init="none needed" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ne_sl_save_LIBS=$LIBS ne_cv_libsfor_SSL_library_init="not found" for lib in ssl; do # The w32api libraries link using the stdcall calling convention. case ${lib}-${ne_cv_os_uname} in ws2_32-MINGW*) ne__code="__stdcall SSL_library_init();" ;; *) ne__code="SSL_library_init();" ;; esac LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_SSL_library_init="-l$lib"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$ne_sl_save_LIBS -l$lib -ldl $NEON_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $ne__code ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ne_cv_libsfor_SSL_library_init="-l$lib -ldl"; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done LIBS=$ne_sl_save_LIBS fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ne_cv_libsfor_SSL_library_init" >&5 $as_echo "$ne_cv_libsfor_SSL_library_init" >&6; } if test "$ne_cv_libsfor_SSL_library_init" = "not found"; then { { $as_echo "$as_me:$LINENO: error: could not find library containing SSL_library_init" >&5 $as_echo "$as_me: error: could not find library containing SSL_library_init" >&2;} { (exit 1); exit 1; }; } elif test "$ne_cv_libsfor_SSL_library_init" = "none needed"; then : else NEON_LIBS="$ne_cv_libsfor_SSL_library_init $NEON_LIBS" fi fi fi for ac_header in openssl/ssl.h openssl/opensslv.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else { { $as_echo "$as_me:$LINENO: error: OpenSSL headers not found, cannot enable SSL support" >&5 $as_echo "$as_me: error: OpenSSL headers not found, cannot enable SSL support" >&2;} { (exit 1); exit 1; }; } fi done # Enable EGD support if using 0.9.7 or newer { $as_echo "$as_me:$LINENO: checking OpenSSL version is >= 0.9.7" >&5 $as_echo_n "checking OpenSSL version is >= 0.9.7... " >&6; } if test "${ne_cv_lib_ssl097+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if OPENSSL_VERSION_NUMBER >= 0x00907000L good #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "good" >/dev/null 2>&1; then ne_cv_lib_ssl097=yes else ne_cv_lib_ssl097=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $ne_cv_lib_ssl097" >&5 $as_echo "$ne_cv_lib_ssl097" >&6; } if test "$ne_cv_lib_ssl097" = "yes"; then { $as_echo "$as_me:$LINENO: OpenSSL >= 0.9.7; EGD support not needed in neon" >&5 $as_echo "$as_me: OpenSSL >= 0.9.7; EGD support not needed in neon" >&6;} NE_FLAG_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_SSL 1 _ACEOF ne_SSL_message="SSL support enabled, using OpenSSL (0.9.7 or later)" { $as_echo "$as_me:$LINENO: SSL support enabled, using OpenSSL (0.9.7 or later)" >&5 $as_echo "$as_me: SSL support enabled, using OpenSSL (0.9.7 or later)" >&6;} ne_cf_save_LIBS=$LIBS LIBS="$LIBS $NEON_LIBS" for ac_func in CRYPTO_set_idptr_callback SSL_SESSION_cmp do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS=$ne_cf_save_LIBS else # Fail if OpenSSL is older than 0.9.6 { $as_echo "$as_me:$LINENO: checking OpenSSL version is >= 0.9.6" >&5 $as_echo_n "checking OpenSSL version is >= 0.9.6... " >&6; } if test "${ne_cv_lib_ssl096+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if OPENSSL_VERSION_NUMBER >= 0x00906000L good #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "good" >/dev/null 2>&1; then ne_cv_lib_ssl096=yes else ne_cv_lib_ssl096=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $ne_cv_lib_ssl096" >&5 $as_echo "$ne_cv_lib_ssl096" >&6; } if test "$ne_cv_lib_ssl096" != "yes"; then { { $as_echo "$as_me:$LINENO: error: OpenSSL 0.9.6 or later is required" >&5 $as_echo "$as_me: error: OpenSSL 0.9.6 or later is required" >&2;} { (exit 1); exit 1; }; } fi NE_FLAG_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_SSL 1 _ACEOF ne_SSL_message="SSL support enabled, using OpenSSL (0.9.6 or later)" { $as_echo "$as_me:$LINENO: SSL support enabled, using OpenSSL (0.9.6 or later)" >&5 $as_echo "$as_me: SSL support enabled, using OpenSSL (0.9.6 or later)" >&6;} case "$with_egd" in yes|no) ne_cv_lib_sslegd=$with_egd ;; /*) ne_cv_lib_sslegd=yes cat >>confdefs.h <<_ACEOF #define EGD_PATH "$with_egd" _ACEOF ;; *) # Guess whether EGD support is needed { $as_echo "$as_me:$LINENO: checking whether to enable EGD support" >&5 $as_echo_n "checking whether to enable EGD support... " >&6; } if test "${ne_cv_lib_sslegd+set}" = set; then $as_echo_n "(cached) " >&6 else if test -r /dev/random || test -r /dev/urandom; then ne_cv_lib_sslegd=no else ne_cv_lib_sslegd=yes fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_lib_sslegd" >&5 $as_echo "$ne_cv_lib_sslegd" >&6; } ;; esac if test "$ne_cv_lib_sslegd" = "yes"; then { $as_echo "$as_me:$LINENO: EGD support enabled for seeding OpenSSL PRNG" >&5 $as_echo "$as_me: EGD support enabled for seeding OpenSSL PRNG" >&6;} cat >>confdefs.h <<\_ACEOF #define ENABLE_EGD 1 _ACEOF fi fi cat >>confdefs.h <<\_ACEOF #define HAVE_OPENSSL 1 _ACEOF NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_openssl" cat >>confdefs.h <<\_ACEOF #define HAVE_NTLM 1 _ACEOF ;; gnutls) # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$PKG_CONFIG" = "no"; then : Not using pkg-config # Fall back on libgnutls-config script # Extract the first word of "libgnutls-config", so it can be a program name with args. set dummy libgnutls-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GNUTLS_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $GNUTLS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_GNUTLS_CONFIG="$GNUTLS_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GNUTLS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GNUTLS_CONFIG" && ac_cv_path_GNUTLS_CONFIG="no" ;; esac fi GNUTLS_CONFIG=$ac_cv_path_GNUTLS_CONFIG if test -n "$GNUTLS_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $GNUTLS_CONFIG" >&5 $as_echo "$GNUTLS_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$GNUTLS_CONFIG" = "no"; then { { $as_echo "$as_me:$LINENO: error: could not find libgnutls-config in \$PATH" >&5 $as_echo "$as_me: error: could not find libgnutls-config in \$PATH" >&2;} { (exit 1); exit 1; }; } fi CPPFLAGS="$CPPFLAGS `$GNUTLS_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$GNUTLS_CONFIG --libs`" ne_gnutls_ver=`$GNUTLS_CONFIG --version` else { $as_echo "$as_me:$LINENO: checking for gnutls pkg-config data" >&5 $as_echo_n "checking for gnutls pkg-config data... " >&6; } if test "${ne_cv_pkg_gnutls+set}" = set; then $as_echo_n "(cached) " >&6 else if $PKG_CONFIG gnutls; then ne_cv_pkg_gnutls=yes else ne_cv_pkg_gnutls=no fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_pkg_gnutls" >&5 $as_echo "$ne_cv_pkg_gnutls" >&6; } if test "$ne_cv_pkg_gnutls" = "yes"; then NE_SSL_CFLAGS=`$PKG_CONFIG --cflags gnutls` NE_SSL_LIBS=`$PKG_CONFIG --libs gnutls` : Using provided pkg-config data { $as_echo "$as_me:$LINENO: using GnuTLS configuration from pkg-config" >&5 $as_echo "$as_me: using GnuTLS configuration from pkg-config" >&6;} CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}" NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}" ne_gnutls_ver=`$PKG_CONFIG --modversion gnutls` else : No pkg-config for gnutls provided # Fall back on libgnutls-config script # Extract the first word of "libgnutls-config", so it can be a program name with args. set dummy libgnutls-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GNUTLS_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $GNUTLS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_GNUTLS_CONFIG="$GNUTLS_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GNUTLS_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GNUTLS_CONFIG" && ac_cv_path_GNUTLS_CONFIG="no" ;; esac fi GNUTLS_CONFIG=$ac_cv_path_GNUTLS_CONFIG if test -n "$GNUTLS_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $GNUTLS_CONFIG" >&5 $as_echo "$GNUTLS_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$GNUTLS_CONFIG" = "no"; then { { $as_echo "$as_me:$LINENO: error: could not find libgnutls-config in \$PATH" >&5 $as_echo "$as_me: error: could not find libgnutls-config in \$PATH" >&2;} { (exit 1); exit 1; }; } fi CPPFLAGS="$CPPFLAGS `$GNUTLS_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$GNUTLS_CONFIG --libs`" ne_gnutls_ver=`$GNUTLS_CONFIG --version` fi fi if test "${ac_cv_header_gnutls_gnutls_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for gnutls/gnutls.h" >&5 $as_echo_n "checking for gnutls/gnutls.h... " >&6; } if test "${ac_cv_header_gnutls_gnutls_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_gnutls_gnutls_h" >&5 $as_echo "$ac_cv_header_gnutls_gnutls_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking gnutls/gnutls.h usability" >&5 $as_echo_n "checking gnutls/gnutls.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking gnutls/gnutls.h presence" >&5 $as_echo_n "checking gnutls/gnutls.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: gnutls/gnutls.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gnutls/gnutls.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: gnutls/gnutls.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gnutls/gnutls.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gnutls/gnutls.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gnutls/gnutls.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gnutls/gnutls.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: gnutls/gnutls.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: gnutls/gnutls.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for gnutls/gnutls.h" >&5 $as_echo_n "checking for gnutls/gnutls.h... " >&6; } if test "${ac_cv_header_gnutls_gnutls_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_gnutls_gnutls_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_gnutls_gnutls_h" >&5 $as_echo "$ac_cv_header_gnutls_gnutls_h" >&6; } fi if test "x$ac_cv_header_gnutls_gnutls_h" = x""yes; then : else { { $as_echo "$as_me:$LINENO: error: could not find gnutls/gnutls.h in include path" >&5 $as_echo "$as_me: error: could not find gnutls/gnutls.h in include path" >&2;} { (exit 1); exit 1; }; } fi NE_FLAG_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_SSL 1 _ACEOF ne_SSL_message="SSL support enabled, using GnuTLS $ne_gnutls_ver" { $as_echo "$as_me:$LINENO: SSL support enabled, using GnuTLS $ne_gnutls_ver" >&5 $as_echo "$as_me: SSL support enabled, using GnuTLS $ne_gnutls_ver" >&6;} NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_gnutls" cat >>confdefs.h <<\_ACEOF #define HAVE_GNUTLS 1 _ACEOF # Check for functions in later releases ne_cf_save_LIBS=$LIBS LIBS="$LIBS $NEON_LIBS" for ac_func in gnutls_session_get_data2 gnutls_x509_dn_get_rdn_ava \ gnutls_sign_callback_set \ gnutls_certificate_get_x509_cas \ gnutls_certificate_verify_peers2 do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS=$ne_cf_save_LIBS # fail if gnutls_certificate_verify_peers2 is not found if test x${ac_cv_func_gnutls_certificate_verify_peers2} != xyes; then { { $as_echo "$as_me:$LINENO: error: GnuTLS version predates gnutls_certificate_verify_peers2, newer version required" >&5 $as_echo "$as_me: error: GnuTLS version predates gnutls_certificate_verify_peers2, newer version required" >&2;} { (exit 1); exit 1; }; } fi # Check for iconv support if using the new RDN access functions: if test ${ac_cv_func_gnutls_x509_dn_get_rdn_ava}X${ac_cv_header_iconv_h} = yesXyes; then for ac_func in iconv do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi ;; *) # Default to off; only create crypto-enabled binaries if requested. NE_FLAG_SSL=no ne_SSL_message="SSL support is not enabled" { $as_echo "$as_me:$LINENO: SSL support is not enabled" >&5 $as_echo "$as_me: SSL support is not enabled" >&6;} NE_FLAG_TS_SSL=no ne_TS_SSL_message="Thread-safe SSL support is not enabled" { $as_echo "$as_me:$LINENO: Thread-safe SSL support is not enabled" >&5 $as_echo "$as_me: Thread-safe SSL support is not enabled" >&6;} NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_stubssl" ;; esac # Check whether --with-ca-bundle was given. if test "${with_ca_bundle+set}" = set; then withval=$with_ca_bundle; else with_ca_bundle=no fi case ${NE_FLAG_SSL}-${with_ca_bundle} in *-no) ;; yes-*) cat >>confdefs.h <<_ACEOF #define NE_SSL_CA_BUNDLE "${with_ca_bundle}" _ACEOF { $as_echo "$as_me:$LINENO: Using ${with_ca_bundle} as default SSL CA bundle" >&5 $as_echo "$as_me: Using ${with_ca_bundle} as default SSL CA bundle" >&6;} ;; esac # Check whether --enable-threadsafe-ssl was given. if test "${enable_threadsafe_ssl+set}" = set; then enableval=$enable_threadsafe_ssl; else enable_threadsafe_ssl=no fi case $enable_threadsafe_ssl in posix|yes) ne_pthr_ok=yes for ac_func in pthread_mutex_init pthread_mutex_lock do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else ne_pthr_ok=no fi done if test "${ne_pthr_ok}" = "no"; then { { $as_echo "$as_me:$LINENO: error: could not find POSIX mutex interfaces; (try CC=\"${CC} -pthread\"?)" >&5 $as_echo "$as_me: error: could not find POSIX mutex interfaces; (try CC=\"${CC} -pthread\"?)" >&2;} { (exit 1); exit 1; }; } fi NE_FLAG_TS_SSL=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_TS_SSL 1 _ACEOF ne_TS_SSL_message="Thread-safe SSL supported using POSIX threads" { $as_echo "$as_me:$LINENO: Thread-safe SSL supported using POSIX threads" >&5 $as_echo "$as_me: Thread-safe SSL supported using POSIX threads" >&6;} ;; *) NE_FLAG_TS_SSL=no ne_TS_SSL_message="Thread-safe SSL not supported" { $as_echo "$as_me:$LINENO: Thread-safe SSL not supported" >&5 $as_echo "$as_me: Thread-safe SSL not supported" >&6;} ;; esac case ${with_pakchois}X${ac_cv_func_gnutls_sign_callback_set}Y${ne_cv_lib_ssl097} in noX*Y*) ;; *X*Yyes|*XyesY*) # PKCS#11... ho! # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$PKG_CONFIG" = "no"; then : Not using pkg-config { $as_echo "$as_me:$LINENO: pakchois library not found; no PKCS#11 support" >&5 $as_echo "$as_me: pakchois library not found; no PKCS#11 support" >&6;} else { $as_echo "$as_me:$LINENO: checking for pakchois pkg-config data" >&5 $as_echo_n "checking for pakchois pkg-config data... " >&6; } if test "${ne_cv_pkg_pakchois+set}" = set; then $as_echo_n "(cached) " >&6 else if $PKG_CONFIG pakchois; then ne_cv_pkg_pakchois=yes else ne_cv_pkg_pakchois=no fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_pkg_pakchois" >&5 $as_echo "$ne_cv_pkg_pakchois" >&6; } if test "$ne_cv_pkg_pakchois" = "yes"; then NE_PK11_CFLAGS=`$PKG_CONFIG --cflags pakchois` NE_PK11_LIBS=`$PKG_CONFIG --libs pakchois` : Using provided pkg-config data { $as_echo "$as_me:$LINENO: using pakchois for PKCS#11 support" >&5 $as_echo "$as_me: using pakchois for PKCS#11 support" >&6;} cat >>confdefs.h <<\_ACEOF #define HAVE_PAKCHOIS 1 _ACEOF CPPFLAGS="$CPPFLAGS ${NE_PK11_CFLAGS}" NEON_LIBS="${NEON_LIBS} ${NE_PK11_LIBS}" else : No pkg-config for pakchois provided { $as_echo "$as_me:$LINENO: pakchois library not found; no PKCS#11 support" >&5 $as_echo "$as_me: pakchois library not found; no PKCS#11 support" >&6;} fi fi ;; esac # Check whether --with-gssapi was given. if test "${with_gssapi+set}" = set; then withval=$with_gssapi; fi if test "$with_gssapi" != "no"; then # Extract the first word of "krb5-config", so it can be a program name with args. set dummy krb5-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_KRB5_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $KRB5_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_KRB5_CONFIG="$KRB5_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy="$PATH:/usr/kerberos/bin" for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_KRB5_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_KRB5_CONFIG" && ac_cv_path_KRB5_CONFIG="none" ;; esac fi KRB5_CONFIG=$ac_cv_path_KRB5_CONFIG if test -n "$KRB5_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $KRB5_CONFIG" >&5 $as_echo "$KRB5_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi else KRB5_CONFIG=none fi if test "x$KRB5_CONFIG" != "xnone"; then ne_save_CPPFLAGS=$CPPFLAGS ne_save_LIBS=$NEON_LIBS NEON_LIBS="$NEON_LIBS `${KRB5_CONFIG} --libs gssapi`" CPPFLAGS="$CPPFLAGS `${KRB5_CONFIG} --cflags gssapi`" # MIT and Heimdal put gssapi.h in different places for ac_header in gssapi/gssapi.h gssapi.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF ne_cf_save_LIBS=$LIBS LIBS="$LIBS $NEON_LIBS" for ac_func in gss_init_sec_context do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ne_save_CPPFLAGS=$CPPFLAGS ne_save_LIBS=$NEON_LIBS { $as_echo "$as_me:$LINENO: GSSAPI authentication support enabled" >&5 $as_echo "$as_me: GSSAPI authentication support enabled" >&6;} cat >>confdefs.h <<\_ACEOF #define HAVE_GSSAPI 1 _ACEOF for ac_header in gssapi/gssapi_generic.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Older versions of MIT Kerberos lack GSS_C_NT_HOSTBASED_SERVICE { $as_echo "$as_me:$LINENO: checking whether GSS_C_NT_HOSTBASED_SERVICE is declared" >&5 $as_echo_n "checking whether GSS_C_NT_HOSTBASED_SERVICE is declared... " >&6; } if test "${ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_GSSAPI_GSSAPI_H #include #else #include #endif int main () { #ifndef GSS_C_NT_HOSTBASED_SERVICE (void) GSS_C_NT_HOSTBASED_SERVICE; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" >&5 $as_echo "$ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" >&6; } if test "x$ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" = x""yes; then : else cat >>confdefs.h <<\_ACEOF #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name _ACEOF fi fi done LIBS=$ne_cf_save_LIBS break fi done CPPFLAGS=$ne_save_CPPFLAGS NEON_LIBS=$ne_save_LIBS fi # Check whether --with-libproxy was given. if test "${with_libproxy+set}" = set; then withval=$with_libproxy; fi if test "x$with_libproxy" != "xno"; then # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$PKG_CONFIG" = "no"; then : Not using pkg-config NE_FLAG_LIBPXY=no ne_LIBPXY_message="libproxy support not enabled" { $as_echo "$as_me:$LINENO: libproxy support not enabled" >&5 $as_echo "$as_me: libproxy support not enabled" >&6;} else { $as_echo "$as_me:$LINENO: checking for libproxy-1.0 pkg-config data" >&5 $as_echo_n "checking for libproxy-1.0 pkg-config data... " >&6; } if test "${ne_cv_pkg_libproxy_1_0+set}" = set; then $as_echo_n "(cached) " >&6 else if $PKG_CONFIG libproxy-1.0; then ne_cv_pkg_libproxy_1_0=yes else ne_cv_pkg_libproxy_1_0=no fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_pkg_libproxy_1_0" >&5 $as_echo "$ne_cv_pkg_libproxy_1_0" >&6; } if test "$ne_cv_pkg_libproxy_1_0" = "yes"; then NE_PXY_CFLAGS=`$PKG_CONFIG --cflags libproxy-1.0` NE_PXY_LIBS=`$PKG_CONFIG --libs libproxy-1.0` : Using provided pkg-config data cat >>confdefs.h <<\_ACEOF #define HAVE_LIBPROXY 1 _ACEOF CPPFLAGS="$CPPFLAGS $NE_PXY_CFLAGS" NEON_LIBS="$NEON_LIBS ${NE_PXY_LIBS}" NE_FLAG_LIBPXY=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_LIBPXY 1 _ACEOF ne_LIBPXY_message="libproxy support enabled" { $as_echo "$as_me:$LINENO: libproxy support enabled" >&5 $as_echo "$as_me: libproxy support enabled" >&6;} else : No pkg-config for libproxy-1.0 provided NE_FLAG_LIBPXY=no ne_LIBPXY_message="libproxy support not enabled" { $as_echo "$as_me:$LINENO: libproxy support not enabled" >&5 $as_echo "$as_me: libproxy support not enabled" >&6;} fi fi else NE_FLAG_LIBPXY=no ne_LIBPXY_message="libproxy support not enabled" { $as_echo "$as_me:$LINENO: libproxy support not enabled" >&5 $as_echo "$as_me: libproxy support not enabled" >&6;} fi CFLAGS="$CFLAGS -I$neon_bundled_srcdir" NEON_LIBS="-L$neon_bundled_builddir -lneon $NEON_LIBS" NEON_NEED_XML_PARSER=yes neon_library_message="included libneon (${NEON_VERSION})" else # Don't need to configure an XML parser NEON_NEED_XML_PARSER=no NEON_BUILD_BUNDLED=no fi # The colons are here so there is something to evaluate # in case the argument was not passed. if test "$neon_force_included" = "yes"; then : # We are using a bundled build, do the necessary stuff... # we have a bundled expat, and we don't need zlib support # Check whether --with-libxml2 was given. if test "${with_libxml2+set}" = set; then withval=$with_libxml2; fi # Check whether --with-expat was given. if test "${with_expat+set}" = set; then withval=$with_expat; fi # Check whether --with-included-expat was given. if test "${with_included_expat+set}" = set; then withval=$with_included_expat; else with_included_expat=no fi if test "$NEON_NEED_XML_PARSER" = "yes"; then # Find an XML parser neon_xml_parser=none # Forced choice of expat: case $with_expat in yes) if test "${ac_cv_header_expat_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for expat.h" >&5 $as_echo_n "checking for expat.h... " >&6; } if test "${ac_cv_header_expat_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_expat_h" >&5 $as_echo "$ac_cv_header_expat_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking expat.h usability" >&5 $as_echo_n "checking expat.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking expat.h presence" >&5 $as_echo_n "checking expat.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: expat.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: expat.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: expat.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: expat.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: expat.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: expat.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: expat.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: expat.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: expat.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: expat.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for expat.h" >&5 $as_echo_n "checking for expat.h... " >&6; } if test "${ac_cv_header_expat_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_expat_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_expat_h" >&5 $as_echo "$ac_cv_header_expat_h" >&6; } fi if test "x$ac_cv_header_expat_h" = x""yes; then { $as_echo "$as_me:$LINENO: checking for XML_SetXmlDeclHandler in -lexpat" >&5 $as_echo_n "checking for XML_SetXmlDeclHandler in -lexpat... " >&6; } if test "${ac_cv_lib_expat_XML_SetXmlDeclHandler+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lexpat $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 XML_SetXmlDeclHandler (); int main () { return XML_SetXmlDeclHandler (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_expat_XML_SetXmlDeclHandler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_expat_XML_SetXmlDeclHandler=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_expat_XML_SetXmlDeclHandler" >&5 $as_echo "$ac_cv_lib_expat_XML_SetXmlDeclHandler" >&6; } if test "x$ac_cv_lib_expat_XML_SetXmlDeclHandler" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_EXPAT 1 _ACEOF neon_xml_parser_message="expat" NEON_LIBS="$NEON_LIBS -lexpat" neon_xml_parser=expat { $as_echo "$as_me:$LINENO: checking for XML_Size" >&5 $as_echo_n "checking for XML_Size... " >&6; } if test "${ac_cv_type_XML_Size+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_XML_Size=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { if (sizeof (XML_Size)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { if (sizeof ((XML_Size))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_XML_Size=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_XML_Size" >&5 $as_echo "$ac_cv_type_XML_Size" >&6; } if test "x$ac_cv_type_XML_Size" = x""yes; then # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of XML_Size" >&5 $as_echo_n "checking size of XML_Size... " >&6; } if test "${ac_cv_sizeof_XML_Size+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_XML_Size=$ac_lo;; '') if test "$ac_cv_type_XML_Size" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_XML_Size=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include static long int longval () { return (long int) (sizeof (XML_Size)); } static unsigned long int ulongval () { return (long int) (sizeof (XML_Size)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (XML_Size))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (XML_Size)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (XML_Size)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_XML_Size=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_XML_Size" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_XML_Size=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_XML_Size" >&5 $as_echo "$ac_cv_sizeof_XML_Size" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_XML_SIZE $ac_cv_sizeof_XML_Size _ACEOF { $as_echo "$as_me:$LINENO: checking how to print XML_Size" >&5 $as_echo_n "checking how to print XML_Size... " >&6; } if test "${ne_cv_fmt_XML_Size+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_XML_Size=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { XML_Size i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_XML_Size=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_XML_Size in $ac_cv_sizeof_int) ne_cv_fmt_XML_Size="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_XML_Size="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_XML_Size="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_XML_Size" >&5 $as_echo "$ne_cv_fmt_XML_Size" >&6; } if test "x$ne_cv_fmt_XML_Size" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for XML_Size not found" >&5 $as_echo "$as_me: error: format string for XML_Size not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_XML_SIZE "$ne_cv_fmt_XML_Size" _ACEOF else cat >>confdefs.h <<_ACEOF #define NE_FMT_XML_SIZE "d" _ACEOF fi else { { $as_echo "$as_me:$LINENO: error: expat library not found, cannot proceed" >&5 $as_echo "$as_me: error: expat library not found, cannot proceed" >&2;} { (exit 1); exit 1; }; } fi else { { $as_echo "$as_me:$LINENO: error: expat library not found, cannot proceed" >&5 $as_echo "$as_me: error: expat library not found, cannot proceed" >&2;} { (exit 1); exit 1; }; } fi ;; no) ;; */libexpat.la) # Special case for Subversion ne_expdir=`echo $with_expat | sed 's:/libexpat.la$::'` cat >>confdefs.h <<\_ACEOF #define HAVE_EXPAT 1 _ACEOF cat >>confdefs.h <<_ACEOF #define NE_FMT_XML_SIZE "d" _ACEOF CPPFLAGS="$CPPFLAGS -I$ne_expdir" if test "x${NEON_TARGET}" = "xlibneon.la"; then NEON_LTLIBS=$with_expat else # no dependency on libexpat => crippled libneon, so do partial install ALLOW_INSTALL=lib fi neon_xml_parser=expat neon_xml_parser_message="expat in $ne_expdir" ;; /*) { { $as_echo "$as_me:$LINENO: error: --with-expat does not take a directory argument" >&5 $as_echo "$as_me: error: --with-expat does not take a directory argument" >&2;} { (exit 1); exit 1; }; } ;; esac # If expat wasn't specifically enabled and libxml was: if test "${neon_xml_parser}-${with_libxml2}-${with_included_expat}" = "none-yes-no"; then # Extract the first word of "xml2-config", so it can be a program name with args. set dummy xml2-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_XML2_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$XML2_CONFIG"; then ac_cv_prog_XML2_CONFIG="$XML2_CONFIG" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_XML2_CONFIG="xml2-config" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi XML2_CONFIG=$ac_cv_prog_XML2_CONFIG if test -n "$XML2_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5 $as_echo "$XML2_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test -n "$XML2_CONFIG"; then neon_xml_parser_message="libxml `$XML2_CONFIG --version`" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBXML 1 _ACEOF # xml2-config in some versions erroneously includes -I/include # in the --cflags output. CPPFLAGS="$CPPFLAGS `$XML2_CONFIG --cflags | sed 's| -I/include||g'`" NEON_LIBS="$NEON_LIBS `$XML2_CONFIG --libs | sed 's|-L/usr/lib ||g'`" for ac_header in libxml/xmlversion.h libxml/parser.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else { { $as_echo "$as_me:$LINENO: error: could not find parser.h, libxml installation problem?" >&5 $as_echo "$as_me: error: could not find parser.h, libxml installation problem?" >&2;} { (exit 1); exit 1; }; } fi done neon_xml_parser=libxml2 else { { $as_echo "$as_me:$LINENO: error: libxml2.x library not found, cannot proceed" >&5 $as_echo "$as_me: error: libxml2.x library not found, cannot proceed" >&2;} { (exit 1); exit 1; }; } fi fi # Otherwise, by default search for expat then libxml2: if test "${neon_xml_parser}-${with_included_expat}" = "none-no"; then if test "${ac_cv_header_expat_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for expat.h" >&5 $as_echo_n "checking for expat.h... " >&6; } if test "${ac_cv_header_expat_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_expat_h" >&5 $as_echo "$ac_cv_header_expat_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking expat.h usability" >&5 $as_echo_n "checking expat.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking expat.h presence" >&5 $as_echo_n "checking expat.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: expat.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: expat.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: expat.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: expat.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: expat.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: expat.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: expat.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: expat.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: expat.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: expat.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: expat.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for expat.h" >&5 $as_echo_n "checking for expat.h... " >&6; } if test "${ac_cv_header_expat_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_expat_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_expat_h" >&5 $as_echo "$ac_cv_header_expat_h" >&6; } fi if test "x$ac_cv_header_expat_h" = x""yes; then { $as_echo "$as_me:$LINENO: checking for XML_SetXmlDeclHandler in -lexpat" >&5 $as_echo_n "checking for XML_SetXmlDeclHandler in -lexpat... " >&6; } if test "${ac_cv_lib_expat_XML_SetXmlDeclHandler+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lexpat $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 XML_SetXmlDeclHandler (); int main () { return XML_SetXmlDeclHandler (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_expat_XML_SetXmlDeclHandler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_expat_XML_SetXmlDeclHandler=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_expat_XML_SetXmlDeclHandler" >&5 $as_echo "$ac_cv_lib_expat_XML_SetXmlDeclHandler" >&6; } if test "x$ac_cv_lib_expat_XML_SetXmlDeclHandler" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_EXPAT 1 _ACEOF neon_xml_parser_message="expat" NEON_LIBS="$NEON_LIBS -lexpat" neon_xml_parser=expat { $as_echo "$as_me:$LINENO: checking for XML_Size" >&5 $as_echo_n "checking for XML_Size... " >&6; } if test "${ac_cv_type_XML_Size+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_XML_Size=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { if (sizeof (XML_Size)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { if (sizeof ((XML_Size))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_XML_Size=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_XML_Size" >&5 $as_echo "$ac_cv_type_XML_Size" >&6; } if test "x$ac_cv_type_XML_Size" = x""yes; then # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of XML_Size" >&5 $as_echo_n "checking size of XML_Size... " >&6; } if test "${ac_cv_sizeof_XML_Size+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { static int test_array [1 - 2 * !(((long int) (sizeof (XML_Size))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_XML_Size=$ac_lo;; '') if test "$ac_cv_type_XML_Size" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_XML_Size=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include static long int longval () { return (long int) (sizeof (XML_Size)); } static unsigned long int ulongval () { return (long int) (sizeof (XML_Size)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (XML_Size))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (XML_Size)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (XML_Size)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_XML_Size=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_XML_Size" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (XML_Size) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_XML_Size=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_XML_Size" >&5 $as_echo "$ac_cv_sizeof_XML_Size" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_XML_SIZE $ac_cv_sizeof_XML_Size _ACEOF { $as_echo "$as_me:$LINENO: checking how to print XML_Size" >&5 $as_echo_n "checking how to print XML_Size... " >&6; } if test "${ne_cv_fmt_XML_Size+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_XML_Size=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { XML_Size i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_XML_Size=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_XML_Size in $ac_cv_sizeof_int) ne_cv_fmt_XML_Size="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_XML_Size="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_XML_Size="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_XML_Size" >&5 $as_echo "$ne_cv_fmt_XML_Size" >&6; } if test "x$ne_cv_fmt_XML_Size" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for XML_Size not found" >&5 $as_echo "$as_me: error: format string for XML_Size not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_XML_SIZE "$ne_cv_fmt_XML_Size" _ACEOF else cat >>confdefs.h <<_ACEOF #define NE_FMT_XML_SIZE "d" _ACEOF fi else # Extract the first word of "xml2-config", so it can be a program name with args. set dummy xml2-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_XML2_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$XML2_CONFIG"; then ac_cv_prog_XML2_CONFIG="$XML2_CONFIG" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_XML2_CONFIG="xml2-config" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi XML2_CONFIG=$ac_cv_prog_XML2_CONFIG if test -n "$XML2_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5 $as_echo "$XML2_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test -n "$XML2_CONFIG"; then neon_xml_parser_message="libxml `$XML2_CONFIG --version`" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBXML 1 _ACEOF # xml2-config in some versions erroneously includes -I/include # in the --cflags output. CPPFLAGS="$CPPFLAGS `$XML2_CONFIG --cflags | sed 's| -I/include||g'`" NEON_LIBS="$NEON_LIBS `$XML2_CONFIG --libs | sed 's|-L/usr/lib ||g'`" for ac_header in libxml/xmlversion.h libxml/parser.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else { { $as_echo "$as_me:$LINENO: error: could not find parser.h, libxml installation problem?" >&5 $as_echo "$as_me: error: could not find parser.h, libxml installation problem?" >&2;} { (exit 1); exit 1; }; } fi done neon_xml_parser=libxml2 else : fi fi else # Extract the first word of "xml2-config", so it can be a program name with args. set dummy xml2-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_XML2_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$XML2_CONFIG"; then ac_cv_prog_XML2_CONFIG="$XML2_CONFIG" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_XML2_CONFIG="xml2-config" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi XML2_CONFIG=$ac_cv_prog_XML2_CONFIG if test -n "$XML2_CONFIG"; then { $as_echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5 $as_echo "$XML2_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test -n "$XML2_CONFIG"; then neon_xml_parser_message="libxml `$XML2_CONFIG --version`" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBXML 1 _ACEOF # xml2-config in some versions erroneously includes -I/include # in the --cflags output. CPPFLAGS="$CPPFLAGS `$XML2_CONFIG --cflags | sed 's| -I/include||g'`" NEON_LIBS="$NEON_LIBS `$XML2_CONFIG --libs | sed 's|-L/usr/lib ||g'`" for ac_header in libxml/xmlversion.h libxml/parser.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else { { $as_echo "$as_me:$LINENO: error: could not find parser.h, libxml installation problem?" >&5 $as_echo "$as_me: error: could not find parser.h, libxml installation problem?" >&2;} { (exit 1); exit 1; }; } fi done neon_xml_parser=libxml2 else : fi fi fi # If an XML parser still has not been found, fail or use the bundled expat if test "$neon_xml_parser" = "none"; then # Configure the bundled copy of expat # Define XML_BYTE_ORDER for expat sources. if test $ac_cv_c_bigendian = "yes"; then ne_xml_border=21 else ne_xml_border=12 fi # mini-expat doesn't pick up config.h CPPFLAGS="$CPPFLAGS -DXML_BYTE_ORDER=$ne_xml_border -DXML_DTD -I\$(top_srcdir)/lib/expat/xmlparse -I\$(top_srcdir)/lib/expat/xmltok" cat >>confdefs.h <<_ACEOF #define NE_FMT_XML_SIZE "d" _ACEOF # Use the bundled expat sources case " $LIBOBJS " in *" \$(top_builddir)/lib/expat/xmltok/xmltok.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS \$(top_builddir)/lib/expat/xmltok/xmltok.$ac_objext" ;; esac case " $LIBOBJS " in *" \$(top_builddir)/lib/expat/xmltok/xmlrole.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS \$(top_builddir)/lib/expat/xmltok/xmlrole.$ac_objext" ;; esac case " $LIBOBJS " in *" \$(top_builddir)/lib/expat/xmlparse/xmlparse.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS \$(top_builddir)/lib/expat/xmlparse/xmlparse.$ac_objext" ;; esac case " $LIBOBJS " in *" \$(top_builddir)/lib/expat/xmlparse/hashtable.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS \$(top_builddir)/lib/expat/xmlparse/hashtable.$ac_objext" ;; esac cat >>confdefs.h <<\_ACEOF #define HAVE_EXPAT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_XMLPARSE_H 1 _ACEOF neon_xml_parser_message="bundled expat in \$(top_srcdir)/lib/expat" fi { $as_echo "$as_me:$LINENO: XML parser used: $neon_xml_parser_message" >&5 $as_echo "$as_me: XML parser used: $neon_xml_parser_message" >&6;} fi NEON_TARGET=libneon.a NEON_OBJEXT=o # Using the default set of object files to build. # Add the extension to EXTRAOBJS ne="$NEON_EXTRAOBJS" NEON_EXTRAOBJS= for o in $ne; do NEON_EXTRAOBJS="$NEON_EXTRAOBJS $o.$NEON_OBJEXT" done # Was DAV support explicitly turned off? if test "x$neon_no_webdav" = "xyes"; then # No WebDAV support NEONOBJS="$NEONOBJS \$(NEON_BASEOBJS)" NE_FLAG_DAV=no ne_DAV_message="WebDAV support is not enabled" { $as_echo "$as_me:$LINENO: WebDAV support is not enabled" >&5 $as_echo "$as_me: WebDAV support is not enabled" >&6;} if test "x${NE_LIBTOOL_RELEASE}y" = "xy"; then NE_LIBTOOL_RELEASE="NODAV" else NE_LIBTOOL_RELEASE="${NE_LIBTOOL_RELEASE}-NODAV" fi else # WebDAV support NEONOBJS="$NEONOBJS \$(NEON_DAVOBJS)" NE_FLAG_DAV=yes cat >>confdefs.h <<\_ACEOF #define NE_HAVE_DAV 1 _ACEOF ne_DAV_message="WebDAV support is enabled" { $as_echo "$as_me:$LINENO: WebDAV support is enabled" >&5 $as_echo "$as_me: WebDAV support is enabled" >&6;} fi else : # Not using a bundled build... do stuff. { $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* 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. */ char *t; 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 saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const /**/ _ACEOF fi for ac_header in stdlib.h string.h strings.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of time_t" >&5 $as_echo_n "checking size of time_t... " >&6; } if test "${ac_cv_sizeof_time_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_TIME_H #include #endif int main () { static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_TIME_H #include #endif int main () { static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_TIME_H #include #endif int main () { static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_TIME_H #include #endif int main () { static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_TIME_H #include #endif int main () { static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_time_t=$ac_lo;; '') if test "$ac_cv_type_time_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (time_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (time_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_time_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_TIME_H #include #endif static long int longval () { return (long int) (sizeof (time_t)); } static unsigned long int ulongval () { return (long int) (sizeof (time_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (time_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (time_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (time_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_time_t=`cat conftest.val` 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 ( exit $ac_status ) if test "$ac_cv_type_time_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (time_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (time_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_time_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5 $as_echo "$ac_cv_sizeof_time_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_TIME_T $ac_cv_sizeof_time_t _ACEOF { $as_echo "$as_me:$LINENO: checking how to print time_t" >&5 $as_echo_n "checking how to print time_t... " >&6; } if test "${ne_cv_fmt_time_t+set}" = set; then $as_echo_n "(cached) " >&6 else ne_cv_fmt_time_t=none if test $ne_fmt_trycompile = yes; then oflags="$CPPFLAGS" # Consider format string mismatches as errors CPPFLAGS="$CPPFLAGS -Wformat -Werror" for str in d ld lld; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef HAVE_SYS_TIME_H #include #endif #include int main () { time_t i = 1; printf("%$str", i); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ne_cv_fmt_time_t=$str; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS=$oflags else # Best guess. Don't have to be too precise since we probably won't # get a warning message anyway. case $ac_cv_sizeof_time_t in $ac_cv_sizeof_int) ne_cv_fmt_time_t="d" ;; $ac_cv_sizeof_long) ne_cv_fmt_time_t="ld" ;; $ac_cv_sizeof_long_long) ne_cv_fmt_time_t="lld" ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ne_cv_fmt_time_t" >&5 $as_echo "$ne_cv_fmt_time_t" >&6; } if test "x$ne_cv_fmt_time_t" = "xnone"; then { { $as_echo "$as_me:$LINENO: error: format string for time_t not found" >&5 $as_echo "$as_me: error: format string for time_t not found" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define NE_FMT_TIME_T "$ne_cv_fmt_time_t" _ACEOF if test "$enable_netrc" = "yes"; then case " $LIBOBJS " in *" lib/netrc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lib/netrc.$ac_objext" ;; esac cat >>confdefs.h <<\_ACEOF #define ENABLE_NETRC 1 _ACEOF { $as_echo "$as_me:$LINENO: .netrc support is enabled" >&5 $as_echo "$as_me: .netrc support is enabled" >&6;} else { $as_echo "$as_me:$LINENO: .netrc support is not enabled" >&5 $as_echo "$as_me: .netrc support is not enabled" >&6;} fi { $as_echo "$as_me:$LINENO: checking for getopt_long" >&5 $as_echo_n "checking for getopt_long... " >&6; } if test "${ac_cv_func_getopt_long+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getopt_long to an innocuous variant, in case declares getopt_long. For example, HP-UX 11i declares gettimeofday. */ #define getopt_long innocuous_getopt_long /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getopt_long (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getopt_long /* 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 getopt_long (); /* 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_getopt_long || defined __stub___getopt_long choke me #endif int main () { return getopt_long (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_getopt_long=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getopt_long=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_getopt_long" >&5 $as_echo "$ac_cv_func_getopt_long" >&6; } if test "x$ac_cv_func_getopt_long" = x""yes; then : else case " $LIBOBJS " in *" lib/getopt.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lib/getopt.$ac_objext" ;; esac case " $LIBOBJS " in *" lib/getopt1.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lib/getopt1.$ac_objext" ;; esac fi { $as_echo "$as_me:$LINENO: checking for strcasecmp" >&5 $as_echo_n "checking for strcasecmp... " >&6; } if test "${ac_cv_func_strcasecmp+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strcasecmp to an innocuous variant, in case declares strcasecmp. For example, HP-UX 11i declares gettimeofday. */ #define strcasecmp innocuous_strcasecmp /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strcasecmp (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strcasecmp /* 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 strcasecmp (); /* 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_strcasecmp || defined __stub___strcasecmp choke me #endif int main () { return strcasecmp (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_strcasecmp=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strcasecmp=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_strcasecmp" >&5 $as_echo "$ac_cv_func_strcasecmp" >&6; } if test "x$ac_cv_func_strcasecmp" = x""yes; then : else case " $LIBOBJS " in *" lib/strcasecmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lib/strcasecmp.$ac_objext" ;; esac fi { $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for unsigned long long" >&5 $as_echo_n "checking for unsigned long long... " >&6; } if test "${ac_cv_type_unsigned_long_long+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ unsigned long long ull = 1; int i = 63; int main () { unsigned long long ullmax = (unsigned long long) -1; return ull << i | ull >> i | ullmax / ull | ullmax % ull; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_type_unsigned_long_long=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_unsigned_long_long=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 $as_echo "$ac_cv_type_unsigned_long_long" >&6; } if test $ac_cv_type_unsigned_long_long = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_UNSIGNED_LONG_LONG 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for uintmax_t" >&5 $as_echo_n "checking for uintmax_t... " >&6; } if test "${ac_cv_type_uintmax_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_uintmax_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (uintmax_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((uintmax_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uintmax_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5 $as_echo "$ac_cv_type_uintmax_t" >&6; } if test "x$ac_cv_type_uintmax_t" = x""yes; then : else test $ac_cv_type_unsigned_long_long = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' cat >>confdefs.h <<_ACEOF #define uintmax_t $ac_type _ACEOF fi { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : 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 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 $as_echo_n "checking whether stat file-mode macros are broken... " >&6; } if test "${ac_cv_header_stat_broken+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if defined S_ISBLK && defined S_IFDIR extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; #endif #if defined S_ISBLK && defined S_IFCHR extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; #endif #if defined S_ISLNK && defined S_IFREG extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; #endif #if defined S_ISSOCK && defined S_IFREG extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stat_broken=no else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stat_broken=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 $as_echo "$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then cat >>confdefs.h <<\_ACEOF #define STAT_MACROS_BROKEN 1 _ACEOF fi for ac_header in fcntl.h sys/time.h stdint.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in __secure_getenv gettimeofday do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking whether getenv is declared" >&5 $as_echo_n "checking whether getenv is declared... " >&6; } if test "${ac_cv_have_decl_getenv+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef getenv (void) getenv; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_getenv=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_getenv=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 $as_echo "$ac_cv_have_decl_getenv" >&6; } if test "x$ac_cv_have_decl_getenv" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETENV 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETENV 0 _ACEOF fi # Check for snprintf { $as_echo "$as_me:$LINENO: checking for snprintf" >&5 $as_echo_n "checking for snprintf... " >&6; } if test "${ac_cv_func_snprintf+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define snprintf to an innocuous variant, in case declares snprintf. For example, HP-UX 11i declares gettimeofday. */ #define snprintf innocuous_snprintf /* System header to define __stub macros and hopefully few prototypes, which can conflict with char snprintf (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef snprintf /* 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 snprintf (); /* 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_snprintf || defined __stub___snprintf choke me #endif int main () { return snprintf (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_snprintf=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_snprintf=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_snprintf" >&5 $as_echo "$ac_cv_func_snprintf" >&6; } if test "x$ac_cv_func_snprintf" = x""yes; then : else cat >>confdefs.h <<\_ACEOF #define HAVE_SNPRINTF_H 1 _ACEOF case " $LIBOBJS " in *" lib/snprintf.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lib/snprintf.$ac_objext" ;; esac fi { $as_echo "$as_me:$LINENO: checking for working POSIX fnmatch" >&5 $as_echo_n "checking for working POSIX fnmatch... " >&6; } if test "${ac_cv_func_fnmatch_works+set}" = set; then $as_echo_n "(cached) " >&6 else # Some versions of Solaris, SCO, and the GNU C Library # have a broken or incompatible fnmatch. # So we run a test program. If we are cross-compiling, take no chance. # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. if test "$cross_compiling" = yes; then ac_cv_func_fnmatch_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include # define y(a, b, c) (fnmatch (a, b, c) == 0) # define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH) int main () { return (!(y ("a*", "abc", 0) && n ("d*/*1", "d/s/1", FNM_PATHNAME) && y ("a\\\\bc", "abc", 0) && n ("a\\\\bc", "abc", FNM_NOESCAPE) && y ("*x", ".x", 0) && n ("*x", ".x", FNM_PERIOD) && 1)); ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_fnmatch_works=yes 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 ( exit $ac_status ) ac_cv_func_fnmatch_works=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_fnmatch_works" >&5 $as_echo "$ac_cv_func_fnmatch_works" >&6; } if test $ac_cv_func_fnmatch_works = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_FNMATCH 1 _ACEOF fi if test $ac_cv_func_fnmatch_works = no; then case " $LIBOBJS " in *" lib/fnmatch.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lib/fnmatch.$ac_objext" ;; esac fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_opendir=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_opendir=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if test "${ac_cv_type_signal+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF { $as_echo "$as_me:$LINENO: checking for unsigned long long int" >&5 $as_echo_n "checking for unsigned long long int... " >&6; } if test "${ac_cv_type_unsigned_long_long_int+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Test preprocessor. */ #if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) error in preprocessor; #endif #if ! (18446744073709551615ULL <= -1ull) error in preprocessor; #endif /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; int i = 63; int main () { /* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | (llmax / ll) | (llmax % ll) | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) | (ullmax / ull) | (ullmax % ull)); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_type_unsigned_long_long_int=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_unsigned_long_long_int=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long_int" >&5 $as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } if test $ac_cv_type_unsigned_long_long_int = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_UNSIGNED_LONG_LONG_INT 1 _ACEOF fi for ac_func in strdup strerror memcpy strcoll tcsetattr getpass stty fchmod strtoull do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/time.h pwd.h stdarg.h vmsdir.h memory.h alloca.h ncurses.h sgtty.h termios.h termio.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in localtime_r do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in strftime do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else case " $LIBOBJS " in *" $ac_func.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; esac fi done { $as_echo "$as_me:$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 test "${ac_cv_path_mkdir+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 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. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac { $as_echo "$as_me:$LINENO: checking whether NLS is requested" >&5 $as_echo_n "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. if test "${enable_nls+set}" = set; then enableval=$enable_nls; USE_NLS=$enableval else USE_NLS=yes fi { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5 $as_echo "$USE_NLS" >&6; } GETTEXT_MACRO_VERSION=0.17 # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_MSGFMT+set}" = set; then $as_echo_n "(cached) " >&6 else case "$MSGFMT" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then { $as_echo "$as_me:$LINENO: result: $MSGFMT" >&5 $as_echo "$MSGFMT" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GMSGFMT+set}" = set; then $as_echo_n "(cached) " >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { $as_echo "$as_me:$LINENO: result: $GMSGFMT" >&5 $as_echo "$GMSGFMT" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; *) MSGFMT_015=$MSGFMT ;; esac case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_XGETTEXT+set}" = set; then $as_echo_n "(cached) " >&6 else case "$XGETTEXT" in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { $as_echo "$as_me:$LINENO: result: $XGETTEXT" >&5 $as_echo "$XGETTEXT" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi rm -f messages.po case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; *) XGETTEXT_015=$XGETTEXT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_MSGMERGE+set}" = set; then $as_echo_n "(cached) " >&6 else case "$MSGMERGE" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" ;; esac fi MSGMERGE="$ac_cv_path_MSGMERGE" if test "$MSGMERGE" != ":"; then { $as_echo "$as_me:$LINENO: result: $MSGMERGE" >&5 $as_echo "$MSGMERGE" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$localedir" || localedir='${datadir}/locale' test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= ac_config_commands="$ac_config_commands po-directories" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 $as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; 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_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 $as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 $as_echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; 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:$LINENO: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 $as_echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; 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 { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2 or newer" >&5 $as_echo_n "checking whether we are using the GNU C Library 2 or newer... " >&6; } if test "${ac_cv_gnu_library_2+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ >= 2) Lucky GNU user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky GNU user" >/dev/null 2>&1; then ac_cv_gnu_library_2=yes else ac_cv_gnu_library_2=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2" >&5 $as_echo "$ac_cv_gnu_library_2" >&6; } GLIBC2="$ac_cv_gnu_library_2" CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then { $as_echo "$as_me:$LINENO: checking for simple visibility declarations" >&5 $as_echo_n "checking for simple visibility declarations... " >&6; } if test "${gl_cv_cc_visibility+set}" = set; then $as_echo_n "(cached) " >&6 else gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void); int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then gl_cv_cc_visibility=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gl_cv_cc_visibility=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$gl_save_CFLAGS" fi { $as_echo "$as_me:$LINENO: result: $gl_cv_cc_visibility" >&5 $as_echo "$gl_cv_cc_visibility" >&6; } if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 fi fi cat >>confdefs.h <<_ACEOF #define HAVE_VISIBILITY $HAVE_VISIBILITY _ACEOF { $as_echo "$as_me:$LINENO: checking for stdint.h" >&5 $as_echo_n "checking for stdint.h... " >&6; } if test "${gl_cv_header_stdint_h+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { uintmax_t i = (uintmax_t) -1; return !i; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then gl_cv_header_stdint_h=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gl_cv_header_stdint_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5 $as_echo "$gl_cv_header_stdint_h" >&6; } if test $gl_cv_header_stdint_h = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STDINT_H_WITH_UINTMAX 1 _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if test "${ac_cv_working_alloca_h+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_working_alloca_h=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$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 cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if test "${ac_cv_func_alloca_works+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 */ char *alloca (); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_alloca_works=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$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 cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 _ACEOF 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 cat >>confdefs.h <<\_ACEOF #define C_ALLOCA 1 _ACEOF { $as_echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if test "${ac_cv_os_cray+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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:$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` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if test "${ac_cv_c_stack_direction+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 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 ( exit $ac_status ) ac_cv_c_stack_direction=-1 fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$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 stdlib.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; int i, pagesize; int fd; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 1; if (write (fd, data, pagesize) != pagesize) return 1; close (fd); /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 1; data2 = (char *) malloc (2 * pagesize); if (!data2) return 1; data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 1; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 1; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 1; if (read (fd, data3, pagesize) != pagesize) return 1; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 1; close (fd); return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes 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 ( exit $ac_status ) ac_cv_func_mmap_fixed_mapped=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 _ACEOF fi rm -f conftest.mmap { $as_echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 $as_echo_n "checking whether integer division by zero raises SIGFPE... " >&6; } if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then $as_echo_n "(cached) " >&6 else gt_cv_int_divbyzero_sigfpe= case "$host_os" in macos* | darwin[6-9]* | darwin[1-9][0-9]*) # On MacOS X 10.2 or newer, just assume the same as when cross- # compiling. If we were to perform the real test, 1 Crash Report # dialog window would pop up. case "$host_cpu" in i[34567]86 | x86_64) gt_cv_int_divbyzero_sigfpe="guessing yes" ;; esac ;; esac if test -z "$gt_cv_int_divbyzero_sigfpe"; then if test "$cross_compiling" = yes; then # Guess based on the CPU. case "$host_cpu" in alpha* | i[34567]86 | x86_64 | m68k | s390*) gt_cv_int_divbyzero_sigfpe="guessing yes";; *) gt_cv_int_divbyzero_sigfpe="guessing no";; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include static void sigfpe_handler (int sig) { /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ exit (sig != SIGFPE); } int x = 1; int y = 0; int z; int nan; int main () { signal (SIGFPE, sigfpe_handler); /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) signal (SIGTRAP, sigfpe_handler); #endif /* Linux/SPARC yields signal SIGILL. */ #if defined (__sparc__) && defined (__linux__) signal (SIGILL, sigfpe_handler); #endif z = x / y; nan = y / y; exit (1); } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_int_divbyzero_sigfpe=yes 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 ( exit $ac_status ) gt_cv_int_divbyzero_sigfpe=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 $as_echo "$gt_cv_int_divbyzero_sigfpe" >&6; } case "$gt_cv_int_divbyzero_sigfpe" in *yes) value=1;; *) value=0;; esac cat >>confdefs.h <<_ACEOF #define INTDIV0_RAISES_SIGFPE $value _ACEOF { $as_echo "$as_me:$LINENO: checking for inttypes.h" >&5 $as_echo_n "checking for inttypes.h... " >&6; } if test "${gl_cv_header_inttypes_h+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { uintmax_t i = (uintmax_t) -1; return !i; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then gl_cv_header_inttypes_h=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gl_cv_header_inttypes_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5 $as_echo "$gl_cv_header_inttypes_h" >&6; } if test $gl_cv_header_inttypes_h = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_INTTYPES_H_WITH_UINTMAX 1 _ACEOF fi if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then test $ac_cv_type_unsigned_long_long_int = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' cat >>confdefs.h <<_ACEOF #define uintmax_t $ac_type _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_UINTMAX_T 1 _ACEOF fi for ac_header in inttypes.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test $ac_cv_header_inttypes_h = yes; then { $as_echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 $as_echo_n "checking whether the inttypes.h PRIxNN macros are broken... " >&6; } if test "${gt_cv_inttypes_pri_broken+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef PRId32 char *p = PRId32; #endif int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then gt_cv_inttypes_pri_broken=no else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_inttypes_pri_broken=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 $as_echo "$gt_cv_inttypes_pri_broken" >&6; } fi if test "$gt_cv_inttypes_pri_broken" = yes; then cat >>confdefs.h <<_ACEOF #define PRI_MACROS_BROKEN 1 _ACEOF PRI_MACROS_BROKEN=1 else PRI_MACROS_BROKEN=0 fi # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then enableval=$enable_threads; gl_use_threads=$enableval else case "$host_os" in osf*) gl_use_threads=no ;; *) gl_use_threads=yes ;; esac fi if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # For using : case "$host_os" in osf*) # On OSF/1, the compiler needs the flag -D_REENTRANT so that it # groks . cc also understands the flag -pthread, but # we don't use it because 1. gcc-2.95 doesn't understand -pthread, # 2. putting a flag into CPPFLAGS that has an effect on the linker # causes the AC_TRY_LINK test below to succeed unexpectedly, # leading to wrong values of LIBTHREAD and LTLIBTHREAD. CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the # definition of 'errno' in . case "$host_os" in aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac fi 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 echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:$LINENO: checking for ld used by GCC" >&5 $as_echo_n "checking for ld used by GCC... " >&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. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path 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:$LINENO: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${acl_cv_path_LD+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do 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 GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi fi LD="$acl_cv_path_LD" if test -n "$LD"; then { $as_echo "$as_me:$LINENO: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${acl_cv_prog_gnu_ld+set}" = set; then $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU ld's 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:$LINENO: checking for shared library run path origin" >&5 $as_echo_n "checking for shared library run path origin... " >&6; } if test "${acl_cv_rpath+set}" = set; 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:$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 acl_libdirstem=lib 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 ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi gl_threads_api=none LIBTHREAD= LTLIBTHREAD= LIBMULTITHREAD= LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then { $as_echo "$as_me:$LINENO: checking whether imported symbols can be declared weak" >&5 $as_echo_n "checking whether imported symbols can be declared weak... " >&6; } gl_have_weak=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern void xyzzy (); #pragma weak xyzzy int main () { xyzzy(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gl_have_weak=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $gl_have_weak" >&5 $as_echo "$gl_have_weak" >&6; } if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks . It's added above, in gl_LOCK_EARLY_BODY. if test "${ac_cv_header_pthread_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for pthread.h" >&5 $as_echo_n "checking for pthread.h... " >&6; } if test "${ac_cv_header_pthread_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 $as_echo "$ac_cv_header_pthread_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking pthread.h usability" >&5 $as_echo_n "checking pthread.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking pthread.h presence" >&5 $as_echo_n "checking pthread.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for pthread.h" >&5 $as_echo_n "checking for pthread.h... " >&6; } if test "${ac_cv_header_pthread_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_pthread_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 $as_echo "$ac_cv_header_pthread_h" >&6; } fi if test "x$ac_cv_header_pthread_h" = x""yes; then gl_have_pthread_h=yes else gl_have_pthread_h=no fi if test "$gl_have_pthread_h" = yes; then # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads gl_have_pthread= # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist # in libc. IRIX 6.5 has the first one in both libc and libpthread, but # the second one only in libpthread, and lock.c needs it. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { pthread_mutex_lock((pthread_mutex_t*)0); pthread_mutexattr_init((pthread_mutexattr_t*)0); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gl_have_pthread=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) if test -n "$gl_have_pthread"; then # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. { $as_echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5 $as_echo_n "checking for pthread_kill in -lpthread... " >&6; } if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 pthread_kill (); int main () { return pthread_kill (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_pthread_pthread_kill=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_kill=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill" >&5 $as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = x""yes; then LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a # thread: pthread_create from libc will fail, whereas # pthread_create will actually create a thread. case "$host_os" in solaris* | hpux*) cat >>confdefs.h <<\_ACEOF #define PTHREAD_IN_USE_DETECTION_HARD 1 _ACEOF esac fi else # Some library is needed. Try libpthread and libc_r. { $as_echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5 $as_echo_n "checking for pthread_kill in -lpthread... " >&6; } if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 pthread_kill (); int main () { return pthread_kill (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_pthread_pthread_kill=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_kill=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill" >&5 $as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } if test "x$ac_cv_lib_pthread_pthread_kill" = x""yes; then gl_have_pthread=yes LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread fi if test -z "$gl_have_pthread"; then # For FreeBSD 4. { $as_echo "$as_me:$LINENO: checking for pthread_kill in -lc_r" >&5 $as_echo_n "checking for pthread_kill in -lc_r... " >&6; } if test "${ac_cv_lib_c_r_pthread_kill+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 pthread_kill (); int main () { return pthread_kill (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_c_r_pthread_kill=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_r_pthread_kill=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_kill" >&5 $as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } if test "x$ac_cv_lib_c_r_pthread_kill" = x""yes; then gl_have_pthread=yes LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r fi fi fi if test -n "$gl_have_pthread"; then gl_threads_api=posix cat >>confdefs.h <<\_ACEOF #define USE_POSIX_THREADS 1 _ACEOF if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then if test $gl_have_weak = yes; then cat >>confdefs.h <<\_ACEOF #define USE_POSIX_THREADS_WEAK 1 _ACEOF LIBTHREAD= LTLIBTHREAD= fi fi # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the # pthread_rwlock_* functions. { $as_echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5 $as_echo_n "checking for pthread_rwlock_t... " >&6; } if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_pthread_rwlock_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { if (sizeof (pthread_rwlock_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { if (sizeof ((pthread_rwlock_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pthread_rwlock_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlock_t" >&5 $as_echo "$ac_cv_type_pthread_rwlock_t" >&6; } if test "x$ac_cv_type_pthread_rwlock_t" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_PTHREAD_RWLOCK 1 _ACEOF fi # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if __FreeBSD__ == 4 error "No, in FreeBSD 4.0 recursive mutexes actually don't work." #else int x = (int)PTHREAD_MUTEX_RECURSIVE; return !x; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >>confdefs.h <<\_ACEOF #define HAVE_PTHREAD_MUTEX_RECURSIVE 1 _ACEOF else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi fi fi if test -z "$gl_have_pthread"; then if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then gl_have_solaristhread= gl_save_LIBS="$LIBS" LIBS="$LIBS -lthread" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { thr_self(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gl_have_solaristhread=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$gl_save_LIBS" if test -n "$gl_have_solaristhread"; then gl_threads_api=solaris LIBTHREAD=-lthread LTLIBTHREAD=-lthread LIBMULTITHREAD="$LIBTHREAD" LTLIBMULTITHREAD="$LTLIBTHREAD" cat >>confdefs.h <<\_ACEOF #define USE_SOLARIS_THREADS 1 _ACEOF if test $gl_have_weak = yes; then cat >>confdefs.h <<\_ACEOF #define USE_SOLARIS_THREADS_WEAK 1 _ACEOF LIBTHREAD= LTLIBTHREAD= fi fi fi fi if test "$gl_use_threads" = pth; then gl_save_CPPFLAGS="$CPPFLAGS" { $as_echo "$as_me:$LINENO: checking how to link with libpth" >&5 $as_echo_n "checking how to link with libpth... " >&6; } if test "${ac_cv_libpth_libs+set}" = set; then $as_echo_n "(cached) " >&6 else 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-libpth-prefix was given. if test "${with_libpth_prefix+set}" = set; then withval=$with_libpth_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" fi fi fi LIBPTH= LTLIBPTH= INCPTH= LIBPTH_PREFIX= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='pth ' 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" || LIBPTH="${LIBPTH}${LIBPTH:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }$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 $LTLIBPTH; 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 LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-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"; then LIBPTH="${LIBPTH}${LIBPTH:+ }$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 LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBPTH="${LIBPTH}${LIBPTH:+ }$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 $LIBPTH; 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 LIBPTH="${LIBPTH}${LIBPTH:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBPTH="${LIBPTH}${LIBPTH:+ }$found_so" else LIBPTH="${LIBPTH}${LIBPTH:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBPTH="${LIBPTH}${LIBPTH:+ }$found_a" else LIBPTH="${LIBPTH}${LIBPTH:+ }-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/"'*$,,'` LIBPTH_PREFIX="$basedir" 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 $INCPTH; 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 INCPTH="${INCPTH}${INCPTH:+ }-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"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; 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 $LIBPTH; 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 LIBPTH="${LIBPTH}${LIBPTH:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBPTH; 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 LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-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$,,'` ;; *) LIBPTH="${LIBPTH}${LIBPTH:+ }$dep" LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }$dep" ;; esac done fi else LIBPTH="${LIBPTH}${LIBPTH:+ }-l$name" LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-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" LIBPTH="${LIBPTH}${LIBPTH:+ }$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" LIBPTH="${LIBPTH}${LIBPTH:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBPTH="${LTLIBPTH}${LTLIBPTH:+ }-R$found_dir" done fi ac_cv_libpth_libs="$LIBPTH" ac_cv_libpth_ltlibs="$LTLIBPTH" ac_cv_libpth_cppflags="$INCPTH" ac_cv_libpth_prefix="$LIBPTH_PREFIX" fi { $as_echo "$as_me:$LINENO: result: $ac_cv_libpth_libs" >&5 $as_echo "$ac_cv_libpth_libs" >&6; } LIBPTH="$ac_cv_libpth_libs" LTLIBPTH="$ac_cv_libpth_ltlibs" INCPTH="$ac_cv_libpth_cppflags" LIBPTH_PREFIX="$ac_cv_libpth_prefix" for element in $INCPTH; 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 HAVE_LIBPTH=yes gl_have_pth= gl_save_LIBS="$LIBS" LIBS="$LIBS -lpth" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { pth_self(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gl_have_pth=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$gl_save_LIBS" if test -n "$gl_have_pth"; then gl_threads_api=pth LIBTHREAD="$LIBPTH" LTLIBTHREAD="$LTLIBPTH" LIBMULTITHREAD="$LIBTHREAD" LTLIBMULTITHREAD="$LTLIBTHREAD" cat >>confdefs.h <<\_ACEOF #define USE_PTH_THREADS 1 _ACEOF if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then if test $gl_have_weak = yes; then cat >>confdefs.h <<\_ACEOF #define USE_PTH_THREADS_WEAK 1 _ACEOF LIBTHREAD= LTLIBTHREAD= fi fi else CPPFLAGS="$gl_save_CPPFLAGS" fi fi if test -z "$gl_have_pthread"; then if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then if { case "$host_os" in mingw*) true;; *) false;; esac }; then gl_threads_api=win32 cat >>confdefs.h <<\_ACEOF #define USE_WIN32_THREADS 1 _ACEOF fi fi fi fi { $as_echo "$as_me:$LINENO: checking for multithread API to use" >&5 $as_echo_n "checking for multithread API to use... " >&6; } { $as_echo "$as_me:$LINENO: result: $gl_threads_api" >&5 $as_echo "$gl_threads_api" >&6; } 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" fi fi fi LIBICONV= LTLIBICONV= INCICONV= LIBICONV_PREFIX= 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"; 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/"'*$,,'` LIBICONV_PREFIX="$basedir" 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"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; 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 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; } int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then cat >>confdefs.h <<\_ACEOF #define HAVE_BUILTIN_EXPECT 1 _ACEOF else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext for ac_header in argz.h inttypes.h limits.h unistd.h sys/param.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getcwd getegid geteuid getgid getuid mempcpy munmap \ stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \ argz_next __fsetlocking do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 $as_echo_n "checking whether feof_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef feof_unlocked char *p = (char *) feof_unlocked; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_feof_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_feof_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 $as_echo "$ac_cv_have_decl_feof_unlocked" >&6; } if test $ac_cv_have_decl_feof_unlocked = yes; then gt_value=1 else gt_value=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FEOF_UNLOCKED $gt_value _ACEOF { $as_echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 $as_echo_n "checking whether fgets_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_fgets_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef fgets_unlocked char *p = (char *) fgets_unlocked; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_fgets_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_fgets_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 $as_echo "$ac_cv_have_decl_fgets_unlocked" >&6; } if test $ac_cv_have_decl_fgets_unlocked = yes; then gt_value=1 else gt_value=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FGETS_UNLOCKED $gt_value _ACEOF 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:$LINENO: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if test "${am_cv_func_iconv+set}" = set; then $as_echo_n "(cached) " >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then am_cv_func_iconv=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then am_cv_lib_iconv=yes am_cv_func_iconv=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { $as_echo "$as_me:$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:$LINENO: checking for working iconv" >&5 $as_echo_n "checking for working iconv... " >&6; } if test "${am_cv_func_iconv_works+set}" = set; then $as_echo_n "(cached) " >&6 else am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { /* 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 const char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; 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, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) return 1; } } #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 const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; 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, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) return 1; } } #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)) return 1; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_func_iconv_works=yes 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 ( exit $ac_status ) am_cv_func_iconv_works=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi LIBS="$am_save_LIBS" fi { $as_echo "$as_me:$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 cat >>confdefs.h <<\_ACEOF #define HAVE_ICONV 1 _ACEOF fi if test "$am_cv_lib_iconv" = yes; then { $as_echo "$as_me:$LINENO: checking how to link with libiconv" >&5 $as_echo_n "checking how to link with libiconv... " >&6; } { $as_echo "$as_me:$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:$LINENO: checking for iconv declaration" >&5 $as_echo_n "checking for iconv declaration... " >&6; } if test "${am_cv_proto_iconv+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || 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 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then am_cv_proto_iconv_arg1="" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$LINENO: result: ${ac_t:- }$am_cv_proto_iconv" >&5 $as_echo "${ac_t:- }$am_cv_proto_iconv" >&6; } cat >>confdefs.h <<_ACEOF #define ICONV_CONST $am_cv_proto_iconv_arg1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for NL_LOCALE_NAME macro" >&5 $as_echo_n "checking for NL_LOCALE_NAME macro... " >&6; } if test "${gt_cv_nl_locale_name+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES)); return !cs; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gt_cv_nl_locale_name=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_nl_locale_name=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gt_cv_nl_locale_name" >&5 $as_echo "$gt_cv_nl_locale_name" >&6; } if test $gt_cv_nl_locale_name = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_NL_LOCALE_NAME 1 _ACEOF fi for ac_prog in bison 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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_INTLBISON+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$INTLBISON"; then ac_cv_prog_INTLBISON="$INTLBISON" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_INTLBISON="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi INTLBISON=$ac_cv_prog_INTLBISON if test -n "$INTLBISON"; then { $as_echo "$as_me:$LINENO: result: $INTLBISON" >&5 $as_echo "$INTLBISON" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$INTLBISON" && break done if test -z "$INTLBISON"; then ac_verc_fail=yes else { $as_echo "$as_me:$LINENO: checking version of bison" >&5 $as_echo_n "checking version of bison... " >&6; } ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac { $as_echo "$as_me:$LINENO: result: $ac_prog_version" >&5 $as_echo "$ac_prog_version" >&6; } fi if test $ac_verc_fail = yes; then INTLBISON=: fi { $as_echo "$as_me:$LINENO: checking for long long int" >&5 $as_echo_n "checking for long long int... " >&6; } if test "${ac_cv_type_long_long_int+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Test preprocessor. */ #if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) error in preprocessor; #endif #if ! (18446744073709551615ULL <= -1ull) error in preprocessor; #endif /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; int i = 63; int main () { /* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | (llmax / ll) | (llmax % ll) | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) | (ullmax / ull) | (ullmax % ull)); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then if test "$cross_compiling" = yes; then ac_cv_type_long_long_int=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifndef LLONG_MAX # define HALF \ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) # define LLONG_MAX (HALF - 1 + HALF) #endif int main () { long long int n = 1; int i; for (i = 0; ; i++) { long long int m = n << i; if (m >> i != n) return 1; if (LLONG_MAX / 2 < m) break; } return 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long_long_int=yes 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 ( exit $ac_status ) ac_cv_type_long_long_int=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long_int=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5 $as_echo "$ac_cv_type_long_long_int" >&6; } if test $ac_cv_type_long_long_int = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LONG_LONG_INT 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for wchar_t" >&5 $as_echo_n "checking for wchar_t... " >&6; } if test "${gt_cv_c_wchar_t+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include wchar_t foo = (wchar_t)'\0'; int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then gt_cv_c_wchar_t=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_c_wchar_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 $as_echo "$gt_cv_c_wchar_t" >&6; } if test $gt_cv_c_wchar_t = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WCHAR_T 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for wint_t" >&5 $as_echo_n "checking for wint_t... " >&6; } if test "${gt_cv_c_wint_t+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be included before . */ #include #include #include #include wint_t foo = (wchar_t)'\0'; int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then gt_cv_c_wint_t=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_c_wint_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 $as_echo "$gt_cv_c_wint_t" >&6; } if test $gt_cv_c_wint_t = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WINT_T 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for intmax_t" >&5 $as_echo_n "checking for intmax_t... " >&6; } if test "${gt_cv_c_intmax_t+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if HAVE_STDINT_H_WITH_UINTMAX #include #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include #endif int main () { intmax_t x = -1; return !x; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then gt_cv_c_intmax_t=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_c_intmax_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gt_cv_c_intmax_t" >&5 $as_echo "$gt_cv_c_intmax_t" >&6; } if test $gt_cv_c_intmax_t = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_INTMAX_T 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether printf() supports POSIX/XSI format strings" >&5 $as_echo_n "checking whether printf() supports POSIX/XSI format strings... " >&6; } if test "${gt_cv_func_printf_posix+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ notposix #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "notposix" >/dev/null 2>&1; then gt_cv_func_printf_posix="guessing no" else gt_cv_func_printf_posix="guessing yes" fi rm -f conftest* else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include /* The string "%2$d %1$d", with dollar characters protected from the shell's dollar expansion (possibly an autoconf bug). */ static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_func_printf_posix=yes 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 ( exit $ac_status ) gt_cv_func_printf_posix=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $gt_cv_func_printf_posix" >&5 $as_echo "$gt_cv_func_printf_posix" >&6; } case $gt_cv_func_printf_posix in *yes) cat >>confdefs.h <<\_ACEOF #define HAVE_POSIX_PRINTF 1 _ACEOF ;; esac { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 $as_echo_n "checking whether we are using the GNU C Library 2.1 or newer... " >&6; } if test "${ac_cv_gnu_library_2_1+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky GNU user" >/dev/null 2>&1; then ac_cv_gnu_library_2_1=yes else ac_cv_gnu_library_2_1=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 $as_echo "$ac_cv_gnu_library_2_1" >&6; } GLIBC21="$ac_cv_gnu_library_2_1" for ac_header in stdint.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for SIZE_MAX" >&5 $as_echo_n "checking for SIZE_MAX... " >&6; } if test "${gl_cv_size_max+set}" = set; then $as_echo_n "(cached) " >&6 else gl_cv_size_max= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if HAVE_STDINT_H #include #endif #ifdef SIZE_MAX Found it #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Found it" >/dev/null 2>&1; then gl_cv_size_max=yes fi rm -f conftest* if test -z "$gl_cv_size_max"; then if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) size_t_bits_minus_1=$ac_lo;; '') size_t_bits_minus_1= ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include static long int longval () { return sizeof (size_t) * CHAR_BIT - 1; } static unsigned long int ulongval () { return sizeof (size_t) * CHAR_BIT - 1; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if ((sizeof (size_t) * CHAR_BIT - 1) < 0) { long int i = longval (); if (i != (sizeof (size_t) * CHAR_BIT - 1)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != (sizeof (size_t) * CHAR_BIT - 1)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then size_t_bits_minus_1=`cat conftest.val` 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 ( exit $ac_status ) size_t_bits_minus_1= fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) fits_in_uint=$ac_lo;; '') fits_in_uint= ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include static long int longval () { return sizeof (size_t) <= sizeof (unsigned int); } static unsigned long int ulongval () { return sizeof (size_t) <= sizeof (unsigned int); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if ((sizeof (size_t) <= sizeof (unsigned int)) < 0) { long int i = longval (); if (i != (sizeof (size_t) <= sizeof (unsigned int))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != (sizeof (size_t) <= sizeof (unsigned int))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then fits_in_uint=`cat conftest.val` 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 ( exit $ac_status ) fits_in_uint= fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then if test $fits_in_uint = 1; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include extern size_t foo; extern unsigned long foo; int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then fits_in_uint=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $fits_in_uint = 1; then gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" else gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" fi else gl_cv_size_max='((size_t)~(size_t)0)' fi fi fi { $as_echo "$as_me:$LINENO: result: $gl_cv_size_max" >&5 $as_echo "$gl_cv_size_max" >&6; } if test "$gl_cv_size_max" != yes; then cat >>confdefs.h <<_ACEOF #define SIZE_MAX $gl_cv_size_max _ACEOF fi for ac_header in stdint.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 $as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gt_cv_func_CFPreferencesCopyAppValue=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_CFPreferencesCopyAppValue=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 $as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CFPREFERENCESCOPYAPPVALUE 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 $as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { CFLocaleCopyCurrent(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gt_cv_func_CFLocaleCopyCurrent=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_CFLocaleCopyCurrent=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 $as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } if test $gt_cv_func_CFLocaleCopyCurrent = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CFLOCALECOPYCURRENT 1 _ACEOF fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi { $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 $as_echo_n "checking for ptrdiff_t... " >&6; } if test "${ac_cv_type_ptrdiff_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_ptrdiff_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (ptrdiff_t)) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((ptrdiff_t))) return 0; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_ptrdiff_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 $as_echo "$ac_cv_type_ptrdiff_t" >&6; } if test "x$ac_cv_type_ptrdiff_t" = x""yes; then : else cat >>confdefs.h <<\_ACEOF #define ptrdiff_t long _ACEOF fi for ac_header in stddef.h stdlib.h string.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to cadaver@webdav.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in asprintf fwprintf putenv setenv setlocale snprintf wcslen do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5 $as_echo_n "checking whether _snprintf is declared... " >&6; } if test "${ac_cv_have_decl__snprintf+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef _snprintf char *p = (char *) _snprintf; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl__snprintf=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl__snprintf=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5 $as_echo "$ac_cv_have_decl__snprintf" >&6; } if test $ac_cv_have_decl__snprintf = yes; then gt_value=1 else gt_value=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL__SNPRINTF $gt_value _ACEOF { $as_echo "$as_me:$LINENO: checking whether _snwprintf is declared" >&5 $as_echo_n "checking whether _snwprintf is declared... " >&6; } if test "${ac_cv_have_decl__snwprintf+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef _snwprintf char *p = (char *) _snwprintf; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl__snwprintf=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl__snwprintf=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl__snwprintf" >&5 $as_echo "$ac_cv_have_decl__snwprintf" >&6; } if test $ac_cv_have_decl__snwprintf = yes; then gt_value=1 else gt_value=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL__SNWPRINTF $gt_value _ACEOF { $as_echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 $as_echo_n "checking whether getc_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef getc_unlocked char *p = (char *) getc_unlocked; #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_getc_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_getc_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 $as_echo "$ac_cv_have_decl_getc_unlocked" >&6; } if test $ac_cv_have_decl_getc_unlocked = yes; then gt_value=1 else gt_value=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETC_UNLOCKED $gt_value _ACEOF case $gt_cv_func_printf_posix in *yes) HAVE_POSIX_PRINTF=1 ;; *) HAVE_POSIX_PRINTF=0 ;; esac if test "$ac_cv_func_asprintf" = yes; then HAVE_ASPRINTF=1 else HAVE_ASPRINTF=0 fi if test "$ac_cv_func_snprintf" = yes; then HAVE_SNPRINTF=1 else HAVE_SNPRINTF=0 fi if test "$ac_cv_func_wprintf" = yes; then HAVE_WPRINTF=1 else HAVE_WPRINTF=0 fi { $as_echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 $as_echo_n "checking for nl_langinfo and CODESET... " >&6; } if test "${am_cv_langinfo_codeset+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char* cs = nl_langinfo(CODESET); return !cs; ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then am_cv_langinfo_codeset=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 am_cv_langinfo_codeset=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 $as_echo "$am_cv_langinfo_codeset" >&6; } if test $am_cv_langinfo_codeset = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LANGINFO_CODESET 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 $as_echo_n "checking for LC_MESSAGES... " >&6; } if test "${gt_cv_val_LC_MESSAGES+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { return LC_MESSAGES ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gt_cv_val_LC_MESSAGES=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_val_LC_MESSAGES=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $gt_cv_val_LC_MESSAGES" >&5 $as_echo "$gt_cv_val_LC_MESSAGES" >&6; } if test $gt_cv_val_LC_MESSAGES = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LC_MESSAGES 1 _ACEOF fi if test "$enable_shared" = yes; then case "$host_os" in mingw* | cygwin*) is_woe32dll=yes ;; *) is_woe32dll=no ;; esac else is_woe32dll=no fi WOE32DLL=$is_woe32dll case "$host_os" in mingw* | cygwin*) is_woe32=yes ;; *) is_woe32=no ;; esac WOE32=$is_woe32 if test $WOE32 = yes; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_WINDRES+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$WINDRES"; then ac_cv_prog_WINDRES="$WINDRES" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_WINDRES="${ac_tool_prefix}windres" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi WINDRES=$ac_cv_prog_WINDRES if test -n "$WINDRES"; then { $as_echo "$as_me:$LINENO: result: $WINDRES" >&5 $as_echo "$WINDRES" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_WINDRES"; then ac_ct_WINDRES=$WINDRES # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_WINDRES+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_WINDRES"; then ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_WINDRES="windres" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES if test -n "$ac_ct_WINDRES"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_WINDRES" >&5 $as_echo "$ac_ct_WINDRES" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_WINDRES" = x; then WINDRES="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$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 WINDRES=$ac_ct_WINDRES fi else WINDRES="$ac_cv_prog_WINDRES" fi fi case "$host_os" in hpux*) LTLIBC="" ;; *) LTLIBC="-lc" ;; esac { $as_echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 $as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gt_cv_func_CFPreferencesCopyAppValue=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_CFPreferencesCopyAppValue=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 $as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CFPREFERENCESCOPYAPPVALUE 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 $as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { CFLocaleCopyCurrent(); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then gt_cv_func_CFLocaleCopyCurrent=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_CFLocaleCopyCurrent=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 $as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } if test $gt_cv_func_CFLocaleCopyCurrent = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CFLOCALECOPYCURRENT 1 _ACEOF fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no LIBINTL= LTLIBINTL= POSUB= case " $gt_needs " in *" need-formatstring-macros "*) gt_api_version=3 ;; *" need-ngettext "*) gt_api_version=2 ;; *) gt_api_version=1 ;; esac gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no { $as_echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 $as_echo_n "checking whether included gettext is requested... " >&6; } # Check whether --with-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval=$with_included_gettext; nls_cv_force_use_gnu_gettext=$withval else nls_cv_force_use_gnu_gettext=no fi { $as_echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 $as_echo "$nls_cv_force_use_gnu_gettext" >&6; } nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then if test $gt_api_version -ge 3; then gt_revision_test_code=' #ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; ' else gt_revision_test_code= fi if test $gt_api_version -ge 2; then gt_expression_test_code=' + * ngettext ("", "", 0)' else gt_expression_test_code= fi { $as_echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 $as_echo_n "checking for GNU gettext in libc... " >&6; } if { as_var=$gt_func_gnugettext_libc; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; int main () { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$gt_func_gnugettext_libc=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$gt_func_gnugettext_libc=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$gt_func_gnugettext_libc'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then 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-libintl-prefix was given. if test "${with_libintl_prefix+set}" = set; then withval=$with_libintl_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" fi fi fi LIBINTL= LTLIBINTL= INCINTL= LIBINTL_PREFIX= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='intl ' 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" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$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 $LTLIBINTL; 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 LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-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"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$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 LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$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 $LIBINTL; 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 LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" else LIBINTL="${LIBINTL}${LIBINTL:+ }-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/"'*$,,'` LIBINTL_PREFIX="$basedir" 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 $INCINTL; 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 INCINTL="${INCINTL}${INCINTL:+ }-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"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; 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 $LIBINTL; 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 LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBINTL; 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 LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-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$,,'` ;; *) LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" ;; esac done fi else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-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" LIBINTL="${LIBINTL}${LIBINTL:+ }$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" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" done fi { $as_echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 $as_echo_n "checking for GNU gettext in libintl... " >&6; } if { as_var=$gt_func_gnugettext_libintl; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$gt_func_gnugettext_libintl=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$gt_func_gnugettext_libintl=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" eval "$gt_func_gnugettext_libintl=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi ac_res=`eval 'as_val=${'$gt_func_gnugettext_libintl'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else LIBINTL= LTLIBINTL= INCINTL= fi if test "$gt_use_preinstalled_gnugettext" != "yes"; then nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes LIBINTL="\$(top_builddir)/lib/intl/libintl.a $LIBICONV $LIBTHREAD" LTLIBINTL="\$(top_builddir)/lib/intl/libintl.a $LTLIBICONV $LTLIBTHREAD" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then CATOBJEXT=.gmo fi if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then cat >>confdefs.h <<\_ACEOF #define ENABLE_NLS 1 _ACEOF else USE_NLS=no fi fi { $as_echo "$as_me:$LINENO: checking whether to use NLS" >&5 $as_echo_n "checking whether to use NLS... " >&6; } { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5 $as_echo "$USE_NLS" >&6; } if test "$USE_NLS" = "yes"; then { $as_echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 $as_echo_n "checking where the gettext function comes from... " >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi { $as_echo "$as_me:$LINENO: result: $gt_source" >&5 $as_echo "$gt_source" >&6; } fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then { $as_echo "$as_me:$LINENO: checking how to link with libintl" >&5 $as_echo_n "checking how to link with libintl... " >&6; } { $as_echo "$as_me:$LINENO: result: $LIBINTL" >&5 $as_echo "$LIBINTL" >&6; } for element in $INCINTL; 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 fi cat >>confdefs.h <<\_ACEOF #define HAVE_GETTEXT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_DCGETTEXT 1 _ACEOF fi POSUB=po fi if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then BUILD_INCLUDED_LIBINTL=yes fi nls_cv_header_intl= nls_cv_header_libgt= DATADIRNAME=share INSTOBJEXT=.mo GENCAT=gencat INTLOBJS= if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi INTL_LIBTOOL_SUFFIX_PREFIX= INTLLIBS="$LIBINTL" if test "$USE_NLS" = "yes"; then if test "$USE_INCLUDED_LIBINTL" = "yes"; then nls_msg="Built using included libintl" CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/lib/intl" else nls_msg="Built using native support" fi LIBS="$LIBS $LIBINTL" else nls_msg="Not built" fi # Check whether --enable-warnings was given. if test "${enable_warnings+set}" = set; then enableval=$enable_warnings; fi if test "$enable_warnings" = "yes"; then case $GCC:`uname` in yes:*) CFLAGS="$CFLAGS -Wall -Wmissing-declarations -Wshadow -Wreturn-type -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wformat-security" if test -z "$with_ssl" -o "$with_ssl" = "no"; then # OpenSSL headers fail strict prototypes checks CFLAGS="$CFLAGS -Wstrict-prototypes" fi ;; no:OSF1) CFLAGS="$CFLAGS -check -msg_disable returnchecks -msg_disable alignment -msg_disable overflow" ;; no:IRIX) CFLAGS="$CFLAGS -fullwarn" ;; no:UnixWare) CFLAGS="$CFLAGS -v" ;; *) { $as_echo "$as_me:$LINENO: WARNING: warning flags unknown for compiler on this platform" >&5 $as_echo "$as_me: WARNING: warning flags unknown for compiler on this platform" >&2;} ;; esac fi # Pick up config.h etc; and before any other paths. CPPFLAGS="-I\$(top_builddir) -I\$(top_srcdir)/lib $CPPFLAGS" ac_config_files="$ac_config_files Makefile lib/neon/Makefile lib/intl/Makefile po/Makefile.in" 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:$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= ;; #( *) $as_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 test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$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= 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. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_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} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_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 # PATH needs CR # 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_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 if (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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false 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. 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); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. 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 # Name of the executable. 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'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. 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 { (exit 1); exit 1; }; } # 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 } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi 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 -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' 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=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 # 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 cadaver $as_me 0.23.3, which was generated by GNU Autoconf 2.63. 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 from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, 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 ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ cadaver config.status 0.23.3 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 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' 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=$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 ;; --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"` ;; esac CONFIG_FILES="$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 CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --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_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$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 # # Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake < 1.5. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" _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" ;; "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "lib/neon/Makefile") CONFIG_FILES="$CONFIG_FILES lib/neon/Makefile" ;; "lib/intl/Makefile") CONFIG_FILES="$CONFIG_FILES lib/intl/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; 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= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # 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=' ' 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 {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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 >>"\$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 >>"\$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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// 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 >"$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_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[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="$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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$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:$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 >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; 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" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } 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:$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 "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$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 "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } fi ;; :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "po-directories":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # 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 || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:$LINENO: Configured to build cadaver ${PACKAGE_VERSION}: Install prefix: ${prefix} Compiler: ${CC} Neon library: ${neon_library_message} XML Parser: ${neon_xml_parser_message} SSL library: ${ne_SSL_message} Internationalization: ${nls_msg} GNU readline support: ${msg_readline} " >&5 $as_echo "$as_me: Configured to build cadaver ${PACKAGE_VERSION}: Install prefix: ${prefix} Compiler: ${CC} Neon library: ${neon_library_message} XML Parser: ${neon_xml_parser_message} SSL library: ${ne_SSL_message} Internationalization: ${nls_msg} GNU readline support: ${msg_readline} " >&6;} test -d src || mkdir src cadaver-0.23.3/src/0000775000076400007640000000000011312007506013410 5ustar jortonjortoncadaver-0.23.3/src/common.h0000664000076400007640000000326011073671663015071 0ustar jortonjorton/* Common definitions for cadaver. Copyright (C) 1998-2005, Joe Orton . 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef COMMON_H #define COMMON_H #include "config.h" #include #include #include #define DEBUG_FILES (1<<10) /* A signal hander */ typedef void (*sig_handler)( int ); #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif #ifdef __EMX__ /* siebert: strcasecmp is stricmp */ #define strcasecmp stricmp #endif /* safe an extra header for lib/yesno.c exports. */ int yesno(void); int cad_mkstemp(char *template); /* boolean */ #define true 1 #define false 0 #if defined (__EMX__) || defined(__CYGWIN__) #define FOPEN_BINARY_FLAGS "b" #define OPEN_BINARY_FLAGS O_BINARY #else #define FOPEN_BINARY_FLAGS "" #define OPEN_BINARY_FLAGS 0 #endif #ifndef O_LARGEFILE #define O_LARGEFILE (0) #endif #if !HAVE_STRERROR && !defined(strerror) char *strerror (int errnum); #endif #endif /* COMMON_H */ cadaver-0.23.3/src/edit.c0000664000076400007640000001474411100331511014502 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2008, Joe Orton , 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #include #include #include #include #include "cadaver.h" #include "commands.h" #include "utils.h" #include "options.h" #include "i18n.h" static int run_editor(const char *filename) { char editcmd[BUFSIZ]; const char *editor; struct stat before_st, after_st; editor = get_option(opt_editor); if (editor == NULL) { editor = getenv("EDITOR"); if (editor == NULL) { editor = "vi"; } } snprintf(editcmd, BUFSIZ, "%s %s", editor, filename); if (stat(filename, &before_st)) { printf(_("Could not stat file: %s\n"), strerror(errno)); return -1; } printf("Running editor: `%s'...\n", editcmd); system(editcmd); if (stat(filename, &after_st)) { printf(_("Error! Could not examine temporary file: %s\n"), strerror(errno)); return -1; } if (before_st.st_mtime == after_st.st_mtime) { /* File not changed. */ printf(_("No changes were made.\n")); return -1; } else { printf(_("Changes were made.\n")); return 0; } } /* Returns true if resource at URI is lockable. */ static int is_lockable(const char *uri) { ne_server_capabilities caps = {0}; /* TODO: for the mo, just check we're on a Class 2 server. * Should check supportedlock property really. */ if (ne_options(session.sess, uri, &caps) != NE_OK) { return 0; } return caps.dav_class2; } #ifndef PATH_MAX #define PATH_MAX (256) #endif /* TODO: this is great big heap of steaming trout. */ /* TODO: does this work under cygwin? mkstemp() may or may not open the file using O_BINARY, and then we *do* upload it using O_BINARY, so maybe this will screw things up. Maybe we should fcntl it and set O_BINARY, if that is allowed under cygwin? */ void execute_edit(const char *remote) { char *real_remote; unsigned int can_lock; /* can we LOCK it? */ struct ne_lock *lock = NULL; char fname[PATH_MAX] = "/tmp/cadaver-edit-XXXXXX"; const char *pnt; int fd; int is_checkout, is_checkin; real_remote = resolve_path(session.uri.path, remote, false); /* Don't let them edit a collection, since PUT to a collection is * bogus. Really we want to be able to fetch a "DefaultDocument" * property, and edit on that instead: IIS does expose such a * property. Would be a nice hack to add the support to mod_dav * too. */ if (getrestype(real_remote) == resr_collection) { printf(_("You cannot edit a collection resource (%s).\n"), real_remote); goto edit_bail; } can_lock = is_lockable(real_remote); /* Give the local temp file the same extension as the remote path, * so the editor can have a stab at the content-type. */ pnt = strrchr(real_remote, '.'); if (pnt != NULL && strchr(pnt, '/') == NULL) { strncat(fname, pnt, PATH_MAX); fname[PATH_MAX-1] = '\0'; } fd = cad_mkstemp(fname); if (fd == -1) { printf(_("Could not create temporary file %s:\n%s\n"), fname, strerror(errno)); goto edit_bail; } /* Sanity check on the file perms. */ #ifdef HAVE_FCHMOD if (fchmod(fd, 0600) == -1) { #else if (chmod(fname, 0600) == -1) { #endif printf(_("Could not set file permissions for %s:\n%s\n"), fname, strerror(errno)); goto edit_bail; } if (can_lock) { lock = ne_lock_create(); ne_fill_server_uri(session.sess, &lock->uri); lock->uri.path = ne_strdup(real_remote); lock->owner = getowner(); out_start("Locking", remote); if (out_handle(ne_lock(session.sess, lock))) { ne_lockstore_add(session.locks, lock); } else { ne_lock_destroy(lock); goto edit_close; } } else { /* TODO: HEAD and get the Etag/modtime */ } /* Return 1: Checkin, 2: Checkout, 0: otherwise */ is_checkin = is_vcr(real_remote); if (is_checkin==1) { execute_checkout(real_remote); } output(o_download, _("Downloading `%s' to %s"), real_remote, fname); /* Don't puke if get fails -- perhaps we are creating a new one? */ out_result(ne_get(session.sess, real_remote, fd)); if (close(fd)) { output(o_finish, _("Error writing to temporary file: %s\n"), strerror(errno)); } else if (!run_editor(fname)) { int upload_okay = 0; fd = open(fname, O_RDONLY | OPEN_BINARY_FLAGS); if (fd < 0) { output(o_finish, _("Could not re-open temporary file: %s\n"), strerror(errno)); } else { do { output(o_upload, _("Uploading changes to `%s'"), real_remote); /* FIXME: conditional PUT using fetched Etag/modtime if * !can_lock */ if (out_handle(ne_put(session.sess, real_remote, fd))) { upload_okay = 1; } else { /* TODO: offer to save locally instead */ printf(_("Try uploading again (y/n)? ")); if (!yesno()) { upload_okay = 1; } } } while (!upload_okay); close(fd); } } if (unlink(fname)) { printf(_("Could not delete temporary file %s:\n%s\n"), fname, strerror(errno)); } /* Return 1: Checkin, 2: Checkout, 0: otherwise */ is_checkout = is_vcr(real_remote); if (is_checkout==2) { execute_checkin(real_remote); } /* UNLOCK it again whether we succeed or failed in our mission */ if (can_lock) { output(o_start, "Unlocking `%s':", remote); out_result(ne_unlock(session.sess, lock)); ne_lockstore_remove(session.locks, lock); ne_lock_destroy(lock); } goto edit_bail; edit_close: close(fd); edit_bail: free(real_remote); return; } cadaver-0.23.3/src/cadaver.c0000664000076400007640000007074011102027145015167 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2007, Joe Orton , except where otherwise indicated. 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_LOCALE_H #include #endif #include #ifdef NEED_SNPRINTF_H #include "snprintf.h" #endif #include "i18n.h" #include "getopt.h" #include "getpass.h" #ifdef ENABLE_NETRC #include "netrc.h" #endif #include #include #include #include #include #include #include #include #include #include "common.h" #include "cadaver.h" #include "cmdline.h" #include "commands.h" #include "options.h" #include "utils.h" #define DEFAULT_NAMESPACE "http://webdav.org/cadaver/custom-properties/" #ifdef ENABLE_NETRC static netrc_entry *netrc_list; /* list of netrc entries */ #endif /* Module-private state: */ const char *lock_store_fn = NULL; static char *progname; /* argv[0] */ static char *rcfile; /* Global state: */ char *proxy_hostname; int proxy_port; char *server_username = NULL, *server_password = NULL; /* Current session state. */ struct session session; ne_ssl_client_cert *client_cert; int tolerant; /* tolerate DAV-enabledness failure */ /* Current output state */ static enum out_state { out_none, /* not doing anything */ out_incommand, /* doing a simple command */ out_transfer_upload, /* uploading a file, not yet started */ out_transfer_download, /* downloading a file, not yet started */ out_transfer_plain, /* doing a plain ... transfer */ out_transfer_pretty, /* doing a pretty progress bar transfer */ out_transfer_done /* a complete transfer */ } out_state; /* Protoypes */ static RETSIGTYPE quit_handler(int signo); static void notifier(void *ud, ne_session_status status, const ne_session_status_info *info); static void pretty_progress_bar(ne_off_t progress, ne_off_t total); static int supply_creds_server(void *userdata, const char *realm, int attempt, char *username, char *password); static int supply_creds_proxy(void *userdata, const char *realm, int attempt, char *username, char *password); static void usage(void) { printf(_( "Usage: %s [OPTIONS] http://hostname[:port]/path\n" " Port defaults to 80, path defaults to '/'\n" "Options:\n" " -t, --tolerant Allow cd/open into non-WebDAV enabled collection.\n" " -r, --rcfile=FILE Read script from FILE instead of ~/.cadaverrc.\n" " -p, --proxy=PROXY[:PORT] Use proxy host PROXY and optional proxy port PORT.\n" " -V, --version Display version information.\n" " -h, --help Display this help message.\n" "Please send bug reports and feature requests to \n"), progname); } static void init_locking(void) { lock_store_fn = get_option(opt_lockstore); session.locks = ne_lockstore_create(); /* TODO: read in lock list from ~/.davlocks */ } static void finish_locking(void) { /* TODO: write out lock list to ~/.davlocks */ } void close_connection(void) { ne_session_destroy(session.sess); session.connected = 0; printf(_("Connection to `%s' closed.\n"), session.uri.host); ne_uri_free(&session.uri); if (session.lastwp) ne_free(session.lastwp); } /* Sets the current collection to the given path. Returns zero on * success, non-zero if newpath is an untolerated non-WebDAV * collection. */ int set_path(const char *newpath) { int is_coll = (getrestype(newpath) == resr_collection); if (is_coll || tolerant) { if (!is_coll) { session.isdav = 0; printf(_("Ignored error: %s not WebDAV-enabled:\n%s\n"), newpath, ne_get_error(session.sess)); } else { session.isdav = 1; } return 0; } else { printf(_("Could not access %s (not WebDAV-enabled?):\n%s\n"), newpath, ne_get_error(session.sess)); return 1; } } static int cert_verify(void *ud, int failures, const ne_ssl_certificate *c) { char *tmp, from[NE_SSL_VDATELEN], to[NE_SSL_VDATELEN]; const char *ident; ident = ne_ssl_cert_identity(c); if (ident) printf(_("WARNING: Untrusted server certificate presented for `%s':\n"), ident); else puts(_("WARNING: Untrusted server certificate presented:\n")); if (failures & NE_SSL_IDMISMATCH) { printf(_("Certificate was issued to hostname `%s' rather than `%s'\n"), ne_ssl_cert_identity(c), session.uri.host); printf(_("This connection could have been intercepted.\n")); } #define PRINT_AND_FREE(str, dn) \ tmp = ne_ssl_readable_dname(dn); printf(str, tmp); free(tmp) PRINT_AND_FREE(_("Issued to: %s\n"), ne_ssl_cert_subject(c)); PRINT_AND_FREE(_("Issued by: %s\n"), ne_ssl_cert_issuer(c)); ne_ssl_cert_validity(c, from, to); printf(_("Certificate is valid from %s to %s\n"), from, to); if (isatty(STDIN_FILENO)) { printf(_("Do you wish to accept the certificate? (y/n) ")); return !yesno(); } else { printf(_("Certificate rejected.\n")); return -1; } } static void provide_clicert(void *userdata, ne_session *sess, const ne_ssl_dname *const *dname, int dncount) { const char *ccfn = userdata; int n; printf("The server has requested a client certificate.\n"); #if 0 /* display CA names? */ for (n = 0; n < dncount; n++) { char *dn = ne_ssl_readable_dname(dname[n]); printf("Name: %s\n", dn); free(dn); } #endif if (ne_ssl_clicert_encrypted(client_cert)) { const char *name = ne_ssl_clicert_name(client_cert); char *pass; if (!name) name = ccfn; printf("Client certificate `%s' is encrypted.\n", name); for (n = 0; n < 3; n++) { pass = fm_getpassword(_("Decryption password: ")); if (pass == NULL) break; if (ne_ssl_clicert_decrypt(client_cert, pass)) { printf("Password incorrect, try again.\n"); } else { break; } } } if (!ne_ssl_clicert_encrypted(client_cert)) { printf("Using client certificate.\n"); ne_ssl_set_clicert(session.sess, client_cert); } } static int setup_ssl(void) { char *ccfn = get_option(opt_clicert); ne_ssl_trust_default_ca(session.sess); ne_ssl_set_verify(session.sess, cert_verify, NULL); if (ccfn) { client_cert = ne_ssl_clicert_read(ccfn); if (client_cert) { ne_ssl_provide_clicert(session.sess, provide_clicert, ccfn); } else { printf("Could not load client certificate from `%s'.\n", ccfn); } } return 0; } /* FIXME: Leaky as a bucket */ void open_connection(const char *url) { char *proxy_host = get_option(opt_proxy), *pnt; ne_server_capabilities caps; int ret, use_ssl = 0; ne_session *sess; if (session.connected) { close_connection(); } else { ne_uri_free(&session.uri); if (session.lastwp) { ne_free(session.lastwp); session.lastwp = NULL; } } /* Single argument: see whether we have a path or scheme */ if (strchr(url, '/') == NULL) { /* No path, no scheme -> just a hostname */ pnt = strchr(url, ':'); if (pnt != NULL) { *pnt++ = '\0'; session.uri.port = atoi(pnt); } else { session.uri.port = 80; } session.uri.host = ne_strdup(url); session.uri.scheme = ne_strdup("http"); } else { /* Parse the URL */ if (ne_uri_parse(url, &session.uri) || session.uri.host == NULL) { printf(_("Could not parse URL `%s'\n"), url); return; } if (session.uri.scheme == NULL) session.uri.scheme = ne_strdup("http"); if (!session.uri.port) session.uri.port = ne_uri_defaultport(session.uri.scheme); if (strcasecmp(session.uri.scheme, "https") == 0) { if (!ne_has_support(NE_FEATURE_SSL)) { printf(_("SSL is not enabled.\n")); return; } use_ssl = 1; } } session.sess = ne_session_create(session.uri.scheme, session.uri.host, session.uri.port); sess = session.sess; if (use_ssl && setup_ssl()) { return; } ne_lockstore_register(session.locks, sess); ne_redirect_register(sess); ne_set_notifier(sess, notifier, NULL); if (session.uri.path == NULL) { session.uri.path = ne_strdup("/"); } else { if (!ne_path_has_trailing_slash(session.uri.path)) { pnt = ne_concat(session.uri.path, "/", NULL); free(session.uri.path); session.uri.path = pnt; } } /* Get the proxy details */ if (proxy_host != NULL) { if (get_option(opt_proxy_port) != NULL) { proxy_port = atoi(get_option(opt_proxy_port)); } else { proxy_port = 8080; } proxy_hostname = proxy_host; } #ifdef ENABLE_NETRC { netrc_entry *found; found = search_netrc(netrc_list, session.uri.host); if (found != NULL) { if (found->account && found->password) { server_username = found->account; server_password = found->password; } } } #endif /* ENABLE_NETRC */ #ifdef NE_SESSFLAG_EXPECT100 ne_set_session_flag(session.sess, NE_SESSFLAG_EXPECT100, get_bool_option(opt_expect100)); #endif /* NE_SESSFLAG_EXPECT100 */ session.connected = 0; ne_set_useragent(session.sess, "cadaver/" PACKAGE_VERSION); ne_set_server_auth(session.sess, supply_creds_server, NULL); ne_set_proxy_auth(session.sess, supply_creds_proxy, NULL); if (proxy_host) { ne_session_proxy(session.sess, proxy_hostname, proxy_port); } ret = ne_options(session.sess, session.uri.path, &caps); switch (ret) { case NE_OK: session.connected = true; if (set_path(session.uri.path)) { close_connection(); } break; case NE_CONNECT: if (proxy_host) { printf(_("Could not connect to `%s' on port %d:\n%s\n"), proxy_hostname, proxy_port, ne_get_error(session.sess)); } else { printf(_("Could not connect to `%s' on port %d:\n%s\n"), session.uri.host, session.uri.port, ne_get_error(session.sess)); } break; case NE_LOOKUP: puts(ne_get_error(session.sess)); break; default: printf(_("Could not open collection:\n%s\n"), ne_get_error(session.sess)); break; } } /* Sets proxy server from hostport argument */ static void set_proxy(const char *str) { char *hostname = ne_strdup(str), *pnt; pnt = strchr(hostname, ':'); if (pnt != NULL) { *pnt++ = '\0'; } set_option(opt_proxy, (void *)hostname); set_option(opt_proxy_port, pnt); } static void parse_args(int argc, char **argv) { static const struct option opts[] = { { "version", no_argument, NULL, 'V' }, { "help", no_argument, NULL, 'h' }, { "proxy", required_argument, NULL, 'p' }, { "tolerant", no_argument, NULL, 't' }, { "rcfile", required_argument, NULL, 'r' }, { 0, 0, 0, 0 } }; int optc; while ((optc = getopt_long(argc, argv, "ehtp:r:V", opts, NULL)) != -1) { switch (optc) { case 'h': usage(); exit(-1); case 'V': execute_about(); exit(-1); case 'p': set_proxy(optarg); break; case 't': tolerant = 1; break; case 'r': rcfile = strdup(optarg); break; case '?': default: printf(_("Try `%s --help' for more information.\n"), progname); exit(-1); } } if (optind == (argc-1)) { open_connection(argv[optind]); #ifdef HAVE_ADD_HISTORY { char *run_cmd; run_cmd = ne_concat("open ", argv[optind], NULL); add_history(run_cmd); free(run_cmd); } #endif } else if (optind < argc) { usage(); exit(-1); } } static char *read_command(void) { char prompt[BUFSIZ]; if (session.uri.path) { char *p = ne_path_unescape(session.uri.path); ne_snprintf(prompt, BUFSIZ, "dav:%s%c ", p, session.isdav ? '>' : '?'); ne_free(p); } else { sprintf(prompt, "dav:!> "); } return readline(prompt); } static int execute_command(const char *line) { const struct command *cmd; char **tokens; int n, argcount, ret = 0; tokens = parse_command(line, &argcount); if (argcount == 0) { free(tokens); return 0; } argcount--; cmd = get_command(tokens[0]); if (cmd == NULL) { printf(_("Unrecognised command. Type 'help' for a list of commands.\n")); } else if (argcount < cmd->min_args) { printf(_("The `%s' command requires %d argument%s"), tokens[0], cmd->min_args, cmd->min_args==1?"":"s"); if (cmd->short_help) { printf(_(":\n %s : %s\n"), cmd->call, cmd->short_help); } else { printf(".\n"); } } else if (argcount > cmd->max_args) { if (cmd->max_args) { printf(_("The `%s' command takes at most %d argument%s"), tokens[0], cmd->max_args, cmd->max_args==1?"":"s"); } else { printf(_("The `%s' command takes no arguments"), tokens[0]); } if (cmd->short_help) { printf(_(":\n" " %s : %s\n"), cmd->call, cmd->short_help); } else { printf(".\n"); } } else if (!session.connected && cmd->needs_connection) { printf(_("The `%s' command can only be used when connected to the server.\n" "Try running `open' first (see `help open' for more details).\n"), tokens[0]); } else if (cmd->id == cmd_quit) { ret = -1; } else { /* Cast away */ /* with a nod in the general direction of apache */ switch (cmd->max_args) { case 0: cmd->handler.take0(); break; case 1: /* tokens[1]==NULL if argcount==0 */ cmd->handler.take1(tokens[1]); break; case 2: if (argcount <=1) { cmd->handler.take2(tokens[1], NULL); } else { cmd->handler.take2(tokens[1], tokens[2]); } break; case 3: cmd->handler.take3(tokens[1], tokens[2], tokens[3]); break; case CMD_VARY: cmd->handler.takeV(argcount, (const char **) &tokens[1]); default: break; } } for (n = 0; n < argcount; n++) { ne_free(tokens[n]); } ne_free(tokens); return ret; } static RETSIGTYPE quit_handler(int sig) { /* Reinstall handler */ if (child_running) { /* The child gets the signal anyway... it can deal with it. * Proper way is probably to ignore signals while child is * running? */ signal(sig, quit_handler); return; } else { printf(_("Terminated by signal %d.\n"), sig); if (session.connected) { close_connection(); } exit(-1); } } static void init_signals(void) { signal(SIGTERM, quit_handler); signal(SIGABRT, quit_handler); signal(SIGQUIT, quit_handler); signal(SIGINT, quit_handler); } static void init_netrc(void) { #ifdef ENABLE_NETRC char *netrc = ne_concat(getenv("HOME"), "/.netrc", NULL); netrc_list = parse_netrc(netrc); #endif } static int init_rcfile(void) { int ret = 0; char buf[BUFSIZ]; struct stat st; FILE *f; if (rcfile == NULL) { rcfile = ne_concat(getenv("HOME"), "/.cadaverrc", NULL); if (stat(rcfile, &st) != 0) { NE_DEBUG(DEBUG_FILES, "No rcfile\n"); free(rcfile); return 0; } } f = fopen(rcfile, "r"); if (f == NULL) { printf(_("Could not read rcfile %s: %s\n"), rcfile, strerror(errno)); } else { for (;;) { if (fgets(buf, BUFSIZ, f) != NULL) { ret = execute_command(ne_shave(buf, "\r\n")); if (ret != 0) break; } else { break; } } fclose(f); } free(rcfile); return ret; } #ifdef HAVE_LIBREADLINE #define COMPLETION_CACHE_EXPIRE 10 /* seconds */ #ifndef HAVE_RL_COMPLETION_MATCHES /* readline <4.2 compatibility. */ #define rl_completion_matches completion_matches #define rl_filename_completion_function filename_completion_function #endif static char *remote_completion(const char *text, int state) { static struct resource *reslist, *current; static int len; static time_t last_fetch; static char *last_path; char *name; if (state == 0) { /* Check to see if we should refresh the dumb cache. * or, initialize the local cache of remote filenames * The remote resource list persists until a completion * in a new context is requested or the cache expires. */ /* TODO get cache expire time from config, currently from cadaver.h * TODO cache and fetch on deep/absolute paths: (path: /a/b/, text: c/d) */ if (last_fetch < (time(NULL) - COMPLETION_CACHE_EXPIRE) || !last_path || strcmp(session.uri.path, last_path) != 0) { if (last_path != NULL) { free(last_path); } if (reslist != NULL) { free_resource_list(reslist); } /* Hide the connection status */ ne_set_notifier(session.sess, NULL, NULL); if (fetch_resource_list(session.sess, session.uri.path, 1, 0, &reslist) != NE_OK) { reslist = NULL; } /* Restore the session connection printing */ ne_set_notifier(session.sess, notifier, NULL); last_path = ne_strdup(session.uri.path); } current = reslist; len = strlen(text); time(&last_fetch); } while (current) { /* Massage the absolute URI to a URI relative to our path */ /* Copy & paste & search & replace from ls.c */ if (ne_path_has_trailing_slash(current->uri)) { current->uri[strlen(current->uri)-1] = '\0'; } name = strrchr(current->uri, '/'); if (name != NULL && strlen(name+1) > 0) { name++; } else { name = current->uri; } name = ne_path_unescape(name); if (strncmp(text, name, len) == 0) { current = current->next; /* FIXME: readline docs say readline will free() this when * it's finished with, although 'memprof' shows that it * leaks. */ return name; } current = current->next; } return NULL; } static char **completion(const char *text, int start, int end) { char **matches = NULL; char *sep = strchr(rl_line_buffer, ' '); if (start == 0) { matches = rl_completion_matches(text, command_generator); } else if (sep != NULL) { char *cname = ne_strndup(rl_line_buffer, sep - rl_line_buffer); const struct command *cmd; cname[sep - rl_line_buffer] = '\0'; cmd = get_command(cname); if (cmd != NULL) { switch (cmd->scope) { case parmscope_none: break; case parmscope_local: matches = rl_completion_matches(text, rl_filename_completion_function); break; case parmscope_option: /* TODO */ break; case parmscope_remote: if (session.connected) { matches = rl_completion_matches(text, remote_completion); } break; } } free(cname); } return matches; } #endif /* HAVE_LIBREADLINE */ void output(enum output_type t, const char *fmt, ...) { va_list params; if (t == o_finish) { switch (out_state) { case out_transfer_plain: printf("] "); break; default: putchar(' '); break; } } va_start(params, fmt); vfprintf(stdout, fmt, params); va_end(params); fflush(stdout); switch (t) { case o_start: out_state = out_incommand; break; case o_upload: out_state = out_transfer_upload; break; case o_download: out_state = out_transfer_download; break; case o_finish: out_state = out_none; break; } } static void init_readline(void) { #ifdef HAVE_LIBREADLINE rl_readline_name = "cadaver"; rl_attempted_completion_function = completion; #endif /* HAVE_LIBREADLINE */ } #ifndef HAVE_LIBREADLINE char *readline(const char *prompt) { static char buf[256]; char *ret; if (prompt) { printf("%s", prompt); } ret = fgets(buf, 256, stdin); if (ret) { return ne_strdup(ne_shave(buf, "\r\n")); } else { return NULL; } } #endif static void init_options(void) { char *lockowner, *tmp; char *user = getenv("USER"), *hostname = getenv("HOSTNAME"); if (user && hostname) { /* set this here so they can override it */ lockowner = ne_concat("mailto:", user, "@", hostname, NULL); set_option(opt_lockowner, lockowner); } else { set_option(opt_lockowner, NULL); } set_option(opt_editor, NULL); set_option(opt_namespace, ne_strdup(DEFAULT_NAMESPACE)); set_bool_option(opt_overwrite, 1); set_bool_option(opt_quiet, 1); set_bool_option(opt_searchall, 1); lockdepth = NE_DEPTH_INFINITE; lockscope = ne_lockscope_exclusive; searchdepth = NE_DEPTH_INFINITE; /* This is what Markus Kahn says we should do. */ if ((tmp = getenv("LC_ALL")) || (tmp = getenv("LC_CTYPE")) || (tmp = getenv("LANG"))) { if (strstr(tmp, "UTF-8")) { int val = 1; set_option(opt_utf8, &val); } } } int main(int argc, char *argv[]) { int ret = 0; char *home = getenv("HOME"), *tmp; progname = argv[0]; #ifdef HAVE_SETLOCALE setlocale(LC_ALL, ""); #endif #ifdef ENABLE_NLS bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); #endif /* ENABLE_NLS */ ne_debug_init(stderr, 0); if (!home) { /* Show me the way to go home... */ printf(_("Environment variable $HOME needs to be set!\n")); return -1; } ne_sock_init(); memset(&session, 0, sizeof session); /* Options before rcfile, so rcfile settings can * override defaults */ tmp = ne_concat(home, "/.cadaver-locks", NULL); set_option(opt_lockstore, tmp); init_options(); init_netrc(); init_signals(); init_locking(); parse_args(argc, argv); ret = init_rcfile(); init_readline(); while (ret == 0) { char *cmd; cmd = read_command(); if (cmd == NULL) { /* Is it safe to do this... they just closed stdin, so * is it bad to write to stdout? */ putchar('\n'); ret = 1; } else { #ifdef HAVE_ADD_HISTORY if (strcmp(cmd, "") != 0) add_history(cmd); #endif ret = execute_command(cmd); free(cmd); } } if (session.connected) { close_connection(); } finish_locking(); ne_sock_exit(); return 0; } static void notifier(void *ud, ne_session_status status, const ne_session_status_info *info) { int quiet = get_bool_option(opt_quiet); switch (out_state) { case out_none: if (quiet) break; switch (status) { case ne_status_lookup: printf(_("Looking up hostname... ")); break; case ne_status_connecting: printf(_("Connecting to server... ")); break; case ne_status_connected: printf(_("connected.\n")); break; default: break; } break; case out_incommand: case out_transfer_upload: case out_transfer_download: case out_transfer_done: switch (status) { case ne_status_connecting: if (!quiet) printf(_(" (reconnecting...")); /* FIXME: should reset out_state here if transfer_done */ break; case ne_status_connected: if (!quiet) printf(_("done)")); break; case ne_status_recving: case ne_status_sending: /* Start of transfer: */ if ((out_state == out_transfer_download && status == ne_status_recving) || (out_state == out_transfer_upload && status == ne_status_sending)) { if (isatty(STDOUT_FILENO) && info->sr.total > 0) { out_state = out_transfer_pretty; putchar('\n'); pretty_progress_bar(info->sr.progress, info->sr.total); } else { out_state = out_transfer_plain; printf(" [."); } } break; default: break; } break; case out_transfer_plain: switch (status) { case ne_status_connecting: printf(_("] reconnecting: ")); break; case ne_status_connected: printf(_("okay [")); break; case ne_status_sending: case ne_status_recving: putchar('.'); fflush(stdout); if (info->sr.progress == info->sr.total) { out_state = out_transfer_done; } break; default: break; } break; case out_transfer_pretty: switch (status) { case ne_status_connecting: if (!quiet) printf(_("\rTransfer timed out, reconnecting... ")); break; case ne_status_connected: if (!quiet) printf(_("okay.")); break; case ne_status_recving: case ne_status_sending: pretty_progress_bar(info->sr.progress, info->sr.total); if (info->sr.progress == info->sr.total) { out_state = out_transfer_done; } default: break; } break; } fflush(stdout); } /* From ncftp. This function is (C) 1995 Mike Gleason, (mgleason@NcFTP.com) */ static void sub_timeval(struct timeval *tdiff, struct timeval *t1, struct timeval *t0) { tdiff->tv_sec = t1->tv_sec - t0->tv_sec; tdiff->tv_usec = t1->tv_usec - t0->tv_usec; if (tdiff->tv_usec < 0) { tdiff->tv_sec--; tdiff->tv_usec += 1000000; } } /* Smooth progress bar. * Doesn't update the bar more than once every 100ms, since this * might give flicker, and would be bad if we are displaying on * a slow link anyway. */ static void pretty_progress_bar(ne_off_t progress, ne_off_t total) { int len, n; double pc; static struct timeval last_call = {0}; struct timeval this_call; if (total < 0) return; if (progress < total && gettimeofday(&this_call, NULL) == 0) { struct timeval diff; sub_timeval(&diff, &this_call, &last_call); if (diff.tv_sec == 0 && diff.tv_usec < 100000) { return; } last_call = this_call; } if (progress == 0 || total == 0) { pc = 0; } else { pc = (double)progress / total; } len = pc * 30; printf(_("\rProgress: [")); for (n = 0; n<30; n++) { putchar((n':' ')); } printf(_("] %5.1f%% of %" NE_FMT_NE_OFF_T " bytes"), pc*100, total); fflush(stdout); } static int supply_creds(const char *prompt, const char *realm, const char *hostname, char *username, char *password) { char *tmp; switch (out_state) { case out_transfer_pretty: case out_transfer_done: putchar('\n'); break; case out_none: break; case out_incommand: case out_transfer_upload: case out_transfer_download: putchar(' '); break; case out_transfer_plain: printf("] "); break; } printf(prompt, realm, hostname); tmp = readline(_("Username: ")); if (tmp == NULL) { printf(_("\rAuthentication aborted!\n")); return -1; } else if (strlen(tmp) >= NE_ABUFSIZ) { printf(_("\rUsername too long (>%d)\n"), NE_ABUFSIZ); free(tmp); return -1; } strcpy(username, tmp); free(tmp); tmp = fm_getpassword(_("Password: ")); if (tmp == NULL) { printf(_("Authentication aborted!\n")); return -1; } else if (strlen(tmp) >= NE_ABUFSIZ) { printf(_("\rPassword too long (>%d)\n"), NE_ABUFSIZ); return -1; } strcpy(password, tmp); switch (out_state) { case out_transfer_download: case out_transfer_upload: case out_transfer_done: case out_incommand: printf(_("Retrying:")); fflush(stdout); break; case out_transfer_plain: printf(_("Retrying [")); fflush(stdout); break; default: break; } return 0; } static int supply_creds_server(void *userdata, const char *realm, int attempt, char *username, char *password) { /* Try netrc creds if we have them on first auth attempt. */ if (server_username && server_password && attempt-- == 0) { ne_strnzcpy(username, server_username, NE_ABUFSIZ); ne_strnzcpy(password, server_password, NE_ABUFSIZ); return 0; } if (attempt > 1) return -1; return supply_creds( _("Authentication required for %s on server `%s':\n"), realm, session.uri.host, username, password); } static int supply_creds_proxy(void *userdata, const char *realm, int attempt, char *username, char *password) { if (attempt > 1) return -1; return supply_creds( _("Authentication required for %s on proxy server `%s':\n"), realm, proxy_hostname, username, password); } cadaver-0.23.3/src/cmdline.h0000664000076400007640000000173610132320456015204 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2001, Joe Orton 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef CMDLINE_H #define CMDLINE_H char **parse_command( const char *line, int *count ); #endif /* CMDLINE_H */ cadaver-0.23.3/src/options.h0000664000076400007640000000355010132320456015260 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2001, Joe Orton 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef OPTIONS_H #define OPTIONS_H #include enum option_id { opt_tolerant, opt_expect100, opt_editor, opt_clicert, opt_namespace, opt_quiet, opt_proxy, opt_proxy_port, opt_debug, opt_utf8, opt_overwrite, opt_lockowner, opt_lockstore, opt_lockdepth, opt_lockscope, opt_pager, opt_searchdepth, opt_searchorder, opt_searchdorder, opt_searchall }; extern int lockdepth; /* current lock depth setting. */ extern int searchdepth; /* current search depth setting. */ extern enum ne_lock_scope lockscope; /* current lock scope setting. */ void execute_set( const char *opt, const char * ); void execute_unset( const char *opt, const char * ); /* Describe option of given name */ void execute_describe(const char *name); void *get_option( enum option_id id ); void set_option( enum option_id id, void *newval ); int get_bool_option(enum option_id id); void set_bool_option(enum option_id id, int truth); #endif /* OPTIONS_H */ cadaver-0.23.3/src/common.c0000664000076400007640000000262210132320456015047 0ustar jortonjorton/* sitecopy, manage remote web sites. Copyright (C) 1998-2001, Joe Orton . 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include "common.h" #include "i18n.h" /* Snagged from fetchmail */ # if !HAVE_STRERROR && !defined(strerror) char *strerror (errnum) int errnum; { extern char *sys_errlist[]; extern int sys_nerr; if (errnum > 0 && errnum <= sys_nerr) return sys_errlist[errnum]; return _("Unknown system error"); } # endif /* HAVE_STRERROR */ cadaver-0.23.3/src/options.c0000664000076400007640000002640511102027145015254 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2001, Joe Orton 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Options handling */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include /* NE_DEPTH_* */ #include "common.h" #include "cadaver.h" #include "options.h" static void set_debug(const char *new); static void unset_debug(const char *new); static void disp_debug(void); static void set_lockscope(const char *new); static void unset_lockscope(const char *new); static void disp_lockscope(void); static void set_lockdepth(const char *new); static void unset_lockdepth(const char *new); static void disp_lockdepth(void); static void set_searchdepth(const char *new); static void unset_searchdepth(const char *new); static void disp_searchdepth(void); /* Option holders */ static int enable_expect, presume_utf8, overwrite, quiet, searchall; enum ne_lock_scope lockscope; int lockdepth; /* search option global */ int searchdepth; static struct option { const char *name; enum option_id id; void *holder; /* for bool + string options */ enum { opt_bool, opt_string, opt_handled } type; /* for handled options */ void (*set)(const char *); void (*unset)(const char *); void (*display)(void); /* for all options */ const char *help; /* for handled options */ const char *handle_help; } options[] = { #define B(x,v,h) { #x, opt_##x, v, opt_bool, NULL, NULL, NULL, h, NULL } /* Booleans */ B(tolerant, &tolerant, "Tolerate non-WebDAV collections"), B(overwrite, &overwrite, "Enable overwrite (e.g. on copy/move operations"), #ifdef NE_SESSFLAG_EXPECT100 B(expect100, &enable_expect, "Enable use of 'Expect: 100-continue' header"), #endif /* NE_SESSFLAG_EXPECT100 */ B(utf8, &presume_utf8, "Presume filenames etc are UTF-8 encoded"), B(quiet, &quiet, "Whether to display connection status messages"), B(searchall, &searchall, "Whether to search and display all props including dead props"), #undef B #define S2(x,y, h) { x, y, NULL, opt_string, NULL, NULL, NULL, h, NULL } #define S(x,h) S2(#x, opt_##x, h) S(lockowner, "Lock owner URI"), S(lockstore, "Persistent lock storage file"), S(editor, "Editor to use with `edit' command"), S2("client-cert", opt_clicert, "Client certificate to use for SSL connections."), S(namespace, "Namespace to use for propset/propget commands."), S(pager, "Command to run for less/more commands."), S(proxy, "Hostname of proxy server"), S(searchorder, "Search ascending props options"), S(searchdorder, "Search descending props options"), { "proxy-port", opt_proxy_port, NULL, opt_string, NULL, NULL, NULL, "Port to use on proxy server", NULL }, #undef S { "debug", opt_debug, NULL, opt_handled, set_debug, unset_debug, disp_debug, "Debugging options", "The debug value is a list of comma-separated keywords.\n" "Valid keywords are: socket, http, xml, httpauth, cleartext." }, { "lockscope", opt_lockscope, NULL, opt_handled, set_lockscope, unset_lockscope, disp_lockscope, "Lock scope options", "The lockscope value must be one of two valid keywords: exclusive or shared." }, { "lockdepth", opt_lockdepth, NULL, opt_handled, set_lockdepth, unset_lockdepth, disp_lockdepth, "Lock depth options", "The lockdepth value must be 0 or infinity." }, /* Several options for search */ { "searchdepth", opt_searchdepth, NULL, opt_handled, set_searchdepth, unset_searchdepth, disp_searchdepth, "Search depth options", "The searchdepth value must be 0, 1 or infinity." }, { NULL, 0 } }; static const struct { const char *name; int val; } debug_map[] = { { "xml", NE_DBG_XML }, { "xmlparse", NE_DBG_XMLPARSE }, { "http", NE_DBG_HTTP }, { "socket", NE_DBG_SOCKET }, { "ssl", NE_DBG_SSL }, { "httpauth", NE_DBG_HTTPAUTH }, { "httpbody", NE_DBG_HTTPBODY }, { "cleartext", NE_DBG_HTTPPLAIN }, { "files", DEBUG_FILES }, { "locks", NE_DBG_LOCKS }, { NULL, 0 } }; #ifdef NE_SESSFLAG_EXPECT100 static void setunset_expect100(void) { if (session.connected) return; ne_set_session_flag(session.sess, NE_SESSFLAG_EXPECT100, get_bool_option(opt_expect100)); } #else #define setunset_expect100() {} #endif /* NE_SESSFLAG_EXPECT100 */ static void display_options(void) { int n; printf("Options:\n"); for (n = 0; options[n].name != NULL; n++) { int *val = (int *)options[n].holder; switch (options[n].type) { case opt_bool: printf(" %15s: %s\n", options[n].name, *val?"on":"off"); break; case opt_string: if (options[n].holder == NULL) { printf(" %15s: unset\n", options[n].name); } else { printf(" %15s: %s\n", options[n].name, (char *)options[n].holder); } break; case opt_handled: printf(" %15s: ", options[n].name); (*options[n].display)(); printf("\n"); break; } } } static void do_debug(const char *set, int setit) { char *opts, *pnt; if (!setit && !set) { ne_debug_mask = 0; return; } pnt = opts = ne_strdup(set); do { int d, got = 0; char *opt = ne_token(&pnt, ','); for (d = 0; debug_map[d].name != NULL; d++) { if (strcasecmp(opt, debug_map[d].name) == 0) { if (setit) { ne_debug_mask |= debug_map[d].val ; } else { ne_debug_mask &= ~debug_map[d].val; } got = 1; } } if (!got) { printf("Debug option %s unknown.\n", opt); } } while (pnt != NULL); free(opts); } static void set_debug(const char *set) { do_debug(set, 1); } static void unset_debug(const char *s) { do_debug(s, 0); } static void disp_debug(void) { int n, flag=0; putchar('{'); for (n = 0; debug_map[n].name != NULL; n++) { if (ne_debug_mask & debug_map[n].val) { printf("%s%s", flag++?",":"", debug_map[n].name); } } putchar('}'); } static void set_lockscope(const char *set) { if (strcasecmp(set,"exclusive") == 0) lockscope = ne_lockscope_exclusive; else if (strcasecmp(set,"shared") == 0) lockscope = ne_lockscope_shared; else printf("Invalid value for lockscope. Try `set lockscope' for more info.\n"); } static void unset_lockscope(const char *s) { lockscope = ne_lockscope_exclusive; } static void disp_lockscope(void) { if (lockscope == ne_lockscope_exclusive) printf("exclusive"); else if (lockscope == ne_lockscope_shared) printf("shared"); else printf("illegal value"); } static void set_lockdepth(const char *set) { if (strcmp(set, "0") == 0 || strcasecmp(set, "zero") == 0) lockdepth = NE_DEPTH_ZERO; else if (strcasecmp(set, "infinite") == 0 || strcasecmp(set, "infinity") == 0) lockdepth = NE_DEPTH_INFINITE; else printf("Invalid value for lockdepth. Try `set lockdepth' for more info.\n"); } static void unset_lockdepth(const char *s) { lockdepth = NE_DEPTH_INFINITE; } static void disp_lockdepth(void) { if (lockdepth == NE_DEPTH_ZERO) printf("zero"); else if (lockdepth == NE_DEPTH_INFINITE) printf("infinite"); else printf("illegal value"); } static void set_searchdepth(const char *set) { if (strcmp(set, "0") == 0 || strcasecmp(set, "zero") == 0) searchdepth = NE_DEPTH_ZERO; else if (strcasecmp(set, "1") == 0 || strcasecmp(set, "one") == 0) searchdepth = NE_DEPTH_ONE; else searchdepth = NE_DEPTH_INFINITE; } static void unset_searchdepth(const char *s) { searchdepth = NE_DEPTH_INFINITE; } static void disp_searchdepth(void) { if (searchdepth == NE_DEPTH_ZERO) printf("0"); else if (searchdepth == NE_DEPTH_ONE) printf("1"); else printf("infinity"); } static const struct option *find_option(const char *name) { int n; for (n = 0; options[n].name != NULL; n++) if (strcasecmp(options[n].name, name) == 0) return &options[n]; return NULL; } void execute_set(const char *opt, const char *newv) { if (opt == NULL) { display_options(); } else { int n; for (n = 0; options[n].name != NULL; n++) { if (strcasecmp(options[n].name, opt) == 0) { switch (options[n].type) { case opt_bool: if (newv) { printf("%s is a boolean option.\n", opt); } else { *(int *)options[n].holder = 1; setunset_expect100(); } break; case opt_string: if (newv == NULL) { printf("You must give a new value for %s\n", opt); } else { char *val = options[n].holder; if (val != NULL) { free(val); } options[n].holder = ne_strdup(newv); } break; case opt_handled: if (!newv) { printf("%s must be given a value:\n%s\n", opt, options[n].handle_help); } else { (*options[n].set)(newv); } break; } return; } } printf("Unknown option: %s.\n", opt); } } void execute_unset(const char *opt, const char *newv) { int n; for (n = 0; options[n].name != NULL; n++) { if (strcasecmp(options[n].name, opt) == 0) { switch (options[n].type) { case opt_bool: if (newv != NULL) { printf("%s ia a boolean option.\n", opt); } else { *(int *)options[n].holder = 0; setunset_expect100(); } break; case opt_string: /* FIXME: This is bad UI */ if (newv != NULL) { printf("%s cannot take a value to unset.\n", opt); } else { char *v = options[n].holder; free(v); options[n].holder = NULL; } break; case opt_handled: (*options[n].unset)(newv); break; } return; } } printf("Unknown option: %s.\n", opt); } void execute_describe(const char *name) { const struct option *opt = find_option(name); if (opt == NULL) { printf("Option `%s' not known.\n", name); return; } printf("Option `%s': %s\n", opt->name, opt->help); if (opt->handle_help) puts(opt->handle_help); } void *get_option(enum option_id id) { int n; for (n = 0; options[n].name != NULL; n++) { if (options[n].id == id) { return options[n].holder; } } return NULL; } int get_bool_option(enum option_id id) { int *ret = get_option(id); if (ret == NULL) return 0; return *ret; } void set_bool_option(enum option_id id, int truth) { int *opt = get_option(id); if (opt != NULL) { *opt = truth; setunset_expect100(); } } void set_option(enum option_id id, void *newval) { int n; for (n = 0; options[n].name != NULL; n++) { if (options[n].id == id) { options[n].holder = newval; setunset_expect100(); return; } } } cadaver-0.23.3/src/i18n.h0000664000076400007640000000022610132320456014341 0ustar jortonjorton #undef _ #ifdef ENABLE_NLS #include #define _(str) gettext(str) #else #define _(str) (str) #endif /* ENABLE_NLS */ #define N_(str) (str) cadaver-0.23.3/src/commands.h0000664000076400007640000000351311100331511015353 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2001, Joe Orton 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef COMMANDS_H #define COMMANDS_H #include "cadaver.h" extern int child_running; /* true when we have a child running */ #define CMD_VARY 9999 /* Returns the command structure for the command of given name. */ const struct command *get_command(const char *name); /* Returns absolute path which is 'filename' relative to 'path' * (which must already be an absolute path). e.g. * resolve_path("/dav/", "asda") == "/dav/asda" * resolve_path("/dav/", "/asda") == "/asda" * Also removes '..' segments, e.g. * resolve_path("/dav/foobar/", "../fish") == "/dav/fish" * If isdir is true, ensures the return value has a trailing slash. */ char *resolve_path(const char *dir, const char *filename, int isdir); /* Displays cadaver version details. */ void execute_about(void); /* Returns owner href. */ char *getowner(void); void out_success(void); void out_start(const char *verb, const char *noun); void out_result(int ret); int out_handle(int ret); #endif /* COMMANDS_H */ cadaver-0.23.3/src/version.c0000664000076400007640000003072310663024527015260 0ustar jortonjorton/* 'version' for cadaver Copyright (C) 2003-2006, Joe Orton Copyright (C) 2002-2003, GRASE Lab, UCSC , 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include #include #include #include "i18n.h" #include "commands.h" #include "cadaver.h" #include "basename.h" #include "utils.h" /* Message body for REPORT */ static const char *report_body = "" "" " " " " " " " " " " " " " " ""; typedef struct report_res { char *href; /* live props */ char *version_name; char *creator_displayname; char *getcontentlength; char *getlastmodified; char *successor_set; struct report_res *next; } report_res; /* Search XML parser context */ typedef struct { report_res *root; report_res *curr; int result_num; int start_prop; int err_code; ne_buffer *cdata; } report_ctx; enum { ELEM_multistatus = 1, ELEM_response, ELEM_href, ELEM_prop, ELEM_propstat, ELEM_status, /* props from RFC 2518 , 23 Appendices 23.1 */ ELEM_version_name, ELEM_creator_displayname, ELEM_getcontentlength, ELEM_getlastmodified, ELEM_ignore }; static const struct ne_xml_idmap report_elements[] = { {"DAV:", "multistatus", ELEM_multistatus}, {"DAV:", "response", ELEM_response}, {"DAV:", "href", ELEM_href}, {"DAV:", "propstat", ELEM_propstat}, {"DAV:", "prop", ELEM_prop}, {"DAV:", "status", ELEM_status}, /* Live props */ {"DAV:", "version-name", ELEM_version_name}, {"DAV:", "creator-displayname", ELEM_creator_displayname}, {"DAV:", "getcontentlength", ELEM_getcontentlength}, {"DAV:", "getlastmodified", ELEM_getlastmodified}, }; /* We do not validate at this point */ /* static int validate_report_elements(void *userdata, ne_xml_elmid parent, ne_xml_elmid child) { return NE_XML_VALID; } */ /* Set xml parser error */ static void set_xml_error(report_ctx * sctx, const char *format, ...) { va_list ap; char buf[512]; va_start(ap, format); ne_vsnprintf(buf, sizeof buf, format, ap); va_end(ap); ne_set_error(session.sess, "%s", buf); sctx->err_code = NE_ERROR; } static int start_element(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { report_ctx *rctx = (report_ctx *) userdata; int state = ne_xml_mapid(report_elements, NE_XML_MAPLEN(report_elements), nspace, name); /* Error occured, ignore remain part */ if (rctx->err_code != NE_OK) return rctx->err_code; ne_buffer_clear(rctx->cdata); switch (state) { case ELEM_response: /* Start of new response */ rctx->curr = ne_calloc(sizeof(report_res)); rctx->result_num++; break; case ELEM_prop: /* Start of prop */ if (rctx->curr == NULL) { set_xml_error(rctx, "XML : <%s> is in the wrong place", name); break; } rctx->start_prop = 1; break; case ELEM_propstat: /* expecting props */ case ELEM_href: /* href */ case ELEM_ignore: default: break; } return state; } #define REPORT_CP_ELEM(rctx, curr, name, desc, src) \ do { \ if ((curr) == NULL) \ set_xml_error((rctx), "XML : is in the wrong place", (name));\ else if (src)\ (desc) = ne_strdup(src);\ } while (0) static int cdata_report(void *userdata, int state, const char *buf, size_t len) { report_ctx *rctx = (report_ctx *) userdata; ne_buffer_append(rctx->cdata, buf, len); return 0; } static int end_element(void *userdata, int state, const char *nspace, const char *name) { report_ctx *rctx = (report_ctx *) userdata; const char *cdata = rctx->cdata->data; /* Error occured, ignore remain part */ if (rctx->err_code != NE_OK) return rctx->err_code; switch (state) { case ELEM_response: /* End of new response */ /* Nothing to add */ if (rctx->curr == NULL) { set_xml_error(rctx, "XML : is in the wrong place", name); break; } /* No HREF */ if (rctx->curr->href == NULL) { set_xml_error(rctx, "XML : No href info in the <%s>...", name, name); break; } /* make link */ rctx->curr->next = rctx->root; rctx->root = rctx->curr; rctx->curr = NULL; break; case ELEM_href: /* href */ REPORT_CP_ELEM(rctx, rctx->curr, name, rctx->curr->href, cdata); break; case ELEM_version_name: REPORT_CP_ELEM(rctx, rctx->curr, name, rctx->curr->version_name, cdata); break; case ELEM_creator_displayname: REPORT_CP_ELEM(rctx, rctx->curr, name, rctx->curr->creator_displayname, cdata); break; case ELEM_getcontentlength: REPORT_CP_ELEM(rctx, rctx->curr, name, rctx->curr->getcontentlength, cdata); break; case ELEM_getlastmodified: REPORT_CP_ELEM(rctx, rctx->curr, name, rctx->curr->getlastmodified, cdata); break; case ELEM_prop: /* Start of prop */ if (rctx->curr == NULL) set_xml_error(rctx, "XML : is in the wrong place", name); else /* stop to props */ rctx->start_prop = 0; break; case ELEM_ignore: case ELEM_propstat: /* expecting props */ default: break; } return NE_OK; } static void report_ctx_destroy(report_ctx * sctx) { report_res *res, *res_free; ne_buffer_destroy(sctx->cdata); for (res = sctx->root; res;) { ne_free(res->href); /* live props */ if (res->version_name) ne_free(res->version_name); if (res->creator_displayname) ne_free(res->creator_displayname); if (res->getcontentlength) ne_free(res->getcontentlength); if (res->getlastmodified) ne_free(res->getlastmodified); res_free = res; res = res->next; ne_free(res_free); } } /* Give UI feedback for request 'req', which got dispatch return code * 'ret'. */ static void req_result(ne_request *req, int ret) { if (ret != NE_OK) { out_result(ret); } else if (ne_get_status(req)->klass != 2) { out_result(NE_ERROR); } else { out_success(); } } static void simple_request(const char *remote, const char *verb, const char *method) { char *real_remote; ne_request *req; int ret; if (remote != NULL) { real_remote = resolve_path(session.uri.path, remote, true); } else { real_remote = ne_strdup(session.uri.path); } out_start(verb, remote); req = ne_request_create(session.sess, method, real_remote); ne_lock_using_resource(req, real_remote, 0); ret = ne_request_dispatch(req); req_result(req, ret); ne_request_destroy(req); free(real_remote); } void execute_version(const char *remote) { simple_request(remote, _("Versioning"), "VERSION-CONTROL"); } void execute_checkin(const char *remote) { simple_request(remote, _("Checking in"), "CHECKIN"); } void execute_checkout(const char *remote) { simple_request(remote, _("Checking out"), "CHECKOUT"); } void execute_uncheckout(const char *remote) { simple_request(remote, _("Cancelling check out of"), "UNCHECKOUT"); } /* displays report results */ static int display_report_results(report_ctx * rctx) { report_res *res; if (rctx->err_code) { return rctx->err_code; } printf(_(" %d version%s in history:\n"), rctx->result_num, rctx->result_num==1?"":"s"); for (res = rctx->root; res; res = res->next) { long modtime = res->getlastmodified ? ne_httpdate_parse(res->getlastmodified) : 0; int size = res->getcontentlength ? atol(res->getcontentlength) : 0; printf("%-40s %10d %s <%s>\n", res->href, size, format_time(modtime), res->version_name); } return rctx->err_code; } static int do_report(const char *real_remote, report_ctx *rctx) { int ret; ne_request *req; ne_xml_parser *report_parser; /* create/prep the request */ if ((req = ne_request_create(session.sess, "REPORT", real_remote)) == NULL) return NE_ERROR; /* Plug our XML parser */ report_parser = ne_xml_create(); ne_xml_push_handler(report_parser, start_element, cdata_report, end_element, rctx); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); ne_add_response_body_reader(req, ne_accept_2xx, ne_xml_parse_v, report_parser); /* Set body */ ne_set_request_body_buffer(req, report_body, strlen(report_body)); /* run the request, see what comes back. */ ret = ne_request_dispatch(req); if (ne_get_status(req)->klass != 2) ret = ne_get_status(req)->code; ne_request_destroy(req); return ret; } void execute_history(const char *remote) { int ret; char *real_remote; report_ctx *rctx = ne_calloc(sizeof(report_ctx)); rctx->cdata = ne_buffer_create(); if (remote != NULL) { real_remote = resolve_path(session.uri.path, remote, false); } else { real_remote = ne_strdup(session.uri.path); } out_start(_("Version history of"), real_remote); /* Run search */ ret = do_report(real_remote, rctx); if (ret != NE_OK) { /* Print out error message */ out_result(ret); } else { /* show report result */ display_report_results(rctx); } free(real_remote); report_ctx_destroy(rctx); } void execute_label(const char *remote, const char *act, const char *value) { int ret; char *real_remote; ne_request *req; ne_buffer *label_body; if (strcasecmp(act, "add") && strcasecmp(act, "remove") && strcasecmp(act, "set")) { printf(_("Invalid action `%s' given.\n"), act); return; } if (remote != NULL) { real_remote = resolve_path(session.uri.path, remote, true); } else { real_remote = ne_strdup(session.uri.path); } out_start(_("Labelling"), real_remote); /* Create Label Body */ label_body = ne_buffer_create(); /* Create the request body */ ne_buffer_zappend(label_body, "\n" "\n"); /* Adction */ ne_buffer_concat(label_body, "", value, "", NULL); ne_buffer_zappend(label_body, "\n"); /* create/prep the request */ req = ne_request_create(session.sess, "LABEL", real_remote); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); /* Set body */ ne_set_request_body_buffer(req, label_body->data, ne_buffer_size(label_body)); /* run the request, see what comes back. */ ret = ne_request_dispatch(req); /* Print out status */ req_result(req, ret); ne_buffer_destroy(label_body); ne_request_destroy(req); free(real_remote); } static const ne_propname vcr_props[] = { { "DAV:", "checked-in" }, { "DAV:", "checked-out" }, { NULL } }; static void vcr_results(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) { const char *checkin, *checkout; int *isvcr = userdata; checkin = ne_propset_value(set, &vcr_props[0]); checkout = ne_propset_value(set, &vcr_props[1]); /* is vcr */ if (checkin) { *isvcr = 1; } else if (checkout) { *isvcr = 2; } } int is_vcr(const char *uri) { int ret, vcr = 0; ne_propfind_handler *pfh = ne_propfind_create(session.sess, uri, NE_DEPTH_ZERO); ret = ne_propfind_named(pfh, vcr_props, vcr_results, &vcr); ne_propfind_destroy(pfh); if (ret != NE_OK) return 0; return vcr; } cadaver-0.23.3/src/cadaver.h0000664000076400007640000001267711073672301015210 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2005, 2008, Joe Orton 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef CADAVER_H #define CADAVER_H #include /* for ne_session */ #include /* for ne_lock_store */ #ifdef HAVE_LIBREADLINE /* readline requires FILE *, silly thing */ #include #ifdef HAVE_READLINE_H #include #else /* !HAVE_READLINE_H */ #ifdef HAVE_READLINE_READLINE_H #include #endif #endif /* HAVE_READLINE_H */ #ifdef HAVE_HISTORY_H #include #else #ifdef HAVE_READLINE_HISTORY_H #include #endif #endif /* HAVE_HISTORY_H */ #endif #include "common.h" /* DON'T FORGET TO ADD A NEW COMMAND ALIAS WHEN YOU ADD A NEW COMMAND */ enum command_id { cmd_ls, cmd_cd, cmd_quit, cmd_open, cmd_close, cmd_about, cmd_pwd, cmd_help, cmd_put, cmd_get, cmd_mkcol, cmd_delete, cmd_move, cmd_copy, cmd_less, cmd_cat, cmd_lpwd, cmd_lcd, cmd_lls, cmd_mput, cmd_mget, cmd_echo, cmd_set, cmd_unset, cmd_rmcol, cmd_lock, cmd_unlock, cmd_steal, cmd_discover, cmd_showlocks, cmd_propedit, cmd_propnames, cmd_propget, cmd_propset, cmd_propdel, cmd_chexec, cmd_edit, cmd_logout, cmd_describe, cmd_search, cmd_version, cmd_checkin, cmd_checkout, cmd_uncheckout, cmd_history, cmd_label, cmd_unknown /* DON'T FORGET TO ADD A NEW COMMAND ALIAS WHEN YOU ADD A NEW COMMAND */ }; struct command { enum command_id id; /* unique ID */ const char *name; /* real command name. */ unsigned int needs_connection; /* true if only works when connected */ int min_args, max_args; /* min and max # of arguments */ enum { /* parameter scope */ parmscope_none, /* not at all */ parmscope_option, /* option parameter */ parmscope_local, /* local filenames */ parmscope_remote /* remote filename */ } scope; union { void (*take0)(void); void (*take1)(const char *); void (*take2)(const char *, const char *); void (*take3)(const char *, const char *, const char *); void (*takeV)(int, const char **); } handler; const char *call; /* command usage */ const char *short_help; /* single-line help message */ }; extern char *proxy_hostname; extern int proxy_port; struct session { ne_uri uri; ne_session *sess; int connected; /* non-zero when connected. */ int isdav; /* non-zero if real DAV collection */ ne_lock_store *locks; /* stored locks */ char *lastwp; /* last working path. */ }; /* Current session state. */ extern struct session session; /* Sets the current collection to the given path. Returns zero on * success, non-zero if newpath is an untolerated non-WebDAV * collection. */ int set_path(const char *newpath); extern int tolerant; #ifdef HAVE_LIBREADLINE char *command_generator(const char *text, int state); #else /* roll our own */ char *readline(const char *prompt); #endif enum resource_type { resr_normal = 0, resr_collection, resr_reference, resr_error }; #ifdef HAVE_UNSIGNED_LONG_LONG typedef unsigned long long dav_size_t; #define FMT_DAV_SIZE_T "ll" #ifdef HAVE_STRTOULL #define DAV_STRTOL strtoull #endif #else typedef unsigned long dav_size_t; #define FMT_DAV_SIZE_T "l" #endif #ifndef DAV_STRTOL #define DAV_STRTOL strtol #endif struct resource { char *uri; char *displayname; enum resource_type type; dav_size_t size; time_t modtime; int is_executable; int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */ char *error_reason; /* error string returned for this resource */ int error_status; /* error status returned for this resource */ struct resource *next; }; void close_connection(void); void open_connection(const char *url); void execute_ls(const char *remote); void execute_edit(const char *remote); /* Determine whether the resource is a version controlled resource * 1: Checkin, 2: Checkout, 0: Otherwise */ int is_vcr(const char *remote); void execute_version(const char *remote); void execute_checkin(const char *remote); void execute_checkout(const char *remote); void execute_uncheckout(const char *remote); void execute_history(const char *remote); void execute_label(const char *res, const char *act, const char *value); void execute_search(int count, const char **args); void free_resource(struct resource *res); void free_resource_list(struct resource *res); int fetch_resource_list(ne_session *sess, const char *uri, int depth, int include_uri, struct resource **reslist); /* Command feedback handling */ enum output_type { o_start, o_upload, o_download, o_finish }; void output(enum output_type, const char *fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif /* __GNUC__ */ ; #endif /* CADAVER_H */ cadaver-0.23.3/src/utils.c0000664000076400007640000000542010354746051014727 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2001, Joe Orton , Portions are: Copyright (C) 85, 88, 90, 91, 1995-1999 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include "i18n.h" #include "cadaver.h" #include "utils.h" /* Returns non-zero if given resource is not a collection resource. * This function MAY make a request to the server. */ enum resource_type getrestype(const char *uri) { struct resource *res = NULL; int ret = 0; /* TODO: just request resourcetype here. */ ret = fetch_resource_list(session.sess, uri, NE_DEPTH_ZERO, 1, &res); if (ret == NE_OK) { if (res != NULL && ne_path_compare(uri, res->uri) == 0) { ret = res->type; } else { /* FIXME: this error occurs when you do open /foo and get * the response for /foo/ back. */ ne_set_error(session.sess, _("Did not find a collection resource.")); ret = resr_error; } } else { ret = resr_error; } free_resource_list(res); return ret; } char *format_time(time_t when) { const char *fmt; static char ret[256]; struct tm *local; time_t current_time; if (when == (time_t)-1) { /* Happens on lock-null resources */ return " (unknown) "; } /* from GNU fileutils... this section is * */ current_time = time(NULL); if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */ || current_time < when - 60L * 60L) { /* The file is fairly old or in the future. POSIX says the cutoff is 6 months old; approximate this by 6*30 days. Allow a 1 hour slop factor for what is considered "the future", to allow for NFS server/client clock disagreement. Show the year instead of the time of day. */ fmt = "%b %e %Y"; } else { fmt = "%b %e %H:%M"; } local = localtime(&when); if (local != NULL) { if (strftime(ret, 256, fmt, local)) { return ret; } } return "???"; } cadaver-0.23.3/src/utils.h0000664000076400007640000000217310132320456014725 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2001, Joe Orton , except where otherwise indicated. 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "cadaver.h" /* Returns resource type of resource with given URI; where resr_error * means "resource not found." */ enum resource_type getrestype(const char *uri); /* Returns time to display */ char *format_time(time_t when); cadaver-0.23.3/src/search.c0000664000076400007640000012726310663025430015040 0ustar jortonjorton/* 'search' for cadaver Copyright (C) 2004-2006, Joe Orton Copyright (C) 2002, GRASE Lab, UCSC , except where otherwise indicated. 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include #include #include #include "i18n.h" #include "commands.h" #include "cadaver.h" #include "basename.h" #include "options.h" #include "utils.h" /* From ne_props.c * Need to move util.c or something? */ #define NSPACE(x) ((x) ? (x) : "") /* * The Macro definations that 'wordtype' might be. */ #define QUOT 101 /*''' */ #define COMMA 102 /*',' */ #define LPAR 103 /*'(' */ #define RPAR 104 /*')' */ #define EQ 105 /*'=' */ #define LE 106 /*'<=' */ #define LT 107 /*'<' */ #define GE 108 /*'>=' */ #define GT 109 /*'>' */ #define NEQ 110 /*'<>' */ #define IDEN 111 /*Integer */ #define INTEGER 112 /*identifier */ #define UNKNOWN 113 /*unknown charactor */ #define ENDBUF 114 /*End of the buffer */ #define WORDLEN 256 /*Max length of a identifier(token) in the search command */ #undef EOL #define EOL "\n" /* Dead prop */ typedef struct dead_prop { char *name; char *nspace; char *value; struct dead_prop *next; } dead_prop; typedef struct search_res { char *href; /* live props */ char *creationdate; char *displayname; char *getcontentlanguage; char *getcontentlength; char *getcontenttype; char *getetag; char *getlastmodified; char *lockdiscovery; char *resourcetype; char *source; char *supportedlock; char *collection; dead_prop *root; dead_prop *curr; int dead_prop_num; struct search_res *next; } search_res; /* Search XML parser context */ typedef struct { search_res *root; search_res *curr; int result_num; int start_prop; int err_code; ne_buffer *cdata; } search_ctx; enum { ELEM_multistatus = 1, ELEM_response, ELEM_href, ELEM_prop, ELEM_propstat, ELEM_status, ELEM_responsedescription, /* props from RFC 2518 , 23 Appendices 23.1 */ ELEM_creationdate, ELEM_displayname, ELEM_getcontentlanguage, ELEM_getcontentlength, ELEM_getcontenttype, ELEM_getetag, ELEM_getlastmodified, ELEM_lockdiscovery, ELEM_resourcetype, ELEM_source, ELEM_supportedlock, ELEM_collection, ELEM_ignore }; static const struct ne_xml_idmap search_elements[] = { {"DAV:", "multistatus", ELEM_multistatus}, {"DAV:", "response", ELEM_response}, {"DAV:", "responsedescription", ELEM_responsedescription}, {"DAV:", "href", ELEM_href}, {"DAV:", "propstat", ELEM_propstat}, {"DAV:", "prop", ELEM_prop}, {"DAV:", "status", ELEM_status}, /* Live props */ {"DAV:", "creationdate", ELEM_creationdate}, {"DAV:", "displayname", ELEM_displayname}, {"DAV:", "getcontentlanguage", ELEM_getcontentlanguage}, {"DAV:", "getcontentlength", ELEM_getcontentlength}, {"DAV:", "getcontenttype", ELEM_getcontenttype}, {"DAV:", "getetag", ELEM_getetag}, {"DAV:", "getlastmodified", ELEM_getlastmodified}, {"DAV:", "lockdiscovery", ELEM_lockdiscovery}, {"DAV:", "resourcetype", ELEM_resourcetype}, {"DAV:", "source", ELEM_source}, {"DAV:", "supportedlock", ELEM_supportedlock}, {"DAV:", "collection", ELEM_collection}, /* Ignore it for now */ {"DAV:", "lockentry", ELEM_ignore}, {"DAV:", "lockscope", ELEM_ignore}, {"DAV:", "locktype", ELEM_ignore}, {"DAV:", "exclusive", ELEM_ignore}, {"DAV:", "shared", ELEM_ignore}, {"DAV:", "read", ELEM_ignore}, {"DAV:", "write", ELEM_ignore}, }; /* * Basic search parser functions * return NE_OK or error_no * basic_search must be allcated before the function call. */ static int search_select_gen(const ne_propname * props, ne_buffer * basic_search); static int search_from_gen(const char *href, const int depth, ne_buffer * basic_search); static int search_where_gen(const char *query, ne_buffer * basic_search); static int search_orderby_gen(const ne_propname * asc, const ne_propname * des, ne_buffer * basic_search); /* * Static functions for where condition parser */ static int read_aword(char **string_parsed, char *word_fetched); static int first_word_equal(const char *string_parsed, const char *word_to_compare); static int match_fetch(char **string_parsed, const char *str_expected); static int search_condition(char **string_parsed, ne_buffer * result_buf); static int boolean_term(char **strparsed, ne_buffer * result_buf); static int boolean_factor(char **string_parsed, ne_buffer * result_buf); static int boolean_primary(char **string_parsed, ne_buffer * result_buf); static int operator_translate(const char *operator, char *XML_operator); static int predicate(char **string_parsed, ne_buffer * result_buf); static int contains_predicate(char **string_parsed, ne_buffer * result_buf); static int quoted_string(char **string_parsed, ne_buffer * result_buf); static int comparison_value(char **string_parsed, ne_buffer * result_buf); static int word_string(char **string_parsed, ne_buffer * result_buf); /* Set xml parser error */ static void set_xml_error(search_ctx *sctx, const char *format, ...) { va_list ap; char buf[512]; va_start(ap, format); ne_vsnprintf(buf, sizeof buf, format, ap); va_end(ap); ne_set_error(session.sess, "%s", buf); sctx->err_code = NE_ERROR; } static int start_element(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { search_ctx *sctx = (search_ctx *) userdata; int state = ne_xml_mapid(search_elements, NE_XML_MAPLEN(search_elements), nspace, name); /* Error occured, ignore remain part */ if (sctx->err_code != NE_OK) return sctx->err_code; ne_buffer_clear(sctx->cdata); switch (state) { case ELEM_ignore: break; case ELEM_response: /* Start of new response */ sctx->curr = ne_calloc(sizeof(search_res)); sctx->result_num++; break; case ELEM_href: /* href */ break; case ELEM_propstat: /* expecting props */ break; case ELEM_prop: /* Start of prop */ if (sctx->curr == NULL) { set_xml_error(sctx, "XML : <%s> is in the wrong place", name); break; } sctx->start_prop = 1; break; default: if (get_bool_option(opt_searchall) && /* check searchall option */ sctx->curr && sctx->start_prop == 1) { /* It's prop */ search_res *res = sctx->curr; res->dead_prop_num++; res->curr = (dead_prop *) ne_calloc(sizeof(dead_prop)); res->curr->name = ne_strdup(name); res->curr->nspace = ne_strdup(nspace); } break; } return state; } #define SEARCH_CP_ELEM(sctx, curr, name, desc, src) \ do { \ if ((curr) == NULL) \ set_xml_error((sctx), "XML : is in the wrong place", (name));\ else if (src)\ (desc) = ne_strdup(src);\ } while (0) static int cdata_search(void *userdata, int state, const char *buf, size_t len) { search_ctx *sctx = (search_ctx *) userdata; ne_buffer_append(sctx->cdata, buf, len); return 0; } static int end_element(void *userdata, int state, const char *nspace, const char *name) { search_ctx *sctx = (search_ctx *) userdata; const char *cdata = sctx->cdata->data; /* Error occured, ignore remain part */ if (sctx->err_code != NE_OK) return sctx->err_code; switch (state) { case ELEM_ignore: break; case ELEM_response: /* End of new response */ /* Nothing to add */ if (sctx->curr == NULL) { set_xml_error(sctx, "XML : is in the wrong place", name); break; } /* No HREF */ if (sctx->curr->href == NULL) { set_xml_error(sctx, "XML : No href info in the <%s>...", name, name); break; } /* make link */ sctx->curr->next = sctx->root; sctx->root = sctx->curr; sctx->curr = NULL; break; case ELEM_href: /* href */ SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->href, cdata); break; /* live props */ case ELEM_creationdate: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->creationdate, cdata); break; case ELEM_displayname: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->displayname, cdata); break; case ELEM_getcontentlanguage: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->getcontentlanguage, cdata); break; case ELEM_getcontentlength: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->getcontentlength, cdata); break; case ELEM_getcontenttype: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->getcontenttype, cdata); break; case ELEM_getetag: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->getetag, cdata); break; case ELEM_getlastmodified: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->getlastmodified, cdata); break; case ELEM_lockdiscovery: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->lockdiscovery, cdata); break; case ELEM_resourcetype: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->resourcetype, cdata); break; case ELEM_source: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->source, cdata); break; case ELEM_supportedlock: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->supportedlock, cdata); break; case ELEM_collection: SEARCH_CP_ELEM(sctx, sctx->curr, name, sctx->curr->collection, cdata); break; case ELEM_propstat: /* expecting props */ break; case ELEM_prop: /* Start of prop */ if (sctx->curr == NULL) set_xml_error(sctx, "XML : is in the wrong place", name); else /* stop to props */ sctx->start_prop = 0; break; default: if (get_bool_option(opt_searchall) && /* check searchall option */ sctx->curr && sctx->start_prop == 1) { /* It's dead prop */ search_res *res = sctx->curr; res->curr->value = ne_strdup(cdata); res->curr->next = res->root; res->root = res->curr; res->curr = NULL; } break; } return NE_OK; } #define RESULT_PER_PAGE 15 /* displays search results */ static int display_results(search_ctx * sctx) { search_res *res; dead_prop *dprop; int i; if (sctx->err_code) { return sctx->err_code; } for (i=1, res = sctx->root; res; res = res->next, i++) { long modtime = res->getlastmodified ? ne_httpdate_parse(res->getlastmodified) : 0; int size = res->getcontentlength ? atol(res->getcontentlength) : 0; char exec_char = ' '; if (i%RESULT_PER_PAGE ==1) { printf("Found %d results (%d-%d)\n\n", sctx->result_num, i, sctx->result_numresult_num:i+9); } printf("[%d] %-40s%c %10d %s <%.10s>\n", i, res->href, exec_char, size, format_time(modtime), res->getcontenttype?res->getcontenttype:""); for (dprop = res->root; get_bool_option(opt_searchall) && dprop; dprop = dprop->next) printf("\t- %s:%s = %s\n", /* better way to show ? */ dprop->nspace, dprop->name, dprop->value); if (i%RESULT_PER_PAGE == 0) { char buf[256]; printf("-- Enter to More, 'q' to QUIT --"); fgets(buf, 255, stdin); if (*buf=='q') break; } } return sctx->err_code; } static void search_ctx_destroy(search_ctx * sctx) { search_res *res, *res_free; dead_prop *dprop, *dprop_free; ne_buffer_destroy(sctx->cdata); for (res = sctx->root; res;) { if (res->href) ne_free(res->href); /* live props */ if (res->creationdate) ne_free(res->creationdate); if (res->displayname) ne_free(res->displayname); if (res->getcontentlanguage) ne_free(res->getcontentlanguage); if (res->getcontentlength) ne_free(res->getcontentlength); if (res->getcontenttype) ne_free(res->getcontenttype); if (res->getetag) ne_free(res->getetag); if (res->getlastmodified) ne_free(res->getlastmodified); if (res->lockdiscovery) ne_free(res->lockdiscovery); if (res->resourcetype) ne_free(res->resourcetype); if (res->source) ne_free(res->source); if (res->supportedlock) ne_free(res->supportedlock); if (res->collection) ne_free(res->collection); for (dprop = res->root; dprop;) { if (dprop->nspace) ne_free(dprop->nspace); if (dprop->name) ne_free(dprop->name); if (dprop->value) ne_free(dprop->value); dprop_free = dprop; dprop = dprop->next; ne_free(dprop_free); } res_free = res; res = res->next; ne_free(res_free); } } /* create propname struct from searchorder setting */ static ne_propname *order_props_create(const char *str) { int n; char *buf; char *tok; char *delm = " \t\n\r"; int num_props = 0; ne_propname *props; /* No props */ if (str == NULL) return NULL; buf = ne_strdup(str); if (strtok(buf, delm)) { num_props = 1; while (strtok(NULL, delm)) num_props++; } /* No props */ if (num_props == 0) return NULL; /* One more for last NULL */ props = ne_calloc(sizeof(ne_propname) * (num_props + 1)); /* Set first token */ ne_free(buf); buf = ne_strdup(str); tok = strtok(buf, delm); /* Other idea? */ props[0].nspace = ne_strdup("DAV:"); props[0].name = ne_strdup(tok); for (n = 1; (tok = strtok(NULL, delm)); n++) { props[n].nspace = ne_strdup("DAV:"); props[n].name = ne_strdup(tok); } ne_free(buf); return props; } static void order_props_destroy(ne_propname * props) { int n; if (props == NULL) return; for (n = 0; props[n].name != NULL; n++) { free((char *)props[n].name); free((char *)props[n].nspace); } free(props); props = NULL; } /* Run search and get the data to sctx */ static int run_search(ne_session * sess, const char *uri, int depth, ne_buffer * query, search_ctx * sctx) { int ret; ne_request *req; ne_buffer *basic_search = ne_buffer_create(); ne_xml_parser *search_parser; const char *searchorder = (const char *) get_option(opt_searchorder); const char *searchdorder = (const char *) get_option(opt_searchdorder); ne_propname *asc = order_props_create(searchorder); ne_propname *des = order_props_create(searchdorder); /* create/prep the request */ if ((req = ne_request_create(sess, "SEARCH", uri)) == NULL) return NE_ERROR; /* Create the request body */ ne_buffer_zappend(basic_search, "" EOL "" EOL); if (search_select_gen(NULL, basic_search) != NE_OK) return NE_ERROR; if (search_from_gen(uri, depth, basic_search) != NE_OK) return NE_ERROR; if (search_where_gen(query->data, basic_search) != NE_OK) return NE_ERROR; if (search_orderby_gen(asc, des, basic_search) != NE_OK) return NE_ERROR; ne_buffer_zappend(basic_search, "" EOL); ne_set_request_body_buffer(req, basic_search->data, ne_buffer_size(basic_search)); /* Plug our XML parser */ search_parser = ne_xml_create(); ne_xml_push_handler(search_parser, start_element, cdata_search, end_element, sctx); ne_add_request_header(req, "Content-Type", NE_XML_MEDIA_TYPE); ne_add_depth_header(req, depth); ne_add_response_body_reader(req, ne_accept_207, ne_xml_parse_v, search_parser); /* run the request, see what comes back. */ if ((ret = ne_request_dispatch(req)) != NE_OK) return ret; /* Check Errors from XML parser */ if (sctx->err_code != NE_OK) return NE_ERROR; /* Get response code */ if (ne_get_status(req)->code != 207) return NE_ERROR; /* destroy request, parse, and etc */ order_props_destroy(asc); order_props_destroy(des); ne_buffer_destroy(basic_search); ne_request_destroy(req); ne_xml_destroy(search_parser); return NE_OK; } /* Main execute routine for search */ void execute_search(int count, const char **args) { int ret; const char **pnt; ne_buffer *query = ne_buffer_create(); search_ctx *sctx = ne_calloc(sizeof(search_ctx)); sctx->cdata = ne_buffer_create(); /* default is success */ sctx->err_code = NE_OK; for (pnt = args; *pnt != NULL; pnt++) { /* Need quota */ if (strchr(*pnt, ' ') || strchr(*pnt, '\t')) ne_buffer_concat(query, "'", *pnt, "' ", NULL); else ne_buffer_concat(query, *pnt, " ", NULL); } printf(_("Using query: ")); printf("%s, ", query->data); /* Run search and get data to sctx */ ret = run_search(session.sess, session.uri.path, searchdepth, query, sctx); if (ret == NE_OK) { display_results(sctx); } out_result(ret); search_ctx_destroy(sctx); ne_buffer_destroy(query); } /* Generate select part of the query. allprop if the props arg is NULL. */ static int search_select_gen(const ne_propname * props, ne_buffer * basic_search) { int n; if (!basic_search) { ne_set_error(session.sess, "select_gen: no buffer"); return NE_ERROR; } if (props == NULL) { ne_buffer_zappend(basic_search, "" EOL); return NE_OK; } ne_buffer_zappend(basic_search, "" EOL); for (n = 0; props[n].name != NULL; n++) { ne_buffer_concat(basic_search, "<", props[n].name, " xmlns=\"", NSPACE(props[n].nspace), "\"/>" EOL, NULL); } ne_buffer_zappend(basic_search, "" EOL); return NE_OK; } static int search_from_gen(const char *href, const int depth, ne_buffer * basic_search) { const char *depth_str; if (!basic_search || !href) { ne_set_error(session.sess, "from_gen: no buffer or no href"); return NE_ERROR; } switch (depth) { case NE_DEPTH_ONE: depth_str = "1"; break; case NE_DEPTH_ZERO: depth_str = "0"; break; default: depth_str = "infinity"; break; } ne_buffer_concat(basic_search, "", href, "", depth_str, "" EOL, NULL); return NE_OK; } /* Parse a searchquery. It will call the search_condition() function and * check the ending status. If the ending status is not ENDBUF, then there will * be a syntax error. * The parsing result will be saved in 'result_buf'. * * Returns: * NE_OK: success * NE_ERROR: syntax error * */ static int search_where_gen(const char *condition_str, ne_buffer * basic_search) { char identifier[WORDLEN + 1] = ""; char *string_parsed = ne_strdup(condition_str); char *ptr_backup = string_parsed; /* The buffer storing the parsing result of search condition */ ne_buffer *result_buf; if (!basic_search || !condition_str) { ne_set_error(session.sess, "where_gen: no buffer or no query"); return NE_ERROR; } result_buf = ne_buffer_create(); /* Fill boby from to */ ne_buffer_zappend(basic_search, "" EOL); if (search_condition(&string_parsed, result_buf) == NE_ERROR) { ne_free(ptr_backup); ne_buffer_destroy(result_buf); return NE_ERROR; /*Parsing error */ } /*The ending of a condition must be an ENDBUF */ if (read_aword(&string_parsed, identifier) != ENDBUF) { ne_set_error(session.sess, "Syntax error in the search condition."); ne_free(ptr_backup); ne_buffer_destroy(result_buf); return NE_ERROR; } /*Append the parsing result of the search condition */ ne_buffer_zappend(basic_search, result_buf->data); ne_buffer_zappend(basic_search, "" EOL); ne_free(ptr_backup); ne_buffer_destroy(result_buf); return NE_OK; } /*End of ne_search_where_gen */ static int search_orderby_gen(const ne_propname * asc, const ne_propname * des, ne_buffer * basic_search) { int n; if (!basic_search) { ne_set_error(session.sess, "orderby_gen: no buffer or no query"); return NE_ERROR; } /* No order information */ if (asc == NULL && des == NULL) return NE_OK; ne_buffer_zappend(basic_search, "" EOL); for (n = 0; asc && asc[n].name != NULL; n++) { ne_buffer_zappend(basic_search, "" EOL); ne_buffer_concat(basic_search, "<", asc[n].name, " xmlns=\"", NSPACE(asc[n].nspace), "\"/>" EOL, NULL); ne_buffer_zappend(basic_search, "" EOL); } for (n = 0; des && des[n].name != NULL; n++) { ne_buffer_zappend(basic_search, "" EOL); ne_buffer_concat(basic_search, "<", des[n].name, " xmlns=\"", NSPACE(des[n].nspace), "\"/>" EOL, NULL); ne_buffer_zappend(basic_search, "" EOL); } ne_buffer_zappend(basic_search, "" EOL); return NE_OK; } /* Search command parser * * This is the Search command parser implementation. * The goal of this code is to translate * dasl search command into XML format. * * The user interface of search command is: * search resource_URI display_fields condition orderby * * This code will parse the three parts of the search command, * dispolay_fields, * * condition and orderby, and translate them into XML, which is a part of a * dasl request. * * The BNF of display_fields, condition and orderby is as below: * * ::= identifier {,identifier} * ::= identifier ["asc"|"desc"] {,identifier ["asc"|"desc"]} * * ::= | " or " * ::= | " and " * ::= [not] * ::= |"("")" * ::= || * ::= * ( | | ) * ::= like -----Formally, * [not] like match_string * ::= contains ( | ) * * ::= identifier * * ::= "=" | "<" | ">" | "<>" | "!=" | "<=" | ">=" * ::= "'" {} "'" * ::= {} * * ::= "'" { | "_" | "%" } "'" * ::= { ||} * ::= [+|-]{} */ /* Read a word from the buffer. The word is fetched into 'word_fetched'. * Every time a word is read, '*string_parsed' is changed to the pointer * pointing to the char just after 'word_fetched'. * * Parameters: * string_parsed: -- *string_parsed points to the buffer. '*string_parsed' * will be changed every time a word is fetched. * word_fetched: -- The word that is fetched. * Returns: * ENDBUF , if the end of buffer, '\0', has been reached. * UNKNOWN, if the word is invalid. * According word type, if the word is valid. * */ static int read_aword(char **string_parsed, char *word_fetched) { int i = 0; int ifetch = 0; char *stringptr = *string_parsed; word_fetched[0] = '\0'; /*Find the left bound of a word */ while (isspace(stringptr[i])) i++; if (stringptr[i] == '\0') return ENDBUF; /* * Check whether the next word is a identifier. An identifier may * be a keyword or a column name. */ if (isalpha(stringptr[i])) { do { word_fetched[ifetch++] = stringptr[i++]; } while (isalnum(stringptr[i]) || (stringptr[i] == '_')); *string_parsed = *string_parsed + i; word_fetched[ifetch] = '\0'; return IDEN; /*Identifier */ } /* Check whether the next word is an integer */ /* A problem here: + , or - !!!!! PK */ if (stringptr[i] == '+' || stringptr[i] == '-' || isdigit(stringptr[i])) { do { word_fetched[ifetch++] = stringptr[i++]; } while (isdigit(stringptr[i])); *string_parsed = *string_parsed + i; word_fetched[ifetch] = '\0'; return INTEGER; /*Identifier */ } /* Check whether the next word is "<=", ">=", or "<>" */ if ((stringptr[i] == '>') && (stringptr[i + 1] == '=')) { strcpy(word_fetched, ">="); *string_parsed = *string_parsed + i + 2; return GE; /*Indicates >= */ } if ((stringptr[i] == '<') && (stringptr[i + 1] == '=')) { strcpy(word_fetched, "<="); *string_parsed = *string_parsed + i + 2; return LE; /*Indicates <= */ } if ((stringptr[i] == '<') && (stringptr[i + 1] == '>')) { strcpy(word_fetched, "<>"); *string_parsed = *string_parsed + i + 2; return NEQ; /*Indicates <> */ } /*Check whether the next word is "'", ",", "(", ")", ">", * "<", "=", */ switch (stringptr[i]) { case '\'': strcpy(word_fetched, "'"); *string_parsed = *string_parsed + i + 1; return QUOT; case ',': strcpy(word_fetched, ","); *string_parsed = *string_parsed + i + 1; return COMMA; case '(': strcpy(word_fetched, "("); *string_parsed = *string_parsed + i + 1; return LPAR; case ')': strcpy(word_fetched, ")"); *string_parsed = *string_parsed + i + 1; return RPAR; case '>': strcpy(word_fetched, ">"); *string_parsed = *string_parsed + i + 1; return GT; case '<': strcpy(word_fetched, "<"); *string_parsed = *string_parsed + i + 1; return LT; case '=': strcpy(word_fetched, "="); *string_parsed = *string_parsed + i + 1; return EQ; default: word_fetched[0] = stringptr[i]; word_fetched[1] = '\0'; *string_parsed = *string_parsed + i + 1; return UNKNOWN; } /*End of switch */ } /*End of read_aword */ /*Read the first word from the string buffer, string_parsed. If the * first is equal to the 'word_to_compare', return 1, else return 0. * The first word will be saved to 'the_first_word', but the pointer * to the buffer, string_parsed, will not be changed. * Returns: * 1: The first word is equal to the word expected. * 0: otherwise * */ static int first_word_equal(const char *string_parsed, const char *word_to_compare) { char *string_buffer = NULL; char *ptr_backup = NULL; char first_word[WORDLEN + 1] = ""; string_buffer = ne_strdup(string_parsed); ptr_backup = string_buffer; read_aword(&string_buffer, first_word); ne_free(ptr_backup); if (strcasecmp(first_word, word_to_compare) == 0) return 1; /*equal */ else return 0; /*Not equal */ } /*End of first_word_compare */ /*Read the first word from the string buffer, string_parsed. If the * first is an interger, return 1, else return 0. * The first word will be saved to 'the_first_word', but the pointer * to the buffer, string_parsed, will not be changed. * Returns: * 1: The first word is equal to the word expected. * 0: otherwise * */ static int first_word_integer(const char *string_parsed) { char *string_buffer = NULL; char *ptr_backup = NULL; char first_word[WORDLEN + 1] = ""; int ret; string_buffer = ne_strdup(string_parsed); ptr_backup = string_buffer; if (read_aword(&string_buffer, first_word) == INTEGER) ret = 1; else ret = 0; ne_free(ptr_backup); return ret; } /*End of first_word_compare */ /* The function reads the first word in the string buffer, *string_parsed, and * changes *string_parsed. * Returns: * NE_ERROR: If the word read is equal to 'str_expected'. * NE_OK: Otherwise * */ static int match_fetch(char **string_parsed, const char *str_expected) { char first_word[WORDLEN + 1] = ""; read_aword(string_parsed, first_word); if (strcmp(first_word, str_expected) == 0) return NE_OK; else return NE_ERROR; } /*End of match_fetch */ /* * Parse the search condition * ::= | or * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * . * Returns: * NE_OK: success * NE_ERROR: syntax error * */ static int search_condition(char **string_parsed, ne_buffer * result_buf) { char identifier[WORDLEN + 1] = ""; /* Indicates whether there is any 'or' in the search condition */ int added_or = 0; ne_buffer *term_result; ne_buffer_clear(result_buf); term_result = ne_buffer_create(); if (boolean_term(string_parsed, term_result) == NE_ERROR) { ne_buffer_destroy(term_result); /*Free the buffer */ return NE_ERROR; /*parsing error */ } if (first_word_equal(*string_parsed, "or") == 1) { added_or = 1; ne_buffer_concat(result_buf, "" EOL, term_result->data, NULL); } else ne_buffer_zappend(result_buf, term_result->data); /*For or or ... */ while (first_word_equal(*string_parsed, "or") == 1) { read_aword(string_parsed, identifier); /*Read 'or' */ if (boolean_term(string_parsed, term_result) == NE_ERROR) { ne_buffer_destroy(term_result); /*Free the buffer */ return NE_ERROR; /*Parsing error */ } ne_buffer_zappend(result_buf, term_result->data); } /*End of while */ if (added_or == 1) ne_buffer_zappend(result_buf, "" EOL); ne_buffer_destroy(term_result); /*Free the buffer */ return NE_OK; /*success */ } /*End of search_condition */ /* * Parse a boolean term. * ::= | and * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * . * * Returns: * NE_OK: success * NE_ERROR: syntax error */ static int boolean_term(char **string_parsed, ne_buffer * result_buf) { char identifier[WORDLEN + 1] = ""; /*Indicates whether there is any 'and' in the boolean term. */ int added_and = 0; ne_buffer *factor_result; ne_buffer_clear(result_buf); factor_result = ne_buffer_create(); if (boolean_factor(string_parsed, factor_result) == NE_ERROR) { ne_buffer_destroy(factor_result); return NE_ERROR; /*parsing error */ } if (first_word_equal(*string_parsed, "and") == 1) { added_and = 1; ne_buffer_concat(result_buf, "" EOL, factor_result->data, NULL); } else ne_buffer_zappend(result_buf, factor_result->data); while (first_word_equal(*string_parsed, "and") == 1) { read_aword(string_parsed, identifier); /*Read 'and' */ if (boolean_factor(string_parsed, factor_result) == NE_ERROR) { ne_buffer_destroy(factor_result); return NE_ERROR; /*Parsing error */ } ne_buffer_zappend(result_buf, factor_result->data); } /*End of while */ if (added_and == 1) ne_buffer_zappend(result_buf, "" EOL); ne_buffer_destroy(factor_result); return NE_OK; /*success */ } /*End of boolean_term */ /* * Parse a boolean factor. * ::= [not] * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * . * * Returns: * NE_OK: success * NE_ERROR: syntax error */ static int boolean_factor(char **string_parsed, ne_buffer * result_buf) { char identifier[WORDLEN + 1] = ""; int added_not = 0; /*Indicates whether there is any 'not' in the search condition */ ne_buffer *boolean_primary_result; ne_buffer_clear(result_buf); boolean_primary_result = ne_buffer_create(); if (first_word_equal(*string_parsed, "not") == 1) { read_aword(string_parsed, identifier); /*Read "not" */ ne_buffer_zappend(result_buf, "" EOL); added_not = 1; } if (boolean_primary(string_parsed, boolean_primary_result) == NE_ERROR) { ne_buffer_destroy(boolean_primary_result); return NE_ERROR; /*parsing error */ } ne_buffer_zappend(result_buf, boolean_primary_result->data); if (added_not == 1) ne_buffer_zappend(result_buf, "" EOL); ne_buffer_destroy(boolean_primary_result); return NE_OK; /*success */ } /*End of boolean_factor */ /* * Parse a boolean primary. * ::= | "("")" * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * . * * Returns: * NE_OK: success * NE_ERROR: syntax error */ static int boolean_primary(char **string_parsed, ne_buffer * result_buf) { char identifier[WORDLEN + 1] = ""; ne_buffer *sub_result; ne_buffer_clear(result_buf); sub_result = ne_buffer_create(); if (first_word_equal(*string_parsed, "(") == 1) { /*It is the case of "("")" */ read_aword(string_parsed, identifier); /*Read "(" */ if (search_condition(string_parsed, sub_result) == NE_ERROR) { ne_buffer_destroy(sub_result); return NE_ERROR; /*Parsing error */ } /*Read and match ")" */ if (match_fetch(string_parsed, ")") == NE_ERROR) { ne_set_error(session.sess, "Syntax error: A ')' is expected in the search condition."); ne_buffer_destroy(sub_result); return NE_ERROR; /*parsing error */ } ne_buffer_zappend(result_buf, sub_result->data); } else { /*It is the case of */ if (predicate(string_parsed, sub_result) == NE_ERROR) { ne_buffer_destroy(sub_result); return NE_ERROR; /*parsing error */ } ne_buffer_zappend(result_buf, sub_result->data); } ne_buffer_destroy(sub_result); return NE_OK; /*success */ } /*End of boolean_primary */ /* * Translate comparison operator in the search condition to XML form. * Returns: * 1: if the operator is valid. * 0: if the operator is not valid. */ static int operator_translate(const char *operator, char *XML_operator) { int operator_valid = 1; XML_operator[0] = '\0'; if (strcmp(operator, "=") == 0) strcpy(XML_operator, "eq"); else if (strcmp(operator, ">=") == 0) strcpy(XML_operator, "gte"); else if (strcmp(operator, "<=") == 0) strcpy(XML_operator, "lte"); else if (strcmp(operator, ">") == 0) strcpy(XML_operator, "gt"); else if (strcmp(operator, "<") == 0) strcpy(XML_operator, "lt"); else if (strcmp(operator, "!=") == 0) strcpy(XML_operator, "not"); else if (strcmp(operator, "<>") == 0) strcpy(XML_operator, "not"); else if (strcmp(operator, "like") == 0) strcpy(XML_operator, "like"); else operator_valid = 0; /*Invalid operator */ return operator_valid; } /*End of operator_translate */ /* * Parse a predicate. * ::= | | * ::= ( | | ) * ::= like * ::= contains ( | ) * * ::= "=" | "<" | ">" | "<>" | "!=" | "<=" | ">=" * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * the predicate. * * Returns: * NE_OK: success * NE_ERROR: syntax error */ static int predicate(char **string_parsed, ne_buffer * result_buf) { char column_name[WORDLEN + 1] = ""; char operator[WORDLEN + 1] = ""; char XML_operator[WORDLEN + 1] = ""; ne_buffer *comparing_value; ne_buffer_clear(result_buf); if (first_word_equal(*string_parsed, "contains") == 1) { /* It is the case of */ ne_buffer *contains_result; contains_result = ne_buffer_create(); if (contains_predicate(string_parsed, contains_result) == NE_ERROR) { ne_buffer_destroy(contains_result); return NE_ERROR; /*Parsing error */ } ne_buffer_zappend(result_buf, contains_result->data); return NE_OK; } comparing_value = ne_buffer_create(); /*Read the column name */ if (read_aword(string_parsed, column_name) != IDEN) { ne_set_error(session.sess, "A column name is expected in the search condition."); ne_buffer_destroy(comparing_value); return NE_ERROR; /*Parsing error */ } /*Read the 'operator' */ read_aword(string_parsed, operator); /*Translate the operator to XML form */ if (operator_translate(operator, XML_operator) == 0) { ne_set_error(session.sess, "Syntax error: Invalid operator in the search condition."); ne_buffer_destroy(comparing_value); return NE_ERROR; } if (strcasecmp(operator, "like") == 0) { /*It is the case of like predicate and then parse the match string */ if (first_word_equal(*string_parsed, "'")) { /* For the case of a quoted string */ if (quoted_string(string_parsed, comparing_value) == NE_ERROR) { ne_buffer_destroy(comparing_value); return NE_ERROR; /*Parsing error */ } } else { /* For the case of word string. */ if (word_string(string_parsed, comparing_value) == NE_ERROR) { ne_set_error(session.sess, "Syntax error: A quoted string or a word string is expected in the search condition."); ne_buffer_destroy(comparing_value); return NE_ERROR; /*Parsing error */ } } } else { /* It is the case of comparison predicate and then * parse the comparison value */ if (comparison_value(string_parsed, comparing_value) == NE_ERROR) { ne_buffer_destroy(comparing_value); return NE_ERROR; /*parsing error */ } } ne_buffer_concat(result_buf, "" EOL "" EOL "", comparing_value->data, "" EOL "" EOL, NULL); ne_buffer_destroy(comparing_value); return NE_OK; /*success */ } /*End of predicate */ /* * Parse a contains predicate. * ::= contains * * The parsing result is saved into result_str. * '*string_parsed' is changed to the pointer pointing to the position after * the predicate. * * Returns: * 1: success * 0: syntax error */ int contains_predicate(char **string_parsed, ne_buffer * result_buf) { ne_buffer *contain_string; ne_buffer_clear(result_buf); contain_string = ne_buffer_create(); /*Read 'contains' */ if (match_fetch(string_parsed, "contains") == NE_ERROR) { /*The case of */ ne_set_error(session.sess, "Syntax error: A 'contains' is expected in the search condition."); ne_buffer_destroy(contain_string); return NE_ERROR; } /*Now parse the containing string */ if (first_word_equal(*string_parsed, "'") == 1) { /*For the case of */ if (quoted_string(string_parsed, contain_string) == NE_ERROR) { ne_buffer_destroy(contain_string); return NE_ERROR; /*Parsing error */ } } else { /* For the case of */ if (word_string(string_parsed, contain_string) == NE_ERROR) { ne_set_error(session.sess, "Syntax error: A quoted string or a word string is expected in the search condition."); ne_buffer_destroy(contain_string); return NE_ERROR; /*Parsing error */ } } ne_buffer_concat(result_buf, "" EOL, contain_string->data, "" EOL, NULL); return NE_OK; /*success */ } /*End of contains_predicate */ /* * Parse a quoted string. * ::= "'" {} "'" * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * the predicate. * * Returns: * 1: success * 0: syntax error */ static int quoted_string(char **string_parsed, ne_buffer * result_buf) { char previous_char; char current_char; char tmp_str[2] = ""; int i = 0; ne_buffer_clear(result_buf); /*Read a quotation mark */ if (match_fetch(string_parsed, "'") == NE_ERROR) { ne_set_error(session.sess, "Syntax error: A ' is expected in the search condition."); return NE_ERROR; /*Parsing error */ } /*To parse {"any_character"}. Considering '\'' case when parsing */ current_char = previous_char = (*string_parsed)[0]; while ( ((current_char != '\'') && (current_char != '\0')) || ((current_char == '\'') && (previous_char == '\\')) ) { tmp_str[0] = current_char; tmp_str[1] = '\0'; ne_buffer_zappend(result_buf, tmp_str); previous_char = current_char; i++; current_char = (*string_parsed)[i]; } if (current_char != '\'') { /*There should be a ending ' */ ne_set_error(session.sess, "An ending ' is expected in the search condition."); return NE_ERROR; /*parsing error */ } *string_parsed = *string_parsed + i + 1; /*1 for ending ' */ return NE_OK; /*success */ } /*End of auoted_string */ /* * Parse a word string. * ::= {} * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * the predicate. * * Returns: * 1: success * 0: syntax error */ static int word_string(char **string_parsed, ne_buffer * result_buf) { char previous_char; char current_char; char tmp_str[2] = ""; int i = 0; ne_buffer_clear(result_buf); /*Find the left bound of a word */ while (isspace((*string_parsed)[i])) i++; if ((*string_parsed)[i] == '\0' || (*string_parsed)[i] == ')') /* Empty string */ return NE_ERROR; current_char = previous_char = (*string_parsed)[i]; while ((current_char != ' ') && (current_char != '\t') && (current_char != ')') && (current_char != '\0')) { tmp_str[0] = current_char; tmp_str[1] = '\0'; ne_buffer_zappend(result_buf, tmp_str); previous_char = current_char; i++; current_char = (*string_parsed)[i]; } *string_parsed = *string_parsed + i; return NE_OK; /*success */ } /*End of auoted_string */ /* * Parse a comparison_value. * * ::= | | * * The parsing result is saved into result_buf. * '*string_parsed' is changed to the pointer pointing to the position after * the predicate. * * Returns: * NE_OK: success * NE_ERROR: syntax error */ static int comparison_value(char **string_parsed, ne_buffer * result_buf) { char identifier[WORDLEN + 1] = ""; ne_buffer *comparing_value; ne_buffer_clear(result_buf); comparing_value = ne_buffer_create(); if (first_word_equal(*string_parsed, "'") == 1) { /*It is the case of quoted string */ if (quoted_string(string_parsed, comparing_value) == NE_ERROR) { ne_buffer_destroy(comparing_value); return NE_ERROR; /*Parsing error */ } ne_buffer_zappend(result_buf, comparing_value->data); } else { /* It is the case of or */ /*An integer or a word string is expected */ if (first_word_integer(*string_parsed) == 1) { read_aword(string_parsed, identifier); ne_buffer_zappend(result_buf, identifier); } else { /* It is the case of a word string */ if (word_string(string_parsed, comparing_value) == NE_ERROR) { ne_set_error(session.sess, "Syntax error: An integer, quoted string or word string is expected in the search condition."); ne_buffer_destroy(comparing_value); return NE_ERROR; } } ne_buffer_zappend(result_buf, comparing_value->data); } ne_buffer_destroy(comparing_value); return NE_OK; /*success */ } /*End of comparison_value */ cadaver-0.23.3/src/commands.c0000664000076400007640000011371011106242426015363 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2007, Joe Orton , except where otherwise indicated. 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Some UI guidelines: * 1. Use dispatch, or out_* to do UI. This makes it CONSISTENT. * 2. Get some feedback on the screen before making any requests * to the server. Tell them what is going on: remember, on a slow * link or a loaded server,5~ a request can take AGES to return. */ #include "config.h" #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #include /* readline requires FILE *, silly thing */ #include #ifdef HAVE_READLINE_H #include #elif HAVE_READLINE_READLINE_H #include #endif #ifdef NEED_SNPRINTF_H #include "snprintf.h" #endif #include #include #include /* for http_forget_auth */ #include #include #include #include #include #include #include #include "i18n.h" #include "basename.h" #include "dirname.h" #include "cadaver.h" #include "commands.h" #include "options.h" #include "utils.h" /* Local variables */ int child_running; /* true when we have a child running */ /* Command alias mappings */ const static struct { enum command_id id; const char *name; } command_names[] = { /* The direct mappings */ #define C(n) { cmd_##n, #n } C(ls), C(cd), C(quit), C(open), C(logout), C(close), C(set), C(unset), C(pwd), C(help), C(put), C(get), C(mkcol), C(delete), C(move), C(copy), C(less), C(cat), C(lpwd), C(lcd), C(lls), C(echo), C(quit), C(about), C(mget), C(mput), C(rmcol), C(lock), C(unlock), C(discover), C(steal), C(chexec), C(showlocks), C(version), C(propget), C(propset), C(propdel), C(describe), C(search), C(version), C(checkin), C(checkout), C(uncheckout), C(history), C(label), #if 0 C(propedit), #endif C(propnames), C(edit), #undef C /* And now the real aliases */ { cmd_less, "more" }, { cmd_mkcol, "mkdir" }, { cmd_delete, "rm" }, { cmd_copy, "cp"}, { cmd_move, "mv" }, { cmd_help, "h" }, { cmd_help, "?" }, { cmd_quit, "exit" }, { cmd_quit, "bye" }, { cmd_unknown, NULL } }; extern const struct command commands[]; /* prototype */ /* Tell them we are doing 'VERB' to 'NOUN'. * (really 'METHOD' to 'RESOURCE' but hey.) */ void out_start(const char *verb, const char *noun) { output(o_start, "%s `%s':", verb, noun); } void out_success(void) { output(o_finish, _("succeeded.\n")); } void out_result(int ret) { switch (ret) { case NE_OK: out_success(); break; case NE_AUTH: case NE_PROXYAUTH: output(o_finish, _("authentication failed.\n")); break; case NE_CONNECT: output(o_finish, _("could not connect to server.\n")); break; case NE_TIMEOUT: output(o_finish, _("connection timed out.\n")); break; default: if (ret == NE_REDIRECT) { const ne_uri *dest = ne_redirect_location(session.sess); if (dest) { char *uri = ne_uri_unparse(dest); output(o_finish, _("redirect to %s\n"), uri); ne_free(uri); break; } } output(o_finish, _("failed:\n%s\n"), ne_get_error(session.sess)); break; } } int out_handle(int ret) { out_result(ret); return (ret == NE_OK); } /* The actual commands */ #ifdef HAVE_LIBREADLINE /* Command name generator for readline. * Copied almost verbatim from the info doc */ char *command_generator(const char *text, int state) { static int i, len; const char *name; if (!state) { i = 0; len = strlen(text); } while ((name = command_names[i].name) != NULL) { i++; if (strncmp(name, text, len) == 0) { return ne_strdup(name); } } return NULL; } #endif static void execute_logout(void) { ne_forget_auth(session.sess); } const struct command *get_command(const char *name) { int n, m; for(n = 0; command_names[n].name != NULL; n++) { if (strcasecmp(command_names[n].name, name) == 0) { for(m = 0; commands[m].id != cmd_unknown; m++) { if (commands[m].id == command_names[n].id) return &commands[m]; } return NULL; } } return NULL; } static void dispatch(const char *verb, const char *filename, int (*func)(ne_session *, const char *), const char *arg) { out_start(verb, filename); out_result((*func)(session.sess, arg)); } char *getowner(void) { char *ret, *owner = get_option(opt_lockowner); if (owner) { ret = ne_concat("", owner, "", NULL); return ret; } else { return NULL; } } /* FIXME: joe: these are really wrong and result from my lack of * understanding of character set issues. I think this needs iconv(), * but iconv isn't really portable, so what's the fallback for * platforms without iconv? Reject any non-ASCII input? And even if * iconv is present, how is the input charset encoding determined? */ static char *cad_utf8_encode(const char *str) { char *buffer = ne_malloc(strlen(str) * 2 + 1); int in, len = strlen(str); char *out; for (in = 0, out = buffer; in < len; in++, out++) { if ((unsigned char)str[in] <= 0x7D) { *out = str[in]; } else { *out++ = 0xC0 | ((str[in] & 0xFC) >> 6); *out = str[in] & 0xBF; } } /* nul-terminate */ *out = '\0'; return buffer; } /* Single byte range 0x00 -> 0x7F */ #define SINGLEBYTE_UTF8(ch) (((unsigned char) (ch)) < 0x80) static char *cad_utf8_decode(const char *str) { int n, m, len = strlen(str); char *dest = ne_malloc(len + 1); for (n = 0, m = 0; n < len; n++, m++) { if (SINGLEBYTE_UTF8(str[n])) { dest[m] = str[n]; } else { /* This just deals with 8-bit data, which will be encoded * as two bytes of UTF-8 */ if ((len - n < 2) || (str[n] & 0xFC) != 0xC0) { free(dest); return NULL; } else { dest[m] = ((str[n] & 0x03) << 6) | (str[n+1] & 0x3F); n++; } } } dest[m] = '\0'; return dest; } /* If in UTF-8 mode, simply duplicates 'str'. When not in UTF-8 mode, * presume 'str' is ISO-8859-1, and UTF-8 encode it. */ static char *utf8_encode(const char *str) { if (get_bool_option(opt_utf8)) { return ne_strdup(str); } else { return cad_utf8_encode(str); } } /* If in UTF-8 mode, simply duplicates 'str'. * When not in UTF-8 mode, does a UTF-8 decode on 'str', * or at least, the least significant 8-bits of the Unicode * characters in 'str'. Returns NULL if 'str' contains * >8-bit characters. * * TODO: yes, is this sensible? embedded NUL's? */ static char *utf8_decode(const char *str) { /* decoded version can be at most as long as encoded version. */ if (get_bool_option(opt_utf8)) { return ne_strdup(str); } else { return cad_utf8_decode(str); } } /* Resolve path, appending trailing slash if resource is a * collection. */ static char *true_path(const char *res) { char *full; full = resolve_path(session.uri.path, res, false); if (getrestype(full) == resr_collection) { if (!ne_path_has_trailing_slash(full)) { char *tmp = ne_concat(full, "/", NULL); free(full); full = tmp; } } return full; } static const char *get_lockscope(enum ne_lock_scope s) { switch (s) { case ne_lockscope_exclusive: return _("exclusive"); case ne_lockscope_shared: return _("shared"); default: return _("unknown"); } } static const char *get_locktype(enum ne_lock_type t) { if (t == ne_locktype_write) { return _("write"); } else { return _("unknown"); } } static const char *get_timeout(long t) { static char buf[128]; switch (t) { case NE_TIMEOUT_INFINITE: return _("infinite"); case NE_TIMEOUT_INVALID: return _("invalid"); default: sprintf(buf, _("%ld seconds"), t); return buf; } } static const char *get_depth(int d) { switch (d) { case NE_DEPTH_INFINITE: return _("infinity"); case 0: /* TODO: errr... do I need to i18n'ize numeric strings??? */ return "0"; case 1: return "1"; default: return _("invalid"); } } static void print_uri(const ne_uri *uri) { char *str = ne_uri_unparse(uri); printf("%s", str); free(str); } static void print_lock(const struct ne_lock *lock) { char *uri = ne_uri_unparse(&lock->uri); printf(_("Lock token <%s>:\n" " Depth %s on `%s'\n" " Scope: %s Type: %s Timeout: %s\n" " Owner: %s\n"), lock->token, get_depth(lock->depth), uri, get_lockscope(lock->scope), get_locktype(lock->type), get_timeout(lock->timeout), lock->owner?lock->owner:_("(none)")); free(uri); } static void discover_result(void *userdata, const struct ne_lock *lock, const ne_uri *uri, const ne_status *status) { int *count = userdata; if (lock) { if (*count == 0) { printf("\n"); } print_lock(lock); *count += 1; } else { printf(_("Failed on %s: %d %s\n"), uri->path, status->code, status->reason_phrase); } } static void steal_result(void *userdata, const struct ne_lock *lock, const ne_uri *uri, const ne_status *status) { int *count = userdata; if (lock != NULL) { if (*count == 0) { printf("\n"); } print_uri(&lock->uri); printf(": <%s>\n", lock->token); ne_lockstore_add(session.locks, ne_lock_copy(lock)); *count += 1; } else { printf(_("Failed on %s: %d %s\n"), uri->path, status->code, status->reason_phrase); } } static void do_discover(const char *res, const char *mesg, ne_lock_result result_cb) { char *real_remote; int ret, count = 0; real_remote = resolve_path(session.uri.path, res, false); out_start(mesg, res); ret = ne_lock_discover(session.sess, real_remote, result_cb, &count); switch (ret) { case NE_OK: if (count == 0) { printf(" no locks found.\n"); } break; default: out_result(ret); break; } free(real_remote); } static void execute_discover(const char *res) { do_discover(res, _("Discovering locks on"), discover_result); } static void execute_steal(const char *res) { do_discover(res, _("Stealing locks on"), steal_result); } static void execute_showlocks(void) { int count = 0; struct ne_lock *lk; for (lk = ne_lockstore_first(session.locks); lk != NULL; lk = ne_lockstore_next(session.locks), count++) { print_lock(lk); } if (count == 0) { printf(_("No owned locks.\n")); } } static void execute_lock(const char *res) { char *real_remote; struct ne_lock *lock; enum resource_type rtype; real_remote = resolve_path(session.uri.path, res, false); rtype = getrestype(real_remote); if (rtype == resr_collection) { if (!ne_path_has_trailing_slash(real_remote)) { char *tmp = ne_concat(real_remote, "/", NULL); free(real_remote); real_remote = tmp; } out_start(_("Locking collection"), res); } else { out_start(_("Locking"), res); } lock = ne_lock_create(); lock->scope = lockscope; lock->owner = getowner(); if (rtype == resr_normal) { /* for non-cols, only zero makes sense */ lock->depth = NE_DEPTH_ZERO; } else { /* use value of lockdepth option. */ lock->depth = lockdepth; } ne_fill_server_uri(session.sess, &lock->uri); lock->uri.path = ne_strdup(real_remote); if (out_handle(ne_lock(session.sess, lock))) { /* success: remember the lock. */ ne_lockstore_add(session.locks, lock); } else { /* otherwise, throw it away */ ne_lock_destroy(lock); } free(real_remote); } static void execute_unlock(const char *res) { struct ne_lock *lock; ne_uri uri; uri = session.uri; /* shallow copy */ uri.path = true_path(res); out_start(_("Unlocking"), res); lock = ne_lockstore_findbyuri(session.locks, &uri); if (!lock) { lock = ne_lock_create(); lock->token = readline(_("Enter locktoken: ")); if (!lock->token || strlen(lock->token) == 0) { goto unlock_fail; } ne_fill_server_uri(session.sess, &lock->uri); lock->uri.path = ne_strdup(uri.path); } else { /* remove the lock from the lockstore */ ne_lockstore_remove(session.locks, lock); } out_result(ne_unlock(session.sess, lock)); unlock_fail: ne_free(uri.path); ne_lock_destroy(lock); } static void execute_mkcol(const char *name) { char *uri = resolve_path(session.uri.path, name, true); dispatch(_("Creating"), name, ne_mkcol, uri); free(uri); } static int all_iterator(void *userdata, const ne_propname *pname, const char *value, const ne_status *status) { char *dnspace = utf8_decode(pname->nspace); char *dname = utf8_decode(pname->name); if (value != NULL) { char *dval = utf8_decode(value); printf("%s %s = %s\n", dnspace, dname, dval); free(dval); } else if (status != NULL) { printf(_("%s %s failed: %s\n"), dnspace, dname, status->reason_phrase); } free(dnspace); free(dname); return 0; } static void pget_results(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) { ne_propname *pname = userdata; const char *value; char *dname; printf("\n"); if (userdata == NULL) { /* allprop */ ne_propset_iterate(set, all_iterator, NULL); return; } dname = utf8_decode(pname->name); value = ne_propset_value(set, pname); if (value != NULL) { char *dval = utf8_decode(value); printf(_("Value of %s is: %s\n"), dname, dval); free(dval); } else { const ne_status *status = ne_propset_status(set, pname); if (status) { printf(_("Could not fetch property: %d %s\n"), status->code, status->reason_phrase); } else { printf(_("Server did not return result for %s\n"), dname); } } free(dname); } /* Change property 'name' on 'uri': if value is non-NULL, set property * to have new value, else delete it. */ static void propop(const char *descr, const char *res, const char *name, const char *value) { ne_proppatch_operation ops[2]; ne_propname pname; char *uri = resolve_path(session.uri.path, res, false); char *val = NULL /* quieten gcc */, *encname = utf8_encode(name); ops[0].name = &pname; if (value) { ops[0].type = ne_propset; ops[0].value = val = utf8_encode(value); } else { ops[0].type = ne_propremove; } ops[1].name = NULL; pname.nspace = (const char *)get_option(opt_namespace); pname.name = encname; out_start(descr, res); out_handle(ne_proppatch(session.sess, uri, ops)); if (value) free(val); free(encname); free(uri); } static void execute_propset(const char *res, const char *name, const char *value) { propop(_("Setting property on"), res, name, value); } static void execute_propdel(const char *res, const char *name) { propop(_("Deleting property on"), res, name, NULL); } static void execute_propget(const char *res, const char *name) { ne_propname pnames[2] = {{NULL}, {NULL}}; char *remote = resolve_path(session.uri.path, res, false), *encname = NULL; ne_propname *props; int ret; if (name == NULL) { props = NULL; } else { pnames[0].nspace = (const char *)get_option(opt_namespace); pnames[0].name = encname = utf8_encode(name); props = pnames; } out_start(_("Fetching properties for"), res); ret = ne_simple_propfind(session.sess, remote, NE_DEPTH_ZERO, props, pget_results, props); if (ret != NE_OK) { out_result(ret); } if (encname) { free(encname); } free(remote); } static int propname_iterator(void *userdata, const ne_propname *pname, const char *value, const ne_status *st) { printf(" %s %s\n", pname->nspace, pname->name); return 0; } static void propname_results(void *userdata, const ne_uri *uri, const ne_prop_result_set *pset) { ne_propset_iterate(pset, propname_iterator, NULL); } static void execute_propnames(const char *res) { char *remote; remote = resolve_path(session.uri.path, res, false); out_start(_("Fetching property names"), res); if (out_handle(ne_propnames(session.sess, remote, NE_DEPTH_ZERO, propname_results, NULL))) { } free(remote); } static void remove_locks(const char *p, int depth) { struct ne_lock *lk; ne_uri sought; memset(&sought, 0, sizeof(sought)); ne_fill_server_uri(session.sess, &sought); sought.path = ne_strdup(p); do { lk = ne_lockstore_findbyuri(session.locks, &sought); if (lk) { ne_lockstore_remove(session.locks, lk); } } while (lk); ne_uri_free(&sought); } static void execute_delete(const char *filename) { char *remote = resolve_path(session.uri.path, filename, false); out_start(_("Deleting"), filename); if (getrestype(remote) == resr_collection) { output(o_finish, _("is a collection resource.\n" "The `rm' command cannot be used to delete a collection.\n" "Use `rmcol %s' to delete this collection and ALL its contents.\n"), filename); } else { if (out_handle(ne_delete(session.sess, remote))) { remove_locks(remote, 0); } } free(remote); } static void execute_rmcol(const char *filename) { char *remote; remote = resolve_path(session.uri.path, filename, true); out_start(_("Deleting collection"), filename); if (getrestype(remote) != resr_collection) { output(o_finish, _("is not a collection.\n" "The `rmcol' command can only be used to delete collections.\n" "Use `rm %s' to delete this resource.\n"), filename); } else { out_result(ne_delete(session.sess, remote)); } remove_locks(remote, NE_DEPTH_INFINITE); free(remote); } /* TODO: can do utf-8 handling here. */ static char *escape_path(const char *p) { return ne_path_escape(p); } /* Like resolve_path except more intelligent. */ static char *clever_path(const char *p, const char *src, const char *dest) { char *ret; int src_is_coll, dest_is_coll; dest_is_coll = (dest[strlen(dest)-1] == '/'); src_is_coll = (src[strlen(src)-1] == '/'); if (strcmp(dest, ".") == 0) { ret = resolve_path(p, base_name(src), false); } else if (strcmp(dest, "..") == 0) { char *parent; parent = ne_path_parent(p); ret = resolve_path(parent, base_name(src), false); free(parent); } else if (!src_is_coll && dest_is_coll) { /* Moving a file to a collection... the destination should * be the basename of file concated with the collection. */ char *tmp = resolve_path(p, dest, true); char *enc = escape_path(base_name(src)); ret = ne_concat(tmp, enc, NULL); free(enc); free(tmp); } else { ret = resolve_path(p, dest, false); } return ret; } static const char *choose_pager(void) { struct stat st; char *tmp; tmp = get_option(opt_pager); if (tmp != NULL) return tmp; /* TODO: add an autoconf for less/more? */ tmp = getenv("PAGER"); if (tmp != NULL) { return tmp; } else if (stat("/usr/bin/less", &st) == 0) { return "/usr/bin/less"; } else if (stat("/bin/less", &st) == 0) { return "/bin/less"; } else { return "/bin/more"; } } static FILE *spawn_pager(const char *pager) { /* Create a pipe */ return popen(pager, "w"); } static void kill_pager(FILE *p) { /* This blocks until the pager quits. */ pclose(p); } static void execute_less(const char *resource) { char *real_res; const char *pager; FILE *p; real_res = resolve_path(session.uri.path, resource, false); pager = choose_pager(); printf(_("Displaying `%s':\n"), real_res); p = spawn_pager(pager); if (p == NULL) { printf(_("Error! Could not spawn pager `%s':\n%s\n"), pager, strerror(errno)); } else { int fd = fileno(p); child_running = true; ne_get(session.sess, real_res, fd); kill_pager(p); /* Blocks until the pager quits */ child_running = false; } } static void execute_cat(const char *resource) { char *real_res = resolve_path(session.uri.path, resource, false); printf(_("Displaying `%s':\n"), real_res); if (ne_get(session.sess, real_res, STDOUT_FILENO) != NE_OK) { printf(_("Failed: %s\n"), ne_get_error(session.sess)); } } static void do_copymove(int argc, const char *argv[], const char *v1, const char *v2, void (*cb)(const char *, const char *)) { /* We are guaranteed that argc > 2... */ char *dest; dest = resolve_path(session.uri.path, argv[argc-1], true); if (getrestype(dest) == resr_collection) { int n; char *real_src, *real_dest; for(n = 0; n < argc-1; n++) { real_src = resolve_path(session.uri.path, argv[n], false); real_dest = clever_path(session.uri.path, argv[n], dest); if (strcmp(real_src, real_dest) == 0) { printf(_("%s: %s and %s are the same resource.\n"), v2, real_src, real_dest); } else { (*cb)(real_src, real_dest); } free(real_src); free(real_dest); } } else if (argc > 2) { printf(_("When %s multiple resources, the last " "argument must be a collection.\n"), v1); } else { char *rsrc, *rdest; rsrc = resolve_path(session.uri.path, argv[0], false); rdest = resolve_path(session.uri.path, argv[1], false); /* Simple */ (*cb) (rsrc, rdest); free(rsrc); free(rdest); } free(dest); } static void simple_move(const char *src, const char *dest) { output(o_start, _("Moving `%s' to `%s': "), src, dest); out_result(ne_move(session.sess, get_bool_option(opt_overwrite), src, dest)); } static void simple_copy(const char *src, const char *dest) { output(o_start, _("Copying `%s' to `%s': "), src, dest); out_result(ne_copy(session.sess, get_bool_option(opt_overwrite), NE_DEPTH_INFINITE, src, dest)); } /* Return full path of 'filename', relative to 'p'. 'p' must be * already URI-escaped; 'filename' must not be. If 'iscoll' is * non-zero, the returned path will have a trailing slash. */ char *resolve_path(const char *p, const char *filename, int iscoll) { char *ret, *pnt; if (*filename == '/') { /* It's absolute */ ret = escape_path(filename); } else if (strcmp(filename, ".") == 0) { ret = ne_strdup(p); } else { pnt = escape_path(filename); ret = ne_concat(p, pnt, NULL); free(pnt); } if (iscoll && ret[strlen(ret)-1] != '/') { char *newret = ne_concat(ret, "/", NULL); free(ret); ret = newret; } /* Sort out '..', etc... */ do { pnt = strstr(ret, "/../"); if (pnt != NULL) { char *last; /* Find the *previous* path segment, to overwrite... * /foo/../ * ^- last points here */ if (pnt > ret) { for(last = pnt-1; (last > ret) && (*last != '/'); last--); } else { last = ret; } memmove(last, pnt + 3, strlen(pnt+2)); } else { pnt = strstr(ret, "/./"); if (pnt != NULL) { memmove(pnt, pnt+2, strlen(pnt+1)); } } } while (pnt != NULL); return ret; } static void execute_get(const char *remote, const char *local) { char *filename, *real_remote; real_remote = resolve_path(session.uri.path, remote, false); if (local == NULL) { struct stat st; /* Choose an appropriate local filename */ if (stat(base_name(remote), &st) == 0) { char buf[BUFSIZ]; /* File already exists... don't overwrite */ snprintf(buf, BUFSIZ, _("Enter local filename for `%s': "), real_remote); filename = readline(buf); if (filename == NULL) { free(real_remote); printf(_("cancelled.\n")); return; } } else { filename = ne_strdup(base_name(remote)); } } else { filename = ne_strdup(local); } { int fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC|OPEN_BINARY_FLAGS|O_LARGEFILE, 0644); output(o_download, _("Downloading `%s' to %s:"), real_remote, filename); if (fd < 0) { output(o_finish, _("failed:\n%s\n"), strerror(errno)); } else { int ret = ne_get(session.sess, real_remote, fd); if (close(fd) && ret == NE_OK) { int errnum = errno; ret = NE_ERROR; ne_set_error(session.sess, _("Could not write to file: %s"), strerror(errnum)); } out_result(ret); } } free(real_remote); free(filename); } static void simple_put(const char *local, const char *remote) { int fd = open(local, O_RDONLY | OPEN_BINARY_FLAGS | O_LARGEFILE); output(o_upload, _("Uploading %s to `%s':"), local, remote); if (fd < 0) { output(o_finish, _("Could not open file: %s\n"), strerror(errno)); } else { out_result(ne_put(session.sess, remote, fd)); (void) close(fd); } } static void execute_put(const char *local, const char *remote) { char *real_remote; if (remote == NULL) { real_remote = resolve_path(session.uri.path, base_name(local), false); } else { real_remote = resolve_path(session.uri.path, remote, false); } simple_put(local, real_remote); free(real_remote); } /* A bit like Haskell's map function... applies func to each * of the first argc items in argv */ static void map_multi(void (*func)(const char *), int argc, const char *argv[]) { int n; for(n = 0; n < argc; n++) { (*func)(argv[n]); } } static void multi_copy(int argc, const char *argv[]) { do_copymove(argc, argv, _("copying"), _("copy"), simple_copy); } static void multi_move(int argc, const char *argv[]) { do_copymove(argc, argv, _("moving"), _("move"), simple_move); } static void multi_mkcol(int argc, const char *argv[]) { map_multi(execute_mkcol, argc, argv); } static void multi_delete(int argc, const char *argv[]) { map_multi(execute_delete, argc, argv); } static void multi_rmcol(int argc, const char *argv[]) { map_multi(execute_rmcol, argc, argv); } static void multi_less(int argc, const char *argv[]) { map_multi(execute_less, argc, argv); } static void multi_cat(int argc, const char *argv[]) { map_multi(execute_cat, argc, argv); } /* this is getting too easy */ static void multi_mput(int argc, const char *argv[]) { for(; argv[0] != NULL; argv++) { char *remote = resolve_path(session.uri.path, argv[0], false); simple_put(argv[0], remote); free(remote); } } static void multi_mget(int argc, const char *argv[]) { for(; argv[0] != NULL; argv++) { execute_get(argv[0], NULL); } } static void execute_chexec(const char *val, const char *remote) { static const ne_propname execprop = { "http://apache.org/dav/props/", "executable" }; /* Use a single operation; set the executable property to... */ ne_proppatch_operation ops[] = { { &execprop, ne_propset, NULL }, { NULL } }; char *uri; ne_server_capabilities caps = {0}; int ret; /* True or false, depending... */ if (strcmp(val, "+") == 0) { ops[0].value = "T"; } else if (strcmp(val, "-") == 0) { ops[0].value = "F"; } else { printf(_("Use:\n" " chexec + %s to make the resource executable\n" "or chexec - %s to make the resource unexecutable\n"), remote, remote); return; } uri = resolve_path(session.uri.path, remote, false); out_start(_("Setting isexecutable"), remote); ret = ne_options(session.sess, uri, &caps); if (ret != NE_OK) { out_result(ret); } else if (!caps.dav_executable) { ne_set_error(session.sess, _("The server does not support the 'isexecutable' property.")); out_result(NE_ERROR); } else { out_result(ne_proppatch(session.sess, uri, ops)); } free(uri); } static void execute_lpwd(void) { char pwd[BUFSIZ]; if (getcwd(pwd, BUFSIZ) == NULL) { perror("pwd"); } else { printf(_("Local directory: %s\n"), pwd); } } /* Using a hack, we get zero-effort multiple-argument 'lls' */ static void execute_lls(int argc, const char **argv) { /* nasty cast; but these describe the same array of pointers, just * with different constness, so it should be okay. */ char *const *vpargs = (char *const *)argv; int pid; pid = fork(); switch (pid) { case 0: /* child... */ execvp("ls", &vpargs[-1]); printf(_("Error executing ls: %s\n"), strerror(errno)); exit(-1); break; case -1: /* Error */ printf(_("Error forking ls: %s\n"), strerror(errno)); break; default: /* Parent */ wait(NULL); break; } return; } static void execute_lcd(const char *p) { const char *real_path; if (p) { real_path = p; } else { real_path = getenv("HOME"); if (!real_path) { printf(_("Could not determine home directory from environment.\n")); return; } } if (chdir(real_path)) { printf(_("Could not change local directory:\nchdir: %s\n"), strerror(errno)); } } static void execute_pwd(void) { char *uri = ne_uri_unparse(&session.uri); printf(_("Current collection is `%s'.\n"), uri); ne_free(uri); } static void execute_cd(const char *newpath) { char *real_path; int is_swap = false; if (strcmp(newpath, "-") == 0) { if (!session.lastwp) { printf(_("No previous collection.\n")); return; } is_swap = true; real_path = session.lastwp; } else { real_path = resolve_path(session.uri.path, newpath, true); } if (set_path(real_path)) { /* Error */ if (!is_swap) free(real_path); } else { /* Success */ if (!is_swap && session.lastwp) { ne_free(session.lastwp); } session.lastwp = session.uri.path; session.uri.path = real_path; } } static void display_help_message(void) { unsigned int n, pos = 0; printf("Available commands: \n "); for (n = 0; commands[n].id != cmd_unknown; n++, pos=(pos+1)%7) { printf("%-11s", commands[n].name); if (pos == 6) printf("\n "); #if 0 if (commands[n].call && commands[n].short_help) { printf(" %-26s %s\n", commands[n].call, _(commands[n].short_help)); } #endif } if (pos == 6) putchar('\r'); else putchar('\n'); printf(_("Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, " "more=less, quit=exit=bye\n")); } static void execute_help(const char *arg) { if (!arg) { display_help_message(); } else { const struct command *cmd = get_command(arg); if (cmd) { printf(_(" `%s' %s\n"), cmd->call, _(cmd->short_help)); if (cmd->needs_connection) { printf(_("This command can only be used when connected to a server.\n")); } } else { printf(_("Command name not known: %s\n"), arg); } } } static void execute_echo(int count, const char **args) { const char **pnt; for(pnt = args; *pnt != NULL; pnt++) { printf("%s ", *pnt); } putchar('\n'); } void execute_about(void) { printf("cadaver " PACKAGE_VERSION "\n%s\n", ne_version_string()); #ifdef HAVE_LIBREADLINE printf("readline %s\n", rl_library_version); #endif } /* The T? macros are used to cast the function pointer into the * command structure. Using GCC extensions this is done in a * type-safe way; for non-GCC< it's type-unsafe. */ #if defined(__GNUC__) #define T0(x) {take0: x} #define T1(x) {take1: x} #define T2(x) {take2: x} #define T3(x) {take3: x} #define TV(x) {takeV: x} #else /* cast to be like first member of union. */ #define Tn(x) { ((void (*)(void)) x) } #define T0(x) Tn(x) #define T1(x) Tn(x) #define T2(x) Tn(x) #define T3(x) Tn(x) #define TV(x) Tn(x) #endif /* C1: connected, 1-arg function C2: connected, 2-arg function * U0: disconnected, 0-arg function. */ #define C1(x,c,h) { cmd_##x, #x, true, 1, 1, parmscope_remote, T1(execute_##x),c,h } #define U0(x,h) { cmd_##x, #x, false, 0, 0, parmscope_none, T0(execute_##x),#x,h } #define UO1(x,c,h) { cmd_##x, #x, false, 0, 1, parmscope_none, T1(execute_##x),c,h } #define C2M(x,c,h) { cmd_##x, #x, true, 2, CMD_VARY, parmscope_remote, TV(multi_##x),c,h } #define C1M(x,c,h) { cmd_##x, #x, true, 1, CMD_VARY, parmscope_remote, TV(multi_##x),c,h } /* commands[] is not static because it would mean adding a bunch of * prototypes for execute_* etc, and declaring this at the top of the * file. */ /* Separate structures for commands and command names. */ /* DON'T FORGET TO ADD A NEW COMMAND ALIAS WHEN YOU ADD A NEW COMMAND */ const struct command commands[] = { { cmd_ls, "ls", true, 0, 1, parmscope_remote, T1(execute_ls), N_("ls [path]"), N_("List contents of current [or other] collection") }, C1(cd, N_("cd path"), N_("Change to specified collection")), { cmd_pwd, "pwd", true, 0, 0, parmscope_none, T0(execute_pwd), "pwd", N_("Display name of current collection") }, { cmd_put, "put", true, 1, 2, parmscope_none, T2(execute_put), N_("put local [remote]"), N_("Upload local file") }, { cmd_get, "get", true, 1, 2, parmscope_none, T2(execute_get), N_("get remote [local]"), N_("Download remote resource") }, C1M(mget, N_("mget remote..."), N_("Download many remote resources")), { cmd_mput, "mput", true, 1, CMD_VARY, parmscope_local, TV(multi_mput), N_("mput local..."), N_("Upload many local files") }, C1(edit, N_("edit resource"), N_("Edit given resource")), C1M(less, N_("less remote..."), N_("Display remote resource through pager")), C1M(mkcol, N_("mkcol remote..."), N_("Create remote collection(s)")), C1M(cat, N_("cat remote..."), N_("Display remote resource(s)")), C1M(delete, N_("delete remote..."), N_("Delete non-collection resource(s)")), C1M(rmcol, N_("rmcol remote..."), N_("Delete remote collections and ALL contents")), C2M(copy, N_("copy source... dest"), N_("Copy resource(s) from source to dest")), C2M(move, N_("move source... dest"), N_("Move resource(s) from source to dest")), /* DON'T FORGET TO ADD A NEW COMMAND ALIAS WHEN YOU ADD A NEW COMMAND */ /*** Locking commands ***/ C1(lock, N_("lock resource"), N_("Lock given resource")), C1(unlock, N_("unlock resource"), N_("Unlock given resource")), C1(discover, N_("discover resource"), N_("Display lock information for resource")), C1(steal, N_("steal resource"), N_("Steal lock token for resource")), { cmd_showlocks, "showlocks", true, 0, 0, parmscope_none, T0(execute_showlocks), "showlocks", N_("Display list of owned locks") }, /*** DeltaV commands ***/ C1(version, N_("verrsion resource"), N_("Place given resource under version control")), C1(checkin, N_("checkin resource"), N_("Checkin given resource")), C1(checkout, N_("checkout resource"), N_("Checkout given resource")), C1(uncheckout, N_("uncheckin resource"), N_("Uncheckout given resource")), C1(history, N_("history resource"), N_("Show version history of resource")), { cmd_label, "label", true, 3, 3, parmscope_none, T3(execute_label), N_("label res [add|set|remove] labelname"), N_("Set/Del/Edit label on resource") }, /*** Property handling ***/ C1(propnames, "propnames res", N_("Names of properties defined on resource")) , { cmd_chexec, "chexec", true, 2, 2, parmscope_none, T2(execute_chexec), N_("chexec [+|-] remote"), N_("Change isexecutable property of resource") }, { cmd_propget, "propget", true, 1, 2, parmscope_none, T2(execute_propget), N_("propget res [propname]"), N_("Retrieve properties of resource") }, { cmd_propdel, "propdel", true, 2, 2, parmscope_none, T2(execute_propdel), N_("propdel res propname"), N_("Delete property from resource") }, { cmd_propset, "propset", true, 3, 3, parmscope_none, T3(execute_propset), N_("propset res propname value"), N_("Set property on resource") }, { cmd_search, "search", true, 1, CMD_VARY, parmscope_remote, TV(execute_search), N_("search query"), N_("DASL Search resource in current collection\n\n" " Examples:\n" " - search where content length is smaller than 100:\n" " > search getcontentlength < 100\n" " - search where author is Smith or Jones\n" " > search author = Smith or author = Jones\n" " Available operators and keywords:\n" " - and, or , (, ), =, <, >, <=, >=, like\n" " (See also variables searchdepth, searchorder, searchdorder)\n") }, { cmd_set, "set", false, 0, 2, parmscope_none, T2(execute_set), N_("set [option] [value]"), N_("Set an option, or display options") }, { cmd_open, "open", false, 1, 1, parmscope_none, T1(open_connection), "open URL", N_("Open connection to given URL") }, { cmd_close, "close", true, 0, 0, parmscope_none, T0(close_connection), "close", N_("Close current connection") }, { cmd_echo, "echo", false, 1, CMD_VARY, parmscope_remote, TV(execute_echo), "echo", NULL }, { cmd_quit, "quit", false, 0, 1, parmscope_none, T1(NULL), "quit", N_("Exit program") }, /* Unconnected operation, 1 mandatory argument */ { cmd_unset, "unset", false, 1, 2, parmscope_none, T2(execute_unset), N_("unset [option] [value]"), N_("Unsets or clears value from option.") }, /* Unconnected operation, 0 arguments */ UO1(lcd, N_("lcd [directory]"), N_("Change local working directory")), { cmd_lls, "lls", false, 0, CMD_VARY, parmscope_local, TV(execute_lls), N_("lls [options]"), N_("Display local directory listing") }, U0(lpwd, N_("Print local working directory")), { cmd_logout, "logout", true, 0, 0, parmscope_none, T0(execute_logout), "logout", N_("Logout of authentication session") }, UO1(help, N_("help [command]"), N_("Display help message")), { cmd_describe, "describe", false, 1, 1, parmscope_none, T1(execute_describe), "describe option", N_("Describe an option variable") }, U0(about, N_("Information about this version of cadaver") ), /* DON'T FORGET TO ADD A NEW COMMAND ALIAS WHEN YOU ADD A NEW COMMAND. */ { cmd_unknown, 0 } /* end-of-list marker, DO NOT move */ }; cadaver-0.23.3/src/ls.c0000664000076400007640000002106311073672301014201 0ustar jortonjorton/* 'ls' for cadaver Copyright (C) 2000-2004, 2006, 2008, Joe Orton , except where otherwise indicated. 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include #include #include "i18n.h" #include "commands.h" #include "cadaver.h" #include "basename.h" #include "utils.h" struct fetch_context { struct resource **list; const char *target; /* Request-URI of the PROPFIND */ unsigned int include_target; /* Include resource at href */ }; static const ne_propname ls_props[] = { { "DAV:", "getcontentlength" }, { "DAV:", "getlastmodified" }, { "http://apache.org/dav/props/", "executable" }, { "DAV:", "resourcetype" }, { "DAV:", "checked-in" }, { "DAV:", "checked-out" }, { NULL } }; #define ELM_resourcetype (NE_PROPS_STATE_TOP + 1) #define ELM_collection (NE_PROPS_STATE_TOP + 2) static const struct ne_xml_idmap ls_idmap[] = { { "DAV:", "resourcetype", ELM_resourcetype }, { "DAV:", "collection", ELM_collection } }; static int compare_resource(const struct resource *r1, const struct resource *r2) { /* Sort errors first, then collections, then alphabetically */ if (r1->type == resr_error) { return -1; } else if (r2->type == resr_error) { return 1; } else if (r1->type == resr_collection) { if (r2->type != resr_collection) { return -1; } else { return strcmp(r1->uri, r2->uri); } } else { if (r2->type != resr_collection) { return strcmp(r1->uri, r2->uri); } else { return 1; } } } static void display_ls_line(struct resource *res) { const char *restype; char exec_char, vcr_char, *name; switch (res->type) { case resr_normal: restype = ""; break; case resr_reference: restype = _("Ref:"); break; case resr_collection: restype = _("Coll:"); break; default: restype = "???"; break; } if (ne_path_has_trailing_slash(res->uri)) { res->uri[strlen(res->uri)-1] = '\0'; } name = strrchr(res->uri, '/'); if (name != NULL && strlen(name+1) > 0) { name++; } else { name = res->uri; } name = ne_path_unescape(name); if (res->type == resr_error) { printf(_("Error: %-30s %d %s\n"), name, res->error_status, res->error_reason?res->error_reason:_("unknown")); } else { exec_char = res->is_executable ? '*' : ' '; /* 0: no vcr, 1: checkin, 2: checkout */ vcr_char = res->is_vcr==0 ? ' ' : (res->is_vcr==1? '>' : '<'); printf("%5s %c%c%-29s %10" FMT_DAV_SIZE_T "u %s\n", restype, vcr_char, exec_char, name, res->size, format_time(res->modtime)); } free(name); } void execute_ls(const char *remote) { int ret; char *real_remote; struct resource *reslist = NULL, *current, *next; if (remote != NULL) { real_remote = resolve_path(session.uri.path, remote, true); } else { real_remote = ne_strdup(session.uri.path); } out_start(_("Listing collection"), real_remote); ret = fetch_resource_list(session.sess, real_remote, 1, 0, &reslist); if (ret == NE_OK) { /* Easy this, eh? */ if (reslist == NULL) { output(o_finish, _("collection is empty.\n")); } else { out_success(); for (current = reslist; current!=NULL; current = next) { next = current->next; if (strlen(current->uri) > strlen(real_remote)) { display_ls_line(current); } free_resource(current); } } } else { out_result(ret); } free(real_remote); } static void results(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) { struct fetch_context *ctx = userdata; struct resource *current, *previous, *newres; const char *clength, *modtime, *isexec; const char *checkin, *checkout; const ne_status *status = NULL; const char *path = uri->path; newres = ne_propset_private(set); if (ne_path_compare(ctx->target, path) == 0 && !ctx->include_target) { /* This is the target URI */ NE_DEBUG(NE_DBG_HTTP, "Skipping target resource.\n"); /* Free the private structure. */ ne_free(newres); return; } newres->uri = ne_strdup(path); clength = ne_propset_value(set, &ls_props[0]); modtime = ne_propset_value(set, &ls_props[1]); isexec = ne_propset_value(set, &ls_props[2]); checkin = ne_propset_value(set, &ls_props[4]); checkout = ne_propset_value(set, &ls_props[5]); if (clength == NULL) status = ne_propset_status(set, &ls_props[0]); if (modtime == NULL) status = ne_propset_status(set, &ls_props[1]); if (newres->type == resr_normal && status) { /* It's an error! */ newres->error_status = status->code; /* Special hack for Apache 1.3/mod_dav */ if (strcmp(status->reason_phrase, "status text goes here") == 0) { const char *desc; if (status->code == 401) { desc = _("Authorization Required"); } else if (status->klass == 3) { desc = _("Redirect"); } else if (status->klass == 5) { desc = _("Server Error"); } else { desc = _("Unknown Error"); } newres->error_reason = ne_strdup(desc); } else { newres->error_reason = ne_strdup(status->reason_phrase); } newres->type = resr_error; } if (isexec && strcasecmp(isexec, "T") == 0) { newres->is_executable = 1; } else { newres->is_executable = 0; } if (modtime) newres->modtime = ne_httpdate_parse(modtime); if (clength) { char *p; newres->size = DAV_STRTOL(clength, &p, 10); if (*p) { newres->size = 0; } } /* is vcr */ if (checkin) { newres->is_vcr = 1; } else if (checkout) { newres->is_vcr = 2; } else { newres->is_vcr = 0; } NE_DEBUG(NE_DBG_HTTP, "End resource %s\n", newres->uri); for (current = *ctx->list, previous = NULL; current != NULL; previous = current, current=current->next) { if (compare_resource(current, newres) >= 0) { break; } } if (previous) { previous->next = newres; } else { *ctx->list = newres; } newres->next = current; } static int ls_startelm(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { ne_propfind_handler *pfh = userdata; struct resource *r = ne_propfind_current_private(pfh); int state = ne_xml_mapid(ls_idmap, NE_XML_MAPLEN(ls_idmap), nspace, name); if (r == NULL || !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) || (parent == ELM_resourcetype && state == ELM_collection))) return NE_XML_DECLINE; if (state == ELM_collection) { NE_DEBUG(NE_DBG_HTTP, "This is a collection.\n"); r->type = resr_collection; } return state; } void free_resource(struct resource *res) { if (res->uri) ne_free(res->uri); if (res->error_reason) ne_free(res->error_reason); free(res); } void free_resource_list(struct resource *res) { struct resource *next; for (; res != NULL; res = next) { next = res->next; free_resource(res); } } static void *create_private(void *userdata, const ne_uri *uri ) { return ne_calloc(sizeof(struct resource)); } int fetch_resource_list(ne_session *sess, const char *uri, int depth, int include_target, struct resource **reslist) { ne_propfind_handler *pfh = ne_propfind_create(sess, uri, depth); int ret; struct fetch_context ctx = {0}; *reslist = NULL; ctx.list = reslist; ctx.target = uri; ctx.include_target = include_target; ne_xml_push_handler(ne_propfind_get_parser(pfh), ls_startelm, NULL, NULL, pfh); ne_propfind_set_private(pfh, create_private, NULL, NULL); ret = ne_propfind_named(pfh, ls_props, results, &ctx); ne_propfind_destroy(pfh); return ret; } cadaver-0.23.3/src/cmdline.c0000664000076400007640000002222410544774177015216 0ustar jortonjorton/* cadaver, command-line DAV client Copyright (C) 1999-2001, Joe Orton 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 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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_STRING_H #include #endif #include #include #include #include #include #include #include "i18n.h" #include "glob.h" #include "basename.h" #include "common.h" #include "commands.h" #include "cadaver.h" #include "cmdline.h" #include "utils.h" static int has_glob_pattern(const char *str) { const char *pnt; for (pnt = str; *pnt != '\0'; pnt++) if (*pnt=='*' || *pnt=='[' || *pnt=='?') return 1; return 0; } /* Gets the next token for parse_command... * Starts at position in line. * DFA states: * 0: chewing leading whitespace * 1: chewing characters, normally * 2: chewing characters in a quote * 3: just got a backslash in normal chew * 4: just got a backslash in a quoted chew * 8: ignoring comment * 9: acceptance state * * State diagram is left as an exercise to the reader, since * I'm not going to draw it in ASCII. ;) * * Returns the token, malloc()-allocated, or NULL on end-of-line. * Position updated to point after token. */ static char *gettoken(const char *line, const char **pointer) { const char *pnt; int state = 0, pos = 0; char buf[BUFSIZ], quote = 0; /* = 0 to keep gcc -Wall happy */ pnt = *pointer; #define ISQUOTE(x) (x=='\'' || x=='\"') #define ISWHITE(x) (x==' ' || x=='\t') while (*pnt != '\0' && state != 9 && pos < BUFSIZ) { switch (state) { case 0: /* leading whitespace chew */ if (ISQUOTE(*pnt)) { state = 2; quote = *pnt; } else if (*pnt == '#') { state = 8; } else if (!ISWHITE(*pnt)) { buf[pos++] = *pnt; state = 1; } break; case 1: /* normal chew */ if (ISWHITE(*pnt)) { state = 9; } else if (*pnt == '#') { state = 8; } else if (*pnt == '\\') { state = 3; } else { buf[pos++] = *pnt; } break; case 2: /* quoted chew */ if (*pnt == quote) { state = 9; } else if (*pnt == '\\') { state = 4; } else { buf[pos++] = *pnt; } break; case 3: /* chew an escaped literal */ buf[pos++] = *pnt; state = 1; break; case 4: /* backslash in quoted chew... like 3 except * we switch back to state 2 afterwards */ buf[pos++] = *pnt; state = 2; break; case 5: /* comment chew */ break; } pnt++; } #undef ISQUOTE #undef ISWHITE /* overflowed the buffer */ if (pos == BUFSIZ) return NULL; buf[pos] = '\0'; *pointer = pnt; if (pos > 0) { #ifdef I_AM_A_LUMBERJACK /* a little hack; does env. var expansion... * 1) is this really useful? * 2) this should be done in parse_command not gettoken */ if (buf[0] == '$') { char *val = getenv(&buf[1]); if (val) return ne_strdup(val); } #endif return ne_strdup(buf); } else { return NULL; } } /* This is about as efficient as painting a wall with a toothbrush. * And it will go just as fast, if you have a slow link to your * server. */ /* Okay, and this was a real swine to get working. The glob() in glibc-2.1.2 (I haven't checked other versions) has a REAL_DIR_ENTRY() macro which checks whether the d_ino field is set. If it isn't, the entry is IGNORED! Actually, the glob() in glib-2.1.2 is broken, so we supply a fixed version in lib/. */ volatile int interrupt_state; /* for glob */ struct dg_ctx { int rootlen; struct resource *files; struct resource *current; }; static void *davglob_opendir(const char *dir) { struct dg_ctx *ctx = NULL; struct resource *files; char *real_path = resolve_path(session.uri.path, dir, 1); NE_DEBUG(DEBUG_FILES, "opendir: %s\n", dir); switch (fetch_resource_list(session.sess, real_path, 1, 0, &files)) { case NE_OK: ctx = ne_calloc(sizeof *ctx); ctx->rootlen = strlen(real_path); ctx->files = files; ctx->current = ctx->files; break; case NE_AUTH: errno = EACCES; break; default: /* Let them know it doesn't exist. */ errno = ENOENT; break; } free(real_path); return (void *)ctx; } /* Mocks up a dummy dirent structure */ static struct dirent *davglob_readdir(void *dir) { static struct dirent ent; struct dg_ctx *ctx = dir; NE_DEBUG(DEBUG_FILES, "readdir:"); if (!ctx->current) { NE_DEBUG(DEBUG_FILES, "none.\n"); return NULL; } else { memset(&ent, 0, sizeof(struct dirent)); ne_strnzcpy(ent.d_name, ctx->current->uri + ctx->rootlen, 255); /* FIXME: non-portable, there's an autoconf * test for this, "d-ino.m4" */ ent.d_ino = 1; NE_DEBUG(DEBUG_FILES, "%s\n", ent.d_name); ctx->current = ctx->current->next; return &ent; } } static void davglob_closedir(void *dir) { struct dg_ctx *ctx = dir; NE_DEBUG(DEBUG_FILES, "closedir\n"); free_resource_list(ctx->files); free(ctx); } static int davglob_stat(const char *filename, struct stat *st) { /* presumption: all glob needs to know is whether it's a directory * or not. I think this is true for the glob in glibc2 */ char *dir; NE_DEBUG(DEBUG_FILES, "stat %s\n", filename); dir = resolve_path(session.uri.path, filename, 1); if (getrestype(dir) == resr_collection) { st->st_mode = S_IFDIR; } else { st->st_mode = S_IFREG; } free(dir); return 0; } static void davglob_interrupt(int sig) { interrupt_state = 1; } static int davglob_errfunc(const char *filename, int errcode) { output(o_finish, "Error on %s: %s\n", filename, strerror(errcode)); return 0; } char **parse_command(const char *line, int *count) { char *token, **tokens = NULL; const char *pnt = line; int numtokens = 0, matches = 0; const struct command *cmd = NULL; #define ADDTOK(x) \ do { \ tokens = realloc(tokens, ++numtokens*sizeof(char *)); \ tokens[numtokens-1] = x; \ } while (0) while ((token = gettoken(line, &pnt)) != NULL) { if (!numtokens) { /* The first token: get the command */ cmd = get_command(token); ADDTOK(token); } else if (has_glob_pattern(token) && cmd && ((cmd->scope == parmscope_remote && session.connected) || (cmd->scope == parmscope_local))) { /* Let us Glob */ glob_t gl = {0}; int ret, flags = GLOB_NOSORT; void (*oldhand)(int sig); output(o_start, _("[Matching...")); interrupt_state = 0; /* The glob() we have compiled here allows us to set a * global variable 'interrupt_state' to 1 when the user * wants to interrupt the glob expansion (particularly * relevant for long slow remote globs)... here's the * handler */ oldhand = signal(SIGINT, davglob_interrupt); /* This is nice. We expand the glob in the same way * whether it is a local or a remote glob, except we lob * in the remote-glob handlers here if the command * requires remote globs to be expanded */ if (cmd->scope == parmscope_remote) { gl.gl_closedir = davglob_closedir; gl.gl_opendir = davglob_opendir; gl.gl_readdir = davglob_readdir; gl.gl_stat = gl.gl_lstat = davglob_stat; flags |= GLOB_ALTDIRFUNC; } /* Do the Glob Thang */ ret = glob(token, flags, davglob_errfunc, &gl); switch (ret) { case 0: { unsigned int n; if (gl.gl_pathc > 1) { output(o_finish, _("%ld matches.]\n"), (long)gl.gl_pathc); } else { output(o_finish, _("1 match.]\n")); } for (n = 0; n < gl.gl_pathc; n++) { ADDTOK(ne_strdup(gl.gl_pathv[n])); } matches++; } break; case GLOB_NOSPACE: output(o_finish, "failed: out of memory.]\n"); break; case GLOB_ABORTED: output(o_finish, "aborted]\n"); break; case GLOB_NOMATCH: output(o_finish, "no matches.]\n"); break; default: output(o_finish, "failed.]\n"); } if (ret) { /* For all the failure cases, put in the glob instead. * Perhaps we should fail here instead... but, this is * what bash does, so we stick with consistent * behaviour. TODO: this could be an option. */ ADDTOK(token); } else { /* Otherwise, we don't use the actual token */ free(token); } globfree(&gl); signal(SIGINT, oldhand); } else { ADDTOK(token); } } *count = numtokens; /* add a NULL at the end of the list */ ADDTOK(NULL); return tokens; } cadaver-0.23.3/aclocal.m40000664000076400007640000040721411312007547014476 0ustar jortonjorton# generated automatically by aclocal 1.11 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 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. # codeset.m4 serial 2 (gettext-0.16) dnl Copyright (C) 2000-2002, 2006 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_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], [char* cs = nl_langinfo(CODESET); return !cs;], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) if test $am_cv_langinfo_codeset = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi ]) # gettext.m4 serial 60 (gettext-0.17) dnl Copyright (C) 1995-2007 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2006. dnl Macro to add for using GNU gettext. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The dnl default (if it is not specified or empty) is 'no-libtool'. dnl INTLSYMBOL should be 'external' for packages with no intl directory, dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. dnl If INTLSYMBOL is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, dnl the value `$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled dnl and used. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 2) GNU gettext has been found in the system's C library. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])])]) ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) define([gt_included_intl], ifelse([$1], [external], ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), [yes])) define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) gt_NEEDS_INIT AM_GNU_GETTEXT_NEED([$2]) AC_REQUIRE([AM_PO_SUBDIRS])dnl ifelse(gt_included_intl, yes, [ AC_REQUIRE([AM_INTL_SUBDIR])dnl ]) dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Sometimes libintl requires libiconv, so first search for libiconv. dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not dnl documented, we avoid it. ifelse(gt_included_intl, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX dnl Set USE_NLS. AC_REQUIRE([AM_NLS]) ifelse(gt_included_intl, yes, [ BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no ]) LIBINTL= LTLIBINTL= POSUB= dnl Add a version number to the cache macros. case " $gt_needs " in *" need-formatstring-macros "*) gt_api_version=3 ;; *" need-ngettext "*) gt_api_version=2 ;; *) gt_api_version=1 ;; esac gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no ifelse(gt_included_intl, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. if test $gt_api_version -ge 3; then gt_revision_test_code=' #ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ' else gt_revision_test_code= fi if test $gt_api_version -ge 2; then gt_expression_test_code=' + * ngettext ("", "", 0)' else gt_expression_test_code= fi AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], [AC_TRY_LINK([#include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings;], [bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], [eval "$gt_func_gnugettext_libc=yes"], [eval "$gt_func_gnugettext_libc=no"])]) if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl Sometimes libintl requires libiconv, so first search for libiconv. ifelse(gt_included_intl, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) dnl because that would add "-liconv" to LIBINTL and LTLIBINTL dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], [$gt_func_gnugettext_libintl], [gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_TRY_LINK([#include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], [eval "$gt_func_gnugettext_libintl=yes"], [eval "$gt_func_gnugettext_libintl=no"]) dnl Now see whether libintl exists and depends on libiconv. if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *);], [bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], [LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" eval "$gt_func_gnugettext_libintl=yes" ]) fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS"]) fi dnl If an already present or preinstalled GNU gettext() is found, dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. LIBINTL= LTLIBINTL= INCINTL= fi ifelse(gt_included_intl, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi ]) if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Some extra flags are needed during linking. LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.]) else USE_NLS=no fi fi AC_MSG_CHECKING([whether to use NLS]) AC_MSG_RESULT([$USE_NLS]) if test "$USE_NLS" = "yes"; then AC_MSG_CHECKING([where the gettext function comes from]) if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi AC_MSG_RESULT([$gt_source]) fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi dnl For backward compatibility. Some packages may be using this. AC_DEFINE(HAVE_GETTEXT, 1, [Define if the GNU gettext() function is already present or preinstalled.]) AC_DEFINE(HAVE_DCGETTEXT, 1, [Define if the GNU dcgettext() function is already present or preinstalled.]) fi dnl We need to process the po/ directory. POSUB=po fi ifelse(gt_included_intl, yes, [ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then BUILD_INCLUDED_LIBINTL=yes fi dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATOBJEXT) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= nls_cv_header_libgt= dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share AC_SUBST(DATADIRNAME) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo AC_SUBST(INSTOBJEXT) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) dnl For backward compatibility. Some Makefiles may be using this. INTLOBJS= if test "$USE_INCLUDED_LIBINTL" = yes; then INTLOBJS="\$(GETTOBJS)" fi AC_SUBST(INTLOBJS) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" AC_SUBST(INTLLIBS) dnl Make all documented variables known to autoconf. AC_SUBST(LIBINTL) AC_SUBST(LTLIBINTL) AC_SUBST(POSUB) ]) dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. m4_define([gt_NEEDS_INIT], [ m4_divert_text([DEFAULTS], [gt_needs=]) m4_define([gt_NEEDS_INIT], []) ]) dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) AC_DEFUN([AM_GNU_GETTEXT_NEED], [ m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) ]) dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) # glibc2.m4 serial 1 dnl Copyright (C) 2000-2002, 2004 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. # Test for the GNU C Library, version 2.0 or newer. # From Bruno Haible. AC_DEFUN([gt_GLIBC2], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer, ac_cv_gnu_library_2, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ >= 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2=yes, ac_cv_gnu_library_2=no) ] ) AC_SUBST(GLIBC2) GLIBC2="$ac_cv_gnu_library_2" ] ) # glibc21.m4 serial 3 dnl Copyright (C) 2000-2002, 2004 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. # Test for the GNU C Library, version 2.1 or newer. # From Bruno Haible. AC_DEFUN([gl_GLIBC21], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, ac_cv_gnu_library_2_1, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2_1=yes, ac_cv_gnu_library_2_1=no) ] ) AC_SUBST(GLIBC21) GLIBC21="$ac_cv_gnu_library_2_1" ] ) # iconv.m4 serial AM6 (gettext-0.17) dnl Copyright (C) 2000-2002, 2007 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_TRY_LINK will then fail, the second AC_TRY_LINK 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_TRY_LINK([#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_TRY_LINK([#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 and HP-UX 11.11. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi AC_TRY_RUN([ #include #include int main () { /* 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 const char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; 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, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) return 1; } } #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 const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; 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, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) return 1; } } #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)) return 1; return 0; }], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], [case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac]) 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) ]) 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_TRY_COMPILE([ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || 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([$]{ac_t:- }[$]am_cv_proto_iconv) AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, [Define as const if the declaration of iconv() needs const.]) fi ]) # intdiv0.m4 serial 2 (gettext-0.17) dnl Copyright (C) 2002, 2007 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([gt_INTDIV0], [ AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], gt_cv_int_divbyzero_sigfpe, [ gt_cv_int_divbyzero_sigfpe= changequote(,)dnl case "$host_os" in macos* | darwin[6-9]* | darwin[1-9][0-9]*) # On MacOS X 10.2 or newer, just assume the same as when cross- # compiling. If we were to perform the real test, 1 Crash Report # dialog window would pop up. case "$host_cpu" in i[34567]86 | x86_64) gt_cv_int_divbyzero_sigfpe="guessing yes" ;; esac ;; esac changequote([,])dnl if test -z "$gt_cv_int_divbyzero_sigfpe"; then AC_TRY_RUN([ #include #include static void sigfpe_handler (int sig) { /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ exit (sig != SIGFPE); } int x = 1; int y = 0; int z; int nan; int main () { signal (SIGFPE, sigfpe_handler); /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) signal (SIGTRAP, sigfpe_handler); #endif /* Linux/SPARC yields signal SIGILL. */ #if defined (__sparc__) && defined (__linux__) signal (SIGILL, sigfpe_handler); #endif z = x / y; nan = y / y; exit (1); } ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, [ # Guess based on the CPU. changequote(,)dnl case "$host_cpu" in alpha* | i[34567]86 | x86_64 | m68k | s390*) gt_cv_int_divbyzero_sigfpe="guessing yes";; *) gt_cv_int_divbyzero_sigfpe="guessing no";; esac changequote([,])dnl ]) fi ]) case "$gt_cv_int_divbyzero_sigfpe" in *yes) value=1;; *) value=0;; esac AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, [Define if integer division by zero raises signal SIGFPE.]) ]) # intl.m4 serial 8 (gettext-0.17) dnl Copyright (C) 1995-2007 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2006. AC_PREREQ(2.52) dnl Checks for all prerequisites of the intl subdirectory, dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. AC_DEFUN([AM_INTL_SUBDIR], [ AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([gt_GLIBC2])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([gl_VISIBILITY])dnl AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl AC_REQUIRE([gt_TYPE_WCHAR_T])dnl AC_REQUIRE([gt_TYPE_WINT_T])dnl AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gt_TYPE_INTMAX_T]) AC_REQUIRE([gt_PRINTF_POSIX]) AC_REQUIRE([gl_GLIBC21])dnl AC_REQUIRE([gl_XSIZE])dnl AC_REQUIRE([gt_INTL_MACOSX])dnl AC_CHECK_TYPE([ptrdiff_t], , [AC_DEFINE([ptrdiff_t], [long], [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ]) AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) AC_CHECK_FUNCS([asprintf fwprintf putenv setenv setlocale snprintf wcslen]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). gt_CHECK_DECL(_snprintf, [#include ]) gt_CHECK_DECL(_snwprintf, [#include ]) dnl Use the *_unlocked functions only if they are declared. dnl (because some of them were defined without being declared in Solaris dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built dnl on Solaris 2.5.1 to run on Solaris 2.6). dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. gt_CHECK_DECL(getc_unlocked, [#include ]) case $gt_cv_func_printf_posix in *yes) HAVE_POSIX_PRINTF=1 ;; *) HAVE_POSIX_PRINTF=0 ;; esac AC_SUBST([HAVE_POSIX_PRINTF]) if test "$ac_cv_func_asprintf" = yes; then HAVE_ASPRINTF=1 else HAVE_ASPRINTF=0 fi AC_SUBST([HAVE_ASPRINTF]) if test "$ac_cv_func_snprintf" = yes; then HAVE_SNPRINTF=1 else HAVE_SNPRINTF=0 fi AC_SUBST([HAVE_SNPRINTF]) if test "$ac_cv_func_wprintf" = yes; then HAVE_WPRINTF=1 else HAVE_WPRINTF=0 fi AC_SUBST([HAVE_WPRINTF]) AM_LANGINFO_CODESET gt_LC_MESSAGES dnl Compilation on mingw and Cygwin needs special Makefile rules, because dnl 1. when we install a shared library, we must arrange to export dnl auxiliary pointer variables for every exported variable, dnl 2. when we install a shared library and a static library simultaneously, dnl the include file specifies __declspec(dllimport) and therefore we dnl must arrange to define the auxiliary pointer variables for the dnl exported variables _also_ in the static library. if test "$enable_shared" = yes; then case "$host_os" in mingw* | cygwin*) is_woe32dll=yes ;; *) is_woe32dll=no ;; esac else is_woe32dll=no fi WOE32DLL=$is_woe32dll AC_SUBST([WOE32DLL]) dnl On mingw and Cygwin, we can activate special Makefile rules which add dnl version information to the shared libraries and executables. case "$host_os" in mingw* | cygwin*) is_woe32=yes ;; *) is_woe32=no ;; esac WOE32=$is_woe32 AC_SUBST([WOE32]) if test $WOE32 = yes; then dnl Check for a program that compiles Windows resource files. AC_CHECK_TOOL([WINDRES], [windres]) fi dnl Determine whether when creating a library, "-lc" should be passed to dnl libtool or not. On many platforms, it is required for the libtool option dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool dnl in the *.la files - makes it impossible to create multithreaded programs, dnl because libtool also reorders the -lc to come before the -pthread, and dnl this disables pthread_create() . case "$host_os" in hpux*) LTLIBC="" ;; *) LTLIBC="-lc" ;; esac AC_SUBST([LTLIBC]) dnl Rename some macros and functions used for locking. AH_BOTTOM([ #define __libc_lock_t gl_lock_t #define __libc_lock_define gl_lock_define #define __libc_lock_define_initialized gl_lock_define_initialized #define __libc_lock_init gl_lock_init #define __libc_lock_lock gl_lock_lock #define __libc_lock_unlock gl_lock_unlock #define __libc_lock_recursive_t gl_recursive_lock_t #define __libc_lock_define_recursive gl_recursive_lock_define #define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized #define __libc_lock_init_recursive gl_recursive_lock_init #define __libc_lock_lock_recursive gl_recursive_lock_lock #define __libc_lock_unlock_recursive gl_recursive_lock_unlock #define glthread_in_use libintl_thread_in_use #define glthread_lock_init libintl_lock_init #define glthread_lock_lock libintl_lock_lock #define glthread_lock_unlock libintl_lock_unlock #define glthread_lock_destroy libintl_lock_destroy #define glthread_rwlock_init libintl_rwlock_init #define glthread_rwlock_rdlock libintl_rwlock_rdlock #define glthread_rwlock_wrlock libintl_rwlock_wrlock #define glthread_rwlock_unlock libintl_rwlock_unlock #define glthread_rwlock_destroy libintl_rwlock_destroy #define glthread_recursive_lock_init libintl_recursive_lock_init #define glthread_recursive_lock_lock libintl_recursive_lock_lock #define glthread_recursive_lock_unlock libintl_recursive_lock_unlock #define glthread_recursive_lock_destroy libintl_recursive_lock_destroy #define glthread_once libintl_once #define glthread_once_call libintl_once_call #define glthread_once_singlethreaded libintl_once_singlethreaded ]) ]) dnl Checks for the core files of the intl subdirectory: dnl dcigettext.c dnl eval-plural.h dnl explodename.c dnl finddomain.c dnl gettextP.h dnl gmo.h dnl hash-string.h hash-string.c dnl l10nflist.c dnl libgnuintl.h.in (except the *printf stuff) dnl loadinfo.h dnl loadmsgcat.c dnl localealias.c dnl log.c dnl plural-exp.h plural-exp.c dnl plural.y dnl Used by libglocale. AC_DEFUN([gt_INTL_SUBDIR_CORE], [ AC_REQUIRE([AC_C_INLINE])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([gt_INTDIV0])dnl AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl AC_REQUIRE([gt_INTTYPES_PRI])dnl AC_REQUIRE([gl_LOCK])dnl AC_TRY_LINK( [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }], [], [AC_DEFINE([HAVE_BUILTIN_EXPECT], 1, [Define to 1 if the compiler understands __builtin_expect.])]) AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h]) AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \ stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \ argz_next __fsetlocking]) dnl Use the *_unlocked functions only if they are declared. dnl (because some of them were defined without being declared in Solaris dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built dnl on Solaris 2.5.1 to run on Solaris 2.6). dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. gt_CHECK_DECL(feof_unlocked, [#include ]) gt_CHECK_DECL(fgets_unlocked, [#include ]) AM_ICONV dnl glibc >= 2.4 has a NL_LOCALE_NAME macro when _GNU_SOURCE is defined, dnl and a _NL_LOCALE_NAME macro always. AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name, [AC_TRY_LINK([#include #include ], [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES)); return !cs; ], gt_cv_nl_locale_name=yes, gt_cv_nl_locale_name=no) ]) if test $gt_cv_nl_locale_name = yes; then AC_DEFINE(HAVE_NL_LOCALE_NAME, 1, [Define if you have and it defines the NL_LOCALE_NAME macro if _GNU_SOURCE is defined.]) fi dnl intl/plural.c is generated from intl/plural.y. It requires bison, dnl because plural.y uses bison specific features. It requires at least dnl bison-1.26 because earlier versions generate a plural.c that doesn't dnl compile. dnl bison is only needed for the maintainer (who touches plural.y). But in dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put dnl the rule in general Makefile. Now, some people carelessly touch the dnl files or have a broken "make" program, hence the plural.c rule will dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not dnl present or too old. AC_CHECK_PROGS([INTLBISON], [bison]) if test -z "$INTLBISON"; then ac_verc_fail=yes else dnl Found it, now check the version. AC_MSG_CHECKING([version of bison]) changequote(<<,>>)dnl ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) changequote([,])dnl ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac AC_MSG_RESULT([$ac_prog_version]) fi if test $ac_verc_fail = yes; then INTLBISON=: fi ]) dnl gt_CHECK_DECL(FUNC, INCLUDES) dnl Check whether a function is declared. AC_DEFUN([gt_CHECK_DECL], [ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, [AC_TRY_COMPILE([$2], [ #ifndef $1 char *p = (char *) $1; #endif ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) if test $ac_cv_have_decl_$1 = yes; then gt_value=1 else gt_value=0 fi AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) ]) # intlmacosx.m4 serial 1 (gettext-0.17) dnl Copyright (C) 2004-2007 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Checks for special options needed on MacOS X. dnl Defines INTL_MACOSX_LIBS. AC_DEFUN([gt_INTL_MACOSX], [ dnl Check for API introduced in MacOS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], gt_cv_func_CFPreferencesCopyAppValue, [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_TRY_LINK([#include ], [CFPreferencesCopyAppValue(NULL, NULL)], [gt_cv_func_CFPreferencesCopyAppValue=yes], [gt_cv_func_CFPreferencesCopyAppValue=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Check for API introduced in MacOS X 10.3. AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], [gt_cv_func_CFLocaleCopyCurrent=yes], [gt_cv_func_CFLocaleCopyCurrent=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFLocaleCopyCurrent = yes; then AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi AC_SUBST([INTL_MACOSX_LIBS]) ]) # intmax.m4 serial 3 (gettext-0.16) dnl Copyright (C) 2002-2005 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 Test whether the system has the 'intmax_t' type, but don't attempt to dnl find a replacement if it is lacking. AC_DEFUN([gt_TYPE_INTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, [AC_TRY_COMPILE([ #include #include #if HAVE_STDINT_H_WITH_UINTMAX #include #endif #if HAVE_INTTYPES_H_WITH_UINTMAX #include #endif ], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in or .]) fi ]) # inttypes-pri.m4 serial 4 (gettext-0.16) dnl Copyright (C) 1997-2002, 2006 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_PREREQ(2.52) # Define PRI_MACROS_BROKEN if exists and defines the PRI* # macros to non-string values. This is the case on AIX 4.3.3. AC_DEFUN([gt_INTTYPES_PRI], [ AC_CHECK_HEADERS([inttypes.h]) if test $ac_cv_header_inttypes_h = yes; then AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], gt_cv_inttypes_pri_broken, [ AC_TRY_COMPILE([#include #ifdef PRId32 char *p = PRId32; #endif ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) ]) fi if test "$gt_cv_inttypes_pri_broken" = yes; then AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, [Define if exists and defines unusable PRI* macros.]) PRI_MACROS_BROKEN=1 else PRI_MACROS_BROKEN=0 fi AC_SUBST([PRI_MACROS_BROKEN]) ]) # inttypes_h.m4 serial 7 dnl Copyright (C) 1997-2004, 2006 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 Paul Eggert. # Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1; return !i;], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)]) if test $gl_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) # lcmessage.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 1995-2002, 2004-2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995. # Check whether LC_MESSAGES is available in . AC_DEFUN([gt_LC_MESSAGES], [ AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)]) if test $gt_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi ]) # lib-ld.m4 serial 3 (gettext-0.13) dnl Copyright (C) 1996-2003 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/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision dnl with libtool.m4. dnl From libtool-1.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 ld's only accept -v. case `$LD -v 2>&1 conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh 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 GCC]) 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. [[\\/]* | [A-Za-z]:[\\/]*)] [re_direlt='/[^/][^/]*/\.\./'] # Canonicalize the path 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 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do 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 GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$acl_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_LIB_PROG_LD_GNU ]) # lib-link.m4 serial 13 (gettext-0.17) dnl Copyright (C) 2001-2007 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_PREREQ(2.54) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) AC_SUBST([LIB]NAME[_PREFIX]) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes undefine([Name]) undefine([NAME]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. If found, it dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. ac_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" LIBS="$LIBS $LIB[]NAME" AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= LIB[]NAME[]_PREFIX= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) AC_SUBST([LIB]NAME[_PREFIX]) undefine([Name]) undefine([NAME]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl acl_libext, dnl acl_shlibext, dnl acl_hardcode_libdir_flag_spec, dnl acl_hardcode_libdir_separator, dnl acl_hardcode_direct, dnl acl_hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ dnl Tell automake >= 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_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]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl Autoconf >= 2.61 supports dots in --with options. define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])]) 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]N_A_M_E[-prefix], [ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib --without-lib]N_A_M_E[-prefix don't search for lib$1 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 ]) 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= 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"; 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/"'*$,,'` LIB[]NAME[]_PREFIX="$basedir" 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"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; 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 ]) 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"; 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"; 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 5 (gettext-0.15) dnl Copyright (C) 2001-2005 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 a variable acl_libdirstem, containing dnl the basename of the libdir, either "lib" or "lib64". AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ dnl There is no formal standard regarding lib and lib64. The current dnl practice is that on a system supporting 32-bit and 64-bit instruction dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit dnl libraries go under $prefix/lib. We determine the compiler's default dnl mode by looking at the compiler's library search path. If at least dnl of its elements ends in /lib64 or points to a directory whose absolute dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the dnl default, namely "lib". acl_libdirstem=lib 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 ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi ]) # lock.m4 serial 7 (gettext-0.17) dnl Copyright (C) 2005-2007 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 Tests for a multithreading library to be used. dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, dnl USE_PTH_THREADS, USE_WIN32_THREADS dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with dnl libtool). dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for dnl programs that really need multithread functionality. The difference dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread". dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for dnl multithread-safe programs. AC_DEFUN([gl_LOCK_EARLY], [ AC_REQUIRE([gl_LOCK_EARLY_BODY]) ]) dnl The guts of gl_LOCK_EARLY. Needs to be expanded only once. AC_DEFUN([gl_LOCK_EARLY_BODY], [ dnl Ordering constraints: This macro modifies CPPFLAGS in a way that dnl influences the result of the autoconf tests that test for *_unlocked dnl declarations, on AIX 5 at least. Therefore it must come early. AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl AC_BEFORE([$0], [gl_ARGP])dnl AC_REQUIRE([AC_CANONICAL_HOST]) dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes dnl AC_GNU_SOURCE. m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) AC_HELP_STRING([--disable-threads], [build without multithread safety]), [gl_use_threads=$enableval], [case "$host_os" in dnl Disable multithreading by default on OSF/1, because it interferes dnl with fork()/exec(): When msgexec is linked with -lpthread, its child dnl process gets an endless segmentation fault inside execvp(). osf*) gl_use_threads=no ;; *) gl_use_threads=yes ;; esac ]) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # For using : case "$host_os" in osf*) # On OSF/1, the compiler needs the flag -D_REENTRANT so that it # groks . cc also understands the flag -pthread, but # we don't use it because 1. gcc-2.95 doesn't understand -pthread, # 2. putting a flag into CPPFLAGS that has an effect on the linker # causes the AC_TRY_LINK test below to succeed unexpectedly, # leading to wrong values of LIBTHREAD and LTLIBTHREAD. CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the # definition of 'errno' in . case "$host_os" in aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac fi ]) dnl The guts of gl_LOCK. Needs to be expanded only once. AC_DEFUN([gl_LOCK_BODY], [ AC_REQUIRE([gl_LOCK_EARLY_BODY]) gl_threads_api=none LIBTHREAD= LTLIBTHREAD= LIBMULTITHREAD= LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then dnl Check whether the compiler and linker support weak declarations. AC_MSG_CHECKING([whether imported symbols can be declared weak]) gl_have_weak=no AC_TRY_LINK([extern void xyzzy (); #pragma weak xyzzy], [xyzzy();], [gl_have_weak=yes]) AC_MSG_RESULT([$gl_have_weak]) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks . It's added above, in gl_LOCK_EARLY_BODY. AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no) if test "$gl_have_pthread_h" = yes; then # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads gl_have_pthread= # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist # in libc. IRIX 6.5 has the first one in both libc and libpthread, but # the second one only in libpthread, and lock.c needs it. AC_TRY_LINK([#include ], [pthread_mutex_lock((pthread_mutex_t*)0); pthread_mutexattr_init((pthread_mutexattr_t*)0);], [gl_have_pthread=yes]) # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) if test -n "$gl_have_pthread"; then # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. AC_CHECK_LIB(pthread, pthread_kill, [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a # thread: pthread_create from libc will fail, whereas # pthread_create will actually create a thread. case "$host_os" in solaris* | hpux*) AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], 1, [Define if the pthread_in_use() detection is hard.]) esac ]) else # Some library is needed. Try libpthread and libc_r. AC_CHECK_LIB(pthread, pthread_kill, [gl_have_pthread=yes LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) if test -z "$gl_have_pthread"; then # For FreeBSD 4. AC_CHECK_LIB(c_r, pthread_kill, [gl_have_pthread=yes LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) fi fi if test -n "$gl_have_pthread"; then gl_threads_api=posix AC_DEFINE([USE_POSIX_THREADS], 1, [Define if the POSIX multithreading library can be used.]) if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then if test $gl_have_weak = yes; then AC_DEFINE([USE_POSIX_THREADS_WEAK], 1, [Define if references to the POSIX multithreading library should be made weak.]) LIBTHREAD= LTLIBTHREAD= fi fi # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the # pthread_rwlock_* functions. AC_CHECK_TYPE([pthread_rwlock_t], [AC_DEFINE([HAVE_PTHREAD_RWLOCK], 1, [Define if the POSIX multithreading library has read/write locks.])], [], [#include ]) # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. AC_TRY_COMPILE([#include ], [#if __FreeBSD__ == 4 error "No, in FreeBSD 4.0 recursive mutexes actually don't work." #else int x = (int)PTHREAD_MUTEX_RECURSIVE; return !x; #endif], [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1, [Define if the defines PTHREAD_MUTEX_RECURSIVE.])]) fi fi fi if test -z "$gl_have_pthread"; then if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then gl_have_solaristhread= gl_save_LIBS="$LIBS" LIBS="$LIBS -lthread" AC_TRY_LINK([#include #include ], [thr_self();], [gl_have_solaristhread=yes]) LIBS="$gl_save_LIBS" if test -n "$gl_have_solaristhread"; then gl_threads_api=solaris LIBTHREAD=-lthread LTLIBTHREAD=-lthread LIBMULTITHREAD="$LIBTHREAD" LTLIBMULTITHREAD="$LTLIBTHREAD" AC_DEFINE([USE_SOLARIS_THREADS], 1, [Define if the old Solaris multithreading library can be used.]) if test $gl_have_weak = yes; then AC_DEFINE([USE_SOLARIS_THREADS_WEAK], 1, [Define if references to the old Solaris multithreading library should be made weak.]) LIBTHREAD= LTLIBTHREAD= fi fi fi fi if test "$gl_use_threads" = pth; then gl_save_CPPFLAGS="$CPPFLAGS" AC_LIB_LINKFLAGS(pth) gl_have_pth= gl_save_LIBS="$LIBS" LIBS="$LIBS -lpth" AC_TRY_LINK([#include ], [pth_self();], gl_have_pth=yes) LIBS="$gl_save_LIBS" if test -n "$gl_have_pth"; then gl_threads_api=pth LIBTHREAD="$LIBPTH" LTLIBTHREAD="$LTLIBPTH" LIBMULTITHREAD="$LIBTHREAD" LTLIBMULTITHREAD="$LTLIBTHREAD" AC_DEFINE([USE_PTH_THREADS], 1, [Define if the GNU Pth multithreading library can be used.]) if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then if test $gl_have_weak = yes; then AC_DEFINE([USE_PTH_THREADS_WEAK], 1, [Define if references to the GNU Pth multithreading library should be made weak.]) LIBTHREAD= LTLIBTHREAD= fi fi else CPPFLAGS="$gl_save_CPPFLAGS" fi fi if test -z "$gl_have_pthread"; then if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then if { case "$host_os" in mingw*) true;; *) false;; esac }; then gl_threads_api=win32 AC_DEFINE([USE_WIN32_THREADS], 1, [Define if the Win32 multithreading API can be used.]) fi fi fi fi AC_MSG_CHECKING([for multithread API to use]) AC_MSG_RESULT([$gl_threads_api]) AC_SUBST(LIBTHREAD) AC_SUBST(LTLIBTHREAD) AC_SUBST(LIBMULTITHREAD) AC_SUBST(LTLIBMULTITHREAD) ]) AC_DEFUN([gl_LOCK], [ AC_REQUIRE([gl_LOCK_EARLY]) AC_REQUIRE([gl_LOCK_BODY]) gl_PREREQ_LOCK ]) # Prerequisites of lib/lock.c. AC_DEFUN([gl_PREREQ_LOCK], [ AC_REQUIRE([AC_C_INLINE]) ]) dnl Survey of platforms: dnl dnl Platform Available Compiler Supports test-lock dnl flavours option weak result dnl --------------- --------- --------- -------- --------- dnl Linux 2.4/glibc posix -lpthread Y OK dnl dnl GNU Hurd/glibc posix dnl dnl FreeBSD 5.3 posix -lc_r Y dnl posix -lkse ? Y dnl posix -lpthread ? Y dnl posix -lthr Y dnl dnl FreeBSD 5.2 posix -lc_r Y dnl posix -lkse Y dnl posix -lthr Y dnl dnl FreeBSD 4.0,4.10 posix -lc_r Y OK dnl dnl NetBSD 1.6 -- dnl dnl OpenBSD 3.4 posix -lpthread Y OK dnl dnl MacOS X 10.[123] posix -lpthread Y OK dnl dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK dnl dnl HP-UX 11 posix -lpthread N (cc) OK dnl Y (gcc) dnl dnl IRIX 6.5 posix -lpthread Y 0.5 dnl dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK dnl dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK dnl -lpthread (gcc) Y dnl dnl Cygwin posix -lpthread Y OK dnl dnl Any of the above pth -lpth 0.0 dnl dnl Mingw win32 N OK dnl dnl BeOS 5 -- dnl dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is dnl turned off: dnl OK if all three tests terminate OK, dnl 0.5 if the first test terminates OK but the second one loops endlessly, dnl 0.0 if the first test already loops endlessly. # longlong.m4 serial 13 dnl Copyright (C) 1999-2007 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 Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. # This fixes a bug in Autoconf 2.61, but can be removed once we # assume 2.62 everywhere. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be # defined. In this case you can treat 'long long int' like 'long int'. AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( [_AC_TYPE_LONG_LONG_SNIPPET], [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. dnl If cross compiling, assume the bug isn't important, since dnl nobody cross compiles for this platform as far as we know. AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[@%:@include @%:@ifndef LLONG_MAX @%:@ define HALF \ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) @%:@ define LLONG_MAX (HALF - 1 + HALF) @%:@endif]], [[long long int n = 1; int i; for (i = 0; ; i++) { long long int m = n << i; if (m >> i != n) return 1; if (LLONG_MAX / 2 < m) break; } return 0;]])], [ac_cv_type_long_long_int=yes], [ac_cv_type_long_long_int=no], [ac_cv_type_long_long_int=yes])], [ac_cv_type_long_long_int=no])]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], 1, [Define to 1 if the system has the type `long long int'.]) fi ]) # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. # This fixes a bug in Autoconf 2.61, but can be removed once we # assume 2.62 everywhere. # Note: If the type 'unsigned long long int' exists but is only 32 bits # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT # will not be defined. In this case you can treat 'unsigned long long int' # like 'unsigned long int'. AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ AC_CACHE_CHECK([for unsigned long long int], [ac_cv_type_unsigned_long_long_int], [AC_LINK_IFELSE( [_AC_TYPE_LONG_LONG_SNIPPET], [ac_cv_type_unsigned_long_long_int=yes], [ac_cv_type_unsigned_long_long_int=no])]) if test $ac_cv_type_unsigned_long_long_int = yes; then AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, [Define to 1 if the system has the type `unsigned long long int'.]) fi ]) # Expands to a C program that can be used to test for simultaneous support # of 'long long' and 'unsigned long long'. We don't want to say that # 'long long' is available if 'unsigned long long' is not, or vice versa, # because too many programs rely on the symmetry between signed and unsigned # integer types (excluding 'bool'). AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], [ AC_LANG_PROGRAM( [[/* Test preprocessor. */ #if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) error in preprocessor; #endif #if ! (18446744073709551615ULL <= -1ull) error in preprocessor; #endif /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; int i = 63;]], [[/* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | (llmax / ll) | (llmax % ll) | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) | (ullmax / ull) | (ullmax % ull));]]) ]) # nls.m4 serial 3 (gettext-0.15) dnl Copyright (C) 1995-2003, 2005-2006 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ(2.50) AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) ]) # po.m4 serial 15 (gettext-0.17) dnl Copyright (C) 1995-2007 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ(2.50) dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake AC_REQUIRE([AM_NLS])dnl dnl Release version of the gettext macros. This is used to ensure that dnl the gettext macros and po/Makefile.in.in are in sync. AC_SUBST([GETTEXT_MACRO_VERSION], [0.17]) dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. dnl Search for GNU msgfmt in the PATH. dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. dnl The second test excludes FreeBSD msgfmt. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) dnl Test whether it is GNU msgfmt >= 0.15. changequote(,)dnl case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; *) MSGFMT_015=$MSGFMT ;; esac changequote([,])dnl AC_SUBST([MSGFMT_015]) changequote(,)dnl case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; esac changequote([,])dnl AC_SUBST([GMSGFMT_015]) dnl Search for GNU xgettext 0.12 or newer in the PATH. dnl The first test excludes Solaris xgettext and early GNU xgettext versions. dnl The second test excludes FreeBSD xgettext. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po dnl Test whether it is GNU xgettext >= 0.15. changequote(,)dnl case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; *) XGETTEXT_015=$XGETTEXT ;; esac changequote([,])dnl AC_SUBST([XGETTEXT_015]) dnl Search for GNU msgmerge 0.11 or newer in the PATH. AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) dnl Installation directories. dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we dnl have to define it here, so that it can be used in po/Makefile. test -n "$localedir" || localedir='${datadir}/locale' AC_SUBST([localedir]) dnl Support for AM_XGETTEXT_OPTION. test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) AC_CONFIG_COMMANDS([po-directories], [[ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done]], [# Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake < 1.5. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" ]) ]) dnl Postprocesses a Makefile in a directory containing PO files. AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], [ # When this code is run, in config.status, two variables have already been # set: # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, # - LINGUAS is the value of the environment variable LINGUAS at configure # time. changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Find a way to echo strings without interpreting backslash. if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then gt_echo='echo' else if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then gt_echo='printf %s\n' else echo_func () { cat < "$ac_file.tmp" if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" < /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` cat >> "$ac_file.tmp" <> "$ac_file.tmp" < #include /* The string "%2$d %1$d", with dollar characters protected from the shell's dollar expansion (possibly an autoconf bug). */ static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; static char buf[100]; int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); }], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, [ AC_EGREP_CPP(notposix, [ #if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ notposix #endif ], gt_cv_func_printf_posix="guessing no", gt_cv_func_printf_posix="guessing yes") ]) ]) case $gt_cv_func_printf_posix in *yes) AC_DEFINE(HAVE_POSIX_PRINTF, 1, [Define if your printf() function supports format strings with positions.]) ;; esac ]) # progtest.m4 serial 4 (gettext-0.14.2) dnl Copyright (C) 1996-2003, 2005 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 dnl This file can can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1996. AC_PREREQ(2.50) # Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], [ # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in ifelse([$5], , $PATH, [$5]); do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) # size_max.m4 serial 6 dnl Copyright (C) 2003, 2005-2006 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([gl_SIZE_MAX], [ AC_CHECK_HEADERS(stdint.h) dnl First test whether the system already has SIZE_MAX. AC_MSG_CHECKING([for SIZE_MAX]) AC_CACHE_VAL([gl_cv_size_max], [ gl_cv_size_max= AC_EGREP_CPP([Found it], [ #include #if HAVE_STDINT_H #include #endif #ifdef SIZE_MAX Found it #endif ], gl_cv_size_max=yes) if test -z "$gl_cv_size_max"; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. Try hard to find a definition that can dnl be used in a preprocessor #if, i.e. doesn't contain a cast. AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], [#include #include ], size_t_bits_minus_1=) AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], [#include ], fits_in_uint=) if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then if test $fits_in_uint = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. AC_TRY_COMPILE([#include extern size_t foo; extern unsigned long foo; ], [], fits_in_uint=0) fi dnl We cannot use 'expr' to simplify this expression, because 'expr' dnl works only with 'long' integers in the host environment, while we dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. if test $fits_in_uint = 1; then gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" else gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" fi else dnl Shouldn't happen, but who knows... gl_cv_size_max='((size_t)~(size_t)0)' fi fi ]) AC_MSG_RESULT([$gl_cv_size_max]) if test "$gl_cv_size_max" != yes; then AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi ]) dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. dnl Remove this when we can assume autoconf >= 2.61. m4_ifdef([AC_COMPUTE_INT], [], [ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) ]) # stdint_h.m4 serial 6 dnl Copyright (C) 1997-2004, 2006 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 Paul Eggert. # Define HAVE_STDINT_H_WITH_UINTMAX if exists, # doesn't clash with , and declares uintmax_t. AC_DEFUN([gl_AC_HEADER_STDINT_H], [ AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1; return !i;], gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)]) if test $gl_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, [Define if exists, doesn't clash with , and declares uintmax_t. ]) fi ]) # uintmax_t.m4 serial 10 dnl Copyright (C) 1997-2004, 2007 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 Paul Eggert. AC_PREREQ(2.13) # Define uintmax_t to 'unsigned long' or 'unsigned long long' # if it is not already defined in or . AC_DEFUN([gl_AC_TYPE_UINTMAX_T], [ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) test $ac_cv_type_unsigned_long_long_int = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, [Define to unsigned long or unsigned long long if and don't define.]) else AC_DEFINE(HAVE_UINTMAX_T, 1, [Define if you have the 'uintmax_t' type in or .]) fi ]) # visibility.m4 serial 1 (gettext-0.15) dnl Copyright (C) 2005 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 Tests whether the compiler supports the command-line option dnl -fvisibility=hidden and the function and variable attributes dnl __attribute__((__visibility__("hidden"))) and dnl __attribute__((__visibility__("default"))). dnl Does *not* test for __visibility__("protected") - which has tricky dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on dnl MacOS X. dnl Does *not* test for __visibility__("internal") - which has processor dnl dependent semantics. dnl Does *not* test for #pragma GCC visibility push(hidden) - which is dnl "really only recommended for legacy code". dnl Set the variable CFLAG_VISIBILITY. dnl Defines and sets the variable HAVE_VISIBILITY. AC_DEFUN([gl_VISIBILITY], [ AC_REQUIRE([AC_PROG_CC]) CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then AC_MSG_CHECKING([for simple visibility declarations]) AC_CACHE_VAL(gl_cv_cc_visibility, [ gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" AC_TRY_COMPILE( [extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void);], [], gl_cv_cc_visibility=yes, gl_cv_cc_visibility=no) CFLAGS="$gl_save_CFLAGS"]) AC_MSG_RESULT([$gl_cv_cc_visibility]) if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 fi fi AC_SUBST([CFLAG_VISIBILITY]) AC_SUBST([HAVE_VISIBILITY]) AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) ]) # wchar_t.m4 serial 1 (gettext-0.12) dnl Copyright (C) 2002-2003 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 Test whether has the 'wchar_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, [AC_TRY_COMPILE([#include wchar_t foo = (wchar_t)'\0';], , gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) fi ]) # wint_t.m4 serial 2 (gettext-0.17) dnl Copyright (C) 2003, 2007 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 Test whether has the 'wint_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, [AC_TRY_COMPILE([ /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be included before . */ #include #include #include #include wint_t foo = (wchar_t)'\0';], , gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) fi ]) # xsize.m4 serial 3 dnl Copyright (C) 2003-2004 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. AC_DEFUN([gl_XSIZE], [ dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) AC_REQUIRE([AC_C_INLINE]) AC_CHECK_HEADERS(stdint.h) ]) # Copyright (C) 2003, 2004, 2005, 2006 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_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) m4_include([m4/neon/neon-test.m4]) m4_include([m4/neon/neon-xml-parser.m4]) m4_include([m4/neon/neon.m4]) m4_include([m4/inttypes.m4]) m4_include([m4/longlong.m4]) m4_include([m4/prereq.m4]) m4_include([m4/readline.m4]) m4_include([m4/strftime.m4]) cadaver-0.23.3/autogen.sh0000775000076400007640000000071211312007347014625 0ustar jortonjorton#!/bin/sh set -ex rm -rf config.cache autom4te*.cache aclocal.m4 ${ACLOCAL:-aclocal} -I m4 -I m4/neon ${AUTOHEADER:-autoheader} ${AUTOCONF:-autoconf} rm -rf autom4te*.cache rm -rf lib/intl cp -r /usr/share/gettext/intl lib/intl for f in config.guess config.sub; do cp -p /usr/share/libtool/config/$f . done # Set correct top_builddir for bundled gettext sed -i '/^top_builddir/s,\.\.,../..,;s,\.\./config.h,../../config.h,g' \ lib/intl/Makefile.in