mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 13:54:19 +08:00
fastjar: Imported.
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com> * fastjar: Imported. From-SVN: r38145
This commit is contained in:
parent
81522a1f86
commit
bd8757b313
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
1
fastjar/AUTHORS
Normal file
1
fastjar/AUTHORS
Normal file
@ -0,0 +1 @@
|
||||
Bryan Burns and Cory Jon Hollingsworth.
|
38
fastjar/CHANGES
Normal file
38
fastjar/CHANGES
Normal file
@ -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
|
340
fastjar/COPYING
Normal file
340
fastjar/COPYING
Normal file
@ -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.
|
33
fastjar/ChangeLog
Normal file
33
fastjar/ChangeLog
Normal file
@ -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.
|
18
fastjar/INSTALL
Normal file
18
fastjar/INSTALL
Normal file
@ -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.)
|
||||
|
||||
|
||||
|
44
fastjar/Makefile
Normal file
44
fastjar/Makefile
Normal file
@ -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
|
50
fastjar/Makefile.am
Normal file
50
fastjar/Makefile.am
Normal file
@ -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)
|
||||
|
417
fastjar/Makefile.in
Normal file
417
fastjar/Makefile.in
Normal file
@ -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:
|
14
fastjar/NEWS
Normal file
14
fastjar/NEWS
Normal file
@ -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.
|
75
fastjar/README
Normal file
75
fastjar/README
Normal file
@ -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
|
127
fastjar/aclocal.m4
vendored
Normal file
127
fastjar/aclocal.m4
vendored
Normal file
@ -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([,]))])
|
||||
|
487
fastjar/compress.c
Normal file
487
fastjar/compress.c
Normal file
@ -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;
|
||||
}
|
51
fastjar/compress.h
Normal file
51
fastjar/compress.h
Normal file
@ -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();
|
57
fastjar/config.h.in
Normal file
57
fastjar/config.h.in
Normal file
@ -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
|
||||
|
2330
fastjar/configure
vendored
Executable file
2330
fastjar/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
42
fastjar/configure.in
Normal file
42
fastjar/configure.in
Normal file
@ -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)
|
126
fastjar/dostime.c
Normal file
126
fastjar/dostime.c
Normal file
@ -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);
|
||||
}
|
||||
|
22
fastjar/dostime.h
Normal file
22
fastjar/dostime.h
Normal file
@ -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*);
|
7
fastjar/install-defs.sh
Normal file
7
fastjar/install-defs.sh
Normal file
@ -0,0 +1,7 @@
|
||||
CP=/bin/cp
|
||||
STRIP=/usr/bin/strip
|
||||
CHMOD=/bin/chmod
|
||||
|
||||
prefix=/usr/local
|
||||
exec_prefix=${prefix}
|
||||
BINDIR=${exec_prefix}/bin
|
7
fastjar/install-defs.sh.in
Normal file
7
fastjar/install-defs.sh.in
Normal file
@ -0,0 +1,7 @@
|
||||
CP=@CP@
|
||||
STRIP=@STRIP@
|
||||
CHMOD=@CHMOD@
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
BINDIR=@bindir@
|
8
fastjar/install-sh
Executable file
8
fastjar/install-sh
Executable file
@ -0,0 +1,8 @@
|
||||
#! /bin/bash
|
||||
|
||||
. install-defs.sh
|
||||
|
||||
$CP fastjar ${BINDIR}
|
||||
$STRIP ${BINDIR}/fastjar
|
||||
$CHMOD 755 ${BINDIR}/fastjar
|
||||
|
663
fastjar/jargrep.c
Normal file
663
fastjar/jargrep.c
Normal file
@ -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;
|
||||
}
|
31
fastjar/jargrep.h
Normal file
31
fastjar/jargrep.h
Normal file
@ -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)"
|
1757
fastjar/jartool.c
Normal file
1757
fastjar/jartool.c
Normal file
File diff suppressed because it is too large
Load Diff
112
fastjar/jartool.h
Normal file
112
fastjar/jartool.h
Normal file
@ -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;
|
190
fastjar/missing
Executable file
190
fastjar/missing
Executable file
@ -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
|
40
fastjar/mkinstalldirs
Executable file
40
fastjar/mkinstalldirs
Executable file
@ -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
|
163
fastjar/pushback.c
Normal file
163
fastjar/pushback.c
Normal file
@ -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;
|
||||
}
|
32
fastjar/pushback.h
Normal file
32
fastjar/pushback.h
Normal file
@ -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);
|
1
fastjar/stamp-h.in
Normal file
1
fastjar/stamp-h.in
Normal file
@ -0,0 +1 @@
|
||||
timestamp
|
74
fastjar/zipfile.h
Normal file
74
fastjar/zipfile.h
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user