diff options
author | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-09 03:08:23 +0000 |
---|---|---|
committer | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-09 03:08:23 +0000 |
commit | 7ce26751b948af5be89a7da5882b19703c48f7fe (patch) | |
tree | 87ea917f50267296afe6acf62ccf01cba566fa09 | |
parent | 68a758b6de03182f0683314be57cae52979cd6c5 (diff) | |
download | gcc-7ce26751b948af5be89a7da5882b19703c48f7fe.tar.gz |
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
* fastjar: Imported.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38145 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | fastjar/AUTHORS | 1 | ||||
-rw-r--r-- | fastjar/CHANGES | 38 | ||||
-rw-r--r-- | fastjar/COPYING | 340 | ||||
-rw-r--r-- | fastjar/ChangeLog | 33 | ||||
-rw-r--r-- | fastjar/INSTALL | 18 | ||||
-rw-r--r-- | fastjar/Makefile | 44 | ||||
-rw-r--r-- | fastjar/Makefile.am | 50 | ||||
-rw-r--r-- | fastjar/Makefile.in | 417 | ||||
-rw-r--r-- | fastjar/NEWS | 14 | ||||
-rw-r--r-- | fastjar/README | 75 | ||||
-rw-r--r-- | fastjar/aclocal.m4 | 127 | ||||
-rw-r--r-- | fastjar/compress.c | 487 | ||||
-rw-r--r-- | fastjar/compress.h | 51 | ||||
-rw-r--r-- | fastjar/config.h.in | 57 | ||||
-rwxr-xr-x | fastjar/configure | 2330 | ||||
-rw-r--r-- | fastjar/configure.in | 42 | ||||
-rw-r--r-- | fastjar/dostime.c | 126 | ||||
-rw-r--r-- | fastjar/dostime.h | 22 | ||||
-rw-r--r-- | fastjar/install-defs.sh | 7 | ||||
-rw-r--r-- | fastjar/install-defs.sh.in | 7 | ||||
-rwxr-xr-x | fastjar/install-sh | 8 | ||||
-rw-r--r-- | fastjar/jargrep.c | 663 | ||||
-rw-r--r-- | fastjar/jargrep.h | 31 | ||||
-rw-r--r-- | fastjar/jartool.c | 1757 | ||||
-rw-r--r-- | fastjar/jartool.h | 112 | ||||
-rwxr-xr-x | fastjar/missing | 190 | ||||
-rwxr-xr-x | fastjar/mkinstalldirs | 40 | ||||
-rw-r--r-- | fastjar/pushback.c | 163 | ||||
-rw-r--r-- | fastjar/pushback.h | 32 | ||||
-rw-r--r-- | fastjar/stamp-h.in | 1 | ||||
-rw-r--r-- | fastjar/zipfile.h | 74 |
32 files changed, 7361 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 8cca88e988a..f215ee43e21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com> + * fastjar: Imported. + +2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com> + * Makefile.in (TARGET_CONFIGDIRS): Wrong place. Removed note about libjava. * configure.in (target_libs): Removed `target-libjava'. diff --git a/fastjar/AUTHORS b/fastjar/AUTHORS new file mode 100644 index 00000000000..8351d85d460 --- /dev/null +++ b/fastjar/AUTHORS @@ -0,0 +1 @@ +Bryan Burns and Cory Jon Hollingsworth. diff --git a/fastjar/CHANGES b/fastjar/CHANGES new file mode 100644 index 00000000000..057aa611051 --- /dev/null +++ b/fastjar/CHANGES @@ -0,0 +1,38 @@ +0.92 08/24/2000 Improved support for other Unix platforms. + Now works on Solaris, AIX, True 64, and HP-UX. + Hopefully resolved all big endian problems. + Fixed bug in update which caused it to skip + openning update file + +0.90 12/06/1999 Fixed recursive archival bug. + +0.86 10/12/1999 Applied patch to fix leading "./" problem. + +0.85 5/10/1999 The -t and -x flags now work. Hooray! Those + took quite a long time to get working. + Handling extraction/listing added quite a bit + of code, 500-1000 lines. ouch! + +0.75 4/27/1999 Added support for -C flag, allowing you to + change directories before adding files. See + fastjar's usage screen for more info. Also + improved the total compression display, and + added install/uninstall targets to the + Makefile. + +0.71 4/27/1999 Added -V flag to print version info. Added + better error messages, and added configure + script for better portability. + +0.70 4/25/1999 Added compression. Only deflation is supported + at this time (only one jar supports) and is + enabled by default. use the -0 flag to disable + compression. + +0.60 4/21/1999 Added support for manifest files (-m, -M). + Fixed bug with mod time/date in central header. + +0.50.1 4/20/1999 Added patch from John Bley. (Fixes bug with + not properly closing the file) + +0.50 4/20/1999 First public release diff --git a/fastjar/COPYING b/fastjar/COPYING new file mode 100644 index 00000000000..d1047464441 --- /dev/null +++ b/fastjar/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 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. + + 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 + + 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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 + + +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) year 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. + + <signature of Ty Coon>, 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. diff --git a/fastjar/ChangeLog b/fastjar/ChangeLog new file mode 100644 index 00000000000..e6cef0902e6 --- /dev/null +++ b/fastjar/ChangeLog @@ -0,0 +1,33 @@ +Tue Nov 16 15:11:36 2000 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * Makefile.am: New file. + * Makefile.in: Rebuilt. + * aclocal.m4: Likewise. + * stamp-h.in: Likewise. + * config.h.in: Likewise. + * configure.in (AM_INIT_AUTOMAKE): Added. + (AM_CONFIG_HEADER): Likewise. + (AC_CHECK_HEADERS): Check for sys/param.h + (AC_CHECK_LIB): Don't check for system's zlib. + (AC_CHECK_FUNC): Removed system's zlib function checks. + (ZDEPS. ZLIBS, ZINCS): Added. + * configure: Rebuilt. + * jartool.c (sys/param.h): Conditionally included or define MAXPATHLEN. + (init_args, get_next_arg): New function. + (use_explicit_list_only, read_names_from_stdin): New global + (main): Parse new non standard options 'E' and '@', check and + report their usage if necessary. Use init_args and get_next_arg. + Fixed indentation. + (add_to_jar): Don't read directory content if `use_explicit_list_only'. + (usage): Added `-E' and `-@'. + * jartool.h (VERSION): Macro removed. + +Tue Nov 14 15:10:44 2000 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * fastjar imported from sourceforge.net/projects/fastjar with + Bryan Burns' permission. Check `CHANGES' for post import changes. + * ChangeLog: Created. + * NEWS: Likewise. + * mkinstalldirs: Likewise. + * COPYING: Likewise. + * AUTHORS: Likewise. diff --git a/fastjar/INSTALL b/fastjar/INSTALL new file mode 100644 index 00000000000..cdc770fb741 --- /dev/null +++ b/fastjar/INSTALL @@ -0,0 +1,18 @@ +---------------------- +How to install fastjar +---------------------- + + +1. Run the 'configure' script to generate config.h and Makefile. You can + use 'configure --help' to get a list of command-line options. + +2. If you're feeling experimental, you can change some settings in jartool.h + to optimize fastjar for your particular system. + +3. Type 'make' to create the fastjar binary. + +4. Type 'make install' to install fastjar in whichever directory you supplied + to configure (or the default directory if you didn't specify one.) + + + diff --git a/fastjar/Makefile b/fastjar/Makefile new file mode 100644 index 00000000000..bc1e1780da8 --- /dev/null +++ b/fastjar/Makefile @@ -0,0 +1,44 @@ +# Generated automatically from Makefile.in by configure. +CFLAGS = -g -O2 -DHAVE_CONFIG_H +CC = gcc +INSTALL = /usr/bin/ginstall -c +prefix = /usr/local +exec_prefix = ${prefix} +BINARY = ${exec_prefix}/bin/fastjar + +all: fastjar grepjar + +fastjar: jartool.o dostime.o compress.o pushback.o + $(CC) -o $@ jartool.o dostime.o compress.o pushback.o -lz + +grepjar: jargrep.o dostime.o compress.o pushback.o + $(CC) -o $@ jargrep.o dostime.o compress.o pushback.o -lz + +install: fastjar + ${INSTALL} -s -m 755 fastjar $(BINARY) + +uninstall: + /bin/rm -f $(BINARY) + +jartool.o: jartool.c dostime.c jartool.h zipfile.h dostime.h compress.h + +jartool.c: jartool.h zipfile.h + +dostime.o: dostime.c dostime.h + +dostime.c: dostime.h + +compress.o: compress.c compress.h + +compress.c: compress.h + +pushback.o: pushback.c pushback.h + +pushback.c: pushback.h + +jargrep.c: jargrep.h + +jargrep.o: jargrep.c jargrep.h + +clean: + rm -rf *.o *~ core fastjar diff --git a/fastjar/Makefile.am b/fastjar/Makefile.am new file mode 100644 index 00000000000..037b57225f9 --- /dev/null +++ b/fastjar/Makefile.am @@ -0,0 +1,50 @@ +# Process this with automake to create Makefile.in + +# Work around what appears to be a GNU make bug handling MAKEFLAGS +# values defined in terms of make variables, as is the case for CC and +# friends when we are called from the top level Makefile. +AM_MAKEFLAGS = \ + "AR_FLAGS=$(AR_FLAGS)" \ + "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ + "CFLAGS=$(CFLAGS)" \ + "CXXFLAGS=$(CXXFLAGS)" \ + "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ + "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ + "JC1FLAGS=$(JC1FLAGS)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ + "MAKE=$(MAKE)" \ + "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ + "PICFLAG=$(PICFLAG)" \ + "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ + "SHELL=$(SHELL)" \ + "exec_prefix=$(exec_prefix)" \ + "infodir=$(infodir)" \ + "libdir=$(libdir)" \ + "prefix=$(prefix)" \ + "AR=$(AR)" \ + "AS=$(AS)" \ + "CC=$(CC)" \ + "CXX=$(CXX)" \ + "LD=$(LD)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "NM=$(NM)" \ + "PICFLAG=$(PICFLAG)" \ + "RANLIB=$(RANLIB)" \ + "DESTDIR=$(DESTDIR)" + +INCLUDES = -I. -I$(top_srcdir) $(ZINCS) + +bin_PROGRAMS = fastjar grepjar +fastjar_SOURCES = jartool.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h +fastjar_LDADD = $(ZLIBS) +fastjar_DEPENDENCIES = $(ZDEPS) +grepjar_SOURCES = jargrep.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h +grepjar_LDADD = $(ZLIBS) +grepjar_DEPENDENCIES = $(ZDEPS) + diff --git a/fastjar/Makefile.in b/fastjar/Makefile.in new file mode 100644 index 00000000000..4f1da7b3157 --- /dev/null +++ b/fastjar/Makefile.in @@ -0,0 +1,417 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in 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. + +# Process this with automake to create Makefile.in + +# Work around what appears to be a GNU make bug handling MAKEFLAGS +# values defined in terms of make variables, as is the case for CC and +# friends when we are called from the top level Makefile. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +CHMOD = @CHMOD@ +CP = @CP@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RM = @RM@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ZDEPS = @ZDEPS@ +ZINCS = @ZINCS@ +ZLIBS = @ZLIBS@ + +AM_MAKEFLAGS = "AR_FLAGS=$(AR_FLAGS)" "CC_FOR_BUILD=$(CC_FOR_BUILD)" "CFLAGS=$(CFLAGS)" "CXXFLAGS=$(CXXFLAGS)" "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" "INSTALL=$(INSTALL)" "INSTALL_DATA=$(INSTALL_DATA)" "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" "JC1FLAGS=$(JC1FLAGS)" "LDFLAGS=$(LDFLAGS)" "LIBCFLAGS=$(LIBCFLAGS)" "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" "MAKE=$(MAKE)" "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" "PICFLAG=$(PICFLAG)" "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" "SHELL=$(SHELL)" "exec_prefix=$(exec_prefix)" "infodir=$(infodir)" "libdir=$(libdir)" "prefix=$(prefix)" "AR=$(AR)" "AS=$(AS)" "CC=$(CC)" "CXX=$(CXX)" "LD=$(LD)" "LIBCFLAGS=$(LIBCFLAGS)" "NM=$(NM)" "PICFLAG=$(PICFLAG)" "RANLIB=$(RANLIB)" "DESTDIR=$(DESTDIR)" + + +INCLUDES = -I. -I$(top_srcdir) $(ZINCS) + +bin_PROGRAMS = fastjar grepjar +fastjar_SOURCES = jartool.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h +fastjar_LDADD = $(ZLIBS) +fastjar_DEPENDENCIES = $(ZDEPS) +grepjar_SOURCES = jargrep.c dostime.c compress.c pushback.c jartool.h zipfile.h dostime.h compress.h pushback.h +grepjar_LDADD = $(ZLIBS) +grepjar_DEPENDENCIES = $(ZDEPS) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = install-defs.sh +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +fastjar_OBJECTS = jartool.o dostime.o compress.o pushback.o +fastjar_LDFLAGS = +grepjar_OBJECTS = jargrep.o dostime.o compress.o pushback.o +grepjar_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS aclocal.m4 config.h.in configure \ +configure.in install-defs.sh.in install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/compress.P .deps/dostime.P .deps/jargrep.P \ +.deps/jartool.P .deps/pushback.P +SOURCES = $(fastjar_SOURCES) $(grepjar_SOURCES) +OBJECTS = $(fastjar_OBJECTS) $(grepjar_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: +install-defs.sh: $(top_builddir)/config.status install-defs.sh.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +fastjar: $(fastjar_OBJECTS) $(fastjar_DEPENDENCIES) + @rm -f fastjar + $(LINK) $(fastjar_LDFLAGS) $(fastjar_OBJECTS) $(fastjar_LDADD) $(LIBS) + +grepjar: $(grepjar_OBJECTS) $(grepjar_DEPENDENCIES) + @rm -f grepjar + $(LINK) $(grepjar_LDFLAGS) $(grepjar_OBJECTS) $(grepjar_LDADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: install-binPROGRAMS +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) config.h +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ + mostlyclean-compile mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ + clean-depend clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ + distclean-tags distclean-depend distclean-generic \ + clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/fastjar/NEWS b/fastjar/NEWS new file mode 100644 index 00000000000..70ee4990fb2 --- /dev/null +++ b/fastjar/NEWS @@ -0,0 +1,14 @@ +Noteworthy changes in fastjar, 11/2000 +-------------------------------------- + +Fastjar as been imported from sourceforge.net/projects/fastjar with +Brian Burns' permission so that it can be used as a replacement to the +zip utility in order to create the libgcj.zip archive. Several missing +distribution files were created, most notably Makefile.am. + +Two new options were added: `-E' to prevent fastjar from reading the +content of a directory when specifying one (and instead relying on the +provided list of files to populate the archive with regard to the +directory entry) and `-@' to let fastjar read the name of the files to +add to the archive from the standard input. This last option is +supported only when creating or augmenting an archive. diff --git a/fastjar/README b/fastjar/README new file mode 100644 index 00000000000..d3f87a8b860 --- /dev/null +++ b/fastjar/README @@ -0,0 +1,75 @@ +======= +FastJar 0.90 + +12/6/1999 +======= + +FastJar is an attempt at creating a feature-for-feature copy of Sun's JDK's +'jar' command. Sun's jar (or Blackdown's for that matter) is written entirely +in Java which makes it dog slow. Since FastJar is written in C, it can create +the same .jar file as Sun's tool in a fraction of the time. On my system, +Sun's jar takes 50 seconds to create a 10MB jar file, while FastJar only takes +a little over a second. + +The reason I wrote fastjar is that building .jar files is a regular process +of the build where I work. The way we have it setup, you have to re-create +the .jar file everytime you want to test it out, which is about every 5 minutes +when I'm busy coding. The .jar file wasn't -that- big, but it did take about +30 seconds to be made, and watching all the garbage collection messages was +pretty irritating as well. I probably wasted a half-hour a day watching +Sun's jar tool chug along. By writing the program in C, I spend much less time +banging my head against the monitor waiting for the build to finish. Yay! + +FastJar has been tested on Solaris and Linux 2.2.x systems and nothing else. +It should compile/run without any problems on either system, provided you have +zlib installed. + +Please mail any bug reports to burnsbr@ucs.orst.edu. + +If you use FastJar and want me to add the rest of the features, send me mail +(toast@users.sourceforge.net). I'll be much more likely to put more work into this +if I know other people find it useful other than me. + +As always, this not being a final release, bugs may exist. I test each +release pretty well, but I can always miss things... + +Compression will slow things down quite a bit. A 10MB jar file takes about +1 second on my machine without compression, and 9 seconds with it. If you +want fastjar to be fast, use the -0 (zero, not O) flag to turn off compression. + +Supported flags: +-------------------------- +-c | create a new archive +-v | verbose output +-f | specify archive file name +-m | specify existing manifest file +-M | don't create manifest +-0 | store only +-C | change to dir +-t | list contents +-x | extract contents + +Unsupported flags: +---------------------------- +-u | update exisiting archive + +If you use the "unsupported" flags, nothing bad will happen, but then again +nothing will happen at all. + + +Unsupported features (in this release): +--------------------------------------------- + * updating + * full manifest support (?) + +Order or features for the future: +-------------------------------------------- + * archive updating + * full manifest support + * filtering + * dependency checking + + +=========================================================================== +http://fastjar.sourceforge.net +toast@users.sourceforge.net diff --git a/fastjar/aclocal.m4 b/fastjar/aclocal.m4 new file mode 100644 index 00000000000..f23ba2904e1 --- /dev/null +++ b/fastjar/aclocal.m4 @@ -0,0 +1,127 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 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 This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<<am_indx=1 +for am_file in <<$1>>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + diff --git a/fastjar/compress.c b/fastjar/compress.c new file mode 100644 index 00000000000..0f919d76364 --- /dev/null +++ b/fastjar/compress.c @@ -0,0 +1,487 @@ +/* $Id: compress.c,v 1.7 2000/09/13 14:02:02 cory Exp $ + + $Log: compress.c,v $ + Revision 1.7 2000/09/13 14:02:02 cory + Reformatted some of the code to more closly match the layout of the orriginal + fastjar utility. + + Revision 1.6 2000/09/12 22:29:36 cory + Jargrep now seems to do what I want it to do. Performs properly on Linux x86, + will test some other platforms later. + + Revision 1.1.1.1 1999/12/06 03:09:16 toast + initial checkin.. + + + + Revision 1.7 1999/05/10 08:50:05 burnsbr + *** empty log message *** + + Revision 1.6 1999/05/10 08:38:44 burnsbr + *** empty log message *** + + Revision 1.5 1999/05/10 08:30:29 burnsbr + added inflation code + + Revision 1.4 1999/04/27 10:03:33 burnsbr + added configure support + + Revision 1.3 1999/04/26 02:35:32 burnsbr + compression now works.. yahoo + + Revision 1.2 1999/04/23 12:01:59 burnsbr + added licence stuff. + + Revision 1.1 1999/04/23 11:58:25 burnsbr + Initial revision + + +*/ + +/* + compress.c - code for handling deflation + Copyright (C) 1999 Bryan Burns + + 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 "config.h" + +#include <zlib.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <sys/types.h> + +#include "jartool.h" +#include "pushback.h" + +extern int seekable; + +static char rcsid[] = "$Id: compress.c,v 1.7 2000/09/13 14:02:02 cory Exp $"; + +static z_stream zs; + +void init_compression(){ + + memset(&zs, 0, sizeof(z_stream)); + + zs.zalloc = Z_NULL; + zs.zfree = Z_NULL; + zs.opaque = Z_NULL; + + /* Why -MAX_WBITS? zlib has an undocumented feature, where if the windowbits + parameter is negative, it omits the zlib header, which seems to kill + any other zip/unzip program. This caused me SO much pain.. */ + if(deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, + 9, Z_DEFAULT_STRATEGY) != Z_OK){ + + fprintf(stderr, "Error initializing deflation!\n"); + exit(1); + } +} + +int compress_file(int in_fd, int out_fd, struct zipentry *ze){ + Bytef in_buff[RDSZ]; + Bytef out_buff[RDSZ]; + unsigned int rdamt, wramt; + unsigned long tr = 0; + + rdamt = 0; + + zs.avail_in = 0; + zs.next_in = in_buff; + + zs.next_out = out_buff; + zs.avail_out = (uInt)RDSZ; + + ze->crc = crc32(0L, Z_NULL, 0); + + for(; ;){ + + /* If deflate is out of input, fill the input buffer for it */ + if(zs.avail_in == 0 && zs.avail_out > 0){ + if((rdamt = read(in_fd, in_buff, RDSZ)) == 0) + break; + + if(rdamt == -1){ + perror("read"); + exit(1); + } + + /* compute the CRC while we're at it */ + ze->crc = crc32(ze->crc, in_buff, rdamt); + + /* update the total amount read sofar */ + tr += rdamt; + + zs.next_in = in_buff; + zs.avail_in = rdamt; + } + + /* deflate the data */ + if(deflate(&zs, 0) != Z_OK){ + fprintf(stderr, "Error deflating! %s:%d\n", __FILE__, __LINE__); + exit(1); + } + + /* If the output buffer is full, dump it to disk */ + if(zs.avail_out == 0){ + + if(write(out_fd, out_buff, RDSZ) != RDSZ){ + perror("write"); + exit(1); + } + + /* clear the output buffer */ + zs.next_out = out_buff; + zs.avail_out = (uInt)RDSZ; + } + + } + + /* If we have any data waiting in the buffer after we're done with the file + we can flush it */ + if(zs.avail_out < RDSZ){ + + wramt = RDSZ - zs.avail_out; + + if(write(out_fd, out_buff, wramt) != wramt){ + perror("write"); + exit(1); + } + /* clear the output buffer */ + zs.next_out = out_buff; + zs.avail_out = (uInt)RDSZ; + } + + + /* finish deflation. This purges zlib's internal data buffers */ + while(deflate(&zs, Z_FINISH) == Z_OK){ + wramt = RDSZ - zs.avail_out; + + if(write(out_fd, out_buff, wramt) != wramt){ + perror("write"); + exit(1); + } + + zs.next_out = out_buff; + zs.avail_out = (uInt)RDSZ; + } + + /* If there's any data left in the buffer, write it out */ + if(zs.avail_out != RDSZ){ + wramt = RDSZ - zs.avail_out; + + if(write(out_fd, out_buff, wramt) != wramt){ + perror("write"); + exit(1); + } + } + + /* update fastjar's entry information */ + ze->usize = (ub4)zs.total_in; + ze->csize = (ub4)zs.total_out; + + /* Reset the deflation for the next time around */ + if(deflateReset(&zs) != Z_OK){ + fprintf(stderr, "Error resetting deflation\n"); + exit(1); + } + + return 0; +} + +void end_compression(){ + int rtval; + + /* Oddly enough, zlib always returns Z_DATA_ERROR if you specify no + zlib header. Go fig. */ + if((rtval = deflateEnd(&zs)) != Z_OK && rtval != Z_DATA_ERROR){ + fprintf(stderr, "Error calling deflateEnd\n"); + fprintf(stderr, "error: (%d) %s\n", rtval, zs.msg); + exit(1); + } +} + + +void init_inflation(){ + + memset(&zs, 0, sizeof(z_stream)); + + zs.zalloc = Z_NULL; + zs.zfree = Z_NULL; + zs.opaque = Z_NULL; + + if(inflateInit2(&zs, -15) != Z_OK){ + fprintf(stderr, "Error initializing deflation!\n"); + exit(1); + } + +} + +int inflate_file(pb_file *pbf, int out_fd, struct zipentry *ze){ + Bytef in_buff[RDSZ]; + Bytef out_buff[RDSZ]; + unsigned int rdamt; + int rtval; + ub4 crc = 0; + + zs.avail_in = 0; + + crc = crc32(crc, NULL, 0); /* initialize crc */ + + /* loop until we've consumed all the compressed data */ + for(;;){ + + if(zs.avail_in == 0){ + if((rdamt = pb_read(pbf, in_buff, RDSZ)) == 0) + break; + else if(rdamt < 0){ + perror("read"); + exit(1); + } + +#ifdef DEBUG + printf("%d bytes read\n", rdamt); +#endif + + zs.next_in = in_buff; + zs.avail_in = rdamt; + } + + zs.next_out = out_buff; + zs.avail_out = RDSZ; + + if((rtval = inflate(&zs, 0)) != Z_OK){ + if(rtval == Z_STREAM_END){ +#ifdef DEBUG + printf("end of stream\n"); +#endif + if(zs.avail_out != RDSZ){ + crc = crc32(crc, out_buff, (RDSZ - zs.avail_out)); + + if(out_fd >= 0) + if(write(out_fd, out_buff, (RDSZ - zs.avail_out)) != + (RDSZ - zs.avail_out)){ + perror("write"); + exit(1); + } + } + + break; + } else { + fprintf(stderr, "Error inflating file! (%d)\n", rtval); + exit(1); + } + } else { + if(zs.avail_out != RDSZ){ + crc = crc32(crc, out_buff, (RDSZ - zs.avail_out)); + + if(out_fd >= 0) + if(write(out_fd, out_buff, (RDSZ - zs.avail_out)) != + (RDSZ - zs.avail_out)){ + perror("write"); + exit(1); + } + zs.next_out = out_buff; + zs.avail_out = RDSZ; + } + } + } +#ifdef DEBUG + printf("done inflating\n"); +#endif + +#ifdef DEBUG + printf("%d bytes left over\n", zs.avail_in); +#endif + +#ifdef DEBUG + printf("CRC is %x\n", crc); +#endif + + ze->crc = crc; + + pb_push(pbf, zs.next_in, zs.avail_in); + + ze->usize = zs.total_out; + + inflateReset(&zs); + return 0; +} + +/* +Function name: report_str_error +args: val Error code returned from zlib. +purpose: Put out an error message corresponding to error code returned from zlib. +Be suitably cryptic seeing I don't really know exactly what these errors mean. +*/ + +void report_str_error(int val) { + switch(val) { + case Z_STREAM_END: + break; + case Z_NEED_DICT: + fprintf(stderr, "Need a dictionary?\n"); + exit(1); + case Z_DATA_ERROR: + fprintf(stderr, "Z_DATA_ERROR\n"); + exit(1); + case Z_STREAM_ERROR: + fprintf(stderr, "Z_STREAM_ERROR\n"); + exit(1); + case Z_MEM_ERROR: + fprintf(stderr, "Z_MEM_ERROR\n"); + exit(1); + case Z_BUF_ERROR: + fprintf(stderr, "Z_BUF_ERROR\n"); + exit(1); + case Z_OK: + break; + default: + fprintf(stderr, "Unknown behavior from inflate\n"); + exit(1); + } +} + +/* +Function name: ez_inflate_str +args: pbf Pointer to pushback handle for file. + csize Compressed size of embedded file. + usize Uncompressed size of embedded file. +purpose: Read in and decompress the contents of an embedded file and store it in a +byte array. +returns: Byte array of uncompressed embedded file. +*/ + +static Bytef *ez_inflate_str(pb_file *pbf, ub4 csize, ub4 usize) { + Bytef *out_buff; + Bytef *in_buff; + unsigned int rdamt; + ub4 crc = 0; + + if(zs.next_in = in_buff = (Bytef *) malloc(csize)) { + if(zs.next_out = out_buff = (Bytef *) malloc(usize + 1)) { + if((rdamt = pb_read(pbf, zs.next_in, csize)) == csize) { + zs.avail_in = csize; + zs.avail_out = usize; + report_str_error(inflate(&zs, 0)); + free(in_buff); + inflateReset(&zs); + out_buff[usize] = '\0'; + } + else { + fprintf(stderr, "Read failed on input file.\n"); + fprintf(stderr, "Tried to read %u but read %u instead.\n", csize, rdamt); + free(in_buff); + free(out_buff); + exit(1); + } + } + else { + fprintf(stderr, "Malloc of out_buff failed.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + free(in_buff); + exit(1); + } + } + else { + fprintf(stderr, "Malloc of in_buff failed.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(1); + } + + return out_buff; +} + +/* +Function name: hrd_inflate_str +args: pbf Pointer to pushback handle for file. + csize Pointer to compressed size of embedded file. + usize Pointer to uncompressed size of embedded file. +purpose: Read and decompress an embedded file into a string. Set csize and usize +accordingly. This function does the reading for us in the case there is not size +information in the header for the embedded file. +returns: Byte array of the contents of the embedded file. +*/ + +static Bytef *hrd_inflate_str(pb_file *pbf, ub4 *csize, ub4 *usize) { + Bytef *out_buff; + Bytef *tmp; + Bytef in_buff[RDSZ]; + unsigned int rdamt; + int i; + int zret; + ub4 crc = 0; + + i = 1; + out_buff = NULL; + zret = Z_OK; + while(zret != Z_STREAM_END && (rdamt = pb_read(pbf, in_buff, RDSZ))) + { + zs.avail_in = rdamt; + zs.avail_out = 0; + zs.next_in = in_buff; + do { + if(tmp = (Bytef *) realloc(out_buff, (RDSZ * i) + 1)) { + out_buff = tmp; + zs.next_out = &(out_buff[(RDSZ * (i - 1)) - zs.avail_out]); + zs.avail_out += RDSZ; + i++; + } + else { + fprintf(stderr, "Realloc of out_buff failed.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(1); + } + } while((zret = inflate(&zs, 0)) == Z_OK); + report_str_error(zret); + } + pb_push(pbf, zs.next_in, zs.avail_in); + + out_buff[(RDSZ * (i - 1)) - zs.avail_out] = '\0'; + *usize = zs.total_out; + *csize = zs.total_in; + + inflateReset(&zs); + + return out_buff; +} + +/* +Function name: inflate_string +args: pbf Pointer to pushback handle for file. + csize Pointer to compressed size of embedded file. May be 0 if not set. + usize Pointer to uncompressed size of embedded file. May be 0 if not set. +purpose: Decide the easiest (in computer terms) methos of decompressing this embedded +file to a string. +returns: Pointer to a string containing the decompressed contents of the embedded file. +If csize and usize are not set set them to correct numbers. +*/ + +Bytef *inflate_string(pb_file *pbf, ub4 *csize, ub4 *usize) { +Bytef *ret_buf; + + if(*csize && *usize) ret_buf = ez_inflate_str(pbf, *csize, *usize); + else ret_buf = hrd_inflate_str(pbf, csize, usize); + + return ret_buf; +} diff --git a/fastjar/compress.h b/fastjar/compress.h new file mode 100644 index 00000000000..f9fadba847f --- /dev/null +++ b/fastjar/compress.h @@ -0,0 +1,51 @@ +/* $Id: compress.h,v 1.1.1.1 1999/12/06 03:09:12 toast Exp $ + + $Log: compress.h,v $ + Revision 1.1.1.1 1999/12/06 03:09:12 toast + initial checkin.. + + + + Revision 1.3 1999/05/10 08:32:09 burnsbr + added new function protos. + + Revision 1.2 1999/04/23 12:02:20 burnsbr + added licence + + Revision 1.1 1999/04/23 11:59:37 burnsbr + Initial revision + + +*/ + +/* + compress.h - header for compression + Copyright (C) 1999 Bryan Burns + + 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. + */ + +/* Initializes the compression data structure(s) */ +void init_compression(); + +/* Compresses the file specified by in_fd and appends it to out_fd */ +int compress_file(int in_fd, int out_fd, struct zipentry *ze); + +/* Frees memory used by compression function */ +void end_compression(); + +void init_inflation(); +int inflate_file(pb_file *, int, struct zipentry *); +void end_inflation(); diff --git a/fastjar/config.h.in b/fastjar/config.h.in new file mode 100644 index 00000000000..1dce3af5a9f --- /dev/null +++ b/fastjar/config.h.in @@ -0,0 +1,57 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to `long' if <sys/types.h> doesn't define. */ +#undef off_t + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if your <sys/time.h> declares struct tm. */ +#undef TM_IN_SYS_TIME + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* The number of bytes in a char. */ +#undef SIZEOF_CHAR + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* The number of bytes in a long long. */ +#undef SIZEOF_LONG_LONG + +/* The number of bytes in a short. */ +#undef SIZEOF_SHORT + +/* Define if you have the <dirent.h> header file. */ +#undef HAVE_DIRENT_H + +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the <ndir.h> header file. */ +#undef HAVE_NDIR_H + +/* Define if you have the <sys/dir.h> header file. */ +#undef HAVE_SYS_DIR_H + +/* Define if you have the <sys/ndir.h> header file. */ +#undef HAVE_SYS_NDIR_H + +/* Define if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/fastjar/configure b/fastjar/configure new file mode 100755 index 00000000000..0e5d54a0092 --- /dev/null +++ b/fastjar/configure @@ -0,0 +1,2330 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -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 ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$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) + # 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 << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + 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) + 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" ;; + + -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 ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=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" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=jartool.h + +# 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 its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + 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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +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 + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# 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 +# 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" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:556: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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 + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +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. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:609: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:666: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=fastar + +VERSION=0.92-gcc + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cat >> confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + + + +missing_dir=`cd $ac_aux_dir && pwd` +echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +echo "configure:712: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:725: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:738: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:751: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:764: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:784: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:814: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:865: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:897: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 908 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:939: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:944: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:972: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&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 + +# 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 +# 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" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1015: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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 + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +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. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1070: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$RM" in + /*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_RM="$RM" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH:/bin:/usr/bin:/usr/local/bin" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_RM="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_RM" && ac_cv_path_RM="/bin/rm" + ;; +esac +fi +RM="$ac_cv_path_RM" +if test -n "$RM"; then + echo "$ac_t""$RM" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1106: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CP" in + /*) + ac_cv_path_CP="$CP" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CP="$CP" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH:/bin:/usr/bin:/usr/local/bin" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CP="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_CP" && ac_cv_path_CP="/bin/cp" + ;; +esac +fi +CP="$ac_cv_path_CP" +if test -n "$CP"; then + echo "$ac_t""$CP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1142: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$STRIP" in + /*) + ac_cv_path_STRIP="$STRIP" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_STRIP="$STRIP" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH:/bin:/usr/bin:/usr/local/bin" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_STRIP="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_STRIP" && ac_cv_path_STRIP="/usr/bin/strip" + ;; +esac +fi +STRIP="$ac_cv_path_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "chmod", so it can be a program name with args. +set dummy chmod; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1178: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CHMOD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CHMOD" in + /*) + ac_cv_path_CHMOD="$CHMOD" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CHMOD="$CHMOD" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH:/bin:/usr/bin:/usr/local/bin" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CHMOD="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_CHMOD" && ac_cv_path_CHMOD="/bin/chmod" + ;; +esac +fi +CHMOD="$ac_cv_path_CHMOD" +if test -n "$CHMOD"; then + echo "$ac_t""$CHMOD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:1217: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1222 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:1230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + ac_header_dirent=$ac_hdr; break +else + echo "$ac_t""no" 1>&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:1255: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1263 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:1296: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1304 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1338: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 1353 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 1370 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext <<EOF +#line 1387 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1418: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1423 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1431: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1448 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + 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 <<EOF +#line 1466 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + 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 <<EOF +#line 1487 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#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)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:1522: checking whether struct tm is in sys/time.h or time.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1527 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <time.h> +int main() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if { (eval echo configure:1535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +for ac_hdr in fcntl.h unistd.h sys/param.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1559: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1564 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:1597: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1602 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:1630: checking whether struct tm is in sys/time.h or time.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1635 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <time.h> +int main() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if { (eval echo configure:1643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + + +echo $ac_n "checking size of char""... $ac_c" 1>&6 +echo "configure:1665: checking size of char" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1673 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(char)); + exit(0); +} +EOF +if { (eval echo configure:1684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_char=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_char=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_char" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_CHAR $ac_cv_sizeof_char +EOF + + +echo $ac_n "checking size of short""... $ac_c" 1>&6 +echo "configure:1704: checking size of short" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1712 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(short)); + exit(0); +} +EOF +if { (eval echo configure:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_short=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_short=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_short" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +EOF + + +echo $ac_n "checking size of int""... $ac_c" 1>&6 +echo "configure:1743: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1751 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int)); + exit(0); +} +EOF +if { (eval echo configure:1762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_INT $ac_cv_sizeof_int +EOF + + +echo $ac_n "checking size of long""... $ac_c" 1>&6 +echo "configure:1782: checking size of long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1790 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long)); + exit(0); +} +EOF +if { (eval echo configure:1801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG $ac_cv_sizeof_long +EOF + + +echo $ac_n "checking size of long long""... $ac_c" 1>&6 +echo "configure:1821: checking size of long long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1829 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long long)); + exit(0); +} +EOF +if { (eval echo configure:1840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +EOF + + + +echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +echo "configure:1861: checking whether byte ordering is bigendian" >&5 +if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat > conftest.$ac_ext <<EOF +#line 1868 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +; return 0; } +EOF +if { (eval echo configure:1879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # It does; now see whether it defined to BIG_ENDIAN or not. +cat > conftest.$ac_ext <<EOF +#line 1883 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +; return 0; } +EOF +if { (eval echo configure:1894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_bigendian=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_bigendian=no +fi +rm -f conftest* +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1914 "configure" +#include "confdefs.h" +main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +EOF +if { (eval echo configure:1927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_bigendian=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_bigendian=yes +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +if test $ac_cv_c_bigendian = yes; then + cat >> confdefs.h <<\EOF +#define WORDS_BIGENDIAN 1 +EOF + +fi + + +ZDEPS='$(top_builddir)/../zlib/libz.a' +ZLIBS="$ZDEPS -L\$(here)/../zlib/$libsubdir" +ZINCS='-I$(top_srcdir)/../zlib' + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# 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. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile install-defs.sh config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@RM@%$RM%g +s%@CP@%$CP%g +s%@STRIP@%$STRIP%g +s%@CHMOD@%$CHMOD%g +s%@CPP@%$CPP%g +s%@ZLIBS@%$ZLIBS%g +s%@ZDEPS@%$ZDEPS%g +s%@ZINCS@%$ZINCS%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile install-defs.sh"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="config.h" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #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. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF + + +EOF +cat >> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/fastjar/configure.in b/fastjar/configure.in new file mode 100644 index 00000000000..000b991a46f --- /dev/null +++ b/fastjar/configure.in @@ -0,0 +1,42 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(jartool.h) +AM_INIT_AUTOMAKE(fastar, 0.92-gcc) +AM_CONFIG_HEADER(config.h) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PATH_PROG(RM, rm, /bin/rm, $PATH:/bin:/usr/bin:/usr/local/bin) +AC_PATH_PROG(CP, cp, /bin/cp, $PATH:/bin:/usr/bin:/usr/local/bin) +AC_PATH_PROG(STRIP, strip, /usr/bin/strip, $PATH:/bin:/usr/bin:/usr/local/bin) +AC_PATH_PROG(CHMOD, chmod, /bin/chmod, $PATH:/bin:/usr/bin:/usr/local/bin) + +dnl Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_STRUCT_TM +AC_CHECK_HEADERS(fcntl.h unistd.h sys/param.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_OFF_T +AC_STRUCT_TM + +dnl Check for type-widths +AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) + +dnl Check byte order +AC_C_BIGENDIAN + +dnl Brain dead check for tree's zlib +ZDEPS='$(top_builddir)/../zlib/libz.a' +ZLIBS="$ZDEPS -L\$(here)/../zlib/$libsubdir" +ZINCS='-I$(top_srcdir)/../zlib' +AC_SUBST(ZLIBS) +AC_SUBST(ZDEPS) +AC_SUBST(ZINCS) + +AC_OUTPUT(Makefile install-defs.sh) diff --git a/fastjar/dostime.c b/fastjar/dostime.c new file mode 100644 index 00000000000..c29d9913000 --- /dev/null +++ b/fastjar/dostime.c @@ -0,0 +1,126 @@ +/* + dostime.c - routines for converting UNIX time to MS-DOS time. + + Borrowed from Info-zip's unzip + + Copyright (C) 1999 Bryan Burns + + 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. +*/ + +/* $Id: dostime.c,v 1.1.1.1 1999/12/06 03:09:12 toast Exp $ + + $Log: dostime.c,v $ + Revision 1.1.1.1 1999/12/06 03:09:12 toast + initial checkin.. + + + + Revision 1.6 1999/05/10 08:32:26 burnsbr + added dos2unixtime + + Revision 1.5 1999/04/27 10:03:50 burnsbr + configure support + + Revision 1.4 1999/04/26 21:55:19 burnsbr + switched from sys/time.h to time.h for better portability + + Revision 1.3 1999/04/20 08:54:30 burnsbr + added GPL comment + + Revision 1.2 1999/04/20 05:10:53 burnsbr + added RCS tags + + +*/ +#include "config.h" + +#ifdef TM_IN_SYS_TIME +#include <sys/time.h> +#else +#include <time.h> +#endif + +#include "dostime.h" + +static char rcsid[] = "$Id: dostime.c,v 1.1.1.1 1999/12/06 03:09:12 toast Exp $"; + +/* + + Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly, + Kai Uwe Rommel, Onno van der Linden and Igor Mandrichenko. + Permission is granted to any individual or institution to use, copy, or + redistribute this software so long as all of the original files are included, + that it is not sold for profit, and that this copyright notice is retained. + +*/ + + +time_t dos2unixtime(dostime) + unsigned long dostime; /* DOS time to convert */ + /* Return the Unix time_t value (GMT/UTC time) for the DOS format (local) + * time dostime, where dostime is a four byte value (date in most + * significant word, time in least significant word), see dostime() + * function. + */ +{ + struct tm *t; /* argument for mktime() */ + time_t clock = time(NULL); + + t = localtime(&clock); + t->tm_isdst = -1; /* let mktime() determine if DST is in effect */ + /* Convert DOS time to UNIX time_t format */ + t->tm_sec = (((int)dostime) << 1) & 0x3e; + t->tm_min = (((int)dostime) >> 5) & 0x3f; + t->tm_hour = (((int)dostime) >> 11) & 0x1f; + t->tm_mday = (int)(dostime >> 16) & 0x1f; + t->tm_mon = ((int)(dostime >> 21) & 0x0f) - 1; + t->tm_year = ((int)(dostime >> 25) & 0x7f) + 80; + + return mktime(t); +} + +unsigned long dostime(y, n, d, h, m, s) +int y; /* year */ +int n; /* month */ +int d; /* day */ +int h; /* hour */ +int m; /* minute */ +int s; /* second */ +/* Convert the date y/n/d and time h:m:s to a four byte DOS date and + time (date in high two bytes, time in low two bytes allowing magnitude + comparison). */ +{ + return y < 1980 ? dostime(1980, 1, 1, 0, 0, 0) : + (((unsigned long)y - 1980) << 25) | ((unsigned long)n << 21) | + ((unsigned long)d << 16) | ((unsigned long)h << 11) | + ((unsigned long)m << 5) | ((unsigned long)s >> 1); +} + + +unsigned long unix2dostime(t) +time_t *t; /* unix time to convert */ +/* Return the Unix time t in DOS format, rounded up to the next two + second boundary. */ +{ + time_t t_even; + struct tm *s; /* result of localtime() */ + + t_even = (*t + 1) & (~1); /* Round up to even seconds. */ + s = localtime(&t_even); /* Use local time since MSDOS does. */ + return dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday, + s->tm_hour, s->tm_min, s->tm_sec); +} + diff --git a/fastjar/dostime.h b/fastjar/dostime.h new file mode 100644 index 00000000000..6f6931f4c21 --- /dev/null +++ b/fastjar/dostime.h @@ -0,0 +1,22 @@ +/* + dostime.h - function prototypes + Copyright (C) 1999 Bryan Burns + + 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. + */ + +time_t dos2unixtime(unsigned long dostime); +unsigned long dostime(int, int, int, int, int, int); +unsigned long unix2dostime(time_t*); diff --git a/fastjar/install-defs.sh b/fastjar/install-defs.sh new file mode 100644 index 00000000000..d7c906e3a36 --- /dev/null +++ b/fastjar/install-defs.sh @@ -0,0 +1,7 @@ +CP=/bin/cp +STRIP=/usr/bin/strip +CHMOD=/bin/chmod + +prefix=/usr/local +exec_prefix=${prefix} +BINDIR=${exec_prefix}/bin diff --git a/fastjar/install-defs.sh.in b/fastjar/install-defs.sh.in new file mode 100644 index 00000000000..b90410c417f --- /dev/null +++ b/fastjar/install-defs.sh.in @@ -0,0 +1,7 @@ +CP=@CP@ +STRIP=@STRIP@ +CHMOD=@CHMOD@ + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +BINDIR=@bindir@ diff --git a/fastjar/install-sh b/fastjar/install-sh new file mode 100755 index 00000000000..c719342656f --- /dev/null +++ b/fastjar/install-sh @@ -0,0 +1,8 @@ +#! /bin/bash + +. install-defs.sh + +$CP fastjar ${BINDIR} +$STRIP ${BINDIR}/fastjar +$CHMOD 755 ${BINDIR}/fastjar + diff --git a/fastjar/jargrep.c b/fastjar/jargrep.c new file mode 100644 index 00000000000..342acd0ad34 --- /dev/null +++ b/fastjar/jargrep.c @@ -0,0 +1,663 @@ +/* + jargrep.c - main functions for jargrep utility + Copyright (C) 1999 Bryan Burns + Copyright (C) 2000 Cory Hollingsworth + + Parts of this program are base on Bryan Burns work with fastjar + Copyright (C) 1999. + + 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. +*/ + +/* $Id: jargrep.c,v 1.8 2000/09/13 14:02:02 cory Exp $ + +$Log: jargrep.c,v $ +Revision 1.8 2000/09/13 14:02:02 cory +Reformatted some of the code to more closly match the layout of the orriginal +fastjar utility. + +Revision 1.7 2000/09/12 22:29:36 cory +Jargrep now seems to do what I want it to do. Performs properly on Linux x86, +will test some other platforms later. + + +*/ + +#include "config.h" +#include <stdio.h> +#include <unistd.h> +#include <regex.h> +#include <errno.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include "jargrep.h" +#include "jartool.h" +#include "pushback.h" +#include "zipfile.h" + +char *Usage = { "Usage: %s [-bcinsw] <-e regexp | regexp> file(s)\n" }; + +extern char *optarg; + +/* +Function name: opt_valid +arg: options Bitfield flag that contains the command line options of grepjar. +purpose: To guard agains the occurance of certain incompatible flags being used +together. +returns: TRUE if options are valid, FALSE otherwise. +*/ + +int opt_valid(int options) { + int retflag; + + if((options & JG_PRINT_COUNT) && + (options & (JG_PRINT_BYTEOFFSET | JG_PRINT_LINE_NUMBER))) + { + retflag = FALSE; + } + else retflag = TRUE; + + return retflag; +} + +/* +Function name: create_regexp +args: regstr String containing the uncompiled regular expression. This may be the + expression as is passed in through argv. + options This is the flag containing the commandline options that have been + parsed by getopt. +purpose: Handle the exception handling involved with setting upt a new regular +expression. +returns: Newly allocated compile regular expression ready to be used in an regexec call. +*/ + +regex_t *create_regexp(char *regstr, int options) { + regex_t *exp; + int exp_flags = 0; + int errcode; + int msgsize; + char *errmsg; + + if(exp = (regex_t *) malloc(sizeof(regex_t))) + { + if(errcode = regcomp(exp, regstr, (options & JG_IGNORE_CASE) ? REG_ICASE : 0)) { + fprintf(stderr, "regcomp of regex failed,\n"); + if(errmsg = (char *) malloc(msgsize = regerror(errcode, exp, NULL, 0) + 1)) { + regerror(errcode, exp, errmsg, msgsize); + fprintf(stderr, "Error: %s\n", errmsg); + free(exp); + free(errmsg); + exit(1); + } + else { + fprintf(stderr, "Malloc of errmsg failed.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + free(exp); + exit(1); + } + } + } + else { + fprintf(stderr, "Malloc of regex failed,\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(1); + } + + return exp; +} + +/* +Function name: check_sig +args: scratch Pointer to array of bytes containing signature. + pbf Pointer to push back handle for jar file. +purpose: Verify that checksum is correct. +returns: 0, 1, or 2. 0 means we are ready to read embedded file information. 1 means +we have read beyound the embedded file list and can exit knowing we have read all the +relevent information. 2 means we still haven't reached embdedded file list and need to +do some more reading. +*/ +int check_sig(ub1 *scratch, pb_file *pbfp) { + ub4 signature; + int retflag = 0; + + signature = UNPACK_UB4(scratch, 0); + +#ifdef DEBUG + printf("signature is %x\n", signature); +#endif + if(signature == 0x08074b50){ +#ifdef DEBUG + printf("skipping data descriptor\n"); +#endif + pb_read(pbfp, scratch, 12); + retflag = 2; + } else if(signature == 0x02014b50){ +#ifdef DEBUG + printf("Central header reached.. we're all done!\n"); +#endif + retflag = 1; + }else if(signature != 0x04034b50){ + printf("Ick! %#x\n", signature); + retflag = 1; + } + + return retflag; +} + +/* +Function name: decd_siz +args csize Pointer to embedded file's compressed size. + usize Pointer to embedded file's uncmpressed size. + fnlen Pointer to embedded file's file name length. + elfen Pointer to length of extra fields in jar file. + flags Pointer to bitmapped flags. + method Pointer to indicator of storage method of embedded file. + file_header Pointer to string containing the above values to be unbacked. +Purpose: Unpack the series of values from file_header. +*/ + +void decd_siz(ub4 *csize, ub4 *usize, ub2 *fnlen, ub2 *eflen, ub2 *flags, ub2 *method, ub1 *file_header) { + *csize = UNPACK_UB4(file_header, LOC_CSIZE); +#ifdef DEBUG + printf("Compressed size is %u\n", *csize); +#endif + + *usize = UNPACK_UB4(file_header, LOC_USIZE); +#ifdef DEBUG + printf("Uncompressed size is %u\n", *usize); +#endif + + *fnlen = UNPACK_UB2(file_header, LOC_FNLEN); +#ifdef DEBUG + printf("Filename length is %hu\n", *fnlen); +#endif + + *eflen = UNPACK_UB2(file_header, LOC_EFLEN); +#ifdef DEBUG + printf("Extra field length is %hu\n", *eflen); +#endif + + *flags = UNPACK_UB2(file_header, LOC_EXTRA); +#ifdef DEBUG + printf("Flags are %#hx\n", *flags); +#endif + + *method = UNPACK_UB2(file_header, LOC_COMP); +#ifdef DEBUG + printf("Compression method is %#hx\n", *method); +#endif + +} + +/* +Function name: new_filename +args: pbf Pointer to push back file handle. Used for reading input file. + len Length of file name to be read. +purpose: Read in the embedded file name from jar file. +returns: Pointer to newly allocated string containing file name. +*/ + +char *new_filename(pb_file *pbf, ub4 len) { + char *filename; + + if(!(filename = (char *) malloc(len + 1))) { + fprintf(stderr, "Malloc failed of filename\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + } + pb_read(pbf, filename, len); + filename[len] = '\0'; + +#ifdef DEBUG + printf("filename is %s\n", filename); +#endif + + return filename; +} + +/* +Funtion name: read_string +args: pbf Pointer to push back file handle. Used for reading input file. + size Size of embedded file in bytes. +purpose: Create a string containing the contents of the embedded noncompressed file. +returns: Pointer to newly allocated string containing embedded file contents. +*/ + +char *read_string(pb_file *pbf, int size) { + char *page; + + if(page = (char *) malloc(size + 1)) { + pb_read(pbf, page, size); + page[size] = '\0'; + } + else { + fprintf(stderr, "Malloc of page buffer failed.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(1); + } + + return page; +} + +/* +Function name: extract_line +args: stream String containing the full contents of a file which is to be substringed + in order to provide line representing our grep output. + begin Index into stream which regular expression first matches. + end Index into stream which end of match to the regular expression. + b Pointer to the index of what will be the beginning of the line when + string is returned. Used for -b option. +purpose: Create a string that can be printed by jargrep from the long string stream. +The matching line that is printed out by jargrep is generated by this function. +returns: Pointer to newly allocated string containing matched expression. +*/ + +char *extract_line(char *stream, regoff_t begin, regoff_t end, int *b) { + int e; + int length; + char *retstr; + + for(*b = begin; *b >= 0 && !iscntrl(stream[*b]); (*b)--); + (*b)++; + for(e = end; stream[e] == '\t' || !iscntrl(stream[e]); e++); + length = e - *b; + if(retstr = (char *) malloc(length + 1)) { + sprintf(retstr, "%d:", *b); + strncpy(retstr, &(stream[*b]), length); + retstr[length] = '\0'; + } + else { + fprintf(stderr, "Malloc failed of output string.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(1); + } + + return retstr; +} + +/* +Function name: chk_wrd +args: exp Pointer to compiled POSIX style regular expression of search target. + str String known to contain at least one match of exp. +purpose: Verify that the occurance of the regular expression in str occurs as a whole +word and not a substring of another word. +returns: TRUE if it is a word, FALSE of it is a substring. +*/ + +int chk_wrd(regex_t *exp, char *str) { + int wrd_fnd = FALSE; + int regflag; + int frnt_ok; + int bck_ok; + char *str2; + regmatch_t match; + + str2 = str; + frnt_ok = bck_ok = FALSE; + while(!wrd_fnd && !(regflag = regexec(exp, str2, 1, &match, 0))) { + if(!match.rm_so && (str2 == str)) frnt_ok = TRUE; + else if(!isalnum(str2[match.rm_so - 1]) && str2[match.rm_so - 1] != '_') + frnt_ok = TRUE; + else frnt_ok = FALSE; + if(frnt_ok) { + if(str2[match.rm_eo] == '\0') bck_ok = TRUE; + else if(!isalnum(str2[match.rm_eo]) && str2[match.rm_eo] != '_') + bck_ok = TRUE; + else bck_ok = FALSE; + } + wrd_fnd = frnt_ok && bck_ok; + str2 = &(str2[match.rm_eo]); + } + + return wrd_fnd; +} + +/* +Function name: prnt_mtchs +args: exp Pointer to compiled POSIX style regular expression of search target. + filename String containing the name of the embedded file which matches have + been found in. + stream String containing the processed contents of the embedded jar file + represended with filename. + pmatch Array of regmatch_t matches into stream. + nl_offset Array of offsets of '\n' characters in stream. May be NULL if -n is + not set on command line. + num Number of matches in pmatch array. + lines Number of lines in file. Not set if -n is not set on command line. + options Bitwise flag containing flags set to represent the command line + options. +purpose: Control output of jargrep. Output is controlled by which options have been +set at the command line. +*/ + +void prnt_mtchs(regex_t *exp, char *filename, char *stream, regmatch_t *pmatch, regmatch_t *nl_offset, int num, int lines, int options) { + int i; + int j = 0; + int ln_cnt; + int begin; + int o_begin; + char *str; + + o_begin = -1; + ln_cnt = 0; + for(i = 0; i < num; i++) { + str = extract_line(stream, pmatch[i].rm_so, pmatch[i].rm_eo, &begin); + if(begin > o_begin) { + if(!(options & JG_WORD_EXPRESSIONS) || chk_wrd(exp, str)) { + ln_cnt++; + if(!(options & JG_PRINT_COUNT)) { + printf("%s:", filename); + if(options & JG_PRINT_LINE_NUMBER) { + for(; j < lines && nl_offset[j].rm_so < begin; j++); + printf("%d:", j + 1); + } + if(options & JG_PRINT_BYTEOFFSET) printf("%d:", begin); + printf("%s\n", str); + } + } + } + o_begin = begin; + free(str); + } + if(options & JG_PRINT_COUNT) printf("%s:%d\n", filename, ln_cnt); +} + +/* +Function name: check_crc +args: pbf Pointer to pushback file pointer for jar file. + stream String containing the non modified contents fo the extraced file entry. + usize Size of file in bytes. +purpose: Verify the CRC matches that as what is stored in the jar file. +*/ + +void check_crc(pb_file *pbf, char *stream, ub4 usize) { + ub4 crc; + ub4 lcrc; + ub1 scratch[16]; + + crc = crc32(crc, NULL, 0); + crc = crc32(crc, stream, usize); + if(pb_read(pbf, scratch, 16) != 16) { + perror("read"); + exit(1); + } + if(UNPACK_UB4(scratch, 0) != 0x08074b50) { + fprintf(stderr, "Error! Missing data descriptor!\n"); + exit(1); + } + lcrc = UNPACK_UB4(scratch, 4); + if(crc != lcrc){ + fprintf(stderr, "Error! CRCs do not match! Got %x, expected %x\n", + crc, lcrc); + exit(1); + } +} + +/* +Function name mk_ascii +args: stream String that contains the contents of the extraced file entry. + usize String size. +purpose: Make certain that the contents of the file are ASCII, not binary. This +permits grepping of binary files as well by converting non ASCII and control characters +into '\n'. +*/ + +void mk_ascii(char *stream, int usize) { + int i; + + for(i = 0; i < usize; i++) + if(stream[i] != '\t' && (iscntrl(stream[i]) || (unsigned char) stream[i] >= 128)) + stream[i] = '\n'; +} + +/* +Funtion name: fnd_match +args: exp Pointer to compiled POSIX style regular expression of search target. + str_stream String that contains the contents of the extracted file entry. + i Pointer to counter and index of matches. +purpose: Search str_stream for occurances of the regular expression exp and create +an array of matches. +returns: Pointer to newly allocated array of regmatch_t which gives indexes to start +and end of matches. NULL is returned upon no matches found. +*/ + +regmatch_t *fnd_match(regex_t *exp, char *str_stream, int *i) { + int regflag; + regmatch_t match; + regmatch_t *match_array; + regmatch_t *tmp; + + match_array = NULL; + for(*i = 0, regflag = regexec(exp, str_stream, 1, &match, 0); !regflag; + regflag = regexec(exp, &(str_stream[match.rm_eo]), 1, &match, 0), (*i)++) + { + if(tmp = (regmatch_t *) + realloc(match_array, sizeof(regmatch_t) * ((*i) + 1))) + { + match_array = tmp; + if(*i) { + match.rm_so += match_array[(*i) - 1].rm_eo; + match.rm_eo += match_array[(*i) - 1].rm_eo; + } + match_array[*i] = match; + } + else { + fprintf(stderr, "Realloc of match_array failed.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(1); + } + } + + return match_array; +} + +/* +Function name: cont_grep +args: exp Pointer to compiled POSIX style regular expression of search target. + nl_exp Pointer to compiled POSIX style regular expression of newlines. This + argument is NULL unless the -n option is used on the command line. + fd File descriptor of the jar file being grepped. + pbf Pointer to pushback file style file stream. This is for use with + the pushback.c file io funtions. + options Bitwise flag containing flags set to represent the command line options. +purpose: This function handles single entries in an open jar file. The header is +read and then the embeded file is extracted and grepped. +returns: FALSE upon failure, TRUE otherwise. +*/ + +int cont_grep(regex_t *exp, regex_t *nl_exp, int fd, char *jarfile, pb_file *pbf, int options) { + int retflag = TRUE; + int i; + int j; + ub4 csize; + ub4 usize; + ub2 fnlen; + ub2 eflen; + ub2 flags; + ub2 method; + ub1 file_header[30]; + char *filename; + char *str_stream; + regmatch_t *match_array; + regmatch_t *nl_offsets; + + if(pb_read(pbf, (file_header + 4), 26) != 26) { + perror("read"); + retflag = FALSE; + } + else { + decd_siz(&csize, &usize, &fnlen, &eflen, &flags, &method, file_header); + filename = new_filename(pbf, fnlen); + lseek(fd, eflen, SEEK_CUR); + if(filename[fnlen - 1] != '/') { + str_stream = (method == 8 || (flags & 0x0008)) ? + (char *) inflate_string(pbf, &csize, &usize) : + read_string(pbf, csize); + if(flags & 0x008) check_crc(pbf, str_stream, usize); + mk_ascii(str_stream, usize); + match_array = fnd_match(exp, str_stream, &i); + if((options & JG_PRINT_LINE_NUMBER) && i) + nl_offsets = fnd_match(nl_exp, str_stream, &j); + prnt_mtchs(exp, filename, str_stream, match_array, nl_offsets, i, j, options); + if(match_array) free(match_array); + free(str_stream); + } + free(filename); + retflag = TRUE; + } + + return retflag; +} + +/* +Funtion name: jargrep +args: exp Pointer to compiled POSIX style regular expression of search target. + nl_exp Pointer to compiled regular expression for newlines or NULL. Only set + if -n option is present at command line. + jarfile Filename of jar file to be searched. + options Bitwise flag containing flags set to represent the command line options. +purpose: Open jar file. Check signatures. When right signature is found go to deeper +grep routine. +*/ + +void jargrep(regex_t *exp, regex_t *nl_exp, char *jarfile, int options) { + int fd; + int floop = TRUE; + pb_file pbf; + ub1 scratch[16]; + + if((fd = open(jarfile, O_RDONLY)) == -1) { + if(!(options & JG_SUPRESS_ERROR)) + fprintf(stderr, "Error reading file '%s': %s\n", jarfile, strerror(errno)); + } + else { + pb_init(&pbf, fd); + + do { + if(pb_read(&pbf, scratch, 4) != 4) { + perror("read"); + floop = FALSE; + } + else { + switch (check_sig(scratch, &pbf)) { + case 0: + floop = cont_grep(exp, nl_exp, fd, jarfile, &pbf, options); + break; + case 1: + floop = FALSE; + break; + case 2: + /* fall through continue */ + } + } + } while(floop); + } +} + +/* +Funtion Name: main +args: argc number of in coming args. + argv array of strings. +purpose: Entry point of the program. Parse command line arguments and set options. +Set up regular expressions. Call grep routines for each file as input. +returns: 1 on error 0 on success. +*/ + +int main(int argc, char **argv) { + int c; + int retval = 0; + int fileindex; + int options = 0; + regex_t *regexp; + regex_t *nl_exp = NULL; + char *regexpstr = NULL; + + while((c = getopt(argc, argv, "bce:insVw")) != -1) { + switch(c) { + case 'b': + options |= JG_PRINT_BYTEOFFSET; + break; + case 'c': + options |= JG_PRINT_COUNT; + break; + case 'e': + if(!(regexpstr = (char *) malloc(strlen(optarg) + 1))) { + fprintf(stderr, "Malloc failure.\n"); + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(1); + } + strcpy(regexpstr, optarg); + break; + case 'i': + options |= JG_IGNORE_CASE; + break; + case 'n': + options |= JG_PRINT_LINE_NUMBER; + break; + case 's': + options |= JG_SUPRESS_ERROR; + break; + case 'v': + options |= JG_INVERT; + break; + case 'V': + printf("%s\n", GVERSION); + exit(0); + case 'w': + options |= JG_WORD_EXPRESSIONS; + break; + default: + fprintf(stderr, "Unknown option -%c\n", c); + fprintf(stderr, Usage, argv[0]); + exit(1); + } + } + if(!regexpstr){ + if(((argc - optind) >= 2)) { + regexpstr = argv[optind]; + fileindex = optind + 1; + } + else { + fprintf(stderr, "Invalid arguments.\n"); + fprintf(stderr, Usage, argv[0]); + exit(1); + } + } + else if((argc - optind) == 1) { + fileindex = optind; + } + else { + fprintf(stderr, "Invalid arguments.\n"); + fprintf(stderr, Usage, argv[0]); + exit(1); + } + + if(opt_valid(options)) { + regexp = create_regexp(regexpstr, options); + if(options & JG_PRINT_LINE_NUMBER) nl_exp = create_regexp("\n", 0); + init_inflation(); + for(; fileindex < argc; fileindex++) + jargrep(regexp, nl_exp, argv[fileindex], options); + regfree(regexp); + if(options & JG_PRINT_LINE_NUMBER) regfree(nl_exp); + } + else { + retval = 1; + fprintf(stderr, "Error: Invalid combination of options.\n"); + } + + return retval; +} diff --git a/fastjar/jargrep.h b/fastjar/jargrep.h new file mode 100644 index 00000000000..0fd786b8619 --- /dev/null +++ b/fastjar/jargrep.h @@ -0,0 +1,31 @@ +/* + jargrep.h - header file for jargrep utility + Copyright (C) 2000 Cory Hollingsworth + + 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. +*/ + +/*$Id: jargrep.h,v 1.3 2000/09/13 14:02:02 cory Exp $ +*/ + +#define JG_PRINT_BYTEOFFSET 0x00000001 +#define JG_PRINT_COUNT 0x00000002 +#define JG_IGNORE_CASE 0x00000004 +#define JG_PRINT_LINE_NUMBER 0x00000008 +#define JG_SUPRESS_ERROR 0x00000010 +#define JG_INVERT 0x00000020 +#define JG_WORD_EXPRESSIONS 0x00000040 + +#define GVERSION "jargrep version 0.1 (09/12/2000)" diff --git a/fastjar/jartool.c b/fastjar/jartool.c new file mode 100644 index 00000000000..402d09ba901 --- /dev/null +++ b/fastjar/jartool.c @@ -0,0 +1,1757 @@ +/* + jartool.c - main functions for fastjar utility + Copyright (C) 1999 Bryan Burns + + 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. +*/ + +/* $Id: jartool.c,v 1.5 2000/08/24 15:01:27 cory Exp $ + + $Log: jartool.c,v $ + Revision 1.5 2000/08/24 15:01:27 cory + Made certain that fastjar opened the jar file before trying to update it + with the -u option. + + Revision 1.4 2000/08/24 13:39:21 cory + Changed +'s to |'s in jartool.c to insure there was no confusion with sign + when byte swapping. Better safe than sorry. + + Revision 1.3 2000/08/23 19:42:17 cory + Added support for more Unix platforms. The following code has been hacked + to work on AIX, Solaris, True 64, and HP-UX. + Added bigendian check. Probably works on most big and little endian platforms + now. + + Revision 1.2 1999/12/06 07:38:28 toast + fixed recursive archiving bug + + Revision 1.1.1.1 1999/12/06 03:09:34 toast + initial checkin.. + + + + Revision 1.22 1999/10/12 19:45:13 burnsbr + adding patch to fix compat problem + + Revision 1.21 1999/05/10 09:15:49 burnsbr + fixed manifest file version info + + Revision 1.20 1999/05/10 08:53:16 burnsbr + *** empty log message *** + + Revision 1.19 1999/05/10 08:30:39 burnsbr + added extract / listing code + + Revision 1.18 1999/04/28 04:24:29 burnsbr + updated version + + Revision 1.17 1999/04/28 04:21:23 burnsbr + added support for -C dir-changing flag.. Updated total compression display + + Revision 1.16 1999/04/27 10:28:22 burnsbr + updated version string + + Revision 1.15 1999/04/27 10:04:06 burnsbr + configure support + + Revision 1.14 1999/04/27 08:56:14 burnsbr + added -V flag, better error messages + + Revision 1.13 1999/04/26 02:35:21 burnsbr + changed all sorts of stuff.. compression now works 100% + + Revision 1.12 1999/04/23 12:00:45 burnsbr + 90% done with compression code + + Revision 1.11 1999/04/22 04:12:57 burnsbr + finished first round of Manifest file support.. + might need to do more, digest etc.. + + Revision 1.10 1999/04/22 02:35:23 burnsbr + added more manifest support, about 75% done now. Replaced all the + redundant shifts and bit-logic with a macro or two, making the code + easier to read. + + Revision 1.9 1999/04/21 09:55:16 burnsbr + pulled out printfs + + Revision 1.8 1999/04/21 02:58:01 burnsbr + started manifest code + + Revision 1.7 1999/04/20 23:15:28 burnsbr + added patch sent by John Bley <jbb6@acpub.duke.edu> + + Revision 1.6 1999/04/20 08:56:02 burnsbr + added GPL comment + + Revision 1.5 1999/04/20 08:16:09 burnsbr + fixed verbose flag, did some optimization + + Revision 1.4 1999/04/20 05:09:59 burnsbr + added rcsid variable + + Revision 1.3 1999/04/20 05:08:54 burnsbr + fixed Log statement + +*/ + +#include "config.h" + +#include <zlib.h> + +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <stdio.h> +#include <sys/stat.h> +#include <sys/types.h> + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#else +#define MAXPATHLEN 1024 +#endif + +#ifdef HAVE_DIRENT_H +#include <dirent.h> +#endif + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#include <string.h> +#include <errno.h> + +#ifdef TM_IN_SYS_TIME +#include <sys/time.h> +#else +#include <time.h> +#endif + +#include "jartool.h" +#include "zipfile.h" +#include "dostime.h" +#include "pushback.h" +#include "compress.h" + +#ifdef WORDS_BIGENDIAN + +#define L2BI(l) ((l & 0xff000000) >> 24) | \ + ((l & 0x00ff0000) >> 8) | \ + ((l & 0x0000ff00) << 8) | \ + ((l & 0x000000ff) << 24); + +#define L2BS(l) ((l & 0xff00) >> 8) | ((l & 0x00ff) << 8); + +#endif + +static char version_string[] = VERSION; +static char rcsid[] = "$Id: jartool.c,v 1.5 2000/08/24 15:01:27 cory Exp $"; + +extern int errno; + +void usage(char*); +void add_entry(struct zipentry *); +void init_headers(); + +int consume(pb_file *, int); +int list_jar(int, char**, int); +int extract_jar(int, char**, int); +int add_file_to_jar(int, int, char*, struct stat*); +int add_to_jar(int, char*, char*); +int create_central_header(int); +int make_manifest(int, char*); +static void init_args(char **, int); +static char *get_next_arg (); + +/* global variables */ +ub1 file_header[30]; +ub1 data_descriptor[16]; +int do_compress; +int seekable; +int verbose; +char jarfile[256]; + +/* If non zero, then don't recurse in directory. Instead, add the + directory entry and relie on an explicit list of files to populate + the archive. This option isn't supported by the original jar tool. */ +int use_explicit_list_only; + +/* If non zero, then read the entry names from stdin. This option + isn't supported by the original jar tool. */ +int read_names_from_stdin; + +zipentry *ziplist; /* linked list of entries */ +zipentry *ziptail; /* tail of the linked list */ + +int number_of_entries; /* number of entries in the linked list */ + +int main(int argc, char **argv){ + + char mfile[256]; + + int action = ACTION_NONE; + int manifest = TRUE; + int manifest_file = FALSE; + int file = FALSE; + int file_first = FALSE; + + int i, j; + int jarfd = -1; + + do_compress = TRUE; + verbose = FALSE; + + ziplist = NULL; + + number_of_entries = 0; + + if(argc < 2) + usage(argv[0]); + + j = strlen(argv[1]); + + for(i = 0; i < j; i++){ + switch(argv[1][i]){ + case 'c': + action = ACTION_CREATE; + break; + case 't': + action = ACTION_LIST; + break; + case 'x': + action = ACTION_EXTRACT; + break; + case 'u': + action = ACTION_UPDATE; + break; + case 'v': + verbose = TRUE; + break; + case 'V': + printf("%s\n", version_string); + exit(0); + case 'f': + file = TRUE; + if(!manifest_file) + file_first = TRUE; + else + file_first = FALSE; + break; + case 'm': + manifest_file = TRUE; + break; + case '0': + do_compress = FALSE; + break; + case 'M': + manifest = FALSE; + break; + case '-': + break; + /* The following options aren't supported by the original jar tool. */ + case 'E': + use_explicit_list_only = TRUE; + break; + case '@': + read_names_from_stdin = TRUE; + break; + default: + fprintf(stderr, "Illegal option: %c\n", argv[1][i]); + usage(argv[0]); + } + } + + if(action == ACTION_NONE){ + fprintf(stderr, "One of options -{ctxu} must be specified.\n"); + usage(argv[0]); + } + + /* Verify unsupported combinations and warn of the use of non + standard features */ + if(verbose && use_explicit_list_only) + fprintf (stderr, "Warning: using non standard '-E' option\n"); + if(verbose && read_names_from_stdin) + fprintf (stderr, "Warning: using non standard '-@' option\n"); + if(read_names_from_stdin + && (action != ACTION_CREATE && action != ACTION_UPDATE)){ + fprintf(stderr, "Option '-@' is supported only with '-c' or '-u'.\n"); + usage(argv[0]); + } + + i = 2; + + /* get the jarfile and manifest file (if any) */ + if(file && file_first){ + if(i >= argc) + usage(argv[0]); + + strncpy(jarfile, argv[i++], 256); + } + if(manifest_file){ + if(i >= argc) + usage(argv[0]); + + strncpy(mfile, argv[i++], 256); + } + + if(file && !file_first){ + if(i >= argc) + usage(argv[0]); + + strncpy(jarfile, argv[i++], 256); + } + + /* create the jarfile */ + if(action == ACTION_CREATE){ + if(file){ + jarfd = creat(jarfile, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + + if(jarfd < 0){ + fprintf(stderr, "Error opening %s for writing!\n", jarfile); + perror(jarfile); + exit(1); + } + + /* We assume that the file is seekable */ + seekable = TRUE; + + } else { + + jarfd = STDOUT_FILENO; /* jarfd is stdout otherwise */ + + /* standard out is not seekable */ + seekable = FALSE; + + /* don't want our output to be part of the jar file.. figured this one + out the hard way.. =P */ + verbose = FALSE; + } + } else if(action == ACTION_LIST || action == ACTION_EXTRACT){ + + if(file){ + jarfd = open(jarfile, O_RDONLY); + + if(jarfd < 0){ + fprintf(stderr, "Error opening %s for reading!\n", jarfile); + perror(jarfile); + exit(1); + } + + seekable = TRUE; + } else { + jarfd = STDIN_FILENO; /* jarfd is standard in */ + + /* we assume that the stream isn't seekable for safety */ + seekable = FALSE; + } + } + + if(action == ACTION_CREATE || action == ACTION_UPDATE){ + char *arg; + init_headers(); + + if((action == ACTION_UPDATE) && file) { + if((jarfd = open(jarfile, O_RDWR)) < 0) { + fprintf(stderr, "Error opening %s for reading!\n", jarfile); + perror(jarfile); + exit(1); + } + } + + if(do_compress) + init_compression(); + + + /* Add the META-INF/ directory and the manifest */ + if(manifest && manifest_file) + make_manifest(jarfd, mfile); + else if(manifest) + make_manifest(jarfd, NULL); + + init_args (argv, i); + /* now we add the files to the archive */ + while ((arg = get_next_arg ())){ + + if(!strcmp(arg, "-C")){ + char *dir_to_change = get_next_arg (); + char *file_to_add = get_next_arg (); + if(!dir_to_change + || !file_to_add + || add_to_jar(jarfd, dir_to_change, file_to_add)){ + printf("Error adding %s to jar archive!\n", arg); + exit(1); + } + } else { + if(add_to_jar(jarfd, NULL, arg)){ + printf("Error adding %s to jar archive!\n", arg); + exit(1); + } + } + } + /* de-initialize the compression DS */ + if(do_compress) + end_compression(); + + create_central_header(jarfd); + + if (close(jarfd) != 0) { + fprintf(stderr, "Error closing jar archive!\n"); + } + } else if(action == ACTION_LIST){ + list_jar(jarfd, &argv[i], (argc - i)); + } else if(action == ACTION_EXTRACT){ + extract_jar(jarfd, &argv[i], (argc - i)); + } + + exit(0); +} + +static int args_current_g; +static char **args_g; + +static void +init_args(args, current) + char **args; + int current; +{ + if(!read_names_from_stdin) + { + args_g = args; + args_current_g = current; + } +} + +static char * +get_next_arg () +{ + static int reached_end = 0; + + if (reached_end) + return NULL; + + if (args_g) + { + if (!args_g [args_current_g]) + { + reached_end = 1; + return NULL; + } + return args_g [args_current_g++]; + } + else + { + /* Read the name from stdin. Delimiters are '\n' and + '\r'. Reading EOF indicates that we don't have anymore file + names characters to read. */ + + char s [MAXPATHLEN]; + int pos = 0; + + /* Get rid of '\n' and '\r' first. */ + while (1) + { + int c = getc (stdin); + if (c == '\n' || c == '\r') + continue; + else + { + if (c == EOF) + return NULL; + ungetc (c, stdin); + break; + } + } + + while (1) + { + int c = getc (stdin); + /* Exit when we get a delimiter or don't have any characters + to read */ + if (c == '\n'|| c == '\r'|| c == EOF) + break; + s [pos++] = (char) c; + } + + if (pos) + { + s [pos] = '\0'; + return strdup (s); + } + else + return NULL; + } +} + +void init_headers(){ + /* packing file header */ + /* magic number */ + file_header[0] = 0x50; + file_header[1] = 0x4b; + file_header[2] = 0x03; + file_header[3] = 0x04; + /* version number (Unix 1.0)*/ + file_header[4] = 10; + file_header[5] = 0; + /* bit flag (normal deflation)*/ + file_header[6] = 0x00; + + file_header[7] = 0x00; + /* do_compression method (deflation) */ + file_header[8] = 0; + file_header[9] = 0; + + /* last mod file time (MS-DOS format) */ + file_header[10] = 0; + file_header[11] = 0; + /* last mod file date (MS-DOS format) */ + file_header[12] = 0; + file_header[13] = 0; + /* CRC 32 */ + file_header[14] = 0; + file_header[15] = 0; + file_header[16] = 0; + file_header[17] = 0; + /* compressed size */ + file_header[18] = 0; + file_header[19] = 0; + file_header[20] = 0; + file_header[21] = 0; + /* uncompressed size */ + file_header[22] = 0; + file_header[23] = 0; + file_header[24] = 0; + file_header[25] = 0; + /* filename length */ + file_header[26] = 0; + file_header[27] = 0; + /* extra field length */ + file_header[28] = 0; + file_header[29] = 0; + + /* Initialize the compression DS */ + PACK_UB4(data_descriptor, 0, 0x08074b50); + +} + +void add_entry(struct zipentry *ze){ + + if(ziplist == NULL){ + ziplist = ze; + ziptail = ziplist; + } else { + ziplist->next_entry = ze; + ziplist = ze; + } + + number_of_entries++; +} + +int make_manifest(int jfd, char *mf_name){ + time_t current_time; + int nlen; /* length of file name */ + int mod_time; /* file modification time */ + struct zipentry *ze; + + nlen = 9; /* trust me on this one */ + + memset((file_header + 12), '\0', 16); /*clear mod time, crc, size fields*/ + + current_time = time(NULL); + if(current_time == (time_t)-1){ + perror("time"); + exit(1); + } + + mod_time = unix2dostime(¤t_time); + + PACK_UB2(file_header, LOC_EXTRA, 0); + PACK_UB2(file_header, LOC_COMP, 0); + PACK_UB2(file_header, LOC_FNLEN, nlen); + PACK_UB4(file_header, LOC_MODTIME, mod_time); + + if(verbose) + printf("adding: META-INF/ (in=0) (out=0) (stored 0%%)\n"); + + ze = (zipentry*)malloc(sizeof(zipentry)); + if(ze == NULL){ + perror("malloc"); + exit(1); + } + + memset(ze, 0, sizeof(zipentry)); /* clear all the fields*/ + ze->filename = (char*)malloc((nlen + 1) * sizeof(char) + 1); + strcpy(ze->filename, "META-INF/"); + ze->filename[nlen] = '\0'; + + ze->offset = lseek(jfd, 0, SEEK_CUR); + ze->mod_time = (ub2)(mod_time & 0x0000ffff); + ze->mod_date = (ub2)((mod_time & 0xffff0000) >> 16); + ze->compressed = FALSE; + + add_entry(ze); + + write(jfd, file_header, 30); + write(jfd, "META-INF/", nlen); + + /* if the user didn't specify an external manifest file... */ + if(mf_name == NULL){ + int mf_len = 37 + strlen(VERSION); + char *mf; + + if(mf = (char *) malloc(mf_len + 1)) { + uLong crc; + + sprintf(mf, "Manifest-Version: 1.0\nCreated-By: %s\n\n", VERSION); + + crc = crc32(0L, Z_NULL, 0); + + crc = crc32(crc, mf, mf_len); + + nlen = 20; /* once again, trust me */ + + PACK_UB2(file_header, LOC_EXTRA, 0); + PACK_UB2(file_header, LOC_COMP, 0); + PACK_UB2(file_header, LOC_FNLEN, nlen); + PACK_UB4(file_header, LOC_USIZE, mf_len); + + memcpy((file_header + LOC_CSIZE), (file_header + LOC_USIZE), 4); + + PACK_UB4(file_header, LOC_CRC, crc); + + if(verbose) + printf("adding: META-INF/MANIFEST.MF (in=56) (out=56) (stored 0%%)\n"); + + ze = (zipentry*)malloc(sizeof(zipentry)); + if(ze == NULL){ + perror("malloc"); + exit(1); + } + + memset(ze, 0, sizeof(zipentry)); /* clear all the fields*/ + ze->filename = (char*)malloc((nlen + 1) * sizeof(char) + 1); + strcpy(ze->filename, "META-INF/MANIFEST.MF"); + ze->filename[nlen] = '\0'; + + ze->offset = lseek(jfd, 0, SEEK_CUR); + ze->mod_time = (ub2)(mod_time & 0x0000ffff); + ze->mod_date = (ub2)((mod_time & 0xffff0000) >> 16); + ze->crc = crc; + ze->csize = mf_len; + ze->usize = ze->csize; + ze->compressed = FALSE; + + add_entry(ze); + + write(jfd, file_header, 30); + write(jfd, "META-INF/MANIFEST.MF", nlen); + write(jfd, mf, mf_len); + free(mf); + } + else { + printf("malloc errror\n"); + exit(-1); + } + } else { + int mfd; + struct stat statbuf; + + stat(mf_name, &statbuf); + + if(!S_ISREG(statbuf.st_mode)){ + fprintf(stderr, "Invalid manifest file specified.\n"); + exit(1); + } + + mfd = open(mf_name, O_RDONLY); + + if(mfd < 0){ + fprintf(stderr, "Error opening %s.\n", mf_name); + exit(1); + } + + if(add_file_to_jar(jfd, mfd, "META-INF/MANIFEST.MF", &statbuf)){ + perror("error writing to jar"); + exit(1); + } + + } + + return 0; +} + +int add_to_jar(int fd, char *new_dir, char *file){ + struct stat statbuf; + DIR *dir; + struct dirent *de; + zipentry *ze; + int stat_return; + char *old_dir = NULL; + + /* This is a quick compatibility fix -- Simon Weijgers <simon@weijgers.com> + * It fixes this: + * "normal" jar : org/apache/java/io/LogRecord.class + * fastjar : ./org/apache/java/io/LogRecord.class + * Fastjar's preservation of the ./'s makes the jarfile unusuable for use + * with both kaffe-1.0b4 and JDK. + */ + while (*file=='.' && *(file+1)=='/') + file+=2; + + /* If new_dir isn't null, we need to change to that directory. However, + we also need to return to the old directory when we're done */ + if(new_dir != NULL){ + old_dir = getcwd(NULL, 0); + + if(chdir(new_dir) == -1){ + perror(new_dir); + return 1; + } + } + + if(!strcmp(file, jarfile)){ + if(verbose) + printf("skipping: %s\n", file); + return 0; /* we don't want to add ourselves.. */ + } + + stat_return = stat(file, &statbuf); + + if(stat_return == -1){ + perror(file); + } else if(S_ISDIR(statbuf.st_mode)){ + char *fullname; + char *t_ptr; + int nlen; + unsigned long mod_time; + + dir = opendir(file); + + if(dir == NULL){ + perror("opendir"); + return 1; + } + + nlen = strlen(file) + 256; + fullname = (char*)malloc(nlen * sizeof(char)); + memset(fullname, 0, (nlen * sizeof(char))); + + if(fullname == NULL){ + fprintf(stderr, "Filename is NULL!\n"); + return 1; + } + + strcpy(fullname, file); + nlen = strlen(file); + + if(fullname[nlen - 1] != '/'){ + fullname[nlen] = '/'; + t_ptr = (fullname + nlen + 1); + } else + t_ptr = (fullname + nlen); + + + memset((file_header + 12), '\0', 16); /*clear mod time, crc, size fields*/ + + nlen = (t_ptr - fullname); + + mod_time = unix2dostime(&statbuf.st_mtime); + + PACK_UB2(file_header, LOC_EXTRA, 0); + PACK_UB2(file_header, LOC_COMP, 0); + PACK_UB2(file_header, LOC_FNLEN, nlen); + PACK_UB4(file_header, LOC_MODTIME, mod_time); + + if(verbose) + printf("adding: %s (in=%d) (out=%d) (stored 0%%)\n", fullname, 0, 0); + + ze = (zipentry*)malloc(sizeof(zipentry)); + if(ze == NULL){ + perror("malloc"); + exit(1); + } + + memset(ze, 0, sizeof(zipentry)); /* clear all the fields*/ + ze->filename = (char*)malloc((nlen + 1) * sizeof(char) + 1); + strcpy(ze->filename, fullname); + ze->filename[nlen] = '\0'; + + ze->offset = lseek(fd, 0, SEEK_CUR); + ze->mod_time = (ub2)(mod_time & 0x0000ffff); + ze->mod_date = (ub2)((mod_time & 0xffff0000) >> 16); + ze->compressed = FALSE; + + add_entry(ze); + + write(fd, file_header, 30); + write(fd, fullname, nlen); + + while(!use_explicit_list_only && (de = readdir(dir)) != NULL){ + if(de->d_name[0] == '.') + continue; + if(!strcmp(de->d_name, jarfile)){ /* we don't want to add ourselves. Believe me */ + if(verbose) + printf("skipping: %s\n", de->d_name); + continue; + } + + strcpy(t_ptr, de->d_name); + + if(add_to_jar(fd, NULL, fullname)){ + fprintf(stderr, "Error adding file to jar!\n"); + return 1; + } + } + + free(fullname); + closedir(dir); + + } else if(S_ISREG(statbuf.st_mode)){ + int add_fd; + + add_fd = open(file, O_RDONLY); + if(add_fd < 0){ + fprintf(stderr, "Error opening %s.\n", file); + return 0; + } + + if(add_file_to_jar(fd, add_fd, file, &statbuf)){ + fprintf(stderr, "Error adding file to jar!\n"); + return 1; + } + + } else { + fprintf(stderr, "Illegal file specified: %s\n", file); + } + + if(old_dir != NULL){ + if(chdir(old_dir)) + perror(old_dir); + + free(old_dir); + } + + return 0; +} + +int add_file_to_jar(int jfd, int ffd, char *fname, struct stat *statbuf){ + + unsigned short file_name_length; + unsigned long mod_time; + ub1 rd_buff[RDSZ]; + uLong crc = 0; + off_t offset = 0; + int rdamt; + struct zipentry *ze; + + mod_time = unix2dostime(&(statbuf->st_mtime)); + file_name_length = strlen(fname); + + if(!seekable && !do_compress){ + crc = crc32(0L, Z_NULL, 0); + + while((rdamt = read(ffd, rd_buff, RDSZ)) != 0) + crc = crc32(crc, rd_buff, rdamt); + + lseek(ffd, 0, SEEK_SET); + } + + /* data descriptor */ + if(!seekable && do_compress){ + PACK_UB2(file_header, LOC_EXTRA, 8); + } else { + PACK_UB2(file_header, LOC_EXTRA, 0); + } + + if(do_compress){ + PACK_UB2(file_header, LOC_COMP, 8); + } else { + PACK_UB2(file_header, LOC_COMP, 0); + } + + PACK_UB4(file_header, LOC_MODTIME, mod_time); + PACK_UB2(file_header, LOC_FNLEN, file_name_length); + + if(!seekable && !do_compress){ + PACK_UB4(file_header, LOC_CRC, crc); + PACK_UB4(file_header, LOC_USIZE, statbuf->st_size); + PACK_UB4(file_header, LOC_CSIZE, statbuf->st_size); + } else + memset((file_header + LOC_CRC), '\0', 12); /* clear crc/usize/csize */ + + ze = (zipentry*)malloc(sizeof(zipentry)); + if(ze == NULL){ + perror("malloc"); + exit(1); + } + + memset(ze, 0, sizeof(zipentry)); /* clear all the fields*/ + ze->filename = (char*)malloc((file_name_length + 1) * sizeof(char)); + strcpy(ze->filename, fname); + + ze->mod_time = (ub2)(mod_time & 0x0000ffff); + ze->mod_date = (ub2)((mod_time & 0xffff0000) >> 16); + + if(!seekable && !do_compress) + ze->crc = crc; + + ze->csize = statbuf->st_size; + ze->usize = ze->csize; + ze->offset = lseek(jfd, 0, SEEK_CUR); + if(do_compress) + ze->compressed = TRUE; + else + ze->compressed = FALSE; + + add_entry(ze); + + /* Write the local header */ + write(jfd, file_header, 30); + + /* write the file name to the zip file */ + write(jfd, fname, file_name_length); + + + if(verbose){ + printf("adding: %s ", fname); + fflush(stdout); + } + + if(do_compress){ + /* compress the file */ + compress_file(ffd, jfd, ze); + } else { + /* Write the contents of the file (uncompressed) to the zip file */ + /* calculate the CRC as we go along */ + ze->crc = crc32(0L, Z_NULL, 0); + + while((rdamt = read(ffd, rd_buff, RDSZ)) != 0){ + ze->crc = crc32(ze->crc, rd_buff, rdamt); + if(write(jfd, rd_buff, rdamt) != rdamt){ + perror("write"); + return 0; + } + } + } + close(ffd); + + /* write out data descriptor */ + PACK_UB4(data_descriptor, 4, ze->crc); + PACK_UB4(data_descriptor, 8, ze->csize); + PACK_UB4(data_descriptor, 12, ze->usize); + + /* we need to seek back and fill the header */ + if(seekable){ + offset = (ze->csize + strlen(ze->filename) + 16); + + if(lseek(jfd, -offset, SEEK_CUR) == (off_t)-1){ + perror("lseek"); + exit(1); + } + + if(write(jfd, (data_descriptor + 4), 12) != 12){ + perror("write"); + return 0; + } + + offset -= 12; + + if(lseek(jfd, offset, SEEK_CUR) == (off_t)-1){ + perror("lseek"); + exit(1); + } + } else if(do_compress){ + /* Sun's jar tool will only allow a data descriptor if the entry is + compressed, but we'll save 16 bytes/entry if we only use it when + we can't seek back on the file */ + + if(write(jfd, data_descriptor, 16) != 16){ + perror("write"); + return 0; + } + } + + if(verbose) + printf("(in=%d) (out=%d) (%s %d%%)\n", + (int)ze->usize, (int)ze->csize, + (do_compress ? "deflated" : "stored"), + (do_compress ? ((int)((1 - ze->csize/(float)ze->usize) * 100)) : 0)); + + return 0; +} + +int create_central_header(int fd){ + ub1 header[46]; + ub1 end_header[22]; + int start_offset; + int dir_size; + int *iheader; + int total_in = 0, total_out = 22; + + zipentry *ze; + + iheader = (int*)header; + + /* magic number */ + header[0] = 'P'; + header[1] = 'K'; + header[2] = 1; + header[3] = 2; + /* version made by */ + header[4] = 10; + header[5] = 0; + /* version needed to extract */ + header[6] = 10; + header[7] = 0; + /* bit flag */ + header[8] = 0; + header[9] = 0; + /* compression method */ + header[10] = 0; + header[11] = 0; + /* file mod time */ + header[12] = 0; + header[13] = 0; + /* file mod date */ + header[14] = 0; + header[15] = 0; + /* crc 32 */ + header[16] = 0; + header[17] = 0; + header[18] = 0; + header[19] = 0; + /* compressed size */ + header[20] = 0; + header[21] = 0; + header[22] = 0; + header[23] = 0; + /* uncompressed size */ + header[24] = 0; + header[25] = 0; + header[26] = 0; + header[27] = 0; + /* filename length */ + header[28] = 0; + header[29] = 0; + /* extra field length */ + header[30] = 0; + header[31] = 0; + /* file comment length */ + header[32] = 0; + header[33] = 0; + /* disk number start */ + header[34] = 0; + header[35] = 0; + /* internal file attribs */ + header[36] = 0; + header[37] = 0; + /* external file attribs */ + header[38] = 0; + header[39] = 0; + header[40] = 0; + header[41] = 0; + /* relative offset of local header */ + header[42] = 0; + header[43] = 0; + header[44] = 0; + header[45] = 0; + + start_offset = lseek(fd, 0, SEEK_CUR); + + for(ze = ziptail; ze != NULL; ze = ze->next_entry){ + + total_in += ze->usize; + total_out += ze->csize + 76 + strlen(ze->filename) * 2; + + if(ze->compressed){ + PACK_UB2(header, CEN_COMP, 8); + } else { + PACK_UB2(header, CEN_COMP, 0); + } + + PACK_UB2(header, CEN_MODTIME, ze->mod_time); + PACK_UB2(header, CEN_MODDATE, ze->mod_date); + PACK_UB4(header, CEN_CRC, ze->crc); + PACK_UB4(header, CEN_CSIZE, ze->csize); + PACK_UB4(header, CEN_USIZE, ze->usize); + PACK_UB2(header, CEN_FNLEN, strlen(ze->filename)); + PACK_UB4(header, CEN_OFFSET, ze->offset); + + write(fd, header, 46); + + write(fd, ze->filename, strlen(ze->filename)); + } + + dir_size = lseek(fd, 0, SEEK_CUR) - start_offset; + + /* magic number */ + end_header[0] = 0x50; + end_header[1] = 0x4b; + end_header[2] = 0x05; + end_header[3] = 0x06; + /* number of this disk */ + end_header[4] = 0; + end_header[5] = 0; + /* number of disk w/ start of central header */ + end_header[6] = 0; + end_header[7] = 0; + /* total number of entries in central dir on this disk*/ + PACK_UB2(end_header, 8, number_of_entries); + /* total number of entries in central dir*/ + PACK_UB2(end_header, 10, number_of_entries); + /* size of central dir. */ + PACK_UB4(end_header, 12, dir_size); + /* offset of start of central dir */ + PACK_UB4(end_header, 16, start_offset); + /* zipfile comment length */ + end_header[20] = 0; + end_header[21] = 0; + + write(fd, end_header, 22); + + if(verbose) + printf("Total:\n------\n(in = %d) (out = %d) (%s %d%%)\n", + total_in, + total_out, + (do_compress ? "deflated" : "stored"), + (int)((1 - (total_out / (float)total_in)) * 100) + ); + + return 0; +} + +int extract_jar(int fd, char **files, int file_num){ + int rdamt; + int out_a, in_a; + ub4 signature; + ub4 csize; + ub4 crc; + ub2 fnlen; + ub2 eflen; + ub2 flags; + ub2 method; + ub1 *filename = NULL; + int filename_len = 0; + ub4 rd_buff[RDSZ]; + pb_file pbf; + ub1 scratch[16]; + zipentry ze; + int f_fd; + int dir; + int handle; + int j; + + init_inflation(); + + pb_init(&pbf, fd); + + for(;;){ + f_fd = 0; + crc = 0; + ze.crc = 0; + + dir = FALSE; /* by default, the file isn't a dir */ + handle = TRUE; /* by default we'll extract/create the file */ + + if((rdamt = pb_read(&pbf, scratch, 4)) != 4){ + perror("read"); + break; + } + + signature = UNPACK_UB4(scratch, 0); + +#ifdef DEBUG + printf("signature is %x\n", signature); +#endif + if(signature == 0x08074b50){ +#ifdef DEBUG + printf("skipping data descriptor\n"); +#endif + pb_read(&pbf, scratch, 12); + continue; + } else if(signature == 0x02014b50){ +#ifdef DEBUG + printf("Central header reached.. we're all done!\n"); +#endif + break; + }else if(signature != 0x04034b50){ + printf("Ick! %#x\n", signature); + break; + } + + if((rdamt = pb_read(&pbf, (file_header + 4), 26)) != 26){ + perror("read"); + break; + } + + csize = UNPACK_UB4(file_header, LOC_CSIZE); +#ifdef DEBUG + printf("Compressed size is %u\n", csize); +#endif + + fnlen = UNPACK_UB2(file_header, LOC_FNLEN); +#ifdef DEBUG + printf("Filename length is %hu\n", fnlen); +#endif + + eflen = UNPACK_UB2(file_header, LOC_EFLEN); +#ifdef DEBUG + printf("Extra field length is %hu\n", eflen); +#endif + + flags = UNPACK_UB2(file_header, LOC_EXTRA); +#ifdef DEBUG + printf("Flags are %#hx\n", flags); +#endif + + method = UNPACK_UB2(file_header, LOC_COMP); +#ifdef DEBUG + printf("Compression method is %#hx\n", method); +#endif + + /* if there isn't a data descriptor */ + if(!(flags & 0x0008)){ + crc = UNPACK_UB4(file_header, LOC_CRC); +#ifdef DEBUG + printf("CRC is %x\n", crc); +#endif + } + + if(filename_len < fnlen){ + if(filename != NULL) + free(filename); + + filename = malloc(sizeof(ub1) * (fnlen + 1)); + filename_len = fnlen + 1; + } + + pb_read(&pbf, filename, fnlen); + filename[fnlen] = '\0'; + +#ifdef DEBUG + printf("filename is %s\n", filename); +#endif + + if(file_num > 0){ + handle = FALSE; + + for(j = 0; j < file_num; j++) + if(strcmp(files[j], filename) == 0){ + handle = TRUE; + break; + } + } + + if(!handle) + f_fd = -1; + + /* OK, there is some directory information in the file. Nothing to do + but ensure the directory(s) exist, and create them if they don't. + What a pain! */ + if(index(filename, '/') != NULL && handle){ + /* Loop through all the directories in the path, (everything w/ a '/') */ + ub1 *start = filename; + char *tmp_buff; + struct stat sbuf; + + tmp_buff = malloc(sizeof(char) * strlen(filename)); + + for(;;){ + ub1 *idx = index(start, '/'); + + if(idx == NULL) + break; + else if(idx == start){ + start++; + continue; + } + start = idx + 1; + + strncpy(tmp_buff, filename, (idx - filename)); + tmp_buff[(idx - filename)] = '\0'; + +#ifdef DEBUG + printf("checking the existance of %s\n", tmp_buff); +#endif + + if(stat(tmp_buff, &sbuf) < 0){ + if(errno != ENOENT){ + perror("stat"); + exit(1); + } + + } else if(S_ISDIR(sbuf.st_mode)){ +#ifdef DEBUG + printf("Directory exists\n"); +#endif + continue; + }else { + fprintf(stderr, "Hmmm.. %s exists but isn't a directory!\n", + tmp_buff); + exit(1); + } + +#ifdef DEBUG + printf("Making directory..\n"); +#endif + if(mkdir(tmp_buff, 0755) < 0){ + perror("mkdir"); + exit(1); + } + if(verbose && handle) + printf("%10s: %s/\n", "created", tmp_buff); + + } + + /* only a directory */ + if(strlen(start) == 0) + dir = TRUE; + +#ifdef DEBUG + printf("Leftovers are \"%s\" (%d)\n", start, strlen(start)); +#endif + + /* If the entry was just a directory, don't write to file, etc */ + if(strlen(start) == 0) + f_fd = -1; + + free(tmp_buff); + } + + if(f_fd != -1 && handle){ + f_fd = creat(filename, 00644); + + if(f_fd < 0){ + fprintf(stderr, "Error extracting JAR archive!\n"); + perror(filename); + exit(1); + } + } + + if(method != 8 && flags & 0x0008){ + fprintf(stderr, "Error in JAR file! (not compressed but data desc.)\n"); + exit(1); + } + + if(method == 8 || flags & 0x0008){ + if(seekable) + lseek(fd, eflen, SEEK_CUR); + else + consume(&pbf, eflen); + + inflate_file(&pbf, f_fd, &ze); + } else { + +#ifdef DEBUG + printf("writing stored data.. (%d bytes)\n", csize); +#endif + + out_a = 0; + in_a = csize; + + ze.crc = crc32(ze.crc, NULL, 0); /* initialize the crc */ + + while(out_a < csize){ + rdamt = (in_a > RDSZ ? RDSZ : in_a); + if(pb_read(&pbf, rd_buff, rdamt) != rdamt){ + perror("read"); + exit(1); + } + + ze.crc = crc32(ze.crc, (Bytef*)rd_buff, rdamt); + + if(f_fd >= 0) + write(f_fd, rd_buff, rdamt); + + out_a += rdamt; + in_a -= rdamt; + +#ifdef DEBUG + printf("%d bytes written\n", out_a); +#endif + } + + if(seekable) + lseek(fd, eflen, SEEK_CUR); + else + consume(&pbf, eflen); + } + + /* if there is a data descriptor left, compare the CRC */ + if(flags & 0x0008){ + + if(pb_read(&pbf, scratch, 16) != 16){ + perror("read"); + exit(1); + } + + signature = UNPACK_UB4(scratch, 0); + + if(signature != 0x08074b50){ + fprintf(stderr, "Error! Missing data descriptor!\n"); + exit(1); + } + + crc = UNPACK_UB4(scratch, 4); + + } + + if(crc != ze.crc){ + fprintf(stderr, "Error! CRCs do not match! Got %x, expected %x\n", + ze.crc, crc); + exit(1); + } + + close(f_fd); + + if(verbose && dir == FALSE && handle) + printf("%10s: %s\n", + (method == 8 ? "inflated" : "extracted"), + filename); + } + + return 0; +} + +int list_jar(int fd, char **files, int file_num){ + int rdamt; + ub4 signature; + ub4 csize; + ub4 usize; + ub4 mdate; + ub4 tmp; + ub2 fnlen; + ub2 eflen; + ub2 clen; + ub2 flags; + ub2 method; + ub2 cen_size; + ub1 *filename = NULL; + ub1 scratch[16]; + ub1 cen_header[46]; + int filename_len = 0; + off_t size; + int i, j; + time_t tdate; + struct tm *s_tm; + char ascii_date[30]; + zipentry ze; + +#ifdef DEBUG + printf("Listing jar file, looking for %d files\n", file_num); +#endif + + /* This should be the start of the central-header-end section */ + if(seekable){ + if(lseek(fd, -22, SEEK_END) == (off_t)-1){ + perror("lseek"); + exit(1); + } + + if(read(fd, &tmp, sizeof(ub4)) != 4){ + perror("read"); + exit(1); + } + +#ifdef WORDS_BIGENDIAN + tmp = L2BI(tmp); +#endif + + if(tmp != 0x06054b50){ + fprintf(stderr, "Error in JAR file format. zip-style comment?\n"); + exit(1); + } + + if(lseek(fd, 6, SEEK_CUR) == (off_t)-1){ + perror("lseek"); + exit(1); + } + + if(read(fd, &cen_size, 2) != 2){ + perror("read"); + exit(1); + } + +#ifdef WORDS_BIGENDIAN + cen_size = L2BS(cen_size); +#endif + + /* printf("%hu entries in central header\n", cen_size); */ + + if(lseek(fd, 4, SEEK_CUR) == (off_t)-1){ + perror("lseek"); + exit(1); + } + + if(read(fd, &tmp, 4) != 4){ + perror("read"); + exit(1); + } + +#ifdef WORDS_BIGENDIAN + tmp = L2BI(tmp); +#endif + + /* printf("Central header offset = %d\n", tmp); */ + + if(lseek(fd, tmp, SEEK_SET) != tmp){ + perror("lseek"); + exit(1); + } + + /* Loop through the entries in the central header */ + for(i = 0; i < cen_size; i++){ + + if(read(fd, &cen_header, 46) != 46){ + perror("read"); + exit(1); + } + + signature = UNPACK_UB4(cen_header, 0); + if(signature != 0x02014b50){ + fprintf(stderr, "Error in JAR file! Cannot locate central header!\n"); + exit(1); + } + + usize = UNPACK_UB4(cen_header, CEN_USIZE); + fnlen = UNPACK_UB2(cen_header, CEN_FNLEN); + eflen = UNPACK_UB2(cen_header, CEN_EFLEN); + clen = UNPACK_UB2(cen_header, CEN_COMLEN); + + /* If we're providing verbose output, we need to make an ASCII + * formatted version of the date. */ + if(verbose){ + mdate = UNPACK_UB4(cen_header, CEN_MODTIME); + tdate = dos2unixtime(mdate); + s_tm = localtime(&tdate); + strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm); + } + + if(filename_len < fnlen){ + if(filename != NULL) + free(filename); + + filename = malloc(sizeof(ub1) * (fnlen + 1)); + filename_len = fnlen + 1; + } + + if(read(fd, filename, fnlen) != fnlen){ + perror("read"); + exit(1); + } + filename[fnlen] = '\0'; + + /* if the user specified a list of files on the command line, + we'll only display those, otherwise we'll display everything */ + if(file_num > 0){ + for(j = 0; j < file_num; j++) + if(strcmp(files[j], filename) == 0){ + if(verbose) + printf("%6d %s %s\n", usize, ascii_date, filename); + else + printf("%s\n", filename); + break; + } + } else { + if(verbose) + printf("%6d %s %s\n", usize, ascii_date, filename); + else + printf("%s\n", filename); + } + + size = eflen + clen; + if(size > 0){ + if(lseek(fd, size, SEEK_CUR) == (off_t)-1){ + perror("lseek"); + exit(1); + } + } + } + } else { + /* the file isn't seekable.. evil! */ + pb_file pbf; + + pb_init(&pbf, fd); + + init_inflation(); + + for(;;){ + if((rdamt = pb_read(&pbf, scratch, 4)) != 4){ + perror("read"); + break; + } + + signature = UNPACK_UB4(scratch, 0); + +#ifdef DEBUG + printf("signature is %x\n", signature); +#endif + + if(signature == 0x08074b50){ +#ifdef DEBUG + printf("skipping data descriptor\n"); +#endif + pb_read(&pbf, scratch, 12); + continue; + } else if(signature == 0x02014b50){ +#ifdef DEBUG + printf("Central header reached.. we're all done!\n"); +#endif + break; + }else if(signature != 0x04034b50){ +#ifdef DEBUG + printf("Ick! %#x\n", signature); +#endif + break; + } + + if((rdamt = pb_read(&pbf, (file_header + 4), 26)) != 26){ + perror("read"); + break; + } + + csize = UNPACK_UB4(file_header, LOC_CSIZE); +#ifdef DEBUG + printf("Compressed size is %u\n", csize); +#endif + + fnlen = UNPACK_UB2(file_header, LOC_FNLEN); +#ifdef DEBUG + printf("Filename length is %hu\n", fnlen); +#endif + + eflen = UNPACK_UB2(file_header, LOC_EFLEN); +#ifdef DEBUG + printf("Extra field length is %hu\n", eflen); +#endif + + method = UNPACK_UB2(file_header, LOC_COMP); +#ifdef DEBUG + printf("Compression method is %#hx\n", method); +#endif + + flags = UNPACK_UB2(file_header, LOC_EXTRA); +#ifdef DEBUG + printf("Flags are %#hx\n", flags); +#endif + + usize = UNPACK_UB4(file_header, LOC_USIZE); + + /* If we're providing verbose output, we need to make an ASCII + * formatted version of the date. */ + if(verbose){ + mdate = UNPACK_UB4(file_header, LOC_MODTIME); + tdate = dos2unixtime(mdate); + s_tm = localtime(&tdate); + strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm); + } + + if(filename_len < fnlen){ + if(filename != NULL) + free(filename); + + filename = malloc(sizeof(ub1) * (fnlen + 1)); + filename_len = fnlen + 1; + } + + pb_read(&pbf, filename, fnlen); + filename[fnlen] = '\0'; + + /* the header is at the end. In a JAR file, this means that the data + happens to be compressed. We have no choice but to inflate the + data */ + if(flags & 0x0008){ + + size = eflen; + + if(size > 0) + consume(&pbf, size); + + if(method == 8){ +#ifdef DEBUG + printf("inflating %s\n", filename); +#endif + inflate_file(&pbf, -1, &ze); + + usize = ze.usize; + } else + printf("We're shit outta luck!\n"); + + } else { + size = csize + (eflen > 0 ? eflen : 0); + + +#ifdef DEBUG + printf("Skipping %d bytes\n", size); +#endif + + consume(&pbf, size); + } + /* print out the listing */ + if(file_num > 0){ + for(j = 0; j < file_num; j++) + if(strcmp(files[j], filename) == 0){ + if(verbose) + printf("%6d %s %s\n", usize, ascii_date, filename); + else + printf("%s\n", filename); + break; + } + } else { + if(verbose) + printf("%6d %s %s\n", usize, ascii_date, filename); + else + printf("%s\n", filename); + } + } + } + return 0; +} + +int consume(pb_file *pbf, int amt){ + int tc = 0; /* total amount consumed */ + ub1 buff[RDSZ]; + int rdamt; + +#ifdef DEBUG + printf("Consuming %d bytes\n", amt); +#endif + + while(tc < amt){ + rdamt = pb_read(pbf, buff, ((amt - tc) < RDSZ ? (amt - tc) : RDSZ)); +#ifdef DEBUG + printf("got %d bytes\n", rdamt); +#endif + tc += rdamt; + } + +#ifdef DEBUG + printf("%d bytes consumed\n", tc); +#endif + + return 0; +} + +void usage(char *filename){ + fprintf(stderr, "Usage: %s {ctxuV}[vfm0ME@] [jar-file] [manifest-file] [-C dir] files ...\nOptions\n -c create new archive\n -t list table of contents for archive\n -x extract named (or all) files from archive\n -u update existing archive\n -V display version information\n -v generate verbose output on standard output\n -f specify archive file name\n -m include manifest information from specified manifest file\n -0 store only; use no ZIP compression\n -M Do not create a manifest file for the entries\n -C change to the specified directory and include the following file\n -E don't include the files found in a directory\n -@ Read names from stdin\nIf any file is a directory then it is processed recursively.\nThe manifest file name and the archive file name needs to be specified\nin the same order the 'm' and 'f' flags are specified.\n\nExample 1: to archive two class files into an archive called classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExample 2: use an existing manifest file 'mymanifest' and archive all the\n files in the foo/ directory into 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n", filename); + + exit(1); +} diff --git a/fastjar/jartool.h b/fastjar/jartool.h new file mode 100644 index 00000000000..573f1517047 --- /dev/null +++ b/fastjar/jartool.h @@ -0,0 +1,112 @@ +/* $Id: jartool.h,v 1.4 2000/08/24 15:23:35 cory Exp $ + + $Log: jartool.h,v $ + Revision 1.4 2000/08/24 15:23:35 cory + Set version number since I think we can let this one out. + + Revision 1.3 2000/08/23 19:42:17 cory + Added support for more Unix platforms. The following code has been hacked + to work on AIX, Solaris, True 64, and HP-UX. + Added bigendian check. Probably works on most big and little endian platforms + now. + + Revision 1.2 1999/12/06 03:47:20 toast + fixing version string + + Revision 1.1.1.1 1999/12/06 03:08:24 toast + initial checkin.. + + + + Revision 1.6 1999/05/10 09:16:08 burnsbr + *** empty log message *** + + Revision 1.5 1999/04/27 10:04:20 burnsbr + configure support + + Revision 1.4 1999/04/26 02:36:15 burnsbr + changed RDSZ to 4096 from 512 + + Revision 1.3 1999/04/23 12:00:29 burnsbr + modified zipentry struct + + +*/ + +/* + jartool.h - generic defines, struct defs etc. + Copyright (C) 1999 Bryan Burns + + 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 "config.h" + +#define ACTION_NONE 0 +#define ACTION_CREATE 1 +#define ACTION_EXTRACT 2 +#define ACTION_UPDATE 3 +#define ACTION_LIST 4 + +#define TRUE 1 +#define FALSE 0 + +/* Amount of bytes to read at a time. You can change this to optimize for + your system */ +#define RDSZ 4096 + +/* Change these to match your system: + ub1 == unsigned 1 byte word + ub2 == unsigned 2 byte word + ub4 == unsigned 4 byte word +*/ +#if SIZEOF_CHAR == 1 +typedef unsigned char ub1; +#else +typedef u_int8_t ub1; +#endif + +#if SIZEOF_SHORT == 2 +typedef unsigned short ub2; +#elif SIZEOF_INT == 2 +typedef unsigned int ub2; +#else +typedef u_int16_t ub2; +#endif + +#if SIZEOF_INT == 4 +typedef unsigned int ub4; +#elif SIZEOF_LONG == 4 +typedef unsigned long ub4; +#elif SIZEOF_LONG_LONG == 4 +typedef unsigned long long ub4; +#else +typedef u_int32_t ub4; +#endif + +struct zipentry { + ub2 mod_time; + ub2 mod_date; + ub4 crc; + ub4 csize; + ub4 usize; + ub4 offset; + ub1 compressed; + char *filename; + + struct zipentry *next_entry; +}; + +typedef struct zipentry zipentry; diff --git a/fastjar/missing b/fastjar/missing new file mode 100755 index 00000000000..7789652e877 --- /dev/null +++ b/fastjar/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/fastjar/mkinstalldirs b/fastjar/mkinstalldirs new file mode 100755 index 00000000000..4f58503ea4e --- /dev/null +++ b/fastjar/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ + +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 diff --git a/fastjar/pushback.c b/fastjar/pushback.c new file mode 100644 index 00000000000..03cdd651b42 --- /dev/null +++ b/fastjar/pushback.c @@ -0,0 +1,163 @@ +/* $Id: pushback.c,v 1.2 2000/08/23 19:42:17 cory Exp $ + + $Log: pushback.c,v $ + Revision 1.2 2000/08/23 19:42:17 cory + Added support for more Unix platforms. The following code has been hacked + to work on AIX, Solaris, True 64, and HP-UX. + Added bigendian check. Probably works on most big and little endian platforms + now. + + Revision 1.1.1.1 1999/12/06 03:09:13 toast + initial checkin.. + + + + Revision 1.1 1999/05/10 08:32:37 burnsbr + Initial revision + +*/ + +/* + pushback.c - code for a pushback buffer to handle file I/O + Copyright (C) 1999 Bryan Burns + + 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 <unistd.h> +#include <string.h> +#include <stdio.h> + +#include "jartool.h" +#include "pushback.h" + +static char rcsid[] = "$Id: pushback.c,v 1.2 2000/08/23 19:42:17 cory Exp $"; + +void pb_init(pb_file *pbf, int fd){ + pbf->fd = fd; + pbf->next = pbf->pb_buff; + pbf->buff_amt = 0; +} + +int pb_push(pb_file *pbf, void *buff, int amt){ + int in_amt; + int wrap = 0; + +#ifdef DEBUG + printf("%d bytes being pushed back to the buffer\n", amt); +#endif + + /* determine how much we can take */ + if((RDSZ - pbf->buff_amt) < amt) + in_amt = RDSZ - pbf->buff_amt; + else + in_amt = amt; + + if(in_amt == 0) + return 0; + + /* figure out if we need to wrap around, and if so, by how much */ + if(((pbf->pb_buff + RDSZ) - pbf->next) < in_amt) + wrap = in_amt - ((pbf->pb_buff + RDSZ) - pbf->next); + + /* write everything up til the end of the buffer */ + memcpy(pbf->next, buff, (in_amt - wrap)); + + /* finish writing what's wrapped around */ + memcpy(pbf->pb_buff, ((char *)buff + (in_amt - wrap)), wrap); + + /* update the buff_amt field */ + pbf->buff_amt += in_amt; + +#ifdef DEBUG + printf("%d bytes we can't accept\n", (amt - in_amt)); +#endif + + return in_amt; +} + + +int pb_read(pb_file *pbf, void *buff, int amt){ + int out_amt = 0; + int wrap = 0; + void *bp = buff; + int tmp; + +#ifdef DEBUG + printf("%d bytes requested from us\n", amt); +#endif + while(out_amt < amt){ + /* if our push-back buffer contains some data */ + if(pbf->buff_amt > 0){ + +#ifdef DEBUG + printf("giving data from buffer\n"); +#endif + + /* calculate how much we can actually give the caller */ + if( (amt - out_amt) < pbf->buff_amt ) + tmp = (amt - out_amt); + else + tmp = pbf->buff_amt; + + /* Determine if we're going to need to wrap around the buffer */ + if(tmp > ((pbf->pb_buff + RDSZ) - pbf->next)) + wrap = tmp - ((pbf->pb_buff + RDSZ) - pbf->next); + + memcpy(bp, pbf->next, (tmp - wrap)); + bp = &(((char *)bp)[tmp - wrap]); + + /* If we need to wrap, read from the start of the buffer */ + if(wrap > 0){ + memcpy(bp, pbf->pb_buff, wrap); + bp = &(((char *)bp)[wrap]); + } + + /* update the buff_amt field */ + pbf->buff_amt -= tmp; + pbf->next += tmp; + +#ifdef DEBUG + printf("%d bytes remaining in buffer\n", pbf->buff_amt); +#endif + + /* if the buffer is empty, reset the next header to the front of the + buffer so subsequent pushbacks/reads won't have to wrap */ + if(pbf->buff_amt == 0) + pbf->next = pbf->pb_buff; + + out_amt += tmp; + + } else { +#ifdef DEBUG + printf("Reading from file..\n"); +#endif + + /* The pushback buffer was empty, so we just need to read from the file */ + tmp = read(pbf->fd, bp, (amt - out_amt)); + if(tmp == 0) + break; + else + out_amt += tmp; + + bp = &(((char *)bp)[tmp]); + } + } + +#ifdef DEBUG + printf("managed to read %d bytes\n", out_amt); +#endif + return out_amt; +} diff --git a/fastjar/pushback.h b/fastjar/pushback.h new file mode 100644 index 00000000000..a3239a5ded4 --- /dev/null +++ b/fastjar/pushback.h @@ -0,0 +1,32 @@ +/* + pushback.h - header for pushback.c + Copyright (C) 1999 Bryan Burns + + 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. +*/ + +struct pb_file { + unsigned int buff_amt; + ub1 pb_buff[RDSZ]; + int fd; + ub1 *next; +}; + +typedef struct pb_file pb_file; + + +void pb_init(pb_file *, int); +int pb_push(pb_file *, void *, int); +int pb_read(pb_file *, void *, int); diff --git a/fastjar/stamp-h.in b/fastjar/stamp-h.in new file mode 100644 index 00000000000..9788f70238c --- /dev/null +++ b/fastjar/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/fastjar/zipfile.h b/fastjar/zipfile.h new file mode 100644 index 00000000000..7dc9527e707 --- /dev/null +++ b/fastjar/zipfile.h @@ -0,0 +1,74 @@ +/* $Id: zipfile.h,v 1.1.1.1 1999/12/06 03:09:11 toast Exp $ + + $Log: zipfile.h,v $ + Revision 1.1.1.1 1999/12/06 03:09:11 toast + initial checkin.. + + + + Revision 1.6 1999/05/10 08:33:08 burnsbr + added UNPACK_UB4 and UNPACK_UB2 + + Revision 1.5 1999/04/26 02:36:34 burnsbr + added LOC_EXTRA macro + + Revision 1.4 1999/04/23 12:01:19 burnsbr + added more defines + + +*/ + +/* + zipfile.h - defines for indexing zipfile headers + Copyright (C) 1999 Bryan Burns + + 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. + */ + +#define LOC_EXTRA 6 /* extra bytes */ +#define LOC_COMP 8 /* compression method */ +#define LOC_MODTIME 10 /* last modification time */ +#define LOC_MODDATE 12 /* last modification date */ +#define LOC_CRC 14 /* CRC */ +#define LOC_CSIZE 18 /* compressed size */ +#define LOC_USIZE 22 /* uncompressed size */ +#define LOC_FNLEN 26 /* filename length */ +#define LOC_EFLEN 28 /* extra-field length */ + +#define CEN_COMP 10 /* compression method */ +#define CEN_MODTIME 12 +#define CEN_MODDATE 14 +#define CEN_CRC 16 +#define CEN_CSIZE 20 +#define CEN_USIZE 24 +#define CEN_FNLEN 28 +#define CEN_EFLEN 30 +#define CEN_COMLEN 32 +#define CEN_OFFSET 42 + + +/* macros */ +#define PACK_UB4(d, o, v) d[o] = (ub1)((v) & 0x000000ff); \ + d[o + 1] = (ub1)(((v) & 0x0000ff00) >> 8); \ + d[o + 2] = (ub1)(((v) & 0x00ff0000) >> 16); \ + d[o + 3] = (ub1)(((v) & 0xff000000) >> 24) + +#define PACK_UB2(d, o, v) d[o] = (ub1)((v) & 0x00ff); \ + d[o + 1] = (ub1)(((v) & 0xff00) >> 8) + +#define UNPACK_UB4(s, o) (ub4)s[o] + (((ub4)s[o + 1]) << 8) +\ + (((ub4)s[o + 2]) << 16) + (((ub4)s[o + 3]) << 24) + +#define UNPACK_UB2(s, o) (ub2)s[o] + (((ub2)s[o + 1]) << 8) |