fhist-1.18/README 644 0 0 23066 11265752627 12717 0 ustar Peter Miller 0 0 ReadMe(FHist) ReadMe(FHist)
NAME
fhist - file history and comparison tools
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Peter Miller;
Portions of this program are
Copyright (C) 1990 David I. Bell.
The fhist package is distributed under the terms of the GNU General
Public License, see the LICENSE section, below, for more information.
DESCRIPTION
The FHist package contains 3 utilities, a file history tool "fhist", a
file comparison tool "fcomp", and a file merging tool "fmerge". All
three are bundled together, because they all use the same minimal-
difference algorithm.
fhist
Keeps track of versions of a file. It works correctly when
given binary files as input. See fhist(1) for more
information.
fcomp
Compares two versions of a file, usually line-for-line textual
comparison. It is capable of comparing two binary files byte-
for-byte. See fcomp(1) for more information.
fmerge
Merges together edits from two descendants of a file. See
fmerge(1) for more information.
The history tool presented here, fhist, is a minimal history tool. It
provides no locking or branching. This can be useful in contexts where
the configuration management or change control be being provided by
some other tool.
REFERENCES
This program is based on the algorithm in
An O(ND) Difference Algorithm and Its Variations, Eugene W.
Myers, TR 85-6, 10-April-1985, Department of Computer Science,
The University of Arizona, Tuscon, Arizona 85721.
See also:
A File Comparison Program, Webb Miller and Eugene W. Myers,
Software Practice and Experience, Volume 15, No. 11, November
1985.
BUILDING
For complete instructions for host to build these programs, see the
BUILDING file included in this distribution.
ARCHIVE SITE
The latest version of fhist is available on the Web from:
URL: http://fhist.sourceforge.net/
File: index.html # The FHist page.
File: fhist-1.18.README # Description, from the tar file
File: fhist-1.18.lsm # Description, in LSM format
File: fhist-1.18.spec # RedHat package spec
File: fhist-1.18.tar.Z # The complete source.
FHist is also carried by sunsite.unc.edu in its Linux archives. You
will be able to find FHist on any of its mirrors.
URL: ftp://sunsite.unc.edu/pub/Linux/devel/vc/
File: fhist-1.18.README # Description, from the tar file
File: fhist-1.18.lsm # Description, in LSM format
File: fhist-1.18.spec # RedHat package spec
File: fhist-1.18.tar.Z # The complete source.
This site is extensively mirrored around the world, so look for a copy
near you (you will get much better response).
COPYRIGHT
fhist version 1.18.D001
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Peter Miller;
This program is derived from a work
Copyright (C) 1990 David I. Bell.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see .
AUTHORS
Peter Miller Web: http://miller.emu.id.au/pmiller/
/\/\* E-Mail: pmiller@opensource.org.au
David I. Bell Web: http://www.canb.auug.org.au/~dbell
E-Mail: dbell@canb.auug.org.au
RELEASE NOTES
For excruciating detail, and also acknowledgements of those who
generously sent me feedback, please see the etc/CHANGES.1.18 file
included in this distribution.
A number of features and bug fixes have been added to fhist with this
release. A few of them are detailed here:
Version 1.18 (16-Oct-2009)
* The .XX macro usage has been made conditional in the man pages, to
silence Debian lintian warnings.
* The use of naked "-" have been replaced with "\-" for option
introducers, "\[hy]" for hyphens, and "\[mi]" for minus signs, to
silence Debian lintian warnings.
* The author's email address has been updated.
Version 1.17 (17-Jun-2008)
* The licenseis now GPLv3.
* The fhist(1) command now accepts a remark string on the command line.
Version 1.16 (20-Dec-2005)
* There is a new fmerge -ignore-identical-conflicts option which may be
used to suppress logical conflicts in which the same thing is done by
both variants. This is often a better match for users' expectations for
merging source code.
Version 1.15 (8-Nov-2005)
* There is a new fcomp -no-binary option, which may be used to prevent
the comparison of binary files, instead it treats them both as empty.
* A small build problem on MacOS X has been fixed.
Version 1.14 (8-Jun-2004)
* The ./configure script now understands the --with-nlsdir option, so
that you can place the .mo files.
* The fhist(1) program is now able to cope with numeric modules names.
* The occasional false negative from test 26 has been fixed. It was
failing for some users because of message translation
(internationalization) issues.
Version 1.13 (13-Mar-2003)
* A bug has been fixed in some of the tests. They were susceptible to
false negatives if the display width changed.
* All references to the cuserid function have been replaced. It isn't
sufficiently portable to be used in real programs.
Version 1.12 (28-Nov-2002)
* Some build problems have been fixed.
Version 1.11 (26-Nov-2002)
* Some build problems, relating to modern ANSI C compilers choking on
K&R function definitions with variable arguments, have been fixed.
* Two bugs relating to the handling of binary files by fhist(1) have
been fixed.
* A bug which left garbage files behind when a create failed has been
fixed.
Version 1.10 (9-Jul-2002)
* Interrupt handling has been improved.
* There is a new fhist -No_Keywords option, used to completely disable
keyword substitution.
* Several build problems have been fixed.
Version 1.9 (23-Oct-2001)
No public release.
Version 1.8 (16-Oct-2001)
* There is a new -BINary option for the fcomp(1) program, which
compares binary files a byte at time, printing the results in
hexadecimal.
* The fcomp(1) program now silently copes with CRLF line terminations.
Version 1.7 (11-Apr-2000)
* The fhist(1) command now has a -binary option, which may be used to
store the history of binary files.
* The fhist(1) command has a new -make-path option, which requests that
the history directory be created if necessary.
* A bug in fhist(1) wich caused a SEGFAULT when you used the -t option
(extract to terminal) has been fixed.
Version 1.6 (25-Oct-1999)
* An RPM spec file has been added to the distribution.
* The code is now more robust about what various UNIX systems return
from pathconf().
* A bug with the "fcomp -blank" option has been fixed.
Version 1.5 (1-Jun-1999)
* Binary files are now detected on input, and the utilities file
gracefully with a warning or error message, as appropriate.
* Some buffer over-run bugs have been fixed.
* Several improvements have been made to the portability.
Version 1.4 (16-Sep-1998)
* The install and build procedures have been made more robust, and they
take note of more of the information provided by GNU Autoconf.
* The error messages have been internationalized, so it is now possible
to obtain error messages in your native language. (If you would like
to contribute with error message translations, please contact the
author.)
* An LSM description has been added, along with a HTML page to present
it all nicely at the archive site.
* A RedHat Package Manager spec file has been added, so that a RedHat
package can be created. The spec file is in the standard distribution.
Version 1.3 (29-Mar-1998)
This version was not distributed at all.
Version 1.2
This version was not distributed very widely.
* The non-standard isblank function is no longer used, it cause too
many portability problems.
* The use of pathconf is not more robust for more operating systems.
Version 1.1
* The fhist package now uses a shell script called configure to
configure itself. This script is generated using the GNU Autoconf
utility. This should make fhist significantly easier to configure, and
significantly more portable.
* A bug has been fixed in the conflict reporting of the fmerge program.
It now correctly opens the conflicts file.
* The fhist program now uses pathconf(2) to determine file name length
limits.
Reference Manual FHist ReadMe(FHist)
fhist-1.18/BUILDING 644 0 0 30535 11265752627 13156 0 ustar Peter Miller 0 0 Building(FHist) Building(FHist)
NAME
fhist - file history and comparison tools
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Peter Miller
Portions of this program are
Copyright (C) 1990 David I. Bell.
The fhist package is distrributed under the terms of the GNU General
Public License, see the LICENSE section, below, for more information.
SPACE REQUIREMENTS
You will need about 600K to unpack and build the fhist package. (This
is the worst case seen so far, most systems have binaries about 60% as
big as this, 400K is more typical.) Your mileage may vary.
BEFORE YOU START
There are a few pieces of software you may want to fetch and install
before you proceed with your installation of cook.
GNU Gettext
The fhist package has been internationalized. It can now print
error messages in any of the supported languages. In order to
do this, the GNU Gettext package must be installed before you
run the configure script as detailed in the next section. This
is because the configure script looks for it. On systems which
use the GNU C library, version 2.0 or later, there is no need
to explictly do this as GNU Gettext is included. Remember to
use the GNU Gettext configure --with-gnu-gettext option if your
system has native gettext tools.
GNU Groff
The documentation for the fhist package was prepared using the
GNU Groff package. This distribution includes full
documentation, which may be processed into PostScript or DVI
files at install time - if GNU Groff has been installed.
Bison If your operating system does not have a native yacc(1) you
will need to fetch and install GNU Bison in order to build the
fhist package.
An ANSI C compiler.
You must have an ANSI C compiler to compile this program. You
may also want to consider fetching and installing the GNU C
Compiler if you have not done so already.
The GNU FTP archives may be found at prep.ai.mit.edu, and are mirrored
around the world.
SITE CONFIGURATION
The fhist package is configured using the configure shell script
included in this distribution.
The configure shell script attempts to guess correct values for various
system-dependent variables used during compilation, and creates the
Makefile and common/config.h files. It also creates a shell script
config.status that you can run in the future to recreate the current
configuration.
Normally, you just cd to the directory containing fhist's source code
and type
% ./configure
...lots of output...
%
If you're using csh on an old version of System V, you might need to
type
% sh configure
...lots of output...
%
instead to prevent csh from trying to execute configure itself.
Running configure takes a minute or two. While it is running, it
prints some messages that tell what it is doing. If you don't want to
see the messages, run configure with its standard output redirected to
/dev/null; for example,
% ./configure > /dev/null
%
By default, configure will arrange for the make install command to
install the fhist package's files in /usr/local/bin and /usr/local/man.
There are a number of options which control the placement of these
files.
--prefix=PATH
You can specify an installation prefix other than /usr/local by
giving configure the option --prefix=PATH.
--exec-prefix=PATH
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.
If you give configure the option --exec-prefix=PATH the fhist
package will use PATH as the prefix for installing programs and
libraries. Data files and documentation will still use the
regular prefix. Normally, all files are installed using the
same prefix.
--bindir=PATH
This directory contains executable programs. On a network,
this directory may be shared between machines with identical
hardware and operating systems; it may be mounted read-only.
Defaults to ${exec_prefix}/bin unless otherwise specified.
--datadir=PATH
This directory contains installed data, such as the
documentation, reports and shell scripts distributed with
Aegis. On a network, this directory may be shared between all
machines; it may be mounted read-only. Defaults to
${prefix}/share/aegis unless otherwise specified. An "aegis"
directory will be appended if there is none in the specified
path.
--libdir=PATH
This directory contains installed data, such as the error
message catalogues. On a network, this directory may be shared
between machines with identical hardware and operating systems;
it may be mounted read-only. Defaults to
${exec_prefix}/lib/aegis unless otherwise specified. An
"aegis" directory will be appended if there is none in the
specified path.
--mandir=PATH
This directory contains the on-line manual entries. On a
network, this directory may be shared between all machines; it
may be mounted read-only. Defaults to ${prefix}/man unless
otherwise specified.
--with-nlsdir=PATH
This directory contains machine specific message catalogues.
Defaults to --libdir if not set.
configure ignores any other arguments that you give it.
On systems that require unusual options for compilation or linking that
the fhist package's configure script does not know about, you can give
configure initial values for variables by setting them in the
environment. In Bourne-compatible shells, you can do that on the
command line like this:
$ CC='gcc -traditional' LIBS=-lposix ./configure
...lots of output...
$
Here are the make variables that you might want to override with
environment variables when running configure.
Variable: CC
C compiler program. The default is cc.
Variable: INSTALL
Program to use to install files. The default is install if you
have it, cp otherwise.
Variable: LIBS
Libraries to link with, in the form -lfoo -lbar. The configure
script will append to this, rather than replace it.
Variable: NLSDIR
This works the same way as the --with-nlsdir option.
If you need to do unusual things to compile the package, the author
encourages you to figure out how configure could check whether to do
them, and mail diffs or instructions to the author so that they can be
included in the next release.
BUILDING FHIST
All you should need to do is use the
% make
...lots of output...
%
command and wait. When this finishes you should see a directory called
bin containing four files: fcomp, fhist, fmerge and txt2c.
fcomp The fcomp program is user to compare two text files.
fhist The fhist program is used to maintain and edit history of a
text file.
fmerge The fmerge program is used to merge together edits from two
descendants of a file.
txt2c The txt2c program is a utility used to build the fhist package;
it is not intended for general use and should not be installed.
You can remove the program binaries and object files from the source
directory by using the
% make clean
...lots of output...
%
command. To remove all of the above files, and also remove the
Makefile and common/config.h and config.status files, use the
% make distclean
...lots of output...
%
command.
The file etc/configure.in is used to create configure by a GNU program
called autoconf. You only need to know this if you want to regenerate
configure using a newer version of autoconf.
TESTING FHIST
The fhist package is accompanied by a test suite. To run this test
suite, use the following command:
% make sure
...lots of output...
%
This is successful if the last line of the test output reads "Passed
All Tests".
Please let the author know if any of the tests fail, and why if you can
work that out.
INSTALLING FHIST
As explained in the SITE CONFIGURATION section, above, the fhist
package is installed under the /usr/local tree by default. Use the
--prefix=PATH option to configure if you want some other path.
All that is required to install the fhist package is to use the
% make install
...lots of output...
%
command. Control of the directories used may be found in the first few
lines of the Makefile file if you want to bypass the configure script.
The above procedure assumes that the soelim(1) command is somewhere in
the command search PATH. The soelim(1) command is available as part of
the GNU Roff package, mentioned previously in the PRINTED MANUALS
section. If you don't have it, but you do have the cook package, then
a link from roffpp to soelim will also work.
The above procedure also assumes that the $(prefix)/man/man1 and
$(prefix)/man/man5 directories already exist. If they do not, you will
need to mkdir them manually.
PRINTED MANUALS
The easiest way to get copies of the manuals is to get the
fhist.1.18.pdf file from the archive site. This is an Adobe AcroRead
file containing the Reference Manual, which contains the README file,
the BUILDING file and internationalization notes, as well as all of the
manual pages for all of the commands.
This distribution contains the sources to all of the documentation for
fhist. The author used the GNU groff package and a postscript printer
to prepare the documentation. If you do not have this software, you
will need to substitute commands appropriate to your site.
If you have the GNU Groff package installed before you run the
configure script, the Makefile will contain instructions for
constructing the documentation. If you already used the make command,
above, this has already been done. The following command
% make doc
...lots of output...
%
can be used to do this explicitly, if you managed to get to this point
without doing it. Please note that there may be some warnings from
groff, particularly about missing fonts, particularly for the .txt
files; this is normal.
Once the documents have been formatted, you only need to print them.
The following command
% lpr lib/en/reference.ps
%
will print the English PostScript version of the Reference Manual.
Watch the make output to see what other versions are available.
COPYRIGHT
version 1.18.D001
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Peter Miller;
This program is derived from a work
Copyright (C) 1990 David I. Bell.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see .
AUTHORS
Peter Miller Web: http://miller.emu.id.au/pmiller/
/\/\* E-Mail: pmiller@opensource.org.au
David I. Bell Web: http://www.canb.auug.org.au/~dbell
E-Mail: dbell@canb.auug.org.au
Reference Manual FHist Building(FHist)
fhist-1.18/LICENSE 644 0 0 114530 11265752627 13061 0 ustar Peter Miller 0 0 GPL(GNU) Free Software Foundation GPL(GNU)
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software
and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program - to make sure it remains
free software for all its users. We, the Free Software Foundation, use
the GNU General Public License for most of our software; it applies
also to any other work released this way by its authors. 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 them 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 pro-
grams, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the software,
or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis
or for a fee, you must pass on to the recipients the same freedoms that
you received. 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.
Developers that use the GNU GPL protect your rights with two steps: (1)
assert copyright on the software, and (2) offer you this License giving
you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run modi-
fied versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of protect-
ing users' freedom to change the software. The systematic pattern of
such abuse occurs in the area of products for individuals to use, which
is precisely where it is most unacceptable. Therefore, we have
designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future ver-
sions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modifi-
cation follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and "recip-
ients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based on
the Program.
To "propagate" a work means to do anything with it that, without per-
mission, would make you directly or secondarily liable for infringement
under applicable copyright law, except executing it on a computer or
modifying a private copy. Propagation includes copying, distribution
(with or without modification), making available to the public, and in
some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not convey-
ing.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible fea-
ture that (1) displays an appropriate copyright notice, and (2) tells
the user that there is no warranty for the work (except to the extent
that warranties are provided), that licensees may convey the work under
this License, and how to view a copy of this License. If the interface
presents a list of user commands or options, such as a menu, a promi-
nent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that is
widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major Compo-
nent, and (b) serves only to enable use of the work with that Major
Component, or to implement a Standard Interface for which an implemen-
tation is available to the public in source code form. A "Major Compo-
nent", in this context, means a major essential component (kernel, win-
dow system, and so on) of the specific operating system (if any) on
which the executable work runs, or a compiler used to produce the work,
or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all the
source code needed to generate, install, and (for an executable work)
run the object code and to modify the work, including scripts to con-
trol those activities. However, it does not include the work's System
Libraries, or general-purpose tools or generally available free pro-
grams which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copy-
right on the Program, and are irrevocable provided the stated condi-
tions are met. This License explicitly affirms your unlimited permis-
sion to run the unmodified Program. The output from running a covered
work is covered by this License only if the output, given its content,
constitutes a covered work. This License acknowledges your rights of
fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with facil-
ities for running those works, provided that you comply with the terms
of this License in conveying all material for which you do not control
copyright. Those thus making or running the covered works for you must
do so exclusively on your behalf, under your direction and control, on
terms that prohibit them from making any copies of your copyrighted
material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological mea-
sure under any applicable law fulfilling obligations under article 11
of the WIPO copyright treaty adopted on 20 December 1996, or similar
laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumven-
tion is effected by exercising rights under this License with respect
to the covered work, and you disclaim any intention to limit operation
or modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and appro-
priately publish on each copy an appropriate copyright notice; keep
intact all notices stating that this License and any non-permissive
terms added in accord with section 7 apply to the code; keep intact all
notices of the absence of any warranty; and give all recipients a copy
of this License along with the Program.
You may charge any price or no price for each copy that you convey, and
you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the terms
of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it,
and giving a relevant date.
b) The work must carry prominent notices stating that it is released
under this License and any conditions added under section 7. This
requirement modifies the requirement in section 4 to "keep intact
all notices".
c) You must license the entire work, as a whole, under this License to
anyone who comes into possession of a copy. This License will
therefore apply, along with any applicable section 7 additional
terms, to the whole of the work, and all its parts, regardless of
how they are packaged. This License gives no permission to license
the work in any other way, but it does not invalidate such permis-
sion if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your work
need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program, in
or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not used
to limit the access or legal rights of the compilation's users beyond
what the individual works permit. Inclusion of a covered work in an
aggregate does not cause this License to apply to the other parts of
the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the Cor-
responding Source fixed on a durable physical medium customarily
used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a writ-
ten offer, valid for at least three years and valid for as long as
you offer spare parts or customer support for that product model,
to give anyone who possesses the object code either (1) a copy of
the Corresponding Source for all the software in the product that
is covered by this License, on a durable physical medium customar-
ily used for software interchange, for a price no more than your
reasonable cost of physically performing this conveying of source,
or (2) access to copy the Corresponding Source from a network
server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This alterna-
tive is allowed only occasionally and noncommercially, and only if
you received the object code with such an offer, in accord with
subsection 6b.
d) Convey the object code by offering access from a designated place
(gratis or for a charge), and offer equivalent access to the Corre-
sponding Source in the same way through the same place at no fur-
ther charge. You need not require recipients to copy the Corre-
sponding Source along with the object code. If the place to copy
the object code is a network server, the Corresponding Source may
be on a different server (operated by you or a third party) that
supports equivalent copying facilities, provided you maintain clear
directions next to the object code saying where to find the Corre-
sponding Source. Regardless of what server hosts the Corresponding
Source, you remain obligated to ensure that it is available for as
long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be included
in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorpora-
tion into a dwelling. In determining whether a product is a consumer
product, doubtful cases shall be resolved in favor of coverage. For a
particular product received by a particular user, "normally used"
refers to a typical or common use of that class of product, regardless
of the status of the particular user or of the way in which the partic-
ular user actually uses, or expects or is expected to use, the product.
A product is a consumer product regardless of whether the product has
substantial commercial, industrial or non-consumer uses, unless such
uses represent the only significant mode of use of the product.
"Installation Information" for a User Product means any methods, proce-
dures, authorization keys, or other information required to install and
execute modified versions of a covered work in that User Product from a
modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because modifi-
cation has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied by
the Installation Information. But this requirement does not apply if
neither you nor any third party retains the ability to install modified
object code on the User Product (for example, the work has been
installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the recipi-
ent, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network or
violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly docu-
mented (and with an implementation available to the public in source
code form), and must require no special password or key for unpacking,
reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions. Addi-
tional permissions that are applicable to the entire Program shall be
treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove
any additional permissions from that copy, or from any part of it.
(Additional permissions may be written to require their own removal in
certain cases when you modify the work.) You may place additional per-
missions on material, added by you to a covered work, for which you
have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in rea-
sonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some trade
names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material
by anyone who conveys the material (or modified versions of it)
with contractual assumptions of liability to the recipient, for any
liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further restric-
tion, you may remove that term. If a license document contains a fur-
ther restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the additional
terms that apply to those files, or a notice indicating where to find
the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly pro-
vided under this License. Any attempt otherwise to propagate or modify
it is void, and will automatically terminate your rights under this
License (including any patent licenses granted under the third para-
graph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally terminates
your license, and (b) permanently, if the copyright holder fails to
notify you of the violation by some reasonable means prior to 60 days
after the cessation.
Moreover, your license from a particular copyright holder is reinstated
permanently if the copyright holder notifies you of the violation by
some reasonable means, this is the first time you have received notice
of violation of this License (for any work) from that copyright holder,
and you cure the violation prior to 30 days after your receipt of the
notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work occur-
ring solely as a consequence of using peer-to-peer transmission to
receive a copy likewise does not require acceptance. However, nothing
other than this License grants you permission to propagate or modify
any covered work. These actions infringe copyright if you do not
accept this License. Therefore, by modifying or propagating a covered
work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that transaction
who receives a copy of the work also receives whatever licenses to the
work the party's predecessor in interest had or could give under the
previous paragraph, plus a right to possession of the Corresponding
Source of the work from the predecessor in interest, if the predecessor
has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or hereafter
acquired, that would be infringed by some manner, permitted by this
License, of making, using, or selling its contributor version, but do
not include claims that would be infringed only as a consequence of
further modification of the contributor version. For purposes of this
definition, "control" includes the right to grant patent sublicenses in
a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone to
copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so avail-
able, or (2) arrange to deprive yourself of the benefit of the patent
license for this particular work, or (3) arrange, in a manner consis-
tent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrange-
ment, you convey, or propagate by procuring conveyance of, a covered
work, and grant a patent license to some of the parties receiving the
covered work authorizing them to use, propagate, modify or convey a
specific copy of the covered work, then the patent license you grant is
automatically extended to all recipients of the covered work and works
based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the busi-
ness of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the work,
and under which the third party grants, to any of the parties who would
receive the covered work from you, a discriminatory patent license (a)
in connection with copies of the covered work conveyed by you (or
copies made from those copies), or (b) primarily for and in connection
with specific products or compilations that contain the covered work,
unless you entered into that arrangement, or that patent license was
granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any
implied license or other defenses to infringement that may otherwise be
available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a consequence
you may not convey it at all. For example, if you agree to terms that
obligate you to collect a royalty for further conveying from those to
whom you convey the Program, the only way you could satisfy both those
terms and this License would be to refrain entirely from conveying the
Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permis-
sion to link or combine any covered work with a work licensed under
version 3 of the GNU Affero General Public License into a single com-
bined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General Public
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If the
Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free Software
Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different permis-
sions. However, no additional obligations are imposed on any author or
copyright holder as a result of your choosing to follow a later ver-
sion.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLI-
CABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLD-
ERS 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 PARTIC-
ULAR 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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CON-
VEYS 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 OPER-
ATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the Pro-
gram, unless a warranty or assumption of liability accompanies a copy
of the Program in return for a fee.
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 state
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 mod-
ify it under the terms of the GNU General Public License as pub-
lished by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MER-
CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Gen-
eral Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
.
Also add information on how to contact you by electronic and paper
mail.
If the program does terminal interaction, make it output a short notice
like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type
"show w". This is free software, and you are welcome to redis-
tribute it under certain conditions; type "show c" for details.
The hypothetical commands "show w" and "show c" should show the appro-
priate parts of the General Public License. Of course, your program's
commands might be different; for a GUI interface, you would use an
"about box".
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU GPL, see .
The GNU General Public License does not permit incorporating your pro-
gram 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 Lesser General Public License instead of this License. But first,
please read .
GNU GPL GPL(GNU)
fhist-1.18/Makefile.in 644 0 0 141131 11265752627 14116 0 ustar Peter Miller 0 0 #
# fhist - file history and comparison tools
# Copyright (C) 1990-1994, 1998, 1999, 2002, 2004, 2008 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# .
#
#
# directory containing the source
#
srcdir = @srcdir@
VPATH = @srcdir@
#
# the name of the install program to use
#
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
#
# the name of the compiler to use
#
CC = @CC@
#
# The compiler flags to use
#
CFLAGS = @CFLAGS@
#
# The linker flags to use
#
LDFLAGS = @LDFLAGS@
#
# prefix for installation path
#
prefix = @prefix@
exec_prefix = @exec_prefix@
#
# where to put the library directory
# (contains architecture-specific data, don't use exec_prefix)
#
libdir = $(RPM_BUILD_ROOT)@libdir@
#
# where to put the locale files
# (contains architecture-specific data, don't use exec_prefix)
#
NLSDIR = $(RPM_BUILD_ROOT)@NLSDIR@
#
# where to put the shared directory
# (contains architecture-neutral data, don't use exec_prefix)
#
datadir = $(RPM_BUILD_ROOT)@datadir@
#
# where to put the executables
#
bindir = $(RPM_BUILD_ROOT)@bindir@
#
# where to put the manuals
#
mandir = $(RPM_BUILD_ROOT)@mandir@
#
# Which yacc to use
#
YACC = @YACC@
#
# extra libraries required for your system
#
LIBS = @LIBS@
#
# shell to use to run tests and commands
#
SH = @SH@
#
# command used to construct libraries
#
AR = ar
#
# program used to place index within libraries
#
RANLIB = @RANLIB@
#
# The program used to compile the message catalogues. Ideally, you
# should use the msgfmt in the GNU Gettext package. (The SunOS one is
# brain-dead, and the Solaris one is hardly better.)
#
MSGFMT = @MSGFMT@
MSGCAT = @MSGCAT@
#
# The program used to format the documentation.
#
GROFF = @GROFF@
#
# where to find the soelim command
#
SOELIM = @SOELIM@
#
# Set MANLANG to English, to select the man pages to be installed into
# $(mandir). If you want your manual pages in some other (supported)
# language, set it here.
#
# The man pages for all supported languages are also installed into
# $(libdir)/$(MANLANG)/manX/Y.X, so that it is only necessary to append
# $(libdir) to $MANPATH, if your man understands $LANG.
#
MANLANG = en
#
# Set HAVE_I18N to ``yes'' if your system has the gettext() system call
# and the msgfmt utility, or ``no'' if it does not.
#
HAVE_I18N = @internationalization@
#
# Set HAVE_GROFF to ``yes'' if your system has GNU Groff installed,
# or ``no'' if it does not.
#
HAVE_GROFF = @have_groff@
#
# Mess with the names of installed executables.
#
# The prefix is added to the front, the suffix is added to the back.
# Both are usually empty. (The suffix does not include the executable
# file extension.)
#
PROGRAM_PREFIX = @PROGRAM_PREFIX@
PROGRAM_SUFFIX = @PROGRAM_SUFFIX@
#
# This is the file extension of executable files.
# It is empty for UNIX, and .EXE for the unmentionable one.
#
EXEEXT = @EXEEXT@
#
# This is the file extension of object files.
# It is .o for UNIX, and .O or .OBJ for the unmentionable one.
#
OBJEXT = @OBJEXT@
#
# This is the file extension of library files. NO DOT.
#
LIBEXT = a
#
# You should not need to alter anything below this point.
#------------------------------------------------------------
default: all
common/ac/libintl.$(OBJEXT): common/ac/libintl.c common/ac/libintl.h \
common/config.h common/config.messy.h common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/ac/libintl.c
mv libintl.$(OBJEXT) $@
common/ac/string.$(OBJEXT): common/ac/string.c common/ac/stddef.h \
common/config.h common/config.messy.h common/ac/stdlib.h \
common/ac/string.h common/ac/stdio.h common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/ac/string.c
mv string.$(OBJEXT) $@
common/ac/unistd.$(OBJEXT): common/ac/unistd.c common/ac/unistd.h \
common/config.h common/config.messy.h \
common/ac/sys/types.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/ac/unistd.c
mv unistd.$(OBJEXT) $@
common/ac/wchar.$(OBJEXT): common/ac/wchar.c common/ac/wchar.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/ac/time.h common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/ac/wchar.c
mv wchar.$(OBJEXT) $@
common/ac/wctype.$(OBJEXT): common/ac/wctype.c common/ac/ctype.h \
common/config.h common/config.messy.h common/ac/wctype.h \
common/ac/stddef.h common/main.h common/ac/limits.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/ac/wctype.c
mv wctype.$(OBJEXT) $@
common/arglex.$(OBJEXT): common/arglex.c common/ac/stddef.h \
common/config.h common/config.messy.h common/ac/stdlib.h \
common/ac/string.h common/ac/ctype.h common/arglex.h \
common/main.h common/cmalloc.h common/error_intl.h \
common/sub.h common/attrib_forma.h common/language.h \
common/progname.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/arglex.c
mv arglex.$(OBJEXT) $@
common/cmalloc.$(OBJEXT): common/cmalloc.c common/ac/errno.h \
common/config.h common/config.messy.h common/ac/stdlib.h \
common/ac/stddef.h common/cmalloc.h common/main.h \
common/error.h common/attrib_forma.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/cmalloc.c
mv cmalloc.$(OBJEXT) $@
common/compare.$(OBJEXT): common/compare.c common/ac/ctype.h \
common/config.h common/config.messy.h common/ac/stddef.h \
common/ac/stdio.h common/main.h common/ac/string.h \
common/ac/libintl.h common/compare.h common/cmalloc.h \
common/error.h common/attrib_forma.h common/error_intl.h \
common/sub.h common/fcheck.h common/input.h \
common/input/file.h common/ac/sys/stat.h \
common/ac/sys/types.h common/input/file_text.h \
common/input/quotprinenco.h common/input/hexify.h \
common/str.h common/ac/stdarg.h common/trace.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/compare.c
mv compare.$(OBJEXT) $@
common/env.$(OBJEXT): common/env.c common/ac/stddef.h common/config.h \
common/config.messy.h common/ac/stdlib.h \
common/ac/string.h common/env.h common/main.h \
common/mem.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/env.c
mv env.$(OBJEXT) $@
common/error.$(OBJEXT): common/error.c common/ac/ctype.h common/config.h \
common/config.messy.h common/ac/errno.h \
common/ac/stdarg.h common/ac/stddef.h common/ac/stdio.h \
common/main.h common/ac/stdlib.h common/ac/string.h \
common/error.h common/attrib_forma.h common/mprintf.h \
common/progname.h common/quit.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/error.c
mv error.$(OBJEXT) $@
common/error_intl.$(OBJEXT): common/error_intl.c common/ac/stdio.h \
common/config.h common/config.messy.h common/main.h \
common/ac/limits.h common/ac/string.h common/ac/wchar.h \
common/ac/stddef.h common/ac/time.h common/ac/wctype.h \
common/ac/ctype.h common/error.h common/attrib_forma.h \
common/error_intl.h common/sub.h common/language.h \
common/page.h common/progname.h common/quit.h \
common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/error_intl.c
mv error_intl.$(OBJEXT) $@
common/fcheck.$(OBJEXT): common/fcheck.c common/ac/string.h \
common/config.h common/config.messy.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/main.h common/fcheck.h common/ac/stdio.h \
common/str.h common/ac/stddef.h common/ac/stdarg.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/fcheck.c
mv fcheck.$(OBJEXT) $@
common/fileio.$(OBJEXT): common/fileio.c common/ac/errno.h \
common/config.h common/config.messy.h \
common/ac/libintl.h common/main.h common/ac/stdarg.h \
common/ac/stdio.h common/ac/string.h common/ac/unistd.h \
common/ac/sys/types.h common/error_intl.h common/sub.h \
common/attrib_forma.h common/fcheck.h common/fileio.h \
common/cmalloc.h common/ac/stddef.h common/str.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/fileio.c
mv fileio.$(OBJEXT) $@
common/help.$(OBJEXT): common/help.c common/ac/stdlib.h common/config.h \
common/config.messy.h common/ac/unistd.h \
common/ac/sys/types.h common/arglex.h common/main.h \
common/env.h common/error.h common/attrib_forma.h \
common/error_intl.h common/sub.h common/help.h \
common/libdir.h common/progname.h common/quit.h \
common/str_list.h common/str.h common/ac/stddef.h \
common/ac/stdarg.h common/trace.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/help.c
mv help.$(OBJEXT) $@
common/input.$(OBJEXT): common/input.c common/ac/ctype.h common/config.h \
common/config.messy.h common/ac/string.h common/fcheck.h \
common/ac/stdio.h common/main.h common/input/private.h \
common/input.h common/mem.h common/ac/stddef.h \
common/trace.h common/attrib_forma.h common/cmalloc.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input.c
mv input.$(OBJEXT) $@
common/input/crlf.$(OBJEXT): common/input/crlf.c common/error.h \
common/attrib_forma.h common/main.h common/input/crlf.h \
common/input.h common/input/private.h common/trace.h \
common/ac/stddef.h common/config.h common/config.messy.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/crlf.c
mv crlf.$(OBJEXT) $@
common/input/file.$(OBJEXT): common/input/file.c common/ac/unistd.h \
common/config.h common/config.messy.h \
common/ac/sys/types.h common/error.h \
common/attrib_forma.h common/main.h common/fcheck.h \
common/ac/stdio.h common/input/file.h common/ac/stddef.h \
common/ac/sys/stat.h common/input.h \
common/input/private.h common/input/stdin.h common/mem.h \
common/str.h common/ac/stdarg.h common/error_intl.h \
common/sub.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/file.c
mv file.$(OBJEXT) $@
common/input/file_text.$(OBJEXT): common/input/file_text.c \
common/input/crlf.h common/input.h common/main.h \
common/input/file.h common/ac/stddef.h common/config.h \
common/config.messy.h common/ac/sys/stat.h \
common/ac/sys/types.h common/input/file_text.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/file_text.c
mv file_text.$(OBJEXT) $@
common/input/hexify.$(OBJEXT): common/input/hexify.c common/ac/ctype.h \
common/config.h common/config.messy.h common/ac/stdio.h \
common/main.h common/error.h common/attrib_forma.h \
common/input/hexify.h common/input.h \
common/input/private.h common/trace.h common/ac/stddef.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/hexify.c
mv hexify.$(OBJEXT) $@
common/input/private.$(OBJEXT): common/input/private.c \
common/input/private.h common/input.h common/main.h \
common/mem.h common/ac/stddef.h common/config.h \
common/config.messy.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/private.c
mv private.$(OBJEXT) $@
common/input/pushba_trans.$(OBJEXT): common/input/pushba_trans.c \
common/input/private.h common/input.h common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/pushba_trans.c
mv pushba_trans.$(OBJEXT) $@
common/input/quotprinenco.$(OBJEXT): common/input/quotprinenco.c \
common/error.h common/attrib_forma.h common/main.h \
common/input/quotprinenco.h common/input.h \
common/input/private.h common/trace.h common/ac/stddef.h \
common/config.h common/config.messy.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/quotprinenco.c
mv quotprinenco.$(OBJEXT) $@
common/input/stdin.$(OBJEXT): common/input/stdin.c common/ac/stdio.h \
common/config.h common/config.messy.h common/main.h \
common/ac/sys/stat.h common/ac/sys/types.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/input/private.h common/input.h \
common/input/stdin.h common/str.h common/ac/stddef.h \
common/ac/stdarg.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/input/stdin.c
mv stdin.$(OBJEXT) $@
common/isdir.$(OBJEXT): common/isdir.c common/ac/sys/stat.h \
common/ac/sys/types.h common/config.h \
common/config.messy.h common/isdir.h common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/isdir.c
mv isdir.$(OBJEXT) $@
common/language.$(OBJEXT): common/language.c common/ac/locale.h \
common/config.h common/config.messy.h \
common/ac/libintl.h common/main.h common/ac/stdlib.h \
common/env.h common/error.h common/attrib_forma.h \
common/language.h common/libdir.h common/progname.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/language.c
mv language.$(OBJEXT) $@
common/libdir.$(OBJEXT): common/libdir.c etc/libdir-h common/libdir.h \
common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/libdir.c
mv libdir.$(OBJEXT) $@
common/mem.$(OBJEXT): common/mem.c common/ac/errno.h common/config.h \
common/config.messy.h common/ac/stddef.h \
common/ac/stdlib.h common/ac/string.h common/error.h \
common/attrib_forma.h common/main.h common/mem.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/mem.c
mv mem.$(OBJEXT) $@
common/mprintf.$(OBJEXT): common/mprintf.c common/ac/errno.h \
common/config.h common/config.messy.h common/ac/stdio.h \
common/main.h common/ac/stdlib.h common/ac/string.h \
common/error.h common/attrib_forma.h common/mprintf.h \
common/ac/stdarg.h common/str.h common/ac/stddef.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/mprintf.c
mv mprintf.$(OBJEXT) $@
common/output.$(OBJEXT): common/output.c common/error.h \
common/attrib_forma.h common/main.h common/mem.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/mprintf.h common/ac/stdarg.h \
common/output/private.h common/output.h common/str.h \
common/trace.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/output.c
mv output.$(OBJEXT) $@
common/output/file.$(OBJEXT): common/output/file.c common/ac/errno.h \
common/config.h common/config.messy.h common/ac/stdio.h \
common/main.h common/fcheck.h common/mem.h \
common/ac/stddef.h common/output/file.h common/output.h \
common/ac/stdarg.h common/attrib_forma.h \
common/output/private.h common/output/stdout.h \
common/error_intl.h common/sub.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/output/file.c
mv file.$(OBJEXT) $@
common/output/private.$(OBJEXT): common/output/private.c \
common/ac/string.h common/config.h common/config.messy.h \
common/error.h common/attrib_forma.h common/main.h \
common/mem.h common/ac/stddef.h common/output/private.h \
common/output.h common/ac/stdarg.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/output/private.c
mv private.$(OBJEXT) $@
common/output/quotprindeco.$(OBJEXT): common/output/quotprindeco.c \
common/output/private.h common/output.h \
common/ac/stdarg.h common/config.h common/config.messy.h \
common/ac/stddef.h common/attrib_forma.h common/main.h \
common/output/quotprindeco.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/output/quotprindeco.c
mv quotprindeco.$(OBJEXT) $@
common/output/stdout.$(OBJEXT): common/output/stdout.c \
common/ac/stddef.h common/config.h common/config.messy.h \
common/ac/stdio.h common/main.h common/ac/sys/stat.h \
common/ac/sys/types.h common/fcheck.h \
common/output/private.h common/output.h \
common/ac/stdarg.h common/attrib_forma.h \
common/output/stdout.h common/str.h common/error_intl.h \
common/sub.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/output/stdout.c
mv stdout.$(OBJEXT) $@
common/page.$(OBJEXT): common/page.c common/ac/stdlib.h common/config.h \
common/config.messy.h common/ac/termios.h \
common/arglex.h common/main.h common/error_intl.h \
common/sub.h common/attrib_forma.h common/page.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/page.c
mv page.$(OBJEXT) $@
common/pager.$(OBJEXT): common/pager.c common/ac/stdio.h common/config.h \
common/config.messy.h common/main.h common/ac/signal.h \
common/ac/stdlib.h common/ac/unistd.h \
common/ac/sys/types.h common/ac/libintl.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/pager.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/pager.c
mv pager.$(OBJEXT) $@
common/progname.$(OBJEXT): common/progname.c common/ac/string.h \
common/config.h common/config.messy.h common/progname.h \
common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/progname.c
mv progname.$(OBJEXT) $@
common/quit.$(OBJEXT): common/quit.c common/ac/stdlib.h common/config.h \
common/config.messy.h common/quit.h common/main.h \
common/undo.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/quit.c
mv quit.$(OBJEXT) $@
common/str.$(OBJEXT): common/str.c common/ac/stddef.h common/config.h \
common/config.messy.h common/ac/stdio.h common/main.h \
common/ac/stdlib.h common/ac/string.h common/ac/ctype.h \
common/ac/stdarg.h common/error.h common/attrib_forma.h \
common/mem.h common/mprintf.h common/str.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/str.c
mv str.$(OBJEXT) $@
common/str_list.$(OBJEXT): common/str_list.c common/ac/ctype.h \
common/config.h common/config.messy.h common/ac/stddef.h \
common/ac/string.h common/ac/stdlib.h common/ac/time.h \
common/mem.h common/main.h common/str.h \
common/ac/stdarg.h common/attrib_forma.h \
common/str_list.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/str_list.c
mv str_list.$(OBJEXT) $@
common/sub.$(OBJEXT): common/sub.c common/ac/errno.h common/config.h \
common/config.messy.h common/ac/libintl.h common/main.h \
common/ac/limits.h common/ac/string.h common/ac/wctype.h \
common/ac/ctype.h common/ac/stddef.h common/arglex.h \
common/error.h common/attrib_forma.h common/error_intl.h \
common/sub.h common/language.h common/mem.h common/str.h \
common/ac/stdarg.h common/sub/basename.h \
common/sub/date.h common/sub/dirname.h \
common/sub/downcase.h common/sub/errno.h \
common/sub/expr.h common/sub/ident.h common/sub/length.h \
common/sub/left.h common/sub/plural.h \
common/sub/private.h common/sub/progname.h \
common/sub/right.h common/sub/upcase.h \
common/sub/zero_pad.h common/trace.h common/wstr_list.h \
common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub.c
mv sub.$(OBJEXT) $@
common/sub/basename.$(OBJEXT): common/sub/basename.c common/ac/string.h \
common/config.h common/config.messy.h \
common/sub/basename.h common/main.h common/sub/private.h \
common/sub.h common/attrib_forma.h common/trace.h \
common/ac/stddef.h common/wstr_list.h common/wstr.h \
common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/basename.c
mv basename.$(OBJEXT) $@
common/sub/date.$(OBJEXT): common/sub/date.c common/ac/time.h \
common/config.h common/config.messy.h common/language.h \
common/main.h common/str.h common/ac/stddef.h \
common/ac/stdarg.h common/attrib_forma.h \
common/sub/date.h common/sub/private.h common/sub.h \
common/trace.h common/wstr_list.h common/wstr.h \
common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/date.c
mv date.$(OBJEXT) $@
common/sub/dirname.$(OBJEXT): common/sub/dirname.c common/sub/dirname.h \
common/main.h common/sub/private.h common/sub.h \
common/attrib_forma.h common/trace.h common/ac/stddef.h \
common/config.h common/config.messy.h common/wstr_list.h \
common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/dirname.c
mv dirname.$(OBJEXT) $@
common/sub/downcase.$(OBJEXT): common/sub/downcase.c \
common/sub/downcase.h common/main.h common/sub/private.h \
common/sub.h common/attrib_forma.h common/trace.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/wstr_list.h common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/downcase.c
mv downcase.$(OBJEXT) $@
common/sub/errno.$(OBJEXT): common/sub/errno.c common/ac/errno.h \
common/config.h common/config.messy.h common/ac/grp.h \
common/ac/sys/types.h common/ac/pwd.h common/ac/string.h \
common/ac/unistd.h common/str.h common/ac/stddef.h \
common/ac/stdarg.h common/attrib_forma.h common/main.h \
common/sub/errno.h common/sub/private.h common/sub.h \
common/trace.h common/wstr_list.h common/wstr.h \
common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/errno.c
mv errno.$(OBJEXT) $@
common/sub/expr.$(OBJEXT): common/sub/expr.c common/sub/expr.h \
common/main.h common/sub/expr_gram.h \
common/sub/private.h common/sub.h common/attrib_forma.h \
common/str.h common/ac/stddef.h common/config.h \
common/config.messy.h common/ac/stdarg.h common/trace.h \
common/wstr_list.h common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/expr.c
mv expr.$(OBJEXT) $@
common/sub/expr_gram.gen.c common/sub/expr_gram.gen.h: \
common/sub/expr_gram.y
@echo Expect no conflicts:
$(YACC) -d common/sub/expr_gram.y
sed -e 's/[yY][yY]/sub_expr_gram_/g' -e '/#include./d' \
-e '/#include./d' -e '/#include./d' \
-e '/#include./d' y.tab.c > \
common/sub/expr_gram.gen.c
sed -e 's/[yY][yY]/sub_expr_gram_/g' y.tab.h > \
common/sub/expr_gram.gen.h
rm y.tab.c y.tab.h
common/sub/expr_gram.gen.$(OBJEXT): common/sub/expr_gram.gen.c \
common/ac/stdarg.h common/config.h common/config.messy.h \
common/ac/stdio.h common/main.h common/ac/stdlib.h \
common/ac/libintl.h common/str.h common/ac/stddef.h \
common/attrib_forma.h common/sub/expr_gram.h \
common/sub/expr_lex.h common/sub/private.h common/sub.h \
common/trace.h
$(CC) $(CPPFLAGS) $(CFLAGS) -Icommon -Icommon -c \
common/sub/expr_gram.gen.c
mv expr_gram.gen.$(OBJEXT) $@
common/sub/expr_lex.$(OBJEXT): common/sub/expr_lex.c common/str.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/ac/stdarg.h common/attrib_forma.h common/main.h \
common/sub/expr_lex.h common/sub/expr_gram.gen.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/expr_lex.c
mv expr_lex.$(OBJEXT) $@
common/sub/ident.$(OBJEXT): common/sub/ident.c common/sub/ident.h \
common/main.h common/sub/private.h common/sub.h \
common/attrib_forma.h common/trace.h common/ac/stddef.h \
common/config.h common/config.messy.h common/wstr_list.h \
common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/ident.c
mv ident.$(OBJEXT) $@
common/sub/left.$(OBJEXT): common/sub/left.c common/ac/stdlib.h \
common/config.h common/config.messy.h common/str.h \
common/ac/stddef.h common/ac/stdarg.h \
common/attrib_forma.h common/main.h common/sub/left.h \
common/sub/private.h common/sub.h common/trace.h \
common/wstr_list.h common/wstr.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/left.c
mv left.$(OBJEXT) $@
common/sub/length.$(OBJEXT): common/sub/length.c common/str.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/ac/stdarg.h common/attrib_forma.h common/main.h \
common/sub/length.h common/sub/private.h common/sub.h \
common/trace.h common/wstr_list.h common/wstr.h \
common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/length.c
mv length.$(OBJEXT) $@
common/sub/plural.$(OBJEXT): common/sub/plural.c common/ac/stdlib.h \
common/config.h common/config.messy.h common/str.h \
common/ac/stddef.h common/ac/stdarg.h \
common/attrib_forma.h common/main.h common/sub/plural.h \
common/sub/private.h common/sub.h common/trace.h \
common/wstr_list.h common/wstr.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/plural.c
mv plural.$(OBJEXT) $@
common/sub/progname.$(OBJEXT): common/sub/progname.c common/progname.h \
common/main.h common/sub/progname.h common/sub/private.h \
common/sub.h common/attrib_forma.h common/trace.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/wstr_list.h common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/progname.c
mv progname.$(OBJEXT) $@
common/sub/right.$(OBJEXT): common/sub/right.c common/str.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/ac/stdarg.h common/attrib_forma.h common/main.h \
common/sub/private.h common/sub.h common/sub/right.h \
common/trace.h common/wstr_list.h common/wstr.h \
common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/right.c
mv right.$(OBJEXT) $@
common/sub/upcase.$(OBJEXT): common/sub/upcase.c common/sub/private.h \
common/sub.h common/attrib_forma.h common/main.h \
common/sub/upcase.h common/trace.h common/ac/stddef.h \
common/config.h common/config.messy.h common/wstr_list.h \
common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/upcase.c
mv upcase.$(OBJEXT) $@
common/sub/zero_pad.$(OBJEXT): common/sub/zero_pad.c common/mem.h \
common/ac/stddef.h common/config.h common/config.messy.h \
common/main.h common/str.h common/ac/stdarg.h \
common/attrib_forma.h common/sub/private.h common/sub.h \
common/sub/zero_pad.h common/trace.h common/wstr_list.h \
common/wstr.h common/ac/stdlib.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/sub/zero_pad.c
mv zero_pad.$(OBJEXT) $@
common/trace.$(OBJEXT): common/trace.c common/ac/errno.h common/config.h \
common/config.messy.h common/ac/stddef.h \
common/ac/stdio.h common/main.h common/ac/string.h \
common/ac/stdarg.h common/error.h common/attrib_forma.h \
common/mem.h common/progname.h common/str.h \
common/trace.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/trace.c
mv trace.$(OBJEXT) $@
common/undo.$(OBJEXT): common/undo.c common/ac/unistd.h common/config.h \
common/config.messy.h common/ac/sys/types.h common/mem.h \
common/ac/stddef.h common/main.h common/str.h \
common/ac/stdarg.h common/attrib_forma.h common/undo.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/undo.c
mv undo.$(OBJEXT) $@
common/version.$(OBJEXT): common/version.c common/ac/stdio.h \
common/config.h common/config.messy.h common/main.h \
common/arglex.h common/error.h common/attrib_forma.h \
common/help.h common/progname.h common/quit.h \
common/str.h common/ac/stddef.h common/ac/stdarg.h \
common/trace.h common/version.h common/version_stmp.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/version.c
mv version.$(OBJEXT) $@
common/version_stmp.$(OBJEXT): common/version_stmp.c common/patchlevel.h \
common/version_stmp.h common/main.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/version_stmp.c
mv version_stmp.$(OBJEXT) $@
common/wstr.$(OBJEXT): common/wstr.c common/ac/limits.h common/config.h \
common/config.messy.h common/ac/stdarg.h \
common/ac/stddef.h common/ac/stdio.h common/main.h \
common/ac/stdlib.h common/ac/string.h common/ac/wchar.h \
common/ac/time.h common/ac/wctype.h common/ac/ctype.h \
common/error.h common/attrib_forma.h common/language.h \
common/mem.h common/str.h common/trace.h common/wstr.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/wstr.c
mv wstr.$(OBJEXT) $@
common/wstr_list.$(OBJEXT): common/wstr_list.c common/ac/string.h \
common/config.h common/config.messy.h common/wstr_list.h \
common/wstr.h common/ac/stdlib.h common/main.h \
common/mem.h common/ac/stddef.h
$(CC) $(CFLAGS) -Icommon -Icommon -c common/wstr_list.c
mv wstr_list.$(OBJEXT) $@
fcomp/main.$(OBJEXT): fcomp/main.c common/ac/errno.h common/config.h \
common/config.messy.h common/ac/stdio.h common/main.h \
common/ac/stdlib.h common/ac/string.h common/arglex.h \
common/cmalloc.h common/ac/stddef.h common/compare.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/fileio.h common/help.h common/isdir.h \
common/progname.h common/quit.h common/version.h
$(CC) $(CFLAGS) -Ifcomp -Icommon -c fcomp/main.c
mv main.$(OBJEXT) $@
fhist/breaks.$(OBJEXT): fhist/breaks.c common/ac/signal.h \
common/config.h common/config.messy.h common/ac/unistd.h \
common/ac/sys/types.h fhist/breaks.h common/main.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/breaks.c
mv breaks.$(OBJEXT) $@
fhist/diff.$(OBJEXT): fhist/diff.c common/ac/errno.h common/config.h \
common/config.messy.h common/ac/stdio.h common/main.h \
common/ac/stdlib.h common/ac/string.h common/ac/unistd.h \
common/ac/sys/types.h common/cmalloc.h \
common/ac/stddef.h common/compare.h fhist/diff.h \
common/error.h common/attrib_forma.h common/error_intl.h \
common/sub.h fhist/extract.h common/fcheck.h \
fhist/fhist.h common/fileio.h fhist/modlin.h \
common/str.h common/ac/stdarg.h fhist/subroutine.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/diff.c
mv diff.$(OBJEXT) $@
fhist/extract.$(OBJEXT): fhist/extract.c common/ac/libintl.h \
common/config.h common/config.messy.h common/main.h \
common/ac/stdio.h common/ac/string.h common/ac/unistd.h \
common/ac/sys/types.h common/cmalloc.h \
common/ac/stddef.h common/compare.h common/error_intl.h \
common/sub.h common/attrib_forma.h fhist/extract.h \
common/fcheck.h fhist/fhist.h common/fileio.h \
fhist/modlin.h common/output/file.h common/output.h \
common/ac/stdarg.h common/output/stdout.h \
common/output/quotprindeco.h fhist/subroutine.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/extract.c
mv extract.$(OBJEXT) $@
fhist/list.$(OBJEXT): fhist/list.c common/ac/libintl.h common/config.h \
common/config.messy.h common/main.h common/ac/stdio.h \
common/cmalloc.h common/ac/stddef.h common/compare.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/fcheck.h fhist/fhist.h common/fileio.h \
fhist/list.h fhist/subroutine.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/list.c
mv list.$(OBJEXT) $@
fhist/main.$(OBJEXT): fhist/main.c common/ac/ctype.h common/config.h \
common/config.messy.h common/ac/sys/types.h \
common/ac/stdio.h common/main.h common/ac/errno.h \
common/ac/dirent.h common/ac/unistd.h common/ac/stdlib.h \
common/ac/string.h common/ac/sys/stat.h common/arglex.h \
fhist/breaks.h common/cmalloc.h common/ac/stddef.h \
common/compare.h fhist/diff.h common/error_intl.h \
common/sub.h common/attrib_forma.h fhist/extract.h \
fhist/fhist.h common/help.h common/isdir.h fhist/list.h \
fhist/modlin.h fhist/name.h common/progname.h \
fhist/prune.h common/quit.h common/str.h \
common/ac/stdarg.h fhist/subroutine.h common/trace.h \
fhist/update.h common/version.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/main.c
mv main.$(OBJEXT) $@
fhist/modlin.$(OBJEXT): fhist/modlin.c common/ac/string.h \
common/config.h common/config.messy.h common/cmalloc.h \
common/ac/stddef.h common/main.h common/compare.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/fcheck.h common/ac/stdio.h fhist/fhist.h \
common/fileio.h common/input/file_text.h common/input.h \
common/input/file.h common/ac/sys/stat.h \
common/ac/sys/types.h common/input/quotprinenco.h \
fhist/modlin.h common/trace.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/modlin.c
mv modlin.$(OBJEXT) $@
fhist/name.$(OBJEXT): fhist/name.c common/ac/ctype.h common/config.h \
common/config.messy.h common/ac/errno.h \
common/ac/stdio.h common/main.h common/ac/string.h \
fhist/breaks.h common/compare.h common/error_intl.h \
common/sub.h common/attrib_forma.h fhist/fhist.h \
common/fileio.h fhist/name.h fhist/subroutine.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/name.c
mv name.$(OBJEXT) $@
fhist/prune.$(OBJEXT): fhist/prune.c common/ac/stdio.h common/config.h \
common/config.messy.h common/main.h common/ac/string.h \
fhist/breaks.h common/compare.h common/error_intl.h \
common/sub.h common/attrib_forma.h common/fcheck.h \
fhist/fhist.h common/fileio.h fhist/prune.h common/str.h \
common/ac/stddef.h common/ac/stdarg.h fhist/subroutine.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/prune.c
mv prune.$(OBJEXT) $@
fhist/subroutine.$(OBJEXT): fhist/subroutine.c common/ac/ctype.h \
common/config.h common/config.messy.h common/ac/errno.h \
common/ac/stdio.h common/main.h common/ac/string.h \
common/ac/unistd.h common/ac/sys/types.h \
common/cmalloc.h common/ac/stddef.h common/compare.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/fcheck.h fhist/fhist.h common/fileio.h \
common/isdir.h common/str.h common/ac/stdarg.h \
fhist/subroutine.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/subroutine.c
mv subroutine.$(OBJEXT) $@
fhist/update.$(OBJEXT): fhist/update.c common/ac/ctype.h common/config.h \
common/config.messy.h common/ac/errno.h common/ac/pwd.h \
common/ac/sys/types.h common/ac/stdio.h common/main.h \
common/ac/string.h common/ac/time.h common/ac/unistd.h \
fhist/breaks.h common/cmalloc.h common/ac/stddef.h \
common/compare.h common/error_intl.h common/sub.h \
common/attrib_forma.h common/fcheck.h fhist/fhist.h \
common/fileio.h common/input/file.h common/ac/sys/stat.h \
common/input.h common/input/file_text.h \
common/input/quotprinenco.h fhist/modlin.h common/str.h \
common/ac/stdarg.h fhist/subroutine.h common/trace.h \
common/undo.h fhist/update.h
$(CC) $(CFLAGS) -Ifhist -Icommon -c fhist/update.c
mv update.$(OBJEXT) $@
fmerge/main.$(OBJEXT): fmerge/main.c common/ac/errno.h common/config.h \
common/config.messy.h common/ac/stdio.h common/main.h \
common/ac/stdlib.h common/ac/string.h common/arglex.h \
common/cmalloc.h common/ac/stddef.h common/compare.h \
common/error_intl.h common/sub.h common/attrib_forma.h \
common/fileio.h common/help.h common/progname.h \
common/quit.h common/version.h fmerge/work.h
$(CC) $(CFLAGS) -Ifmerge -Icommon -c fmerge/main.c
mv main.$(OBJEXT) $@
fmerge/work.$(OBJEXT): fmerge/work.c common/ac/stdio.h common/config.h \
common/config.messy.h common/main.h common/ac/string.h \
common/ac/libintl.h common/cmalloc.h common/ac/stddef.h \
common/compare.h common/error_intl.h common/sub.h \
common/attrib_forma.h common/fcheck.h common/fileio.h \
fmerge/work.h
$(CC) $(CFLAGS) -Ifmerge -Icommon -c fmerge/work.c
mv work.$(OBJEXT) $@
lib/en/LC_MESSAGES/fcomp.mo: lib/en/LC_MESSAGES/fcomp.po \
lib/en/LC_MESSAGES/common.po
$(SH) etc/msgfmt.sh --msgfmt=$(MSGFMT) --msgcat=$(MSGCAT) \
--output=$@ lib/en/LC_MESSAGES/fcomp.po \
lib/en/LC_MESSAGES/common.po
$(NLSDIR)/en/LC_MESSAGES/fcomp.mo: lib/en/LC_MESSAGES/fcomp.mo \
lib/en/LC_MESSAGES/.nlsdir
$(INSTALL_DATA) lib/en/LC_MESSAGES/fcomp.mo $@
lib/en/LC_MESSAGES/fhist.mo: lib/en/LC_MESSAGES/fhist.po \
lib/en/LC_MESSAGES/common.po
$(SH) etc/msgfmt.sh --msgfmt=$(MSGFMT) --msgcat=$(MSGCAT) \
--output=$@ lib/en/LC_MESSAGES/fhist.po \
lib/en/LC_MESSAGES/common.po
$(NLSDIR)/en/LC_MESSAGES/fhist.mo: lib/en/LC_MESSAGES/fhist.mo \
lib/en/LC_MESSAGES/.nlsdir
$(INSTALL_DATA) lib/en/LC_MESSAGES/fhist.mo $@
lib/en/LC_MESSAGES/fmerge.mo: lib/en/LC_MESSAGES/fmerge.po \
lib/en/LC_MESSAGES/common.po
$(SH) etc/msgfmt.sh --msgfmt=$(MSGFMT) --msgcat=$(MSGCAT) \
--output=$@ lib/en/LC_MESSAGES/fmerge.po \
lib/en/LC_MESSAGES/common.po
$(NLSDIR)/en/LC_MESSAGES/fmerge.mo: lib/en/LC_MESSAGES/fmerge.mo \
lib/en/LC_MESSAGES/.nlsdir
$(INSTALL_DATA) lib/en/LC_MESSAGES/fmerge.mo $@
lib/en/building.ps: lib/en/building/main.man
$(SOELIM) -Ilib/en/building -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/building/main.man | $(GROFF) -s -t -p -man -mpic \
-mpspic > $@
$(datadir)/en/building.ps: lib/en/building.ps lib/en/.datadir
$(INSTALL_DATA) lib/en/building.ps $@
lib/en/building.dvi: lib/en/building/main.man
$(SOELIM) -Ilib/en/building -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/building/main.man | $(GROFF) -Tdvi -s -t -p -man \
-mpic > $@
$(datadir)/en/building.dvi: lib/en/building.dvi lib/en/.datadir
$(INSTALL_DATA) lib/en/building.dvi $@
lib/en/building.txt: lib/en/building/main.man
$(SOELIM) -Ilib/en/building -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/building/main.man | $(GROFF) -Tascii -s -t -p \
-man -mpic > $@
$(datadir)/en/building.txt: lib/en/building.txt lib/en/.datadir
$(INSTALL_DATA) lib/en/building.txt $@
$(datadir)/en/man1/fcomp.1: lib/en/man1/fcomp.1 lib/en/man1/.datadir
$(SOELIM) -Ilib/en/man1 -Ietc lib/en/man1/fcomp.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
$(mandir)/man1/fcomp.1: lib/$(MANLANG)/man1/fcomp.1 lib/en/man1/.mandir
$(SOELIM) -Ilib/$(MANLANG)/man1 -Ietc lib/$(MANLANG)/man1/fcomp.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
$(datadir)/en/man1/fhist.1: lib/en/man1/fhist.1 lib/en/man1/.datadir
$(SOELIM) -Ilib/en/man1 -Ietc lib/en/man1/fhist.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
$(mandir)/man1/fhist.1: lib/$(MANLANG)/man1/fhist.1 lib/en/man1/.mandir
$(SOELIM) -Ilib/$(MANLANG)/man1 -Ietc lib/$(MANLANG)/man1/fhist.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
$(datadir)/en/man1/fhist_lic.1: lib/en/man1/fhist_lic.1 \
lib/en/man1/.datadir
$(SOELIM) -Ilib/en/man1 -Ietc lib/en/man1/fhist_lic.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
$(mandir)/man1/fhist_lic.1: lib/$(MANLANG)/man1/fhist_lic.1 \
lib/en/man1/.mandir
$(SOELIM) -Ilib/$(MANLANG)/man1 -Ietc \
lib/$(MANLANG)/man1/fhist_lic.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
$(datadir)/en/man1/fmerge.1: lib/en/man1/fmerge.1 lib/en/man1/.datadir
$(SOELIM) -Ilib/en/man1 -Ietc lib/en/man1/fmerge.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
$(mandir)/man1/fmerge.1: lib/$(MANLANG)/man1/fmerge.1 \
lib/en/man1/.mandir
$(SOELIM) -Ilib/$(MANLANG)/man1 -Ietc \
lib/$(MANLANG)/man1/fmerge.1 > tmp
$(INSTALL_DATA) tmp $@
@rm -f tmp
lib/en/readme.ps: lib/en/readme/main.man
$(SOELIM) -Ilib/en/readme -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/readme/main.man | $(GROFF) -s -t -p -man -mpic \
-mpspic > $@
$(datadir)/en/readme.ps: lib/en/readme.ps lib/en/.datadir
$(INSTALL_DATA) lib/en/readme.ps $@
lib/en/readme.dvi: lib/en/readme/main.man
$(SOELIM) -Ilib/en/readme -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/readme/main.man | $(GROFF) -Tdvi -s -t -p -man \
-mpic > $@
$(datadir)/en/readme.dvi: lib/en/readme.dvi lib/en/.datadir
$(INSTALL_DATA) lib/en/readme.dvi $@
lib/en/readme.txt: lib/en/readme/main.man
$(SOELIM) -Ilib/en/readme -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/readme/main.man | $(GROFF) -Tascii -s -t -p -man \
-mpic > $@
$(datadir)/en/readme.txt: lib/en/readme.txt lib/en/.datadir
$(INSTALL_DATA) lib/en/readme.txt $@
lib/en/reference.ps: lib/en/reference/main.man
$(SOELIM) -Ilib/en/reference -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/reference/main.man | $(GROFF) -s -t -p -man -mpic \
-mpspic > $@
$(datadir)/en/reference.ps: lib/en/reference.ps lib/en/.datadir
$(INSTALL_DATA) lib/en/reference.ps $@
lib/en/reference.dvi: lib/en/reference/main.man
$(SOELIM) -Ilib/en/reference -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/reference/main.man | $(GROFF) -Tdvi -s -t -p -man \
-mpic > $@
$(datadir)/en/reference.dvi: lib/en/reference.dvi lib/en/.datadir
$(INSTALL_DATA) lib/en/reference.dvi $@
lib/en/reference.txt: lib/en/reference/main.man
$(SOELIM) -Ilib/en/reference -Ietc -Ilib/en/man1 -Ilib/en/readme \
lib/en/reference/main.man | $(GROFF) -Tascii -s -t -p \
-man -mpic > $@
$(datadir)/en/reference.txt: lib/en/reference.txt lib/en/.datadir
$(INSTALL_DATA) lib/en/reference.txt $@
t0001a: test/00/t0001a.sh all
$(SH) test/00/t0001a.sh
t0002a: test/00/t0002a.sh all
$(SH) test/00/t0002a.sh
t0003a: test/00/t0003a.sh all
$(SH) test/00/t0003a.sh
t0004a: test/00/t0004a.sh all
$(SH) test/00/t0004a.sh
t0005a: test/00/t0005a.sh all
$(SH) test/00/t0005a.sh
t0006a: test/00/t0006a.sh all
$(SH) test/00/t0006a.sh
t0007a: test/00/t0007a.sh all
$(SH) test/00/t0007a.sh
t0008a: test/00/t0008a.sh all
$(SH) test/00/t0008a.sh
t0009a: test/00/t0009a.sh all
$(SH) test/00/t0009a.sh
t0010a: test/00/t0010a.sh all
$(SH) test/00/t0010a.sh
t0011a: test/00/t0011a.sh all
$(SH) test/00/t0011a.sh
t0012a: test/00/t0012a.sh all
$(SH) test/00/t0012a.sh
t0013a: test/00/t0013a.sh all
$(SH) test/00/t0013a.sh
t0014a: test/00/t0014a.sh all
$(SH) test/00/t0014a.sh
t0015a: test/00/t0015a.sh all
$(SH) test/00/t0015a.sh
t0016a: test/00/t0016a.sh all
$(SH) test/00/t0016a.sh
t0017a: test/00/t0017a.sh all
$(SH) test/00/t0017a.sh
t0018a: test/00/t0018a.sh all
$(SH) test/00/t0018a.sh
t0019a: test/00/t0019a.sh all
$(SH) test/00/t0019a.sh
t0020a: test/00/t0020a.sh all
$(SH) test/00/t0020a.sh
t0021a: test/00/t0021a.sh all
$(SH) test/00/t0021a.sh
t0022a: test/00/t0022a.sh all
$(SH) test/00/t0022a.sh
t0023a: test/00/t0023a.sh all
$(SH) test/00/t0023a.sh
t0024a: test/00/t0024a.sh all
$(SH) test/00/t0024a.sh
t0025a: test/00/t0025a.sh all
$(SH) test/00/t0025a.sh
t0026a: test/00/t0026a.sh all
$(SH) test/00/t0026a.sh
t0027a: test/00/t0027a.sh all
$(SH) test/00/t0027a.sh
t0028a: test/00/t0028a.sh all
$(SH) test/00/t0028a.sh
t0029a: test/00/t0029a.sh all
$(SH) test/00/t0029a.sh
t0030a: test/00/t0030a.sh all
$(SH) test/00/t0030a.sh
t0031a: test/00/t0031a.sh all
$(SH) test/00/t0031a.sh
lib/en/LC_MESSAGES/.nlsdir: lib/en/.nlsdir
-$(INSTALL) -m 0755 -d $(NLSDIR)/en/LC_MESSAGES
@-test -d $(NLSDIR)/en/LC_MESSAGES && touch $@
@sleep 1
lib/en/.nlsdir: lib/.nlsdir
-$(INSTALL) -m 0755 -d $(NLSDIR)/en
@-test -d $(NLSDIR)/en && touch $@
@sleep 1
lib/.nlsdir:
-$(INSTALL) -m 0755 -d $(NLSDIR)
@-test -d $(NLSDIR) && touch $@
@sleep 1
lib/en/man1/.mandir: lib/en/.mandir
-$(INSTALL) -m 0755 -d $(mandir)/man1
@-test -d $(mandir)/man1 && touch $@
@sleep 1
lib/en/.mandir:
-$(INSTALL) -m 0755 -d $(mandir)
@-test -d $(mandir) && touch $@
@sleep 1
lib/en/man1/.datadir: lib/en/.datadir
-$(INSTALL) -m 0755 -d $(datadir)/en/man1
@-test -d $(datadir)/en/man1 && touch $@
@sleep 1
lib/en/.datadir: lib/.datadir
-$(INSTALL) -m 0755 -d $(datadir)/en
@-test -d $(datadir)/en && touch $@
@sleep 1
lib/.datadir:
-$(INSTALL) -m 0755 -d $(datadir)
@-test -d $(datadir) && touch $@
@sleep 1
all: binaries po doc
CommonFiles = common/ac/libintl.$(OBJEXT) common/ac/string.$(OBJEXT) \
common/ac/unistd.$(OBJEXT) common/ac/wchar.$(OBJEXT) \
common/ac/wctype.$(OBJEXT) common/arglex.$(OBJEXT) \
common/cmalloc.$(OBJEXT) common/compare.$(OBJEXT) \
common/env.$(OBJEXT) common/error.$(OBJEXT) \
common/error_intl.$(OBJEXT) common/fcheck.$(OBJEXT) \
common/fileio.$(OBJEXT) common/help.$(OBJEXT) \
common/input.$(OBJEXT) common/input/crlf.$(OBJEXT) \
common/input/file.$(OBJEXT) \
common/input/file_text.$(OBJEXT) \
common/input/hexify.$(OBJEXT) \
common/input/private.$(OBJEXT) \
common/input/pushba_trans.$(OBJEXT) \
common/input/quotprinenco.$(OBJEXT) \
common/input/stdin.$(OBJEXT) common/isdir.$(OBJEXT) \
common/language.$(OBJEXT) common/libdir.$(OBJEXT) \
common/mem.$(OBJEXT) common/mprintf.$(OBJEXT) \
common/output.$(OBJEXT) common/output/file.$(OBJEXT) \
common/output/private.$(OBJEXT) \
common/output/quotprindeco.$(OBJEXT) \
common/output/stdout.$(OBJEXT) common/page.$(OBJEXT) \
common/pager.$(OBJEXT) common/progname.$(OBJEXT) \
common/quit.$(OBJEXT) common/str.$(OBJEXT) \
common/str_list.$(OBJEXT) common/sub.$(OBJEXT) \
common/sub/basename.$(OBJEXT) common/sub/date.$(OBJEXT) \
common/sub/dirname.$(OBJEXT) \
common/sub/downcase.$(OBJEXT) common/sub/errno.$(OBJEXT) \
common/sub/expr.$(OBJEXT) \
common/sub/expr_gram.gen.$(OBJEXT) \
common/sub/expr_lex.$(OBJEXT) common/sub/ident.$(OBJEXT) \
common/sub/left.$(OBJEXT) common/sub/length.$(OBJEXT) \
common/sub/plural.$(OBJEXT) \
common/sub/progname.$(OBJEXT) common/sub/right.$(OBJEXT) \
common/sub/upcase.$(OBJEXT) \
common/sub/zero_pad.$(OBJEXT) common/trace.$(OBJEXT) \
common/undo.$(OBJEXT) common/version.$(OBJEXT) \
common/version_stmp.$(OBJEXT) common/wstr.$(OBJEXT) \
common/wstr_list.$(OBJEXT)
TestFiles = t0001a t0002a t0003a t0004a t0005a t0006a t0007a t0008a \
t0009a t0010a t0011a t0012a t0013a t0014a t0015a t0016a \
t0017a t0018a t0019a t0020a t0021a t0022a t0023a t0024a \
t0025a t0026a t0027a t0028a t0029a t0030a t0031a
install-man: $(mandir)/man1/fcomp.1 $(mandir)/man1/fhist.1 \
$(mandir)/man1/fhist_lic.1 $(mandir)/man1/fmerge.1
install-iman: install-iman-$(HAVE_I18N)
install-iman-yes: $(datadir)/en/man1/fcomp.1 $(datadir)/en/man1/fhist.1 \
$(datadir)/en/man1/fhist_lic.1 \
$(datadir)/en/man1/fmerge.1
install-iman-no:
po: po-$(HAVE_I18N)
po-yes: lib/en/LC_MESSAGES/fcomp.mo lib/en/LC_MESSAGES/fhist.mo \
lib/en/LC_MESSAGES/fmerge.mo
po-no:
install-po: install-po-$(HAVE_I18N)
install-po-yes: $(NLSDIR)/en/LC_MESSAGES/fcomp.mo \
$(NLSDIR)/en/LC_MESSAGES/fhist.mo \
$(NLSDIR)/en/LC_MESSAGES/fmerge.mo
install-po-no:
doc: doc-$(HAVE_GROFF)
doc-yes: lib/en/building.ps lib/en/building.dvi lib/en/building.txt \
lib/en/readme.ps lib/en/readme.dvi lib/en/readme.txt \
lib/en/reference.ps lib/en/reference.dvi \
lib/en/reference.txt
doc-no:
install-doc: install-doc-$(HAVE_GROFF)
install-doc-yes: $(datadir)/en/building.ps $(datadir)/en/building.dvi \
$(datadir)/en/building.txt $(datadir)/en/readme.ps \
$(datadir)/en/readme.dvi $(datadir)/en/readme.txt \
$(datadir)/en/reference.ps $(datadir)/en/reference.dvi \
$(datadir)/en/reference.txt
install-doc-no:
binaries: bin/fcomp$(EXEEXT) bin/fhist$(EXEEXT) bin/fmerge$(EXEEXT)
fcomp_files = fcomp/main.$(OBJEXT)
bin/fcomp$(EXEEXT): $(fcomp_files) common/lib.$(LIBEXT) .bin
$(CC) $(LDFLAGS) -o $@ $(fcomp_files) common/lib.$(LIBEXT) $(LIBS)
chmod 755 $@
$(bindir)/$(PROGRAM_PREFIX)fcomp$(PROGRAM_SUFFIX)$(EXEEXT): \
bin/fcomp$(EXEEXT) .bindir
$(INSTALL_PROGRAM) bin/fcomp$(EXEEXT) $@
fhist_files = fhist/breaks.$(OBJEXT) fhist/diff.$(OBJEXT) \
fhist/extract.$(OBJEXT) fhist/list.$(OBJEXT) \
fhist/main.$(OBJEXT) fhist/modlin.$(OBJEXT) \
fhist/name.$(OBJEXT) fhist/prune.$(OBJEXT) \
fhist/subroutine.$(OBJEXT) fhist/update.$(OBJEXT)
bin/fhist$(EXEEXT): $(fhist_files) common/lib.$(LIBEXT) .bin
$(CC) $(LDFLAGS) -o $@ $(fhist_files) common/lib.$(LIBEXT) $(LIBS)
chmod 755 $@
$(bindir)/$(PROGRAM_PREFIX)fhist$(PROGRAM_SUFFIX)$(EXEEXT): \
bin/fhist$(EXEEXT) .bindir
$(INSTALL_PROGRAM) bin/fhist$(EXEEXT) $@
fmerge_files = fmerge/main.$(OBJEXT) fmerge/work.$(OBJEXT)
bin/fmerge$(EXEEXT): $(fmerge_files) common/lib.$(LIBEXT) .bin
$(CC) $(LDFLAGS) -o $@ $(fmerge_files) common/lib.$(LIBEXT) $(LIBS)
chmod 755 $@
$(bindir)/$(PROGRAM_PREFIX)fmerge$(PROGRAM_SUFFIX)$(EXEEXT): \
bin/fmerge$(EXEEXT) .bindir
$(INSTALL_PROGRAM) bin/fmerge$(EXEEXT) $@
clean-obj:
rm -f core common/lib.$(LIBEXT) .bin .bindir
rm -f common/ac/libintl.$(OBJEXT) common/ac/string.$(OBJEXT)
rm -f common/ac/unistd.$(OBJEXT) common/ac/wchar.$(OBJEXT)
rm -f common/ac/wctype.$(OBJEXT) common/arglex.$(OBJEXT)
rm -f common/cmalloc.$(OBJEXT) common/compare.$(OBJEXT)
rm -f common/env.$(OBJEXT) common/error.$(OBJEXT)
rm -f common/error_intl.$(OBJEXT) common/fcheck.$(OBJEXT)
rm -f common/fileio.$(OBJEXT) common/help.$(OBJEXT)
rm -f common/input.$(OBJEXT) common/input/crlf.$(OBJEXT)
rm -f common/input/file.$(OBJEXT)
rm -f common/input/file_text.$(OBJEXT)
rm -f common/input/hexify.$(OBJEXT)
rm -f common/input/private.$(OBJEXT)
rm -f common/input/pushba_trans.$(OBJEXT)
rm -f common/input/quotprinenco.$(OBJEXT)
rm -f common/input/stdin.$(OBJEXT) common/isdir.$(OBJEXT)
rm -f common/language.$(OBJEXT) common/libdir.$(OBJEXT)
rm -f common/mem.$(OBJEXT) common/mprintf.$(OBJEXT)
rm -f common/output.$(OBJEXT) common/output/file.$(OBJEXT)
rm -f common/output/private.$(OBJEXT)
rm -f common/output/quotprindeco.$(OBJEXT)
rm -f common/output/stdout.$(OBJEXT) common/page.$(OBJEXT)
rm -f common/pager.$(OBJEXT) common/progname.$(OBJEXT)
rm -f common/quit.$(OBJEXT) common/str.$(OBJEXT)
rm -f common/str_list.$(OBJEXT) common/sub.$(OBJEXT)
rm -f common/sub/basename.$(OBJEXT) common/sub/date.$(OBJEXT)
rm -f common/sub/dirname.$(OBJEXT) common/sub/downcase.$(OBJEXT)
rm -f common/sub/errno.$(OBJEXT) common/sub/expr.$(OBJEXT)
rm -f common/sub/expr_gram.gen.c common/sub/expr_gram.gen.h
rm -f common/sub/expr_gram.gen.$(OBJEXT)
rm -f common/sub/expr_lex.$(OBJEXT) common/sub/ident.$(OBJEXT)
rm -f common/sub/left.$(OBJEXT) common/sub/length.$(OBJEXT)
rm -f common/sub/plural.$(OBJEXT) common/sub/progname.$(OBJEXT)
rm -f common/sub/right.$(OBJEXT) common/sub/upcase.$(OBJEXT)
rm -f common/sub/zero_pad.$(OBJEXT) common/trace.$(OBJEXT)
rm -f common/undo.$(OBJEXT) common/version.$(OBJEXT)
rm -f common/version_stmp.$(OBJEXT) common/wstr.$(OBJEXT)
rm -f common/wstr_list.$(OBJEXT) fcomp/main.$(OBJEXT)
rm -f fhist/breaks.$(OBJEXT) fhist/diff.$(OBJEXT)
rm -f fhist/extract.$(OBJEXT) fhist/list.$(OBJEXT)
rm -f fhist/main.$(OBJEXT) fhist/modlin.$(OBJEXT)
rm -f fhist/name.$(OBJEXT) fhist/prune.$(OBJEXT)
rm -f fhist/subroutine.$(OBJEXT) fhist/update.$(OBJEXT)
rm -f fmerge/main.$(OBJEXT) fmerge/work.$(OBJEXT)
rm -f lib/en/LC_MESSAGES/.nlsdir lib/en/.nlsdir lib/.nlsdir
rm -f lib/en/building.ps lib/en/building.dvi lib/en/building.txt
rm -f lib/en/man1/.mandir lib/en/.mandir lib/en/man1/.datadir
rm -f lib/en/.datadir lib/.datadir lib/en/readme.ps
rm -f lib/en/readme.dvi lib/en/readme.txt lib/en/reference.ps
rm -f lib/en/reference.dvi lib/en/reference.txt
clean: clean-obj
rm -f bin/fcomp$(EXEEXT) bin/fhist$(EXEEXT) bin/fmerge$(EXEEXT)
distclean: clean
rm -f config.status config.log config.cache Makefile
rm -f common/config.h etc/libdir-h
common/lib.$(LIBEXT): $(CommonFiles)
rm -f $@
ar cq $@ $(CommonFiles)
$(RANLIB) $@
.bin:
-mkdir bin
-@test -d bin && touch $@
@sleep 1
.bindir:
-$(INSTALL) -d -m 0755 $(bindir)
-@test -d $(bindir) && touch $@
@sleep 1
sure: $(TestFiles)
@echo Passed All Tests
install: install-bin install-man install-iman install-po install-doc
@echo Installation Complete
install-bin: $(bindir)/$(PROGRAM_PREFIX)fcomp$(PROGRAM_SUFFIX)$(EXEEXT) \
$(bindir)/$(PROGRAM_PREFIX)fhist$(PROGRAM_SUFFIX)$(EXEEXT) \
$(bindir)/$(PROGRAM_PREFIX)fmerge$(PROGRAM_SUFFIX)$(EXEEXT)
fhist-1.18/aegis.conf 644 0 0 10774 11265752627 14000 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1993-1995, 1998, 2000, 2006, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
configuration_directory = "aegis.conf.d";
/*
* how to build the project
* (actually, how to do an integration build)
* mandatory
*/
build_command =
"cook -book ${source etc/Howto.cook} -nl -st "
"project=$project change=$change "
"version=$version arch=$arch "
"search_path=$search_path "
"cc=${Project_Specific cc} "
"${uname}_cc=${Project_Specific ${uname}_cc} "
"${uname}_cc_flags=${Project_Specific ${uname}_cc_flags} "
"${uname}_ld_flags=${Project_Specific ${uname}_ld_flags} "
"${uname}_libs=${Project_Specific ${uname}_libs}";
/*
* When do -Integrate_Begin, link the baseline to the integration directory,
* rather than copying it.. This should be much faster.
*
* There is a gotcha: all the recipes in Howto.cook must unlink their targets
* before re-creating them, otherwise the baseline will be trashed.
*/
link_integration_directory = true;
/*
* create a new history
* always executed as the project owner
*/
history_create_command =
"fhist ${basename $history} -cr -cu -i ${input} -p ${dirname $history} -r";
/*
* get a file from history
* may be executed by developers
*/
history_get_command =
"fhist ${basename $history} -e '$edit' -o $output -p ${dirname $history}";
/*
* add a new change to the history
* always executed as the project owner
*/
history_put_command =
"fhist ${basename $history} -cu -cr -i $input -p ${dirname $history} -r";
/*
* query the topmost edit of a history file
* Result to be printed on stdout.
* may be executed by developers
*/
history_query_command =
"fhist ${basename $history} -l 0 -p ${dirname $history} -q";
/*
* difference of 2 files
*/
diff_command =
"fcomp -s -w $original $input -o $output";
/*
* merege 2 competing edits
*/
merge_command =
"fmerge $original $mostRecent $input -o $output -c $input,C";
/*
* whenever files are added to or removed from the change,
* execute the following command.
*/
change_file_command = "rm -f .c_inclrc etc/cook/*";
project_file_command = "rm -f .c_inclrc etc/cook/*";
/*
* new file templates
*/
file_template =
[
{
pattern = [ "*.[cyl]" ];
body = "${read_file ${source etc/template/c abs}}";
},
{
pattern = [ "*.h" ];
body = "${read_file ${source etc/template/h abs}}";
},
{
pattern = [ "test/*/*.sh" ];
body = "${read_file ${source etc/template/test abs}}";
},
{
pattern = [ "*.sh" ];
body = "${read_file ${source etc/template/sh abs}}";
},
{
pattern = [ "*.man", "*.[12345678]" ];
body = "${read_file ${source etc/template/man abs}}";
},
{
pattern = [ "*.so", "*.ms", "*.me" ];
body = "${read_file ${source etc/template/ms abs}}";
},
{
pattern = [ "*" ];
body = "${read_file ${source etc/template/generic abs}}";
}
];
architecture =
[
{
name = "linux-i486";
pattern = "Linux-*-*-i?86";
},
];
develop_begin_command = "ln -s $bl bl";
integrate_begin_command =
"rm -f aegis.log common/patchlevel.h lib/*/readme/new.so etc/version.so";
test_command = "$sh $filename $arch";
maximum_filename_length = 14;
project_specific =
[
{
name = "html:body-begin";
value = @@;
},
];
fhist-1.18/aegis.conf.d/aede-policy 644 0 0 2217 11265752627 16366 0 ustar Peter Miller 0 0 #
# fhist - file history and comparison tools
# Copyright (C) 2008 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
develop_end_policy_command = "aede-policy -p $project -c $change";
project_specific =
[
{
name = "aede-policy";
value =
"copyright "
"crlf "
"description "
"fsf-address "
"gpl-version=3 "
"line-length "
# "merge-fhist "
"no-manifest "
"no-tabs "
"printable "
"white-space"
;
}
];
fhist-1.18/aegis.conf.d/rss 644 0 0 2527 11265752627 15006 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2005, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
project_specific =
[
{
name = "rss:feedfilename-completed.xml";
value = "completed";
},
{
name = "rss:feeddescription-completed.xml";
value =
"This feed provides you with a way to subscribe to new "
"FHist change sets if you are interested in tracking FHist "
"development."
;
},
{
name = "rss:feedtitle-completed.xml";
value = "Developments";
},
{
name = "rss:feedlanguage-completed.xml";
value = "en-AU";
},
];
fhist-1.18/aegis.conf.d/site.conf 644 0 0 10762 11265752627 16107 0 ustar Peter Miller 0 0 #
# fhist - file history and comparison tools
# Copyright (C) 2006, 2008 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# .
#
/*
* This file define some variables specific to *your* site.
*/
project_specific =
[
/*
* Define the following attribute if you need to override the
* default autoconf name, or if it is in an unusual (not in
* $PATH) directory.
*/
{
name = "autoconf";
value = "";
},
/*
* Define the following attribute if you need to override the
* default autoheader name, or if it is in an unusual (not in
* $PATH) directory.
*/
{
name = "autoheader";
value = "";
},
/*
* Define the following attribute if you want to override the
* c compiler for the solaris 5.8 architecture.
*/
{
name = "sun4-SunOS-5.8_cc";
value = "";
},
{
name = "sun4-SunOS-5.8_cc_flags";
value = "-I/usr/local/include/libxml2";
},
{
name = "sun4-SunOS-5.8_ld_flags";
value = "-L/usr/local/lib";
},
{
name = "sun4-SunOS-5.8_libs";
value = "-liconv";
},
/*
* Define the following attribute if you want to override the
* c compiler for the linux 2.4 architecture.
*/
{
name = "i686-Linux-2.4_cc";
value = "";
},
{
name = "i686-Linux-2.4_cc_flags";
value = "-I/usr/local/include/libxml2";
},
{
name = "i686-Linux-2.4_ld_flags";
value = "-L/usr/local/lib%-Wl,-rpath,/usr/local/lib";
},
{
name = "i686-Linux-2.4_libs";
value = "";
},
/*
* Define the following attribute if you want to override the
* c compiler for the linux 2.6 architecture.
*/
{
name = "i686-Linux-2.6_cc";
value = "";
},
{
name = "i686-Linux-2.6_cc_flags";
value = "-I/usr/include/libxml2";
},
{
name = "i686-Linux-2.6_ld_flags";
value = "";
},
{
name = "i686-Linux-2.6_libs";
value = "";
},
/*
* Define the following attributes if you want to override the
* c compiler for the ppc-Darwin architecture.
*/
{
name = "ppc-Darwin-8.x_cc";
value = "";
},
{
name = "ppc-Darwin-8.x_cc_flags";
value = "";
},
{
name = "ppc-Darwin-8.x_ld_flags";
value = "-L/usr/local/lib%-lintl";
},
{
name = "ppc-Darwin-8.x_libs";
value = "-lintl";
},
/*
* Define the following attribute if you want to override the
* c compiler for the mips architecture.
*/
{
name = "mips-IRIX64-6.5_cc";
value = "";
},
{
name = "mips-IRIX64-6.5_cc_flags";
value = "-I/usr/local/include/libxml2";
},
{
name = "mips-IRIX64-6.5_ld_flags";
value = "-Wl,-L/usr/local/lib,-LD_MSG:woff=84:woff=127,-rpath,/usr/local/lib";
},
{
name = "mips-IRIX64-6.5_libs";
value = "-liconv";
},
/*
* Define the following attribute if you want to suggest which
* c compiler to use to configure.
*/
{
name = "cc";
value = "";
}
];
fhist-1.18/common/ac/ctype.h 644 0 0 3204 11265752627 15157 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_CTYPE_H
#define COMMON_AC_CTYPE_H
#include
#include
/*
* HAVE_ISWPRINT is only set if (a) there is a have_iswprint function,
* and (b) it works for ascii. It is assumed that if iswprint is absent
* or brain-dead, then so are the rest.
*
* This code copes with the case where (a) it exists, (b) it is broken,
* and (c) it is defined in , of all places!
*/
#ifndef HAVE_ISWPRINT
#ifdef iswprint
#undef iswprint
#endif
#ifdef iswspace
#undef iswspace
#endif
#ifdef iswpunct
#undef iswpunct
#endif
#ifdef iswupper
#undef iswupper
#endif
#ifdef iswlower
#undef iswlower
#endif
#ifdef iswdigit
#undef iswdigit
#endif
#ifdef iswalnum
#undef iswalnum
#endif
#ifdef towupper
#undef towupper
#endif
#ifdef towlower
#undef towlower
#endif
#endif /* !HAVE_ISWPRINT */
#endif /* COMMON_AC_CTYPE_H */
fhist-1.18/common/ac/dirent.h 644 0 0 2614 11265752627 15324 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1994, 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_DIRENT_H
#define COMMON_AC_DIRENT_H
#include
/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
#if defined(DIRENT) || defined(_POSIX_VERSION)
#include
#define NLENGTH(dirent) (strlen((dirent)->d_name))
#else /* not (DIRENT or _POSIX_VERSION) */
#define dirent direct
#define NLENGTH(dirent) ((dirent)->d_namlen)
#ifdef SYSNDIR
#include
#endif /* SYSNDIR */
#ifdef SYSDIR
#include
#endif /* SYSDIR */
#ifdef NDIR
#include
#endif /* NDIR */
#endif /* not (DIRENT or _POSIX_VERSION) */
#endif /* COMMON_AC_DIRENT_H */
fhist-1.18/common/ac/errno.h 644 0 0 1646 11265752627 15170 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_ERRNO_H
#define COMMON_AC_ERRNO_H
#include
#include
#endif /* COMMON_AC_ERRNO_H */
fhist-1.18/common/ac/grp.h 644 0 0 1730 11265752627 14625 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2002, 2004, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_GRP_H
#define COMMON_AC_GRP_H
/* MacOS X needs sys/types.h before grp.h */
#include
#include
#endif /* COMMON_AC_GRP_H */
fhist-1.18/common/ac/libintl.c 644 0 0 2472 11265752627 15471 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
/*
* NAME
* gettext
*
* DESCRIPTION
* The gettext function is used to translate messages into a
* language dictated by the LANG environment variable (et al). If
* the current operating system does not supply one, then pass the
* message through unchanged. (This is what gettext will do for
* error messages it does not have a translation for.)
*/
#ifndef HAVE_GETTEXT
char *
gettext(const char *s)
{
return (char *)s;
}
#endif /* !HAVE_GETTEXT */
fhist-1.18/common/ac/libintl.h 644 0 0 2366 11265752627 15500 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 1999, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_LIBINTL_H
#define COMMON_AC_LIBINTL_H
#include
/*
* if the libintl.h include file is available, include it
*/
#ifdef HAVE_LIBINTL_H
#include
#else
#ifdef HAVE_LIBGETTEXT_H
#include
#else
/*
* otherwise, provide a prototype and nothing else
*/
#include
char *gettext(const char *);
#endif /* !HAVE_LIBGETTEXT_H */
#endif /* !HAVE_LIBINTL_H */
#endif /* COMMON_AC_LIBINTL_H */
fhist-1.18/common/ac/limits.h 644 0 0 3672 11265752627 15345 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1994, 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_LIMITS_H
#define COMMON_AC_LIMITS_H
#include
#ifdef HAVE_LIMITS_H
#include
#else
/*
* fake a few of the values
* (the *_MIN things only work on 2s compliment machines,
* the *SHRT* things do not work on non-compliant compilers)
*/
#ifndef USHRT_MAX
#define USHRT_MAX ((unsigned short)~(unsigned)0)
#endif
#ifndef SHRT_MAX
#define SHRT_MAX ((short)(USHRT_MAX >> 1))
#endif
#ifndef SHRT_MIN
#define SHRT_MIN ((short)(~(unsigned short)SHRT_MAX))
#endif
#ifndef UINT_MAX
#define UINT_MAX (~(unsigned)0)
#endif
#ifndef INT_MAX
#define INT_MAX ((int)(UINT_MAX >> 1))
#endif
#ifndef INT_MIN
#define INT_MIN ((int)(~(unsigned)INT_MAX))
#endif
#ifndef ULONG_MAX
#define ULONG_MAX (~(unsigned long)0)
#endif
#ifndef LONG_MAX
#define LONG_MAX ((long)(ULONG_MAX >> 1))
#endif
#ifndef LONG_MIN
#define LONG_MIN ((long)(~(unsigned long)LONG_MAX))
#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 1
#endif
#ifndef UCHAR_MAX
#define UCHAR_MAX 255
#endif
#endif /* !HAVE_LIMITS_H */
#endif /* COMMON_AC_LIMITS_H */
fhist-1.18/common/ac/locale.h 644 0 0 1707 11265752627 15300 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_LOCALE_H
#define COMMON_AC_LOCALE_H
#include
#ifdef HAVE_LOCALE_H
#include
#endif
#endif /* COMMON_AC_LOCALE_H */
fhist-1.18/common/ac/pwd.h 644 0 0 1652 11265752627 14632 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2002, 2004, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_PWD_H
#define COMMON_AC_PWD_H
#include
#include
#endif /* COMMON_AC_PWD_H */
fhist-1.18/common/ac/signal.h 644 0 0 1652 11265752627 15315 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1999, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_SIGNAL_H
#define COMMON_AC_SIGNAL_H
#include
#include
#endif /* COMMON_AC_SIGNAL_H */
fhist-1.18/common/ac/stdarg.h 644 0 0 1673 11265752627 15327 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1992-1994, 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_STDARG_H
#define COMMON_AC_STDARG_H
#include
#include
#endif /* COMMON_AC_STDARG_H */
fhist-1.18/common/ac/stddef.h 644 0 0 2061 11265752627 15304 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1994, 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_STDDEF_H
#define COMMON_AC_STDDEF_H
#include
#ifdef HAVE_STDDEF_H
#include
#endif
#ifndef offsetof
#define offsetof(a, b) ((size_t)((char *)&((a *)0)->b - (char *)0))
#endif
#endif /* COMMON_AC_STDDEF_H */
fhist-1.18/common/ac/stdio.h 644 0 0 2453 11265752627 15162 0 ustar Peter Miller 0 0 /*
* cook - file construction tool
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_STDIO_H
#define COMMON_AC_STDIO_H
/*
* Need to define _POSIX_SOURCE on Linux, in order to get the fdopen,
* fileno, popen and pclose function prototypes.
*/
#ifdef __linux__
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE 1
#endif
#endif
#include
/*
* Ancient pre-ANSI-C systems (e.g. SunOS 4.1.2) fail to define this.
*/
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
#include
#ifndef HAVE_CUSERID
#include
char *cuserid(char *);
#endif
#endif /* COMMON_AC_STDIO_H */
fhist-1.18/common/ac/stdlib.h 644 0 0 3104 11265752627 15313 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1994, 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_STDLIB_H
#define COMMON_AC_STDLIB_H
#include
#ifdef HAVE_STDLIB_H
#include
#else
#ifndef _WCHAR_T
#ifndef _T_WCHAR_
#ifndef _T_WCHAR
#ifndef __WCHAR_T
#ifndef _WCHAR_T_
#ifndef _WCHAR_T_H
#ifndef ___int_wchar_t_h
#ifndef __INT_WCHAR_T_H
#ifndef _GCC_WCHAR_T
#define _WCHAR_T
#define _T_WCHAR_
#define _T_WCHAR
#define __WCHAR_T
#define _WCHAR_T_
#define _WCHAR_T_H
#define ___int_wchar_t_h
#define __INT_WCHAR_T_H
#define _GCC_WCHAR_T
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ int
#endif
typedef __WCHAR_TYPE__ wchar_t;
typedef int wchar_t;
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 1
#endif
#ifndef MB_CUR_MAX
#define MB_CUR_MAX 1
#endif
#endif
#endif /* COMMON_AC_STDLIB_H */
fhist-1.18/common/ac/string.c 644 0 0 11344 11265752627 15360 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1993, 1994, 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* This file contains functions for use with non-ANSI conforming systems
* to implement absent ANSI functionality.
*/
#include
#include
#include
#include
#include
/*
* NAME
* strerror - string for error number
*
* SYNOPSIS
* char *strerror(int errnum);
*
* DESCRIPTION
* The strerror function maps the error number in errnum to an error
* message string.
*
* RETURNS
* The strerror function returns a pointer to the string, the contents of
* which are implementation-defined. The array pointed to shall not be
* modified by the program, but may be overwritten by a subsequent call to
* the strerror function.
*
* CAVEAT
* Unknown errors will be rendered in the form "Error %d", where %d will
* be replaced by a decimal representation of the error number.
*/
#ifndef HAVE_STRERROR
char *
strerror(int n)
{
extern int sys_nerr;
extern char *sys_errlist[];
static char buffer[30];
if (n < 1 || n > sys_nerr)
{
sprintf(buffer, "Error %d", n);
return buffer;
}
return sys_errlist[n];
}
#endif /* !HAVE_STRERROR */
#ifndef HAVE_STRCASECMP
int
strcasecmp(const char *s1, const char *s2)
{
int c1;
int c2;
for (;;)
{
c1 = *s1++;
if (islower(c1))
c1 = toupper(c1);
c2 = *s2++;
if (islower(c2))
c2 = toupper(c2);
if (c1 != c2)
{
/*
* if s1 is a leading substring of s2, must
* return -1, even if the next character of s2
* is negative.
*/
if (!c1)
return -1;
if (c1 < c2)
return -1;
return 1;
}
if (!c1)
return 0;
}
}
#endif /* !HAVE_STRCASECMP */
#ifndef HAVE_STRSIGNAL
char *
strsignal(int n)
{
static char buffer[16];
switch (n)
{
#ifdef SIGHUP
case SIGHUP:
return "hang up [SIGHUP]";
#endif /* SIGHUP */
#ifdef SIGINT
case SIGINT:
return "user interrupt [SIGINT]";
#endif /* SIGINT */
#ifdef SIGQUIT
case SIGQUIT:
return "user quit [SIGQUIT]";
#endif /* SIGQUIT */
#ifdef SIGILL
case SIGILL:
return "illegal instruction [SIGILL]";
#endif /* SIGILL */
#ifdef SIGTRAP
case SIGTRAP:
return "trace trap [SIGTRAP]";
#endif /* SIGTRAP */
#ifdef SIGIOT
case SIGIOT:
return "abort [SIGIOT]";
#endif /* SIGIOT */
#ifdef SIGEMT
case SIGEMT:
return "EMT instruction [SIGEMT]";
#endif /* SIGEMT */
#ifdef SIGFPE
case SIGFPE:
return "floating point exception [SIGFPE]";
#endif /* SIGFPE */
#ifdef SIGKILL
case SIGKILL:
return "kill [SIGKILL]";
#endif /* SIGKILL */
#ifdef SIGBUS
case SIGBUS:
return "bus error [SIGBUS]";
#endif /* SIGBUS */
#ifdef SIGSEGV
case SIGSEGV:
return "segmentation violation [SIGSEGV]";
#endif /* SIGSEGV */
#ifdef SIGSYS
case SIGSYS:
return "bad argument to system call [SIGSYS]";
#endif /* SIGSYS */
#ifdef SIGPIPE
case SIGPIPE:
return "write on a pipe with no one to read it [SIGPIPE]";
#endif /* SIGPIPE */
#ifdef SIGALRM
case SIGALRM:
return "alarm clock [SIGALRM]";
#endif /* SIGALRM */
#ifdef SIGTERM
case SIGTERM:
return "software termination [SIGTERM]";
#endif /* SIGTERM */
#ifdef SIGUSR1
case SIGUSR1:
return "user defined signal one [SIGUSR1]";
#endif /* SIGUSR1 */
#ifdef SIGUSR2
case SIGUSR2:
return "user defined signal two [SIGUSR2]";
#endif /* SIGUSR2 */
#ifdef SIGCLD
case SIGCLD:
return "death of child [SIGCLD]";
#endif /* SIGCLD */
#ifdef SIGPWR
case SIGPWR:
return "power failure [SIGPWR]";
#endif /* SIGPWR */
default:
sprintf(buffer, "signal %d", n);
return buffer;
}
}
#endif /* !HAVE_STRSIGNAL */
fhist-1.18/common/ac/string.h 644 0 0 3464 11265752627 15351 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1994, 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_STRING_H
#define COMMON_AC_STRING_H
#include
/*
* We could have used __USE_BSD, but that defines prototypes for the
* index, rindex, bcmp, bzero and bcopy functions, and we don't want
* them. This prototype does not conflict, however.
*/
#if !defined(HAVE_STRCASECMP) || defined(__linux__)
# if __STDC__ >= 1
# ifdef __USE_BSD
# undef __USE_BSD
# endif
int strcasecmp(const char *, const char *);
# endif
#endif
/*
* We could have used __USE_GNU, but that defines prototypes for
* too many other things. This prototype does not conflict, however.
*/
#if !defined(HAVE_STRSIGNAL) || defined(__linux__)
# if __STDC__ >= 1
char *strsignal(int);
# endif
#endif
#if STDC_HEADERS || HAVE_STRING_H
# include
/* An ANSI string.h and pre-ANSI memory.h might conflict. */
# if !STDC_HEADERS && HAVE_MEMORY_H
# include
# endif
#else
/* memory.h and strings.h conflict on some systems. */
# include
#endif
#endif /* COMMON_AC_STRING_H */
fhist-1.18/common/ac/sys/stat.h 644 0 0 1727 11265752627 15634 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2004, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_SYS_STAT_H
#define COMMON_AC_SYS_STAT_H
#include
#ifdef HAVE_SYS_STAT_H
#include
#endif
#endif /* COMMON_AC_SYS_STAT_H */
fhist-1.18/common/ac/sys/types.h 644 0 0 1726 11265752627 16024 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2004, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_SYS_TYPES_H
#define COMMON_AC_SYS_TYPES_H
#include
#ifdef HAVE_SYS_TYPES_H
#include
#endif
#endif /* COMMON_AC_SYS_TYPES_H */
fhist-1.18/common/ac/termios.h 644 0 0 2125 11265752627 15516 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_TERMIOS_H
#define COMMON_AC_TERMIOS_H
#include
#ifdef HAVE_winsize_SYS_IOCTL_H
#include
#else
#ifdef HAVE_winsize_TERMIOS_H
#include
#endif /* HAVE_winsize_TERMIOS_H */
#endif /* !HAVE_winsize_SYS_IOCTL_H */
#endif /* COMMON_AC_TERMIOS_H */
fhist-1.18/common/ac/time.h 644 0 0 2360 11265752627 14773 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1994, 1998, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_TIME_H
#define COMMON_AC_TIME_H
#include
/*
* Catch-22: Dec Alpha OSF/1: need to include time.h before sys/time.h
* before time.h
*/
#ifdef __alpha__
#ifndef _CLOCK_ID_T
#define _CLOCK_ID_T
typedef int clockid_t;
#endif
#endif
#ifdef TIME_WITH_SYS_TIME
#include
#include
#else
#ifdef HAVE_SYS_TIME_H
#include
#else
#include
#endif
#endif
#endif /* COMMON_AC_TIME_H */
fhist-1.18/common/ac/unistd.c 644 0 0 2201 11265752627 15330 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#ifndef HAVE_RENAME
/*
* Routine to rename files using link and unlink.
* Returns -1 on failure.
*/
int
rename(char *oldname, char *newname)
{
if (link(oldname, newname) < 0)
return -1;
if (unlink(oldname) < 0)
{
unlink(newname);
return -1;
}
return 0;
}
#endif
fhist-1.18/common/ac/unistd.h 644 0 0 2436 11265752627 15347 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1994, 1998, 2004, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_UNISTD_H
#define COMMON_AC_UNISTD_H
#include
/*
* Need to define _BSD_SOURCE on Linux to get prototypes for the symlink
* and readlink functions.
*/
#ifdef __linux__
#ifndef _BSD_SOURCE
#define _BSD_SOURCE 1
#endif
#ifndef __USE_BSD
#define __USE_BSD 1
#endif
#endif
#ifdef HAVE_UNISTD_H
#include
#include
#endif
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
#ifndef F_OK
#define F_OK 0
#endif
#endif /* COMMON_AC_UNISTD_H */
fhist-1.18/common/ac/wchar.c 644 0 0 2007 11265752627 15132 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#ifndef HAVE_WCSLEN
size_t
wcslen(const wchar_t *wcs)
{
const wchar_t *start;
start = wcs;
while (*wcs)
++wcs;
return (wcs - start);
}
#endif /* !HAVE_WCSLEN */
fhist-1.18/common/ac/wchar.h 644 0 0 5127 11265752627 15145 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2001, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_WCHAR_H
#define COMMON_AC_WCHAR_H
#include
/*
* From the ``believe it or not'' category: The Dec Alpha OSF/1
* includes , but we need to make sure own own
* is invoked first.
*/
#ifdef __alpha___
#include
#endif
#ifdef HAVE_WCHAR_H
#include
#else
#include
#include
typedef int mbstate_t;
#ifndef WEOF
#define WEOF (wchar_t)(-1);
#endif
int mbsinit(const mbstate_t *);
size_t wcslen(const wchar_t *);
size_t mbrlen(const char *, size_t, mbstate_t *);
size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
size_t wcrtomb(char *, wchar_t, mbstate_t *);
size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
#endif
/*
* HAVE_ISWPRINT is only set if (a) there is a have_iswprint function,
* and (b) it works for ascii. It is assumed that if iswprint is absent
* or brain-dead, then so are the rest.
*
* This code copes with the case where (a) it exists, (b) it is broken,
* and (c) it is defined in , of all places!
*/
#ifndef HAVE_ISWPRINT
#ifdef iswprint
#undef iswprint
#endif
#ifdef iswspace
#undef iswspace
#endif
#ifdef iswpunct
#undef iswpunct
#endif
#ifdef iswupper
#undef iswupper
#endif
#ifdef iswlower
#undef iswlower
#endif
#ifdef iswdigit
#undef iswdigit
#endif
#ifdef iswalnum
#undef iswalnum
#endif
#ifdef towupper
#undef towupper
#endif
#ifdef towlower
#undef towlower
#endif
#endif /* !HAVE_ISWPRINT */
/*
* The ANSI C standard states that wint_t symbol shall be defined by
* and . The GNU people also define it in ,
* but this is incorrect.
*/
#ifndef HAVE_WINT_T
#define HAVE_WINT_T
typedef wchar_t wint_t;
#endif
#endif /* COMMON_AC_WCHAR_H */
fhist-1.18/common/ac/wctype.c 644 0 0 7023 11265752627 15344 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* The use of the long variable is to cope with the possibility of an
* unusual data type having been defined for wchar_t. Unusual types
* have been observed, and often cause unnecessary warnings from
* compilers. The long takes care of it.
*
* Also, the HAVE_ISWPRINT can be false (e.g. on Solaris) but iswprint
* is still available as a macro. Hence, we need to test for the macro
* as well as the function.
*/
#include
#include
#include
#ifndef HAVE_ISWPRINT
#ifndef iswprint
int
iswprint(wint_t wc)
{
long c;
/*
* Assume characters over 256 are printable. Assume characters
* under 256 are either ASCII or Latin-1. These are dumb
* assumptions, but real i18n support will provide a real
* iswprint function.
*/
c = wc;
return (c > UCHAR_MAX || (c >= 0 && isprint((unsigned char)c)));
}
#endif
#ifndef iswspace
int
iswspace(wint_t wc)
{
long c;
/*
* Assume characters over 256 are letters. Assume characters
* under 256 are either ASCII or Latin-1. These are dumb
* assumptions, but real i18n support will provide a real
* iswspace function.
*/
c = wc;
return (c >= 0 && c <= UCHAR_MAX && isspace((unsigned char)c));
}
#endif
#ifndef iswpunct
int
iswpunct(wint_t wc)
{
long c;
/*
* Assume characters over 256 are letters. Assume characters
* under 256 are either ASCII or Latin-1. These are dumb
* assumptions, but real i18n support will provide a real
* iswpunct function.
*/
c = wc;
return (c >= 0 && c <= UCHAR_MAX && ispunct((unsigned char)c));
}
#endif
#ifndef iswupper
int
iswupper(wint_t wc)
{
long c;
c = wc;
return (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char)c));
}
#endif
#ifndef iswlower
int
iswlower(wint_t wc)
{
long c;
c = wc;
return (c >= 0 && c <= UCHAR_MAX && islower((unsigned char)c));
}
#endif
#ifndef iswdigit
int
iswdigit(wint_t wc)
{
long c;
c = wc;
return (c >= 0 && c <= UCHAR_MAX && isdigit((unsigned char)c));
}
#endif
#ifndef iswalnum
int
iswalnum(wint_t wc)
{
long c;
c = wc;
return (c >= 0 && c <= UCHAR_MAX && isalnum((unsigned char)c));
}
#endif
#ifndef towupper
wint_t
towupper(wint_t wc)
{
long c;
c = wc;
if (c >= 0 && c <= UCHAR_MAX && islower((unsigned char)c))
return toupper((unsigned char)c);
return c;
}
#endif
#ifndef towlower
wint_t
towlower(wint_t wc)
{
long c;
c = wc;
if (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char)c))
return tolower((unsigned char)c);
return c;
}
#endif
#endif /* !HAVE_ISWPRINT */
fhist-1.18/common/ac/wctype.h 644 0 0 5153 11265752627 15353 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 1999, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_AC_WCTYPE_H
#define COMMON_AC_WCTYPE_H
/*
* Often needed, if is implemented in terms of .
* Not strictly ANSI C standard conforming.
*/
#include
/*
* Often needed, particularly to implement the dummy functions if real
* ones aren't present. Not strictly ANSI C standard conforming.
*/
#include
/* Solaris bug 1250837: include wchar.h before widec.h */
#ifdef HAVE_WCHAR_H
#include
#endif
/*
* Silicon Graphics
*/
#ifdef HAVE_WIDEC_H
#include
#endif
#ifdef HAVE_WCTYPE_H
#include
#endif
/*
* The ANSI C standard states that wint_t symbol shall be defined by
* and . The GNU people also define it in ,
* but this is incorrect.
*/
#ifndef HAVE_WINT_T
#define HAVE_WINT_T
typedef wchar_t wint_t;
#endif
#ifndef HAVE_WCTYPE_H
#include
int iswalnum(wint_t);
int iswdigit(wint_t);
int iswlower(wint_t);
int iswprint(wint_t);
int iswpunct(wint_t);
int iswspace(wint_t);
int iswupper(wint_t);
wint_t towlower(wint_t);
wint_t towupper(wint_t);
#endif
/*
* HAVE_ISWPRINT is only set if (a) there is a have_iswprint function,
* and (b) it works for ascii. It is assumed that if iswprint is absent
* or brain-dead, then so are the rest.
*
* This code copes with the case where (a) it exists, (b) it is broken,
* and (c) it is defined in
*/
#ifndef HAVE_ISWPRINT
#ifdef iswprint
#undef iswprint
#endif
#ifdef iswspace
#undef iswspace
#endif
#ifdef iswpunct
#undef iswpunct
#endif
#ifdef iswupper
#undef iswupper
#endif
#ifdef iswlower
#undef iswlower
#endif
#ifdef iswdigit
#undef iswdigit
#endif
#ifdef iswalnum
#undef iswalnum
#endif
#ifdef towupper
#undef towupper
#endif
#ifdef towlower
#undef towlower
#endif
#endif /* !HAVE_ISWPRINT */
#endif /* COMMON_AC_WCTYPE_H */
fhist-1.18/common/arglex.c 644 0 0 23415 11265752627 14753 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998, 2000-2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static arglex_table_ty table[] =
{
{ "-", arglex_token_stdio, },
{ "-Help", arglex_token_help, },
{ "-VERSion", arglex_token_version, },
{ 0, 0, }, /* end marker */
};
static int argc;
static char **argv;
arglex_value_ty arglex_value;
arglex_token_ty arglex_token;
static arglex_table_ty *utable;
static const char *partial;
void
arglex_init(int ac, char **av, arglex_table_ty *tp)
{
progname_set(av[0]);
language_init();
argc = ac - 1;
argv = av + 1;
utable = tp;
}
int
arglex_compare(const char *formal, const char *actual)
{
char fc;
char ac;
int result;
for (;;)
{
ac = *actual++;
if (isupper((unsigned char)ac))
ac = tolower((unsigned char)ac);
fc = *formal++;
switch (fc)
{
case 0:
result = !ac;
goto ret;
case '_':
if (ac == '-')
break;
/* fall through... */
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z':
/*
* optional characters
*/
if (ac == fc && arglex_compare(formal, actual))
{
result = 1;
goto ret;
}
/*
* skip forward to next
* mandatory character, or after '_'
*/
while (islower((unsigned char)*formal))
++formal;
if (*formal == '_')
{
++formal;
if (ac == '_' || ac == '-')
++actual;
}
--actual;
break;
case '*':
/*
* This is a hack, it should really
* check for a match match the stuff after
* the '*', too, a la glob.
*/
if (!ac)
{
result = 0;
goto ret;
}
partial = actual - 1;
result = 1;
goto ret;
case '\\':
if (actual[-1] != *formal++)
{
result = 0;
goto ret;
}
break;
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
fc = tolower((unsigned char)fc);
/* fall through... */
default:
/*
* mandatory characters
*/
if (fc != ac)
{
result = 0;
goto ret;
}
break;
}
}
ret:
return result;
}
static int
is_a_number(const char *s)
{
long n;
int sign;
n = 0;
switch (*s)
{
default:
sign = 1;
break;
case '+':
s++;
sign = 1;
break;
case '-':
s++;
sign = -1;
break;
}
switch (*s)
{
case '0':
if ((s[1] == 'x' || s[1] == 'X') && s[2])
{
s += 2;
for (;;)
{
switch (*s)
{
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9':
n = n * 16 + *s++ - '0';
continue;
case 'A': case 'B': case 'C':
case 'D': case 'E': case 'F':
n = n * 16 + *s++ - 'A' + 10;
continue;
case 'a': case 'b': case 'c':
case 'd': case 'e': case 'f':
n = n * 16 + *s++ - 'a' + 10;
continue;
}
break;
}
}
else
{
for (;;)
{
switch (*s)
{
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
n = n * 8 + *s++ - '0';
continue;
}
break;
}
}
break;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
for (;;)
{
switch (*s)
{
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9':
n = n * 10 + *s++ - '0';
continue;
}
break;
}
break;
default:
return 0;
}
if (*s)
return 0;
arglex_value.alv_number = n * sign;
return 1;
}
arglex_token_ty
arglex(void)
{
arglex_table_ty *tp;
int j;
arglex_table_ty *hit[20];
int nhit;
static char *pushback;
char *arg;
if (pushback)
{
/*
* the second half of a "-foo=bar" style argument.
*/
arg = pushback;
pushback = 0;
}
else
{
if (argc <= 0)
{
arglex_token = arglex_token_eoln;
arg = "";
goto ret;
}
arg = argv[0];
argc--;
argv++;
/*
* See if it looks like a GNU "-foo=bar" option.
* Split it at the '=' to make it something the
* rest of the code understands.
*/
if (arg[0] == '-' && arg[1] != '=')
{
char *eqp;
eqp = strchr(arg, '=');
if (eqp)
{
pushback = eqp + 1;
*eqp = 0;
}
}
/*
* Turn the GNU-style leading "--"
* into "-" if necessary.
*/
if
(
arg[0] == '-'
&&
arg[1] == '-'
&&
arg[2]
&&
!is_a_number(arg + 1)
)
++arg;
}
if (is_a_number(arg))
{
arglex_token = arglex_token_number;
goto ret;
}
nhit = 0;
partial = 0;
for (tp = table; tp->name; tp++)
{
if (arglex_compare(tp->name, arg))
hit[nhit++] = tp;
}
if (utable)
{
for (tp = utable; tp->name; tp++)
{
if (arglex_compare(tp->name, arg))
hit[nhit++] = tp;
}
}
switch (nhit)
{
case 0:
/*
* not found in the table
*/
if (arg[0] == '-')
arglex_token = arglex_token_option;
else
arglex_token = arglex_token_string;
break;
case 1:
if (partial)
arg = (char *)partial;
else
arg = hit[0]->name;
arglex_token = hit[0]->token;
break;
default:
{
size_t len;
char *buf;
sub_context_ty *scp;
len = strlen(hit[0]->name + 1);
for (j = 1; j < nhit; ++j)
len += strlen(hit[j]->name) + 2;
buf = r_alloc_and_check(len);
strcpy(buf, hit[0]->name);
for (j = 1; j < nhit; ++j)
{
strcat(buf, ", ");
strcat(buf, hit[j]->name);
}
scp = sub_context_new();
sub_var_set_charstar(scp, "Name", arg);
sub_var_set_charstar(scp, "Guess", buf);
fatal_intl(scp, i18n("option \"$name\" ambiguous ($guess)"));
/* NOTREACHED */
}
}
ret:
arglex_value.alv_string = arg;
return arglex_token;
}
char *
arglex_token_name(arglex_token_ty n)
{
arglex_table_ty *tp;
switch (n)
{
case arglex_token_eoln:
return "end of command line";
case arglex_token_number:
return "number";
case arglex_token_option:
return "option";
case arglex_token_stdio:
return "standard input or output";
case arglex_token_string:
return "string";
default:
break;
}
for (tp = table; tp < ENDOF(table); tp++)
{
if (tp->token == n)
return tp->name;
}
if (utable)
{
for (tp = utable; tp->name; tp++)
{
if (tp->token == n)
return tp->name;
}
}
return "unknown command line token";
}
fhist-1.18/common/arglex.h 644 0 0 3267 11265752627 14743 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998, 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef ARGLEX_H
#define ARGLEX_H
#include
enum arglex_token_ty
{
arglex_token_eoln = -20,
arglex_token_help,
arglex_token_number,
arglex_token_option,
arglex_token_stdio,
arglex_token_string,
arglex_token_version
};
typedef enum arglex_token_ty arglex_token_ty;
typedef struct arglex_table_ty arglex_table_ty;
struct arglex_table_ty
{
char *name;
arglex_token_ty token;
};
typedef struct arglex_value_ty arglex_value_ty;
struct arglex_value_ty
{
char *alv_string;
long alv_number;
};
extern arglex_token_ty arglex_token;
extern arglex_value_ty arglex_value;
void arglex_init(int, char **, arglex_table_ty *);
arglex_token_ty arglex(void);
int arglex_compare(const char *formal, const char *actual);
char *arglex_token_name(arglex_token_ty);
#endif /* ARGLEX_H */
fhist-1.18/common/attrib_forma.h 644 0 0 2524 11265752627 16125 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_ATTRIB_FORMA_H
#define COMMON_ATTRIB_FORMA_H
#ifdef __GNCU__
#define ATTRIBUTE_FORMAT_1_2 __attribute__ ((__format__ (__printf__, 1, 2)))
#define ATTRIBUTE_FORMAT_2_3 __attribute__ ((__format__ (__printf__, 2, 3)))
#define ATTRIBUTE_FORMAT_3_4 __attribute__ ((__format__ (__printf__, 3, 4)))
#define ATTRIBUTE_FORMAT_4_5 __attribute__ ((__format__ (__printf__, 4, 5)))
#else
#define ATTRIBUTE_FORMAT_1_2
#define ATTRIBUTE_FORMAT_2_3
#define ATTRIBUTE_FORMAT_3_4
#define ATTRIBUTE_FORMAT_4_5
#endif
#endif /* COMMON_ATTRIB_FORMA_H */
fhist-1.18/common/cmalloc.c 644 0 0 15117 11265752627 15103 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998, 2000-2002, 2008 Peter Miller
*
* Derived from a work
* Copyright (C) 1990 David I. Bell.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* Malloc interludes which allow for releasing of all used memory blocks.
* Just call cm_reset whenever you want to free all allocated memory.
* This is convenient when reinitializing a program which allocates memory.
*
* Note: You must make sure that old stale pointers are not referenced,
* such as static pointers which were 0 when the program started but
* won't be later. In other words, to be safe you should not assume any
* variables have been initialized, even for zero values.
*/
#include
#include
#include
#include
#include
#undef malloc
#undef realloc
#undef free
#undef calloc
#define MAGIC 54928347L
/*
* This is to protect DOS.
* On a 16-bit machine, this will be 65535,
* exactly right for small-memory-model doc programs.
*
* but on a 32-bit machine, like most unixes,
* this is essentially infinity.
*/
#define BIG ((unsigned int)-1)
typedef struct chunk CHUNK;
struct chunk
{
CHUNK *next; /* next chunk in chain */
CHUNK *prev; /* previous chunk in chain */
long magic; /* magic value */
double data[1]; /* data storage (varying size) */
};
#define CHUNKSIZE(size) (sizeof(CHUNK) + (size) - sizeof(double))
#define DPTOCP(dp) \
((CHUNK *)(void*)(((char *)(dp)) - offsetof(CHUNK, data[0])))
static CHUNK head = {&head, &head};
/*
* Actual calls to malloc, realloc, calloc, and free.
* Users must be sure not to intermix these calls with the ones above.
*/
void *
r_alloc(size_t size)
{
void *result;
if (size > BIG)
{
errno = EINVAL;
return 0;
}
errno = 0;
result = malloc((unsigned int) size);
if (!result && !errno)
errno = ENOMEM;
return result;
}
void *
r_realloc(void *dp, size_t size)
{
void *result;
if (size > BIG)
{
errno = EINVAL;
return 0;
}
errno = 0;
result = realloc(dp, (unsigned int) size);
if (!result && !errno)
errno = ENOMEM;
return result;
}
void *
r_realloc_and_check(void *a, size_t b)
{
void *result;
result = r_realloc(a, b);
if (!result)
nfatal_raw("realloc(%lu)", (unsigned long)b);
return result;
}
void
r_free(void *dp)
{
free(dp);
}
void *
r_alloc_and_check(size_t n)
{
void *result;
result = r_alloc(n);
if (!result)
nfatal_raw("malloc(%lu)", (unsigned long)n);
return result;
}
/*
* Allocate some memory.
*/
void *
cm_alloc(size_t size)
{
CHUNK *cp;
if (size > BIG)
{
errno = EINVAL;
return 0;
}
cp = (CHUNK *)r_alloc((size_t)CHUNKSIZE(size));
if (!cp)
return 0;
cp->magic = MAGIC;
cp->next = head.next;
cp->next->prev = cp;
cp->prev = &head;
head.next = cp;
return (void *)cp->data;
}
void *
cm_alloc_and_check(size_t n)
{
void *result;
result = cm_alloc(n);
if (!result)
nfatal_raw("malloc(%lu)", (unsigned long)n);
return result;
}
/*
* Reallocate memory.
*/
void *
cm_realloc(void *dp, size_t size)
{
CHUNK *cp;
if (!dp || size > BIG)
{
errno = EINVAL;
return 0;
}
cp = DPTOCP(dp);
if (cp->magic != MAGIC)
{
error_raw
(
"%s: %d: bad realloc %08lX (bug)",
__FILE__,
__LINE__,
(unsigned long)dp
);
errno = EINVAL;
return 0;
}
cp = (CHUNK *)r_realloc(cp, (size_t)CHUNKSIZE(size));
if (!cp)
return 0;
cp->next->prev = cp;
cp->prev->next = cp;
return (void *)cp->data;
}
void *
cm_realloc_and_check(void *a, size_t b)
{
void *result;
result = cm_realloc(a, b);
if (!result)
nfatal_raw("malloc(%lu)", (unsigned long)b);
return result;
}
/*
* Allocate zeroed memory.
*/
void *
cm_calloc(size_t nelem, size_t elsize)
{
size_t totalsize;
CHUNK *cp;
if (nelem > BIG || elsize > BIG)
{
errno = EINVAL;
return 0;
}
totalsize = CHUNKSIZE(nelem * elsize);
if (totalsize > BIG)
{
errno = EINVAL;
return 0;
}
cp = (CHUNK *)r_alloc(totalsize);
if (!cp)
return 0;
cp->magic = MAGIC;
cp->next = head.next;
cp->next->prev = cp;
cp->prev = &head;
head.next = cp;
return (void *)cp->data;
}
void *
cm_calloc_and_check(size_t a, size_t b)
{
void *result;
result = cm_calloc(a, b);
if (!result)
nfatal_raw("malloc(%lu)", (unsigned long)b);
return result;
}
/*
* Free memory.
*/
void
cm_free(void *dp)
{
CHUNK *cp;
if (!dp)
return;
cp = DPTOCP(dp);
if (cp->magic != MAGIC)
{
error_raw
(
"%s: %d: bad free %08lX (bug)",
__FILE__,
__LINE__,
(unsigned long)dp
);
return;
}
cp->prev->next = cp->next;
cp->next->prev = cp->prev;
cp->next = 0;
cp->prev = 0;
cp->magic = 0;
r_free(cp);
}
/*
* Reset the whole memory arena.
* This frees all memory allocated since the last cm_reset call.
*/
void
cm_reset(void)
{
CHUNK *cp;
while (head.next != &head)
{
cp = head.next;
if (cp->magic != MAGIC)
{
error_raw
(
"%s: %d: bad cm_reset %08lX (bug)",
__FILE__,
__LINE__,
(unsigned long)cp
);
break;
}
head.next = cp->next;
cp->next = 0;
cp->prev = 0;
cp->magic = 0;
r_free(cp);
}
head.next = &head;
head.prev = &head;
}
fhist-1.18/common/cmalloc.h 644 0 0 3731 11265752627 15067 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1995, 1998, 2002, 2008 Peter Miller
*
* Derived from a work
* Copyright (C) 1990 David I. Bell.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* Definitions to use releaseable memory allocation.
*/
#ifndef CMALLOC_H
#define CMALLOC_H
#include
#include
/*
* prevent use of libc functions
*/
#undef malloc
#define malloc(n) !/!/!cmalloc((unsigned long) (n))
#undef realloc
#define realloc(p,n) !/!/!cmrealloc((char *) (p), (unsigned long) (n))
#undef calloc
#define calloc(n,s) !/!/!cmcalloc((unsigned long) (n), (unsigned long) (s))
#undef free
#define free(p) !/!/!cmfree((char *) (p))
/*
* these functions can be released
* by using the cmreset function.
*/
void *cm_alloc(size_t);
void *cm_alloc_and_check(size_t);
void *cm_realloc(void *, size_t);
void *cm_realloc_and_check(void *, size_t);
void *cm_calloc(size_t, size_t);
void *cm_calloc_and_check(size_t, size_t);
void cm_free(void *);
void cm_reset(void);
/*
* these functions access the libc functions more-or-less directly
*/
void *r_alloc(size_t);
void *r_alloc_and_check(size_t);
void *r_realloc(void *, size_t);
void *r_realloc_and_check(void *, size_t);
void *r_calloc(size_t, size_t);
void r_free(void *);
#endif /* CMALLOC_H */
fhist-1.18/common/compare.c 644 0 0 110663 11265752627 15141 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1995, 1998-2002, 2008 Peter Miller
*
* Derived from a work
* Copyright (C) 1990 David I. Bell.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* This program is based on the algorithm in:
* An O(ND) Difference Algorithm and Its Variations
* Eugene W. Myers
* (TR 85-6, April 10, 1985)
* Department of Computer Science
* The University of Arizona
* Tuscon, Arizona 85721
*
* Also see:
* A File Comparison Program
* Webb Miller and Eugene W. Myers
* Software Practice and Experience
* (Volume 15, No. 11, November 1985)
*
* Actual implementation and features by David I. Bell.
* Enhancements and bug fixes by Peter Miller.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define SNAKEALLOCSIZE (size_t)500 /* chunk size for snake allocation */
#define CHARALLOCSIZE (size_t)10240 /* allocation size for file data */
#define UNIQUEALLOCSIZE (size_t)512 /* unique handling size for allocation */
#define LINEALLOCSIZE (size_t)2000 /* number of lines to allocate */
#define HASHSIZE 2003 /* size of hash table */
#define CHANGEBLABINTERVAL 100 /* how often to talk about changes */
#define READBLABINTERVAL 1000 /* how often to talk about reading */
#define SNAKEBLABINTERVAL 1000 /* how often to talk about snakes */
#define TABSIZE 8 /* tab size */
#define DETABALLOCSIZE (size_t)128 /* buffer allocation size for detab */
static size_t tablesize; /* needed table size */
static size_t snakecount; /* number of snake structures used */
static int availchars; /* number of available characters */
static char *nextchar; /* next allocable character storage */
static long *V1; /* the row containing the last d */
static long *V2; /* another row */
static SNAKE *nextsnake; /* next allocable snake structure */
static SNAKE *lastsnake; /* end of allocable snake structures */
static SNAKE *endsnake; /* last snake structure in list */
static LINE **hashtable; /* hash table for lines */
static modifyline_type modifyline;
FCOMP_DATA fc; /* externally referencable data */
/*
* NAME
* canonical
*
* SYNOPSIS
* char *canonical(char *s);
*
* DESCRIPTION
* The canonical function is used to apply the -Upcase and -Spaces
* options to produce a canonical line for comparison purposes.
*
* ARGUMENTS
* s - string to canonicalize
*
* RETURNS
* A pointer to the canonical line is returned. This will be valid
* until the next call to this function. If the canonical string
* would be the same as the input string, the input string is returned.
*/
static char *
canonical(char *s)
{
static size_t bufsiz;
static char *buf;
size_t len;
int changed;
int space;
char *cp1;
char *cp2;
/*
* if no modifiers are in effect,
* no alterations will be required
*/
if (!fc.upcaseflag && !fc.spaceflag)
return s;
/*
* make sure the buffer is large enough
*/
len = strlen(s) + 1;
if (len > bufsiz)
{
if (buf)
{
bufsiz = len;
buf = r_realloc_and_check(buf, bufsiz);
}
else
{
bufsiz = len;
buf = r_alloc_and_check(bufsiz);
}
}
/*
* simple upcase is easier to handle
*/
if (fc.upcaseflag)
{
changed = 0;
cp1 = s;
cp2 = buf;
while (*cp1)
{
if (islower((unsigned char)*cp1))
{
*cp2++ = toupper((unsigned char)*cp1);
changed = 1;
}
else
*cp2++ = *cp1;
++cp1;
}
if (!changed)
return s;
*cp2 = 0;
return buf;
}
/*
* spaces are rather harder to handle
*
* keep track of whether a run of spaces has been seen.
* replace this run of spaces with a single space
* provided it is not at either end of a line.
*/
cp1 = s;
cp2 = buf;
space = 0;
changed = 0;
while (*cp1)
{
int c;
c = (unsigned char)*cp1++;
if (fc.upcaseflag && islower(c))
{
c = toupper(c);
changed = 1;
}
if (c == '\n')
{
if (space)
changed = 1;
*cp2++ = c;
space = 0;
}
else if (isspace(c))
{
if (space || c != ' ')
changed = 1;
space = 1;
}
else
{
if (space)
{
if (cp2 != buf)
*cp2++ = ' ';
else
changed = 1;
}
*cp2++ = c;
space = 0;
}
}
if (!changed)
return s;
*cp2 = 0;
return buf;
}
/*
* Allocate a string of a certain size. This routine is used instead of
* simply calling malloc in order to reduce the overhead. The allocated
* strings cannot be freed or realloced.
*/
void *
allocstr(long len)
{
char *cp;
static unsigned alignment_mask;
if (!alignment_mask)
{
struct test
{
char a;
double b;
};
unsigned alignment;
alignment = offsetof(struct test, b);
/* make sure is a power of 2 */
while ((alignment & (~alignment + 1)) != alignment)
++alignment;
alignment_mask = alignment - 1;
}
/* round length to a multiple of alignment */
len = (len + alignment_mask) & ~alignment_mask;
if (len >= UNIQUEALLOCSIZE)
return cm_alloc_and_check(len);
cp = nextchar;
if (len > availchars)
{
cp = cm_alloc_and_check(CHARALLOCSIZE);
nextchar = cp;
availchars = CHARALLOCSIZE;
}
nextchar += len;
availchars -= len;
return cp;
}
/*
* Subroutine to allocate a line structure of the appropriate size and
* add it to the hash table. If it matches an already existing line, then
* the old structure will be returned.
*/
static LINE *
addline(char *cp)
{
LINE *lp; /* current line element */
char *curcp; /* current character of string */
LINE **hashentry; /* hash entry to use */
long hash; /* hash value */
long len; /* line length */
int ch; /* current char */
char *canon;
/*
* Compute line length and hash value.
* This has to take into account the space and uppercase flags.
*/
canon = canonical(cp);
hash = 0;
for (curcp = canon; *curcp; curcp++)
{
ch = *curcp;
hash += ((hash * 101) + ch);
if (hash < 0)
hash = (hash + 1) & INFINITY;
}
len = curcp - canon;
/*
* Search proper hash chain for already existing line.
* If the hash accidentally matches, modify it and try again.
*
* Search on the real data, not the canonical form,
* that way fcomp -w -s can report more natural looking results.
*/
again:
hashentry = &hashtable[hash % HASHSIZE];
for (lp = *hashentry; lp; lp = lp->l_next)
{
if (lp->l_hash != hash)
continue;
if (strcmp(cp, lp->l_data) == 0)
return lp;
if
(
(cp != canon || lp->l_canon != lp->l_data)
&&
strcmp(canon, lp->l_canon) == 0
)
continue;
hash = ((hash * 1234321) + 1) & INFINITY;
goto again;
}
/*
* Line not found, allocate a new one
*/
if (canon != cp)
{
lp = (LINE *)allocstr(LINE_SIZE(strlen(cp)));
strcpy(lp->l_data, cp);
lp->l_canon = allocstr(len + 1);
strcpy(lp->l_canon, canon);
}
else
{
lp = (LINE *)allocstr(LINE_SIZE(len));
strcpy(lp->l_data, cp);
lp->l_canon = lp->l_data;
}
lp->l_hash = hash;
lp->l_next = *hashentry;
*hashentry = lp;
return lp;
}
static int
is_blank_string(const char *s)
{
while (*s)
if (!isspace((unsigned char)*s))
return 0;
return 1;
}
/*
* Readfile - read in a file and remember the maximum number of lines it needs.
* This routine squeezes out blank lines if specified.
* The first specified number of lines is skipped first.
* Then the specified number of lines is modified.
*/
static void
readfile(FILEINFO *fi, long skip, long modify)
{
input_ty *fp; /* file pointer for file to read in */
LINE **lines; /* pointer to lines array */
long *lnums; /* line numbers within file */
char *cp; /* current line */
long linesavail; /* available number of lines */
long linecount; /* current number of lines */
long linenumber; /* current line number */
long linelen; /* length of line read */
fi->is_binary = 0;
if (fc.verbosity > VERBOSE_DEFAULT)
error_raw("[Reading \"%s\"]", fi->f_name);
fp = fi->f_file;
if (skip > 0)
input_skip_lines(fp, skip);
linecount = 0;
linenumber = 0;
linesavail = LINEALLOCSIZE;
lines = (LINE **)cm_alloc_and_check(sizeof(LINE *) * LINEALLOCSIZE);
lnums = (long *)cm_alloc_and_check(sizeof(long) * LINEALLOCSIZE);
for (;;)
{
cp = input_readline(fp, &linelen, 0, &fi->is_binary);
if (!cp)
break;
if (++linenumber <= modify && modifyline)
cp = modifyline(cp, &linelen, (struct INFO *)0);
if
(
(fc.verbosity > VERBOSE_DEFAULT)
&&
((linenumber % READBLABINTERVAL) == 0)
)
error_raw("[%ld lines]", linenumber);
if (fc.blankflag && is_blank_string(cp))
continue;
if (linecount >= linesavail)
{
linesavail += LINEALLOCSIZE;
lines =
(LINE **)
cm_realloc_and_check(lines, sizeof(LINE *) * linesavail);
lnums =
(long *)cm_realloc_and_check(lnums, sizeof(long) * linesavail);
}
lnums[linecount] = linenumber;
lines[linecount] = addline(cp);
linecount++;
}
fi->f_lnums = lnums;
fi->f_lines = lines;
fi->f_linecount = linecount;
fi->f_linestotal = linenumber;
if (linecount > fc.maxlines)
fc.maxlines = linecount;
input_delete(fp);
if (fc.verbosity > VERBOSE_DEFAULT)
{
if (linecount == linenumber)
error_raw("[Done, %ld lines]", linenumber);
else
{
error_raw
(
"[Done, %ld lines, %ld non-blanks]",
linenumber,
linecount
);
}
}
}
/*
* Allocate a new snake structure and append it to the snake list.
*/
static SNAKE *
allocsnake(void)
{
SNAKE *sp; /* snake being allocated */
sp = nextsnake;
if (sp >= lastsnake)
{
sp = (SNAKE *)cm_alloc_and_check(sizeof(SNAKE) * SNAKEALLOCSIZE);
nextsnake = sp;
lastsnake = sp + SNAKEALLOCSIZE;
}
nextsnake++;
sp->next = NULL;
if (!fc.snakelist)
fc.snakelist = sp;
else
endsnake->next = sp;
endsnake = sp;
if (fc.verbosity > VERBOSE_DEFAULT && !(++snakecount % SNAKEBLABINTERVAL))
error_raw("[%ld snake elements]", snakecount);
return sp;
}
/*
* Routine to find the middle snake of an optimial D-path spanning
* lines A to A+N in file A to lines B to B+N in file B. Returns the
* length D of the D-path as a return value, and the upper left and
* lower right relative coordinates of a snake midway through the D-path.
*/
static long
midsnake(int depth, long A, long N, long B, long M, long *ulx, long *uly,
long *lrx, long *lry)
{
long D;
long MAXD;
long DELTA;
long odd;
long x;
long y;
long k;
long changes;
long oldx;
LINE **lp1;
LINE **lp2;
if (fc.debugflag)
{
error_raw
(
"%*ssearching: %ld,%ld to %ld,%ld midsnake: ",
depth * 2,
"",
A,
B,
A + N,
B + M
);
}
DELTA = N - M;
odd = DELTA & 1;
MAXD = (M + N + 1) / 2;
V1[1] = 0;
V2[-1] = 0;
changes = -odd - 2;
/*
* This is the main loop for searching for the snake.
* D is the distance off the diagonals, and is the number
* of changes needed to get from the upper left to the
* lower right corner of the region.
*/
for (D = 0; D <= MAXD; D++)
{
changes += 2;
if (changes > fc.maxchanges)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_var_set_long(scp, "Number", fc.maxchanges);
fatal_intl(scp, i18n("More than $number changes required"));
/* NOTREACHED */
sub_context_delete(scp);
}
if
(
(fc.verbosity > VERBOSE_DEFAULT)
&&
(depth == 0)
&&
(changes > 1)
&&
((changes % CHANGEBLABINTERVAL) <= 1)
)
error_raw("[%ld changes]", changes - odd);
/*
* Examine all diagonals within current distance.
* First search from upper left to lower right,
* and then search from lower right to upper left.
*/
for (k = -D; k <= D; k += 2)
{
/*
* Find the end of the furthest forward D-path
* in diagonal k.
*/
if (k == -D || (k != D && (V1[k - 1] < V1[k + 1])))
x = V1[k + 1];
else
x = V1[k - 1] + 1;
y = x - k;
lp1 = &fc.fileA.f_lines[A + x];
lp2 = &fc.fileB.f_lines[B + y];
oldx = x;
while ((x < N) && (y < M) && ((*lp1)->l_hash == (*lp2)->l_hash))
{
x++;
y++;
lp1++;
lp2++;
}
V1[k] = x;
/*
* See if path overlaps furthest reverse D-path.
* If so, then we have found the snake.
*/
if (odd && (k >= (DELTA - (D - 1))) && (k <= (DELTA + (D - 1))))
{
if ((x + V2[k - DELTA]) >= N)
{
*ulx = oldx;
*uly = oldx - k;
*lrx = x;
*lry = y;
if (fc.debugflag)
{
error_raw
(
"%ld,%ld to %ld,%ld (odd)",
*ulx,
*uly,
*lrx,
*lry
);
}
return changes;
}
}
}
for (k = -D; k <= D; k += 2)
{
/*
* Find the end of the furthest reaching reverse
* path in diagonal k+DELTA.
*/
if (k == D || (k != -D && (V2[k + 1] < V2[k - 1])))
x = V2[k - 1];
else
x = V2[k + 1] + 1;
y = x + k;
lp1 = &fc.fileA.f_lines[A + N - x - 1];
lp2 = &fc.fileB.f_lines[B + M - y - 1];
oldx = x;
while ((x < N) && (y < M) && ((*lp1)->l_hash == (*lp2)->l_hash))
{
x++;
y++;
lp1--;
lp2--;
}
V2[k] = x;
/*
* See if path overlaps furthest forward D-path.
* If so, then we have found the snake.
*/
if (!odd && (k <= D - DELTA) && (k >= -D - DELTA))
{
if ((x + V1[k + DELTA]) >= N)
{
*ulx = N - x;
*uly = M - y;
*lrx = N - oldx;
*lry = *lrx + *uly - *ulx;
if (fc.debugflag)
{
error_raw
(
"%ld,%ld to %ld,%ld (even)",
*ulx,
*uly,
*lrx,
*lry
);
}
return changes;
}
}
}
}
fatal_raw("Middle snake procedure failed (bug)");
return 0;
}
/*
* Recursive routine to find a minimal D-path through the edit graph
* of the two input files. Arguments are the beginning line numbers in
* the files, and the number of lines to examine. This is basically a
* divide-and-conquer routine which finds the middle snake of an optimal
* D-path, then calls itself to find the remainder of the path before the
* snake and after the snake.
*/
static void
findsnake(int depth, long A, long N, long B, long M)
{
SNAKE *sp;
long ulx;
long uly;
long lrx;
long lry;
long D;
long count;
/*
* If more than one change needed, then call ourself for each part.
*/
D = midsnake(depth, A, N, B, M, &ulx, &uly, &lrx, &lry);
if ((fc.verbosity > VERBOSE_DEFAULT) && (depth == 0))
{
error_raw("[%ld change%s total]", D, ((D == 1) ? "" : "s"));
error_raw("[Finding edit path]");
}
if (D > 1)
{
if ((ulx > 0) && (uly > 0))
findsnake(depth + 1, A, ulx, B, uly);
count = lrx - ulx;
if (count > fc.maxjoin)
{
sp = allocsnake();
sp->line1 = A + ulx;
sp->line2 = B + uly;
sp->count = count;
}
N -= lrx;
M -= lry;
if ((N > 0) && (M > 0))
findsnake(depth + 1, A + lrx, N, B + lry, M);
return;
}
/*
* Only 0 or 1 change needed, so we can compute the result directly.
* First compute the snake coming from the upper left corner if any.
*/
if (N > M)
count = uly;
else
count = ulx;
if (count > fc.maxjoin)
{
sp = allocsnake();
sp->line1 = A;
sp->line2 = B;
sp->count = count;
}
/*
* Finally compute the snake coming from the lower right corner if any.
*/
count = lrx - ulx;
if (count > fc.maxjoin)
{
sp = allocsnake();
sp->line1 = A + ulx;
sp->line2 = B + uly;
sp->count = count;
}
}
/*
* Routine to generate the D-path list and compute the number
* of insertions, deletions and matching lines found.
*/
static void
makesnakes(void)
{
SNAKE *sp; /* current snake element */
long line1; /* current line in file A */
long line2; /* current line in file B */
if (fc.verbosity > VERBOSE_DEFAULT)
error_raw("[Beginning comparisons]");
tablesize = fc.maxlines * 2 + 1;
V1 = (long *)cm_alloc_and_check(sizeof(long) * tablesize);
V2 = (long *)cm_alloc_and_check(sizeof(long) * tablesize);
V1 += fc.maxlines;
V2 += fc.maxlines;
if ((fc.fileA.f_linecount > 0) && (fc.fileB.f_linecount > 0))
findsnake(0, 0L, fc.fileA.f_linecount, 0L, fc.fileB.f_linecount);
/*
* End the list with the lower right endpoint
*/
sp = allocsnake();
sp->line1 = fc.fileA.f_linecount;
sp->line2 = fc.fileB.f_linecount;
sp->count = 0;
if (fc.verbosity > VERBOSE_DEFAULT)
error_raw("[Comparisons complete]");
if (fc.debugflag)
{
error_raw("%8s%8s%8s", "line1", "line2", "count");
for (sp = fc.snakelist; sp; sp = sp->next)
error_raw("%8ld%8ld%8ld", sp->line1, sp->line2, sp->count);
}
/*
* Scan the snake list and calculate the number of inserted,
* deleted, and matching lines.
*/
line1 = 0;
line2 = 0;
for (sp = fc.snakelist; sp; sp = sp->next)
{
fc.deletes += (sp->line1 - line1);
fc.inserts += (sp->line2 - line2);
fc.matches += sp->count;
line1 = sp->line1 + sp->count;
line2 = sp->line2 + sp->count;
}
}
/*
* Print the specified range of line numbers for both files.
* The given string is also typed as part of the message.
* This routine handles both full and line number output.
* The real line numbers in each file are typed.
*/
static void
printrange(FILE *fp, const char *msg, long line1, long count1, long line2,
long count2)
{
long beg1;
long end1;
long beg2;
long end2; /* real beginning and ending line numbers */
string_ty *buf1;
string_ty *buf2;
end1 = line1 + count1 - 1;
end2 = line2 + count2 - 1;
if (line1 >= fc.fileA.f_linecount)
{
beg1 = fc.fileA.f_linestotal + 1;
end1 = beg1;
}
else
{
beg1 = fc.fileA.f_lnums[line1];
end1 = fc.fileA.f_lnums[end1];
}
if (line2 >= fc.fileB.f_linecount)
{
beg2 = fc.fileB.f_linestotal + 1;
end2 = beg2;
}
else
{
beg2 = fc.fileB.f_lnums[line2];
end2 = fc.fileB.f_lnums[end2];
}
if (beg1 == end1)
{
if (fc.hexify_flag)
buf1 = str_format("0x%lX", beg1 - 1);
else
buf1 = str_format("%ld", beg1);
}
else
{
if (fc.hexify_flag)
buf1 = str_format("0x%lX-0x%lX", beg1 - 1, end1 - 1);
else
buf1 = str_format("%ld-%ld", beg1, end1);
}
if (beg2 == end2)
{
if (fc.hexify_flag)
buf2 = str_format("0x%lX", beg2 - 1);
else
buf2 = str_format("%ld", beg2);
}
else
{
if (fc.hexify_flag)
buf2 = str_format("0x%lX-0x%lX", beg2 - 1, end2 - 1);
else
buf2 = str_format("%ld-%ld", beg2, end2);
}
if (fc.editscriptflag)
{
fprintf(fp, "%c %s %s\n", *msg, buf1->str_text, buf2->str_text);
}
else
{
fprintf
(
fp,
"\n******************** %s [A %s, B %s]:\n",
msg,
buf1->str_text,
buf2->str_text
);
}
str_free(buf1);
str_free(buf2);
}
/*
* Translate all tabs to the appropriate number of spaces in a line.
* This is used when the line is not output at a nice tab boundary,
* so that the output still looks correct. Returns the new converted
* string, which is only valid until the next call.
*/
static char *
detab(const char *str)
{
int pos; /* current character position */
int ch; /* current character */
char *destcp; /* destination pointer */
static char *strbuf; /* string buffer */
static int maxlen; /* maximum size of string buffer */
if (!maxlen)
{
maxlen = DETABALLOCSIZE;
strbuf = r_alloc_and_check(maxlen + TABSIZE + 1);
}
destcp = strbuf;
pos = 0;
for (;;)
{
ch = *str++;
if (!ch)
break;
if (pos >= maxlen)
{
maxlen += DETABALLOCSIZE;
strbuf = r_realloc_and_check(strbuf, maxlen + TABSIZE + 1);
destcp = strbuf + pos;
}
if (ch != '\t')
{
*destcp++ = ch;
pos++;
}
else
{
for (;;)
{
*destcp++ = ' ';
pos++;
if ((pos % TABSIZE) == 0)
break;
}
}
}
*destcp = '\0';
return strbuf;
}
/*
* Print the specified number of lines of a file beginning at the
* specified line number. This prints imbedded blank lines too.
* The lines can be preceeded by line number if desired. Context
* lines can be added also. Tabs are converted to the appropriate
* number of spaces if line numbering or tags are supplied.
*/
static void
printlines(FILE *fp, FILEINFO *fi, long line, long count, const char *tagstr)
{
LINE **lines; /* data of file */
long *lnum; /* line numbers */
char *data; /* current data line */
long curlnum; /* current line number */
line = line - fc.context - 1;
count += (2 * fc.context);
if (line < 0)
{
count += line;
line = 0;
}
if ((line + count) > fi->f_linecount)
count = fi->f_linecount - line;
lines = fi->f_lines + line;
lnum = fi->f_lnums + line;
curlnum = *lnum;
while (count-- > 0)
{
while (curlnum < *lnum)
{
if (fc.whatflag)
fprintf(fp, "%s\n", tagstr);
else if (fc.numflag)
fprintf(fp, "%c%ld\n", fi->f_tag, curlnum);
else
putc('\n', fp);
curlnum++;
}
if (fc.whatflag)
fprintf(fp, "%s ", tagstr);
else if (fc.numflag)
fprintf(fp, "%c%-7ld ", fi->f_tag, curlnum);
data = (*lines)->l_data;
if (fc.whatflag)
data = detab(data);
fputs(data, fp);
lines++;
lnum++;
curlnum++;
}
}
/*
* Dump lines which match, either just the line numbers or with the text.
*/
void
dumpmatch(char *outputname)
{
FILE *fp;
SNAKE *sp;
if ((fc.verbosity > VERBOSE_DEFAULT) && outputname)
error_raw("[Writing matching lines to \"%s\"]", outputname);
if (outputname)
{
fp = fopen_and_check(outputname, "w");
}
else
{
fp = stdout;
outputname = gettext("standard output");
}
if (fc.editscriptflag)
fprintf(fp, "A %s\nB %s\n", fc.fileA.f_name, fc.fileB.f_name);
else
{
fprintf
(
fp,
"FILE A: %s\nFILE B: %s\n",
fc.fileA.f_name,
fc.fileB.f_name
);
fprintf
(
fp,
"TOTALS: %ld inserted %ld deleted %ld matched\n",
fc.inserts,
fc.deletes,
fc.matches
);
}
for (sp = fc.snakelist; sp; sp = sp->next)
{
if (sp->count <= 0)
continue;
printrange(fp, "MATCH", sp->line1, sp->count, sp->line2, sp->count);
if (!fc.editscriptflag)
printlines(fp, &fc.fileB, sp->line2 + 1, sp->count, "");
}
if (fc.editscriptflag)
fprintf(fp, "T %ld %ld %ld\n", fc.inserts, fc.deletes, fc.matches);
fflush_and_check(fp, outputname);
fclose_and_check(fp, outputname);
}
/*
* Dump the edit script in the normal manner, showing changed line
* numbers along with the relevent text.
*/
void
dumpnormal(char *outputname)
{
FILE *fp; /* output file */
SNAKE *sp; /* current snake */
long line1;
long line2; /* current line numbers */
long count1;
long count2; /* line counts */
if ((fc.verbosity > VERBOSE_DEFAULT) && outputname)
error_raw("[Writing differences to \"%s\"]", outputname);
if (outputname)
{
fp = fopen_and_check(outputname, "w");
}
else
{
fp = stdout;
outputname = gettext("standard output");
}
if (fc.quickflag)
{
fprintf
(
fp,
"Files \"%s\" and \"%s\":\n",
fc.fileA.f_name,
fc.fileB.f_name
);
fprintf
(
fp,
"%ld inserted %ld deleted %ld matched\n",
fc.inserts,
fc.deletes,
fc.matches
);
goto done;
}
if ((fc.inserts == 0) && (fc.deletes == 0))
{
if (fc.verbosity)
{
fprintf
(
fp,
"Files \"%s\" and \"%s\" are identical\n",
fc.fileA.f_name,
fc.fileB.f_name
);
}
goto done;
}
fprintf
(
fp,
"FILE A: %s\nFILE B: %s\nTOTALS: %ld inserted %ld deleted %ld matched\n",
fc.fileA.f_name,
fc.fileB.f_name,
fc.inserts,
fc.deletes,
fc.matches
);
line1 = 0;
line2 = 0;
for (sp = fc.snakelist; sp; sp = sp->next)
{
count1 = sp->line1 - line1;
count2 = sp->line2 - line2;
if (count1 && count2)
{
printrange(fp, "REPLACE", line1, count1, line2, count2);
printlines(fp, &fc.fileA, line1 + 1, count1, "");
fputs("******************** WITH:\n", fp);
printlines(fp, &fc.fileB, line2 + 1, count2, "");
}
else if (count1)
{
printrange(fp, "DELETE", line1, count1, line2, 1L);
printlines(fp, &fc.fileA, line1 + 1, count1, "");
}
else if (count2)
{
printrange(fp, "INSERT", line1, 1L, line2, count2);
printlines(fp, &fc.fileB, line2 + 1, count2, "");
}
line1 = sp->line1 + sp->count;
line2 = sp->line2 + sp->count;
}
done:
fflush_and_check(fp, outputname);
fclose_and_check(fp, outputname);
}
/*
* Dump all of both files showing what happened to each line.
*/
void
dumpwhat(char *outputname)
{
FILE *fp;
SNAKE *sp;
long line1;
long line2; /* current line numbers */
long count1;
long count2; /* line counts */
if ((fc.verbosity > VERBOSE_DEFAULT) && outputname)
error_raw("[Writing what changes were made to \"%s\"]", outputname);
if (outputname)
{
fp = fopen_and_check(outputname, "w");
}
else
{
fp = stdout;
outputname = "(stdandard output)";
}
fprintf(fp, "FILE A: %s\n", fc.fileA.f_name);
fprintf(fp, "FILE B: %s\n", fc.fileB.f_name);
fprintf
(
fp,
"TOTALS: %ld inserted %ld deleted %ld matched\n",
fc.inserts,
fc.deletes,
fc.matches
);
line1 = 0;
line2 = 0;
for (sp = fc.snakelist; sp; sp = sp->next)
{
count1 = sp->line1 - line1;
count2 = sp->line2 - line2;
if (count1 && count2)
{
printlines(fp, &fc.fileA, line1 + 1, count1, "|-");
printlines(fp, &fc.fileB, line2 + 1, count2, "|+");
}
else if (count1)
printlines(fp, &fc.fileA, line1 + 1, count1, "|-");
else if (count2)
printlines(fp, &fc.fileB, line2 + 1, count2, "|+");
printlines(fp, &fc.fileB, sp->line2 + 1, sp->count, " ");
line1 = sp->line1 + sp->count;
line2 = sp->line2 + sp->count;
}
fflush_and_check(fp, outputname);
fclose_and_check(fp, outputname);
}
/*
* Dump only the line numbers which have changed.
* This is useful for machine processing of the differences.
*/
void
dumplines(char *outputname)
{
FILE *fp; /* output file */
SNAKE *sp; /* current snake */
long line1;
long line2; /* previous line numbers */
long count1;
long count2; /* count of line numbers */
if ((fc.verbosity > VERBOSE_DEFAULT) && outputname)
error_raw("[Writing edit script to \"%s\"]", outputname);
if (outputname)
{
fp = fopen_and_check(outputname, "w");
}
else
{
fp = stdout;
outputname = gettext("standard output");
}
line1 = 0;
line2 = 0;
fprintf(fp, "A %s\nB %s\n", fc.fileA.f_name, fc.fileB.f_name);
for (sp = fc.snakelist; sp; sp = sp->next)
{
count1 = sp->line1 - line1;
count2 = sp->line2 - line2;
if (count1 && count2)
printrange(fp, "R", line1, count1, line2, count2);
else if (count1)
printrange(fp, "D", line1, count1, line2, 1L);
else if (count2)
printrange(fp, "I", line1, 1L, line2, count2);
line1 = sp->line1 + sp->count;
line2 = sp->line2 + sp->count;
}
fprintf(fp, "T %ld %ld %ld\n", fc.inserts, fc.deletes, fc.matches);
fflush_and_check(fp, outputname);
fclose_and_check(fp, outputname);
}
/*
* Reinitialize for a new file comparison.
* This zeroes out our static variables so that another
* file comparison will work correctly.
*/
void
fcompreset(void)
{
tablesize = 0;
snakecount = 0;
availchars = 0;
fc.inserts = 0;
fc.deletes = 0;
fc.matches = 0;
fc.snakelist = NULL;
nextchar = NULL;
V1 = NULL;
V2 = NULL;
nextsnake = NULL;
lastsnake = NULL;
endsnake = NULL;
hashtable = NULL;
}
void
binary_warning(const char *filename)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_var_set_charstar(scp, "File_Name", filename);
error_intl(scp, i18n("warning: $filename is binary"));
sub_context_delete(scp);
}
void
binary_fatal(const char *filename)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_var_set_charstar(scp, "File_Name", filename);
fatal_intl(scp, i18n("$filename is binary"));
/* NOTREACHED */
sub_context_delete(scp);
}
/*
* Routine to do the comparison of two files.
* If either of the input filenames is NULL, then this indicates
* that the file has already been read by an earlier call.
*/
void
fcomp(char *nameA, char *nameB)
{
long changes; /* total number of changes */
trace(("fcomp(nameA = \"%s\", nameB = \"%s\")\n{\n", nameA, nameB));
fc.fileA.f_tag = 'A';
fc.fileB.f_tag = 'B';
if (nameA)
{
fc.fileA.f_name = nameA;
if (fc.hexify_flag)
{
fc.fileA.f_file = input_hexify(input_file_open(nameA), 1);
}
else if (fc.binary)
{
fc.fileA.f_file =
input_quoted_printable_encode(input_file_open(nameA), 1);
}
else
fc.fileA.f_file = input_file_text_open(nameA);
}
if (nameB)
{
fc.fileB.f_name = nameB;
if (fc.hexify_flag)
{
fc.fileB.f_file = input_hexify(input_file_open(nameB), 1);
}
else
fc.fileB.f_file = input_file_text_open(nameB);
}
if (!nameA && !nameB)
{
fatal_intl(0, i18n("input file names not supplied"));
}
if (!hashtable)
{
int j;
hashtable = (LINE **)cm_alloc_and_check(HASHSIZE * sizeof(LINE *));
for (j = 0; j < HASHSIZE; ++j)
hashtable[j] = 0;
}
if (nameA)
{
readfile(&fc.fileA, fc.fileAskip, fc.fileAmodify);
if (fc.fileA.is_binary)
{
binary_warning(nameA);
if (fc.cant_do_binary)
return;
}
}
if (nameB)
{
readfile(&fc.fileB, fc.fileBskip, fc.fileBmodify);
if (fc.fileB.is_binary)
{
binary_warning(nameB);
if (fc.cant_do_binary)
return;
}
}
changes = fc.fileA.f_linecount - fc.fileB.f_linecount;
if (changes < 0)
changes = -changes;
if (changes > fc.maxchanges)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_var_set_long(scp, "Number", fc.maxchanges);
fatal_intl(scp, i18n("More than $number changes required"));
/* NOTREACHED */
sub_context_delete(scp);
}
makesnakes();
trace(("}\n"));
}
void
modifyline_register(modifyline_type func)
{
modifyline = func;
}
fhist-1.18/common/compare.h 644 0 0 13176 11265752627 15127 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998-2002, 2008 Peter Miller
*
* Derived from a work
* Copyright (C) 1990 David I. Bell.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* Common definitions for talking to the fcomp module.
* These are the variables which control its actions.
*/
#ifndef COMPARE_H
#define COMPARE_H
#include
#define INFINITY (long)(~(unsigned long)0 >> 1) /* maximum number */
#define VERBOSE_NONE 0 /* least verbosity level */
#define VERBOSE_DEFAULT 1 /* default verbosity level */
#define VERBOSE_FULL 2 /* full verbosity level */
/*
* Structure which traces an optimal D-path through the edit path
* for the two files. The linked list of these structures lists the
* snakes which define the path, where a snake is a region of multiple
* line matchings.
*/
typedef struct snake SNAKE;
struct snake
{
SNAKE *next; /* next snake in path */
long line1; /* line number in file1 */
long line2; /* line number in file2 */
long count; /* number of matching lines */
};
/*
* Data about a line.
* Each line is placed on an appropriate hash chain.
* For any two entries, the two l_hash values match if and only if
* the two lines match, so that the data never needs to be examined
* once the original comparisons are complete. In the extremely rare
* cases where the hash would incorrectly match, it is modified.
*/
typedef struct line LINE;
struct line
{
LINE *l_next; /* next line on same hash chain */
long l_hash; /* hash value for line */
char *l_canon;
char l_data[4]; /* chars (variable length, MUST BE LAST) */
};
#define LINE_SIZE(chars) (sizeof(LINE) + (chars) - 2)
/*
* Data about the files being compared.
*/
typedef struct FILEINFO FILEINFO;
struct FILEINFO
{
LINE **f_lines; /* pointer to data lines */
long *f_lnums; /* line number of each saved line */
long f_linecount; /* number of saved lines in file */
long f_linestotal; /* total number of lines in file */
char *f_name; /* file name */
struct input_ty *f_file; /* file structure for input */
char f_tag; /* tag character for file */
int is_binary;
};
/*
* Global data for file comparisons.
*/
typedef struct FCOMP_DATA FCOMP_DATA;
struct FCOMP_DATA
{
/*
* Input arguments
*/
long maxjoin; /* maximum number of lines to join */
long maxchanges; /* maximum changes to allow */
long maxlines; /* maximum number of lines */
long context; /* lines of context in output */
long fileAskip; /* lines to skip for first file */
long fileBskip; /* lines to skip for second file */
long fileAmodify; /* lines to be modified for first file */
long fileBmodify; /* lines to be modified for second file */
long verbosity; /* verbosity level */
short numflag; /* show line numbers */
short spaceflag; /* ignore extra spaces in lines */
short blankflag; /* ignore blank lines in files */
short hexify_flag; /* turn binary files into byte-per-line text */
short upcaseflag; /* ignore case differences in lines */
short quickflag; /* only show quick summary */
short whatflag; /* show both files showing what changed */
short editscriptflag; /* output an edit script */
short matchflag; /* output lines which match */
short debugflag; /* tell some debugging info */
/*
* Output arguments
*/
long inserts; /* number of lines inserted into first file */
long deletes; /* number of lines deleted from first file */
long matches; /* number of lines unchanged between files */
SNAKE *snakelist; /* snake list describing matching lines */
FILEINFO fileA; /* first file being compared */
FILEINFO fileB; /* second file being compared */
int binary; /* -binary cmd line option */
int cant_do_binary; /* -no-binary cmd line option */
};
extern FCOMP_DATA fc; /* all data defined in here */
/*
* for prototypes
*/
struct INFO;
/*
* Function prototypes
*/
void *allocstr(long);
void fcomp(char *fileA, char *fileB);
void dumpmatch(char *outfile);
void dumpnormal(char *outfile);
void dumpwhat(char *outfile);
void dumplines(char *outfile);
void fcompreset(void);
void binary_warning(const char *);
void binary_fatal(const char *);
/*
* the modifyline calls are used to alter line between reading them
* and comparing them.
*/
typedef char *(*modifyline_type)(char *, long *, struct INFO *);
void modifyline_register(modifyline_type);
#endif /* COMPARE_H */
fhist-1.18/common/config.h.in 644 0 0 13434 11265752627 15350 0 ustar Peter Miller 0 0 /* common/config.h.in. Generated from etc/configure.ac by autoheader. */
#ifndef COMMON_CONFIG_H
#define COMMON_CONFIG_H
/* Set this to be the absolute path of a Bourne shell which understands
functions. */
#undef CONF_SHELL
/* Set this to a suitable argument for the getpgrp function to discover the
process group of the current process. */
#undef CONF_getpgrp_arg
/* Define to 1 if you have the `atexit' function. */
#undef HAVE_ATEXIT
/* Define to 1 if you have the header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the `getpgrp' function. */
#undef HAVE_GETPGRP
/* Define to 1 if you have the `gettext' function. */
#undef HAVE_GETTEXT
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_ISO646_H
/* Define to 1 if you have the `iswctype' function. */
#undef HAVE_ISWCTYPE
/* Define this symbol of your system has iswprint() AND it works. (GNU libc v2
had a bug.) */
#undef HAVE_ISWPRINT
/* Define to 1 if you have the header file. */
#undef HAVE_LIBGETTEXT_H
/* Define to 1 if you have the `intl' library (-lintl). */
#undef HAVE_LIBINTL
/* Define to 1 if you have the header file. */
#undef HAVE_LIBINTL_H
/* Define to 1 if you have the `w' library (-lw). */
#undef HAVE_LIBW
/* Define to 1 if you have the `w32' library (-lw32). */
#undef HAVE_LIBW32
/* Define to 1 if you have the header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES
/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the `rename' function. */
#undef HAVE_RENAME
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the `sighold' function. */
#undef HAVE_SIGHOLD
/* Define to 1 if you have the `sigprocmask' function. */
#undef HAVE_SIGPROCMASK
/* Define to 1 if you have the header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strsignal' function. */
#undef HAVE_STRSIGNAL
/* Define to 1 if you have the header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the `tcgetpgrp' function. */
#undef HAVE_TCGETPGRP
/* Define to 1 if you have the header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the `wcslen' function. */
#undef HAVE_WCSLEN
/* Define to 1 if you have the header file. */
#undef HAVE_WCTYPE_H
/* Define to 1 if you have the header file. */
#undef HAVE_WIDEC_H
/* Define this symbol of your system has the wint_t type defined. It is
usually in or */
#undef HAVE_WINT_T
/* Define this symbol if your system as AND it defines
TIOCGWINSZ and struct winsize. */
#undef HAVE_winsize_SYS_IOCTL_H
/* Define this symbol if your system as AND it defines TIOCGWINSZ
and struct winsize. */
#undef HAVE_winsize_TERMIOS_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both and . */
#undef TIME_WITH_SYS_TIME
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `unsigned int' if does not define. */
#undef size_t
#include
#endif /* COMMON_CONFIG_H */
fhist-1.18/common/config.messy.h 644 0 0 4366 11265752627 16066 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1999, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* This file is included by the generated ``common/config.h'' file.
* These actions are performed ehre, to insulate them from the attentions
* of ./configure (config.status) which is a little over-0zealous about
* nuking the #undef lines.
*/
#ifndef COMMON_CONFIG_MESSY_H
#define COMMON_CONFIG_MESSY_H
/*
* Make sure Solaris includes POSIX extensions.
*/
#if (defined(__sun) || defined(__sun__) || defined(sun)) && \
(defined(__svr4__) || defined(svr4))
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 1
#endif
#ifndef __EXTENSIONS__
#define __EXTENSIONS__ 1
#endif
/*
* fix a glitch in Solaris's
* which only show's up when you turn __EXTENSIONS__ on
*/
#define _timespec timespec /* fix 2.4 */
#define _tv_sec tv_sec /* fix 2.5.1 */
#endif /* Solaris */
/*
* normalize the wide character support
*/
#if defined(HAVE_WCTYPE_H) && !defined(HAVE_ISWPRINT)
# undef HAVE_WCTYPE_H
# ifdef HAVE_ISWCTYPE
# undef HAVE_ISWCTYPE
# endif
#endif
#if !defined(HAVE_WCTYPE_H) && defined(HAVE_ISWPRINT)
# undef HAVE_ISWPRINT
#endif
#if defined(HAVE_WIDEC_H) && !defined(HAVE_WCTYPE_H)
# undef HAVE_WIDEC_H
#endif
/*
* Need to define _POSIX_SOURCE on Linux, in order to get the fdopen,
* fileno, popen and pclose function prototypes.
*/
#ifdef __linux__
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#endif
#endif /* COMMON_CONFIG_MESSY_H */
fhist-1.18/common/env.c 644 0 0 11066 11265752627 14260 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
#include
extern char **environ;
static size_t nenvirons;
static int initialized;
/*
* NAME
* env_initialize - start up environment
*
* SYNOPSIS
* void env_initialize(void);
*
* DESCRIPTION
* The env_initialize function is used to copy all of the environment
* variables into dynamic memory, so that they may be altered by the
* setenv and unsetenv commands.
*/
static void
env_initialize(void)
{
int j;
char **old;
if (initialized)
return;
initialized = 1;
nenvirons = 0;
for (j = 0; environ[j]; ++j)
++nenvirons;
old = environ;
environ = mem_alloc((nenvirons + 1) * sizeof(char *));
for (j = 0; j < nenvirons; ++j)
{
char *cp;
char *was;
was = old[j];
cp = mem_alloc(strlen(was) + 1);
strcpy(cp, was);
environ[j] = cp;
}
environ[nenvirons] = 0;
env_set("SHELL", "/bin/sh");
}
/*
* NAME
* setenv - set environment variable
*
* SYNOPSIS
* void setenv(char *name, char *value);
*
* DESCRIPTION
* The setenv function is used to set the given environment variable to
* the given value.
*
* CAVEAT
* Assumes that the env_initialize function has already been called.
*/
void
env_set(char *name, char *value)
{
size_t name_len;
int j;
char *cp;
if (!initialized)
env_initialize();
cp = 0;
name_len = strlen(name);
for (j = 0; j < nenvirons; ++j)
{
cp = environ[j];
/* assert(cp); */
if
(
name_len <= strlen(cp)
&&
(cp[name_len] == '=' || !cp[name_len])
&&
!memcmp(cp, name, name_len)
)
break;
}
if (environ[j])
{
environ[j] = 0;
if (cp)
mem_free(cp);
}
else
{
size_t nbytes;
nbytes = (nenvirons + 2) * sizeof(char *);
environ = mem_change_size(environ, nbytes);
environ[++nenvirons] = 0;
}
cp = mem_alloc(name_len + strlen(value) + 2);
strcpy(cp, name);
cp[name_len] = '=';
strcpy(cp + name_len + 1, value);
environ[j] = cp;
}
/*
* NAME
* unsetenv - remove environment variable
*
* SYNOPSIS
* void unsetenv(char *name);
*
* DESCRIPTION
* The unsetenv function is used to remove the named variable from the
* environment.
*
* RETURNS
* void
*
* CAVEAT
* Assumes that the env_initialize function has been called already.
*/
void
env_unset(char *name)
{
size_t name_len;
int j;
char *cp;
if (!initialized)
env_initialize();
name_len = strlen(name);
cp = 0;
for (j = 0; j < nenvirons; ++j)
{
cp = environ[j];
/* assert(cp); */
if
(
(cp[name_len] == '=' || !cp[name_len])
&&
!strncmp(cp, name, name_len)
)
break;
}
if (!environ[j])
return;
environ[j] = 0;
if (cp)
mem_free(cp);
--nenvirons;
for ( ; j < nenvirons; ++j)
environ[j] = environ[j + 1];
}
fhist-1.18/common/env.h 644 0 0 1714 11265752627 14244 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_ENV_H
#define COMMON_ENV_H
#include
void env_set(char *name, char *value);
void env_unset(char *name);
#endif /* COMMON_ENV_H */
fhist-1.18/common/error.c 644 0 0 22473 11265752627 14625 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998-2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*
* NAME
* wrap - wrap s string over lines
*
* SYNOPSIS
* void wrap(char *);
*
* DESCRIPTION
* The wrap function is used to print error messages onto stderr
* wrapping ling lines.
*
* CAVEATS
* Line length is assumed to be 80 characters.
*/
#define PAGE_WIDTH 79
static void
wrap(char *s)
{
static char escapes[] = "\rr\nn\ff\bb\tt";
char tmp[PAGE_WIDTH + 2];
int first_line;
char *tp;
int bomb_later;
char *progname;
/*
* Flush stdout so that errors are in sync with the output.
* If you get an error doing this, whinge about it _after_ reporting
* the originating error. Also, clear the error on stdout to
* avoid getting caught in an infinite loop.
*/
if (fflush(stdout) || ferror(stdout))
{
bomb_later = errno;
clearerr(stdout);
}
else
bomb_later = 0;
progname = progname_get();
first_line = 1;
while (*s)
{
char *ep;
int ocol;
/*
* Work out how many characters fit on the line.
*/
if (first_line)
ocol = strlen(progname) + 2;
else
ocol = 8;
for (ep = s; *ep; ++ep)
{
int cw;
int c;
c = (unsigned char)*ep;
if (isprint(c))
cw = 1 + (c == '\\');
else
cw = (strchr(escapes, c) ? 2 : 4);
if (ocol + cw > PAGE_WIDTH)
break;
ocol += cw;
}
/*
* see if there is a better place to break the line
*/
if (*ep && *ep != ' ')
{
char *mp;
for (mp = ep; mp > s; --mp)
{
if (strchr(" /", mp[-1]))
{
ep = mp;
break;
}
}
}
/*
* ignore trailing blanks
*/
while (ep > s && ep[-1] == ' ')
ep--;
/*
* print the line
*/
if (first_line)
sprintf(tmp, "%.*s: ", (int)(sizeof(tmp) - 3), progname);
else
strcpy(tmp, "\t");
tp = tmp + strlen(tmp);
while (s < ep)
{
int c;
c = (unsigned char)*s++;
if (isprint(c))
{
if (c == '\\')
*tp++ = '\\';
*tp++ = c;
}
else
{
char *esc;
esc = strchr(escapes, c);
if (esc)
{
*tp++ = '\\';
*tp++ = esc[1];
}
else
{
sprintf(tp, "\\%3.3o", c);
tp += strlen(tp);
}
}
}
*tp++ = '\n';
*tp = 0;
fputs(tmp, stderr);
if (ferror(stderr))
break;
/*
* skip leading spaces for subsequent lines
*/
while (*s == ' ')
s++;
first_line = 0;
}
if (fflush(stderr) || ferror(stderr))
{
/* don't print why, there is no point! */
quit(1);
}
if (bomb_later)
{
errno = bomb_later;
nfatal_raw("(stdout)");
}
}
static void
double_jeopardy(void)
{
char buffer[200];
sprintf
(
buffer,
"while attempting to construct an error message: %.100s (fatal)",
strerror(errno)
);
wrap(buffer);
quit(1);
}
static char *
copy_string(char *s)
{
char *cp;
errno = 0;
cp = malloc(strlen(s) + 1);
if (!cp)
{
if (!errno)
errno = ENOMEM;
double_jeopardy();
}
strcpy(cp, s);
return cp;
}
/*
* NAME
* error - place a message on the error stream
*
* SYNOPSIS
* void error(char *s, ...);
*
* DESCRIPTION
* Error places a message on the error output stream.
* The first argument is a printf-like format string,
* optionally followed by other arguments.
* The message will be prefixed by the program name and a colon,
* and will be terminated with a newline, automatically.
*
* CAVEAT
* Things like "error(filename)" blow up if the filename
* contains a '%' character.
*/
void
error_raw(char *s, ...)
{
va_list ap;
char *buffer;
va_start(ap, s);
buffer = vmprintf_errok(s, ap);
if (!buffer)
double_jeopardy();
va_end(ap);
wrap(buffer);
}
/*
* NAME
* nerror - place a system fault message on the error stream
*
* SYNOPSIS
* void nerror(char *s, ...);
*
* DESCRIPTION
* Nerror places a message on the error output stream.
* The first argument is a printf-like format string,
* optionally followed by other arguments.
* The message will be prefixed by the program name and a colon,
* and will be terminated with a text description of the error
* indicated by the 'errno' global variable, automatically.
*
* CAVEAT
* Things like "nerror(filename)" blow up if the filename
* contains a '%' character.
*/
void
nerror_raw(char *s, ...)
{
va_list ap;
int n;
char *buf1;
char *buf2;
n = errno;
va_start(ap, s);
buf1 = vmprintf_errok(s, ap);
if (!buf1)
double_jeopardy();
va_end(ap);
buf1 = copy_string(buf1);
buf2 = mprintf_errok("%s: %s", buf1, strerror(n));
if (!buf2)
double_jeopardy();
free(buf1);
wrap(buf2);
}
/*
* NAME
* nfatal - place a system fault message on the error stream and exit
*
* SYNOPSIS
* void nfatal(char *s, ...);
*
* DESCRIPTION
* Nfatal places a message on the error output stream and exits.
* The first argument is a printf-like format string,
* optionally followed by other arguments.
* The message will be prefixed by the program name and a colon,
* and will be terminated with a text description of the error
* indicated by the 'errno' global variable, automatically.
*
* CAVEAT
* Things like "nfatal(filename)" blow up if the filename
* contains a '%' character.
*
* This function does NOT return.
*/
void
nfatal_raw(char *s, ...)
{
va_list ap;
int n;
char *buf1;
char *buf2;
n = errno;
va_start(ap, s);
buf1 = vmprintf_errok(s, ap);
if (!buf1)
double_jeopardy();
va_end(ap);
buf1 = copy_string(buf1);
buf2 = mprintf_errok("%s: %s", buf1, strerror(n));
if (!buf2)
double_jeopardy();
wrap(buf2);
quit(1);
}
/*
* NAME
* fatal - place a message on the error stream and exit
*
* SYNOPSIS
* void fatal(char *s, ...);
*
* DESCRIPTION
* Fatal places a message on the error output stream and exits.
* The first argument is a printf-like format string,
* optionally followed by other arguments.
* The message will be prefixed by the program name and a colon,
* and will be terminated with a newline, automatically.
*
* CAVEAT
* Things like "error(filename)" blow up if the filename
* contains a '%' character.
*
* This function does NOT return.
*/
void
fatal_raw(char *s, ...)
{
va_list ap;
char *buffer;
va_start(ap, s);
buffer = vmprintf_errok(s, ap);
if (!buffer)
double_jeopardy();
va_end(ap);
wrap(buffer);
quit(1);
}
/*
* NAME
* assert - make an assertion
*
* SYNOPSIS
* void assert(int condition);
*
* DESCRIPTION
* Assert is a handy tool for a programmer to guarantee the internal
* consistency of their program. If "-DDEBUG" is specified on
* the compiler's command line, then assert will generate code to verify
* the assertios made. If no DEBUG is defined, assertions will generate
* no code.
*
* CAVEAT
* If the assertion fails, a fatal diagnostic is issued.
*
* The #define's which control the compilation may be found in "error.h".
*
*/
#ifdef my_assert
#undef my_assert
#endif
void
my_assert(int c, char *s, char *file, int line)
{
if (c)
return;
error_raw("%s: %d: assertion \"%s\" failed (bug)", file, line, s);
abort();
}
fhist-1.18/common/error.h 644 0 0 2753 11265752627 14611 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998-2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_ERROR_H
#define COMMON_ERROR_H
#include
#include
#define error @/@/@
#define nerror @/@/@
#define fatal @/@/@
#define nfatal @/@/@
void error_raw(char *, ...) ATTRIBUTE_FORMAT_1_2;
void fatal_raw(char *, ...) ATTRIBUTE_FORMAT_1_2 ATTR_NORETURN;
void nerror_raw(char *, ...) ATTRIBUTE_FORMAT_1_2;
void nfatal_raw(char *, ...) ATTRIBUTE_FORMAT_1_2 ATTR_NORETURN;
void my_assert(int, char *, char *, int);
#ifdef DEBUG
# ifdef __STDC__
# define assert(c) my_assert((c) != 0, #c, __FILE__, __LINE__)
# else
# define assert(c) my_assert((c) != 0, "c", __FILE__, __LINE__)
# endif
#else
# define assert(c)
#endif
#endif /* COMMON_ERROR_H */
fhist-1.18/common/error_intl.c 644 0 0 45223 11265752627 15651 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*
* NAME
* column_width - determine column width of a wide character
*
* SYNOPSIS
* int column_width(wchar_t);
*
* DESCRIPTION
* The column_width function is used to determine the column width
* if a wide character. This is particularly hard to do,
* especially if you have read the ISO C standard ammendments.
*
* WEASEL WORDS
* This is the phrase used by P.J. Plauger in his CUJ columns about
* standard C and C++, specially when the standard dances all
* around the issue, rather than actually solving anything. Take a
* squiz at these classic weasel words...
*
* In the original standard, ISO/IEC 9899:1990, 7.3 Character
* handling reads as follows (3rd paragraph):
*
* The term printing character refers to a member of
* an implemntation defined set of characters, each of
* which occupies one printing position on a display
* device; the term control character refers to a
* member of an implementation defined set of characters
* that are not printing characters.
*
* The following 2 sections are from ISO/IEC 9899:1990/Amd. 1:1995 (E):
*
* 7.15.2 Wide-character classification utilities (2nd paragraph)
*
* The term printing wide character refers to a
* member of a locale-specific set of wide characters, each
* of which occupies at least one printing position on a
* display device; the term control wide character
* refers to a member of a locale-specific set of wide
* characters that are not printing wide characters.
*
* [ Notice how they weasel out by not-quite contradicting 7.3: a
* printing char is exactly one printing position wide, but
* a printing wchar_t is one or more printing positions
* wide. ]
*
* H.14 Column width
*
* The number of characters to be read or written can be
* specified in existing formatted i/o functions. On a
* traditional display device that displays characters with
* fixed pitch, the number of characters is directly
* proportional to the width occupied by the characters.
* So the display format can be specified through the field
* width and/or the precision.
*
* In formatted wide-character i/o functions, the field
* width and the precision specify the number of wide
* characters to be read or written. The number of wide
* characters is not always directly proportional to the
* width of their display. For example, with Japanese
* traditional display devices, a single-byte character
* such as an ASCII character has half the width of a Kanji
* character, even though each of them is treated as one
* wide character. To control the display format for wide
* characters, a set of formatted wide-character i/o
* functions were proposed whose metric was the column
* width instead of the character count.
*
* This proposal was supported only by Japan. Critics
* observed that the proposal was based on such traditional
* display devices with a fixed width of characters, while
* many modern display devices support a broad assortment
* of proportional pitch type faces. Hence, it was
* questioned whether the extra i/o functions in this
* proposal were really needed or were sufficiently
* general. Also considered were another set of functions
* that return the column width for any kind of display
* devices for a given wide-character string; but these
* seemed to be beyond the scope of the C language. Thus
* all proposals regarding column width were withdrawn.
*
* [ Notice how 7.15.2 specifically states that each printing
* character has a non-zero width measurable in printing
* positions. Why is this metric is unavailable to the
* C programmer? Presumably it is OK for an informational appendix
* to contradict the body of the standard. ]
*
* [ The section ends with a compliant-but-non-standard way a
* standard C library implementor may choose to do this. You can't
* reply on it being there, and you can't reply on the suggested
* semantics being used, so don't even bother having ./configure go
* look for it. ]
*
* SO FAKE IT
* Since there is no standard way to determine character width, we
* will have to fake it. Hopefully, locales that need it will
* define something useful. If you know of any, please let me
* know.
*/
static int
column_width(wchar_t wc)
{
#ifdef HAVE_ISWCTYPE
static int kanji_set;
static wctype_t kanji;
if (!kanji_set)
{
kanji = wctype("kanji");
kanji_set = 1;
}
if (kanji && iswctype(kanji, wc))
return 2;
#endif
return 1;
}
static int
wcs_column_width(wchar_t *wcs)
{
int result;
result = 0;
while (*wcs)
result += column_width(*wcs++);
return result;
}
/*
* NAME
* wrap - wrap s string over lines
*
* SYNOPSIS
* void wrap(wstring_ty *);
*
* DESCRIPTION
* The wrap function is used to print error messages onto stderr
* wrapping ling lines. Be very careful of multi-byte characters
* in international character sets.
*
* CAVEATS
* Line length is assumed to be 80 characters.
*/
static void
wrap(const wchar_t *s)
{
char *progname;
int page_width;
char tmp[(MAX_PAGE_WIDTH + 2) * MB_LEN_MAX];
int first_line;
char *tp;
int nbytes;
static int progname_width;
int midway;
/*
* flush any pending output,
* so the error message appears in a sensible place.
*/
if (fflush(stdout) || ferror(stdout))
nfatal_raw("standard output");
/*
* Ask the system how wide the terminal is.
* Don't use last column, many terminals are dumb.
*/
page_width = page_width_get() - 1;
midway = (page_width + 8) / 2;
/*
* Because it must be a legal UNIX file name, it is unlikely to
* be stupid - unprintable characters are hard to type, and most
* file systems don't allow high-bit-on characters in file
* names. Thus, assume progname is all legal characters.
*/
progname = progname_get();
if (!progname_width)
{
wstring_ty *ws;
ws = wstr_from_c(progname);
progname_width = wcs_column_width(ws->wstr_text);
wstr_free(ws);
}
/*
* the message is for a human, so
* use the human's locale
*/
language_human();
/*
* Emit the message a line at a time, wrapping as we go. The
* first line starts with the program name, subsequent lines are
* indented by a tab.
*/
first_line = 1;
while (*s)
{
const wchar_t *ep;
int ocol;
const wchar_t *break_space;
int break_space_col;
const wchar_t *break_punct;
int break_punct_col;
/*
* Work out how many characters fit on the line.
*/
if (first_line)
ocol = progname_width + 2;
else
ocol = 8;
wctomb(NULL, 0);
ep = s;
break_space = 0;
break_space_col = 0;
break_punct = 0;
break_punct_col = 0;
while (*ep)
{
char dummy[MB_LEN_MAX];
int cw;
wchar_t c;
/*
* Keep printing characters. Use a dummy
* character for unprintable sequences (which
* should not happen).
*/
c = *ep;
if (!iswprint(c))
c = '?';
nbytes = wctomb(dummy, c);
cw = column_width(c);
if (nbytes <= 0)
{
/*
* This should not happen! All
* unprintable characters should have
* been turned into C escapes inside the
* common/wstr.c file when converting from C
* string to wide strings.
*
* Replace invalid wide characters with
* a C escape.
*/
cw = 4;
nbytes = 4;
/*
* The wctomb state will be ``error'',
* so reset it and brave the worst. No
* need to reset the wctomb state, it is
* not broken.
*/
wctomb(NULL, 0);
}
/*
* Keep track of good places to break the line,
* but try to avoid runs of white space. There
* is a pathological case where the line is
* entirely composed of white space, but it does
* not happen often.
*/
if (c == ' ')
{
break_space = ep;
break_space_col = ocol;
while (break_space > s && break_space[-1] == ' ')
{
--break_space;
--break_space_col;
}
}
if (iswpunct(c) && ocol + cw <= page_width)
{
break_punct = ep + 1;
break_punct_col = ocol + cw;
}
/*
* if we have run out of room, break here
*/
if (ocol + cw > page_width)
break;
ocol += cw;
++ep;
}
/*
* see if there is a better place to break the line
*
* Break the line at space characters, otherwise break
* at punctuator characters. If it is possible to break
* on either a space or a punctuator, choose the space.
*
* However, if the space is in the left half of the
* line, things look very unbalanced, so break on a
* punctuator in that case.
*/
if (*ep && *ep != ' ')
{
if (break_space == s)
break_space = 0;
if
(
break_space
&&
break_punct
&&
break_space_col < midway
&&
break_punct_col >= midway
)
ep = break_punct;
else if (break_space)
ep = break_space;
else if (break_punct)
ep = break_punct;
}
/*
* print the line
*/
if (first_line)
{
strcpy(tmp, progname);
strcat(tmp, ": ");
}
else
strcpy(tmp, "\t");
tp = tmp + strlen(tmp);
/*
* Turn the input into a multi bytes chacacters.
*/
wctomb(NULL, 0);
while (s < ep)
{
wchar_t c;
/*
* Keep printing characters. Use a dummy
* character for unprintable sequences (which
* should not happen).
*/
c = *s++;
if (!iswprint(c))
c = '?';
nbytes = wctomb(tp, c);
if (nbytes <= 0)
{
/*
* This should not happen! All
* unprintable characters should have
* been turned into C escapes inside the
* wstring.c file when converting from C
* string to wide strings.
*
* Replace invalid wide characters with
* a C escape.
*/
nbytes = 4;
tp[0] = '\\';
tp[1] = '0' + ((c >> 6) & 7);
tp[2] = '0' + ((c >> 3) & 7);
tp[3] = '0' + ( c & 7);
/*
* The wctomb state will be ``error'',
* so reset it and brave the worst. No
* need to reset the wctomb state, it is
* not broken.
*/
wctomb(NULL, 0);
}
tp += nbytes;
}
/*
* Add a newline and end any outstanding shift state and
* add a NUL character.
*/
nbytes = wctomb(tp, (wchar_t)'\n');
if (nbytes > 0)
tp += nbytes;
nbytes = wctomb(tp, (wchar_t)0);
if (nbytes > 0)
tp += nbytes;
/*
* Emit the line to stderr. It is important to do this
* a whole line at a time, otherwise performance is
* terrible - stderr by default is character buffered.
*/
fputs(tmp, stderr);
if (ferror(stderr))
break;
/*
* skip leading spaces for subsequent lines
*/
while (*s == ' ')
++s;
first_line = 0;
}
/*
* done with humans
*/
language_C();
/*
* make sure nothing went wrong
*/
if (fflush(stderr) || ferror(stderr))
nfatal_raw("standard error");
}
void
error_intl(sub_context_ty *scp, const char *s)
{
wstring_ty *message;
int need_to_delete;
if (scp)
need_to_delete = 0;
else
{
scp = sub_context_new();
need_to_delete = 1;
}
message = subst_intl_wide(scp, s);
wrap(message->wstr_text);
wstr_free(message);
if (need_to_delete)
sub_context_delete(scp);
}
void
fatal_intl(sub_context_ty *scp, const char *s)
{
wstring_ty *message;
static const char *double_jeopardy;
/*
* Make sure that there isn't an infinite loop,
* if there is a problem with a substitution
* in an error message.
*/
if (double_jeopardy)
{
/*
* this error message can't be internationalized
*/
fatal_raw
(
"a fatal_intl error (\"%s\") happened while \
attempting to report an earlier fatal_intl error (\"%s\"). \
This is a probably bug.",
s,
double_jeopardy
);
}
double_jeopardy = s;
if (!scp)
scp = sub_context_new();
message = subst_intl_wide(scp, s);
wrap(message->wstr_text);
double_jeopardy = 0;
quit(1);
}
/*
* These are extra messages generated by various tools, but which must
* be translated all the same.
*/
#if 0
static void
bogus(void)
{
/* bison */
i18n("parse error");
i18n("parse error; also virtual memory exceeded");
i18n("parser stack overflow");
/* yacc */
i18n("syntax error");
}
#endif
fhist-1.18/common/error_intl.h 644 0 0 2276 11265752627 15637 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1998, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_ERROR_INTL_H
#define COMMON_ERROR_INTL_H
#include /* always needed */
/*
* internationalized error messages
* (also the keywords necessary to pull out the msgid strings)
*/
void error_intl(sub_context_ty *, const char *);
void fatal_intl(sub_context_ty *, const char *) ATTR_NORETURN;
void verbose_intl(sub_context_ty *, const char *);
#endif /* COMMON_ERROR_INTL_H */
fhist-1.18/common/fcheck.c 644 0 0 5137 11265752627 14675 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
FILE *
fopen_and_check(const char *filename, const char *mode)
{
FILE *fp;
if (!filename)
return (strchr(mode, 'r') ? stdin : stdout);
fp = fopen(filename, mode);
if (!fp)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", filename);
fatal_intl(scp, i18n("open \"$filename\": $errno"));
}
return fp;
}
void
fflush_and_check(FILE *fp, const char *filename)
{
if (fflush(fp))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", filename);
fatal_intl(scp, i18n("write \"$filename\": $errno"));
}
}
void
fclose_and_check(FILE *fp, const char *filename)
{
if (fp == stdout || fp == stdin)
return;
if (fclose(fp))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", filename);
fatal_intl(scp, i18n("close \"$filename\": $errno"));
}
}
void
fatal_with_filename(const char *filename, sub_context_ty *scp, const char *text)
{
string_ty *s;
if (!scp)
scp = sub_context_new();
s = subst_intl(scp, (char *)text);
sub_var_set_charstar(scp, "File_Name", filename);
sub_var_set_string(scp, "MeSsaGe", s);
str_free(s);
fatal_intl(scp, i18n("$filename: $message"));
}
void
warning_last_line_unterminated(const char *filename)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_var_set_charstar(scp, "File_Name", filename);
error_intl(scp, i18n("$filename: warning: last line unterminated"));
sub_context_delete(scp);
}
fhist-1.18/common/fcheck.h 644 0 0 2320 11265752627 14671 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_FCHECK_H
#define COMMON_FCHECK_H
#include
#include
FILE *fopen_and_check(const char *, const char *);
void fflush_and_check(FILE *, const char *);
void fclose_and_check(FILE *, const char *);
void warning_last_line_unterminated(const char *);
struct sub_context_ty;
void fatal_with_filename(const char *, struct sub_context_ty *, const char *);
#endif /* COMMON_FCHECK_H */
fhist-1.18/common/fileio.c 644 0 0 21311 11265752627 14731 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998-2000, 2002, 2008 Peter Miller
*
* Derived from a work
* Copyright (C) 1990 David I. Bell.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* Functions to position within an ascii file and read lines from it.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define LINEALLOCSIZE 132 /* allocation size for line buffer */
/*
* Position absolutely within a file to the indicated byte position,
* returns a negative value if failed.
*/
void
seekf(FILE *fp, long pos, const char *filename)
{
if (fseek(fp, pos, SEEK_SET) == -1)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", filename);
sub_var_set_long(scp, "Number", pos);
fatal_intl(scp, i18n("fseek(\"$filename\", $number): $errno"));
}
}
/*
* Skip forwards through a file by the specified number of lines.
* Returns nonzero on end of file or any error.
*/
int
skipf(FILE *fp, long count, const char *filename)
{
int c;
while (count > 0)
{
c = getc(fp);
if (c == EOF)
{
if (ferror(fp))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", filename);
fatal_intl(scp, i18n("read \"$filename\": $errno"));
}
return -1;
}
if (c == '\n')
--count;
}
return 0;
}
/*
* Function to read in the next line from a file, no matter how long it is.
* This returns a pointer to the string, and also indirectly its length.
* The string is normally returned from a static string, which is reused
* for each call. But if keep is non-zero, then the returned string
* belongs to the caller and must later be freed. The returned line
* is ended with a newline and null character, but the returned length
* does not count the null character. Returns 0 on an error, with the
* error stored in the fp structure.
*/
char *
readlinef(FILE *fp, long *retlen, int keep, const char *filename,
int *is_bin_file)
{
char *cp; /* pointer to character string */
char *dp; /* destination pointer */
long cursize; /* current size */
long count; /* length of data read from file */
long totallen; /* total length of data */
static char *linebuffer; /* common line buffer */
static long linelength; /* total length of line */
totallen = 0;
if (linelength == 0)
{
/* allocate line buffer */
linebuffer = r_alloc_and_check(LINEALLOCSIZE + 1);
linelength = LINEALLOCSIZE;
}
cp = linebuffer;
cursize = linelength;
for (;;)
{
count = readf(fp, cp, cursize, filename, is_bin_file);
if (count <= 0)
{
if (totallen == 0)
return 0;
warning_last_line_unterminated(filename);
count = 1;
cp[0] = '\n';
}
totallen += count;
if (cp[count - 1] == '\n')
break;
linebuffer =
r_realloc_and_check(linebuffer, linelength + LINEALLOCSIZE + 1);
cp = linebuffer + totallen;
linelength += LINEALLOCSIZE;
cursize = LINEALLOCSIZE;
}
if (retlen)
*retlen = totallen;
if (!keep)
dp = linebuffer;
else
{
dp = cm_alloc_and_check(totallen + 1);
memcpy(dp, linebuffer, (size_t)totallen);
}
dp[totallen] = 0;
return dp;
}
/*
* Read data from the current position in a file until a newline is found
* or the supplied buffer is full. These two cases can be distinguished by
* checking the last character of the returned data. Returns the number of
* characters in the line (including the newline), or -1 if an error or end
* of file in the middle of the line is found. Line is terminated by a null
* character if space allows. Returns zero if the end of file occurs at
* the front of the line.
*/
long
readf(FILE *fp, char *buf, long size, const char *filename, int *is_bin_file)
{
char *bp;
char *ep;
int c;
bp = buf;
ep = buf + size;
while (bp < ep)
{
c = getc(fp);
if (c == EOF)
{
if (ferror(fp))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", filename);
fatal_intl(scp, i18n("read \"$filename\": $errno"));
}
if (bp != buf)
break;
return -1;
}
if (c == 0)
{
c = 0x80;
*is_bin_file = 1;
}
*bp++ = c;
if (c == '\n')
break;
}
return (bp - buf);
}
/*
* Write data at the current position in a file.
* This buffers the data in the current block, thus flushing is needed later.
* Prints a fatal error message and exits on errors.
*/
void
writefx(FILE *fp, char *buf, long size, const char *filename)
{
fwrite(buf, 1, size, fp);
if (ferror(fp))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", filename);
fatal_intl(scp, i18n("write \"$filename\": $errno"));
}
}
/*
* Function to copy data from one file to another. Data is copied from
* the current position of the input file to the current position of the
* output file until end of file is reached on the input file, or until
* the specified number of characters has been read. Minus one means
* there is no limit to the amount to be copied. Line boundaries and
* space expansions are ignored. Returns nonzero on errors.
*/
int
copyf(FILE *ip, FILE *op, long count, const char *ifn, const char *ofn)
{
char buffer[1 << 10];
long len;
while (count)
{
if (count < 0 || count > sizeof(buffer))
len = sizeof(buffer);
else
len = count;
len = fread(buffer, 1, len, ip);
if (len < 0)
return EOF;
if (len == 0)
break;
fwrite(buffer, 1, len, op);
if (ferror(op))
return EOF;
if (count >= 0)
count -= len;
}
return 0;
}
void
copyfx(FILE *ip, FILE *op, long count, const char *ifn, const char *ofn)
{
char buffer[1 << 10];
long len;
sub_context_ty *scp;
while (count)
{
if (count < 0 || count > sizeof(buffer))
len = sizeof(buffer);
else
len = count;
len = fread(buffer, 1, len, ip);
if (len < 0)
{
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", ifn);
fatal_intl(scp, i18n("read \"$filename\": $errno"));
}
if (len == 0)
break;
fwrite(buffer, 1, len, op);
if (ferror(op))
{
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", ofn);
fatal_intl(scp, i18n("write \"$filename\": $errno"));
}
if (count >= 0)
count -= len;
}
fflush_and_check(op, ofn);
}
/*
* Function to type out the rest of an input file to the terminal.
* It is assumed that we are positioned at the beginning of a line.
*/
int
typef(FILE *fp, const char *filename)
{
return copyf(fp, stdout, -1L, filename, gettext("standard output"));
}
void
typefx(FILE *fp, const char *filename)
{
copyfx(fp, stdout, -1L, filename, gettext("standard output"));
}
fhist-1.18/common/fileio.h 644 0 0 2763 11265752627 14730 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998-2000, 2002, 2008 Peter Miller
*
* Derived from a work
* Copyright (C) 1990 David I. Bell.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*
* Definitions for local file handling routines.
*/
#ifndef FILEIO_H
#define FILEIO_H
#include
#include
/*
* Function Prototypes
*/
void seekf(FILE *, long, const char *);
int skipf(FILE *, long, const char *);
char *readlinef(FILE *, long *, int, const char *, int *);
long readf(FILE *, char *, long, const char *, int *);
void writefx(FILE *, char *, long, const char *);
int copyf(FILE *, FILE *, long, const char *, const char *);
void copyfx(FILE *, FILE *, long, const char *, const char *);
int typef(FILE *, const char *);
void typefx(FILE *, const char *);
#endif /* FILEIO_H */
fhist-1.18/common/help.c 644 0 0 14541 11265752627 14421 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static void
help_env(void)
{
char *cp;
string_list_ty manpath;
string_ty *s;
string_list_ty lib;
string_list_ty lang;
size_t j, k;
string_list_ty wl;
/*
* Honour any existing MANPATH setting by appending only.
* Read the MANPATH to set the initial path.
*/
cp = getenv("MANPATH");
if (cp)
{
s = str_from_c(cp);
str2wl(&manpath, s, ":", 0);
str_free(s);
}
else
{
string_list_constructor(&manpath);
s = str_from_c("/usr/man");
string_list_append(&manpath, s);
str_free(s);
s = str_from_c("/usr/share/man");
string_list_append(&manpath, s);
str_free(s);
}
/*
* The list of library directories to look in.
*/
string_list_constructor(&lib);
s = str_from_c(configured_datadir());
string_list_append_unique(&lib, s);
str_free(s);
cp = getenv("FHIST_MESSAGE_LIBRARY");
if (cp)
{
s = str_from_c(cp);
str2wl(&wl, s, ":", 0);
for (j = 0; j < wl.nstrings; ++j)
string_list_append_unique(&lib, wl.string[j]);
string_list_destructor(&wl);
}
/*
* Use the LANGUAGE (or LANG) environment
* variables to know which languages to add.
* Default to "en" if not set.
*/
string_list_constructor(&lang);
cp = getenv("LANGUAGE");
if (cp)
{
s = str_from_c(cp);
str2wl(&wl, s, ":", 0);
for (j = 0; j < wl.nstrings; ++j)
string_list_append_unique(&lang, wl.string[j]);
string_list_destructor(&wl);
}
cp = getenv("LANG");
if (cp)
{
s = str_from_c(cp);
str2wl(&wl, s, ":", 0);
for (j = 0; j < wl.nstrings; ++j)
string_list_append_unique(&lang, wl.string[j]);
string_list_destructor(&wl);
}
if (!lang.nstrings)
{
s = str_from_c("en");
string_list_append(&lang, s);
str_free(s);
}
/*
* convolve the lib and lang lists and append them to the manpath
*/
for (j = 0; j < lib.nstrings; ++j)
{
string_list_append_unique(&manpath, lib.string[j]);
for (k = 0; k < lang.nstrings; ++k)
{
s = str_format("%S/%S", lib.string[j], lang.string[k]);
string_list_append_unique(&manpath, s);
str_free(s);
}
}
string_list_destructor(&lib);
string_list_destructor(&lang);
s = str_from_c(configured_mandir());
string_list_append_unique(&lib, s);
str_free(s);
/*
* set the MANPATH environment variable
*/
s = wl2str(&manpath, 0, manpath.nstrings, ":");
string_list_destructor(&manpath);
env_set("MANPATH", s->str_text);
str_free(s);
}
void
help(char *progname, void (*usage)(void))
{
char *argv[3];
sub_context_ty *scp;
/*
* collect the rest of the command line,
* if necessary
*/
if (usage)
{
arglex();
while (arglex_token != arglex_token_eoln)
bad_argument(usage);
}
if (!progname)
progname = progname_get();
/*
* set the MANPATH environment variable
* to point into the libraries
*/
help_env();
/*
* Invoke the appropriate ``man'' command. This will find the
* right language on the search path, and it already knows how
* to translate the *roff into text.
*/
argv[0] = "man";
argv[1] = progname;
argv[2] = 0;
error_raw("%s %s", argv[0], argv[1]);
execvp(argv[0], argv);
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_charstar(scp, "File_Name", argv[0]);
fatal_intl(scp, i18n("exec \"$filename\": $errno"));
/* NOTREACHED */
}
void
bad_argument(void (*usage)(void))
{
sub_context_ty *scp;
trace(("bad_argument()\n{\n"));
switch (arglex_token)
{
case arglex_token_string:
scp = sub_context_new();
sub_var_set_charstar(scp, "File_Name", arglex_value.alv_string);
error_intl(scp, i18n("misplaced file name (\"$filename\")"));
sub_context_delete(scp);
break;
case arglex_token_number:
scp = sub_context_new();
sub_var_set_charstar(scp, "Number", arglex_value.alv_string);
error_intl(scp, i18n("misplaced number ($number)"));
sub_context_delete(scp);
break;
case arglex_token_option:
scp = sub_context_new();
sub_var_set_charstar(scp, "Name", arglex_value.alv_string);
error_intl(scp, i18n("unknown \"$name\" option"));
sub_context_delete(scp);
break;
case arglex_token_eoln:
error_intl(0, i18n("command line too short"));
break;
default:
scp = sub_context_new();
sub_var_set_charstar(scp, "Name", arglex_token_name(arglex_token));
error_intl(scp, i18n("misplaced \"$name\" option"));
sub_context_delete(scp);
break;
}
usage();
trace(("}\n"));
quit(1);
/* NOTREACHED */
}
void
mutually_exclusive(int arg1, int arg2, void (*usage)(void))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_var_set_charstar(scp, "Name1", arglex_token_name(arg1));
sub_var_set_charstar(scp, "Name2", arglex_token_name(arg2));
error_intl(scp, i18n("$name1 and $name2 mutually exclusive"));
sub_context_delete(scp);
usage();
quit(1);
}
fhist-1.18/common/help.h 644 0 0 2240 11265752627 14377 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 1991-1994, 1998, 2002, 2005, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef HELP_H
#define HELP_H
#include
void help(char *, void (*usage)(void));
void bad_argument(void(*)(void));
/**
* The mutually_exclusive function is used to complain abut the user
* specifying two mutually exclusive command line options.
*/
void mutually_exclusive(int arg1, int arg2, void (*usage)(void));
#endif /* HELP_H */
fhist-1.18/common/input.c 644 0 0 15565 11265752627 14637 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000-2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
#include
#include
#ifdef input_name
#undef input_name
#endif
const char *
input_name(input_ty *fp)
{
const char *result;
trace(("input_name(fp = %8.8lX)\n{\n", (long)fp));
result = fp->vptr->name(fp);
trace(("return \"%s\";\n", result));
trace(("}\n"));
return result;
}
#ifdef input_length
#undef input_length
#endif
long
input_length(input_ty *fp)
{
long result;
trace(("input_length(fp = %8.8lX)\n{\n", (long)fp));
result = fp->vptr->length(fp);
trace(("return %ld;\n", result));
trace(("}\n"));
return result;
}
#ifdef input_ftell
#undef input_ftell
#endif
long
input_ftell(input_ty *fp)
{
long result;
trace(("input_ftell(fp = %8.8lX)\n{\n", (long)fp));
result = fp->vptr->ftell(fp) - fp->pushback_len;
trace(("return %ld;\n", result));
trace(("}\n"));
return result;
}
#ifdef input_read
#undef input_read
#endif
long
input_read(input_ty *fp, void *data, long len)
{
long result;
trace(("input_read(fp = %8.8lX, data = %8.8lX, len = %8.8lX)\n{\n",
(long)fp, (long)data, len));
if (len <= 0)
{
result = 0;
}
else
{
if (fp->pushback_len > 0)
{
fp->pushback_len--;
*(char *)data = fp->pushback_buf[fp->pushback_len];
result = 1;
}
else
{
result = fp->vptr->read(fp, data, len);
}
}
trace(("return %ld;\n", result));
trace(("}\n"));
return result;
}
#ifdef DEBUG
static char *
unctrl(int c)
{
static char buffer[10];
if (c < 0 || c >= 256)
{
snprintf(buffer, sizeof(buffer), "%d", c);
return buffer;
}
switch (c)
{
case '\'':
case '\\':
escape:
buffer[0] = '\'';
buffer[1] = '\\';
buffer[2] = c;
buffer[3] = '\'';
buffer[4] = 0;
break;
case '\b': c = 'b'; goto escape;
case '\f': c = 'f'; goto escape;
case '\n': c = 'n'; goto escape;
case '\r': c = 'r'; goto escape;
case '\t': c = 't'; goto escape;
default:
if (isprint((unsigned char)c))
{
buffer[0] = '\'';
buffer[1] = c;
buffer[2] = '\'';
buffer[3] = 0;
}
else
snprintf(buffer, sizeof(buffer), "'\\%o'", c);
break;
}
return buffer;
}
#endif
#ifdef input_getc
#undef input_getc
#endif
int
input_getc(input_ty *fp)
{
int result;
trace(("input_getc(fp = %8.8lX)\n{\n", (long)fp));
if (fp->pushback_len > 0)
{
fp->pushback_len--;
result = fp->pushback_buf[fp->pushback_len];
}
else
result = fp->vptr->get(fp);
trace(("return %s;\n", unctrl(result)));
trace(("}\n"));
return result;
}
#ifdef input_ungetc
#undef input_ungetc
#endif
void
input_ungetc(input_ty *fp, int c)
{
trace(("input_ungetc(fp = %8.8lX, c = %s)\n{\n", (long)fp, unctrl(c)));
if (c >= 0)
{
if (fp->pushback_len >= fp->pushback_max)
{
fp->pushback_max = 16 + 2 * fp->pushback_max;
fp->pushback_buf =
mem_change_size(fp->pushback_buf, fp->pushback_max);
}
fp->pushback_buf[fp->pushback_len++] = c;
}
trace(("}\n"));
}
void
input_delete(input_ty *fp)
{
trace(("input_delete(fp = %8.8lX)\n{\n", (long)fp));
if (fp->vptr->destruct)
fp->vptr->destruct(fp);
if (fp->pushback_buf)
mem_free(fp->pushback_buf);
fp->pushback_buf = 0;
fp->pushback_len = 0;
fp->pushback_max = 0;
fp->vptr = 0; /* paranoia */
mem_free(fp);
trace(("}\n"));
}
#include
/*
* Routine to read in the next line from a file, no matter how long it is.
* This returns a pointer to the string, and also indirectly its length.
* The string is normally returned from a static string, which is reused
* for each call. But if keep is non-zero, then the returned string
* belongs to the caller and must later be freed. The returned line
* is ended with a newline and null character, but the returned length
* does not count the null character. Returns 0 on an error, with the
* error stored in the fp structure.
*/
char *
input_readline(input_ty *fp, long *retlen, int keep, int *is_bin_file)
{
char *dp; /* destination pointer */
size_t totallen; /* total length of data */
static char *linebuffer; /* common line buffer */
static size_t linelength; /* total length of line */
trace(("input_readline(fp = %8.8lX, retlen = %8.8lX, keep = %d)\n{\n",
(long)fp, (long)retlen, keep));
if (linelength == 0)
{
/* allocate line buffer */
linelength = 16;
linebuffer = r_alloc_and_check(linelength + 1);
}
totallen = 0;
for (;;)
{
int c = input_getc(fp);
if (c < 0)
{
if (totallen == 0)
return 0;
warning_last_line_unterminated(input_name(fp));
c = '\n';
}
if (c == 0)
{
*is_bin_file = 1;
c = 0x80;
}
if (totallen >= linelength)
{
/*
* doubling gives O(1) behaviour
* over the life of the prog
*/
linelength = linelength * 2 + 16;
linebuffer = r_realloc_and_check(linebuffer, linelength + 1);
}
linebuffer[totallen++] = c;
if (c == '\n')
break;
}
linebuffer[totallen] = 0;
if (retlen)
*retlen = totallen;
if (!keep)
dp = linebuffer;
else
{
dp = cm_alloc_and_check(totallen + 1);
memcpy(dp, linebuffer, (size_t)totallen);
}
trace(("return %8.8lX;\n", (long)dp));
trace(("}\n"));
return dp;
}
void
input_skip_lines(input_ty *fp, int numlines)
{
while (numlines > 0)
{
int c = input_getc(fp);
if (c < 0)
break;
if (c == '\n')
--numlines;
}
}
fhist-1.18/common/input.h 644 0 0 6011 11265752627 14606 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_INPUT_H
#define COMMON_INPUT_H
#include
typedef struct input_ty input_ty;
struct input_ty
{
struct input_vtbl_ty *vptr;
/* private: */
unsigned char *pushback_buf;
int pushback_len;
int pushback_max;
};
/*
* This structure is *not* to be accessed by clients of this interface.
* It is only present to permit optimizations.
*/
typedef struct input_vtbl_ty input_vtbl_ty;
struct input_vtbl_ty
{
int size;
void (*destruct)(input_ty *);
long (*read)(input_ty *, void *, long);
int (*get)(input_ty *);
long (*ftell)(input_ty *);
const char *(*name)(input_ty *);
long (*length)(input_ty *);
};
long input_read(input_ty *, void *, long);
int input_getc(input_ty *);
void input_ungetc(input_ty *, int);
const char *input_name(input_ty *);
void input_delete(input_ty *);
long input_length(input_ty *);
long input_ftell(input_ty *);
void input_format_error(input_ty *);
char *input_readline(input_ty *, long *retlen, int keep, int *bin);
void input_skip_lines(input_ty *, int);
struct output_ty; /* existence */
void input_to_output(input_ty *, struct output_ty *);
struct string_ty *input_one_line(input_ty *);
#ifdef __GNUC__
extern __inline long input_read(input_ty *fp, void *data, long len)
{ if (len <= 0) return 0; if (fp->pushback_len > 0) {
fp->pushback_len--; *(char *)data = fp->pushback_buf[
fp->pushback_len ]; return 1; } return fp->vptr->read(fp, data, len); }
extern __inline int input_getc(input_ty *fp) { if (fp->pushback_len >
0) { fp->pushback_len--; return fp->pushback_buf[ fp->pushback_len
]; } return fp->vptr->get(fp); }
extern __inline const char *input_name(input_ty *fp)
{ return fp->vptr->name(fp); }
extern __inline long input_length(input_ty *fp)
{ return fp->vptr->length(fp); }
extern __inline long input_ftell(input_ty *fp)
{ return fp->vptr->ftell(fp) - fp->pushback_len; }
#else /* !__GNUC__ */
#ifndef DEBUG
#define input_name(fp) ((fp)->vptr->name(fp))
#define input_length(fp) ((fp)->vptr->length(fp))
#define input_ftell(fp) ((fp)->vptr->ftell(fp) - (fp)->pushback_len)
#endif /* DEBUG */
#endif /* !__GNUC__ */
#endif /* COMMON_INPUT_H */
fhist-1.18/common/input/crlf.c 644 0 0 6356 11265752627 15543 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
typedef struct input_crlf_ty input_crlf_ty;
struct input_crlf_ty
{
input_ty inherited;
input_ty *fp;
long pos;
int delete_on_close;
};
static void
destruct(input_ty *p)
{
input_crlf_ty *this;
trace(("input_crlf::destruct()\n{\n"));
this = (input_crlf_ty *)p;
input_pushback_transfer(this->fp, p);
if (this->delete_on_close)
input_delete(this->fp);
this->fp = 0; /* paranoia */
trace(("}\n"));
}
static int
get(input_ty *p)
{
input_crlf_ty *this;
int c;
trace(("input_crlf::get()\n{\n"));
this = (input_crlf_ty *)p;
c = input_getc(this->fp);
if (c == '\r')
{
c = input_getc(this->fp);
if (c != '\n')
{
input_ungetc(this->fp, c);
c = '\r';
}
}
if (c >= 0)
this->pos++;
#ifdef DEBUG
if (c < 0)
trace(("return EOF;\n"));
else if (c >= ' ' && c <= '~')
trace(("return '%c';\n", c));
else
trace(("return 0x%02X;\n", c));
#endif
trace(("}\n"));
return c;
}
static long
itell(input_ty *fp)
{
input_crlf_ty *this;
this = (input_crlf_ty *)fp;
trace(("input_crlf::tell => %ld\n", this->pos));
return this->pos;
}
static const char *
name(input_ty *p)
{
input_crlf_ty *this;
trace(("input_crlf::name\n"));
this = (input_crlf_ty *)p;
return input_name(this->fp);
}
static long
length(input_ty *p)
{
trace(("input_crlf::length => -1\n"));
return -1;
}
static input_vtbl_ty vtbl =
{
sizeof(input_crlf_ty),
destruct,
input_generic_read,
get,
itell,
name,
length,
};
input_ty *
input_crlf(input_ty *fp, int delete_on_close)
{
input_ty *result;
input_crlf_ty *this;
trace(("input_crlf(fp = %08lX)\n{\n", (long)fp));
result = input_new(&vtbl);
this = (input_crlf_ty *)result;
this->fp = fp;
this->pos = 0;
this->delete_on_close = delete_on_close;
trace(("return %08lX\n", (long)result));
trace(("}\n"));
return result;
}
fhist-1.18/common/input/crlf.h 644 0 0 1706 11265752627 15542 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_INPUT_CRLF_H
#define COMMON_INPUT_CRLF_H
#include
input_ty *input_crlf(input_ty *, int);
#endif /* COMMON_INPUT_CRLF_H */
fhist-1.18/common/input/file.c 644 0 0 10606 11265752627 15545 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
typedef struct input_file_ty input_file_ty;
struct input_file_ty
{
input_ty inherited;
FILE *fp;
string_ty *fn;
int unlink_on_close;
long pos;
};
static void
destruct(input_ty *p)
{
input_file_ty *this;
this = (input_file_ty *)p;
fclose_and_check(this->fp, this->fn->str_text);
if (this->unlink_on_close)
unlink(this->fn->str_text);
str_free(this->fn);
this->fp = 0;
this->fn = 0;
}
static long
iread(input_ty *p, void *data, long len)
{
input_file_ty *this;
long result;
if (len < 0)
return 0;
this = (input_file_ty *)p;
result = fread(data, (size_t)1, (size_t)len, this->fp);
if (result <= 0 && ferror(this->fp))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_string(scp, "File_Name", this->fn);
fatal_intl(scp, i18n("read \"$filename\": $errno"));
/* NOTREACHED */
}
this->pos += result;
return result;
}
static int
get(input_ty *p)
{
input_file_ty *this;
int c;
this = (input_file_ty *)p;
c = getc(this->fp);
if (c == EOF && ferror(this->fp))
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_string(scp, "File_Name", this->fn);
fatal_intl(scp, i18n("read \"$filename\": $errno"));
/* NOTREACHED */
}
if (c != EOF)
this->pos++;
return c;
}
static long
itell(input_ty *p)
{
input_file_ty *this;
this = (input_file_ty *)p;
return this->pos;
}
static const char *
name(input_ty *p)
{
input_file_ty *this;
this = (input_file_ty *)p;
return this->fn->str_text;
}
static long
length(input_ty *p)
{
input_file_ty *this;
struct stat st;
int err;
this = (input_file_ty *)p;
#ifdef S_IFLNK
err = lstat(this->fn->str_text, &st);
#else
err = stat(this->fn->str_text, &st);
#endif
if (err < 0)
{
sub_context_ty *scp;
scp = sub_context_new();
sub_errno_set(scp);
sub_var_set_string(scp, "File_Name", this->fn);
fatal_intl(scp, i18n("stat \"$filename\": $errno"));
/* NOTREACHED */
}
return st.st_size;
}
static input_vtbl_ty vtbl =
{
sizeof(input_file_ty),
destruct,
iread,
get,
itell,
name,
length,
};
input_ty *
input_file_open(const char *fn)
{
input_ty *result;
input_file_ty *this;
if (!fn || !*fn)
return input_stdin();
result = input_new(&vtbl);
this = (input_file_ty *)result;
this->fp = fopen_and_check(fn, "rb");
this->fn = str_from_c(fn);
this->unlink_on_close = 0;
this->pos = 0;
return result;
}
void
input_file_unlink_on_close(input_ty *fp)
{
input_file_ty *this;
if (fp->vptr != &vtbl)
return;
this = (input_file_ty *)fp;
this->unlink_on_close = 1;
}
fhist-1.18/common/input/file.h 644 0 0 2054 11265752627 15530 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2004, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_INPUT_FILE_H
#define COMMON_INPUT_FILE_H
#include
#include
#include
input_ty *input_file_open(const char *);
void input_file_unlink_on_close(input_ty *);
#endif /* COMMON_INPUT_FILE_H */
fhist-1.18/common/input/file_text.c 644 0 0 1742 11265752627 16572 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
input_ty *
input_file_text_open(const char *fn)
{
return input_crlf(input_file_open(fn), 1);
}
fhist-1.18/common/input/file_text.h 644 0 0 1734 11265752627 16600 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_INPUT_FILE_TEXT_H
#define COMMON_INPUT_FILE_TEXT_H
#include
input_ty *input_file_text_open(const char *);
#endif /* COMMON_INPUT_FILE_TEXT_H */
fhist-1.18/common/input/hexify.c 644 0 0 7375 11265752627 16113 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include /* for sprintf */
#include
#include
#include
#include
typedef struct input_hexify_ty input_hexify_ty;
struct input_hexify_ty
{
input_ty inherited;
input_ty *deeper;
int delete_on_close;
int buf_pos;
char buffer[16];
};
static void
destruct(input_ty *p)
{
input_hexify_ty *this;
trace(("input_hexify::destruct()\n{\n"));
this = (input_hexify_ty *)p;
input_pushback_transfer(this->deeper, p);
if (this->delete_on_close)
input_delete(this->deeper);
this->deeper = 0; /* paranoia */
trace(("}\n"));
}
static int
get(input_ty *p)
{
input_hexify_ty *this;
int c;
trace(("input_hexify::get()\n{\n"));
this = (input_hexify_ty *)p;
if (this->buffer[this->buf_pos] == 0)
{
char *ctrl = "";
char *meta = "";
int c2;
c = input_getc(this->deeper);
if (c < 0)
{
trace(("return EOF;\n"));
return -1;
}
c2 = c;
if (c2 & 0x80)
{
meta = "M-";
c2 &= 0x7F;
}
if (!isprint(c2))
{
ctrl = "^";
c2 ^= 0x40;
}
sprintf(this->buffer, "0x%02X %s%s%c\n", c, meta, ctrl, c2);
this->buf_pos = 0;
}
c = this->buffer[this->buf_pos++];
trace(("return %d;\n", c));
trace(("}\n"));
return c;
}
static long
itell(input_ty *fp)
{
input_hexify_ty *this;
this = (input_hexify_ty *)fp;
trace(("input_hexify::tell => %ld\n", this->buf_pos));
return input_ftell(this->deeper);
}
static const char *
name(input_ty *p)
{
input_hexify_ty *this;
trace(("input_hexify::name\n"));
this = (input_hexify_ty *)p;
return input_name(this->deeper);
}
static long
length(input_ty *p)
{
trace(("input_hexify::length => -1\n"));
return -1;
}
static input_vtbl_ty vtbl =
{
sizeof(input_hexify_ty),
destruct,
input_generic_read,
get,
itell,
name,
length,
};
input_ty *
input_hexify(input_ty *deeper, int delete_on_close)
{
input_ty *result;
input_hexify_ty *this;
trace(("input_hexify(fp = %08lX)\n{\n", (long)deeper));
result = input_new(&vtbl);
this = (input_hexify_ty *)result;
this->deeper = deeper;
this->delete_on_close = delete_on_close;
this->buf_pos = 0;
this->buffer[0] = 0;
trace(("return %08lX\n", (long)result));
trace(("}\n"));
return result;
}
fhist-1.18/common/input/hexify.h 644 0 0 1716 11265752627 16111 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_INPUT_HEXIFY_H
#define COMMON_INPUT_HEXIFY_H
#include
input_ty *input_hexify(input_ty *, int);
#endif /* COMMON_INPUT_HEXIFY_H */
fhist-1.18/common/input/private.c 644 0 0 2640 11265752627 16257 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
input_ty *
input_new(input_vtbl_ty *vptr)
{
input_ty *result;
result = mem_alloc(vptr->size);
result->vptr = vptr;
result->pushback_buf = 0;
result->pushback_len = 0;
result->pushback_max = 0;
return result;
}
long
input_generic_read(input_ty *fp, void *data_v, long len)
{
char *data;
long result;
int c;
data = data_v;
for (result = 0; result < len; ++result)
{
c = fp->vptr->get(fp);
if (c < 0)
break;
*data++ = c;
}
return result;
}
fhist-1.18/common/input/private.h 644 0 0 2067 11265752627 16267 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#ifndef COMMON_INPUT_PRIVATE_H
#define COMMON_INPUT_PRIVATE_H
#include
input_ty *input_new(input_vtbl_ty *);
long input_generic_read(input_ty *, void *, long);
void input_pushback_transfer(input_ty *, input_ty *);
#endif /* COMMON_INPUT_PRIVATE_H */
fhist-1.18/common/input/pushba_trans.c 644 0 0 2036 11265752627 17275 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
void
input_pushback_transfer(input_ty *to, input_ty *from)
{
int j;
for (j = 0; j < from->pushback_len; ++j)
input_ungetc(to, from->pushback_buf[j]);
from->pushback_len = 0;
}
fhist-1.18/common/input/quotprinenco.c 644 0 0 14475 11265752627 17364 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* .
*/
#include
#include
#include
#include
typedef struct input_quoted_printable_encode_ty
input_quoted_printable_encode_ty;
struct input_quoted_printable_encode_ty
{
input_ty inherited;
input_ty *fp;
int state;
int c1;
int column;
int delete_on_close;
};
static void
destruct(input_ty *p)
{
input_quoted_printable_encode_ty *this;
trace(("input_quoted_printable_encode::destruct()\n{\n"));
this = (input_quoted_printable_encode_ty *)p;
input_pushback_transfer(this->fp, p);
if (this->delete_on_close)
input_delete(this->fp);
this->fp = 0; /* paranoia */
trace(("}\n"));
}
static int
hex(int n)
{
return "0123456789ABCDEF"[n & 15];
}
static int
get(input_ty *p)
{
input_quoted_printable_encode_ty *this;
int c;
trace(("input_quoted_printable_encode::get()\n{\n"));
this = (input_quoted_printable_encode_ty *)p;
switch (this->state)
{
case 1:
/*
* we have given half of a '=' '\n' sequence.
* Give the secoind byte, and resume normal
*/
c = '\n';
this->column = 0;
this->state = 0;
break;
case 3:
/*
* we have seen end of file without a newline
* we have sent '=', now send '\n'
*/
c = '\n';
this->state = 4;
break;
case 4:
/*
* we have seen end of file
*/
c = -1;
break;
case 5:
/*
* we have seen a newline
* following end of file does NOT need a '=' '\n' sequence
*/
c = input_getc(this->fp);
if (c < 0)
{
this->state = 4;
break;
}
this->state = 0;
goto normal;
case 6:
/*
* we have seen an unprintable character
* we have sent the '=' synbol
* now send the first hex byte
*/
c = hex(this->c1 >> 4);
this->state = 7;
break;
case 7:
/*
* we have seen an unprintable character
* we have sent the '=' synbol
* we have sent the first hex byte
* now send the second hex byte
* and the resume normal processing
*/
c = hex(this->c1);
this->state = 0;
break;
default:
/*
* Normal processing.
* Actually case 0, but this cobvers a multitude of sins.
*/
if (this->column >= 500)
{
c = '=';
this->state = 1;
break;
}
c = input_getc(this->fp);
if (c < 0)
{
this->state = 3;
this->column = 0;
c = '=';
break;
}
normal:
if (c == '\n')
{
this->column = 0;
this->state = 5;
break;
}
if (c == '\t')
{
this->column = (this->column + 8) & 7;
break;
}
if (c == 0 || c == '=' || c == '\r')
{
this->column += 3;
this->c1 = c;
this->state = 6;
c = '=';
break;
}
this->column++;
break;
}
trace(("}\n"));
return c;
}
static long
itell(input_ty *fp)
{
input_quoted_printable_encode_ty *this;
this = (input_quoted_printable_encode_ty *)fp;
return input_ftell(this->fp);
}
static const char *
name(input_ty *p)
{
input_quoted_printable_encode_ty *this;
trace(("input_quoted_printable_encode::name\n"));
this = (input_quoted_printable_encode_ty *)p;
return input_name(this->fp);
}
static long
length(input_ty *p)
{
trace(("input_quoted_printable_encode::length => -1\n"));
return -1;
}
static input_vtbl_ty vtbl =
{
sizeof(input_quoted_printable_encode_ty),
destruct,
input_generic_read,
get,
itell,
name,
length,
};
input_ty *
input_quoted_printable_encode(input_ty *fp, int delete_on_close)
{
input_ty *result;
input_quoted_printable_encode_ty *this;
trace(("input_quoted_printable_encode(fp = %08lX)\n{\n", (long)fp));
result = input_new(&vtbl);
this = (input_quoted_printable_encode_ty *)result;
this->fp = fp;
this->column = 0;
this->state = 0;
this->c1 = 0;
this->delete_on_close = delete_on_close;
trace(("return %08lX\n", (long)result));
trace(("}\n"));
return result;
}
fhist-1.18/common/input/quotprinenco.h 644 0 0 1761 11265752627 17343 0 ustar Peter Miller 0 0 /*
* fhist - file history and comparison tools
* Copyright (C) 2000, 2002, 2008 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
*