Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial import (0.37)

  • Loading branch information...
commit 7dca0e67eb2cbe2223aeac3aad515a8f47c33fda 0 parents
jedwin authored
18 AUTHORS
... ... @@ -0,0 +1,18 @@
  1 +Jed Wing <jedwin@ugcs.caltech.edu>
  2 +includes modified LZX code from cabextract-0.5 by Stuart Caie.
  3 +
  4 +Thanks to:
  5 + iDEFENSE for reporting the stack overflow vulnerability.
  6 + Palasik Sandor for reporting and fixing the LZX buffer overrun vulnerability.
  7 + David Huseby for enhancements to the chm_enumerate functionality.
  8 + Vitaly Bursov for compilation fixes for x86-64.
  9 + Vadim Zeitlin for a patch to clean up and fix some deficiencies in the
  10 + configure script.
  11 + Stan Tobias for bugfixes and index-page improvement to chm_http.
  12 + Andrew Hodgetts for major portability improvement.
  13 + Rich Erwin for his work towards Windows CE support.
  14 + Pabs for bug fixes and suggestions.
  15 + Antony Dovgal for setting up autoconf/automake based build process.
  16 + Ragnar Hojland Espinosa for patches to make chm_http more useful.
  17 + Razvan Cojocaru for forwarding along information regarding building on OS X.
  18 + Anyone else I've forgotten.
510 COPYING
... ... @@ -0,0 +1,510 @@
  1 +
  2 + GNU LESSER GENERAL PUBLIC LICENSE
  3 + Version 2.1, February 1999
  4 +
  5 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
  6 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  7 + Everyone is permitted to copy and distribute verbatim copies
  8 + of this license document, but changing it is not allowed.
  9 +
  10 +[This is the first released version of the Lesser GPL. It also counts
  11 + as the successor of the GNU Library Public License, version 2, hence
  12 + the version number 2.1.]
  13 +
  14 + Preamble
  15 +
  16 + The licenses for most software are designed to take away your
  17 +freedom to share and change it. By contrast, the GNU General Public
  18 +Licenses are intended to guarantee your freedom to share and change
  19 +free software--to make sure the software is free for all its users.
  20 +
  21 + This license, the Lesser General Public License, applies to some
  22 +specially designated software packages--typically libraries--of the
  23 +Free Software Foundation and other authors who decide to use it. You
  24 +can use it too, but we suggest you first think carefully about whether
  25 +this license or the ordinary General Public License is the better
  26 +strategy to use in any particular case, based on the explanations
  27 +below.
  28 +
  29 + When we speak of free software, we are referring to freedom of use,
  30 +not price. Our General Public Licenses are designed to make sure that
  31 +you have the freedom to distribute copies of free software (and charge
  32 +for this service if you wish); that you receive source code or can get
  33 +it if you want it; that you can change the software and use pieces of
  34 +it in new free programs; and that you are informed that you can do
  35 +these things.
  36 +
  37 + To protect your rights, we need to make restrictions that forbid
  38 +distributors to deny you these rights or to ask you to surrender these
  39 +rights. These restrictions translate to certain responsibilities for
  40 +you if you distribute copies of the library or if you modify it.
  41 +
  42 + For example, if you distribute copies of the library, whether gratis
  43 +or for a fee, you must give the recipients all the rights that we gave
  44 +you. You must make sure that they, too, receive or can get the source
  45 +code. If you link other code with the library, you must provide
  46 +complete object files to the recipients, so that they can relink them
  47 +with the library after making changes to the library and recompiling
  48 +it. And you must show them these terms so they know their rights.
  49 +
  50 + We protect your rights with a two-step method: (1) we copyright the
  51 +library, and (2) we offer you this license, which gives you legal
  52 +permission to copy, distribute and/or modify the library.
  53 +
  54 + To protect each distributor, we want to make it very clear that
  55 +there is no warranty for the free library. Also, if the library is
  56 +modified by someone else and passed on, the recipients should know
  57 +that what they have is not the original version, so that the original
  58 +author's reputation will not be affected by problems that might be
  59 +introduced by others.
  60 +^L
  61 + Finally, software patents pose a constant threat to the existence of
  62 +any free program. We wish to make sure that a company cannot
  63 +effectively restrict the users of a free program by obtaining a
  64 +restrictive license from a patent holder. Therefore, we insist that
  65 +any patent license obtained for a version of the library must be
  66 +consistent with the full freedom of use specified in this license.
  67 +
  68 + Most GNU software, including some libraries, is covered by the
  69 +ordinary GNU General Public License. This license, the GNU Lesser
  70 +General Public License, applies to certain designated libraries, and
  71 +is quite different from the ordinary General Public License. We use
  72 +this license for certain libraries in order to permit linking those
  73 +libraries into non-free programs.
  74 +
  75 + When a program is linked with a library, whether statically or using
  76 +a shared library, the combination of the two is legally speaking a
  77 +combined work, a derivative of the original library. The ordinary
  78 +General Public License therefore permits such linking only if the
  79 +entire combination fits its criteria of freedom. The Lesser General
  80 +Public License permits more lax criteria for linking other code with
  81 +the library.
  82 +
  83 + We call this license the "Lesser" General Public License because it
  84 +does Less to protect the user's freedom than the ordinary General
  85 +Public License. It also provides other free software developers Less
  86 +of an advantage over competing non-free programs. These disadvantages
  87 +are the reason we use the ordinary General Public License for many
  88 +libraries. However, the Lesser license provides advantages in certain
  89 +special circumstances.
  90 +
  91 + For example, on rare occasions, there may be a special need to
  92 +encourage the widest possible use of a certain library, so that it
  93 +becomes a de-facto standard. To achieve this, non-free programs must
  94 +be allowed to use the library. A more frequent case is that a free
  95 +library does the same job as widely used non-free libraries. In this
  96 +case, there is little to gain by limiting the free library to free
  97 +software only, so we use the Lesser General Public License.
  98 +
  99 + In other cases, permission to use a particular library in non-free
  100 +programs enables a greater number of people to use a large body of
  101 +free software. For example, permission to use the GNU C Library in
  102 +non-free programs enables many more people to use the whole GNU
  103 +operating system, as well as its variant, the GNU/Linux operating
  104 +system.
  105 +
  106 + Although the Lesser General Public License is Less protective of the
  107 +users' freedom, it does ensure that the user of a program that is
  108 +linked with the Library has the freedom and the wherewithal to run
  109 +that program using a modified version of the Library.
  110 +
  111 + The precise terms and conditions for copying, distribution and
  112 +modification follow. Pay close attention to the difference between a
  113 +"work based on the library" and a "work that uses the library". The
  114 +former contains code derived from the library, whereas the latter must
  115 +be combined with the library in order to run.
  116 +^L
  117 + GNU LESSER GENERAL PUBLIC LICENSE
  118 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  119 +
  120 + 0. This License Agreement applies to any software library or other
  121 +program which contains a notice placed by the copyright holder or
  122 +other authorized party saying it may be distributed under the terms of
  123 +this Lesser General Public License (also called "this License").
  124 +Each licensee is addressed as "you".
  125 +
  126 + A "library" means a collection of software functions and/or data
  127 +prepared so as to be conveniently linked with application programs
  128 +(which use some of those functions and data) to form executables.
  129 +
  130 + The "Library", below, refers to any such software library or work
  131 +which has been distributed under these terms. A "work based on the
  132 +Library" means either the Library or any derivative work under
  133 +copyright law: that is to say, a work containing the Library or a
  134 +portion of it, either verbatim or with modifications and/or translated
  135 +straightforwardly into another language. (Hereinafter, translation is
  136 +included without limitation in the term "modification".)
  137 +
  138 + "Source code" for a work means the preferred form of the work for
  139 +making modifications to it. For a library, complete source code means
  140 +all the source code for all modules it contains, plus any associated
  141 +interface definition files, plus the scripts used to control
  142 +compilation and installation of the library.
  143 +
  144 + Activities other than copying, distribution and modification are not
  145 +covered by this License; they are outside its scope. The act of
  146 +running a program using the Library is not restricted, and output from
  147 +such a program is covered only if its contents constitute a work based
  148 +on the Library (independent of the use of the Library in a tool for
  149 +writing it). Whether that is true depends on what the Library does
  150 +and what the program that uses the Library does.
  151 +
  152 + 1. You may copy and distribute verbatim copies of the Library's
  153 +complete source code as you receive it, in any medium, provided that
  154 +you conspicuously and appropriately publish on each copy an
  155 +appropriate copyright notice and disclaimer of warranty; keep intact
  156 +all the notices that refer to this License and to the absence of any
  157 +warranty; and distribute a copy of this License along with the
  158 +Library.
  159 +
  160 + You may charge a fee for the physical act of transferring a copy,
  161 +and you may at your option offer warranty protection in exchange for a
  162 +fee.
  163 +
  164 + 2. You may modify your copy or copies of the Library or any portion
  165 +of it, thus forming a work based on the Library, and copy and
  166 +distribute such modifications or work under the terms of Section 1
  167 +above, provided that you also meet all of these conditions:
  168 +
  169 + a) The modified work must itself be a software library.
  170 +
  171 + b) You must cause the files modified to carry prominent notices
  172 + stating that you changed the files and the date of any change.
  173 +
  174 + c) You must cause the whole of the work to be licensed at no
  175 + charge to all third parties under the terms of this License.
  176 +
  177 + d) If a facility in the modified Library refers to a function or a
  178 + table of data to be supplied by an application program that uses
  179 + the facility, other than as an argument passed when the facility
  180 + is invoked, then you must make a good faith effort to ensure that,
  181 + in the event an application does not supply such function or
  182 + table, the facility still operates, and performs whatever part of
  183 + its purpose remains meaningful.
  184 +
  185 + (For example, a function in a library to compute square roots has
  186 + a purpose that is entirely well-defined independent of the
  187 + application. Therefore, Subsection 2d requires that any
  188 + application-supplied function or table used by this function must
  189 + be optional: if the application does not supply it, the square
  190 + root function must still compute square roots.)
  191 +
  192 +These requirements apply to the modified work as a whole. If
  193 +identifiable sections of that work are not derived from the Library,
  194 +and can be reasonably considered independent and separate works in
  195 +themselves, then this License, and its terms, do not apply to those
  196 +sections when you distribute them as separate works. But when you
  197 +distribute the same sections as part of a whole which is a work based
  198 +on the Library, the distribution of the whole must be on the terms of
  199 +this License, whose permissions for other licensees extend to the
  200 +entire whole, and thus to each and every part regardless of who wrote
  201 +it.
  202 +
  203 +Thus, it is not the intent of this section to claim rights or contest
  204 +your rights to work written entirely by you; rather, the intent is to
  205 +exercise the right to control the distribution of derivative or
  206 +collective works based on the Library.
  207 +
  208 +In addition, mere aggregation of another work not based on the Library
  209 +with the Library (or with a work based on the Library) on a volume of
  210 +a storage or distribution medium does not bring the other work under
  211 +the scope of this License.
  212 +
  213 + 3. You may opt to apply the terms of the ordinary GNU General Public
  214 +License instead of this License to a given copy of the Library. To do
  215 +this, you must alter all the notices that refer to this License, so
  216 +that they refer to the ordinary GNU General Public License, version 2,
  217 +instead of to this License. (If a newer version than version 2 of the
  218 +ordinary GNU General Public License has appeared, then you can specify
  219 +that version instead if you wish.) Do not make any other change in
  220 +these notices.
  221 +^L
  222 + Once this change is made in a given copy, it is irreversible for
  223 +that copy, so the ordinary GNU General Public License applies to all
  224 +subsequent copies and derivative works made from that copy.
  225 +
  226 + This option is useful when you wish to copy part of the code of
  227 +the Library into a program that is not a library.
  228 +
  229 + 4. You may copy and distribute the Library (or a portion or
  230 +derivative of it, under Section 2) in object code or executable form
  231 +under the terms of Sections 1 and 2 above provided that you accompany
  232 +it with the complete corresponding machine-readable source code, which
  233 +must be distributed under the terms of Sections 1 and 2 above on a
  234 +medium customarily used for software interchange.
  235 +
  236 + If distribution of object code is made by offering access to copy
  237 +from a designated place, then offering equivalent access to copy the
  238 +source code from the same place satisfies the requirement to
  239 +distribute the source code, even though third parties are not
  240 +compelled to copy the source along with the object code.
  241 +
  242 + 5. A program that contains no derivative of any portion of the
  243 +Library, but is designed to work with the Library by being compiled or
  244 +linked with it, is called a "work that uses the Library". Such a
  245 +work, in isolation, is not a derivative work of the Library, and
  246 +therefore falls outside the scope of this License.
  247 +
  248 + However, linking a "work that uses the Library" with the Library
  249 +creates an executable that is a derivative of the Library (because it
  250 +contains portions of the Library), rather than a "work that uses the
  251 +library". The executable is therefore covered by this License.
  252 +Section 6 states terms for distribution of such executables.
  253 +
  254 + When a "work that uses the Library" uses material from a header file
  255 +that is part of the Library, the object code for the work may be a
  256 +derivative work of the Library even though the source code is not.
  257 +Whether this is true is especially significant if the work can be
  258 +linked without the Library, or if the work is itself a library. The
  259 +threshold for this to be true is not precisely defined by law.
  260 +
  261 + If such an object file uses only numerical parameters, data
  262 +structure layouts and accessors, and small macros and small inline
  263 +functions (ten lines or less in length), then the use of the object
  264 +file is unrestricted, regardless of whether it is legally a derivative
  265 +work. (Executables containing this object code plus portions of the
  266 +Library will still fall under Section 6.)
  267 +
  268 + Otherwise, if the work is a derivative of the Library, you may
  269 +distribute the object code for the work under the terms of Section 6.
  270 +Any executables containing that work also fall under Section 6,
  271 +whether or not they are linked directly with the Library itself.
  272 +^L
  273 + 6. As an exception to the Sections above, you may also combine or
  274 +link a "work that uses the Library" with the Library to produce a
  275 +work containing portions of the Library, and distribute that work
  276 +under terms of your choice, provided that the terms permit
  277 +modification of the work for the customer's own use and reverse
  278 +engineering for debugging such modifications.
  279 +
  280 + You must give prominent notice with each copy of the work that the
  281 +Library is used in it and that the Library and its use are covered by
  282 +this License. You must supply a copy of this License. If the work
  283 +during execution displays copyright notices, you must include the
  284 +copyright notice for the Library among them, as well as a reference
  285 +directing the user to the copy of this License. Also, you must do one
  286 +of these things:
  287 +
  288 + a) Accompany the work with the complete corresponding
  289 + machine-readable source code for the Library including whatever
  290 + changes were used in the work (which must be distributed under
  291 + Sections 1 and 2 above); and, if the work is an executable linked
  292 + with the Library, with the complete machine-readable "work that
  293 + uses the Library", as object code and/or source code, so that the
  294 + user can modify the Library and then relink to produce a modified
  295 + executable containing the modified Library. (It is understood
  296 + that the user who changes the contents of definitions files in the
  297 + Library will not necessarily be able to recompile the application
  298 + to use the modified definitions.)
  299 +
  300 + b) Use a suitable shared library mechanism for linking with the
  301 + Library. A suitable mechanism is one that (1) uses at run time a
  302 + copy of the library already present on the user's computer system,
  303 + rather than copying library functions into the executable, and (2)
  304 + will operate properly with a modified version of the library, if
  305 + the user installs one, as long as the modified version is
  306 + interface-compatible with the version that the work was made with.
  307 +
  308 + c) Accompany the work with a written offer, valid for at least
  309 + three years, to give the same user the materials specified in
  310 + Subsection 6a, above, for a charge no more than the cost of
  311 + performing this distribution.
  312 +
  313 + d) If distribution of the work is made by offering access to copy
  314 + from a designated place, offer equivalent access to copy the above
  315 + specified materials from the same place.
  316 +
  317 + e) Verify that the user has already received a copy of these
  318 + materials or that you have already sent this user a copy.
  319 +
  320 + For an executable, the required form of the "work that uses the
  321 +Library" must include any data and utility programs needed for
  322 +reproducing the executable from it. However, as a special exception,
  323 +the materials to be distributed need not include anything that is
  324 +normally distributed (in either source or binary form) with the major
  325 +components (compiler, kernel, and so on) of the operating system on
  326 +which the executable runs, unless that component itself accompanies
  327 +the executable.
  328 +
  329 + It may happen that this requirement contradicts the license
  330 +restrictions of other proprietary libraries that do not normally
  331 +accompany the operating system. Such a contradiction means you cannot
  332 +use both them and the Library together in an executable that you
  333 +distribute.
  334 +^L
  335 + 7. You may place library facilities that are a work based on the
  336 +Library side-by-side in a single library together with other library
  337 +facilities not covered by this License, and distribute such a combined
  338 +library, provided that the separate distribution of the work based on
  339 +the Library and of the other library facilities is otherwise
  340 +permitted, and provided that you do these two things:
  341 +
  342 + a) Accompany the combined library with a copy of the same work
  343 + based on the Library, uncombined with any other library
  344 + facilities. This must be distributed under the terms of the
  345 + Sections above.
  346 +
  347 + b) Give prominent notice with the combined library of the fact
  348 + that part of it is a work based on the Library, and explaining
  349 + where to find the accompanying uncombined form of the same work.
  350 +
  351 + 8. You may not copy, modify, sublicense, link with, or distribute
  352 +the Library except as expressly provided under this License. Any
  353 +attempt otherwise to copy, modify, sublicense, link with, or
  354 +distribute the Library is void, and will automatically terminate your
  355 +rights under this License. However, parties who have received copies,
  356 +or rights, from you under this License will not have their licenses
  357 +terminated so long as such parties remain in full compliance.
  358 +
  359 + 9. You are not required to accept this License, since you have not
  360 +signed it. However, nothing else grants you permission to modify or
  361 +distribute the Library or its derivative works. These actions are
  362 +prohibited by law if you do not accept this License. Therefore, by
  363 +modifying or distributing the Library (or any work based on the
  364 +Library), you indicate your acceptance of this License to do so, and
  365 +all its terms and conditions for copying, distributing or modifying
  366 +the Library or works based on it.
  367 +
  368 + 10. Each time you redistribute the Library (or any work based on the
  369 +Library), the recipient automatically receives a license from the
  370 +original licensor to copy, distribute, link with or modify the Library
  371 +subject to these terms and conditions. You may not impose any further
  372 +restrictions on the recipients' exercise of the rights granted herein.
  373 +You are not responsible for enforcing compliance by third parties with
  374 +this License.
  375 +^L
  376 + 11. If, as a consequence of a court judgment or allegation of patent
  377 +infringement or for any other reason (not limited to patent issues),
  378 +conditions are imposed on you (whether by court order, agreement or
  379 +otherwise) that contradict the conditions of this License, they do not
  380 +excuse you from the conditions of this License. If you cannot
  381 +distribute so as to satisfy simultaneously your obligations under this
  382 +License and any other pertinent obligations, then as a consequence you
  383 +may not distribute the Library at all. For example, if a patent
  384 +license would not permit royalty-free redistribution of the Library by
  385 +all those who receive copies directly or indirectly through you, then
  386 +the only way you could satisfy both it and this License would be to
  387 +refrain entirely from distribution of the Library.
  388 +
  389 +If any portion of this section is held invalid or unenforceable under
  390 +any particular circumstance, the balance of the section is intended to
  391 +apply, and the section as a whole is intended to apply in other
  392 +circumstances.
  393 +
  394 +It is not the purpose of this section to induce you to infringe any
  395 +patents or other property right claims or to contest validity of any
  396 +such claims; this section has the sole purpose of protecting the
  397 +integrity of the free software distribution system which is
  398 +implemented by public license practices. Many people have made
  399 +generous contributions to the wide range of software distributed
  400 +through that system in reliance on consistent application of that
  401 +system; it is up to the author/donor to decide if he or she is willing
  402 +to distribute software through any other system and a licensee cannot
  403 +impose that choice.
  404 +
  405 +This section is intended to make thoroughly clear what is believed to
  406 +be a consequence of the rest of this License.
  407 +
  408 + 12. If the distribution and/or use of the Library is restricted in
  409 +certain countries either by patents or by copyrighted interfaces, the
  410 +original copyright holder who places the Library under this License
  411 +may add an explicit geographical distribution limitation excluding those
  412 +countries, so that distribution is permitted only in or among
  413 +countries not thus excluded. In such case, this License incorporates
  414 +the limitation as if written in the body of this License.
  415 +
  416 + 13. The Free Software Foundation may publish revised and/or new
  417 +versions of the Lesser General Public License from time to time.
  418 +Such new versions will be similar in spirit to the present version,
  419 +but may differ in detail to address new problems or concerns.
  420 +
  421 +Each version is given a distinguishing version number. If the Library
  422 +specifies a version number of this License which applies to it and
  423 +"any later version", you have the option of following the terms and
  424 +conditions either of that version or of any later version published by
  425 +the Free Software Foundation. If the Library does not specify a
  426 +license version number, you may choose any version ever published by
  427 +the Free Software Foundation.
  428 +^L
  429 + 14. If you wish to incorporate parts of the Library into other free
  430 +programs whose distribution conditions are incompatible with these,
  431 +write to the author to ask for permission. For software which is
  432 +copyrighted by the Free Software Foundation, write to the Free
  433 +Software Foundation; we sometimes make exceptions for this. Our
  434 +decision will be guided by the two goals of preserving the free status
  435 +of all derivatives of our free software and of promoting the sharing
  436 +and reuse of software generally.
  437 +
  438 + NO WARRANTY
  439 +
  440 + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
  441 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
  442 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
  443 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
  444 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  445 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  446 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  447 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
  448 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  449 +
  450 + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  451 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
  452 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
  453 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  454 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
  455 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  456 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  457 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
  458 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  459 +DAMAGES.
  460 +
  461 + END OF TERMS AND CONDITIONS
  462 +^L
  463 + How to Apply These Terms to Your New Libraries
  464 +
  465 + If you develop a new library, and you want it to be of the greatest
  466 +possible use to the public, we recommend making it free software that
  467 +everyone can redistribute and change. You can do so by permitting
  468 +redistribution under these terms (or, alternatively, under the terms
  469 +of the ordinary General Public License).
  470 +
  471 + To apply these terms, attach the following notices to the library.
  472 +It is safest to attach them to the start of each source file to most
  473 +effectively convey the exclusion of warranty; and each file should
  474 +have at least the "copyright" line and a pointer to where the full
  475 +notice is found.
  476 +
  477 +
  478 + <one line to give the library's name and a brief idea of what it does.>
  479 + Copyright (C) <year> <name of author>
  480 +
  481 + This library is free software; you can redistribute it and/or
  482 + modify it under the terms of the GNU Lesser General Public
  483 + License as published by the Free Software Foundation; either
  484 + version 2.1 of the License, or (at your option) any later version.
  485 +
  486 + This library is distributed in the hope that it will be useful,
  487 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  488 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  489 + Lesser General Public License for more details.
  490 +
  491 + You should have received a copy of the GNU Lesser General Public
  492 + License along with this library; if not, write to the Free Software
  493 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  494 +
  495 +Also add information on how to contact you by electronic and paper mail.
  496 +
  497 +You should also get your employer (if you work as a programmer) or
  498 +your school, if any, to sign a "copyright disclaimer" for the library,
  499 +if necessary. Here is a sample; alter the names:
  500 +
  501 + Yoyodyne, Inc., hereby disclaims all copyright interest in the
  502 + library `Frob' (a library for tweaking knobs) written by James
  503 + Random Hacker.
  504 +
  505 + <signature of Ty Coon>, 1 April 1990
  506 + Ty Coon, President of Vice
  507 +
  508 +That's all there is to it!
  509 +
  510 +
BIN  ChmLib-ce.zip
Binary file not shown
BIN  ChmLib-ds6.zip
Binary file not shown
124 INSTALL
... ... @@ -0,0 +1,124 @@
  1 +CHMLIB 0.3 Installation
  2 +=======================
  3 +
  4 +-----
  5 +Linux/Unix and Windows (Cygwin)
  6 +-----
  7 +
  8 +I. Relevant options:
  9 +
  10 + CHM_MT: build library with synchronization for thread-safety
  11 + CHM_USE_PREAD: use pread instead of lseek/read
  12 + CHM_USE_IO64: support 64-bit file I/O
  13 +
  14 + Modify the INSTALLPREFIX to change the installation location.
  15 +
  16 + Except on platforms where they need to be disabled, I recommend leaving all
  17 + three options enabled. OS X, however, in particular, seems to need pread
  18 + and io64 disabled.
  19 +
  20 +II. autoconf/automake-style build
  21 +
  22 + ./configure [options]
  23 + make
  24 + su
  25 + make install
  26 +
  27 +III. old-style (plain Makefile) build
  28 +
  29 + cd src
  30 + <edit Makefile.simple if necessary>
  31 + make -f Makefile.old
  32 + su
  33 + make install
  34 +
  35 +To use the library, see chm_lib.h, and the included example programs:
  36 +
  37 + test_chmLib.c
  38 + enum_chmLib.c
  39 + chm_http.c
  40 +
  41 +-------
  42 +Windows (MSVC++, Win CE SDK)
  43 +-------
  44 +
  45 +I. Relevant options:
  46 +
  47 + CHM_MT: build library with synchronization for thread-safety
  48 +
  49 +II. Windows Standard Build
  50 +
  51 + Unzip ChmLib-vs6.zip in the src directory, and open the ChmLib.dsw file in
  52 + Developer Studio. (This was developed on Developer Studio 6. I don't know
  53 + if that matters.) You may wish to enable or disable certain features by
  54 + adding preprocessor defines under the project settings dialog:
  55 +
  56 + CHM_MT: build library with synchronization for thread-safety
  57 +
  58 + CHM_MT is enabled by default in the Windows build.
  59 +
  60 + The resultant library is called chmlib.lib.
  61 +
  62 + To use the library, see chm_lib.h, and the included example programs:
  63 +
  64 + test_chmLib.c
  65 + enum_chmLib.c
  66 + chm_http.c
  67 +
  68 + The example programs should also show up in the Visual Studio workspace,
  69 + except for chm_http. I don't know enough about Windows network programming
  70 + to try to get that one working. Other than that one, all the other examples
  71 + run without any problems.
  72 +
  73 +III. Windows CE Build
  74 +
  75 + Unzip ChmLib-ce.zip in the src directory. I don't know much beyond that,
  76 + as I have no familiarity with Windows CE, but this should be a good
  77 + starting point. These project files are from Rich Erwin, who also supplied
  78 + the necessary code changes to get it running.
  79 +
  80 +Sparc (Solaris)
  81 +---------------
  82 + Andrew Hodgetts has gotten the library compilable and working on Sparc
  83 +Solaris machines, with CPUs ranging from a Sun4m (Sparc5) up through an
  84 +UltraSparcIII (SunFireV880). He has managed the compilation using both GCC and
  85 +SunProC, although, he notes, some modification to the Makefile was required,
  86 +since SunProC does not understand the -fPIC flag, which GCC uses for Position
  87 +Independent Code.
  88 +
  89 +MIPS (SGI Irix)
  90 +---------------
  91 + Andrew Hodgetts has gotten the library compilable and working on SGI MIPS
  92 +machines running Irix; this was using only the standard MIPS compiler, not GCC.
  93 +He reported that the -n32 flag was required in the Makefile. He also reported
  94 +that the MIPS compiler was fairly verbose with the warning messages, but that
  95 +the simple examples that came with the library seemed to work.
  96 +
  97 +OS X
  98 +----
  99 + Apparently, various people have gotten the library compiled for OS X. From
  100 +what I've heard, the secret is to disable pread and io64, and possibly to use
  101 +the 'libtool' from fink, instead of the one included with the standard
  102 +developers kit.
  103 +
  104 +BSD variants
  105 +----
  106 + I've heard that the library has been compiled on BSD variants. I haven't
  107 +heard of any particular difficulties.
  108 +
  109 +Other Unix variants
  110 +-------------------
  111 + The code has been written with an eye on portability. Presently, I've only
  112 +personally compiled on Linux and Windows, albeit on a variety of Linux
  113 +configurations, but, as reported above, Andrew Hodgetts has reported successful
  114 +use of the library on both Solaris machines and MIPS machines.. After I get
  115 +version 0.3 out, I may try to get it compiling on some of the machines I have
  116 +at work. This code may or may not compile out of the box with, for instance,
  117 +*BSD or other Unix variants. I welcome any patches that increase the
  118 +portability of this code.
  119 +
  120 + Platforms that I have access to at work, and may attempt to support after
  121 +version 0.3:
  122 +
  123 + - AIX
  124 + - maybe Tru64
58 Makefile.in
... ... @@ -0,0 +1,58 @@
  1 +
  2 +## Available defines for building chm_lib with particular options
  3 +# CHM_MT: build thread-safe version of chm_lib
  4 +# CHM_USE_PREAD: build chm_lib to use pread/pread64 for all I/O
  5 +# CHM_USE_IO64: build chm_lib to support 64-bit file I/O
  6 +#
  7 +# Note: LDFLAGS must contain -lpthread if you are using -DCHM_MT.
  8 +#
  9 +#CFLAGS=-DCHM_MT -DCHM_USE_PREAD -DCHM_USE_IO64
  10 +#CFLAGS=-DCHM_MT -DCHM_USE_PREAD -DCHM_USE_IO64 -g -DDMALLOC_DISABLE
  11 +CFLAGS=@CFLAGS@ @CHM_MT@ @CHM_USE_PREAD@ @CHM_USE_IO64@ @DMALLOC_DISABLE@
  12 +LDFLAGS=@LDFLAGS@
  13 +prefix=@prefix@
  14 +libdir=@libdir@
  15 +exec_prefix=@exec_prefix@
  16 +includedir=@includedir@
  17 +CC=@CC@
  18 +top_builddir=@top_builddir@
  19 +ifeq ($(top_builddir),)
  20 +top_builddir=$(shell pwd)
  21 +endif
  22 +srcdir=@srcdir@
  23 +LIBTOOL=@LIBTOOL@
  24 +EXAMPLES=@EXAMPLES@
  25 +
  26 +all: src/libchm.la
  27 +
  28 +examples: ${EXAMPLES}
  29 +
  30 +src/%.lo: $(srcdir)/src/%.c
  31 + ${LIBTOOL} --mode=compile ${CC} -c -o $@ $^ ${CFLAGS}
  32 +
  33 +src/libchm.la: src/chm_lib.lo src/lzx.lo
  34 + ${LIBTOOL} --mode=link ${CC} -o $@ $^ ${LDFLAGS} -rpath $(libdir)
  35 +
  36 +install: src/libchm.la
  37 + mkdir -p $(DESTDIR)$(prefix) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
  38 + ${LIBTOOL} --mode=install install -m0755 src/libchm.la $(DESTDIR)$(libdir)/
  39 + install -m0644 $(srcdir)/src/chm_lib.h $(DESTDIR)$(includedir)/
  40 +
  41 +clean:
  42 + rm -fr src/libchm.la src/*.o src/*.lo .libs src/.libs src/${EXAMPLES}
  43 +
  44 +test_chmLib: $(srcdir)/src/test_chmLib.c
  45 + ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
  46 +
  47 +enum_chmLib: $(srcdir)/src/enum_chmLib.c
  48 + ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
  49 +
  50 +enumdir_chmLib: $(srcdir)/src/enumdir_chmLib.c
  51 + ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
  52 +
  53 +extract_chmLib: $(srcdir)/src/extract_chmLib.c
  54 + ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
  55 +
  56 +chm_http: $(srcdir)/src/chm_http.c
  57 + ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm -lpthread ${CFLAGS}
  58 +
58 NEWS
... ... @@ -0,0 +1,58 @@
  1 +Changes from 0.36 to 0.37
  2 + - Major security fix for stack overflow vulnerability:
  3 + http://www.sven-tantau.de/public_files/chmlib/chmlib_20051126.txt
  4 + - Corrected the broken Makefile.in.
  5 +
  6 +Changes from 0.35 to 0.36
  7 + - Major security fix (iDEFENSE Security Advisory IDEF1099 - Stack Overflow
  8 + Vulnerability)
  9 + - Major security fix from Palasik Sandor (LZX decompression buffer overrun)
  10 + - Bugfix/enhancement from David Huseby to make the "what" flags to
  11 + chm_enumerate work correctly, and to pass the flags along to the callback
  12 + function (via the chmUnitInfo structure) so that the callback doesn't
  13 + need to re-parse the filename.
  14 + - Compilation fixes for x86-64 from Vitaly V. Bursov.
  15 + - Miscellaneous fixes to the configure script, including some significant
  16 + cleanup by Vadim Zeitlin. The changes from Vadim should also allow the
  17 + configure script to correctly configure the build on OS X, where it was
  18 + previously failing to note that pread64 doesn't work.
  19 + - Minor update to the Makefile.in to do a mkdir before the install, in case
  20 + the specified INSTALLPREFIX directory is non-existent
  21 +
  22 +Changes from 0.32 to 0.35
  23 + - UTF-8 filenames, while still not handled correctly, are handled a little
  24 + more gracefully. That is to say, the library doesn't fail to open files
  25 + with filenames using characters outside the ASCII subset. I'm very
  26 + interested in any information as to the "right" way to handle filenames
  27 + of this sort.
  28 + - Files not containing a compressed section are handled properly, such as
  29 + .chw files. These files seem to contain information about compression,
  30 + but the information is invalid or empty. The library deals gracefully
  31 + with this now.
  32 + - Files compressed with different options were not being decompressed
  33 + properly. In particular, if the "reset interval" for the compressed
  34 + section was other than 2 block sizes, it could fail to read some of the
  35 + files.
  36 + - The caching system was improved slightly, in conjunction with this
  37 + previous bugfix.
  38 +
  39 +Changes from 0.3 to 0.32:
  40 + - [Rich Erwin] Minor portability fixes for Windows CE.
  41 + - [Pabs] Minor bugfix regarding detecting directory entries versus empty files.
  42 + - [Antony Dovgal] autoconf-based build process
  43 + - [Ragnar Hojland Espinosa] Feature additions for chm_http:
  44 + * Use SO_REUSEADDR
  45 + * Allow --bind= and --port= command line arguments
  46 + - Simple makefile has been fixed (finally) to use gcc instead of gcc-3.2. (Sorry, everybody!)
  47 +
  48 +Changes from 0.2 to 0.3:
  49 +
  50 + - initial attempt at portability to Win32.
  51 + - bugfixes from Stan Tobias:
  52 + * memory corruption error with caching system
  53 + * case insensitivity, to match with the Windows semantics
  54 + - modification to chm_http by Stan Tobias:
  55 + * when the user requests the page '/', they get a page with links to
  56 + all of the files in the archive
  57 + - Andrew Hodgetts has ported the library to Solaris and Irix. See README for details.
  58 + - Stuart Caie has granted permission to relicense under the LGPL.
129 README
... ... @@ -0,0 +1,129 @@
  1 +CHMLIB 0.37
  2 +===========
  3 +
  4 +-------
  5 +SUMMARY
  6 +-------
  7 +chmlib is a small library designed for accessing MS ITSS files. The ITSS file
  8 +format is used for Microsoft Html Help files (.chm), which have been the
  9 +predominant medium for software documentation from Microsoft during the past
  10 +several years, having superceded the previously used .hlp file format.
  11 +
  12 +Note that this is NOT the same as the OLE structured storage file format used
  13 +by MS Excel, Word, and so on. Instead, it is a different file format which
  14 +fulfills a similar purpose. Both file formats may be accessed via instances
  15 +of the IStorage COM interface, which is essentially an "acts like a
  16 +filesystem" interface.
  17 +
  18 +-------
  19 +FILE FORMAT SUPPORT
  20 +-------
  21 +
  22 +Lookup of files in the archive is supported, and should be relatively quick.
  23 +Reading of files in the archive is also supported.
  24 +Writing is not supported, but may be added in the future.
  25 +
  26 +In terms of support for the ITSS file format, there are a few places in which
  27 +the support provided by this library is not fully general:
  28 +
  29 +1. ITSS files whose names contain UTF-8 characters which are not part of the
  30 + ASCII subset will not currently be dealt with gracefully. Currently, the
  31 + filenames are not converted from UTF-8, but are instead returned as-is. I'm
  32 + very interested in hearing any suggestions as to the "right" way to handle
  33 + this.
  34 +
  35 +2. Only version 3 ITSS files are supported at present, though some work has
  36 + gone towards divining the differences between different versions of the
  37 + file format. It is possible that version 2 ITSS files might work properly
  38 + with this library, but unconfirmed.
  39 +
  40 +3. Archives larger than 4 GB should be supported just fine, but if they
  41 + contain files larger than 4GB, this library may break. Fortunately, this
  42 + seems somewhat unlikely.
  43 +
  44 +If you run into .chm files (or files you suspect are ITSS files) that this
  45 +library doesn't work with, please contact me so I can fix the library.
  46 +
  47 +-------
  48 +PORTABILITY
  49 +-------
  50 +
  51 +This software was originally developed on a Intel x86 Debian Linux machine,
  52 +using gcc 3.0. It has since been compiled on various flavors of RedHat as
  53 +well, and using versions of gcc from 2.95 through 3.2. Basic Win32 support
  54 +should be in this release. (While a port to Win32 may _seem_ like a funny
  55 +idea, given that Windows ships with libraries for CHM access, it turns out that
  56 +Win CE does not; I've gotten a request for a port to Windows CE.)
  57 +
  58 +Chmlib apparently works on OS X, with some tweaks. In particular, disabling
  59 +pread and io64 apparently works.
  60 +
  61 +Finally, Andrew Hodgetts has ported to Solaris and IRIX:
  62 +
  63 +On Monday, 7 Oct 2002, Andrew Hodgetts wrote:
  64 +> Solaris(Sun):
  65 +>
  66 +> I used both SunProC and GCC on the solaris machines to compile. They
  67 +> both worked ok.
  68 +> However, both required -lsocket on the link line of the Makefile or you
  69 +> recieve linking errors.
  70 +>
  71 +> I have this working on CPUs ranging from Sun4m (Sparc5) through to
  72 +> UltraSparcIII (SunFireV880).
  73 +>
  74 +> Irix (SGI):
  75 +>
  76 +> I only testing with the MIPS compiler (not GCC). All worked ok - lots of
  77 +> warning messages, but it always does that.
  78 +
  79 +He further noted that:
  80 +
  81 +> ... for NON GCC compilers, a little tweaking may be required, but nothing too
  82 +> complex. ie SunProC doesn't understand -fPIC for library building. Irix
  83 +> required -n32 (new 32bit libraries) etc. These are things that someone who
  84 +> uses the OS and compiler should be used to dealing with.
  85 +
  86 +-------
  87 +CREDITS
  88 +-------
  89 +
  90 +* Stuart Caie: the LZX decompression code, and for granting permission to
  91 + re-license under the LGPL.
  92 +
  93 +* Sven Tantau: identification of a stack-overflow security flaw and a quick fix
  94 + for the problem.
  95 +
  96 +* iDEFENSE Labs: identification of a nasty stack-overflow security flaw
  97 +
  98 +* Palasik Sandor: identification of a potential security flaw in lzx.c as well
  99 + as a quick fix for the problem
  100 +
  101 +* David Huseby: An excellent patch to the chm_enumerate functionality, relating
  102 + to the "what" flags, which didn't work entirely correctly before
  103 +
  104 +* Vadim Zeitlin: Configure script cleanup, including an important update to
  105 + allow detection of platforms where pread64 doesn't work. (OS X)
  106 +
  107 +* Vitaly V. Bursov: Compilation on x86-64.
  108 +
  109 +* mc: A suggestion to add a "mkdir" to the install step.
  110 +
  111 +* Stan Tobias: bugfixes and the added 'index page' feature of chm_http.
  112 +
  113 +* Andrew Hodgetts: porting to Solaris and IRIX, as well as fixing some
  114 + little-endian biases in the code.
  115 +
  116 +* Rich Erwin: Windows CE support.
  117 +
  118 +* Pabs: bug fixes and suggestions.
  119 +
  120 +* Antony Dovgal: setting up autoconf/automake based build process.
  121 +
  122 +* Ragnar Hojland Espinosa: patches to make chm_http more useful.
  123 +
  124 +* Razvan Cojocaru: forwarding along information regarding building on OS X.
  125 +
  126 +* Julien Lemoine: creating and maintaining the Debian package of chmlib.
  127 +
  128 +* Anyone else I've forgotten. (?)
  129 +
6,737 aclocal.m4
6,737 additions, 0 deletions not shown
1,402 config.guess
... ... @@ -0,0 +1,1402 @@
  1 +#! /bin/sh
  2 +# Attempt to guess a canonical system name.
  3 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
  4 +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
  5 +
  6 +timestamp='2003-01-02'
  7 +
  8 +# This file is free software; you can redistribute it and/or modify it
  9 +# under the terms of the GNU General Public License as published by
  10 +# the Free Software Foundation; either version 2 of the License, or
  11 +# (at your option) any later version.
  12 +#
  13 +# This program is distributed in the hope that it will be useful, but
  14 +# WITHOUT ANY WARRANTY; without even the implied warranty of
  15 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16 +# General Public License for more details.
  17 +#
  18 +# You should have received a copy of the GNU General Public License
  19 +# along with this program; if not, write to the Free Software
  20 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21 +#
  22 +# As a special exception to the GNU General Public License, if you
  23 +# distribute this file as part of a program that contains a
  24 +# configuration script generated by Autoconf, you may include it under
  25 +# the same distribution terms that you use for the rest of that program.
  26 +
  27 +# Originally written by Per Bothner <per@bothner.com>.
  28 +# Please send patches to <config-patches@gnu.org>. Submit a context
  29 +# diff and a properly formatted ChangeLog entry.
  30 +#
  31 +# This script attempts to guess a canonical system name similar to
  32 +# config.sub. If it succeeds, it prints the system name on stdout, and
  33 +# exits with 0. Otherwise, it exits with 1.
  34 +#
  35 +# The plan is that this can be called by configure scripts if you
  36 +# don't specify an explicit build system type.
  37 +
  38 +me=`echo "$0" | sed -e 's,.*/,,'`
  39 +
  40 +usage="\
  41 +Usage: $0 [OPTION]
  42 +
  43 +Output the configuration name of the system \`$me' is run on.
  44 +
  45 +Operation modes:
  46 + -h, --help print this help, then exit
  47 + -t, --time-stamp print date of last modification, then exit
  48 + -v, --version print version number, then exit
  49 +
  50 +Report bugs and patches to <config-patches@gnu.org>."
  51 +
  52 +version="\
  53 +GNU config.guess ($timestamp)
  54 +
  55 +Originally written by Per Bothner.
  56 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
  57 +Free Software Foundation, Inc.
  58 +
  59 +This is free software; see the source for copying conditions. There is NO
  60 +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  61 +
  62 +help="
  63 +Try \`$me --help' for more information."
  64 +
  65 +# Parse command line
  66 +while test $# -gt 0 ; do
  67 + case $1 in
  68 + --time-stamp | --time* | -t )
  69 + echo "$timestamp" ; exit 0 ;;
  70 + --version | -v )
  71 + echo "$version" ; exit 0 ;;
  72 + --help | --h* | -h )
  73 + echo "$usage"; exit 0 ;;
  74 + -- ) # Stop option processing
  75 + shift; break ;;
  76 + - ) # Use stdin as input.
  77 + break ;;
  78 + -* )
  79 + echo "$me: invalid option $1$help" >&2
  80 + exit 1 ;;
  81 + * )
  82 + break ;;
  83 + esac
  84 +done
  85 +
  86 +if test $# != 0; then
  87 + echo "$me: too many arguments$help" >&2
  88 + exit 1
  89 +fi
  90 +
  91 +trap 'exit 1' 1 2 15
  92 +
  93 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
  94 +# compiler to aid in system detection is discouraged as it requires
  95 +# temporary files to be created and, as you can see below, it is a
  96 +# headache to deal with in a portable fashion.
  97 +
  98 +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
  99 +# use `HOST_CC' if defined, but it is deprecated.
  100 +
  101 +# Portable tmp directory creation inspired by the Autoconf team.
  102 +
  103 +set_cc_for_build='
  104 +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
  105 +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
  106 +: ${TMPDIR=/tmp} ;
  107 + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  108 + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
  109 + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
  110 +dummy=$tmp/dummy ;
  111 +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
  112 +case $CC_FOR_BUILD,$HOST_CC,$CC in
  113 + ,,) echo "int x;" > $dummy.c ;
  114 + for c in cc gcc c89 c99 ; do
  115 + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
  116 + CC_FOR_BUILD="$c"; break ;
  117 + fi ;
  118 + done ;
  119 + if test x"$CC_FOR_BUILD" = x ; then
  120 + CC_FOR_BUILD=no_compiler_found ;
  121 + fi
  122 + ;;
  123 + ,,*) CC_FOR_BUILD=$CC ;;
  124 + ,*,*) CC_FOR_BUILD=$HOST_CC ;;
  125 +esac ;'
  126 +
  127 +# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
  128 +# (ghazi@noc.rutgers.edu 1994-08-24)
  129 +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
  130 + PATH=$PATH:/.attbin ; export PATH
  131 +fi
  132 +
  133 +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
  134 +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
  135 +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
  136 +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
  137 +
  138 +# Note: order is significant - the case branches are not exclusive.
  139 +
  140 +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
  141 + *:NetBSD:*:*)
  142 + # NetBSD (nbsd) targets should (where applicable) match one or
  143 + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
  144 + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
  145 + # switched to ELF, *-*-netbsd* would select the old
  146 + # object file format. This provides both forward
  147 + # compatibility and a consistent mechanism for selecting the
  148 + # object file format.
  149 + #
  150 + # Note: NetBSD doesn't particularly care about the vendor
  151 + # portion of the name. We always set it to "unknown".
  152 + sysctl="sysctl -n hw.machine_arch"
  153 + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
  154 + /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
  155 + case "${UNAME_MACHINE_ARCH}" in
  156 + armeb) machine=armeb-unknown ;;
  157 + arm*) machine=arm-unknown ;;
  158 + sh3el) machine=shl-unknown ;;
  159 + sh3eb) machine=sh-unknown ;;
  160 + *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
  161 + esac
  162 + # The Operating System including object format, if it has switched
  163 + # to ELF recently, or will in the future.
  164 + case "${UNAME_MACHINE_ARCH}" in
  165 + arm*|i386|m68k|ns32k|sh3*|sparc|vax)
  166 + eval $set_cc_for_build
  167 + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
  168 + | grep __ELF__ >/dev/null
  169 + then
  170 + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
  171 + # Return netbsd for either. FIX?
  172 + os=netbsd
  173 + else
  174 + os=netbsdelf
  175 + fi
  176 + ;;
  177 + *)
  178 + os=netbsd
  179 + ;;
  180 + esac
  181 + # The OS release
  182 + # Debian GNU/NetBSD machines have a different userland, and
  183 + # thus, need a distinct triplet. However, they do not need
  184 + # kernel version information, so it can be replaced with a
  185 + # suitable tag, in the style of linux-gnu.
  186 + case "${UNAME_VERSION}" in
  187 + Debian*)
  188 + release='-gnu'
  189 + ;;
  190 + *)
  191 + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  192 + ;;
  193 + esac
  194 + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
  195 + # contains redundant information, the shorter form:
  196 + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
  197 + echo "${machine}-${os}${release}"
  198 + exit 0 ;;
  199 + amiga:OpenBSD:*:*)
  200 + echo m68k-unknown-openbsd${UNAME_RELEASE}
  201 + exit 0 ;;
  202 + arc:OpenBSD:*:*)
  203 + echo mipsel-unknown-openbsd${UNAME_RELEASE}
  204 + exit 0 ;;
  205 + hp300:OpenBSD:*:*)
  206 + echo m68k-unknown-openbsd${UNAME_RELEASE}
  207 + exit 0 ;;
  208 + mac68k:OpenBSD:*:*)
  209 + echo m68k-unknown-openbsd${UNAME_RELEASE}
  210 + exit 0 ;;
  211 + macppc:OpenBSD:*:*)
  212 + echo powerpc-unknown-openbsd${UNAME_RELEASE}
  213 + exit 0 ;;
  214 + mvme68k:OpenBSD:*:*)
  215 + echo m68k-unknown-openbsd${UNAME_RELEASE}
  216 + exit 0 ;;
  217 + mvme88k:OpenBSD:*:*)
  218 + echo m88k-unknown-openbsd${UNAME_RELEASE}
  219 + exit 0 ;;
  220 + mvmeppc:OpenBSD:*:*)
  221 + echo powerpc-unknown-openbsd${UNAME_RELEASE}
  222 + exit 0 ;;
  223 + pmax:OpenBSD:*:*)
  224 + echo mipsel-unknown-openbsd${UNAME_RELEASE}
  225 + exit 0 ;;
  226 + sgi:OpenBSD:*:*)
  227 + echo mipseb-unknown-openbsd${UNAME_RELEASE}
  228 + exit 0 ;;
  229 + sun3:OpenBSD:*:*)
  230 + echo m68k-unknown-openbsd${UNAME_RELEASE}
  231 + exit 0 ;;
  232 + wgrisc:OpenBSD:*:*)
  233 + echo mipsel-unknown-openbsd${UNAME_RELEASE}
  234 + exit 0 ;;
  235 + *:OpenBSD:*:*)
  236 + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
  237 + exit 0 ;;
  238 + alpha:OSF1:*:*)
  239 + if test $UNAME_RELEASE = "V4.0"; then
  240 + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
  241 + fi
  242 + # A Vn.n version is a released version.
  243 + # A Tn.n version is a released field test version.
  244 + # A Xn.n version is an unreleased experimental baselevel.
  245 + # 1.2 uses "1.2" for uname -r.
  246 + eval $set_cc_for_build
  247 + cat <<EOF >$dummy.s
  248 + .data
  249 +\$Lformat:
  250 + .byte 37,100,45,37,120,10,0 # "%d-%x\n"
  251 +
  252 + .text
  253 + .globl main
  254 + .align 4
  255 + .ent main
  256 +main:
  257 + .frame \$30,16,\$26,0
  258 + ldgp \$29,0(\$27)
  259 + .prologue 1
  260 + .long 0x47e03d80 # implver \$0
  261 + lda \$2,-1
  262 + .long 0x47e20c21 # amask \$2,\$1
  263 + lda \$16,\$Lformat
  264 + mov \$0,\$17
  265 + not \$1,\$18
  266 + jsr \$26,printf
  267 + ldgp \$29,0(\$26)
  268 + mov 0,\$16
  269 + jsr \$26,exit
  270 + .end main
  271 +EOF
  272 + $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
  273 + if test "$?" = 0 ; then
  274 + case `$dummy` in
  275 + 0-0)
  276 + UNAME_MACHINE="alpha"
  277 + ;;
  278 + 1-0)
  279 + UNAME_MACHINE="alphaev5"
  280 + ;;
  281 + 1-1)
  282 + UNAME_MACHINE="alphaev56"
  283 + ;;
  284 + 1-101)
  285 + UNAME_MACHINE="alphapca56"
  286 + ;;
  287 + 2-303)
  288 + UNAME_MACHINE="alphaev6"
  289 + ;;
  290 + 2-307)
  291 + UNAME_MACHINE="alphaev67"
  292 + ;;
  293 + 2-1307)
  294 + UNAME_MACHINE="alphaev68"
  295 + ;;
  296 + 3-1307)
  297 + UNAME_MACHINE="alphaev7"
  298 + ;;
  299 + esac
  300 + fi
  301 + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  302 + exit 0 ;;
  303 + Alpha\ *:Windows_NT*:*)
  304 + # How do we know it's Interix rather than the generic POSIX subsystem?
  305 + # Should we change UNAME_MACHINE based on the output of uname instead
  306 + # of the specific Alpha model?
  307 + echo alpha-pc-interix
  308 + exit 0 ;;
  309 + 21064:Windows_NT:50:3)
  310 + echo alpha-dec-winnt3.5
  311 + exit 0 ;;
  312 + Amiga*:UNIX_System_V:4.0:*)
  313 + echo m68k-unknown-sysv4
  314 + exit 0;;
  315 + *:[Aa]miga[Oo][Ss]:*:*)
  316 + echo ${UNAME_MACHINE}-unknown-amigaos
  317 + exit 0 ;;
  318 + *:[Mm]orph[Oo][Ss]:*:*)
  319 + echo ${UNAME_MACHINE}-unknown-morphos
  320 + exit 0 ;;
  321 + *:OS/390:*:*)
  322 + echo i370-ibm-openedition
  323 + exit 0 ;;
  324 + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
  325 + echo arm-acorn-riscix${UNAME_RELEASE}
  326 + exit 0;;
  327 + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
  328 + echo hppa1.1-hitachi-hiuxmpp
  329 + exit 0;;
  330 + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
  331 + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
  332 + if test "`(/bin/universe) 2>/dev/null`" = att ; then
  333 + echo pyramid-pyramid-sysv3
  334 + else
  335 + echo pyramid-pyramid-bsd
  336 + fi
  337 + exit 0 ;;
  338 + NILE*:*:*:dcosx)
  339 + echo pyramid-pyramid-svr4
  340 + exit 0 ;;
  341 + DRS?6000:UNIX_SV:4.2*:7*)