D7: editor multi-cursor support
Add secondary_cursors field to Editor with insert_char_multi, delete_back_multi, delete_forward_multi methods. Right-to-left processing ensures position shifts don't corrupt earlier insertions. 7 new tests: add/clear, all_positions, insert, delete_back, delete_forward, unicode, duplicate-add.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
3.6
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
GNU diff was written by Paul Eggert, Mike Haertel, David Hayes,
|
||||
Richard Stallman, and Len Tower.
|
||||
|
||||
GNU diff3 was written by Randy Smith.
|
||||
|
||||
GNU sdiff was written by Thomas Lord.
|
||||
|
||||
GNU cmp was written by Torbjorn Granlund and David MacKenzie.
|
||||
|
||||
The diffutils manual was written by David MacKenzie, Paul Eggert, and
|
||||
Richard Stallman. Parts are adapted by from a manual page written by
|
||||
Larry Wall, with his permission.
|
||||
|
||||
Many other people have contributed to GNU diffutils, including Wayne
|
||||
Davison, Patrick D'Cruze, F. Thomas May, Greg McGary, Chip Rosenthal,
|
||||
and Eli Zaretskii.
|
||||
|
||||
The following contributions warranted legal paper exchanges with the
|
||||
Free Software Foundation. Also see the files ChangeLog and THANKS.
|
||||
|
||||
Leonard H. Tower Jr.
|
||||
Torbjorn Granlund
|
||||
Mike Haertel
|
||||
David S. Hayes
|
||||
Randall Smith
|
||||
Richard Stallman
|
||||
F. Thomas May
|
||||
Wayne Davison
|
||||
Paul R. Eggert
|
||||
Chip Rosenthal
|
||||
Wayne Davison
|
||||
Patrick D'Cruze
|
||||
Eli Zaretskii
|
||||
|
||||
|
||||
Copyright (C) 2001, 2006, 2009-2013, 2015-2017 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU diffutils.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
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 programs, 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
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting 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 versions
|
||||
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
|
||||
modification 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
|
||||
"recipients" 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
|
||||
permission, 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 conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature 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 prominent 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
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window 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
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs 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
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission 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 facilities 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
|
||||
measure 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 circumvention
|
||||
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
|
||||
appropriately 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 permission 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
|
||||
Corresponding 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
|
||||
written 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 customarily 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
|
||||
alternative 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
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding 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
|
||||
Corresponding 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 incorporation
|
||||
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 particular 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,
|
||||
procedures, 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
|
||||
modification 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 recipient, 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
|
||||
documented (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.
|
||||
Additional 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 permissions 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
|
||||
reasonable 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
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further 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
|
||||
provided 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
|
||||
paragraph 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
|
||||
occurring 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
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent 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
|
||||
arrangement, 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 business 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
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined 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
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
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 CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
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
|
||||
Program, 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 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, 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
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,127 @@
|
||||
# Having a separate GNUmakefile lets me 'include' the dynamically
|
||||
# generated rules created via cfg.mk (package-local configuration)
|
||||
# as well as maint.mk (generic maintainer rules).
|
||||
# This makefile is used only if you run GNU Make.
|
||||
# It is necessary if you want to build targets usually of interest
|
||||
# only to the maintainer.
|
||||
|
||||
# Copyright (C) 2001, 2003, 2006-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# If the user runs GNU make but has not yet run ./configure,
|
||||
# give them a diagnostic.
|
||||
_gl-Makefile := $(wildcard [M]akefile)
|
||||
ifneq ($(_gl-Makefile),)
|
||||
|
||||
# Make tar archive easier to reproduce.
|
||||
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
|
||||
|
||||
# Allow the user to add to this in the Makefile.
|
||||
ALL_RECURSIVE_TARGETS =
|
||||
|
||||
include Makefile
|
||||
|
||||
# Some projects override e.g., _autoreconf here.
|
||||
-include $(srcdir)/cfg.mk
|
||||
|
||||
# Allow cfg.mk to override these.
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf -v
|
||||
|
||||
include $(srcdir)/maint.mk
|
||||
|
||||
# Ensure that $(VERSION) is up to date for dist-related targets, but not
|
||||
# for others: rerunning autoreconf and recompiling everything isn't cheap.
|
||||
_have-git-version-gen := \
|
||||
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
|
||||
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
|
||||
_is-dist-target ?= $(filter-out %clean, \
|
||||
$(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
|
||||
_is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
|
||||
ifneq (,$(_is-dist-target)$(_is-install-target))
|
||||
_curr-ver := $(shell cd $(srcdir) \
|
||||
&& $(_build-aux)/git-version-gen \
|
||||
.tarball-version \
|
||||
$(git-version-gen-tag-sed-script))
|
||||
ifneq ($(_curr-ver),$(VERSION))
|
||||
ifeq ($(_curr-ver),UNKNOWN)
|
||||
$(info WARNING: unable to verify if $(VERSION) is the correct version)
|
||||
else
|
||||
ifneq (,$(_is-install-target))
|
||||
# GNU Coding Standards state that 'make install' should not cause
|
||||
# recompilation after 'make all'. But as long as changing the version
|
||||
# string alters config.h, the cost of having 'make all' always have an
|
||||
# up-to-date version is prohibitive. So, as a compromise, we merely
|
||||
# warn when installing a version string that is out of date; the user
|
||||
# should run 'autoreconf' (or something like 'make distcheck') to
|
||||
# fix the version, 'make all' to propagate it, then 'make install'.
|
||||
$(info WARNING: version string $(VERSION) is out of date;)
|
||||
$(info run '$(MAKE) _version' to fix it)
|
||||
else
|
||||
$(info INFO: running autoreconf for new version string: $(_curr-ver))
|
||||
GNUmakefile: _version
|
||||
touch GNUmakefile
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: _version
|
||||
_version:
|
||||
cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
|
||||
$(MAKE) $(AM_MAKEFLAGS) Makefile
|
||||
|
||||
else
|
||||
|
||||
.DEFAULT_GOAL := abort-due-to-no-makefile
|
||||
srcdir = .
|
||||
|
||||
# The package can override .DEFAULT_GOAL to run actions like autoreconf.
|
||||
-include ./cfg.mk
|
||||
|
||||
# Allow cfg.mk to override these.
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf -v
|
||||
|
||||
include ./maint.mk
|
||||
|
||||
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
|
||||
$(MAKECMDGOALS): abort-due-to-no-makefile
|
||||
endif
|
||||
|
||||
abort-due-to-no-makefile:
|
||||
@echo There seems to be no Makefile in this directory. 1>&2
|
||||
@echo "You must run ./configure before running 'make'." 1>&2
|
||||
@exit 1
|
||||
|
||||
endif
|
||||
|
||||
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||
# directory in parallel, in case someone tries to build multiple
|
||||
# targets, and one of them can cause a recursive target to be invoked.
|
||||
|
||||
# Only set this if Automake doesn't provide it.
|
||||
AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) \
|
||||
dist distcheck tags ctags
|
||||
|
||||
ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
|
||||
|
||||
ifneq ($(word 2, $(MAKECMDGOALS)), )
|
||||
ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
endif
|
||||
@@ -0,0 +1,368 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
||||
@@ -0,0 +1,58 @@
|
||||
# Main Automakefile for GNU diffutils.
|
||||
|
||||
# Copyright (C) 2001-2002, 2004, 2006, 2009-2013, 2015-2017 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
ALL_RECURSIVE_TARGETS =
|
||||
|
||||
EXTRA_DIST = bootstrap exgettext ChangeLog-2008 cfg.mk dist-check.mk
|
||||
SUBDIRS = lib src tests doc man po gnulib-tests
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
# Arrange so that .tarball-version appears only in the distribution
|
||||
# tarball, and never in a checked-out repository.
|
||||
dist-hook: gen-ChangeLog
|
||||
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
gen_start_date = '2009-11-11 15:00'
|
||||
.PHONY: gen-ChangeLog
|
||||
gen-ChangeLog:
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||
--since=$(gen_start_date) > $(distdir)/cl-t && \
|
||||
{ rm -f $(distdir)/ChangeLog && \
|
||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; } \
|
||||
fi
|
||||
|
||||
ALL_RECURSIVE_TARGETS += distcheck-hook
|
||||
distcheck-hook:
|
||||
$(MAKE) my-distcheck
|
||||
|
||||
# Some of our git hook scripts are supposed to be identical to git's samples.
|
||||
# See if they are still in sync.
|
||||
.PHONY: check-git-hook-script-sync
|
||||
check-git-hook-script-sync:
|
||||
@fail=0; \
|
||||
t=$$(mktemp -d) \
|
||||
&& cd $$t && git init -q && cd .git/hooks \
|
||||
&& for i in pre-commit pre-applypatch applypatch-msg; do \
|
||||
diff -u $(abs_top_srcdir)/scripts/git-hooks/$$i $$i.sample \
|
||||
|| fail=1; \
|
||||
done; \
|
||||
rm -rf $$t; \
|
||||
test $$fail = 0
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,423 @@
|
||||
GNU diffutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 3.6 (2017-05-21) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
When one file is a prefix of the other, cmp now appends the shorter
|
||||
file's size to the EOF diagnostic.
|
||||
|
||||
** Bug fixes
|
||||
|
||||
Using an invalid regular expression with --ignore-matching-lines=RE (-I)
|
||||
no longer causes stack overflow. Before, with an invocation like the
|
||||
following, diff would diagnose the error, but would still proceed to
|
||||
blow the stack: diff -Ia -I\\ <(echo) <(echo b)
|
||||
[bug introduced in 2.9]
|
||||
|
||||
diff no longer mishandles line numbers exceeding 2**31 on Mingw-w64.
|
||||
|
||||
the ---presume-output-tty (ostensibly test-only) option would cause
|
||||
diff --color to read an uninitialized variable
|
||||
[bug introduced in 3.4]
|
||||
|
||||
** Performance changes
|
||||
|
||||
diff's default algorithm has been tweaked to deal better with larger
|
||||
files, reversing some of the changes made in diffutils-3.4.
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.5 (2016-08-20) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
diff3 no longer malfunctions due to use-after-free
|
||||
[bug introduced in 3.4]
|
||||
|
||||
diff --color no longer colorizes when TERM=dumb
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.4 (2016-08-08) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
diff accepts two new options --color and --palette to generate
|
||||
and configure colored output. --color takes an optional argument
|
||||
specifying when to colorize a line: --color=always, --color=auto,
|
||||
--color=never. --palette is used to configure which colors are used.
|
||||
|
||||
** Bug fixes
|
||||
|
||||
When binary files differ, diff now exits with status 1 as POSIX requires.
|
||||
Formerly it exited with status 2.
|
||||
|
||||
Unless the --ignore-file-name-case option is used, diff now
|
||||
considers file names to be equal only if they are byte-for-byte
|
||||
equivalent. This fixes a bug where diff in an English locale might
|
||||
consider two Asian file names to be the same merely because they
|
||||
contain no English characters.
|
||||
|
||||
diff -B no longer generates incorrect output if the two inputs
|
||||
each end with a one-byte incomplete line.
|
||||
|
||||
diff --brief no longer reports a difference for unusual identical files.
|
||||
For example, when comparing a file like /proc/cmdline (for which the linux
|
||||
kernel reports st_size of 0 even though it is not an empty file) to a
|
||||
copy of that file's contents residing on a "normal" file system:
|
||||
$ f=/proc/cmdline; cp $f k; diff --brief $f k
|
||||
Files /proc/cmdline and k differ
|
||||
|
||||
** Performance changes
|
||||
|
||||
diff's default algorithm has been adjusted to output higher-quality
|
||||
results at somewhat greater computational cost, as CPUs have gotten
|
||||
faster since the algorithm was last tweaked in diffutils-2.6 (1993).
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.3 (2013-03-24) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
diff accepts a new option, --no-dereference. With this option, symbolic
|
||||
links are treated specially: as a separate type of file that can compare
|
||||
equal only to another symbolic link with the same value. For example,
|
||||
with --no-dereference, two symbolic links compare equal when they have
|
||||
the same value, even when that value does not reference a readable file.
|
||||
|
||||
--new-file (-N) and --unidirectional-new-file now allow comparisons to "-".
|
||||
A standard input that's closed acts like a nonexistent file.
|
||||
|
||||
A file name containing spaces, double quotes, backslashes or control
|
||||
characters is now encoded in a diff header as a double-quoted C string
|
||||
literal. The escape sequences \\, \", \a, \b, \f, \n, \r, \t, \v and
|
||||
\ooo (a three-digit octal number between 0 and 255) are used.
|
||||
|
||||
** Packaging
|
||||
|
||||
diffutils is now designed to build with Cygwin or MinGW rather than DJGPP.
|
||||
The ms subdirectory has been removed.
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.2 (2011-09-02) [stable]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
--ignore-file-name-case now applies at the top level too.
|
||||
For example, "diff dir inIt" might compare "dir/Init" to "inIt".
|
||||
|
||||
** New features
|
||||
|
||||
diff and sdiff have a new option --ignore-trailing-space (-Z).
|
||||
|
||||
** Packaging
|
||||
|
||||
The texinfo documentation no longer specifies "front-cover" or "back-cover"
|
||||
texts, so that it may now be included in Debian's "main" section.
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.1 (2011-08-10) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
diff no longer reports spurious differences merely because two entries
|
||||
in the same directory have names that compare equal in the current
|
||||
locale, or compare equal because --ignore-file-name-case was given.
|
||||
|
||||
* Noteworthy changes in release 3.0 (2010-05-03) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
diff once again prints the required "\ No newline at end of file" line
|
||||
when at least one input lacks a newline-at-EOF and the final hunk plus
|
||||
context-length aligns exactly with the end of the newline-lacking file.
|
||||
[bug introduced between 2.8.7 and 2.9]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
In context-style diffs, diff prints a portion of a preceding "function"
|
||||
line for each hunk, with --show-function-line=RE (-F) or
|
||||
--show-c-function (-p). Now, it trims leading blanks from such lines
|
||||
before extracting a prefix. This is useful especially when a function
|
||||
line is so far indented that the name itself would be truncated or not
|
||||
included in the limited-width substring that diff appends.
|
||||
|
||||
diff once again reports a difference with the diagnostic
|
||||
"Binary files A and B differ" when at least one of the files
|
||||
appears to be binary. From 2.8.4 through diffutils-2.9, it printed
|
||||
"Files A and B differ".
|
||||
|
||||
|
||||
* Noteworthy changes in release 2.9 (2010-02-11) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
New diff option --suppress-blank-empty.
|
||||
|
||||
Bring back support for 'diff -NUM', where NUM is a number,
|
||||
even when conforming to POSIX 1003.1-2001. This change reverts to
|
||||
the behavior of GNU diff 2.7 and earlier. This is a change only
|
||||
when conforming to POSIX 1003.1-2001; there is no effect when
|
||||
conforming to older POSIX versions.
|
||||
|
||||
This change is in response to decisions taken in the January 2005
|
||||
Austin Group standardization meeting. For more details, please see
|
||||
"Utility Syntax Guidelines" in the Minutes of the January 2005
|
||||
Meeting <http://www.opengroup.org/austin/docs/austin_239.html>.
|
||||
|
||||
sdiff now understands '1' and '2' as synonyms for 'l' and 'r'.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
sdiff and diff3 now invoke diff, not $(bindir)/diff
|
||||
|
||||
** Administrivia
|
||||
|
||||
New discussion and bug-reporting address: bug-diffutils@gnu.org
|
||||
|
||||
updated gnulib support
|
||||
|
||||
|
||||
* Noteworthy changes in release 2.8.7 (2004-04-13) [stable]
|
||||
|
||||
Version 2.8.7 contains no user-visible changes.
|
||||
|
||||
User-visible changes in version 2.8.6:
|
||||
|
||||
* New diff3 option --strip-trailing-cr.
|
||||
|
||||
* With -N and -P, inaccessible empty regular files (the kind of files
|
||||
that 'patch' creates to indicate nonexistent backups) are now
|
||||
treated as nonexistent when they are in the 'backup' file position.
|
||||
|
||||
* If multiple SKIP values are given to cmp, e.g., 'cmp -i 10 -i 20',
|
||||
cmp now uses the maximal value instead of the last one.
|
||||
|
||||
* diff now omits the ".000000000" on hosts that do not support
|
||||
fractional timestamps.
|
||||
|
||||
Version 2.8.5 was not publicly released.
|
||||
|
||||
User-visible changes in version 2.8.4:
|
||||
|
||||
* Diff now simply prints "Files A and B differ" instead of "Binary
|
||||
files A and B differ". The message is output if either A or B
|
||||
appears to be a binary file, and the old wording was misleading
|
||||
because it implied that both files are binary, which is not
|
||||
necessarily the case.
|
||||
|
||||
User-visible changes in version 2.8.3:
|
||||
|
||||
* New locale: en_US.
|
||||
|
||||
User-visible changes in version 2.8.2:
|
||||
|
||||
* New diff and sdiff option:
|
||||
--tabsize=COLUMNS
|
||||
* If --ignore-space-change or --ignore-all-space is also specified,
|
||||
--ignore-blank-lines now considers lines to be empty if they contain
|
||||
only white space.
|
||||
* More platforms now handle multibyte characters correctly when
|
||||
excluding files by name (diff -x and -X).
|
||||
* New locales: hu, pt_BR.
|
||||
|
||||
User-visible changes in version 2.8.1:
|
||||
|
||||
* Documentation fixes.
|
||||
|
||||
User-visible changes in version 2.8:
|
||||
|
||||
* cmp and diff now conform to POSIX 1003.1-2001 (IEEE Std 1003.1-2001)
|
||||
if the underlying system conforms to POSIX and if the _POSIX2_VERSION
|
||||
environment variable is set to 200112. Conformance removes support
|
||||
for 'diff -NUM', where NUM is a number. Use -C NUM or -U NUM instead.
|
||||
* cmp now supports trailing operands SKIP1 and SKIP2, like BSD cmp.
|
||||
* cmp -i or --ignore-initial now accepts SKIP1:SKIP2 option value.
|
||||
* New cmp option: -n or --bytes.
|
||||
* cmp's old -c or --print-chars option has been renamed;
|
||||
use -b or --print-bytes instead.
|
||||
* cmp now outputs "byte" rather than "char" outside the POSIX locale.
|
||||
* cmp -l's index column width now adjusts to fit larger (or smaller) files.
|
||||
* cmp -l -s and cmp -s -l are not allowed. Use cmp -s or cmp -l instead.
|
||||
* diff uses ISO 8601 style timestamps for output times (e.g. "2001-11-23
|
||||
16:44:36.875702460 -0800") unless in the C or POSIX locale and the
|
||||
-c style is specified.
|
||||
* diff's -I and -F options use the regexp syntax of grep, not of Emacs.
|
||||
* diff now accepts multiple context arguments, and uses their maximum value.
|
||||
* New diff and sdiff options:
|
||||
-E --ignore-tab-expansion
|
||||
--strip-trailing-cr
|
||||
* New diff options:
|
||||
--from-file=FILE, --to-file=FILE
|
||||
--ignore-file-name-case
|
||||
--no-ignore-file-name-case
|
||||
* New diff3 and sdiff option:
|
||||
--diff-program=PROGRAM
|
||||
* The following diff options are still accepted, but are no longer documented.
|
||||
They may be withdrawn in future releases.
|
||||
-h (omit; it has no effect)
|
||||
-H (use --speed-large-files instead)
|
||||
-L (use --label instead)
|
||||
-P (use --unidirectional-new-file instead)
|
||||
--inhibit-hunk-merge (omit; it has no effect)
|
||||
* Recursive diffs now sort file names according to the LC_COLLATE locale
|
||||
category if possible, instead of using native byte comparison.
|
||||
* Recursive diffs now detect and report directory loops.
|
||||
* Diff printf specs can now use the "0" and "'" flags.
|
||||
* The new sdiff interactive command 'ed' precedes each version with a header.
|
||||
* On 64-bit hosts, files larger than 2 GB can be compared.
|
||||
* Some internationalization support has been added, but multibyte locales
|
||||
are still not completely supported yet.
|
||||
* Some diagnostics have been reworded slightly for consistency.
|
||||
Also, 'diff -D FOO' now outputs '/* ! FOO */' instead of '/* not FOO */'.
|
||||
* The 'patch' part of the manual now describes 'patch' version 2.5.4.
|
||||
* Man pages are now distributed and installed.
|
||||
* There is support for DJGPP; see the 'ms' subdirectory and the files
|
||||
m4/dos.m4 and */setmode.*.
|
||||
|
||||
|
||||
User-visible changes in version 2.7:
|
||||
|
||||
* New diff option: --binary (useful only on non-POSIX hosts)
|
||||
* diff -b and -w now ignore line incompleteness; -B no longer does this.
|
||||
* cmp -c now uses locale to decide which output characters to quote.
|
||||
* Help and version messages are reorganized.
|
||||
|
||||
|
||||
User-visible changes in version 2.6:
|
||||
|
||||
* New cmp, diff, diff3, sdiff option: --help
|
||||
* A new heuristic for diff greatly reduces the time needed to compare
|
||||
large input files that contain many differences.
|
||||
* Partly as a result, GNU diff's output is not exactly the same as before.
|
||||
Usually it is a bit smaller, but sometimes it is a bit larger.
|
||||
|
||||
|
||||
User-visible changes in version 2.5:
|
||||
|
||||
* New cmp option: -v --version
|
||||
|
||||
|
||||
User-visible changes in version 2.4:
|
||||
|
||||
* New cmp option: --ignore-initial=BYTES
|
||||
* New diff3 option: -T --initial-tab
|
||||
* New diff option: --line-format=FORMAT
|
||||
* New diff group format specifications:
|
||||
<PRINTF_SPEC>[eflmnEFLMN]
|
||||
A printf spec followed by one of the following letters
|
||||
causes the integer corresponding to that letter to be
|
||||
printed according to the printf specification.
|
||||
E.g. '%5df' prints the number of the first line in the
|
||||
group in the old file using the "%5d" format.
|
||||
e: line number just before the group in old file; equals f - 1
|
||||
f: first line number in group in the old file
|
||||
l: last line number in group in the old file
|
||||
m: line number just after the group in old file; equals l + 1
|
||||
n: number of lines in group in the old file; equals l - f + 1
|
||||
E, F, L, M, N: likewise, for lines in the new file
|
||||
%(A=B?T:E)
|
||||
If A equals B then T else E. A and B are each either a decimal
|
||||
constant or a single letter interpreted as above. T and E are
|
||||
arbitrary format strings. This format spec is equivalent to T if
|
||||
A's value equals B's; otherwise it is equivalent to E. For
|
||||
example, '%(N=0?no:%dN) line%(N=1?:s)' is equivalent to 'no lines'
|
||||
if N (the number of lines in the group in the new file) is 0,
|
||||
to '1 line' if N is 1, and to '%dN lines' otherwise.
|
||||
%c'C'
|
||||
where C is a single character, stands for the character C. C may not
|
||||
be a backslash or an apostrophe. E.g. %c':' stands for a colon.
|
||||
%c'\O'
|
||||
where O is a string of 1, 2, or 3 octal digits, stands for the
|
||||
character with octal code O. E.g. %c'\0' stands for a null character.
|
||||
* New diff line format specifications:
|
||||
<PRINTF_SPEC>n
|
||||
The line number, printed with <PRINTF_SPEC>.
|
||||
E.g. '%5dn' prints the line number with a "%5d" format.
|
||||
%c'C'
|
||||
%c'\O'
|
||||
The character C, or with octal code O, as above.
|
||||
* Supported <PRINTF_SPEC>s have the same meaning as with printf, but must
|
||||
match the extended regular expression %-*[0-9]*(\.[0-9]*)?[doxX].
|
||||
* The format spec %0 introduced in version 2.1 has been removed, since it
|
||||
is incompatible with printf specs like %02d. To represent a null char,
|
||||
use %c'\0' instead.
|
||||
* cmp and diff now conform to POSIX 1003.2-1992 (ISO/IEC 9945-2:1993)
|
||||
if the underlying system conforms to POSIX:
|
||||
- Some messages' wordings are changed in minor ways.
|
||||
- "White space" is now whatever C's 'isspace' says it is.
|
||||
- When comparing directories, if 'diff' finds a file that is not a regular
|
||||
file or a directory, it reports the file's type instead of diffing it.
|
||||
(As usual, it follows symbolic links first.)
|
||||
- When signaled, sdiff exits with the signal's status, not with status 2.
|
||||
* Now portable to hosts where int, long, pointer, etc. are not all the same
|
||||
size.
|
||||
* 'cmp - -' now works like 'diff - -'.
|
||||
|
||||
|
||||
User-visible changes in version 2.3:
|
||||
|
||||
* New diff option: --horizon-lines=lines
|
||||
|
||||
|
||||
User-visible changes in version 2.1:
|
||||
|
||||
* New diff options:
|
||||
--{old,new,unchanged}-line-format='format'
|
||||
--{old,new,unchanged,changed}-group-format='format'
|
||||
-U
|
||||
* New diff3 option:
|
||||
-A --show-all
|
||||
* diff3 -m now defaults to -A, not -E.
|
||||
* diff3 now takes up to three -L or --label options, not just two.
|
||||
If just two options are given, they refer to the first two input files,
|
||||
not the first and third input files.
|
||||
* sdiff and diff -y handle incomplete lines.
|
||||
|
||||
|
||||
User-visible changes in version 2.0:
|
||||
|
||||
* Add sdiff and cmp programs.
|
||||
* Add Texinfo documentation.
|
||||
* Add configure script.
|
||||
* Improve diff performance.
|
||||
* New diff options:
|
||||
-x --exclude
|
||||
-X --exclude-from
|
||||
-P --unidirectional-new-file
|
||||
-W --width
|
||||
-y --side-by-side
|
||||
--left-column
|
||||
--sdiff-merge-assist
|
||||
--suppress-common-lines
|
||||
* diff options renamed:
|
||||
--label renamed from --file-label
|
||||
--forward-ed renamed from --reversed-ed
|
||||
--paginate renamed from --print
|
||||
--entire-new-file renamed from --entire-new-files
|
||||
--new-file renamed from --new-files
|
||||
--all-text removed
|
||||
* New diff3 options:
|
||||
-v --version
|
||||
* Add long-named equivalents for other diff3 options.
|
||||
* diff options -F (--show-function-line) and -I (--ignore-matching-lines)
|
||||
can now be given more than once.
|
||||
|
||||
|
||||
|
||||
Copyright (C) 1993-1994, 1998, 2001-2002, 2004, 2006, 2009-2013, 2015-2017 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Diffutils.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,64 @@
|
||||
README for GNU DIFF
|
||||
|
||||
This directory contains the GNU diff, diff3, sdiff, and cmp utilities.
|
||||
Their features are a superset of the Unix features and they are
|
||||
significantly faster.
|
||||
|
||||
Please see the file COPYING for copying conditions.
|
||||
|
||||
Please see the file doc/version.texi for version information.
|
||||
|
||||
Please see the file doc/diffutils.texi (or doc/diffutils.info) for
|
||||
documentation that can be printed with TeX, or read with the 'info'
|
||||
program or with Emacs's 'M-x info'. Brief man pages are in man/*,
|
||||
but they are no substitute for the documentation.
|
||||
|
||||
Please see the file ABOUT-NLS for notes about translations.
|
||||
|
||||
Please see the file INSTALL for generic compilation and installation
|
||||
instructions. Briefly, you can run "./configure; make install". The
|
||||
command "./configure --help" lists the supported --enable and --with
|
||||
options.
|
||||
|
||||
If you have a problem with internationalization, you might be able to
|
||||
work around it as described in ABOUT-NLS by invoking './configure
|
||||
--disable-nls'. Many of the problems arise from dynamic linking
|
||||
issues on non-GNU platforms (e.g. with the iconv library). Such
|
||||
problems tend to be shared by other GNU applications on these
|
||||
platforms, and can usually be fixed by carefully tweaking your non-GNU
|
||||
installation. If you have an older version of libiconv, please
|
||||
upgrade to the latest one; see <ftp://ftp.gnu.org/gnu/libiconv/>. If
|
||||
the problem seems isolated to diffutils, though, please report a bug.
|
||||
|
||||
This program requires a Standard C compiler (C89 or later). If you
|
||||
have a nonstandard compiler, please install GCC first.
|
||||
|
||||
If you make changes to the source code, you may need appropriate
|
||||
versions of GNU build tools to regenerate the intermediate files. The
|
||||
following versions were used to generate the intermediate files in
|
||||
this distribution:
|
||||
|
||||
* Autoconf 2.59 <ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.59.tar.gz>
|
||||
* Automake 1.8.3 <ftp://ftp.gnu.org/gnu/automake/automake-1.8.3.tar.gz>
|
||||
* gettext 0.14.1 <ftp://ftp.gnu.org/gnu/gettext/gettext-0.14.1.tar.gz>
|
||||
* help2man 1.33 <ftp://ftp.gnu.org/gnu/help2man/help2man-1.33.1.tar.gz>
|
||||
* Texinfo 4.7 <ftp://ftp.gnu.org/gnu/texinfo/texinfo-4.7.tar.gz>
|
||||
|
||||
For any copyright year range specified as YYYY-ZZZZ in this package
|
||||
note that the range specifies every single year in that closed interval.
|
||||
|
||||
Please report bugs to <bug-diffutils@gnu.org>.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1992, 1998, 2001-2002, 2004, 2009-2013, 2015-2017 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of GNU Diffutils.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
@@ -0,0 +1,23 @@
|
||||
Thanks to all the following for their contributions to GNU diffutils:
|
||||
|
||||
Thomas Bushnell, BSG <tb@becket.net>
|
||||
Wayne Davison <wayne@opencoder.net>
|
||||
Ulrich Drepper <drepper@redhat.com>
|
||||
Paul Eggert <eggert@cs.ucla.edu>
|
||||
Jay Fenlason <fenlason@redhat.com>
|
||||
John Gilmore <gnu@toad.com>
|
||||
Torbjorn Granlund <tege@swox.com>
|
||||
Mike Haertel <mike@ichips.intel.com>
|
||||
Bruno Haible <haible@clisp.org>
|
||||
Chris Hanson <cph@gnu.org>
|
||||
Jim Kingdon <kingdon@panix.com>
|
||||
Tom Lord <lord@gnu.org>
|
||||
David J. MacKenzie <djm@gnu.org>
|
||||
Roland McGrath <roland@redhat.com>
|
||||
Jim Meyering <jim@meyering.net>
|
||||
Gene Myers <gene@eecs.berkeley.edu>
|
||||
Randy Smith <randy@gnu.org>
|
||||
Richard Stallman <rms@gnu.org>
|
||||
Leonard H. Tower Jr. <tower@art.net>
|
||||
Larry Wall <larry@wall.org>
|
||||
Eli Zaretskii <eliz@gnu.org>
|
||||
@@ -0,0 +1,9 @@
|
||||
Add --include option (opposite of --exclude).
|
||||
|
||||
Look into sdiff improvement here:
|
||||
http://www.pkix.net/~chuck/sdiff2.diff
|
||||
|
||||
Propagate stderr from subprocess so that diff3 does
|
||||
a better job of explaining _why_:
|
||||
> $ diff3 /bin/sh /bin/false /bin/mv
|
||||
> diff3: subsidiary program 'diff' failed (exit status 2)
|
||||
+1512
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,918 @@
|
||||
# This file was generated by Autom4te 2.72.
|
||||
# It contains the lists of macros which have been traced.
|
||||
# It can be safely removed.
|
||||
|
||||
@request = (
|
||||
bless( [
|
||||
'0',
|
||||
1,
|
||||
[
|
||||
'/usr/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/share/autoconf/autoconf/autoconf.m4f',
|
||||
'/usr/share/aclocal-1.18/internal/ac-config-macro-dirs.m4',
|
||||
'/usr/share/aclocal-1.18/amversion.m4',
|
||||
'/usr/share/aclocal-1.18/auxdir.m4',
|
||||
'/usr/share/aclocal-1.18/cond.m4',
|
||||
'/usr/share/aclocal-1.18/depend.m4',
|
||||
'/usr/share/aclocal-1.18/depout.m4',
|
||||
'/usr/share/aclocal-1.18/init.m4',
|
||||
'/usr/share/aclocal-1.18/install-sh.m4',
|
||||
'/usr/share/aclocal-1.18/lead-dot.m4',
|
||||
'/usr/share/aclocal-1.18/make.m4',
|
||||
'/usr/share/aclocal-1.18/missing.m4',
|
||||
'/usr/share/aclocal-1.18/mkdirp.m4',
|
||||
'/usr/share/aclocal-1.18/options.m4',
|
||||
'/usr/share/aclocal-1.18/prog-cc-c-o.m4',
|
||||
'/usr/share/aclocal-1.18/rmf.m4',
|
||||
'/usr/share/aclocal-1.18/runlog.m4',
|
||||
'/usr/share/aclocal-1.18/sanity.m4',
|
||||
'/usr/share/aclocal-1.18/silent.m4',
|
||||
'/usr/share/aclocal-1.18/strip.m4',
|
||||
'/usr/share/aclocal-1.18/substnot.m4',
|
||||
'/usr/share/aclocal-1.18/tar.m4',
|
||||
'/usr/share/aclocal-1.18/xargsn.m4',
|
||||
'm4/00gnulib.m4',
|
||||
'm4/absolute-header.m4',
|
||||
'm4/alloca.m4',
|
||||
'm4/arpa_inet_h.m4',
|
||||
'm4/btowc.m4',
|
||||
'm4/builtin-expect.m4',
|
||||
'm4/c-stack.m4',
|
||||
'm4/clock_time.m4',
|
||||
'm4/close.m4',
|
||||
'm4/codeset.m4',
|
||||
'm4/config-h.m4',
|
||||
'm4/configmake.m4',
|
||||
'm4/ctype.m4',
|
||||
'm4/dirname.m4',
|
||||
'm4/double-slash-root.m4',
|
||||
'm4/dup2.m4',
|
||||
'm4/eealloc.m4',
|
||||
'm4/environ.m4',
|
||||
'm4/errno_h.m4',
|
||||
'm4/error.m4',
|
||||
'm4/exponentd.m4',
|
||||
'm4/extensions.m4',
|
||||
'm4/extern-inline.m4',
|
||||
'm4/fcntl-o.m4',
|
||||
'm4/fcntl.m4',
|
||||
'm4/fcntl_h.m4',
|
||||
'm4/fdopen.m4',
|
||||
'm4/filenamecat.m4',
|
||||
'm4/flexmember.m4',
|
||||
'm4/float_h.m4',
|
||||
'm4/fnmatch.m4',
|
||||
'm4/fpieee.m4',
|
||||
'm4/freopen.m4',
|
||||
'm4/fstat.m4',
|
||||
'm4/ftruncate.m4',
|
||||
'm4/getcwd.m4',
|
||||
'm4/getdtablesize.m4',
|
||||
'm4/getopt.m4',
|
||||
'm4/getpagesize.m4',
|
||||
'm4/getprogname.m4',
|
||||
'm4/gettext.m4',
|
||||
'm4/gettime.m4',
|
||||
'm4/gettimeofday.m4',
|
||||
'm4/glibc21.m4',
|
||||
'm4/gnu-make.m4',
|
||||
'm4/gnulib-common.m4',
|
||||
'm4/gnulib-comp.m4',
|
||||
'm4/hard-locale.m4',
|
||||
'm4/iconv.m4',
|
||||
'm4/iconv_h.m4',
|
||||
'm4/iconv_open.m4',
|
||||
'm4/include_next.m4',
|
||||
'm4/inet_pton.m4',
|
||||
'm4/inline.m4',
|
||||
'm4/intlmacosx.m4',
|
||||
'm4/intmax_t.m4',
|
||||
'm4/inttostr.m4',
|
||||
'm4/inttypes-pri.m4',
|
||||
'm4/inttypes.m4',
|
||||
'm4/inttypes_h.m4',
|
||||
'm4/ioctl.m4',
|
||||
'm4/isblank.m4',
|
||||
'm4/iswblank.m4',
|
||||
'm4/langinfo_h.m4',
|
||||
'm4/largefile.m4',
|
||||
'm4/lib-ld.m4',
|
||||
'm4/lib-link.m4',
|
||||
'm4/lib-prefix.m4',
|
||||
'm4/libsigsegv.m4',
|
||||
'm4/libunistring-base.m4',
|
||||
'm4/limits-h.m4',
|
||||
'm4/localcharset.m4',
|
||||
'm4/locale-fr.m4',
|
||||
'm4/locale-ja.m4',
|
||||
'm4/locale-tr.m4',
|
||||
'm4/locale-zh.m4',
|
||||
'm4/locale_h.m4',
|
||||
'm4/localeconv.m4',
|
||||
'm4/localtime-buffer.m4',
|
||||
'm4/longlong.m4',
|
||||
'm4/lstat.m4',
|
||||
'm4/malloc.m4',
|
||||
'm4/malloca.m4',
|
||||
'm4/manywarnings.m4',
|
||||
'm4/mbchar.m4',
|
||||
'm4/mbiter.m4',
|
||||
'm4/mbrtowc.m4',
|
||||
'm4/mbsinit.m4',
|
||||
'm4/mbslen.m4',
|
||||
'm4/mbsrtowcs.m4',
|
||||
'm4/mbstate_t.m4',
|
||||
'm4/mbtowc.m4',
|
||||
'm4/memchr.m4',
|
||||
'm4/minmax.m4',
|
||||
'm4/mkstemp.m4',
|
||||
'm4/mktime.m4',
|
||||
'm4/mmap-anon.m4',
|
||||
'm4/mode_t.m4',
|
||||
'm4/msvc-inval.m4',
|
||||
'm4/msvc-nothrow.m4',
|
||||
'm4/multiarch.m4',
|
||||
'm4/nanosleep.m4',
|
||||
'm4/netinet_in_h.m4',
|
||||
'm4/nl_langinfo.m4',
|
||||
'm4/nls.m4',
|
||||
'm4/nocrash.m4',
|
||||
'm4/off_t.m4',
|
||||
'm4/open.m4',
|
||||
'm4/pathmax.m4',
|
||||
'm4/perror.m4',
|
||||
'm4/pipe.m4',
|
||||
'm4/po.m4',
|
||||
'm4/printf.m4',
|
||||
'm4/progtest.m4',
|
||||
'm4/putenv.m4',
|
||||
'm4/quote.m4',
|
||||
'm4/quotearg.m4',
|
||||
'm4/raise.m4',
|
||||
'm4/rawmemchr.m4',
|
||||
'm4/readlink.m4',
|
||||
'm4/regex.m4',
|
||||
'm4/secure_getenv.m4',
|
||||
'm4/select.m4',
|
||||
'm4/setenv.m4',
|
||||
'm4/setlocale.m4',
|
||||
'm4/sigaction.m4',
|
||||
'm4/signal_h.m4',
|
||||
'm4/signalblocking.m4',
|
||||
'm4/size_max.m4',
|
||||
'm4/sleep.m4',
|
||||
'm4/snprintf.m4',
|
||||
'm4/socketlib.m4',
|
||||
'm4/sockets.m4',
|
||||
'm4/socklen.m4',
|
||||
'm4/sockpfaf.m4',
|
||||
'm4/ssize_t.m4',
|
||||
'm4/stat-time.m4',
|
||||
'm4/stat.m4',
|
||||
'm4/stdalign.m4',
|
||||
'm4/stdarg.m4',
|
||||
'm4/stdbool.m4',
|
||||
'm4/stddef_h.m4',
|
||||
'm4/stdint.m4',
|
||||
'm4/stdint_h.m4',
|
||||
'm4/stdio_h.m4',
|
||||
'm4/stdlib_h.m4',
|
||||
'm4/strcase.m4',
|
||||
'm4/strerror.m4',
|
||||
'm4/strerror_r.m4',
|
||||
'm4/strftime.m4',
|
||||
'm4/string_h.m4',
|
||||
'm4/strings_h.m4',
|
||||
'm4/strndup.m4',
|
||||
'm4/strnlen.m4',
|
||||
'm4/strptime.m4',
|
||||
'm4/strtoull.m4',
|
||||
'm4/strtoumax.m4',
|
||||
'm4/symlink.m4',
|
||||
'm4/sys_ioctl_h.m4',
|
||||
'm4/sys_select_h.m4',
|
||||
'm4/sys_socket_h.m4',
|
||||
'm4/sys_stat_h.m4',
|
||||
'm4/sys_time_h.m4',
|
||||
'm4/sys_types_h.m4',
|
||||
'm4/sys_uio_h.m4',
|
||||
'm4/sys_wait_h.m4',
|
||||
'm4/tempname.m4',
|
||||
'm4/time_h.m4',
|
||||
'm4/time_r.m4',
|
||||
'm4/time_rz.m4',
|
||||
'm4/timegm.m4',
|
||||
'm4/timespec.m4',
|
||||
'm4/tm_gmtoff.m4',
|
||||
'm4/tzset.m4',
|
||||
'm4/unistd_h.m4',
|
||||
'm4/unlocked-io.m4',
|
||||
'm4/vararrays.m4',
|
||||
'm4/vasnprintf.m4',
|
||||
'm4/vasprintf.m4',
|
||||
'm4/version-etc.m4',
|
||||
'm4/warn-on-use.m4',
|
||||
'm4/warnings.m4',
|
||||
'm4/wchar_h.m4',
|
||||
'm4/wchar_t.m4',
|
||||
'm4/wcrtomb.m4',
|
||||
'm4/wctob.m4',
|
||||
'm4/wctomb.m4',
|
||||
'm4/wctype_h.m4',
|
||||
'm4/wcwidth.m4',
|
||||
'm4/wint_t.m4',
|
||||
'm4/xalloc.m4',
|
||||
'm4/xsize.m4',
|
||||
'm4/xstrndup.m4',
|
||||
'm4/xstrtol.m4',
|
||||
'm4/xvasprintf.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'AC_' => 1,
|
||||
'AC_CHECK_HEADER_STDBOOL' => 1,
|
||||
'AC_COMPUTE_INT' => 1,
|
||||
'AC_CONFIG_MACRO_DIR' => 1,
|
||||
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
|
||||
'AC_C_FLEXIBLE_ARRAY_MEMBER' => 1,
|
||||
'AC_C_RESTRICT' => 1,
|
||||
'AC_C_VARARRAYS' => 1,
|
||||
'AC_DEFUN' => 1,
|
||||
'AC_DEFUN_ONCE' => 1,
|
||||
'AC_FUNC_MBRTOWC' => 1,
|
||||
'AC_HEADER_MAJOR' => 1,
|
||||
'AC_LIB_APPENDTOVAR' => 1,
|
||||
'AC_LIB_ARG_WITH' => 1,
|
||||
'AC_LIB_FROMPACKAGE' => 1,
|
||||
'AC_LIB_HAVE_LINKFLAGS' => 1,
|
||||
'AC_LIB_LINKFLAGS' => 1,
|
||||
'AC_LIB_LINKFLAGS_BODY' => 1,
|
||||
'AC_LIB_LINKFLAGS_FROM_LIBS' => 1,
|
||||
'AC_LIB_PREFIX' => 1,
|
||||
'AC_LIB_PREPARE_MULTILIB' => 1,
|
||||
'AC_LIB_PREPARE_PREFIX' => 1,
|
||||
'AC_LIB_PROG_LD' => 1,
|
||||
'AC_LIB_PROG_LD_GNU' => 1,
|
||||
'AC_LIB_RPATH' => 1,
|
||||
'AC_LIB_WITH_FINAL_PREFIX' => 1,
|
||||
'AC_PROG_MKDIR_P' => 1,
|
||||
'AC_PROG_SED' => 1,
|
||||
'AC_SYS_LARGEFILE' => 1,
|
||||
'AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC' => 1,
|
||||
'AC_TYPE_LONG_LONG_INT' => 1,
|
||||
'AC_TYPE_MBSTATE_T' => 1,
|
||||
'AC_TYPE_UNSIGNED_LONG_LONG_INT' => 1,
|
||||
'AC_USE_SYSTEM_EXTENSIONS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AM_AUX_DIR_EXPAND' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AM_DEP_TRACK' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AM_GNU_GETTEXT_NEED' => 1,
|
||||
'AM_GNU_GETTEXT_VERSION' => 1,
|
||||
'AM_ICONV' => 1,
|
||||
'AM_ICONV_LINK' => 1,
|
||||
'AM_ICONV_LINKFLAGS_BODY' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AM_LANGINFO_CODESET' => 1,
|
||||
'AM_MAKE_INCLUDE' => 1,
|
||||
'AM_MISSING_HAS_RUN' => 1,
|
||||
'AM_MISSING_PROG' => 1,
|
||||
'AM_NLS' => 1,
|
||||
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'AM_PATH_PROG_WITH_TEST' => 1,
|
||||
'AM_POSTPROCESS_PO_MAKEFILE' => 1,
|
||||
'AM_PO_SUBDIRS' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AM_PROG_INSTALL_SH' => 1,
|
||||
'AM_PROG_INSTALL_STRIP' => 1,
|
||||
'AM_PROG_MKDIR_P' => 1,
|
||||
'AM_RUN_LOG' => 1,
|
||||
'AM_SANITY_CHECK' => 1,
|
||||
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
|
||||
'AM_SET_DEPDIR' => 1,
|
||||
'AM_SET_LEADING_DOT' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AM_STDBOOL_H' => 1,
|
||||
'AM_SUBST_NOTMAKE' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'AM_XGETTEXT_OPTION_INIT' => 1,
|
||||
'AU_DEFUN' => 1,
|
||||
'GL_NOCRASH' => 1,
|
||||
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
|
||||
'_AC_FUNC_MALLOC_IF' => 1,
|
||||
'_AC_TYPE_LONG_LONG_SNIPPET' => 1,
|
||||
'_AM_AUTOCONF_VERSION' => 1,
|
||||
'_AM_CONFIG_MACRO_DIRS' => 1,
|
||||
'_AM_DEPENDENCIES' => 1,
|
||||
'_AM_FILESYSTEM_TIMESTAMP_RESOLUTION' => 1,
|
||||
'_AM_IF_OPTION' => 1,
|
||||
'_AM_MANGLE_OPTION' => 1,
|
||||
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'_AM_PROG_CC_C_O' => 1,
|
||||
'_AM_PROG_RM_F' => 1,
|
||||
'_AM_PROG_TAR' => 1,
|
||||
'_AM_PROG_XARGS_N' => 1,
|
||||
'_AM_SET_OPTION' => 1,
|
||||
'_AM_SET_OPTIONS' => 1,
|
||||
'_AM_SILENT_RULES' => 1,
|
||||
'_AM_SLEEP_FRACTIONAL_SECONDS' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'gl_00GNULIB' => 1,
|
||||
'gl_ABSOLUTE_HEADER' => 1,
|
||||
'gl_ABSOLUTE_HEADER_ONE' => 1,
|
||||
'gl_AC_HEADER_INTTYPES_H' => 1,
|
||||
'gl_AC_HEADER_STDINT_H' => 1,
|
||||
'gl_AC_TYPE_INTMAX_T' => 1,
|
||||
'gl_ARPA_INET_H_DEFAULTS' => 1,
|
||||
'gl_ARPA_INET_MODULE_INDICATOR' => 1,
|
||||
'gl_ASSERT_NO_GNULIB_POSIXCHECK' => 1,
|
||||
'gl_ASSERT_NO_GNULIB_TESTS' => 1,
|
||||
'gl_BIGENDIAN' => 1,
|
||||
'gl_CACHE_VAL_SILENT' => 1,
|
||||
'gl_CHECK_MALLOC_POSIX' => 1,
|
||||
'gl_CHECK_NEXT_HEADERS' => 1,
|
||||
'gl_CHECK_SOCKET_HEADERS' => 1,
|
||||
'gl_CHECK_TYPES_SIGNED' => 1,
|
||||
'gl_CHECK_TYPE_SIGSET_T' => 1,
|
||||
'gl_CHECK_TYPE_STRUCT_TIMESPEC' => 1,
|
||||
'gl_CLOCK_TIME' => 1,
|
||||
'gl_COMMON' => 1,
|
||||
'gl_COMMON_BODY' => 1,
|
||||
'gl_COMPILER_OPTION_IF' => 1,
|
||||
'gl_CONFIGMAKE_PREP' => 1,
|
||||
'gl_CONFIG_H' => 1,
|
||||
'gl_CTYPE_H' => 1,
|
||||
'gl_CTYPE_H_DEFAULTS' => 1,
|
||||
'gl_CTYPE_MODULE_INDICATOR' => 1,
|
||||
'gl_C_STACK' => 1,
|
||||
'gl_DIRNAME' => 1,
|
||||
'gl_DIRNAME_LGPL' => 1,
|
||||
'gl_DOUBLE_EXPONENT_LOCATION' => 1,
|
||||
'gl_DOUBLE_SLASH_ROOT' => 1,
|
||||
'gl_EARLY' => 1,
|
||||
'gl_EEALLOC' => 1,
|
||||
'gl_EEMALLOC' => 1,
|
||||
'gl_EEREALLOC' => 1,
|
||||
'gl_ENVIRON' => 1,
|
||||
'gl_ERROR' => 1,
|
||||
'gl_EXTERN_INLINE' => 1,
|
||||
'gl_FCNTL_H' => 1,
|
||||
'gl_FCNTL_H_DEFAULTS' => 1,
|
||||
'gl_FCNTL_MODULE_INDICATOR' => 1,
|
||||
'gl_FCNTL_O_FLAGS' => 1,
|
||||
'gl_FEATURES_H' => 1,
|
||||
'gl_FILE_LIST' => 1,
|
||||
'gl_FILE_NAME_CONCAT' => 1,
|
||||
'gl_FILE_NAME_CONCAT_LGPL' => 1,
|
||||
'gl_FLOAT_H' => 1,
|
||||
'gl_FP_IEEE' => 1,
|
||||
'gl_FUNC_ALLOCA' => 1,
|
||||
'gl_FUNC_BTOWC' => 1,
|
||||
'gl_FUNC_CLOSE' => 1,
|
||||
'gl_FUNC_DUP2' => 1,
|
||||
'gl_FUNC_FCNTL' => 1,
|
||||
'gl_FUNC_FDOPEN' => 1,
|
||||
'gl_FUNC_FNMATCH_GNU' => 1,
|
||||
'gl_FUNC_FNMATCH_POSIX' => 1,
|
||||
'gl_FUNC_FREOPEN' => 1,
|
||||
'gl_FUNC_FSTAT' => 1,
|
||||
'gl_FUNC_FTRUNCATE' => 1,
|
||||
'gl_FUNC_GEN_TEMPNAME' => 1,
|
||||
'gl_FUNC_GETCWD' => 1,
|
||||
'gl_FUNC_GETCWD_LGPL' => 1,
|
||||
'gl_FUNC_GETCWD_NULL' => 1,
|
||||
'gl_FUNC_GETCWD_SIGNATURE' => 1,
|
||||
'gl_FUNC_GETDTABLESIZE' => 1,
|
||||
'gl_FUNC_GETOPT_GNU' => 1,
|
||||
'gl_FUNC_GETOPT_POSIX' => 1,
|
||||
'gl_FUNC_GETPAGESIZE' => 1,
|
||||
'gl_FUNC_GETPROGNAME' => 1,
|
||||
'gl_FUNC_GETTIMEOFDAY' => 1,
|
||||
'gl_FUNC_GETTIMEOFDAY_CLOBBER' => 1,
|
||||
'gl_FUNC_GLIBC_UNLOCKED_IO' => 1,
|
||||
'gl_FUNC_GNU_STRFTIME' => 1,
|
||||
'gl_FUNC_ICONV_OPEN' => 1,
|
||||
'gl_FUNC_INET_PTON' => 1,
|
||||
'gl_FUNC_IOCTL' => 1,
|
||||
'gl_FUNC_ISBLANK' => 1,
|
||||
'gl_FUNC_ISWBLANK' => 1,
|
||||
'gl_FUNC_LOCALECONV' => 1,
|
||||
'gl_FUNC_LSTAT' => 1,
|
||||
'gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
|
||||
'gl_FUNC_MALLOC_GNU' => 1,
|
||||
'gl_FUNC_MALLOC_POSIX' => 1,
|
||||
'gl_FUNC_MBRTOWC' => 1,
|
||||
'gl_FUNC_MBSINIT' => 1,
|
||||
'gl_FUNC_MBSLEN' => 1,
|
||||
'gl_FUNC_MBSRTOWCS' => 1,
|
||||
'gl_FUNC_MBTOWC' => 1,
|
||||
'gl_FUNC_MEMCHR' => 1,
|
||||
'gl_FUNC_MKSTEMP' => 1,
|
||||
'gl_FUNC_MKTIME' => 1,
|
||||
'gl_FUNC_MKTIME_INTERNAL' => 1,
|
||||
'gl_FUNC_MKTIME_WORKS' => 1,
|
||||
'gl_FUNC_MMAP_ANON' => 1,
|
||||
'gl_FUNC_NANOSLEEP' => 1,
|
||||
'gl_FUNC_NL_LANGINFO' => 1,
|
||||
'gl_FUNC_OPEN' => 1,
|
||||
'gl_FUNC_PERROR' => 1,
|
||||
'gl_FUNC_PIPE' => 1,
|
||||
'gl_FUNC_PUTENV' => 1,
|
||||
'gl_FUNC_RAISE' => 1,
|
||||
'gl_FUNC_RAWMEMCHR' => 1,
|
||||
'gl_FUNC_READLINK' => 1,
|
||||
'gl_FUNC_READLINK_SEPARATE' => 1,
|
||||
'gl_FUNC_SECURE_GETENV' => 1,
|
||||
'gl_FUNC_SELECT' => 1,
|
||||
'gl_FUNC_SETENV' => 1,
|
||||
'gl_FUNC_SETENV_SEPARATE' => 1,
|
||||
'gl_FUNC_SETLOCALE' => 1,
|
||||
'gl_FUNC_SLEEP' => 1,
|
||||
'gl_FUNC_SNPRINTF' => 1,
|
||||
'gl_FUNC_STAT' => 1,
|
||||
'gl_FUNC_STRCASECMP' => 1,
|
||||
'gl_FUNC_STRERROR' => 1,
|
||||
'gl_FUNC_STRERROR_0' => 1,
|
||||
'gl_FUNC_STRERROR_R' => 1,
|
||||
'gl_FUNC_STRERROR_R_WORKS' => 1,
|
||||
'gl_FUNC_STRNCASECMP' => 1,
|
||||
'gl_FUNC_STRNDUP' => 1,
|
||||
'gl_FUNC_STRNLEN' => 1,
|
||||
'gl_FUNC_STRPTIME' => 1,
|
||||
'gl_FUNC_STRTOULL' => 1,
|
||||
'gl_FUNC_STRTOUMAX' => 1,
|
||||
'gl_FUNC_SYMLINK' => 1,
|
||||
'gl_FUNC_TIMEGM' => 1,
|
||||
'gl_FUNC_TZSET' => 1,
|
||||
'gl_FUNC_TZSET_CLOBBER' => 1,
|
||||
'gl_FUNC_UNSETENV' => 1,
|
||||
'gl_FUNC_VASNPRINTF' => 1,
|
||||
'gl_FUNC_VASPRINTF' => 1,
|
||||
'gl_FUNC_WCRTOMB' => 1,
|
||||
'gl_FUNC_WCTOB' => 1,
|
||||
'gl_FUNC_WCTOMB' => 1,
|
||||
'gl_FUNC_WCWIDTH' => 1,
|
||||
'gl_GETOPT_CHECK_HEADERS' => 1,
|
||||
'gl_GETOPT_SUBSTITUTE_HEADER' => 1,
|
||||
'gl_GETTIME' => 1,
|
||||
'gl_GLIBC21' => 1,
|
||||
'gl_GNU_MAKE' => 1,
|
||||
'gl_HARD_LOCALE' => 1,
|
||||
'gl_HEADER_ARPA_INET' => 1,
|
||||
'gl_HEADER_ERRNO_H' => 1,
|
||||
'gl_HEADER_NETINET_IN' => 1,
|
||||
'gl_HEADER_STRINGS_H' => 1,
|
||||
'gl_HEADER_STRINGS_H_BODY' => 1,
|
||||
'gl_HEADER_STRINGS_H_DEFAULTS' => 1,
|
||||
'gl_HEADER_STRING_H' => 1,
|
||||
'gl_HEADER_STRING_H_BODY' => 1,
|
||||
'gl_HEADER_STRING_H_DEFAULTS' => 1,
|
||||
'gl_HEADER_SYS_SELECT' => 1,
|
||||
'gl_HEADER_SYS_SOCKET' => 1,
|
||||
'gl_HEADER_SYS_STAT_H' => 1,
|
||||
'gl_HEADER_SYS_TIME_H' => 1,
|
||||
'gl_HEADER_SYS_TIME_H_BODY' => 1,
|
||||
'gl_HEADER_SYS_TIME_H_DEFAULTS' => 1,
|
||||
'gl_HEADER_SYS_UIO' => 1,
|
||||
'gl_HEADER_TIME_H' => 1,
|
||||
'gl_HEADER_TIME_H_BODY' => 1,
|
||||
'gl_HEADER_TIME_H_DEFAULTS' => 1,
|
||||
'gl_ICONV_H' => 1,
|
||||
'gl_ICONV_H_DEFAULTS' => 1,
|
||||
'gl_ICONV_MODULE_INDICATOR' => 1,
|
||||
'gl_INCLUDE_NEXT' => 1,
|
||||
'gl_INIT' => 1,
|
||||
'gl_INLINE' => 1,
|
||||
'gl_INTEGER_TYPE_SUFFIX' => 1,
|
||||
'gl_INTTOSTR' => 1,
|
||||
'gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION' => 1,
|
||||
'gl_INTTYPES_H' => 1,
|
||||
'gl_INTTYPES_H_DEFAULTS' => 1,
|
||||
'gl_INTTYPES_INCOMPLETE' => 1,
|
||||
'gl_INTTYPES_MODULE_INDICATOR' => 1,
|
||||
'gl_INTTYPES_PRI_SCN' => 1,
|
||||
'gl_LANGINFO_H' => 1,
|
||||
'gl_LANGINFO_H_DEFAULTS' => 1,
|
||||
'gl_LANGINFO_MODULE_INDICATOR' => 1,
|
||||
'gl_LARGEFILE' => 1,
|
||||
'gl_LIBOBJ' => 1,
|
||||
'gl_LIBSIGSEGV' => 1,
|
||||
'gl_LIBSOURCES' => 1,
|
||||
'gl_LIBUNISTRING_LIBHEADER' => 1,
|
||||
'gl_LIBUNISTRING_LIB_PREPARE' => 1,
|
||||
'gl_LIBUNISTRING_MODULE' => 1,
|
||||
'gl_LIBUNISTRING_VERSION_CMP' => 1,
|
||||
'gl_LIMITS_H' => 1,
|
||||
'gl_LOCALCHARSET' => 1,
|
||||
'gl_LOCALE_H' => 1,
|
||||
'gl_LOCALE_H_DEFAULTS' => 1,
|
||||
'gl_LOCALE_MODULE_INDICATOR' => 1,
|
||||
'gl_LOCALTIME_BUFFER_DEFAULTS' => 1,
|
||||
'gl_LOCALTIME_BUFFER_NEEDED' => 1,
|
||||
'gl_MALLOCA' => 1,
|
||||
'gl_MANYWARN_ALL_GCC' => 1,
|
||||
'gl_MANYWARN_COMPLEMENT' => 1,
|
||||
'gl_MBCHAR' => 1,
|
||||
'gl_MBITER' => 1,
|
||||
'gl_MBRTOWC_C_LOCALE' => 1,
|
||||
'gl_MBRTOWC_EMPTY_INPUT' => 1,
|
||||
'gl_MBRTOWC_INCOMPLETE_STATE' => 1,
|
||||
'gl_MBRTOWC_NULL_ARG1' => 1,
|
||||
'gl_MBRTOWC_NULL_ARG2' => 1,
|
||||
'gl_MBRTOWC_NUL_RETVAL' => 1,
|
||||
'gl_MBRTOWC_RETVAL' => 1,
|
||||
'gl_MBRTOWC_SANITYCHECK' => 1,
|
||||
'gl_MBSRTOWCS_WORKS' => 1,
|
||||
'gl_MBSTATE_T_BROKEN' => 1,
|
||||
'gl_MINMAX' => 1,
|
||||
'gl_MINMAX_IN_HEADER' => 1,
|
||||
'gl_MODULE_INDICATOR' => 1,
|
||||
'gl_MODULE_INDICATOR_FOR_TESTS' => 1,
|
||||
'gl_MODULE_INDICATOR_SET_VARIABLE' => 1,
|
||||
'gl_MODULE_INDICATOR_SET_VARIABLE_AUX' => 1,
|
||||
'gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR' => 1,
|
||||
'gl_MSVC_INVAL' => 1,
|
||||
'gl_MSVC_NOTHROW' => 1,
|
||||
'gl_MULTIARCH' => 1,
|
||||
'gl_NEXT_HEADERS' => 1,
|
||||
'gl_NEXT_HEADERS_INTERNAL' => 1,
|
||||
'gl_PATHMAX' => 1,
|
||||
'gl_PATHMAX_SNIPPET' => 1,
|
||||
'gl_PATHMAX_SNIPPET_PREREQ' => 1,
|
||||
'gl_PREREQ_ALLOCA' => 1,
|
||||
'gl_PREREQ_ASNPRINTF' => 1,
|
||||
'gl_PREREQ_ASPRINTF' => 1,
|
||||
'gl_PREREQ_BTOWC' => 1,
|
||||
'gl_PREREQ_C_STACK' => 1,
|
||||
'gl_PREREQ_DUP2' => 1,
|
||||
'gl_PREREQ_ERROR' => 1,
|
||||
'gl_PREREQ_FDOPEN' => 1,
|
||||
'gl_PREREQ_FNMATCH' => 1,
|
||||
'gl_PREREQ_FREOPEN' => 1,
|
||||
'gl_PREREQ_FSTAT' => 1,
|
||||
'gl_PREREQ_FTRUNCATE' => 1,
|
||||
'gl_PREREQ_GETCWD' => 1,
|
||||
'gl_PREREQ_GETDTABLESIZE' => 1,
|
||||
'gl_PREREQ_GETTIMEOFDAY' => 1,
|
||||
'gl_PREREQ_IMAXTOSTR' => 1,
|
||||
'gl_PREREQ_INET_PTON' => 1,
|
||||
'gl_PREREQ_INTTOSTR' => 1,
|
||||
'gl_PREREQ_LOCALECONV' => 1,
|
||||
'gl_PREREQ_LSTAT' => 1,
|
||||
'gl_PREREQ_MBRTOWC' => 1,
|
||||
'gl_PREREQ_MBSINIT' => 1,
|
||||
'gl_PREREQ_MBSRTOWCS' => 1,
|
||||
'gl_PREREQ_MBTOWC' => 1,
|
||||
'gl_PREREQ_MEMCHR' => 1,
|
||||
'gl_PREREQ_MINMAX' => 1,
|
||||
'gl_PREREQ_MKSTEMP' => 1,
|
||||
'gl_PREREQ_MKTIME' => 1,
|
||||
'gl_PREREQ_NANOSLEEP' => 1,
|
||||
'gl_PREREQ_OFFTOSTR' => 1,
|
||||
'gl_PREREQ_OPEN' => 1,
|
||||
'gl_PREREQ_PRINTF_ARGS' => 1,
|
||||
'gl_PREREQ_PRINTF_PARSE' => 1,
|
||||
'gl_PREREQ_PUTENV' => 1,
|
||||
'gl_PREREQ_RAISE' => 1,
|
||||
'gl_PREREQ_RAWMEMCHR' => 1,
|
||||
'gl_PREREQ_READLINK' => 1,
|
||||
'gl_PREREQ_REGEX' => 1,
|
||||
'gl_PREREQ_SECURE_GETENV' => 1,
|
||||
'gl_PREREQ_SETENV' => 1,
|
||||
'gl_PREREQ_SETLOCALE' => 1,
|
||||
'gl_PREREQ_SIGACTION' => 1,
|
||||
'gl_PREREQ_SIGPROCMASK' => 1,
|
||||
'gl_PREREQ_SIG_HANDLER_H' => 1,
|
||||
'gl_PREREQ_SNPRINTF' => 1,
|
||||
'gl_PREREQ_SOCKETS' => 1,
|
||||
'gl_PREREQ_STAT' => 1,
|
||||
'gl_PREREQ_STRCASECMP' => 1,
|
||||
'gl_PREREQ_STRERROR_R' => 1,
|
||||
'gl_PREREQ_STRNCASECMP' => 1,
|
||||
'gl_PREREQ_STRNLEN' => 1,
|
||||
'gl_PREREQ_STRPTIME' => 1,
|
||||
'gl_PREREQ_STRTOULL' => 1,
|
||||
'gl_PREREQ_STRTOUMAX' => 1,
|
||||
'gl_PREREQ_SYS_H_SOCKET' => 1,
|
||||
'gl_PREREQ_SYS_H_WINSOCK2' => 1,
|
||||
'gl_PREREQ_TEMPNAME' => 1,
|
||||
'gl_PREREQ_TIMEGM' => 1,
|
||||
'gl_PREREQ_TIME_R' => 1,
|
||||
'gl_PREREQ_UINTTOSTR' => 1,
|
||||
'gl_PREREQ_UMAXTOSTR' => 1,
|
||||
'gl_PREREQ_UNSETENV' => 1,
|
||||
'gl_PREREQ_VASNPRINTF' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_DIRECTIVE_A' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_DIRECTIVE_F' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_DIRECTIVE_LS' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_ENOMEM' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_FLAG_GROUPING' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_FLAG_ZERO' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_LONG_DOUBLE' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_PRECISION' => 1,
|
||||
'gl_PREREQ_VASNPRINTF_WITH_EXTRAS' => 1,
|
||||
'gl_PREREQ_VASPRINTF' => 1,
|
||||
'gl_PREREQ_VASPRINTF_H' => 1,
|
||||
'gl_PREREQ_WCRTOMB' => 1,
|
||||
'gl_PREREQ_WCTOB' => 1,
|
||||
'gl_PREREQ_WCTOMB' => 1,
|
||||
'gl_PREREQ_XSTRNDUP' => 1,
|
||||
'gl_PRINTF_DIRECTIVE_A' => 1,
|
||||
'gl_PRINTF_DIRECTIVE_F' => 1,
|
||||
'gl_PRINTF_DIRECTIVE_LS' => 1,
|
||||
'gl_PRINTF_DIRECTIVE_N' => 1,
|
||||
'gl_PRINTF_ENOMEM' => 1,
|
||||
'gl_PRINTF_FLAG_GROUPING' => 1,
|
||||
'gl_PRINTF_FLAG_LEFTADJUST' => 1,
|
||||
'gl_PRINTF_FLAG_ZERO' => 1,
|
||||
'gl_PRINTF_INFINITE' => 1,
|
||||
'gl_PRINTF_INFINITE_LONG_DOUBLE' => 1,
|
||||
'gl_PRINTF_LONG_DOUBLE' => 1,
|
||||
'gl_PRINTF_POSITIONS' => 1,
|
||||
'gl_PRINTF_PRECISION' => 1,
|
||||
'gl_PRINTF_SIZES_C99' => 1,
|
||||
'gl_PROG_AR_RANLIB' => 1,
|
||||
'gl_PROG_CC_C99' => 1,
|
||||
'gl_PROMOTED_TYPE_MODE_T' => 1,
|
||||
'gl_QUOTE' => 1,
|
||||
'gl_QUOTEARG' => 1,
|
||||
'gl_REGEX' => 1,
|
||||
'gl_REPLACE_ERRNO_VALUE' => 1,
|
||||
'gl_REPLACE_FCNTL' => 1,
|
||||
'gl_REPLACE_FUNCS' => 1,
|
||||
'gl_REPLACE_ICONV_H' => 1,
|
||||
'gl_REPLACE_ICONV_OPEN' => 1,
|
||||
'gl_REPLACE_SNPRINTF' => 1,
|
||||
'gl_REPLACE_VASNPRINTF' => 1,
|
||||
'gl_REPLACE_VASPRINTF' => 1,
|
||||
'gl_SIGACTION' => 1,
|
||||
'gl_SIGNALBLOCKING' => 1,
|
||||
'gl_SIGNAL_H' => 1,
|
||||
'gl_SIGNAL_H_DEFAULTS' => 1,
|
||||
'gl_SIGNAL_MODULE_INDICATOR' => 1,
|
||||
'gl_SIZE_MAX' => 1,
|
||||
'gl_SNPRINTF_DIRECTIVE_N' => 1,
|
||||
'gl_SNPRINTF_PRESENCE' => 1,
|
||||
'gl_SNPRINTF_RETVAL_C99' => 1,
|
||||
'gl_SNPRINTF_SIZE1' => 1,
|
||||
'gl_SNPRINTF_TRUNCATION_C99' => 1,
|
||||
'gl_SOCKETLIB' => 1,
|
||||
'gl_SOCKETS' => 1,
|
||||
'gl_SOCKET_FAMILIES' => 1,
|
||||
'gl_SOCKET_FAMILY_UNIX' => 1,
|
||||
'gl_SOCKET_HEADERS' => 1,
|
||||
'gl_STAT_BIRTHTIME' => 1,
|
||||
'gl_STAT_TIME' => 1,
|
||||
'gl_STDALIGN_H' => 1,
|
||||
'gl_STDARG_H' => 1,
|
||||
'gl_STDBOOL_H' => 1,
|
||||
'gl_STDDEF_H' => 1,
|
||||
'gl_STDDEF_H_DEFAULTS' => 1,
|
||||
'gl_STDDEF_MODULE_INDICATOR' => 1,
|
||||
'gl_STDINT_BITSIZEOF' => 1,
|
||||
'gl_STDINT_H' => 1,
|
||||
'gl_STDINT_INCLUDES' => 1,
|
||||
'gl_STDINT_TYPE_PROPERTIES' => 1,
|
||||
'gl_STDIO_H' => 1,
|
||||
'gl_STDIO_H_DEFAULTS' => 1,
|
||||
'gl_STDIO_MODULE_INDICATOR' => 1,
|
||||
'gl_STDLIB_H' => 1,
|
||||
'gl_STDLIB_H_DEFAULTS' => 1,
|
||||
'gl_STDLIB_MODULE_INDICATOR' => 1,
|
||||
'gl_STRCASE' => 1,
|
||||
'gl_STRINGS_MODULE_INDICATOR' => 1,
|
||||
'gl_STRING_MODULE_INDICATOR' => 1,
|
||||
'gl_SYS_IOCTL_H' => 1,
|
||||
'gl_SYS_IOCTL_H_DEFAULTS' => 1,
|
||||
'gl_SYS_IOCTL_MODULE_INDICATOR' => 1,
|
||||
'gl_SYS_SELECT_H_DEFAULTS' => 1,
|
||||
'gl_SYS_SELECT_MODULE_INDICATOR' => 1,
|
||||
'gl_SYS_SOCKET_H_DEFAULTS' => 1,
|
||||
'gl_SYS_SOCKET_MODULE_INDICATOR' => 1,
|
||||
'gl_SYS_STAT_H_DEFAULTS' => 1,
|
||||
'gl_SYS_STAT_MODULE_INDICATOR' => 1,
|
||||
'gl_SYS_TIME_MODULE_INDICATOR' => 1,
|
||||
'gl_SYS_TYPES_H' => 1,
|
||||
'gl_SYS_TYPES_H_DEFAULTS' => 1,
|
||||
'gl_SYS_UIO_H_DEFAULTS' => 1,
|
||||
'gl_SYS_UIO_MODULE_INDICATOR' => 1,
|
||||
'gl_SYS_WAIT_H' => 1,
|
||||
'gl_SYS_WAIT_H_DEFAULTS' => 1,
|
||||
'gl_SYS_WAIT_MODULE_INDICATOR' => 1,
|
||||
'gl_TIMESPEC' => 1,
|
||||
'gl_TIME_MODULE_INDICATOR' => 1,
|
||||
'gl_TIME_R' => 1,
|
||||
'gl_TIME_RZ' => 1,
|
||||
'gl_TIME_T_IS_SIGNED' => 1,
|
||||
'gl_TM_GMTOFF' => 1,
|
||||
'gl_TYPE_OFF_T' => 1,
|
||||
'gl_TYPE_SOCKLEN_T' => 1,
|
||||
'gl_TYPE_WINT_T_PREREQ' => 1,
|
||||
'gl_UNISTD_H' => 1,
|
||||
'gl_UNISTD_H_DEFAULTS' => 1,
|
||||
'gl_UNISTD_MODULE_INDICATOR' => 1,
|
||||
'gl_UNKNOWN_WARNINGS_ARE_ERRORS' => 1,
|
||||
'gl_USE_SYSTEM_EXTENSIONS' => 1,
|
||||
'gl_VERSION_ETC' => 1,
|
||||
'gl_VSNPRINTF_ZEROSIZE_C99' => 1,
|
||||
'gl_W' => 1,
|
||||
'gl_WARN_ADD' => 1,
|
||||
'gl_WARN_ON_USE_PREPARE' => 1,
|
||||
'gl_WCHAR_H' => 1,
|
||||
'gl_WCHAR_H_DEFAULTS' => 1,
|
||||
'gl_WCHAR_H_INLINE_OK' => 1,
|
||||
'gl_WCHAR_MODULE_INDICATOR' => 1,
|
||||
'gl_WCTYPE_H' => 1,
|
||||
'gl_WCTYPE_H_DEFAULTS' => 1,
|
||||
'gl_WCTYPE_MODULE_INDICATOR' => 1,
|
||||
'gl_XALLOC' => 1,
|
||||
'gl_XSIZE' => 1,
|
||||
'gl_XSTRNDUP' => 1,
|
||||
'gl_XSTRTOL' => 1,
|
||||
'gl_XVASPRINTF' => 1,
|
||||
'gl___BUILTIN_EXPECT' => 1,
|
||||
'gltests_LIBOBJ' => 1,
|
||||
'gltests_LIBSOURCES' => 1,
|
||||
'gltests_REPLACE_FUNCS' => 1,
|
||||
'gt_AC_TYPE_INTMAX_T' => 1,
|
||||
'gt_CHECK_VAR_DECL' => 1,
|
||||
'gt_INTL_MACOSX' => 1,
|
||||
'gt_INTTYPES_PRI' => 1,
|
||||
'gt_LOCALE_FR' => 1,
|
||||
'gt_LOCALE_FR_UTF8' => 1,
|
||||
'gt_LOCALE_JA' => 1,
|
||||
'gt_LOCALE_TR_UTF8' => 1,
|
||||
'gt_LOCALE_ZH_CN' => 1,
|
||||
'gt_TYPE_SSIZE_T' => 1,
|
||||
'gt_TYPE_WCHAR_T' => 1,
|
||||
'gt_TYPE_WINT_T' => 1,
|
||||
'include' => 1,
|
||||
'm4_include' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'm4_pattern_forbid' => 1
|
||||
}
|
||||
], 'Autom4te::Request' ),
|
||||
bless( [
|
||||
'1',
|
||||
1,
|
||||
[
|
||||
'/usr/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/share/autoconf/autoconf/autoconf.m4f',
|
||||
'aclocal.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AC_FC_PP_DEFINE' => 1,
|
||||
'AC_FC_PP_SRCEXT' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_SUBST_TRACE' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AM_ENABLE_MULTILIB' => 1,
|
||||
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AM_NLS' => 1,
|
||||
'AM_PATH_GUILE' => 1,
|
||||
'AM_POT_TOOLS' => 1,
|
||||
'AM_PROG_AR' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AM_PROG_CXX_C_O' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'AM_PROG_LIBTOOL' => 1,
|
||||
'AM_PROG_MKDIR_P' => 1,
|
||||
'AM_PROG_MOC' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'GTK_DOC_CHECK' => 1,
|
||||
'IT_PROG_INTLTOOL' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'_AM_COND_ELSE' => 1,
|
||||
'_AM_COND_ENDIF' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'_AM_MAKEFILE_INCLUDE' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'include' => 1,
|
||||
'm4_include' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'sinclude' => 1
|
||||
}
|
||||
], 'Autom4te::Request' ),
|
||||
bless( [
|
||||
'2',
|
||||
1,
|
||||
[
|
||||
'/usr/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/share/autoconf/autoconf/autoconf.m4f',
|
||||
'aclocal.m4',
|
||||
'/usr/share/autoconf/autoconf/trailer.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AC_FC_PP_DEFINE' => 1,
|
||||
'AC_FC_PP_SRCEXT' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_SUBST_TRACE' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AM_ENABLE_MULTILIB' => 1,
|
||||
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AM_NLS' => 1,
|
||||
'AM_PATH_GUILE' => 1,
|
||||
'AM_POT_TOOLS' => 1,
|
||||
'AM_PROG_AR' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AM_PROG_CXX_C_O' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'AM_PROG_LIBTOOL' => 1,
|
||||
'AM_PROG_MKDIR_P' => 1,
|
||||
'AM_PROG_MOC' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'GTK_DOC_CHECK' => 1,
|
||||
'IT_PROG_INTLTOOL' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'_AM_COND_ELSE' => 1,
|
||||
'_AM_COND_ENDIF' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'_AM_MAKEFILE_INCLUDE' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'include' => 1,
|
||||
'm4_include' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'sinclude' => 1
|
||||
}
|
||||
], 'Autom4te::Request' )
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1028
File diff suppressed because it is too large
Load Diff
+557
@@ -0,0 +1,557 @@
|
||||
eval '(exit $?0)' && eval 'exec perl -wS "$0" "$@"'
|
||||
& eval 'exec perl -wS "$0" $argv:q'
|
||||
if 0;
|
||||
# Generate a release announcement message.
|
||||
|
||||
my $VERSION = '2016-01-12 23:09'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering
|
||||
|
||||
use strict;
|
||||
|
||||
use Getopt::Long;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
my %valid_release_types = map {$_ => 1} qw (alpha beta stable);
|
||||
my @archive_suffixes = ('tar.gz', 'tar.bz2', 'tar.lzma', 'tar.xz');
|
||||
my %digest_classes =
|
||||
(
|
||||
'md5' => (eval { require Digest::MD5; } and 'Digest::MD5'),
|
||||
'sha1' => ((eval { require Digest::SHA; } and 'Digest::SHA')
|
||||
or (eval { require Digest::SHA1; } and 'Digest::SHA1'))
|
||||
);
|
||||
my $srcdir = '.';
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
my @types = sort keys %valid_release_types;
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS]
|
||||
Generate an announcement message. Run this from builddir.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
These options must be specified:
|
||||
|
||||
--release-type=TYPE TYPE must be one of @types
|
||||
--package-name=PACKAGE_NAME
|
||||
--previous-version=VER
|
||||
--current-version=VER
|
||||
--gpg-key-id=ID The GnuPG ID of the key used to sign the tarballs
|
||||
--url-directory=URL_DIR
|
||||
|
||||
The following are optional:
|
||||
|
||||
--news=NEWS_FILE include the NEWS section about this release
|
||||
from this NEWS_FILE; accumulates.
|
||||
--srcdir=DIR where to find the NEWS_FILEs (default: $srcdir)
|
||||
--bootstrap-tools=TOOL_LIST a comma-separated list of tools, e.g.,
|
||||
autoconf,automake,bison,gnulib
|
||||
--gnulib-version=VERSION report VERSION as the gnulib version, where
|
||||
VERSION is the result of running git describe
|
||||
in the gnulib source directory.
|
||||
required if gnulib is in TOOL_LIST.
|
||||
--no-print-checksums do not emit MD5 or SHA1 checksums
|
||||
--archive-suffix=SUF add SUF to the list of archive suffixes
|
||||
--mail-headers=HEADERS a space-separated list of mail headers, e.g.,
|
||||
To: x\@example.com Cc: y-announce\@example.com,...
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
|
||||
=item C<%size> = C<sizes (@file)>
|
||||
|
||||
Compute the sizes of the C<@file> and return them as a hash. Return
|
||||
C<undef> if one of the computation failed.
|
||||
|
||||
=cut
|
||||
|
||||
sub sizes (@)
|
||||
{
|
||||
my (@file) = @_;
|
||||
|
||||
my $fail = 0;
|
||||
my %res;
|
||||
foreach my $f (@file)
|
||||
{
|
||||
my $cmd = "du -h $f";
|
||||
my $t = `$cmd`;
|
||||
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
|
||||
$@
|
||||
and (warn "command failed: '$cmd'\n"), $fail = 1;
|
||||
chomp $t;
|
||||
$t =~ s/^\s*([\d.]+[MkK]).*/${1}B/;
|
||||
$res{$f} = $t;
|
||||
}
|
||||
return $fail ? undef : %res;
|
||||
}
|
||||
|
||||
=item C<print_locations ($title, \@url, \%size, @file)
|
||||
|
||||
Print a section C<$title> dedicated to the list of <@file>, which
|
||||
sizes are stored in C<%size>, and which are available from the C<@url>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_locations ($\@\%@)
|
||||
{
|
||||
my ($title, $url, $size, @file) = @_;
|
||||
print "Here are the $title:\n";
|
||||
foreach my $url (@{$url})
|
||||
{
|
||||
for my $file (@file)
|
||||
{
|
||||
print " $url/$file";
|
||||
print " (", $$size{$file}, ")"
|
||||
if exists $$size{$file};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
=item C<print_checksums (@file)
|
||||
|
||||
Print the MD5 and SHA1 signature section for each C<@file>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_checksums (@)
|
||||
{
|
||||
my (@file) = @_;
|
||||
|
||||
print "Here are the MD5 and SHA1 checksums:\n";
|
||||
print "\n";
|
||||
|
||||
foreach my $meth (qw (md5 sha1))
|
||||
{
|
||||
my $class = $digest_classes{$meth} or next;
|
||||
foreach my $f (@file)
|
||||
{
|
||||
open IN, '<', $f
|
||||
or die "$ME: $f: cannot open for reading: $!\n";
|
||||
binmode IN;
|
||||
my $dig = $class->new->addfile(*IN)->hexdigest;
|
||||
close IN;
|
||||
print "$dig $f\n";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
=item C<print_news_deltas ($news_file, $prev_version, $curr_version)
|
||||
|
||||
Print the section of the NEWS file C<$news_file> addressing changes
|
||||
between versions C<$prev_version> and C<$curr_version>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_news_deltas ($$$)
|
||||
{
|
||||
my ($news_file, $prev_version, $curr_version) = @_;
|
||||
|
||||
my $news_name = $news_file;
|
||||
$news_name =~ s|^\Q$srcdir\E/||;
|
||||
|
||||
print "\n$news_name\n\n";
|
||||
|
||||
# Print all lines from $news_file, starting with the first one
|
||||
# that mentions $curr_version up to but not including
|
||||
# the first occurrence of $prev_version.
|
||||
my $in_items;
|
||||
|
||||
my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
|
||||
|
||||
my $found_news;
|
||||
open NEWS, '<', $news_file
|
||||
or die "$ME: $news_file: cannot open for reading: $!\n";
|
||||
while (defined (my $line = <NEWS>))
|
||||
{
|
||||
if ( ! $in_items)
|
||||
{
|
||||
# Match lines like these:
|
||||
# * Major changes in release 5.0.1:
|
||||
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
|
||||
or next;
|
||||
$in_items = 1;
|
||||
print $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# This regexp must not match version numbers in NEWS items.
|
||||
# For example, they might well say "introduced in 4.5.5",
|
||||
# and we don't want that to match.
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
|
||||
and last;
|
||||
print $line;
|
||||
$line =~ /\S/
|
||||
and $found_news = 1;
|
||||
}
|
||||
}
|
||||
close NEWS;
|
||||
|
||||
$in_items
|
||||
or die "$ME: $news_file: no matching lines for '$curr_version'\n";
|
||||
$found_news
|
||||
or die "$ME: $news_file: no news item found for '$curr_version'\n";
|
||||
}
|
||||
|
||||
sub print_changelog_deltas ($$)
|
||||
{
|
||||
my ($package_name, $prev_version) = @_;
|
||||
|
||||
# Print new ChangeLog entries.
|
||||
|
||||
# First find all CVS-controlled ChangeLog files.
|
||||
use File::Find;
|
||||
my @changelog;
|
||||
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
|
||||
and push @changelog, $File::Find::name}},
|
||||
'.');
|
||||
|
||||
# If there are no ChangeLog files, we're done.
|
||||
@changelog
|
||||
or return;
|
||||
my %changelog = map {$_ => 1} @changelog;
|
||||
|
||||
# Reorder the list of files so that if there are ChangeLog
|
||||
# files in the specified directories, they're listed first,
|
||||
# in this order:
|
||||
my @dir = qw ( . src lib m4 config doc );
|
||||
|
||||
# A typical @changelog array might look like this:
|
||||
# ./ChangeLog
|
||||
# ./po/ChangeLog
|
||||
# ./m4/ChangeLog
|
||||
# ./lib/ChangeLog
|
||||
# ./doc/ChangeLog
|
||||
# ./config/ChangeLog
|
||||
my @reordered;
|
||||
foreach my $d (@dir)
|
||||
{
|
||||
my $dot_slash = $d eq '.' ? $d : "./$d";
|
||||
my $target = "$dot_slash/ChangeLog";
|
||||
delete $changelog{$target}
|
||||
and push @reordered, $target;
|
||||
}
|
||||
|
||||
# Append any remaining ChangeLog files.
|
||||
push @reordered, sort keys %changelog;
|
||||
|
||||
# Remove leading './'.
|
||||
@reordered = map { s!^\./!!; $_ } @reordered;
|
||||
|
||||
print "\nChangeLog entries:\n\n";
|
||||
# print join ("\n", @reordered), "\n";
|
||||
|
||||
$prev_version =~ s/\./_/g;
|
||||
my $prev_cvs_tag = "\U$package_name\E-$prev_version";
|
||||
|
||||
my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered";
|
||||
open DIFF, '-|', $cmd
|
||||
or die "$ME: cannot run '$cmd': $!\n";
|
||||
# Print two types of lines, making minor changes:
|
||||
# Lines starting with '+++ ', e.g.,
|
||||
# +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247
|
||||
# and those starting with '+'.
|
||||
# Don't print the others.
|
||||
my $prev_printed_line_empty = 1;
|
||||
while (defined (my $line = <DIFF>))
|
||||
{
|
||||
if ($line =~ /^\+\+\+ /)
|
||||
{
|
||||
my $separator = "*"x70 ."\n";
|
||||
$line =~ s///;
|
||||
$line =~ s/\s.*//;
|
||||
$prev_printed_line_empty
|
||||
or print "\n";
|
||||
print $separator, $line, $separator;
|
||||
}
|
||||
elsif ($line =~ /^\+/)
|
||||
{
|
||||
$line =~ s///;
|
||||
print $line;
|
||||
$prev_printed_line_empty = ($line =~ /^$/);
|
||||
}
|
||||
}
|
||||
close DIFF;
|
||||
|
||||
# The exit code should be 1.
|
||||
# Allow in case there are no modified ChangeLog entries.
|
||||
$? == 256 || $? == 128
|
||||
or warn "warning: '$cmd' had unexpected exit code or signal ($?)\n";
|
||||
}
|
||||
|
||||
sub get_tool_versions ($$)
|
||||
{
|
||||
my ($tool_list, $gnulib_version) = @_;
|
||||
@$tool_list
|
||||
or return ();
|
||||
|
||||
my $fail;
|
||||
my @tool_version_pair;
|
||||
foreach my $t (@$tool_list)
|
||||
{
|
||||
if ($t eq 'gnulib')
|
||||
{
|
||||
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
|
||||
next;
|
||||
}
|
||||
# Assume that the last "word" on the first line of
|
||||
# 'tool --version' output is the version string.
|
||||
my ($first_line, undef) = split ("\n", `$t --version`);
|
||||
if ($first_line =~ /.* (\d[\w.-]+)$/)
|
||||
{
|
||||
$t = ucfirst $t;
|
||||
push @tool_version_pair, "$t $1";
|
||||
}
|
||||
else
|
||||
{
|
||||
defined $first_line
|
||||
and $first_line = '';
|
||||
warn "$t: unexpected --version output\n:$first_line";
|
||||
$fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$fail
|
||||
and exit 1;
|
||||
|
||||
return @tool_version_pair;
|
||||
}
|
||||
|
||||
{
|
||||
# Neutralize the locale, so that, for instance, "du" does not
|
||||
# issue "1,2" instead of "1.2", what confuses our regexps.
|
||||
$ENV{LC_ALL} = "C";
|
||||
|
||||
my $mail_headers;
|
||||
my $release_type;
|
||||
my $package_name;
|
||||
my $prev_version;
|
||||
my $curr_version;
|
||||
my $gpg_key_id;
|
||||
my @url_dir_list;
|
||||
my @news_file;
|
||||
my $bootstrap_tools;
|
||||
my $gnulib_version;
|
||||
my $print_checksums_p = 1;
|
||||
|
||||
# Reformat the warnings before displaying them.
|
||||
local $SIG{__WARN__} = sub
|
||||
{
|
||||
my ($msg) = @_;
|
||||
# Warnings from GetOptions.
|
||||
$msg =~ s/Option (\w)/option --$1/;
|
||||
warn "$ME: $msg";
|
||||
};
|
||||
|
||||
GetOptions
|
||||
(
|
||||
'mail-headers=s' => \$mail_headers,
|
||||
'release-type=s' => \$release_type,
|
||||
'package-name=s' => \$package_name,
|
||||
'previous-version=s' => \$prev_version,
|
||||
'current-version=s' => \$curr_version,
|
||||
'gpg-key-id=s' => \$gpg_key_id,
|
||||
'url-directory=s' => \@url_dir_list,
|
||||
'news=s' => \@news_file,
|
||||
'srcdir=s' => \$srcdir,
|
||||
'bootstrap-tools=s' => \$bootstrap_tools,
|
||||
'gnulib-version=s' => \$gnulib_version,
|
||||
'print-checksums!' => \$print_checksums_p,
|
||||
'archive-suffix=s' => \@archive_suffixes,
|
||||
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
) or usage 1;
|
||||
|
||||
my $fail = 0;
|
||||
# Ensure that each required option is specified.
|
||||
$release_type
|
||||
or (warn "release type not specified\n"), $fail = 1;
|
||||
$package_name
|
||||
or (warn "package name not specified\n"), $fail = 1;
|
||||
$prev_version
|
||||
or (warn "previous version string not specified\n"), $fail = 1;
|
||||
$curr_version
|
||||
or (warn "current version string not specified\n"), $fail = 1;
|
||||
$gpg_key_id
|
||||
or (warn "GnuPG key ID not specified\n"), $fail = 1;
|
||||
@url_dir_list
|
||||
or (warn "URL directory name(s) not specified\n"), $fail = 1;
|
||||
|
||||
my @tool_list = split ',', $bootstrap_tools
|
||||
if $bootstrap_tools;
|
||||
|
||||
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
|
||||
and (warn "when specifying gnulib as a tool, you must also specify\n"
|
||||
. "--gnulib-version=V, where V is the result of running git describe\n"
|
||||
. "in the gnulib source directory.\n"), $fail = 1;
|
||||
|
||||
!$release_type || exists $valid_release_types{$release_type}
|
||||
or (warn "'$release_type': invalid release type\n"), $fail = 1;
|
||||
|
||||
@ARGV
|
||||
and (warn "too many arguments:\n", join ("\n", @ARGV), "\n"),
|
||||
$fail = 1;
|
||||
$fail
|
||||
and usage 1;
|
||||
|
||||
my $my_distdir = "$package_name-$curr_version";
|
||||
|
||||
my $xd = "$package_name-$prev_version-$curr_version.xdelta";
|
||||
|
||||
my @candidates = map { "$my_distdir.$_" } @archive_suffixes;
|
||||
my @tarballs = grep {-f $_} @candidates;
|
||||
|
||||
@tarballs
|
||||
or die "$ME: none of " . join(', ', @candidates) . " were found\n";
|
||||
my @sizable = @tarballs;
|
||||
-f $xd
|
||||
and push @sizable, $xd;
|
||||
my %size = sizes (@sizable);
|
||||
%size
|
||||
or exit 1;
|
||||
|
||||
my $headers = '';
|
||||
if (defined $mail_headers)
|
||||
{
|
||||
($headers = $mail_headers) =~ s/\s+(\S+:)/\n$1/g;
|
||||
$headers .= "\n";
|
||||
}
|
||||
|
||||
# The markup is escaped as <\# so that when this script is sent by
|
||||
# mail (or part of a diff), Gnus is not triggered.
|
||||
print <<EOF;
|
||||
|
||||
${headers}Subject: $my_distdir released [$release_type]
|
||||
|
||||
<\#secure method=pgpmime mode=sign>
|
||||
|
||||
FIXME: put comments here
|
||||
|
||||
EOF
|
||||
|
||||
if (@url_dir_list == 1 && @tarballs == 1)
|
||||
{
|
||||
# When there's only one tarball and one URL, use a more concise form.
|
||||
my $m = "$url_dir_list[0]/$tarballs[0]";
|
||||
print "Here are the compressed sources and a GPG detached signature[*]:\n"
|
||||
. " $m\n"
|
||||
. " $m.sig\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
|
||||
-f $xd
|
||||
and print_locations ("xdelta diffs (useful? if so, "
|
||||
. "please tell bug-gnulib\@gnu.org)",
|
||||
@url_dir_list, %size, $xd);
|
||||
my @sig_files = map { "$_.sig" } @tarballs;
|
||||
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
|
||||
@sig_files);
|
||||
}
|
||||
|
||||
if ($url_dir_list[0] =~ "gnu\.org")
|
||||
{
|
||||
print "Use a mirror for higher download bandwidth:\n";
|
||||
if (@tarballs == 1 && $url_dir_list[0] =~ m!http://ftp\.gnu\.org/gnu/!)
|
||||
{
|
||||
(my $m = "$url_dir_list[0]/$tarballs[0]")
|
||||
=~ s!http://ftp\.gnu\.org/gnu/!http://ftpmirror\.gnu\.org/!;
|
||||
print " $m\n"
|
||||
. " $m.sig\n\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print " http://www.gnu.org/order/ftp.html\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
$print_checksums_p
|
||||
and print_checksums (@sizable);
|
||||
|
||||
print <<EOF;
|
||||
[*] Use a .sig file to verify that the corresponding file (without the
|
||||
.sig suffix) is intact. First, be sure to download both the .sig file
|
||||
and the corresponding tarball. Then, run a command like this:
|
||||
|
||||
gpg --verify $tarballs[0].sig
|
||||
|
||||
If that command fails because you don't have the required public key,
|
||||
then run this command to import it:
|
||||
|
||||
gpg --keyserver keys.gnupg.net --recv-keys $gpg_key_id
|
||||
|
||||
and rerun the 'gpg --verify' command.
|
||||
EOF
|
||||
|
||||
my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version);
|
||||
@tool_versions
|
||||
and print "\nThis release was bootstrapped with the following tools:",
|
||||
join ('', map {"\n $_"} @tool_versions), "\n";
|
||||
|
||||
print_news_deltas ($_, $prev_version, $curr_version)
|
||||
foreach @news_file;
|
||||
|
||||
$release_type eq 'stable'
|
||||
or print_changelog_deltas ($package_name, $prev_version);
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
||||
## Local Variables:
|
||||
## mode: perl
|
||||
## perl-indent-level: 2
|
||||
## perl-continued-statement-offset: 2
|
||||
## perl-continued-brace-offset: 0
|
||||
## perl-brace-offset: 0
|
||||
## perl-brace-imaginary-offset: 0
|
||||
## perl-label-offset: -2
|
||||
## perl-extra-newline-before-brace: t
|
||||
## perl-merge-trailing-else: nil
|
||||
## eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC0"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for Microsoft lib.exe
|
||||
|
||||
me=ar-lib
|
||||
scriptversion=2012-03-01.08; # UTC
|
||||
|
||||
# Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
||||
# Written by Peter Rosin <peda@lysator.liu.se>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
|
||||
# func_error message
|
||||
func_error ()
|
||||
{
|
||||
echo "$me: $1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv in
|
||||
mingw)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_at_file at_file operation archive
|
||||
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
|
||||
# for each of them.
|
||||
# When interpreting the content of the @FILE, do NOT use func_file_conv,
|
||||
# since the user would need to supply preconverted file names to
|
||||
# binutils ar, at least for MinGW.
|
||||
func_at_file ()
|
||||
{
|
||||
operation=$2
|
||||
archive=$3
|
||||
at_file_contents=`cat "$1"`
|
||||
eval set x "$at_file_contents"
|
||||
shift
|
||||
|
||||
for member
|
||||
do
|
||||
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
|
||||
done
|
||||
}
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
func_error "no command. Try '$0 --help' for more information."
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<EOF
|
||||
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
|
||||
|
||||
Members may be specified in a file named with @FILE.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "$me, version $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $# -lt 3; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
|
||||
AR=$1
|
||||
shift
|
||||
while :
|
||||
do
|
||||
if test $# -lt 2; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
case $1 in
|
||||
-lib | -LIB \
|
||||
| -ltcg | -LTCG \
|
||||
| -machine* | -MACHINE* \
|
||||
| -subsystem* | -SUBSYSTEM* \
|
||||
| -verbose | -VERBOSE \
|
||||
| -wx* | -WX* )
|
||||
AR="$AR $1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
action=$1
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
orig_archive=$1
|
||||
shift
|
||||
func_file_conv "$orig_archive"
|
||||
archive=$file
|
||||
|
||||
# strip leading dash in $action
|
||||
action=${action#-}
|
||||
|
||||
delete=
|
||||
extract=
|
||||
list=
|
||||
quick=
|
||||
replace=
|
||||
index=
|
||||
create=
|
||||
|
||||
while test -n "$action"
|
||||
do
|
||||
case $action in
|
||||
d*) delete=yes ;;
|
||||
x*) extract=yes ;;
|
||||
t*) list=yes ;;
|
||||
q*) quick=yes ;;
|
||||
r*) replace=yes ;;
|
||||
s*) index=yes ;;
|
||||
S*) ;; # the index is always updated implicitly
|
||||
c*) create=yes ;;
|
||||
u*) ;; # TODO: don't ignore the update modifier
|
||||
v*) ;; # TODO: don't ignore the verbose modifier
|
||||
*)
|
||||
func_error "unknown action specified"
|
||||
;;
|
||||
esac
|
||||
action=${action#?}
|
||||
done
|
||||
|
||||
case $delete$extract$list$quick$replace,$index in
|
||||
yes,* | ,yes)
|
||||
;;
|
||||
yesyes*)
|
||||
func_error "more than one action specified"
|
||||
;;
|
||||
*)
|
||||
func_error "no action specified"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$delete"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -REMOVE "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
elif test -n "$extract"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
if test $# -gt 0; then
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -EXTRACT "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
|
||||
do
|
||||
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
elif test -n "$quick$replace"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
if test -z "$create"; then
|
||||
echo "$me: creating $orig_archive"
|
||||
fi
|
||||
orig_archive=
|
||||
else
|
||||
orig_archive=$archive
|
||||
fi
|
||||
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_file_conv "${1#@}"
|
||||
set x "$@" "@$file"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
set x "$@" "$file"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
if test -n "$orig_archive"; then
|
||||
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
|
||||
else
|
||||
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
|
||||
fi
|
||||
|
||||
elif test -n "$list"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
$AR -NOLOGO -LIST "$archive" || exit $?
|
||||
fi
|
||||
+348
@@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1999-2015 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+1466
File diff suppressed because it is too large
Load Diff
+684
@@ -0,0 +1,684 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2017 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# Known limitations:
|
||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||
# known workaround is to choose shorter directory names for the build
|
||||
# directory and/or the installation directory.
|
||||
|
||||
# All known linkers require a '.a' archive for static linking (except MSVC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shrext=.so
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_CC_BASENAME.
|
||||
|
||||
for cc_temp in $CC""; do
|
||||
case $cc_temp in
|
||||
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
||||
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
||||
\-*) ;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
case $cc_basename in
|
||||
ecc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
icc* | ifort*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
lf95*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
nagfor*)
|
||||
wl='-Wl,-Wl,,'
|
||||
;;
|
||||
pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
ccc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
xl* | bgxl* | bgf* | mpixl*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
como)
|
||||
wl='-lopt='
|
||||
;;
|
||||
*)
|
||||
case `$CC -V 2>&1 | sed 5q` in
|
||||
*Sun\ F* | *Sun*Fortran*)
|
||||
wl=
|
||||
;;
|
||||
*Sun\ C*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
case $cc_basename in
|
||||
f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
unicos*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
interix*)
|
||||
# we just hope/assume this is gcc and not c89 (= MSVC++)
|
||||
with_gnu_ld=yes
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# Set some defaults for GNU ld with shared library support. These
|
||||
# are reset later if shared libraries are not supported. Putting them
|
||||
# here allows them to be overridden if necessary.
|
||||
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
case "$host_os" in
|
||||
aix[3-9]*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc)
|
||||
;;
|
||||
m68k)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
haiku*)
|
||||
;;
|
||||
interix[3-9]*)
|
||||
hardcode_direct=no
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
solaris*)
|
||||
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
|
||||
case `$LD -v 2>&1` in
|
||||
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = no; then
|
||||
hardcode_libdir_flag_spec=
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix[4-9]*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
:
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
fi
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath="/usr/lib:/lib"
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc)
|
||||
;;
|
||||
m68k)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
bsdi[45]*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=no
|
||||
if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
freebsd2.[01]*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
hpux10*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
fi
|
||||
;;
|
||||
hpux11*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
case $host_cpu in
|
||||
hppa*64*|ia64*)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
*)
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
;;
|
||||
openbsd*)
|
||||
if test -f /usr/libexec/ld.so; then
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
case $host_vendor in
|
||||
sni)
|
||||
hardcode_direct=yes # is this really true???
|
||||
;;
|
||||
siemens)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
motorola)
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6*)
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||
hardcode_libdir_separator=':'
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
|
||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||
# only about the one the linker finds when passed -lNAME. This is the last
|
||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||
# linker has special search rules.
|
||||
library_names_spec= # the last element of library_names_spec in libtool.m4
|
||||
libname_spec='lib$name'
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
aix[4-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc*)
|
||||
library_names_spec='$libname$shrext' ;;
|
||||
m68k)
|
||||
library_names_spec='$libname.a' ;;
|
||||
esac
|
||||
;;
|
||||
beos*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
bsdi[45]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.dll.a $libname.lib'
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shrext=.dylib
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
dgux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
freebsd[23].*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
gnu*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
haiku*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_cpu in
|
||||
ia64*)
|
||||
shrext=.so
|
||||
;;
|
||||
hppa*64*)
|
||||
shrext=.sl
|
||||
;;
|
||||
*)
|
||||
shrext=.sl
|
||||
;;
|
||||
esac
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
interix[3-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
case "$host_os" in
|
||||
irix5* | nonstopux*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
knetbsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
netbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
newsos6)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
openbsd*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sunos4*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
sysv4 | sysv4.3*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
tpf*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
uts4*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Format of library name prefix.
|
||||
libname_spec="$escaped_libname_spec"
|
||||
|
||||
# Library names that the linker finds when passed -lNAME.
|
||||
library_names_spec="$escaped_library_names_spec"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
EOF
|
||||
+1836
File diff suppressed because it is too large
Load Diff
+756
@@ -0,0 +1,756 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,179 @@
|
||||
#!/bin/sh
|
||||
# In a git/autoconf/automake-enabled project with a NEWS file and a version-
|
||||
# controlled .prev-version file, automate the procedure by which we record
|
||||
# the date, release-type and version string in the NEWS file. That commit
|
||||
# will serve to identify the release, so apply a signed tag to it as well.
|
||||
VERSION=2016-12-31.14 # UTC
|
||||
|
||||
# Note: this is a bash script (could be zsh or dash)
|
||||
|
||||
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering
|
||||
|
||||
ME=$(basename "$0")
|
||||
warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
|
||||
die() { warn "$*"; exit 1; }
|
||||
|
||||
help()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $ME [OPTION...] VERSION RELEASE_TYPE
|
||||
|
||||
Run this script from top_srcdir to perform the final pre-release NEWS
|
||||
update in which the date, release-type and version string are
|
||||
recorded. Commit that result with a log entry marking the release,
|
||||
and apply a signed tag. Run it from your project's top-level
|
||||
directory.
|
||||
|
||||
Requirements:
|
||||
- you use git for version-control
|
||||
- a version-controlled .prev-version file
|
||||
- a NEWS file, with line 3 identical to this:
|
||||
$noteworthy_stub
|
||||
|
||||
Options:
|
||||
--branch=BRANCH set release branch (default: $branch)
|
||||
-C, --builddir=DIR location of (configured) Makefile (default: $builddir)
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
|
||||
EXAMPLE:
|
||||
To update NEWS and tag the beta 8.1 release of coreutils, I would run this:
|
||||
|
||||
$ME 8.1 beta
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
version()
|
||||
{
|
||||
year=$(echo "$VERSION" | sed 's/[^0-9].*//')
|
||||
cat <<EOF
|
||||
$ME $VERSION
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
## ------ ##
|
||||
## Main. ##
|
||||
## ------ ##
|
||||
|
||||
# Constants.
|
||||
noteworthy='* Noteworthy changes in release'
|
||||
noteworthy_stub="$noteworthy ?.? (????-??-??) [?]"
|
||||
|
||||
# Variables.
|
||||
branch=$(git branch | sed -ne '/^\* /{s///;p;q;}')
|
||||
builddir=.
|
||||
|
||||
while test $# != 0
|
||||
do
|
||||
# Handle --option=value by splitting apart and putting back on argv.
|
||||
case $1 in
|
||||
--*=*)
|
||||
opt=$(echo "$1" | sed -e 's/=.*//')
|
||||
val=$(echo "$1" | sed -e 's/[^=]*=//')
|
||||
shift
|
||||
set dummy "$opt" "$val" "$@"; shift
|
||||
;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--help|--version) ${1#--};;
|
||||
--branch) shift; branch=$1; shift ;;
|
||||
-C|--builddir) shift; builddir=$1; shift ;;
|
||||
--*) die "unrecognized option: $1";;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
test $# = 2 \
|
||||
|| die "Usage: $ME [OPTION...] VERSION TYPE"
|
||||
|
||||
ver=$1
|
||||
type=$2
|
||||
|
||||
|
||||
## ---------------------- ##
|
||||
## First, sanity checks. ##
|
||||
## ---------------------- ##
|
||||
|
||||
# Verify that $ver looks like a version number, and...
|
||||
echo "$ver"|grep -E '^[0-9][0-9.]*[0-9]$' > /dev/null \
|
||||
|| die "invalid version: $ver"
|
||||
prev_ver=$(cat .prev-version) \
|
||||
|| die 'failed to determine previous version number from .prev-version'
|
||||
|
||||
# Verify that $ver is sensible (> .prev-version).
|
||||
case $(printf "$prev_ver\n$ver\n"|sort -V -u|tr '\n' ':') in
|
||||
"$prev_ver:$ver:") ;;
|
||||
*) die "invalid version: $ver (<= $prev_ver)";;
|
||||
esac
|
||||
|
||||
case $type in
|
||||
alpha|beta|stable) ;;
|
||||
*) die "invalid release type: $type";;
|
||||
esac
|
||||
|
||||
# No local modifications allowed.
|
||||
case $(git diff-index --name-only HEAD) in
|
||||
'') ;;
|
||||
*) die 'this tree is dirty; commit your changes first';;
|
||||
esac
|
||||
|
||||
# Ensure the current branch name is correct:
|
||||
curr_br=$(git rev-parse --symbolic-full-name HEAD)
|
||||
test "$curr_br" = "refs/heads/$branch" || die not on branch $branch
|
||||
|
||||
# Extract package name from Makefile.
|
||||
Makefile=$builddir/Makefile
|
||||
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' "$Makefile") \
|
||||
|| die "failed to determine package name from $Makefile"
|
||||
|
||||
# Check that line 3 of NEWS is the stub line about to be replaced.
|
||||
test "$(sed -n 3p NEWS)" = "$noteworthy_stub" \
|
||||
|| die "line 3 of NEWS must be exactly '$noteworthy_stub'"
|
||||
|
||||
## --------------- ##
|
||||
## Then, changes. ##
|
||||
## --------------- ##
|
||||
|
||||
# Update NEWS to have today's date, plus desired version number and $type.
|
||||
perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
|
||||
-e 'my ($type, $ver) = qw('"$type $ver"');' \
|
||||
-e 'my $pfx = "'"$noteworthy"'";' \
|
||||
-e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
|
||||
NEWS || die 'failed to update NEWS'
|
||||
|
||||
printf "version $ver\n\n* NEWS: Record release date.\n" \
|
||||
| git commit -F - -a || die 'git commit failed'
|
||||
git tag -s -m "$pkg $ver" v$ver HEAD || die 'git tag failed'
|
||||
|
||||
# Local variables:
|
||||
# indent-tabs-mode: nil
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "VERSION="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: " # UTC"
|
||||
# End:
|
||||
+504
@@ -0,0 +1,504 @@
|
||||
#!/bin/sh -e
|
||||
# gendocs.sh -- generate a GNU manual in many formats. This script is
|
||||
# mentioned in maintain.texi. See the help message below for usage details.
|
||||
|
||||
scriptversion=2016-12-31.18
|
||||
|
||||
# Copyright 2003-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Original author: Mohit Agarwal.
|
||||
# Send bug reports and any other correspondence to bug-gnulib@gnu.org.
|
||||
#
|
||||
# The latest version of this script, and the companion template, is
|
||||
# available from the Gnulib repository:
|
||||
#
|
||||
# http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh
|
||||
# http://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template
|
||||
|
||||
# TODO:
|
||||
# - image importing was only implemented for HTML generated by
|
||||
# makeinfo. But it should be simple enough to adjust.
|
||||
# - images are not imported in the source tarball. All the needed
|
||||
# formats (PDF, PNG, etc.) should be included.
|
||||
|
||||
prog=`basename "$0"`
|
||||
srcdir=`pwd`
|
||||
|
||||
scripturl="http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
|
||||
templateurl="http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
|
||||
|
||||
: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
|
||||
: ${MAKEINFO="makeinfo"}
|
||||
: ${TEXI2DVI="texi2dvi"}
|
||||
: ${DOCBOOK2HTML="docbook2html"}
|
||||
: ${DOCBOOK2PDF="docbook2pdf"}
|
||||
: ${DOCBOOK2TXT="docbook2txt"}
|
||||
: ${GENDOCS_TEMPLATE_DIR="."}
|
||||
: ${PERL='perl'}
|
||||
: ${TEXI2HTML="texi2html"}
|
||||
unset CDPATH
|
||||
unset use_texi2html
|
||||
|
||||
MANUAL_TITLE=
|
||||
PACKAGE=
|
||||
EMAIL=webmasters@gnu.org # please override with --email
|
||||
commonarg= # passed to all makeinfo/texi2html invcations.
|
||||
dirargs= # passed to all tools (-I dir).
|
||||
dirs= # -I directories.
|
||||
htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
|
||||
infoarg=--no-split
|
||||
generate_ascii=true
|
||||
generate_html=true
|
||||
generate_info=true
|
||||
generate_tex=true
|
||||
outdir=manual
|
||||
source_extra=
|
||||
split=node
|
||||
srcfile=
|
||||
texarg="-t @finalout"
|
||||
|
||||
version="gendocs.sh $scriptversion
|
||||
|
||||
Copyright 2017 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING."
|
||||
|
||||
usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
|
||||
|
||||
Generate output in various formats from PACKAGE.texinfo (or .texi or
|
||||
.txi) source. See the GNU Maintainers document for a more extensive
|
||||
discussion:
|
||||
http://www.gnu.org/prep/maintain_toc.html
|
||||
|
||||
Options:
|
||||
--email ADR use ADR as contact in generated web pages; always give this.
|
||||
|
||||
-s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
|
||||
-o OUTDIR write files into OUTDIR, instead of manual/.
|
||||
-I DIR append DIR to the Texinfo search path.
|
||||
--common ARG pass ARG in all invocations.
|
||||
--html ARG pass ARG to makeinfo or texi2html for HTML targets,
|
||||
instead of '$htmlarg'.
|
||||
--info ARG pass ARG to makeinfo for Info, instead of --no-split.
|
||||
--no-ascii skip generating the plain text output.
|
||||
--no-html skip generating the html output.
|
||||
--no-info skip generating the info output.
|
||||
--no-tex skip generating the dvi and pdf output.
|
||||
--source ARG include ARG in tar archive of sources.
|
||||
--split HOW make split HTML by node, section, chapter; default node.
|
||||
--tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
|
||||
|
||||
--texi2html use texi2html to make HTML target, with all split versions.
|
||||
--docbook convert through DocBook too (xml, txt, html, pdf).
|
||||
|
||||
--help display this help and exit successfully.
|
||||
--version display version information and exit successfully.
|
||||
|
||||
Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
|
||||
|
||||
Typical sequence:
|
||||
cd PACKAGESOURCE/doc
|
||||
wget \"$scripturl\"
|
||||
wget \"$templateurl\"
|
||||
$prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
|
||||
|
||||
Output will be in a new subdirectory \"manual\" (by default;
|
||||
use -o OUTDIR to override). Move all the new files into your web CVS
|
||||
tree, as explained in the Web Pages node of maintain.texi.
|
||||
|
||||
Please use the --email ADDRESS option so your own bug-reporting
|
||||
address will be used in the generated HTML pages.
|
||||
|
||||
MANUAL-TITLE is included as part of the HTML <title> of the overall
|
||||
manual/index.html file. It should include the name of the package being
|
||||
documented. manual/index.html is created by substitution from the file
|
||||
$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
|
||||
generic template for your own purposes.)
|
||||
|
||||
If you have several manuals, you'll need to run this script several
|
||||
times with different MANUAL values, specifying a different output
|
||||
directory with -o each time. Then write (by hand) an overall index.html
|
||||
with links to them all.
|
||||
|
||||
If a manual's Texinfo sources are spread across several directories,
|
||||
first copy or symlink all Texinfo sources into a single directory.
|
||||
(Part of the script's work is to make a tar.gz of the sources.)
|
||||
|
||||
As implied above, by default monolithic Info files are generated.
|
||||
If you want split Info, or other Info options, use --info to override.
|
||||
|
||||
You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
|
||||
and PERL to control the programs that get executed, and
|
||||
GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
|
||||
looked for. With --docbook, the environment variables DOCBOOK2HTML,
|
||||
DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
|
||||
|
||||
By default, makeinfo and texi2dvi are run in the default (English)
|
||||
locale, since that's the language of most Texinfo manuals. If you
|
||||
happen to have a non-English manual and non-English web site, see the
|
||||
SETLANG setting in the source.
|
||||
|
||||
Email bug reports or enhancement requests to bug-gnulib@gnu.org.
|
||||
"
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
-s) shift; srcfile=$1;;
|
||||
-o) shift; outdir=$1;;
|
||||
-I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
|
||||
--common) shift; commonarg=$1;;
|
||||
--docbook) docbook=yes;;
|
||||
--email) shift; EMAIL=$1;;
|
||||
--html) shift; htmlarg=$1;;
|
||||
--info) shift; infoarg=$1;;
|
||||
--no-ascii) generate_ascii=false;;
|
||||
--no-html) generate_ascii=false;;
|
||||
--no-info) generate_info=false;;
|
||||
--no-tex) generate_tex=false;;
|
||||
--source) shift; source_extra=$1;;
|
||||
--split) shift; split=$1;;
|
||||
--tex) shift; texarg=$1;;
|
||||
--texi2html) use_texi2html=1;;
|
||||
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
-*)
|
||||
echo "$0: Unknown option \`$1'." >&2
|
||||
echo "$0: Try \`--help' for more information." >&2
|
||||
exit 1;;
|
||||
*)
|
||||
if test -z "$PACKAGE"; then
|
||||
PACKAGE=$1
|
||||
elif test -z "$MANUAL_TITLE"; then
|
||||
MANUAL_TITLE=$1
|
||||
else
|
||||
echo "$0: extra non-option argument \`$1'." >&2
|
||||
exit 1
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# makeinfo uses the dirargs, but texi2dvi doesn't.
|
||||
commonarg=" $dirargs $commonarg"
|
||||
|
||||
# For most of the following, the base name is just $PACKAGE
|
||||
base=$PACKAGE
|
||||
|
||||
if test -n "$srcfile"; then
|
||||
# but here, we use the basename of $srcfile
|
||||
base=`basename "$srcfile"`
|
||||
case $base in
|
||||
*.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
|
||||
esac
|
||||
PACKAGE=$base
|
||||
elif test -s "$srcdir/$PACKAGE.texinfo"; then
|
||||
srcfile=$srcdir/$PACKAGE.texinfo
|
||||
elif test -s "$srcdir/$PACKAGE.texi"; then
|
||||
srcfile=$srcdir/$PACKAGE.texi
|
||||
elif test -s "$srcdir/$PACKAGE.txi"; then
|
||||
srcfile=$srcdir/$PACKAGE.txi
|
||||
else
|
||||
echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
|
||||
echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
|
||||
echo "$0: it is available from $templateurl." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to return size of $1 in something resembling kilobytes.
|
||||
calcsize()
|
||||
{
|
||||
size=`ls -ksl $1 | awk '{print $1}'`
|
||||
echo $size
|
||||
}
|
||||
|
||||
# copy_images OUTDIR HTML-FILE...
|
||||
# -------------------------------
|
||||
# Copy all the images needed by the HTML-FILEs into OUTDIR.
|
||||
# Look for them in . and the -I directories; this is simpler than what
|
||||
# makeinfo supports with -I, but hopefully it will suffice.
|
||||
copy_images()
|
||||
{
|
||||
local odir
|
||||
odir=$1
|
||||
shift
|
||||
$PERL -n -e "
|
||||
BEGIN {
|
||||
\$me = '$prog';
|
||||
\$odir = '$odir';
|
||||
@dirs = qw(. $dirs);
|
||||
}
|
||||
" -e '
|
||||
/<img src="(.*?)"/g && ++$need{$1};
|
||||
|
||||
END {
|
||||
#print "$me: @{[keys %need]}\n"; # for debugging, show images found.
|
||||
FILE: for my $f (keys %need) {
|
||||
for my $d (@dirs) {
|
||||
if (-f "$d/$f") {
|
||||
use File::Basename;
|
||||
my $dest = dirname ("$odir/$f");
|
||||
#
|
||||
use File::Path;
|
||||
-d $dest || mkpath ($dest)
|
||||
|| die "$me: cannot mkdir $dest: $!\n";
|
||||
#
|
||||
use File::Copy;
|
||||
copy ("$d/$f", $dest)
|
||||
|| die "$me: cannot copy $d/$f to $dest: $!\n";
|
||||
next FILE;
|
||||
}
|
||||
}
|
||||
die "$me: $ARGV: cannot find image $f\n";
|
||||
}
|
||||
}
|
||||
' -- "$@" || exit 1
|
||||
}
|
||||
|
||||
case $outdir in
|
||||
/*) abs_outdir=$outdir;;
|
||||
*) abs_outdir=$srcdir/$outdir;;
|
||||
esac
|
||||
|
||||
echo "Making output for $srcfile"
|
||||
echo " in `pwd`"
|
||||
mkdir -p "$outdir/"
|
||||
|
||||
#
|
||||
if $generate_info; then
|
||||
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
|
||||
echo "Generating info... ($cmd)"
|
||||
rm -f $PACKAGE.info* # get rid of any strays
|
||||
eval "$cmd"
|
||||
tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
|
||||
ls -l "$outdir/$PACKAGE.info.tar.gz"
|
||||
info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
|
||||
# do not mv the info files, there's no point in having them available
|
||||
# separately on the web.
|
||||
fi # end info
|
||||
|
||||
#
|
||||
if $generate_tex; then
|
||||
cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
|
||||
printf "\nGenerating dvi... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
# compress/finish dvi:
|
||||
gzip -f -9 $PACKAGE.dvi
|
||||
dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
|
||||
mv $PACKAGE.dvi.gz "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.dvi.gz"
|
||||
|
||||
cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
|
||||
printf "\nGenerating pdf... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
pdf_size=`calcsize $PACKAGE.pdf`
|
||||
mv $PACKAGE.pdf "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.pdf"
|
||||
fi # end tex (dvi + pdf)
|
||||
|
||||
#
|
||||
if $generate_ascii; then
|
||||
opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
printf "\nGenerating ascii... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
ascii_size=`calcsize $PACKAGE.txt`
|
||||
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
|
||||
ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
|
||||
mv $PACKAGE.txt "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
|
||||
fi
|
||||
|
||||
#
|
||||
|
||||
if $generate_html; then
|
||||
# Split HTML at level $1. Used for texi2html.
|
||||
html_split()
|
||||
{
|
||||
opt="--split=$1 --node-files $commonarg $htmlarg"
|
||||
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
|
||||
printf "\nGenerating html by $1... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
split_html_dir=$PACKAGE.html
|
||||
(
|
||||
cd ${split_html_dir} || exit 1
|
||||
ln -sf ${PACKAGE}.html index.html
|
||||
tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
|
||||
)
|
||||
eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
|
||||
rm -f "$outdir"/html_$1/*.html
|
||||
mkdir -p "$outdir/html_$1/"
|
||||
mv ${split_html_dir}/*.html "$outdir/html_$1/"
|
||||
rmdir ${split_html_dir}
|
||||
}
|
||||
|
||||
if test -z "$use_texi2html"; then
|
||||
opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
printf "\nGenerating monolithic html... ($cmd)\n"
|
||||
rm -rf $PACKAGE.html # in case a directory is left over
|
||||
eval "$cmd"
|
||||
html_mono_size=`calcsize $PACKAGE.html`
|
||||
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
|
||||
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
|
||||
copy_images "$outdir/" $PACKAGE.html
|
||||
mv $PACKAGE.html "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
|
||||
|
||||
# Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
|
||||
# it just always split by node. So if we're splitting by node anyway,
|
||||
# leave it out.
|
||||
if test "x$split" = xnode; then
|
||||
split_arg=
|
||||
else
|
||||
split_arg=--split=$split
|
||||
fi
|
||||
#
|
||||
opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
printf "\nGenerating html by $split... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
split_html_dir=$PACKAGE.html
|
||||
copy_images $split_html_dir/ $split_html_dir/*.html
|
||||
(
|
||||
cd $split_html_dir || exit 1
|
||||
tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
|
||||
)
|
||||
eval \
|
||||
html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
|
||||
rm -rf "$outdir/html_$split/"
|
||||
mv $split_html_dir "$outdir/html_$split/"
|
||||
du -s "$outdir/html_$split/"
|
||||
ls -l "$outdir/$PACKAGE.html_$split.tar.gz"
|
||||
|
||||
else # use texi2html:
|
||||
opt="--output $PACKAGE.html $commonarg $htmlarg"
|
||||
cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
|
||||
printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
|
||||
rm -rf $PACKAGE.html # in case a directory is left over
|
||||
eval "$cmd"
|
||||
html_mono_size=`calcsize $PACKAGE.html`
|
||||
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
|
||||
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
|
||||
mv $PACKAGE.html "$outdir/"
|
||||
|
||||
html_split node
|
||||
html_split chapter
|
||||
html_split section
|
||||
fi
|
||||
fi # end html
|
||||
|
||||
#
|
||||
printf "\nMaking .tar.gz for sources...\n"
|
||||
d=`dirname $srcfile`
|
||||
(
|
||||
cd "$d"
|
||||
srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true
|
||||
tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
|
||||
ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
|
||||
)
|
||||
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
|
||||
|
||||
#
|
||||
# Do everything again through docbook.
|
||||
if test -n "$docbook"; then
|
||||
opt="-o - --docbook $commonarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
|
||||
printf "\nGenerating docbook XML... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_xml_size=`calcsize $PACKAGE-db.xml`
|
||||
gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
|
||||
docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
|
||||
mv $PACKAGE-db.xml "$outdir/"
|
||||
|
||||
split_html_db_dir=html_node_db
|
||||
opt="$commonarg -o $split_html_db_dir"
|
||||
cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
|
||||
printf "\nGenerating docbook HTML... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
(
|
||||
cd ${split_html_db_dir} || exit 1
|
||||
tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
|
||||
)
|
||||
html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
|
||||
rm -f "$outdir"/html_node_db/*.html
|
||||
mkdir -p "$outdir/html_node_db"
|
||||
mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
|
||||
rmdir ${split_html_db_dir}
|
||||
|
||||
cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
|
||||
printf "\nGenerating docbook ASCII... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
|
||||
mv $PACKAGE-db.txt "$outdir/"
|
||||
|
||||
cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
|
||||
printf "\nGenerating docbook PDF... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
|
||||
mv $PACKAGE-db.pdf "$outdir/"
|
||||
fi
|
||||
|
||||
#
|
||||
printf "\nMaking index.html for $PACKAGE...\n"
|
||||
if test -z "$use_texi2html"; then
|
||||
CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
|
||||
/%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
|
||||
else
|
||||
# should take account of --split here.
|
||||
CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
|
||||
fi
|
||||
|
||||
curdate=`$SETLANG date '+%B %d, %Y'`
|
||||
sed \
|
||||
-e "s!%%TITLE%%!$MANUAL_TITLE!g" \
|
||||
-e "s!%%EMAIL%%!$EMAIL!g" \
|
||||
-e "s!%%PACKAGE%%!$PACKAGE!g" \
|
||||
-e "s!%%DATE%%!$curdate!g" \
|
||||
-e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
|
||||
-e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
|
||||
-e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
|
||||
-e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
|
||||
-e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
|
||||
-e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
|
||||
-e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
|
||||
-e "s!%%PDF_SIZE%%!$pdf_size!g" \
|
||||
-e "s!%%ASCII_SIZE%%!$ascii_size!g" \
|
||||
-e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
|
||||
-e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
|
||||
-e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
|
||||
-e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
|
||||
-e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
|
||||
-e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
|
||||
-e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
|
||||
-e "s,%%SCRIPTURL%%,$scripturl,g" \
|
||||
-e "s!%%SCRIPTNAME%%!$prog!g" \
|
||||
-e "$CONDS" \
|
||||
$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
|
||||
|
||||
echo "Done, see $outdir/ subdirectory for new files."
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -0,0 +1,226 @@
|
||||
#!/bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2017-01-09.19; # UTC
|
||||
|
||||
# Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
|
||||
# It may be run two ways:
|
||||
# - from a git repository in which the "git describe" command below
|
||||
# produces useful output (thus requiring at least one signed tag)
|
||||
# - from a non-git-repo directory containing a .tarball-version file, which
|
||||
# presumes this script is invoked like "./git-version-gen .tarball-version".
|
||||
|
||||
# In order to use intra-version strings in your project, you will need two
|
||||
# separate generated version string files:
|
||||
#
|
||||
# .tarball-version - present only in a distribution tarball, and not in
|
||||
# a checked-out repository. Created with contents that were learned at
|
||||
# the last time autoconf was run, and used by git-version-gen. Must not
|
||||
# be present in either $(srcdir) or $(builddir) for git-version-gen to
|
||||
# give accurate answers during normal development with a checked out tree,
|
||||
# but must be present in a tarball when there is no version control system.
|
||||
# Therefore, it cannot be used in any dependencies. GNUmakefile has
|
||||
# hooks to force a reconfigure at distribution time to get the value
|
||||
# correct, without penalizing normal development with extra reconfigures.
|
||||
#
|
||||
# .version - present in a checked-out repository and in a distribution
|
||||
# tarball. Usable in dependencies, particularly for files that don't
|
||||
# want to depend on config.h but do want to track version changes.
|
||||
# Delete this file prior to any autoconf run where you want to rebuild
|
||||
# files to pick up a version string change; and leave it stale to
|
||||
# minimize rebuild time after unrelated changes to configure sources.
|
||||
#
|
||||
# As with any generated file in a VC'd directory, you should add
|
||||
# /.version to .gitignore, so that you don't accidentally commit it.
|
||||
# .tarball-version is never generated in a VC'd directory, so needn't
|
||||
# be listed there.
|
||||
#
|
||||
# Use the following line in your configure.ac, so that $(VERSION) will
|
||||
# automatically be up-to-date each time configure is run (and note that
|
||||
# since configure.ac no longer includes a version string, Makefile rules
|
||||
# should not depend on configure.ac for version updates).
|
||||
#
|
||||
# AC_INIT([GNU project],
|
||||
# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
# [bug-project@example])
|
||||
#
|
||||
# Then use the following lines in your Makefile.am, so that .version
|
||||
# will be present for dependencies, and so that .version and
|
||||
# .tarball-version will exist in distribution tarballs.
|
||||
#
|
||||
# EXTRA_DIST = $(top_srcdir)/.version
|
||||
# BUILT_SOURCES = $(top_srcdir)/.version
|
||||
# $(top_srcdir)/.version:
|
||||
# echo $(VERSION) > $@-t && mv $@-t $@
|
||||
# dist-hook:
|
||||
# echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
|
||||
me=$0
|
||||
|
||||
version="git-version-gen $scriptversion
|
||||
|
||||
Copyright 2011 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING."
|
||||
|
||||
usage="\
|
||||
Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
|
||||
Print a version string.
|
||||
|
||||
Options:
|
||||
|
||||
--prefix PREFIX prefix of git tags (default 'v')
|
||||
--fallback VERSION
|
||||
fallback version to use if \"git --version\" fails
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Running without arguments will suffice in most cases."
|
||||
|
||||
prefix=v
|
||||
fallback=
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
--prefix) shift; prefix=${1?};;
|
||||
--fallback) shift; fallback=${1?};;
|
||||
-*)
|
||||
echo "$0: Unknown option '$1'." >&2
|
||||
echo "$0: Try '--help' for more information." >&2
|
||||
exit 1;;
|
||||
*)
|
||||
if test "x$tarball_version_file" = x; then
|
||||
tarball_version_file="$1"
|
||||
elif test "x$tag_sed_script" = x; then
|
||||
tag_sed_script="$1"
|
||||
else
|
||||
echo "$0: extra non-option argument '$1'." >&2
|
||||
exit 1
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test "x$tarball_version_file" = x; then
|
||||
echo "$usage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tag_sed_script="${tag_sed_script:-s/x/x/}"
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# Avoid meddling by environment variable of the same name.
|
||||
v=
|
||||
v_from_git=
|
||||
|
||||
# First see if there is a tarball-only version file.
|
||||
# then try "git describe", then default.
|
||||
if test -f $tarball_version_file
|
||||
then
|
||||
v=`cat $tarball_version_file` || v=
|
||||
case $v in
|
||||
*$nl*) v= ;; # reject multi-line output
|
||||
[0-9]*) ;;
|
||||
*) v= ;;
|
||||
esac
|
||||
test "x$v" = x \
|
||||
&& echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2
|
||||
fi
|
||||
|
||||
if test "x$v" != x
|
||||
then
|
||||
: # use $v
|
||||
# Otherwise, if there is at least one git commit involving the working
|
||||
# directory, and "git describe" output looks sensible, use that to
|
||||
# derive a version string.
|
||||
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
|
||||
&& v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
|
||||
|| git describe --abbrev=4 HEAD 2>/dev/null` \
|
||||
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
|
||||
&& case $v in
|
||||
$prefix[0-9]*) ;;
|
||||
*) (exit 1) ;;
|
||||
esac
|
||||
then
|
||||
# Is this a new git that lists number of commits since the last
|
||||
# tag or the previous older version that did not?
|
||||
# Newer: v6.10-77-g0f8faeb
|
||||
# Older: v6.10-g0f8faeb
|
||||
case $v in
|
||||
*-*-*) : git describe is okay three part flavor ;;
|
||||
*-*)
|
||||
: git describe is older two part flavor
|
||||
# Recreate the number of commits and rewrite such that the
|
||||
# result is the same as if we were using the newer version
|
||||
# of git describe.
|
||||
vtag=`echo "$v" | sed 's/-.*//'`
|
||||
commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \
|
||||
|| { commit_list=failed;
|
||||
echo "$0: WARNING: git rev-list failed" 1>&2; }
|
||||
numcommits=`echo "$commit_list" | wc -l`
|
||||
v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
|
||||
test "$commit_list" = failed && v=UNKNOWN
|
||||
;;
|
||||
esac
|
||||
|
||||
# Change the first '-' to a '.', so version-comparing tools work properly.
|
||||
# Remove the "g" in git describe's output string, to save a byte.
|
||||
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
|
||||
v_from_git=1
|
||||
elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
|
||||
v=UNKNOWN
|
||||
else
|
||||
v=$fallback
|
||||
fi
|
||||
|
||||
v=`echo "$v" |sed "s/^$prefix//"`
|
||||
|
||||
# Test whether to append the "-dirty" suffix only if the version
|
||||
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
|
||||
# or if it came from .tarball-version.
|
||||
if test "x$v_from_git" != x; then
|
||||
# Don't declare a version "dirty" merely because a timestamp has changed.
|
||||
git update-index --refresh > /dev/null 2>&1
|
||||
|
||||
dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
|
||||
case "$dirty" in
|
||||
'') ;;
|
||||
*) # Append the suffix only if there isn't one already.
|
||||
case $v in
|
||||
*-dirty) ;;
|
||||
*) v="$v-dirty" ;;
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
|
||||
printf %s "$v"
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,499 @@
|
||||
eval '(exit $?0)' && eval 'exec perl -wS "$0" "$@"'
|
||||
& eval 'exec perl -wS "$0" $argv:q'
|
||||
if 0;
|
||||
# Convert git log output to ChangeLog format.
|
||||
|
||||
my $VERSION = '2016-03-22 21:49'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
# use File::Coda; # http://meyering.net/code/Coda/
|
||||
END {
|
||||
defined fileno STDOUT or return;
|
||||
close STDOUT and return;
|
||||
warn "$ME: failed to close standard output: $!\n";
|
||||
$? ||= 1;
|
||||
}
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS] [ARGS]
|
||||
|
||||
Convert git log output to ChangeLog format. If present, any ARGS
|
||||
are passed to "git log". To avoid ARGS being parsed as options to
|
||||
$ME, they may be preceded by '--'.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
--amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that
|
||||
makes a change to SHA1's commit log text or metadata.
|
||||
--append-dot append a dot to the first line of each commit message if
|
||||
there is no other punctuation or blank at the end.
|
||||
--no-cluster never cluster commit messages under the same date/author
|
||||
header; the default is to cluster adjacent commit messages
|
||||
if their headers are the same and neither commit message
|
||||
contains multiple paragraphs.
|
||||
--srcdir=DIR the root of the source tree, from which the .git/
|
||||
directory can be derived.
|
||||
--since=DATE convert only the logs since DATE;
|
||||
the default is to convert all log entries.
|
||||
--until=DATE convert only the logs older than DATE.
|
||||
--ignore-matching=PAT ignore commit messages whose first lines match PAT.
|
||||
--ignore-line=PAT ignore lines of commit messages that match PAT.
|
||||
--format=FMT set format string for commit subject and body;
|
||||
see 'man git-log' for the list of format metacharacters;
|
||||
the default is '%s%n%b%n'
|
||||
--strip-tab remove one additional leading TAB from commit message lines.
|
||||
--strip-cherry-pick remove data inserted by "git cherry-pick";
|
||||
this includes the "cherry picked from commit ..." line,
|
||||
and the possible final "Conflicts:" paragraph.
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
$ME --since=2008-01-01 > ChangeLog
|
||||
$ME -- -n 5 foo > last-5-commits-to-branch-foo
|
||||
|
||||
SPECIAL SYNTAX:
|
||||
|
||||
The following types of strings are interpreted specially when they appear
|
||||
at the beginning of a log message line. They are not copied to the output.
|
||||
|
||||
Copyright-paperwork-exempt: Yes
|
||||
Append the "(tiny change)" notation to the usual "date name email"
|
||||
ChangeLog header to mark a change that does not require a copyright
|
||||
assignment.
|
||||
Co-authored-by: Joe User <user\@example.com>
|
||||
List the specified name and email address on a second
|
||||
ChangeLog header, denoting a co-author.
|
||||
Signed-off-by: Joe User <user\@example.com>
|
||||
These lines are simply elided.
|
||||
|
||||
In a FILE specified via --amend, comment lines (starting with "#") are ignored.
|
||||
FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on
|
||||
a line) referring to a commit in the current project, and CODE refers to one
|
||||
or more consecutive lines of Perl code. Pairs must be separated by one or
|
||||
more blank line.
|
||||
|
||||
Here is sample input for use with --amend=FILE, from coreutils:
|
||||
|
||||
3a169f4c5d9159283548178668d2fae6fced3030
|
||||
# fix typo in title:
|
||||
s/all tile types/all file types/
|
||||
|
||||
1379ed974f1fa39b12e2ffab18b3f7a607082202
|
||||
# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
|
||||
# Change the author to be Paul. Note the escaped "@":
|
||||
s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>,
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
# If the string $S is a well-behaved file name, simply return it.
|
||||
# If it contains white space, quotes, etc., quote it, and return the new string.
|
||||
sub shell_quote($)
|
||||
{
|
||||
my ($s) = @_;
|
||||
if ($s =~ m![^\w+/.,-]!)
|
||||
{
|
||||
# Convert each single quote to '\''
|
||||
$s =~ s/\'/\'\\\'\'/g;
|
||||
# Then single quote the string.
|
||||
$s = "'$s'";
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
sub quoted_cmd(@)
|
||||
{
|
||||
return join (' ', map {shell_quote $_} @_);
|
||||
}
|
||||
|
||||
# Parse file F.
|
||||
# Comment lines (starting with "#") are ignored.
|
||||
# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1
|
||||
# (alone on a line) referring to a commit in the current project, and
|
||||
# CODE refers to one or more consecutive lines of Perl code.
|
||||
# Pairs must be separated by one or more blank line.
|
||||
sub parse_amend_file($)
|
||||
{
|
||||
my ($f) = @_;
|
||||
|
||||
open F, '<', $f
|
||||
or die "$ME: $f: failed to open for reading: $!\n";
|
||||
|
||||
my $fail;
|
||||
my $h = {};
|
||||
my $in_code = 0;
|
||||
my $sha;
|
||||
while (defined (my $line = <F>))
|
||||
{
|
||||
$line =~ /^\#/
|
||||
and next;
|
||||
chomp $line;
|
||||
$line eq ''
|
||||
and $in_code = 0, next;
|
||||
|
||||
if (!$in_code)
|
||||
{
|
||||
$line =~ /^([0-9a-fA-F]{40})$/
|
||||
or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"),
|
||||
$fail = 1, next;
|
||||
$sha = lc $1;
|
||||
$in_code = 1;
|
||||
exists $h->{$sha}
|
||||
and (warn "$ME: $f:$.: duplicate SHA1\n"),
|
||||
$fail = 1, next;
|
||||
}
|
||||
else
|
||||
{
|
||||
$h->{$sha} ||= '';
|
||||
$h->{$sha} .= "$line\n";
|
||||
}
|
||||
}
|
||||
close F;
|
||||
|
||||
$fail
|
||||
and exit 1;
|
||||
|
||||
return $h;
|
||||
}
|
||||
|
||||
# git_dir_option $SRCDIR
|
||||
#
|
||||
# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR
|
||||
# is undef). Return as a list (0 or 1 element).
|
||||
sub git_dir_option($)
|
||||
{
|
||||
my ($srcdir) = @_;
|
||||
my @res = ();
|
||||
if (defined $srcdir)
|
||||
{
|
||||
my $qdir = shell_quote $srcdir;
|
||||
my $cmd = "cd $qdir && git rev-parse --show-toplevel";
|
||||
my $qcmd = shell_quote $cmd;
|
||||
my $git_dir = qx($cmd);
|
||||
defined $git_dir
|
||||
or die "$ME: cannot run $qcmd: $!\n";
|
||||
$? == 0
|
||||
or die "$ME: $qcmd had unexpected exit code or signal ($?)\n";
|
||||
chomp $git_dir;
|
||||
push @res, "--git-dir=$git_dir/.git";
|
||||
}
|
||||
@res;
|
||||
}
|
||||
|
||||
{
|
||||
my $since_date;
|
||||
my $until_date;
|
||||
my $format_string = '%s%n%b%n';
|
||||
my $amend_file;
|
||||
my $append_dot = 0;
|
||||
my $cluster = 1;
|
||||
my $ignore_matching;
|
||||
my $ignore_line;
|
||||
my $strip_tab = 0;
|
||||
my $strip_cherry_pick = 0;
|
||||
my $srcdir;
|
||||
GetOptions
|
||||
(
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
'since=s' => \$since_date,
|
||||
'until=s' => \$until_date,
|
||||
'format=s' => \$format_string,
|
||||
'amend=s' => \$amend_file,
|
||||
'append-dot' => \$append_dot,
|
||||
'cluster!' => \$cluster,
|
||||
'ignore-matching=s' => \$ignore_matching,
|
||||
'ignore-line=s' => \$ignore_line,
|
||||
'strip-tab' => \$strip_tab,
|
||||
'strip-cherry-pick' => \$strip_cherry_pick,
|
||||
'srcdir=s' => \$srcdir,
|
||||
) or usage 1;
|
||||
|
||||
defined $since_date
|
||||
and unshift @ARGV, "--since=$since_date";
|
||||
defined $until_date
|
||||
and unshift @ARGV, "--until=$until_date";
|
||||
|
||||
# This is a hash that maps an SHA1 to perl code (i.e., s/old/new/)
|
||||
# that makes a correction in the log or attribution of that commit.
|
||||
my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
|
||||
|
||||
my @cmd = ('git',
|
||||
git_dir_option $srcdir,
|
||||
qw(log --log-size),
|
||||
'--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV);
|
||||
open PIPE, '-|', @cmd
|
||||
or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n"
|
||||
. "(Is your Git too old? Version 1.5.1 or later is required.)\n");
|
||||
|
||||
my $prev_multi_paragraph;
|
||||
my $prev_date_line = '';
|
||||
my @prev_coauthors = ();
|
||||
my @skipshas = ();
|
||||
while (1)
|
||||
{
|
||||
defined (my $in = <PIPE>)
|
||||
or last;
|
||||
$in =~ /^log size (\d+)$/
|
||||
or die "$ME:$.: Invalid line (expected log size):\n$in";
|
||||
my $log_nbytes = $1;
|
||||
|
||||
my $log;
|
||||
my $n_read = read PIPE, $log, $log_nbytes;
|
||||
$n_read == $log_nbytes
|
||||
or die "$ME:$.: unexpected EOF\n";
|
||||
|
||||
# Extract leading hash.
|
||||
my ($sha, $rest) = split ':', $log, 2;
|
||||
defined $sha
|
||||
or die "$ME:$.: malformed log entry\n";
|
||||
$sha =~ /^[0-9a-fA-F]{40}$/
|
||||
or die "$ME:$.: invalid SHA1: $sha\n";
|
||||
|
||||
my $skipflag = 0;
|
||||
if (@skipshas)
|
||||
{
|
||||
foreach(@skipshas)
|
||||
{
|
||||
if ($sha =~ /^$_/)
|
||||
{
|
||||
$skipflag = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If this commit's log requires any transformation, do it now.
|
||||
my $code = $amend_code->{$sha};
|
||||
if (defined $code)
|
||||
{
|
||||
eval 'use Safe';
|
||||
my $s = new Safe;
|
||||
# Put the unpreprocessed entry into "$_".
|
||||
$_ = $rest;
|
||||
|
||||
# Let $code operate on it, safely.
|
||||
my $r = $s->reval("$code")
|
||||
or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n";
|
||||
|
||||
# Note that we've used this entry.
|
||||
delete $amend_code->{$sha};
|
||||
|
||||
# Update $rest upon success.
|
||||
$rest = $_;
|
||||
}
|
||||
|
||||
# Remove lines inserted by "git cherry-pick".
|
||||
if ($strip_cherry_pick)
|
||||
{
|
||||
$rest =~ s/^\s*Conflicts:\n.*//sm;
|
||||
$rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m;
|
||||
}
|
||||
|
||||
my @line = split /[ \t]*\n/, $rest;
|
||||
my $author_line = shift @line;
|
||||
defined $author_line
|
||||
or die "$ME:$.: unexpected EOF\n";
|
||||
$author_line =~ /^(\d+) (.*>)$/
|
||||
or die "$ME:$.: Invalid line "
|
||||
. "(expected date/author/email):\n$author_line\n";
|
||||
|
||||
# Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog
|
||||
# `(tiny change)' annotation.
|
||||
my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line)
|
||||
? ' (tiny change)' : '');
|
||||
|
||||
my $date_line = sprintf "%s %s$tiny\n",
|
||||
strftime ("%Y-%m-%d", localtime ($1)), $2;
|
||||
|
||||
my @coauthors = grep /^Co-authored-by:.*$/, @line;
|
||||
# Omit meta-data lines we've already interpreted.
|
||||
@line = grep !/^(?:Signed-off-by:[ ].*>$
|
||||
|Co-authored-by:[ ]
|
||||
|Copyright-paperwork-exempt:[ ]
|
||||
|Tiny-change:[ ]
|
||||
)/x, @line;
|
||||
|
||||
# Remove leading and trailing blank lines.
|
||||
if (@line)
|
||||
{
|
||||
while ($line[0] =~ /^\s*$/) { shift @line; }
|
||||
while ($line[$#line] =~ /^\s*$/) { pop @line; }
|
||||
}
|
||||
|
||||
# Handle Emacs gitmerge.el "skipped" commits.
|
||||
# Yes, this should be controlled by an option. So sue me.
|
||||
if ( grep /^(; )?Merge from /, @line )
|
||||
{
|
||||
my $found = 0;
|
||||
foreach (@line)
|
||||
{
|
||||
if (grep /^The following commit.*skipped:$/, $_)
|
||||
{
|
||||
$found = 1;
|
||||
## Reset at each merge to reduce chance of false matches.
|
||||
@skipshas = ();
|
||||
next;
|
||||
}
|
||||
if ($found && $_ =~ /^([0-9a-fA-F]{7,}) [^ ]/)
|
||||
{
|
||||
push ( @skipshas, $1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Ignore commits that match the --ignore-matching pattern, if specified.
|
||||
if (defined $ignore_matching && @line && $line[0] =~ /$ignore_matching/)
|
||||
{
|
||||
$skipflag = 1;
|
||||
}
|
||||
elsif ($skipflag)
|
||||
{
|
||||
## Perhaps only warn if a pattern matches more than once?
|
||||
warn "$ME: warning: skipping $sha due to $skipflag\n";
|
||||
}
|
||||
|
||||
if (! $skipflag)
|
||||
{
|
||||
if (defined $ignore_line && @line)
|
||||
{
|
||||
@line = grep ! /$ignore_line/, @line;
|
||||
while ($line[$#line] =~ /^\s*$/) { pop @line; }
|
||||
}
|
||||
|
||||
# Record whether there are two or more paragraphs.
|
||||
my $multi_paragraph = grep /^\s*$/, @line;
|
||||
|
||||
# Format 'Co-authored-by: A U Thor <email@example.com>' lines in
|
||||
# standard multi-author ChangeLog format.
|
||||
for (@coauthors)
|
||||
{
|
||||
s/^Co-authored-by:\s*/\t /;
|
||||
s/\s*</ </;
|
||||
|
||||
/<.*?@.*\..*>/
|
||||
or warn "$ME: warning: missing email address for "
|
||||
. substr ($_, 5) . "\n";
|
||||
}
|
||||
|
||||
# If clustering of commit messages has been disabled, if this header
|
||||
# would be different from the previous date/name/etc. header,
|
||||
# or if this or the previous entry consists of two or more paragraphs,
|
||||
# then print the header.
|
||||
if ( ! $cluster
|
||||
|| $date_line ne $prev_date_line
|
||||
|| "@coauthors" ne "@prev_coauthors"
|
||||
|| $multi_paragraph
|
||||
|| $prev_multi_paragraph)
|
||||
{
|
||||
$prev_date_line eq ''
|
||||
or print "\n";
|
||||
print $date_line;
|
||||
@coauthors
|
||||
and print join ("\n", @coauthors), "\n";
|
||||
}
|
||||
$prev_date_line = $date_line;
|
||||
@prev_coauthors = @coauthors;
|
||||
$prev_multi_paragraph = $multi_paragraph;
|
||||
|
||||
# If there were any lines
|
||||
if (@line == 0)
|
||||
{
|
||||
warn "$ME: warning: empty commit message:\n $date_line\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($append_dot)
|
||||
{
|
||||
# If the first line of the message has enough room, then
|
||||
if (length $line[0] < 72)
|
||||
{
|
||||
# append a dot if there is no other punctuation or blank
|
||||
# at the end.
|
||||
$line[0] =~ /[[:punct:]\s]$/
|
||||
or $line[0] .= '.';
|
||||
}
|
||||
}
|
||||
|
||||
# Remove one additional leading TAB from each line.
|
||||
$strip_tab
|
||||
and map { s/^\t// } @line;
|
||||
|
||||
# Prefix each non-empty line with a TAB.
|
||||
@line = map { length $_ ? "\t$_" : '' } @line;
|
||||
|
||||
print "\n", join ("\n", @line), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
defined ($in = <PIPE>)
|
||||
or last;
|
||||
$in ne "\n"
|
||||
and die "$ME:$.: unexpected line:\n$in";
|
||||
}
|
||||
|
||||
close PIPE
|
||||
or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
|
||||
# FIXME-someday: include $PROCESS_STATUS in the diagnostic
|
||||
|
||||
# Complain about any unused entry in the --amend=F specified file.
|
||||
my $fail = 0;
|
||||
foreach my $sha (keys %$amend_code)
|
||||
{
|
||||
warn "$ME:$amend_file: unused entry: $sha\n";
|
||||
$fail = 1;
|
||||
}
|
||||
|
||||
exit $fail;
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# mode: perl
|
||||
# indent-tabs-mode: nil
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "my $VERSION = '"
|
||||
# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "'; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,210 @@
|
||||
#!/bin/sh
|
||||
# Run this after each non-alpha release, to update the web documentation at
|
||||
# http://www.gnu.org/software/$pkg/manual/
|
||||
|
||||
VERSION=2016-01-12.23; # UTC
|
||||
|
||||
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
ME=$(basename "$0")
|
||||
warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
|
||||
die() { warn "$*"; exit 1; }
|
||||
|
||||
help()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $ME
|
||||
|
||||
Run this script from top_srcdir (no arguments) after each non-alpha
|
||||
release, to update the web documentation at
|
||||
http://www.gnu.org/software/\$pkg/manual/
|
||||
|
||||
This script assumes you're using git for revision control, and
|
||||
requires a .prev-version file as well as a Makefile, from which it
|
||||
extracts the version number and package name, respectively. Also, it
|
||||
assumes all documentation is in the doc/ sub-directory.
|
||||
|
||||
Options:
|
||||
-C, --builddir=DIR location of (configured) Makefile (default: .)
|
||||
-n, --dry-run don't actually commit anything
|
||||
-m, --mirror remove out of date files from document server
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
version()
|
||||
{
|
||||
year=$(echo "$VERSION" | sed 's/[^0-9].*//')
|
||||
cat <<EOF
|
||||
$ME $VERSION
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
# find_tool ENVVAR NAMES...
|
||||
# -------------------------
|
||||
# Search for a required program. Use the value of ENVVAR, if set,
|
||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||
# supports --version). If found, set ENVVAR to the program name,
|
||||
# die otherwise.
|
||||
#
|
||||
# FIXME: code duplication, see also bootstrap.
|
||||
find_tool ()
|
||||
{
|
||||
find_tool_envvar=$1
|
||||
shift
|
||||
find_tool_names=$@
|
||||
eval "find_tool_res=\$$find_tool_envvar"
|
||||
if test x"$find_tool_res" = x; then
|
||||
for i
|
||||
do
|
||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
fi
|
||||
test x"$find_tool_res" != x \
|
||||
|| die "one of these is required: $find_tool_names"
|
||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||
eval "$find_tool_envvar=\$find_tool_res"
|
||||
eval "export $find_tool_envvar"
|
||||
}
|
||||
|
||||
## ------ ##
|
||||
## Main. ##
|
||||
## ------ ##
|
||||
|
||||
# Requirements: everything required to bootstrap your package, plus
|
||||
# these.
|
||||
find_tool CVS cvs
|
||||
find_tool GIT git
|
||||
find_tool RSYNC rsync
|
||||
find_tool XARGS gxargs xargs
|
||||
|
||||
builddir=.
|
||||
dryrun=
|
||||
rm_stale='echo'
|
||||
while test $# != 0
|
||||
do
|
||||
# Handle --option=value by splitting apart and putting back on argv.
|
||||
case $1 in
|
||||
--*=*)
|
||||
opt=$(echo "$1" | sed -e 's/=.*//')
|
||||
val=$(echo "$1" | sed -e 's/[^=]*=//')
|
||||
shift
|
||||
set dummy "$opt" "$val" "$@"; shift
|
||||
;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--help|--version) ${1#--};;
|
||||
-C|--builddir) shift; builddir=$1; shift ;;
|
||||
-n|--dry-run) dryrun=echo; shift;;
|
||||
-m|--mirror) rm_stale=''; shift;;
|
||||
--*) die "unrecognized option: $1";;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
test $# = 0 \
|
||||
|| die "too many arguments"
|
||||
|
||||
prev=.prev-version
|
||||
version=$(cat $prev) || die "no $prev file?"
|
||||
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' $builddir/Makefile) \
|
||||
|| die "no Makefile?"
|
||||
tmp_branch=web-doc-$version-$$
|
||||
current_branch=$($GIT branch | sed -ne '/^\* /{s///;p;q;}')
|
||||
|
||||
cleanup()
|
||||
{
|
||||
__st=$?
|
||||
$dryrun rm -rf "$tmp"
|
||||
$GIT checkout "$current_branch"
|
||||
$GIT submodule update --recursive
|
||||
$GIT branch -d $tmp_branch
|
||||
exit $__st
|
||||
}
|
||||
trap cleanup 0
|
||||
trap 'exit $?' 1 2 13 15
|
||||
|
||||
# We must build using sources for which --version reports the
|
||||
# just-released version number, not some string like 7.6.18-20761.
|
||||
# That version string propagates into all documentation.
|
||||
set -e
|
||||
$GIT checkout -b $tmp_branch v$version
|
||||
$GIT submodule update --recursive
|
||||
./bootstrap
|
||||
srcdir=$(pwd)
|
||||
cd "$builddir"
|
||||
builddir=$(pwd)
|
||||
./config.status --recheck
|
||||
./config.status
|
||||
make
|
||||
make web-manual
|
||||
cd "$srcdir"
|
||||
set +e
|
||||
|
||||
tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1
|
||||
( cd $tmp \
|
||||
&& $CVS -d $USER@cvs.sv.gnu.org:/webcvs/$pkg co $pkg )
|
||||
$RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
|
||||
|
||||
(
|
||||
cd $tmp/$pkg/manual
|
||||
|
||||
# Add all the files. This is simpler than trying to add only the
|
||||
# new ones because of new directories
|
||||
# First add non empty dirs individually
|
||||
find . -name CVS -prune -o -type d \! -empty -print \
|
||||
| $XARGS -n1 --no-run-if-empty -- $dryrun $CVS add -ko
|
||||
# Now add all files
|
||||
find . -name CVS -prune -o -type f -print \
|
||||
| $XARGS --no-run-if-empty -- $dryrun $CVS add -ko
|
||||
|
||||
# Report/Remove stale files
|
||||
# excluding doc server specific files like CVS/* and .symlinks
|
||||
if test -n "$rm_stale"; then
|
||||
echo 'Consider the --mirror option if all of the manual is generated,' >&2
|
||||
echo 'which will run `cvs remove` to remove stale files.' >&2
|
||||
fi
|
||||
{ find . \( -name CVS -o -type f -name '.*' \) -prune -o -type f -print
|
||||
(cd "$builddir"/doc/manual/ && find . -type f -print | sed p)
|
||||
} | sort | uniq -u \
|
||||
| $XARGS --no-run-if-empty -- ${rm_stale:-$dryrun} $CVS remove -f
|
||||
|
||||
$dryrun $CVS ci -m $version
|
||||
)
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "VERSION="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+440
@@ -0,0 +1,440 @@
|
||||
#!/bin/sh
|
||||
# Sign files and upload them.
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 2004-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Originally written by Alexandre Duret-Lutz <adl@gnu.org>.
|
||||
# The master copy of this file is maintained in the gnulib Git repository.
|
||||
# Please send bug reports and feature requests to bug-gnulib@gnu.org.
|
||||
|
||||
set -e
|
||||
|
||||
GPG='gpg --batch --no-tty'
|
||||
conffile=.gnuploadrc
|
||||
to=
|
||||
dry_run=false
|
||||
replace=
|
||||
symlink_files=
|
||||
delete_files=
|
||||
delete_symlinks=
|
||||
collect_var=
|
||||
dbg=
|
||||
nl='
|
||||
'
|
||||
|
||||
usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...]
|
||||
|
||||
Sign all FILES, and process them at the destinations specified with --to.
|
||||
If CMD is not given, it defaults to uploading. See examples below.
|
||||
|
||||
Commands:
|
||||
--delete delete FILES from destination
|
||||
--symlink create symbolic links
|
||||
--rmsymlink remove symbolic links
|
||||
-- treat the remaining arguments as files to upload
|
||||
|
||||
Options:
|
||||
--to DEST specify a destination DEST for FILES
|
||||
(multiple --to options are allowed)
|
||||
--user NAME sign with key NAME
|
||||
--replace allow replacements of existing files
|
||||
--symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names
|
||||
--dry-run do nothing, show what would have been done
|
||||
(including the constructed directive file)
|
||||
--version output version information and exit
|
||||
--help print this help text and exit
|
||||
|
||||
If --symlink-regex is given without EXPR, then the link target name
|
||||
is created by replacing the version information with '-latest', e.g.:
|
||||
foo-1.3.4.tar.gz -> foo-latest.tar.gz
|
||||
|
||||
Recognized destinations are:
|
||||
alpha.gnu.org:DIRECTORY
|
||||
savannah.gnu.org:DIRECTORY
|
||||
savannah.nongnu.org:DIRECTORY
|
||||
ftp.gnu.org:DIRECTORY
|
||||
build directive files and upload files by FTP
|
||||
download.gnu.org.ua:{alpha|ftp}/DIRECTORY
|
||||
build directive files and upload files by SFTP
|
||||
[user@]host:DIRECTORY upload files with scp
|
||||
|
||||
Options and commands are applied in order. If the file $conffile exists
|
||||
in the current working directory, its contents are prepended to the
|
||||
actual command line options. Use this to keep your defaults. Comments
|
||||
(#) and empty lines in $conffile are allowed.
|
||||
|
||||
<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>
|
||||
gives some further background.
|
||||
|
||||
Examples:
|
||||
1. Upload foobar-1.0.tar.gz to ftp.gnu.org:
|
||||
gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz
|
||||
|
||||
2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org:
|
||||
gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz
|
||||
|
||||
3. Same as above, and also create symbolic links to foobar-latest.tar.*:
|
||||
gnupload --to ftp.gnu.org:foobar \\
|
||||
--symlink-regex \\
|
||||
foobar-1.0.tar.gz foobar-1.0.tar.xz
|
||||
|
||||
4. Upload foobar-0.9.90.tar.gz to two sites:
|
||||
gnupload --to alpha.gnu.org:foobar \\
|
||||
--to sources.redhat.com:~ftp/pub/foobar \\
|
||||
foobar-0.9.90.tar.gz
|
||||
|
||||
5. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz
|
||||
(the -- terminates the list of files to delete):
|
||||
gnupload --to alpha.gnu.org:foobar \\
|
||||
--to sources.redhat.com:~ftp/pub/foobar \\
|
||||
--delete oopsbar-0.9.91.tar.gz \\
|
||||
-- foobar-0.9.91.tar.gz
|
||||
|
||||
gnupload executes a program ncftpput to do the transfers; if you don't
|
||||
happen to have an ncftp package installed, the ncftpput-ftp script in
|
||||
the build-aux/ directory of the gnulib package
|
||||
(http://savannah.gnu.org/projects/gnulib) may serve as a replacement.
|
||||
|
||||
Send patches and bug reports to <bug-gnulib@gnu.org>."
|
||||
|
||||
# Read local configuration file
|
||||
if test -r "$conffile"; then
|
||||
echo "$0: Reading configuration file $conffile"
|
||||
conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" ' '`
|
||||
eval set x "$conf \"\$@\""
|
||||
shift
|
||||
fi
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-*)
|
||||
collect_var=
|
||||
case $1 in
|
||||
--help)
|
||||
echo "$usage"
|
||||
exit $?
|
||||
;;
|
||||
--to)
|
||||
if test -z "$2"; then
|
||||
echo "$0: Missing argument for --to" 1>&2
|
||||
exit 1
|
||||
elif echo "$2" | grep 'ftp-upload\.gnu\.org' >/dev/null; then
|
||||
echo "$0: Use ftp.gnu.org:PKGNAME or alpha.gnu.org:PKGNAME" >&2
|
||||
echo "$0: for the destination, not ftp-upload.gnu.org (which" >&2
|
||||
echo "$0: is used for direct ftp uploads, not with gnupload)." >&2
|
||||
echo "$0: See --help and its examples if need be." >&2
|
||||
exit 1
|
||||
else
|
||||
to="$to $2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--user)
|
||||
if test -z "$2"; then
|
||||
echo "$0: Missing argument for --user" 1>&2
|
||||
exit 1
|
||||
else
|
||||
GPG="$GPG --local-user $2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--delete)
|
||||
collect_var=delete_files
|
||||
;;
|
||||
--replace)
|
||||
replace="replace: true"
|
||||
;;
|
||||
--rmsymlink)
|
||||
collect_var=delete_symlinks
|
||||
;;
|
||||
--symlink-regex=*)
|
||||
symlink_expr=`expr "$1" : '[^=]*=\(.*\)'`
|
||||
;;
|
||||
--symlink-regex)
|
||||
symlink_expr='s|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|'
|
||||
;;
|
||||
--symlink)
|
||||
collect_var=symlink_files
|
||||
;;
|
||||
--dry-run|-n)
|
||||
dry_run=:
|
||||
;;
|
||||
--version)
|
||||
echo "gnupload $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "$0: Unknown option '$1', try '$0 --help'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
if test -z "$collect_var"; then
|
||||
break
|
||||
else
|
||||
eval "$collect_var=\"\$$collect_var $1\""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
dprint()
|
||||
{
|
||||
echo "Running $* ..."
|
||||
}
|
||||
|
||||
if $dry_run; then
|
||||
dbg=dprint
|
||||
fi
|
||||
|
||||
if test -z "$to"; then
|
||||
echo "$0: Missing destination sites" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -n "$symlink_files"; then
|
||||
x=`echo "$symlink_files" | sed 's/[^ ]//g;s/ //g'`
|
||||
if test -n "$x"; then
|
||||
echo "$0: Odd number of symlink arguments" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# = 0; then
|
||||
if test -z "${symlink_files}${delete_files}${delete_symlinks}"; then
|
||||
echo "$0: No file to upload" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Make sure all files exist. We don't want to ask
|
||||
# for the passphrase if the script will fail.
|
||||
for file
|
||||
do
|
||||
if test ! -f $file; then
|
||||
echo "$0: Cannot find '$file'" 1>&2
|
||||
exit 1
|
||||
elif test -n "$symlink_expr"; then
|
||||
linkname=`echo $file | sed "$symlink_expr"`
|
||||
if test -z "$linkname"; then
|
||||
echo "$0: symlink expression produces empty results" >&2
|
||||
exit 1
|
||||
elif test "$linkname" = $file; then
|
||||
echo "$0: symlink expression does not alter file name" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Make sure passphrase is not exported in the environment.
|
||||
unset passphrase
|
||||
unset passphrase_fd_0
|
||||
GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg}
|
||||
|
||||
# Reset PATH to be sure that echo is a built-in. We will later use
|
||||
# 'echo $passphrase' to output the passphrase, so it is important that
|
||||
# it is a built-in (third-party programs tend to appear in 'ps'
|
||||
# listings with their arguments...).
|
||||
# Remember this script runs with 'set -e', so if echo is not built-in
|
||||
# it will exit now.
|
||||
if $dry_run || grep -q "^use-agent" $GNUPGHOME/gpg.conf; then :; else
|
||||
PATH=/empty echo -n "Enter GPG passphrase: "
|
||||
stty -echo
|
||||
read -r passphrase
|
||||
stty echo
|
||||
echo
|
||||
passphrase_fd_0="--passphrase-fd 0"
|
||||
fi
|
||||
|
||||
if test $# -ne 0; then
|
||||
for file
|
||||
do
|
||||
echo "Signing $file ..."
|
||||
rm -f $file.sig
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 -ba -o $file.sig $file
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# mkdirective DESTDIR BASE FILE STMT
|
||||
# Arguments: See upload, below
|
||||
mkdirective ()
|
||||
{
|
||||
stmt="$4"
|
||||
if test -n "$3"; then
|
||||
stmt="
|
||||
filename: $3$stmt"
|
||||
fi
|
||||
|
||||
cat >${2}.directive<<EOF
|
||||
version: 1.2
|
||||
directory: $1
|
||||
comment: gnupload v. $scriptversion$stmt
|
||||
EOF
|
||||
if $dry_run; then
|
||||
echo "File ${2}.directive:"
|
||||
cat ${2}.directive
|
||||
echo "File ${2}.directive:" | sed 's/./-/g'
|
||||
fi
|
||||
}
|
||||
|
||||
mksymlink ()
|
||||
{
|
||||
while test $# -ne 0
|
||||
do
|
||||
echo "symlink: $1 $2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
# upload DEST DESTDIR BASE FILE STMT FILES
|
||||
# Arguments:
|
||||
# DEST Destination site;
|
||||
# DESTDIR Destination directory;
|
||||
# BASE Base name for the directive file;
|
||||
# FILE Name of the file to distribute (may be empty);
|
||||
# STMT Additional statements for the directive file;
|
||||
# FILES List of files to upload.
|
||||
upload ()
|
||||
{
|
||||
dest=$1
|
||||
destdir=$2
|
||||
base=$3
|
||||
file=$4
|
||||
stmt=$5
|
||||
files=$6
|
||||
|
||||
rm -f $base.directive $base.directive.asc
|
||||
case $dest in
|
||||
alpha.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/alpha $files $base.directive.asc
|
||||
;;
|
||||
ftp.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/ftp $files $base.directive.asc
|
||||
;;
|
||||
savannah.gnu.org:*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg ncftpput savannah.gnu.org /incoming/savannah/$destdir $files
|
||||
;;
|
||||
savannah.nongnu.org:*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files
|
||||
;;
|
||||
download.gnu.org.ua:alpha/*|download.gnu.org.ua:ftp/*)
|
||||
destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'`
|
||||
destdir_topdir=`echo "$destdir" | sed 's,/.*,,'`
|
||||
mkdirective "$destdir_p1" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
for f in $files $base.directive.asc
|
||||
do
|
||||
echo put $f
|
||||
done | $dbg sftp -b - puszcza.gnu.org.ua:/incoming/$destdir_topdir
|
||||
;;
|
||||
/*)
|
||||
dest_host=`echo "$dest" | sed 's,:.*,,'`
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg cp $files $base.directive.asc $dest_host
|
||||
;;
|
||||
*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg scp $files $dest
|
||||
;;
|
||||
esac
|
||||
rm -f $base.directive $base.directive.asc
|
||||
}
|
||||
|
||||
#####
|
||||
# Process any standalone directives
|
||||
stmt=
|
||||
if test -n "$symlink_files"; then
|
||||
stmt="$stmt
|
||||
`mksymlink $symlink_files`"
|
||||
fi
|
||||
|
||||
for file in $delete_files
|
||||
do
|
||||
stmt="$stmt
|
||||
archive: $file"
|
||||
done
|
||||
|
||||
for file in $delete_symlinks
|
||||
do
|
||||
stmt="$stmt
|
||||
rmsymlink: $file"
|
||||
done
|
||||
|
||||
if test -n "$stmt"; then
|
||||
for dest in $to
|
||||
do
|
||||
destdir=`echo $dest | sed 's/[^:]*://'`
|
||||
upload "$dest" "$destdir" "`hostname`-$$" "" "$stmt"
|
||||
done
|
||||
fi
|
||||
|
||||
# Process actual uploads
|
||||
for dest in $to
|
||||
do
|
||||
for file
|
||||
do
|
||||
echo "Uploading $file to $dest ..."
|
||||
stmt=
|
||||
#
|
||||
# allowing file replacement is all or nothing.
|
||||
if test -n "$replace"; then stmt="$stmt
|
||||
$replace"
|
||||
fi
|
||||
#
|
||||
files="$file $file.sig"
|
||||
destdir=`echo $dest | sed 's/[^:]*://'`
|
||||
if test -n "$symlink_expr"; then
|
||||
linkname=`echo $file | sed "$symlink_expr"`
|
||||
stmt="$stmt
|
||||
symlink: $file $linkname
|
||||
symlink: $file.sig $linkname.sig"
|
||||
fi
|
||||
upload "$dest" "$destdir" "$file" "$file" "$stmt" "$files"
|
||||
done
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+501
@@ -0,0 +1,501 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1995-2017 Free Software Foundation, Inc.
|
||||
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No file. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: mdate-sh [--help] [--version] FILE
|
||||
|
||||
Pretty-print the modification day of FILE, in the format:
|
||||
1 January 1970
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "mdate-sh $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
error ()
|
||||
{
|
||||
echo "$0: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# GNU ls changes its time format in response to the TIME_STYLE
|
||||
# variable. Since we cannot assume 'unset' works, revert this
|
||||
# variable to its documented default.
|
||||
if test "${TIME_STYLE+set}" = set; then
|
||||
TIME_STYLE=posix-long-iso
|
||||
export TIME_STYLE
|
||||
fi
|
||||
|
||||
save_arg1=$1
|
||||
|
||||
# Find out how to get the extended ls output of a file or directory.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command='ls -L -l -d'
|
||||
else
|
||||
ls_command='ls -l -d'
|
||||
fi
|
||||
# Avoid user/group names that might have spaces, when possible.
|
||||
if ls -n /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command="$ls_command -n"
|
||||
fi
|
||||
|
||||
# A 'ls -l' line looks as follows on OS/2.
|
||||
# drwxrwx--- 0 Aug 11 2001 foo
|
||||
# This differs from Unix, which adds ownership information.
|
||||
# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
|
||||
#
|
||||
# To find the date, we split the line on spaces and iterate on words
|
||||
# until we find a month. This cannot work with files whose owner is a
|
||||
# user named "Jan", or "Feb", etc. However, it's unlikely that '/'
|
||||
# will be owned by a user whose name is a month. So we first look at
|
||||
# the extended ls output of the root directory to decide how many
|
||||
# words should be skipped to get the date.
|
||||
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
set x`$ls_command /`
|
||||
|
||||
# Find which argument is the month.
|
||||
month=
|
||||
command=
|
||||
until test $month
|
||||
do
|
||||
test $# -gt 0 || error "failed parsing '$ls_command /' output"
|
||||
shift
|
||||
# Add another shift to the command.
|
||||
command="$command shift;"
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -n "$month" || error "failed parsing '$ls_command /' output"
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
set dummy x`eval "$ls_command \"\\\$save_arg1\""`
|
||||
|
||||
# Remove all preceding arguments
|
||||
eval $command
|
||||
|
||||
# Because of the dummy argument above, month is in $2.
|
||||
#
|
||||
# On a POSIX system, we should have
|
||||
#
|
||||
# $# = 5
|
||||
# $1 = file size
|
||||
# $2 = month
|
||||
# $3 = day
|
||||
# $4 = year or time
|
||||
# $5 = filename
|
||||
#
|
||||
# On Darwin 7.7.0 and 7.6.0, we have
|
||||
#
|
||||
# $# = 4
|
||||
# $1 = day
|
||||
# $2 = month
|
||||
# $3 = year or time
|
||||
# $4 = filename
|
||||
|
||||
# Get the month.
|
||||
case $2 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
|
||||
case $3 in
|
||||
???*) day=$1;;
|
||||
*) day=$3; shift;;
|
||||
esac
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
#! /bin/sh
|
||||
# test-driver - basic testsuite driver script.
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 2011-2015 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$0: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
END
|
||||
}
|
||||
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=no
|
||||
color_tests=no
|
||||
enable_hard_errors=yes
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "test-driver $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
missing_opts=
|
||||
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
|
||||
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
|
||||
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
|
||||
if test x"$missing_opts" != x; then
|
||||
usage_error "the following mandatory options are missing:$missing_opts"
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage_error "missing argument"
|
||||
fi
|
||||
|
||||
if test $color_tests = yes; then
|
||||
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
||||
red='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # No color.
|
||||
else
|
||||
red= grn= lgn= blu= mgn= std=
|
||||
fi
|
||||
|
||||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
||||
trap "st=129; $do_exit" 1
|
||||
trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here.
|
||||
"$@" >$log_file 2>&1
|
||||
estatus=$?
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
tweaked_estatus=1
|
||||
else
|
||||
tweaked_estatus=$estatus
|
||||
fi
|
||||
|
||||
case $tweaked_estatus:$expect_failure in
|
||||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
||||
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
||||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
||||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
||||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
||||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
||||
esac
|
||||
|
||||
# Report the test outcome and exit status in the logs, so that one can
|
||||
# know whether the test passed or failed simply by looking at the '.log'
|
||||
# file, without the need of also peaking into the corresponding '.trs'
|
||||
# file (automake bug#11814).
|
||||
echo "$res $test_name (exit status: $estatus)" >>$log_file
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
# Register the test result, and other relevant metadata.
|
||||
echo ":test-result: $res" > $trs_file
|
||||
echo ":global-test-result: $res" >> $trs_file
|
||||
echo ":recheck: $recheck" >> $trs_file
|
||||
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
||||
eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" "$@"'
|
||||
& eval 'exec perl -wS -0777 -pi "$0" $argv:q'
|
||||
if 0;
|
||||
# Update an FSF copyright year list to include the current year.
|
||||
|
||||
my $VERSION = '2016-01-12.23:13'; # UTC
|
||||
|
||||
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering and Joel E. Denny
|
||||
|
||||
# The arguments to this script should be names of files that contain
|
||||
# copyright statements to be updated. The copyright holder's name
|
||||
# defaults to "Free Software Foundation, Inc." but may be changed to
|
||||
# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
|
||||
# variable.
|
||||
#
|
||||
# For example, you might wish to use the update-copyright target rule
|
||||
# in maint.mk from gnulib's maintainer-makefile module.
|
||||
#
|
||||
# Iff a copyright statement is recognized in a file and the final
|
||||
# year is not the current year, then the statement is updated for the
|
||||
# new year and it is reformatted to:
|
||||
#
|
||||
# 1. Fit within 72 columns.
|
||||
# 2. Convert 2-digit years to 4-digit years by prepending "19".
|
||||
# 3. Expand copyright year intervals. (See "Environment variables"
|
||||
# below.)
|
||||
#
|
||||
# A warning is printed for every file for which no copyright
|
||||
# statement is recognized.
|
||||
#
|
||||
# Each file's copyright statement must be formatted correctly in
|
||||
# order to be recognized. For example, each of these is fine:
|
||||
#
|
||||
# Copyright @copyright{} 1990-2005, 2007-2009 Free Software
|
||||
# Foundation, Inc.
|
||||
#
|
||||
# # Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||
# # Foundation, Inc.
|
||||
#
|
||||
# /*
|
||||
# * Copyright © 90,2005,2007-2009
|
||||
# * Free Software Foundation, Inc.
|
||||
# */
|
||||
#
|
||||
# However, the following format is not recognized because the line
|
||||
# prefix changes after the first line:
|
||||
#
|
||||
# ## Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||
# # Foundation, Inc.
|
||||
#
|
||||
# However, any correctly formatted copyright statement following
|
||||
# a non-matching copyright statements would be recognized.
|
||||
#
|
||||
# The exact conditions that a file's copyright statement must meet
|
||||
# to be recognized are:
|
||||
#
|
||||
# 1. It is the first copyright statement that meets all of the
|
||||
# following conditions. Subsequent copyright statements are
|
||||
# ignored.
|
||||
# 2. Its format is "Copyright (C)", then a list of copyright years,
|
||||
# and then the name of the copyright holder.
|
||||
# 3. The "(C)" takes one of the following forms or is omitted
|
||||
# entirely:
|
||||
#
|
||||
# A. (C)
|
||||
# B. (c)
|
||||
# C. @copyright{}
|
||||
# D. ©
|
||||
#
|
||||
# 4. The "Copyright" appears at the beginning of a line, except that it
|
||||
# may be prefixed by any sequence (e.g., a comment) of no more than
|
||||
# 5 characters -- including white space.
|
||||
# 5. Iff such a prefix is present, the same prefix appears at the
|
||||
# beginning of each remaining line within the FSF copyright
|
||||
# statement. There is one exception in order to support C-style
|
||||
# comments: if the first line's prefix contains nothing but
|
||||
# whitespace surrounding a "/*", then the prefix for all subsequent
|
||||
# lines is the same as the first line's prefix except with each of
|
||||
# "/" and possibly "*" replaced by a " ". The replacement of "*"
|
||||
# by " " is consistent throughout all subsequent lines.
|
||||
# 6. Blank lines, even if preceded by the prefix, do not appear
|
||||
# within the FSF copyright statement.
|
||||
# 7. Each copyright year is 2 or 4 digits, and years are separated by
|
||||
# commas or dashes. Whitespace may appear after commas.
|
||||
#
|
||||
# Environment variables:
|
||||
#
|
||||
# 1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
|
||||
# is reformatted even if it does not need updating for the new
|
||||
# year. If unset or set to 0, only updated FSF copyright
|
||||
# statements are reformatted.
|
||||
# 2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
|
||||
# copyright years (such as 90, 1991, 1992-2007, 2008) in a
|
||||
# reformatted FSF copyright statement is collapsed to a single
|
||||
# interval (such as 1990-2008). If unset or set to 0, all existing
|
||||
# copyright year intervals in a reformatted FSF copyright statement
|
||||
# are expanded instead.
|
||||
# If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
|
||||
# to the minimal containing range. For example, convert
|
||||
# 2000, 2004-2007, 2009 to 2000-2009.
|
||||
# 3. For testing purposes, you can set the assumed current year in
|
||||
# UPDATE_COPYRIGHT_YEAR.
|
||||
# 4. The default maximum line length for a copyright line is 72.
|
||||
# Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
|
||||
# 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
|
||||
# than "Free Software Foundation, Inc.".
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $copyright_re = 'Copyright';
|
||||
my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©)';
|
||||
my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
|
||||
$holder ||= 'Free Software Foundation, Inc.';
|
||||
my $prefix_max = 5;
|
||||
my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
|
||||
!$margin || $margin !~ m/^\d+$/
|
||||
and $margin = 72;
|
||||
|
||||
my $tab_width = 8;
|
||||
|
||||
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
||||
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
||||
{
|
||||
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
||||
$this_year = $year + 1900;
|
||||
}
|
||||
|
||||
# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead.
|
||||
my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
|
||||
|
||||
my $leading;
|
||||
my $prefix;
|
||||
my $ws_re;
|
||||
my $stmt_re;
|
||||
while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
|
||||
{
|
||||
$leading = "$1$2";
|
||||
$prefix = $2;
|
||||
if ($prefix =~ /^(\s*\/)\*(\s*)$/)
|
||||
{
|
||||
$prefix =~ s,/, ,;
|
||||
my $prefix_ws = $prefix;
|
||||
$prefix_ws =~ s/\*/ /; # Only whitespace.
|
||||
if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/)
|
||||
{
|
||||
$prefix = $prefix_ws;
|
||||
}
|
||||
}
|
||||
$ws_re = '[ \t\r\f]'; # \s without \n
|
||||
$ws_re =
|
||||
"(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)";
|
||||
my $holder_re = $holder;
|
||||
$holder_re =~ s/\s/$ws_re/g;
|
||||
my $stmt_remainder_re =
|
||||
"(?:$ws_re$circle_c_re)?"
|
||||
. "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*"
|
||||
. "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
|
||||
if (/\G$stmt_remainder_re/)
|
||||
{
|
||||
$stmt_re =
|
||||
quotemeta($leading) . "($copyright_re$stmt_remainder_re)";
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (defined $stmt_re)
|
||||
{
|
||||
/$stmt_re/ or die; # Should never die.
|
||||
my $stmt = $1;
|
||||
my $final_year_orig = $2;
|
||||
|
||||
# Handle two-digit year numbers like "98" and "99".
|
||||
my $final_year = $final_year_orig;
|
||||
$final_year <= 99
|
||||
and $final_year += 1900;
|
||||
|
||||
if ($final_year != $this_year)
|
||||
{
|
||||
# Update the year.
|
||||
$stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/;
|
||||
}
|
||||
if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
|
||||
{
|
||||
# Normalize all whitespace including newline-prefix sequences.
|
||||
$stmt =~ s/$ws_re/ /g;
|
||||
|
||||
# Put spaces after commas.
|
||||
$stmt =~ s/, ?/, /g;
|
||||
|
||||
# Convert 2-digit to 4-digit years.
|
||||
$stmt =~ s/(\b\d\d\b)/19$1/g;
|
||||
|
||||
# Make the use of intervals consistent.
|
||||
if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
|
||||
{
|
||||
$stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt =~
|
||||
s/
|
||||
(\d{4})
|
||||
(?:
|
||||
(,\ |-)
|
||||
((??{
|
||||
if ($2 eq '-') { '\d{4}'; }
|
||||
elsif (!$3) { $1 + 1; }
|
||||
else { $3 + 1; }
|
||||
}))
|
||||
)+
|
||||
/$1-$3/gx;
|
||||
|
||||
# When it's 2, emit a single range encompassing all year numbers.
|
||||
$ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
|
||||
and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/;
|
||||
}
|
||||
|
||||
# Format within margin.
|
||||
my $stmt_wrapped;
|
||||
my $text_margin = $margin - length($prefix);
|
||||
if ($prefix =~ /^(\t+)/)
|
||||
{
|
||||
$text_margin -= length($1) * ($tab_width - 1);
|
||||
}
|
||||
while (length $stmt)
|
||||
{
|
||||
if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//)
|
||||
|| ($stmt =~ s/^([\S]+)(?: |$)//))
|
||||
{
|
||||
my $line = $1;
|
||||
$stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
|
||||
$stmt_wrapped .= $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Should be unreachable, but we don't want an infinite
|
||||
# loop if it can be reached.
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
# Replace the old copyright statement.
|
||||
s/$stmt_re/$stmt_wrapped/;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "$ARGV: warning: copyright statement not found\n";
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# mode: perl
|
||||
# indent-tabs-mode: nil
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "my $VERSION = '"
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "'; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,210 @@
|
||||
eval '(exit $?0)' && eval 'exec perl -wST "$0" "$@"'
|
||||
& eval 'exec perl -wST "$0" $argv:q'
|
||||
if 0;
|
||||
# Detect instances of "if (p) free (p);".
|
||||
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
|
||||
|
||||
my $VERSION = '2016-08-01 17:47'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
# use File::Coda; # http://meyering.net/code/Coda/
|
||||
END {
|
||||
defined fileno STDOUT or return;
|
||||
close STDOUT and return;
|
||||
warn "$ME: failed to close standard output: $!\n";
|
||||
$? ||= 1;
|
||||
}
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS] FILE...
|
||||
|
||||
Detect any instance in FILE of a useless "if" test before a free call, e.g.,
|
||||
"if (p) free (p);". Any such test may be safely removed without affecting
|
||||
the semantics of the C code in FILE. Use --name=FOO --name=BAR to also
|
||||
detect free-like functions named FOO and BAR.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
--list print only the name of each matching FILE (\\0-terminated)
|
||||
--name=N add name N to the list of \'free\'-like functions to detect;
|
||||
may be repeated
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Exit status:
|
||||
|
||||
0 one or more matches
|
||||
1 no match
|
||||
2 an error
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
For example, this command prints all removable "if" tests before "free"
|
||||
and "kfree" calls in the linux kernel sources:
|
||||
|
||||
git ls-files -z |xargs -0 $ME --name=kfree
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
sub is_NULL ($)
|
||||
{
|
||||
my ($expr) = @_;
|
||||
return ($expr eq 'NULL' || $expr eq '0');
|
||||
}
|
||||
|
||||
{
|
||||
sub EXIT_MATCH {0}
|
||||
sub EXIT_NO_MATCH {1}
|
||||
sub EXIT_ERROR {2}
|
||||
my $err = EXIT_NO_MATCH;
|
||||
|
||||
my $list;
|
||||
my @name = qw(free);
|
||||
GetOptions
|
||||
(
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
list => \$list,
|
||||
'name=s@' => \@name,
|
||||
) or usage 1;
|
||||
|
||||
# Make sure we have the right number of non-option arguments.
|
||||
# Always tell the user why we fail.
|
||||
@ARGV < 1
|
||||
and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR;
|
||||
|
||||
my $or = join '|', @name;
|
||||
my $regexp = qr/(?:$or)/;
|
||||
|
||||
# Set the input record separator.
|
||||
# Note: this makes it impractical to print line numbers.
|
||||
$/ = '"';
|
||||
|
||||
my $found_match = 0;
|
||||
FILE:
|
||||
foreach my $file (@ARGV)
|
||||
{
|
||||
open FH, '<', $file
|
||||
or (warn "$ME: can't open '$file' for reading: $!\n"),
|
||||
$err = EXIT_ERROR, next;
|
||||
while (defined (my $line = <FH>))
|
||||
{
|
||||
# Skip non-matching lines early to save time
|
||||
$line =~ /\bif\b/
|
||||
or next;
|
||||
while ($line =~
|
||||
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
|
||||
# 1 2 3
|
||||
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
|
||||
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
|
||||
{
|
||||
my $all = $1;
|
||||
my ($lhs, $rhs) = ($2, $3);
|
||||
my ($free_opnd, $braced_free_opnd) = ($4, $5);
|
||||
my $non_NULL;
|
||||
if (!defined $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $lhs) { $non_NULL = $rhs }
|
||||
else { next }
|
||||
|
||||
# Compare the non-NULL part of the "if" expression and the
|
||||
# free'd expression, without regard to white space.
|
||||
$non_NULL =~ tr/ \t//d;
|
||||
my $e2 = defined $free_opnd ? $free_opnd : $braced_free_opnd;
|
||||
$e2 =~ tr/ \t//d;
|
||||
if ($non_NULL eq $e2)
|
||||
{
|
||||
$found_match = 1;
|
||||
$list
|
||||
and (print "$file\0"), next FILE;
|
||||
print "$file: $all\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue
|
||||
{
|
||||
close FH;
|
||||
}
|
||||
|
||||
$found_match && $err == EXIT_NO_MATCH
|
||||
and $err = EXIT_MATCH;
|
||||
|
||||
exit $err;
|
||||
}
|
||||
|
||||
my $foo = <<'EOF';
|
||||
# The above is to *find* them.
|
||||
# This adjusts them, removing the unnecessary "if (p)" part.
|
||||
|
||||
# FIXME: do something like this as an option (doesn't do braces):
|
||||
free=xfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0x3b -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
|
||||
|
||||
# Use the following to remove redundant uses of kfree inside braces.
|
||||
# Note that -0777 puts perl in slurp-whole-file mode;
|
||||
# but we have plenty of memory, these days...
|
||||
free=kfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0777 -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
|
||||
|
||||
Be careful that the result of the above transformation is valid.
|
||||
If the matched string is followed by "else", then obviously, it won't be.
|
||||
|
||||
When modifying files, refuse to process anything other than a regular file.
|
||||
EOF
|
||||
|
||||
## Local Variables:
|
||||
## mode: perl
|
||||
## indent-tabs-mode: nil
|
||||
## eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC0"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
@@ -0,0 +1,113 @@
|
||||
#!/bin/sh
|
||||
# List version-controlled file names.
|
||||
|
||||
# Print a version string.
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# List the specified version-controlled files.
|
||||
# With no argument, list them all. With a single DIRECTORY argument,
|
||||
# list the version-controlled files in that directory.
|
||||
|
||||
# If there's an argument, it must be a single, "."-relative directory name.
|
||||
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
||||
|
||||
postprocess=
|
||||
case $1 in
|
||||
--help) cat <<EOF
|
||||
Usage: $0 [-C SRCDIR] [DIR...]
|
||||
|
||||
Output a list of version-controlled files in DIR (default .), relative to
|
||||
SRCDIR (default .). SRCDIR must be the top directory of a checkout.
|
||||
|
||||
Options:
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
-C SRCDIR change directory to SRCDIR before generating list
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
--version)
|
||||
year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
|
||||
cat <<EOF
|
||||
vc-list-files $scriptversion
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
-C)
|
||||
test "$2" = . || postprocess="| sed 's|^|$2/|'"
|
||||
cd "$2" || exit 1
|
||||
shift; shift ;;
|
||||
esac
|
||||
|
||||
test $# = 0 && set .
|
||||
|
||||
for dir
|
||||
do
|
||||
if test -d .git; then
|
||||
test "x$dir" = x. \
|
||||
&& dir= sed_esc= \
|
||||
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
|
||||
# Ignore git symlinks - either they point into the tree, in which case
|
||||
# we don't need to visit the target twice, or they point somewhere
|
||||
# else (often into a submodule), in which case the content does not
|
||||
# belong to this package.
|
||||
eval exec git ls-tree -r 'HEAD:"$dir"' \
|
||||
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
|
||||
elif test -d .hg; then
|
||||
eval exec hg locate '"$dir/*"' $postprocess
|
||||
elif test -d .bzr; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
eval exec bzr ls -R --versioned '"$dir"' $postprocess
|
||||
elif test -d CVS; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
if test -x build-aux/cvsu; then
|
||||
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
elif (cvsu --help) >/dev/null 2>&1; then
|
||||
eval cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
else
|
||||
eval awk -F/ \''{ \
|
||||
if (!$1 && $3 !~ /^-/) { \
|
||||
f=FILENAME; \
|
||||
if (f ~ /CVS\/Entries$/) \
|
||||
f = substr(f, 1, length(f)-11); \
|
||||
print f $2; \
|
||||
}}'\'' \
|
||||
`find "$dir" -name Entries -print` /dev/null' $postprocess
|
||||
fi
|
||||
elif test -d .svn; then
|
||||
eval exec svn list -R '"$dir"' $postprocess
|
||||
else
|
||||
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,72 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2003-2013, 2015-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Use the direct link. This is guaranteed to work immediately, while
|
||||
# it can take a while for the faster mirror links to become usable.
|
||||
url_dir_list = http://ftp.gnu.org/gnu/$(PACKAGE)
|
||||
|
||||
# Used in maint.mk's web-manual rule
|
||||
manual_title = Comparing and Merging Files
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
local-checks-to-skip = \
|
||||
sc_error_message_period \
|
||||
sc_error_message_uppercase
|
||||
|
||||
# Tools used to bootstrap this package, used for "announcement".
|
||||
bootstrap-tools = autoconf,automake,gnulib
|
||||
|
||||
# Now that we have better tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
old_NEWS_hash = 0216ec3bf3e3322f33afd4e949a9a29b
|
||||
|
||||
# Tell maint.mk's syntax-check rules that diff gets config.h directly or
|
||||
# via diff.h or system.h.
|
||||
config_h_header = (<config\.h>|"(diff|system)\.h")
|
||||
|
||||
update-copyright-env = \
|
||||
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
|
||||
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
|
||||
|
||||
-include $(srcdir)/dist-check.mk
|
||||
|
||||
_cf_state_dir ?= .config-state
|
||||
_date_time := $(shell date +%F.%T)
|
||||
config-compare:
|
||||
diff -u \
|
||||
-I'define VERSION ' \
|
||||
-I'define PACKAGE_VERSION ' \
|
||||
-I'define PACKAGE_STRING ' \
|
||||
$(_cf_state_dir)/latest lib/config.h
|
||||
diff -u \
|
||||
-I'$(PACKAGE_NAME)' \
|
||||
-I'[SD]\["VERSION"\]' \
|
||||
-I'[SD]\["PACKAGE_VERSION"\]' \
|
||||
-I'D\["PACKAGE_STRING"\]' \
|
||||
$(_cf_state_dir)/latest config.status
|
||||
|
||||
config-save:
|
||||
$(MAKE) --quiet config-compare > /dev/null 2>&1 \
|
||||
&& { echo no change; exit 1; } || :
|
||||
mkdir -p $(_cf_state_dir)/$(_date_time)
|
||||
ln -nsf $(_date_time) $(_cf_state_dir)/latest
|
||||
cp lib/config.h config.status $(_cf_state_dir)/latest
|
||||
|
||||
exclude_file_name_regexp--sc_space_tab = ^gl/lib/.*\.c\.diff$$
|
||||
|
||||
# Tell gnulib's tight_scope rule that we mark externs with XTERN
|
||||
export _gl_TS_extern = extern|XTERN
|
||||
+43076
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,180 @@
|
||||
# Configure template for GNU Diffutils.
|
||||
|
||||
# Copyright (C) 1994-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, 2015-2017
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
|
||||
AC_INIT([GNU diffutils],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[bug-diffutils@gnu.org])
|
||||
|
||||
AC_CONFIG_SRCDIR([src/diff.c])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip subdir-objects
|
||||
color-tests parallel-tests])
|
||||
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
|
||||
|
||||
AC_CONFIG_HEADER([lib/config.h:lib/config.hin])
|
||||
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||
AC_PROG_RANLIB
|
||||
gl_EARLY
|
||||
gl_USE_SYSTEM_EXTENSIONS
|
||||
gl_INIT
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[AS_HELP_STRING([--enable-gcc-warnings],
|
||||
[turn on lots of GCC warnings (for developers)])],
|
||||
[case $enableval in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
|
||||
esac
|
||||
gl_gcc_warnings=$enableval],
|
||||
[if test -d "$srcdir"/.git; then
|
||||
gl_gcc_warnings=yes
|
||||
else
|
||||
gl_gcc_warnings=no
|
||||
fi]
|
||||
)
|
||||
|
||||
if test "$gl_gcc_warnings" = yes; then
|
||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||
AC_SUBST([WERROR_CFLAGS])
|
||||
|
||||
nw=
|
||||
# This, $nw, is the list of warnings we disable.
|
||||
nw="$nw -Wdeclaration-after-statement" # too useful to forbid
|
||||
nw="$nw -Waggregate-return" # anachronistic
|
||||
nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h)
|
||||
nw="$nw -Wc++-compat" # We don't care about C++ compilers
|
||||
nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
|
||||
nw="$nw -Wtraditional" # Warns on #elif which we use often
|
||||
nw="$nw -Wcast-qual" # Too many warnings for now
|
||||
nw="$nw -Wconversion" # Too many warnings for now
|
||||
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
|
||||
nw="$nw -Wsign-conversion" # Too many warnings for now
|
||||
nw="$nw -Wtraditional-conversion" # Too many warnings for now
|
||||
nw="$nw -Wunreachable-code" # Too many warnings for now
|
||||
nw="$nw -Wpadded" # Our structs are not padded
|
||||
nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
|
||||
nw="$nw -Wlogical-op" # any use of fwrite provokes this
|
||||
nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
|
||||
nw="$nw -Wvla" # warnings in gettext.h
|
||||
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
|
||||
nw="$nw -Wswitch-enum" # Too many warnings for now
|
||||
nw="$nw -Wswitch-default" # Too many warnings for now
|
||||
nw="$nw -Wstack-protector" # not worth working around
|
||||
# things I might fix soon:
|
||||
nw="$nw -Wfloat-equal" # sort.c, seq.c
|
||||
nw="$nw -Wmissing-format-attribute" # copy.c
|
||||
nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
|
||||
nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
|
||||
nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
|
||||
nw="$nw -Wformat-extra-args" # sdiff.c
|
||||
# ?? -Wstrict-overflow
|
||||
|
||||
gl_MANYWARN_ALL_GCC([ws])
|
||||
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
|
||||
for w in $ws; do
|
||||
gl_WARN_ADD([$w])
|
||||
done
|
||||
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
|
||||
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-format-nonliteral])
|
||||
|
||||
# In spite of excluding -Wlogical-op above, it is enabled, as of
|
||||
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
|
||||
gl_WARN_ADD([-Wno-logical-op])
|
||||
|
||||
gl_WARN_ADD([-fdiagnostics-show-option])
|
||||
gl_WARN_ADD([-funit-at-a-time])
|
||||
gl_WARN_ADD([-fno-common])
|
||||
|
||||
AC_SUBST([WARN_CFLAGS])
|
||||
|
||||
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
|
||||
AC_DEFINE([_FORTIFY_SOURCE], [2],
|
||||
[enable compile-time and run-time bounds-checking, and some warnings])
|
||||
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
|
||||
|
||||
# We use a slightly smaller set of warning options for lib/.
|
||||
# Remove the following and save the result in GNULIB_WARN_CFLAGS.
|
||||
nw=
|
||||
nw="$nw -Wunused-macros"
|
||||
nw="$nw -Wmissing-prototypes"
|
||||
nw="$nw -Wold-style-definition"
|
||||
nw="$nw -Wsuggest-attribute=pure"
|
||||
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
|
||||
AC_SUBST([GNULIB_WARN_CFLAGS])
|
||||
fi
|
||||
|
||||
AC_C_INLINE
|
||||
AC_C_VARARRAYS
|
||||
|
||||
AC_DEFINE([DEFAULT_EDITOR_PROGRAM], ["ed"],
|
||||
[Name of editor program, unless overridden.])
|
||||
|
||||
AC_PATH_PROG([PR_PROGRAM], [pr], [""])
|
||||
AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR_PROGRAM"], [Name of "pr" program.])
|
||||
|
||||
AC_CHECK_MEMBERS([struct stat.st_blksize])
|
||||
AC_CHECK_MEMBERS([struct stat.st_rdev])
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_TYPE_PID_T
|
||||
|
||||
AC_CHECK_FUNCS_ONCE([sigaction sigprocmask strcasecoll stricoll])
|
||||
if test $ac_cv_func_sigprocmask = no; then
|
||||
AC_CHECK_FUNCS([sigblock])
|
||||
fi
|
||||
AC_FUNC_CLOSEDIR_VOID
|
||||
AC_FUNC_FORK
|
||||
|
||||
# When .tarball-version exists, we're building from a tarball
|
||||
# and must not make man/*.1 files depend on the generated src/version.c,
|
||||
# because that would induce a requirement to run the help2man perl script.
|
||||
# We are not yet prepared to make perl a build-from-tarball requirement.
|
||||
# Hence, here we detect .tarball-version existence. When not present,
|
||||
# we define a variable to be used in man/Makefile.am to induce the
|
||||
# proper dependency (so that man/*.1 will be rebuilt upon any version change),
|
||||
# but not when built from a tarball.
|
||||
AC_SUBST([SRC_VERSION_C])
|
||||
test -f $srcdir/.tarball-version \
|
||||
&& SRC_VERSION_C= \
|
||||
|| SRC_VERSION_C=../src/version.c
|
||||
|
||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
AM_GNU_GETTEXT_VERSION([0.19.2])
|
||||
XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT"
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile doc/Makefile
|
||||
lib/Makefile
|
||||
src/Makefile
|
||||
tests/Makefile
|
||||
gnulib-tests/Makefile
|
||||
man/Makefile
|
||||
po/Makefile.in
|
||||
])
|
||||
AC_OUTPUT
|
||||
+41980
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,171 @@
|
||||
# Most of this is probably too coreutils-centric to be useful to other packages.
|
||||
|
||||
bin=bin-$$$$
|
||||
|
||||
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
|
||||
|
||||
tmpdir = $(abs_top_builddir)/tests/torture
|
||||
|
||||
t=$(tmpdir)/$(PACKAGE)/test
|
||||
pfx=$(t)/i
|
||||
|
||||
built_programs = \
|
||||
$$(echo 'spy:;@echo $$(bin_PROGRAMS)' \
|
||||
| MAKEFLAGS= $(MAKE) -s -C src -f Makefile -f - spy \
|
||||
| fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u)
|
||||
|
||||
# More than once, tainted build and source directory names would
|
||||
# have caused at least one "make check" test to apply "chmod 700"
|
||||
# to all directories under $HOME. Make sure it doesn't happen again.
|
||||
tp = $(tmpdir)/taint
|
||||
t_prefix = $(tp)/a
|
||||
t_taint = '$(t_prefix) b'
|
||||
fake_home = $(tp)/home
|
||||
|
||||
# When extracting from a distribution tarball, extract using the fastest
|
||||
# method possible. With dist-xz, that means using the *.xz file.
|
||||
ifneq ('', $(filter *.xz, $(DIST_ARCHIVES)))
|
||||
tar_decompress_opt_ = J
|
||||
suffix_ = xz
|
||||
else
|
||||
ifneq ('', $(filter *.gz, $(DIST_ARCHIVES)))
|
||||
tar_decompress_opt_ = z
|
||||
suffix_ = gz
|
||||
else
|
||||
tar_decompress_opt_ = j
|
||||
suffix_ = bz2
|
||||
endif
|
||||
endif
|
||||
amtar_extract_ = $(AMTAR) -$(tar_decompress_opt_)xf
|
||||
preferred_tarball_ = $(distdir).tar.$(suffix_)
|
||||
|
||||
# Ensure that tests run from tainted build and src dir names work,
|
||||
# and don't affect anything in $HOME. Create witness files in $HOME,
|
||||
# record their attributes, and build/test. Then ensure that the
|
||||
# witnesses were not affected.
|
||||
# Skip this test when using libtool, since libtool-generated scripts
|
||||
# cannot deal with a space-tainted srcdir.
|
||||
ALL_RECURSIVE_TARGETS += taint-distcheck
|
||||
taint-distcheck: $(DIST_ARCHIVES)
|
||||
grep '^[ ]*LT_INIT' configure.ac >/dev/null && exit 0 || :
|
||||
test -d $(t_taint) && chmod -R 700 $(t_taint) || :
|
||||
-rm -rf $(t_taint) $(fake_home)
|
||||
mkdir -p $(t_prefix) $(t_taint) $(fake_home)
|
||||
$(amtar_extract_) $(preferred_tarball_) -C $(t_taint)
|
||||
mkfifo $(fake_home)/fifo
|
||||
touch $(fake_home)/f
|
||||
mkdir -p $(fake_home)/d/e
|
||||
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
|
||||
HOME=$(fake_home); export HOME; \
|
||||
cd $(t_taint)/$(distdir) \
|
||||
&& ./configure \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) check \
|
||||
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
|
||||
&& diff $(tp)/.ls-before $(tp)/.ls-after \
|
||||
&& test -d $(t_prefix)
|
||||
rm -rf $(tp)
|
||||
|
||||
# Verify that a twisted use of --program-transform-name=PROGRAM works.
|
||||
define install-transform-check
|
||||
echo running install-transform-check \
|
||||
&& rm -rf $(pfx) \
|
||||
&& $(MAKE) program_transform_name='s/.*/zyx/' \
|
||||
prefix=$(pfx) install \
|
||||
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
|
||||
&& test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
|
||||
endef
|
||||
|
||||
# Install, then verify that all binaries and man pages are in place.
|
||||
# Note that neither the binary, ginstall, nor the [.1 man page is installed.
|
||||
define my-instcheck
|
||||
echo running my-instcheck; \
|
||||
$(MAKE) prefix=$(pfx) install \
|
||||
&& test ! -f $(pfx)/bin/ginstall \
|
||||
&& { fail=0; \
|
||||
for i in $(built_programs); do \
|
||||
test "$$i" = ginstall && i=install; \
|
||||
for j in "$(pfx)/bin/$$i" \
|
||||
"$(pfx)/share/man/man1/$$i.1"; do \
|
||||
case $$j in *'[.1') continue;; esac; \
|
||||
test -f "$$j" && : \
|
||||
|| { echo "$$j not installed"; fail=1; }; \
|
||||
done; \
|
||||
done; \
|
||||
test $$fail = 1 && exit 1 || :; \
|
||||
}
|
||||
endef
|
||||
|
||||
# The hard-linking for-loop below ensures that there is a bin/ directory
|
||||
# full of all of the programs under test (except the ones that are required
|
||||
# for basic Makefile rules), all symlinked to the just-built "false" program.
|
||||
# This is to ensure that if ever a test neglects to make PATH include
|
||||
# the build srcdir, these always-failing programs will run.
|
||||
# Otherwise, it is too easy to test the wrong programs.
|
||||
# Note that "false" itself is a symlink to true, so it too will malfunction.
|
||||
define coreutils-path-check
|
||||
{ \
|
||||
echo running coreutils-path-check; \
|
||||
if test -f $(srcdir)/src/true.c; then \
|
||||
fail=1; \
|
||||
mkdir $(bin) \
|
||||
&& ($(write_loser)) > $(bin)/loser \
|
||||
&& chmod a+x $(bin)/loser \
|
||||
&& for i in $(built_programs); do \
|
||||
case $$i in \
|
||||
rm|expr|basename|echo|sort|ls|tr);; \
|
||||
cat|dirname|mv|wc);; \
|
||||
*) ln $(bin)/loser $(bin)/$$i;; \
|
||||
esac; \
|
||||
done \
|
||||
&& ln -sf ../src/true $(bin)/false \
|
||||
&& PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \
|
||||
$(MAKE) -C tests check \
|
||||
&& { test -d gnulib-tests \
|
||||
&& $(MAKE) -C gnulib-tests check \
|
||||
|| :; } \
|
||||
&& rm -rf $(bin) \
|
||||
&& fail=0; \
|
||||
else \
|
||||
fail=0; \
|
||||
fi; \
|
||||
test $$fail = 1 && exit 1 || :; \
|
||||
}
|
||||
endef
|
||||
|
||||
# Use this to make sure we don't run these programs when building
|
||||
# from a virgin compressed tarball file, below.
|
||||
null_AM_MAKEFLAGS ?= \
|
||||
ACLOCAL=false \
|
||||
AUTOCONF=false \
|
||||
AUTOMAKE=false \
|
||||
AUTOHEADER=false \
|
||||
GPERF=false \
|
||||
MAKEINFO=false
|
||||
|
||||
ALL_RECURSIVE_TARGETS += my-distcheck
|
||||
my-distcheck: $(DIST_ARCHIVES) $(local-check)
|
||||
$(MAKE) syntax-check
|
||||
$(MAKE) check
|
||||
-rm -rf $(t)
|
||||
mkdir -p $(t)
|
||||
$(amtar_extract_) $(preferred_tarball_) -C $(t)
|
||||
(set -e; cd $(t)/$(distdir); \
|
||||
./configure --quiet --enable-gcc-warnings --disable-nls; \
|
||||
$(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'; \
|
||||
$(MAKE) dvi; \
|
||||
$(install-transform-check); \
|
||||
$(my-instcheck); \
|
||||
$(coreutils-path-check); \
|
||||
$(MAKE) distclean \
|
||||
)
|
||||
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||
&& $(amtar_extract_) - ) < $(preferred_tarball_)
|
||||
find $(t)/$(distdir).old $(t)/$(distdir) -name .deps | xargs rm -rf
|
||||
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||
-rm -rf $(t)
|
||||
rmdir $(tmpdir)/$(PACKAGE) $(tmpdir)
|
||||
@echo "========================"; \
|
||||
echo "ready for distribution:"; \
|
||||
for i in $(DIST_ARCHIVES); do echo " $$i"; done; \
|
||||
echo "========================"
|
||||
@@ -0,0 +1,23 @@
|
||||
# Makefile for GNU diffutils documentation.
|
||||
|
||||
# Copyright (C) 2001-2002, 2009-2013, 2015-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
AM_MAKEINFOFLAGS = --no-split
|
||||
|
||||
info_TEXINFOS = diffutils.texi
|
||||
diffutils_TEXINFOS = fdl.texi
|
||||
|
||||
EXTRA_DIST = diagmeet.note
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
Here is a comparison matrix which shows a case in which
|
||||
it is possible for the forward and backward scan in 'diag'
|
||||
to meet along a nonzero length of diagonal simultaneous
|
||||
(so that bdiag[d] and fdiag[d] are not equal)
|
||||
even though there is no snake on that diagonal at the meeting point.
|
||||
|
||||
|
||||
85 1 1 1 159 1 1 17
|
||||
1 2 3 4
|
||||
60
|
||||
1 2
|
||||
1
|
||||
2 2 3 4
|
||||
71
|
||||
3 3 4 5
|
||||
85
|
||||
4 3 4 5
|
||||
17
|
||||
5 4 5
|
||||
1
|
||||
6 4 5 6
|
||||
183
|
||||
7 5 6 7
|
||||
10
|
||||
8 6 7
|
||||
1
|
||||
9 6 7 8
|
||||
12
|
||||
7 8 9 10
|
||||
13
|
||||
10 8 9 10
|
||||
14
|
||||
10 9 10
|
||||
17
|
||||
10 10
|
||||
1
|
||||
10 9 10
|
||||
1
|
||||
8 10 10 10
|
||||
183
|
||||
8 7 9 9 9
|
||||
10
|
||||
7 6 8 9 8 8
|
||||
1
|
||||
6 5 7 7
|
||||
1
|
||||
5 6 6
|
||||
1
|
||||
5 5 5
|
||||
50
|
||||
5 4 4 4
|
||||
1
|
||||
4 3 3
|
||||
85
|
||||
5 4 3 2 2
|
||||
1
|
||||
2 1
|
||||
17
|
||||
5 4 3 2 1 1
|
||||
1
|
||||
1 0
|
||||
85 1 1 1 159 1 1 17
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,505 @@
|
||||
@c The GNU Free Documentation License.
|
||||
@center Version 1.3, 3 November 2008
|
||||
|
||||
@c This file is intended to be included within another document,
|
||||
@c hence no sectioning command or @node.
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
||||
@uref{http://fsf.org/}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@end display
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document @dfn{free} in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of ``copyleft'', which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
@item
|
||||
APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The ``Document'', below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as ``you''. You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A ``Modified Version'' of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A ``Secondary Section'' is a named appendix or a front-matter section
|
||||
of the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could fall
|
||||
directly within that overall subject. (Thus, if the Document is in
|
||||
part a textbook of mathematics, a Secondary Section may not explain
|
||||
any mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not ``Transparent'' is called ``Opaque''.
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, La@TeX{} input
|
||||
format, SGML or XML using a publicly available
|
||||
DTD, and standard-conforming simple HTML,
|
||||
PostScript or PDF designed for human modification. Examples
|
||||
of transparent image formats include PNG, XCF and
|
||||
JPG@. Opaque formats include proprietary formats that can be
|
||||
read and edited only by proprietary word processors, SGML or
|
||||
XML for which the DTD and/or processing tools are
|
||||
not generally available, and the machine-generated HTML,
|
||||
PostScript or PDF produced by some word processors for
|
||||
output purposes only.
|
||||
|
||||
The ``Title Page'' means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, ``Title Page'' means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
The ``publisher'' means any person or entity that distributes copies
|
||||
of the Document to the public.
|
||||
|
||||
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as ``Acknowledgements'',
|
||||
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section ``Entitled XYZ'' according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
@item
|
||||
VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
@item
|
||||
COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
@item
|
||||
MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
@enumerate A
|
||||
@item
|
||||
Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
|
||||
@item
|
||||
List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
|
||||
@item
|
||||
State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
|
||||
@item
|
||||
Preserve all the copyright notices of the Document.
|
||||
|
||||
@item
|
||||
Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
|
||||
@item
|
||||
Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
|
||||
@item
|
||||
Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
|
||||
@item
|
||||
Include an unaltered copy of this License.
|
||||
|
||||
@item
|
||||
Preserve the section Entitled ``History'', Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled ``History'' in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
|
||||
@item
|
||||
Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the ``History'' section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
|
||||
@item
|
||||
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
|
||||
the Title of the section, and preserve in the section all the
|
||||
substance and tone of each of the contributor acknowledgements and/or
|
||||
dedications given therein.
|
||||
|
||||
@item
|
||||
Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
|
||||
@item
|
||||
Delete any section Entitled ``Endorsements''. Such a section
|
||||
may not be included in the Modified Version.
|
||||
|
||||
@item
|
||||
Do not retitle any existing section to be Entitled ``Endorsements'' or
|
||||
to conflict in title with any Invariant Section.
|
||||
|
||||
@item
|
||||
Preserve any Warranty Disclaimers.
|
||||
@end enumerate
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled ``Endorsements'', provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties---for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
@item
|
||||
COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled ``History''
|
||||
in the various original documents, forming one section Entitled
|
||||
``History''; likewise combine any sections Entitled ``Acknowledgements'',
|
||||
and any sections Entitled ``Dedications''. You must delete all
|
||||
sections Entitled ``Endorsements.''
|
||||
|
||||
@item
|
||||
COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
@item
|
||||
AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an ``aggregate'' if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
@item
|
||||
TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled ``Acknowledgements'',
|
||||
``Dedications'', or ``History'', the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
@item
|
||||
TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, or distribute it is void, and
|
||||
will automatically terminate your rights under this License.
|
||||
|
||||
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, receipt of a copy of some or all of the same material does
|
||||
not give you any rights to use it.
|
||||
|
||||
@item
|
||||
FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation 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. See
|
||||
@uref{http://www.gnu.org/copyleft/}.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License ``or any later version'' applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation. If the Document
|
||||
specifies that a proxy can decide which future versions of this
|
||||
License can be used, that proxy's public statement of acceptance of a
|
||||
version permanently authorizes you to choose that version for the
|
||||
Document.
|
||||
|
||||
@item
|
||||
RELICENSING
|
||||
|
||||
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
|
||||
World Wide Web server that publishes copyrightable works and also
|
||||
provides prominent facilities for anybody to edit those works. A
|
||||
public wiki that anybody can edit is an example of such a server. A
|
||||
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
|
||||
site means any set of copyrightable works thus published on the MMC
|
||||
site.
|
||||
|
||||
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
|
||||
license published by Creative Commons Corporation, a not-for-profit
|
||||
corporation with a principal place of business in San Francisco,
|
||||
California, as well as future copyleft versions of that license
|
||||
published by that same organization.
|
||||
|
||||
``Incorporate'' means to publish or republish a Document, in whole or
|
||||
in part, as part of another Document.
|
||||
|
||||
An MMC is ``eligible for relicensing'' if it is licensed under this
|
||||
License, and if all works that were first published under this License
|
||||
somewhere other than this MMC, and subsequently incorporated in whole
|
||||
or in part into the MMC, (1) had no cover texts or invariant sections,
|
||||
and (2) were thus incorporated prior to November 1, 2008.
|
||||
|
||||
The operator of an MMC Site may republish an MMC contained in the site
|
||||
under CC-BY-SA on the same site at any time before August 1, 2009,
|
||||
provided the MMC is eligible for relicensing.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@page
|
||||
@heading ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
Copyright (C) @var{year} @var{your name}.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the ``with@dots{}Texts.''@: line with this:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
with the Invariant Sections being @var{list their titles}, with
|
||||
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
|
||||
being @var{list}.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
|
||||
@c Local Variables:
|
||||
@c ispell-local-pdict: "ispell-dict"
|
||||
@c End:
|
||||
@@ -0,0 +1,4 @@
|
||||
@set UPDATED 6 May 2017
|
||||
@set UPDATED-MONTH May 2017
|
||||
@set EDITION 3.6
|
||||
@set VERSION 3.6
|
||||
@@ -0,0 +1,4 @@
|
||||
@set UPDATED 6 May 2017
|
||||
@set UPDATED-MONTH May 2017
|
||||
@set EDITION 3.6
|
||||
@set VERSION 3.6
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
#! /bin/sh
|
||||
# Wrapper around gettext for programs using the msgid convention.
|
||||
|
||||
# Copyright (C) 1998, 2001, 2004, 2009-2013, 2015-2017 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# Written by Paul Eggert <eggert@twinsun.com>.
|
||||
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Always operate in the C locale.
|
||||
LANG=C
|
||||
LANGUAGE=C
|
||||
LC_ALL=C
|
||||
export LANG LANGUAGE LC_ALL
|
||||
|
||||
# Set AWK if environment has not already set it.
|
||||
AWK=${AWK-awk}
|
||||
|
||||
# The argument to this wrapper is the xgettext command to be executed.
|
||||
# Extract the xgettext program name from the rest of the command.
|
||||
xgettext=${1?}
|
||||
shift
|
||||
|
||||
# Save work if we're just wrapping a no-op.
|
||||
case $xgettext in
|
||||
:) exit;;
|
||||
esac
|
||||
|
||||
# Find the files to be scanned, and the directory to scan them from.
|
||||
directory=.
|
||||
files=
|
||||
for i
|
||||
do
|
||||
case $i in
|
||||
--directory=*)
|
||||
directory=`expr " $i" : ' --directory=\(.*\)'`;;
|
||||
--files-from=*)
|
||||
files_from=`expr " $i" : ' --files-from=\(.*\)'`
|
||||
files=`$AWK '/^[^#]/ { print }' $files_from`;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Generate keyword options for xgettext,
|
||||
# by scanning for declarations of functions
|
||||
# whose parameter names end in "msgid".
|
||||
generate_keyword_options='
|
||||
/^[A-Z_a-z].*\(.*msgid[,)]/ {
|
||||
|
||||
paren_index = index($0, "(")
|
||||
|
||||
name = substr($0, 1, paren_index - 1)
|
||||
sub(/[^0-9A-Z_a-z]*$/, "", name)
|
||||
sub(/[ ]+PARAMS/, "", name)
|
||||
sub(/[ ]+VPARAMS/, "", name)
|
||||
sub(/.*[^0-9A-Z_a-z]/, "", name)
|
||||
|
||||
args = substr($0, paren_index)
|
||||
sub(/msgid[,)].*/, "", args)
|
||||
for (n = 1; sub(/^[^,]*,/, "", args); n++) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
keyword = name
|
||||
} else {
|
||||
keyword = name ":" n
|
||||
}
|
||||
|
||||
if (! keyword_seen[keyword]++) {
|
||||
print "--keyword=" keyword
|
||||
}
|
||||
}
|
||||
'
|
||||
keyword_options=`(
|
||||
cd $directory &&
|
||||
$AWK "$generate_keyword_options" $files < /dev/null
|
||||
)` || exit
|
||||
|
||||
# Run the xgettext command, with extra input containing the extra
|
||||
# msgids that it wouldn't normally find.
|
||||
generate_emsgids='
|
||||
/%e.*}/ {
|
||||
line = $0
|
||||
while ((percent_index = index(line, "%e")) != 0) {
|
||||
line = substr(line, percent_index + 2)
|
||||
bracket_index = index(line, "}")
|
||||
if (bracket_index == 0) {
|
||||
continue
|
||||
}
|
||||
msgid = substr(line, 1, bracket_index - 1)
|
||||
if (index(msgid, "%") != 0) {
|
||||
continue
|
||||
}
|
||||
printf "#line %d \"%s\"\n", FNR, FILENAME
|
||||
printf "_(\"%s\")\n", msgid
|
||||
line = substr(line, bracket_index + 1)
|
||||
}
|
||||
}
|
||||
'
|
||||
(cd $directory &&
|
||||
$AWK "$generate_emsgids" $files < /dev/null
|
||||
) | "$xgettext" $keyword_options ${1+"$@"} -
|
||||
@@ -0,0 +1 @@
|
||||
include gnulib.mk
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
#if !defined _Noreturn && __STDC_VERSION__ < 201112
|
||||
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|
||||
|| 0x5110 <= __SUNPRO_C)
|
||||
# define _Noreturn __attribute__ ((__noreturn__))
|
||||
# elif 1200 <= _MSC_VER
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _Noreturn
|
||||
# endif
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
/* accept.c --- wrappers for Windows accept function
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paolo Bonzini */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
/* Get winsock2.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
|
||||
#include "w32sock.h"
|
||||
|
||||
#undef accept
|
||||
|
||||
int
|
||||
rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
{
|
||||
SOCKET sock = FD_TO_SOCKET (fd);
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SOCKET fh = accept (sock, addr, addrlen);
|
||||
if (fh == INVALID_SOCKET)
|
||||
{
|
||||
set_winsock_errno ();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return SOCKET_TO_FD (fh);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/* A C macro for declaring that specific arguments must not be NULL.
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
||||
that the values passed as arguments n, ..., m must be non-NULL pointers.
|
||||
n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
||||
#ifndef _GL_ARG_NONNULL
|
||||
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
||||
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
||||
# else
|
||||
# define _GL_ARG_NONNULL(params)
|
||||
# endif
|
||||
#endif
|
||||
@@ -0,0 +1,140 @@
|
||||
/* A GNU-like <arpa/inet.h>.
|
||||
|
||||
Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#if @HAVE_FEATURES_H@
|
||||
# include <features.h> /* for __GLIBC__ */
|
||||
#endif
|
||||
|
||||
/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
|
||||
for pulling in winsock2.h etc. under MinGW.
|
||||
But avoid namespace pollution on glibc systems. */
|
||||
#ifndef __GLIBC__
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
|
||||
But avoid namespace pollution on glibc systems. */
|
||||
#if defined __TANDEM && !defined __GLIBC__
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#if @HAVE_ARPA_INET_H@
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
|
||||
#define _@GUARD_PREFIX@_ARPA_INET_H
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||
|
||||
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||
|
||||
|
||||
#if @GNULIB_INET_NTOP@
|
||||
/* Converts an internet address from internal format to a printable,
|
||||
presentable format.
|
||||
AF is an internet address family, such as AF_INET or AF_INET6.
|
||||
SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
|
||||
(for AF_INET6).
|
||||
DST points to a buffer having room for CNT bytes.
|
||||
The printable representation of the address (in numeric form, not
|
||||
surrounded by [...], no reverse DNS is done) is placed in DST, and
|
||||
DST is returned. If an error occurs, the return value is NULL and
|
||||
errno is set. If CNT bytes are not sufficient to hold the result,
|
||||
the return value is NULL and errno is set to ENOSPC. A good value
|
||||
for CNT is 46.
|
||||
|
||||
For more details, see the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
|
||||
# if @REPLACE_INET_NTOP@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef inet_ntop
|
||||
# define inet_ntop rpl_inet_ntop
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (inet_ntop, const char *,
|
||||
(int af, const void *restrict src,
|
||||
char *restrict dst, socklen_t cnt)
|
||||
_GL_ARG_NONNULL ((2, 3)));
|
||||
_GL_CXXALIAS_RPL (inet_ntop, const char *,
|
||||
(int af, const void *restrict src,
|
||||
char *restrict dst, socklen_t cnt));
|
||||
# else
|
||||
# if !@HAVE_DECL_INET_NTOP@
|
||||
_GL_FUNCDECL_SYS (inet_ntop, const char *,
|
||||
(int af, const void *restrict src,
|
||||
char *restrict dst, socklen_t cnt)
|
||||
_GL_ARG_NONNULL ((2, 3)));
|
||||
# endif
|
||||
/* Need to cast, because on NonStop Kernel, the fourth parameter is
|
||||
size_t cnt. */
|
||||
_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
|
||||
(int af, const void *restrict src,
|
||||
char *restrict dst, socklen_t cnt));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (inet_ntop);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef inet_ntop
|
||||
# if HAVE_RAW_DECL_INET_NTOP
|
||||
_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
|
||||
"use gnulib module inet_ntop for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_INET_PTON@
|
||||
# if @REPLACE_INET_PTON@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef inet_pton
|
||||
# define inet_pton rpl_inet_pton
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (inet_pton, int,
|
||||
(int af, const char *restrict src, void *restrict dst)
|
||||
_GL_ARG_NONNULL ((2, 3)));
|
||||
_GL_CXXALIAS_RPL (inet_pton, int,
|
||||
(int af, const char *restrict src, void *restrict dst));
|
||||
# else
|
||||
# if !@HAVE_DECL_INET_PTON@
|
||||
_GL_FUNCDECL_SYS (inet_pton, int,
|
||||
(int af, const char *restrict src, void *restrict dst)
|
||||
_GL_ARG_NONNULL ((2, 3)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (inet_pton, int,
|
||||
(int af, const char *restrict src, void *restrict dst));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (inet_pton);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef inet_pton
|
||||
# if HAVE_RAW_DECL_INET_PTON
|
||||
_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
|
||||
"use gnulib module inet_pton for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
|
||||
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
|
||||
@@ -0,0 +1,49 @@
|
||||
/* bind.c --- wrappers for Windows bind function
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paolo Bonzini */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
/* Get winsock2.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
|
||||
#include "w32sock.h"
|
||||
|
||||
#undef bind
|
||||
|
||||
int
|
||||
rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len)
|
||||
{
|
||||
SOCKET sock = FD_TO_SOCKET (fd);
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int r = bind (sock, sockaddr, len);
|
||||
if (r < 0)
|
||||
set_winsock_errno ();
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
/* C++ compatible function declaration macros.
|
||||
Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GL_CXXDEFS_H
|
||||
#define _GL_CXXDEFS_H
|
||||
|
||||
/* Begin/end the GNULIB_NAMESPACE namespace. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
|
||||
# define _GL_END_NAMESPACE }
|
||||
#else
|
||||
# define _GL_BEGIN_NAMESPACE
|
||||
# define _GL_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
/* The three most frequent use cases of these macros are:
|
||||
|
||||
* For providing a substitute for a function that is missing on some
|
||||
platforms, but is declared and works fine on the platforms on which
|
||||
it exists:
|
||||
|
||||
#if @GNULIB_FOO@
|
||||
# if !@HAVE_FOO@
|
||||
_GL_FUNCDECL_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (foo, ...);
|
||||
_GL_CXXALIASWARN (foo);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
...
|
||||
#endif
|
||||
|
||||
* For providing a replacement for a function that exists on all platforms,
|
||||
but is broken/insufficient and needs to be replaced on some platforms:
|
||||
|
||||
#if @GNULIB_FOO@
|
||||
# if @REPLACE_FOO@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef foo
|
||||
# define foo rpl_foo
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (foo, ...);
|
||||
_GL_CXXALIAS_RPL (foo, ...);
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIASWARN (foo);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
...
|
||||
#endif
|
||||
|
||||
* For providing a replacement for a function that exists on some platforms
|
||||
but is broken/insufficient and needs to be replaced on some of them and
|
||||
is additionally either missing or undeclared on some other platforms:
|
||||
|
||||
#if @GNULIB_FOO@
|
||||
# if @REPLACE_FOO@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef foo
|
||||
# define foo rpl_foo
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (foo, ...);
|
||||
_GL_CXXALIAS_RPL (foo, ...);
|
||||
# else
|
||||
# if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
|
||||
_GL_FUNCDECL_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIASWARN (foo);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
...
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* _GL_EXTERN_C declaration;
|
||||
performs the declaration with C linkage. */
|
||||
#if defined __cplusplus
|
||||
# define _GL_EXTERN_C extern "C"
|
||||
#else
|
||||
# define _GL_EXTERN_C extern
|
||||
#endif
|
||||
|
||||
/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
|
||||
declares a replacement function, named rpl_func, with the given prototype,
|
||||
consisting of return type, parameters, and attributes.
|
||||
Example:
|
||||
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
*/
|
||||
#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
|
||||
_GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
|
||||
#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
|
||||
_GL_EXTERN_C rettype rpl_func parameters_and_attributes
|
||||
|
||||
/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
|
||||
declares the system function, named func, with the given prototype,
|
||||
consisting of return type, parameters, and attributes.
|
||||
Example:
|
||||
_GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
*/
|
||||
#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
|
||||
_GL_EXTERN_C rettype func parameters_and_attributes
|
||||
|
||||
/* _GL_CXXALIAS_RPL (func, rettype, parameters);
|
||||
declares a C++ alias called GNULIB_NAMESPACE::func
|
||||
that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
|
||||
Example:
|
||||
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
|
||||
|
||||
Wrapping rpl_func in an object with an inline conversion operator
|
||||
avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
|
||||
actually used in the program. */
|
||||
#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
|
||||
_GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return ::rpl_func; \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
|
||||
is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
|
||||
except that the C function rpl_func may have a slightly different
|
||||
declaration. A cast is used to silence the "invalid conversion" error
|
||||
that would otherwise occur. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return reinterpret_cast<type>(::rpl_func); \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||
declares a C++ alias called GNULIB_NAMESPACE::func
|
||||
that redirects to the system provided function func, if GNULIB_NAMESPACE
|
||||
is defined.
|
||||
Example:
|
||||
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
|
||||
|
||||
Wrapping func in an object with an inline conversion operator
|
||||
avoids a reference to func unless GNULIB_NAMESPACE::func is
|
||||
actually used in the program. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return ::func; \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
|
||||
is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||
except that the C function func may have a slightly different declaration.
|
||||
A cast is used to silence the "invalid conversion" error that would
|
||||
otherwise occur. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return reinterpret_cast<type>(::func); \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
|
||||
is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||
except that the C function is picked among a set of overloaded functions,
|
||||
namely the one with rettype2 and parameters2. Two consecutive casts
|
||||
are used to silence the "cannot find a match" and "invalid conversion"
|
||||
errors that would otherwise occur. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
/* The outer cast must be a reinterpret_cast.
|
||||
The inner cast: When the function is defined as a set of overloaded
|
||||
functions, it works as a static_cast<>, choosing the designated variant.
|
||||
When the function is defined as a single variant, it works as a
|
||||
reinterpret_cast<>. The parenthesized cast syntax works both ways. */
|
||||
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIASWARN (func);
|
||||
causes a warning to be emitted when ::func is used but not when
|
||||
GNULIB_NAMESPACE::func is used. func must be defined without overloaded
|
||||
variants. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIASWARN(func) \
|
||||
_GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
|
||||
# define _GL_CXXALIASWARN_1(func,namespace) \
|
||||
_GL_CXXALIASWARN_2 (func, namespace)
|
||||
/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
||||
we enable the warning only when not optimizing. */
|
||||
# if !__OPTIMIZE__
|
||||
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||
_GL_WARN_ON_USE (func, \
|
||||
"The symbol ::" #func " refers to the system function. " \
|
||||
"Use " #namespace "::" #func " instead.")
|
||||
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||
extern __typeof__ (func) func
|
||||
# else
|
||||
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
# endif
|
||||
#else
|
||||
# define _GL_CXXALIASWARN(func) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
|
||||
causes a warning to be emitted when the given overloaded variant of ::func
|
||||
is used but not when GNULIB_NAMESPACE::func is used. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
||||
_GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
|
||||
GNULIB_NAMESPACE)
|
||||
# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
|
||||
_GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
|
||||
/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
||||
we enable the warning only when not optimizing. */
|
||||
# if !__OPTIMIZE__
|
||||
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||
_GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
|
||||
"The symbol ::" #func " refers to the system function. " \
|
||||
"Use " #namespace "::" #func " instead.")
|
||||
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||
extern __typeof__ (func) func
|
||||
# else
|
||||
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
# endif
|
||||
#else
|
||||
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
#endif /* _GL_CXXDEFS_H */
|
||||
@@ -0,0 +1,56 @@
|
||||
/* connect.c --- wrappers for Windows connect function
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paolo Bonzini */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
/* Get winsock2.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
|
||||
#include "w32sock.h"
|
||||
|
||||
#undef connect
|
||||
|
||||
int
|
||||
rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
|
||||
{
|
||||
SOCKET sock = FD_TO_SOCKET (fd);
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int r = connect (sock, sockaddr, len);
|
||||
if (r < 0)
|
||||
{
|
||||
/* EINPROGRESS is not returned by WinSock 2.0; for backwards
|
||||
compatibility, connect(2) uses EWOULDBLOCK. */
|
||||
if (WSAGetLastError () == WSAEWOULDBLOCK)
|
||||
WSASetLastError (WSAEINPROGRESS);
|
||||
|
||||
set_winsock_errno ();
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/* Convert double to timespec.
|
||||
|
||||
Copyright (C) 2011-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Paul Eggert */
|
||||
|
||||
/* Convert the double value SEC to a struct timespec. Round toward
|
||||
positive infinity. On overflow, return an extremal value. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "timespec.h"
|
||||
|
||||
#include "intprops.h"
|
||||
|
||||
struct timespec
|
||||
dtotimespec (double sec)
|
||||
{
|
||||
if (! (TYPE_MINIMUM (time_t) < sec))
|
||||
return make_timespec (TYPE_MINIMUM (time_t), 0);
|
||||
else if (! (sec < 1.0 + TYPE_MAXIMUM (time_t)))
|
||||
return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_RESOLUTION - 1);
|
||||
else
|
||||
{
|
||||
time_t s = sec;
|
||||
double frac = TIMESPEC_RESOLUTION * (sec - s);
|
||||
long ns = frac;
|
||||
ns += ns < frac;
|
||||
s += ns / TIMESPEC_RESOLUTION;
|
||||
ns %= TIMESPEC_RESOLUTION;
|
||||
|
||||
if (ns < 0)
|
||||
{
|
||||
s--;
|
||||
ns += TIMESPEC_RESOLUTION;
|
||||
}
|
||||
|
||||
return make_timespec (s, ns);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/* Open a stream with a given file descriptor.
|
||||
Copyright (C) 2011-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
# include "msvc-inval.h"
|
||||
#endif
|
||||
|
||||
#undef fdopen
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
static FILE *
|
||||
fdopen_nothrow (int fd, const char *mode)
|
||||
{
|
||||
FILE *result;
|
||||
|
||||
TRY_MSVC_INVAL
|
||||
{
|
||||
result = fdopen (fd, mode);
|
||||
}
|
||||
CATCH_MSVC_INVAL
|
||||
{
|
||||
result = NULL;
|
||||
}
|
||||
DONE_MSVC_INVAL;
|
||||
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
# define fdopen_nothrow fdopen
|
||||
#endif
|
||||
|
||||
FILE *
|
||||
rpl_fdopen (int fd, const char *mode)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
FILE *fp;
|
||||
|
||||
errno = 0;
|
||||
fp = fdopen_nothrow (fd, mode);
|
||||
if (fp == NULL)
|
||||
{
|
||||
if (errno == 0)
|
||||
errno = EBADF;
|
||||
}
|
||||
else
|
||||
errno = saved_errno;
|
||||
|
||||
return fp;
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/* Manipulating the FPU control word. -*- coding: utf-8 -*-
|
||||
Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2007.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _FPUCW_H
|
||||
#define _FPUCW_H
|
||||
|
||||
/* The i386 floating point hardware (the 387 compatible FPU, not the modern
|
||||
SSE/SSE2 hardware) has a controllable rounding precision. It is specified
|
||||
through the 'PC' bits in the FPU control word ('fctrl' register). (See
|
||||
the GNU libc i386 <fpu_control.h> header for details.)
|
||||
|
||||
On some platforms, such as Linux or Solaris, the default precision setting
|
||||
is set to "extended precision". This means that 'long double' instructions
|
||||
operate correctly, but 'double' computations often produce slightly
|
||||
different results as on strictly IEEE 754 conforming systems.
|
||||
|
||||
On some platforms, such as NetBSD, the default precision is set to
|
||||
"double precision". This means that 'long double' instructions will operate
|
||||
only as 'double', i.e. lead to wrong results. Similarly on FreeBSD 6.4, at
|
||||
least for the division of 'long double' numbers.
|
||||
|
||||
The FPU control word is under control of the application, i.e. it is
|
||||
not required to be set either way by the ABI. (In fact, the i386 ABI
|
||||
http://refspecs.freestandards.org/elf/abi386-4.pdf page 3-12 = page 38
|
||||
is not clear about it. But in any case, gcc treats the control word
|
||||
like a "preserved" register: it emits code that assumes that the control
|
||||
word is preserved across calls, and it restores the control word at the
|
||||
end of functions that modify it.)
|
||||
|
||||
See Vincent Lefèvre's page http://www.vinc17.org/research/extended.en.html
|
||||
for a good explanation.
|
||||
See http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html for
|
||||
some argumentation which setting should be the default. */
|
||||
|
||||
/* This header file provides the following facilities:
|
||||
fpucw_t integral type holding the value of 'fctrl'
|
||||
FPU_PC_MASK bit mask denoting the precision control
|
||||
FPU_PC_DOUBLE precision control for 53 bits mantissa
|
||||
FPU_PC_EXTENDED precision control for 64 bits mantissa
|
||||
GET_FPUCW () yields the current FPU control word
|
||||
SET_FPUCW (word) sets the FPU control word
|
||||
DECL_LONG_DOUBLE_ROUNDING variable declaration for
|
||||
BEGIN/END_LONG_DOUBLE_ROUNDING
|
||||
BEGIN_LONG_DOUBLE_ROUNDING () starts a sequence of instructions with
|
||||
'long double' safe operation precision
|
||||
END_LONG_DOUBLE_ROUNDING () ends a sequence of instructions with
|
||||
'long double' safe operation precision
|
||||
*/
|
||||
|
||||
/* Inline assembler like this works only with GNU C. */
|
||||
#if (defined __i386__ || defined __x86_64__) && defined __GNUC__
|
||||
|
||||
typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */
|
||||
|
||||
# define FPU_PC_MASK 0x0300
|
||||
# define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */
|
||||
# define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */
|
||||
|
||||
# define GET_FPUCW() \
|
||||
({ fpucw_t _cw; \
|
||||
__asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \
|
||||
_cw; \
|
||||
})
|
||||
# define SET_FPUCW(word) \
|
||||
(void)({ fpucw_t _ncw = (word); \
|
||||
__asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \
|
||||
})
|
||||
|
||||
# define DECL_LONG_DOUBLE_ROUNDING \
|
||||
fpucw_t oldcw;
|
||||
# define BEGIN_LONG_DOUBLE_ROUNDING() \
|
||||
(void)(oldcw = GET_FPUCW (), \
|
||||
SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED))
|
||||
# define END_LONG_DOUBLE_ROUNDING() \
|
||||
SET_FPUCW (oldcw)
|
||||
|
||||
#else
|
||||
|
||||
typedef unsigned int fpucw_t;
|
||||
|
||||
# define FPU_PC_MASK 0
|
||||
# define FPU_PC_DOUBLE 0
|
||||
# define FPU_PC_EXTENDED 0
|
||||
|
||||
# define GET_FPUCW() 0
|
||||
# define SET_FPUCW(word) (void)(word)
|
||||
|
||||
# define DECL_LONG_DOUBLE_ROUNDING
|
||||
# define BEGIN_LONG_DOUBLE_ROUNDING()
|
||||
# define END_LONG_DOUBLE_ROUNDING()
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _FPUCW_H */
|
||||
@@ -0,0 +1,193 @@
|
||||
/* ftruncate emulations for native Windows.
|
||||
Copyright (C) 1992-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#if HAVE_CHSIZE
|
||||
/* A native Windows platform. */
|
||||
|
||||
# include <errno.h>
|
||||
|
||||
# if _GL_WINDOWS_64_BIT_OFF_T
|
||||
|
||||
/* Large File Support: off_t is 64-bit, but chsize() takes only a 32-bit
|
||||
argument. So, define a 64-bit safe SetFileSize function ourselves. */
|
||||
|
||||
/* Ensure that <windows.h> declares GetFileSizeEx. */
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT _WIN32_WINNT_WIN2K
|
||||
|
||||
/* Get declarations of the native Windows API functions. */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
/* Get _get_osfhandle. */
|
||||
# if GNULIB_MSVC_NOTHROW
|
||||
# include "msvc-nothrow.h"
|
||||
# else
|
||||
# include <io.h>
|
||||
# endif
|
||||
|
||||
static BOOL
|
||||
SetFileSize (HANDLE h, LONGLONG size)
|
||||
{
|
||||
LARGE_INTEGER old_size;
|
||||
|
||||
if (!GetFileSizeEx (h, &old_size))
|
||||
return FALSE;
|
||||
|
||||
if (size != old_size.QuadPart)
|
||||
{
|
||||
/* Duplicate the handle, so we are free to modify its file position. */
|
||||
HANDLE curr_process = GetCurrentProcess ();
|
||||
HANDLE tmph;
|
||||
|
||||
if (!DuplicateHandle (curr_process, /* SourceProcessHandle */
|
||||
h, /* SourceHandle */
|
||||
curr_process, /* TargetProcessHandle */
|
||||
(PHANDLE) &tmph, /* TargetHandle */
|
||||
(DWORD) 0, /* DesiredAccess */
|
||||
FALSE, /* InheritHandle */
|
||||
DUPLICATE_SAME_ACCESS)) /* Options */
|
||||
return FALSE;
|
||||
|
||||
if (size < old_size.QuadPart)
|
||||
{
|
||||
/* Reduce the size. */
|
||||
LONG size_hi = (LONG) (size >> 32);
|
||||
if (SetFilePointer (tmph, (LONG) size, &size_hi, FILE_BEGIN)
|
||||
== INVALID_SET_FILE_POINTER
|
||||
&& GetLastError() != NO_ERROR)
|
||||
{
|
||||
CloseHandle (tmph);
|
||||
return FALSE;
|
||||
}
|
||||
if (!SetEndOfFile (tmph))
|
||||
{
|
||||
CloseHandle (tmph);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Increase the size by adding zero bytes at the end. */
|
||||
static char zero_bytes[1024];
|
||||
LONG pos_hi = 0;
|
||||
LONG pos_lo = SetFilePointer (tmph, (LONG) 0, &pos_hi, FILE_END);
|
||||
LONGLONG pos;
|
||||
if (pos_lo == INVALID_SET_FILE_POINTER
|
||||
&& GetLastError() != NO_ERROR)
|
||||
{
|
||||
CloseHandle (tmph);
|
||||
return FALSE;
|
||||
}
|
||||
pos = ((LONGLONG) pos_hi << 32) | (ULONGLONG) (ULONG) pos_lo;
|
||||
while (pos < size)
|
||||
{
|
||||
DWORD written;
|
||||
LONGLONG count = size - pos;
|
||||
if (count > sizeof (zero_bytes))
|
||||
count = sizeof (zero_bytes);
|
||||
if (!WriteFile (tmph, zero_bytes, (DWORD) count, &written, NULL)
|
||||
|| written == 0)
|
||||
{
|
||||
CloseHandle (tmph);
|
||||
return FALSE;
|
||||
}
|
||||
pos += (ULONGLONG) (ULONG) written;
|
||||
}
|
||||
}
|
||||
/* Close the handle. */
|
||||
CloseHandle (tmph);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
ftruncate (int fd, off_t length)
|
||||
{
|
||||
HANDLE handle = (HANDLE) _get_osfhandle (fd);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
if (length < 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!SetFileSize (handle, length))
|
||||
{
|
||||
switch (GetLastError ())
|
||||
{
|
||||
case ERROR_ACCESS_DENIED:
|
||||
errno = EACCES;
|
||||
break;
|
||||
case ERROR_HANDLE_DISK_FULL:
|
||||
case ERROR_DISK_FULL:
|
||||
case ERROR_DISK_TOO_FRAGMENTED:
|
||||
errno = ENOSPC;
|
||||
break;
|
||||
default:
|
||||
errno = EIO;
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
# include <io.h>
|
||||
|
||||
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
# include "msvc-inval.h"
|
||||
static int
|
||||
chsize_nothrow (int fd, long length)
|
||||
{
|
||||
int result;
|
||||
|
||||
TRY_MSVC_INVAL
|
||||
{
|
||||
result = chsize (fd, length);
|
||||
}
|
||||
CATCH_MSVC_INVAL
|
||||
{
|
||||
result = -1;
|
||||
errno = EBADF;
|
||||
}
|
||||
DONE_MSVC_INVAL;
|
||||
|
||||
return result;
|
||||
}
|
||||
# else
|
||||
# define chsize_nothrow chsize
|
||||
# endif
|
||||
|
||||
int
|
||||
ftruncate (int fd, off_t length)
|
||||
{
|
||||
return chsize_nothrow (fd, length);
|
||||
}
|
||||
|
||||
# endif
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
|
||||
This file is part of gnulib.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification */
|
||||
#include <unistd.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if GNULIB_GETCWD
|
||||
/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use. */
|
||||
typedef int dummy;
|
||||
#else
|
||||
|
||||
/* Get the name of the current working directory, and put it in SIZE
|
||||
bytes of BUF. Returns NULL if the directory couldn't be determined
|
||||
(perhaps because the absolute name was longer than PATH_MAX, or
|
||||
because of missing read/search permissions on parent directories)
|
||||
or SIZE was too small. If successful, returns BUF. If BUF is
|
||||
NULL, an array is allocated with 'malloc'; the array is SIZE bytes
|
||||
long, unless SIZE == 0, in which case it is as big as
|
||||
necessary. */
|
||||
|
||||
# undef getcwd
|
||||
char *
|
||||
rpl_getcwd (char *buf, size_t size)
|
||||
{
|
||||
char *ptr;
|
||||
char *result;
|
||||
|
||||
/* Handle single size operations. */
|
||||
if (buf)
|
||||
{
|
||||
if (!size)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
return getcwd (buf, size);
|
||||
}
|
||||
|
||||
if (size)
|
||||
{
|
||||
buf = malloc (size);
|
||||
if (!buf)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
result = getcwd (buf, size);
|
||||
if (!result)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
free (buf);
|
||||
errno = saved_errno;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Flexible sizing requested. Avoid over-allocation for the common
|
||||
case of a name that fits within a 4k page, minus some space for
|
||||
local variables, to be sure we don't skip over a guard page. */
|
||||
{
|
||||
char tmp[4032];
|
||||
size = sizeof tmp;
|
||||
ptr = getcwd (tmp, size);
|
||||
if (ptr)
|
||||
{
|
||||
result = strdup (ptr);
|
||||
if (!result)
|
||||
errno = ENOMEM;
|
||||
return result;
|
||||
}
|
||||
if (errno != ERANGE)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* My what a large directory name we have. */
|
||||
do
|
||||
{
|
||||
size <<= 1;
|
||||
ptr = realloc (buf, size);
|
||||
if (ptr == NULL)
|
||||
{
|
||||
free (buf);
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
buf = ptr;
|
||||
result = getcwd (buf, size);
|
||||
}
|
||||
while (!result && errno == ERANGE);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
free (buf);
|
||||
errno = saved_errno;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Trim to fit, if possible. */
|
||||
result = realloc (buf, strlen (buf) + 1);
|
||||
if (!result)
|
||||
result = buf;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/* getpagesize emulation for systems where it cannot be done in a C macro.
|
||||
|
||||
Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible and Martin Lambers. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
/* This implementation is only for native Windows systems. */
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
int
|
||||
getpagesize (void)
|
||||
{
|
||||
SYSTEM_INFO system_info;
|
||||
GetSystemInfo (&system_info);
|
||||
return system_info.dwPageSize;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
/* hash-pjw.c -- compute a hash value from a NUL-terminated string.
|
||||
|
||||
Copyright (C) 2001, 2003, 2006, 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "hash-pjw.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
|
||||
|
||||
/* A hash function for NUL-terminated char* strings using
|
||||
the method described by Bruno Haible.
|
||||
See http://www.haible.de/bruno/hashfunc.html. */
|
||||
|
||||
size_t
|
||||
hash_pjw (const void *x, size_t tablesize)
|
||||
{
|
||||
const char *s;
|
||||
size_t h = 0;
|
||||
|
||||
for (s = x; *s; s++)
|
||||
h = *s + ((h << 9) | (h >> (SIZE_BITS - 9)));
|
||||
|
||||
return h % tablesize;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/* hash-pjw.h -- declaration for a simple hash function
|
||||
Copyright (C) 2001, 2003, 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Compute a hash code for a NUL-terminated string starting at X,
|
||||
and return the hash code modulo TABLESIZE.
|
||||
The result is platform dependent: it depends on the size of the 'size_t'
|
||||
type and on the signedness of the 'char' type. */
|
||||
extern size_t hash_pjw (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE;
|
||||
@@ -0,0 +1,268 @@
|
||||
/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
|
||||
|
||||
Copyright (C) 2006, 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996,1999 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#if HAVE_DECL_INET_PTON
|
||||
|
||||
# undef inet_pton
|
||||
|
||||
int
|
||||
rpl_inet_pton (int af, const char *restrict src, void *restrict dst)
|
||||
{
|
||||
return inet_pton (af, src, dst);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include <c-ctype.h>
|
||||
# include <string.h>
|
||||
# include <errno.h>
|
||||
|
||||
# define NS_INADDRSZ 4
|
||||
# define NS_IN6ADDRSZ 16
|
||||
# define NS_INT16SZ 2
|
||||
|
||||
/*
|
||||
* WARNING: Don't even consider trying to compile this on a system where
|
||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||
*/
|
||||
|
||||
static int inet_pton4 (const char *src, unsigned char *dst);
|
||||
# if HAVE_IPV6
|
||||
static int inet_pton6 (const char *src, unsigned char *dst);
|
||||
# endif
|
||||
|
||||
/* int
|
||||
* inet_pton(af, src, dst)
|
||||
* convert from presentation format (which usually means ASCII printable)
|
||||
* to network format (which is usually some kind of binary format).
|
||||
* return:
|
||||
* 1 if the address was valid for the specified address family
|
||||
* 0 if the address wasn't valid ('dst' is untouched in this case)
|
||||
* -1 if some other error occurred ('dst' is untouched in this case, too)
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
int
|
||||
inet_pton (int af, const char *restrict src, void *restrict dst)
|
||||
{
|
||||
switch (af)
|
||||
{
|
||||
case AF_INET:
|
||||
return (inet_pton4 (src, dst));
|
||||
|
||||
# if HAVE_IPV6
|
||||
case AF_INET6:
|
||||
return (inet_pton6 (src, dst));
|
||||
# endif
|
||||
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (-1);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* int
|
||||
* inet_pton4(src, dst)
|
||||
* like inet_aton() but without all the hexadecimal, octal (with the
|
||||
* exception of 0) and shorthand.
|
||||
* return:
|
||||
* 1 if 'src' is a valid dotted quad, else 0.
|
||||
* notice:
|
||||
* does not touch 'dst' unless it's returning 1.
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static int
|
||||
inet_pton4 (const char *restrict src, unsigned char *restrict dst)
|
||||
{
|
||||
int saw_digit, octets, ch;
|
||||
unsigned char tmp[NS_INADDRSZ], *tp;
|
||||
|
||||
saw_digit = 0;
|
||||
octets = 0;
|
||||
*(tp = tmp) = 0;
|
||||
while ((ch = *src++) != '\0')
|
||||
{
|
||||
|
||||
if (ch >= '0' && ch <= '9')
|
||||
{
|
||||
unsigned new = *tp * 10 + (ch - '0');
|
||||
|
||||
if (saw_digit && *tp == 0)
|
||||
return (0);
|
||||
if (new > 255)
|
||||
return (0);
|
||||
*tp = new;
|
||||
if (!saw_digit)
|
||||
{
|
||||
if (++octets > 4)
|
||||
return (0);
|
||||
saw_digit = 1;
|
||||
}
|
||||
}
|
||||
else if (ch == '.' && saw_digit)
|
||||
{
|
||||
if (octets == 4)
|
||||
return (0);
|
||||
*++tp = 0;
|
||||
saw_digit = 0;
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
if (octets < 4)
|
||||
return (0);
|
||||
memcpy (dst, tmp, NS_INADDRSZ);
|
||||
return (1);
|
||||
}
|
||||
|
||||
# if HAVE_IPV6
|
||||
|
||||
/* int
|
||||
* inet_pton6(src, dst)
|
||||
* convert presentation level address to network order binary form.
|
||||
* return:
|
||||
* 1 if 'src' is a valid [RFC1884 2.2] address, else 0.
|
||||
* notice:
|
||||
* (1) does not touch 'dst' unless it's returning 1.
|
||||
* (2) :: in a full address is silently ignored.
|
||||
* credit:
|
||||
* inspired by Mark Andrews.
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static int
|
||||
inet_pton6 (const char *restrict src, unsigned char *restrict dst)
|
||||
{
|
||||
static const char xdigits[] = "0123456789abcdef";
|
||||
unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
|
||||
const char *curtok;
|
||||
int ch, saw_xdigit;
|
||||
unsigned val;
|
||||
|
||||
tp = memset (tmp, '\0', NS_IN6ADDRSZ);
|
||||
endp = tp + NS_IN6ADDRSZ;
|
||||
colonp = NULL;
|
||||
/* Leading :: requires some special handling. */
|
||||
if (*src == ':')
|
||||
if (*++src != ':')
|
||||
return (0);
|
||||
curtok = src;
|
||||
saw_xdigit = 0;
|
||||
val = 0;
|
||||
while ((ch = c_tolower (*src++)) != '\0')
|
||||
{
|
||||
const char *pch;
|
||||
|
||||
pch = strchr (xdigits, ch);
|
||||
if (pch != NULL)
|
||||
{
|
||||
val <<= 4;
|
||||
val |= (pch - xdigits);
|
||||
if (val > 0xffff)
|
||||
return (0);
|
||||
saw_xdigit = 1;
|
||||
continue;
|
||||
}
|
||||
if (ch == ':')
|
||||
{
|
||||
curtok = src;
|
||||
if (!saw_xdigit)
|
||||
{
|
||||
if (colonp)
|
||||
return (0);
|
||||
colonp = tp;
|
||||
continue;
|
||||
}
|
||||
else if (*src == '\0')
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
if (tp + NS_INT16SZ > endp)
|
||||
return (0);
|
||||
*tp++ = (u_char) (val >> 8) & 0xff;
|
||||
*tp++ = (u_char) val & 0xff;
|
||||
saw_xdigit = 0;
|
||||
val = 0;
|
||||
continue;
|
||||
}
|
||||
if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
|
||||
inet_pton4 (curtok, tp) > 0)
|
||||
{
|
||||
tp += NS_INADDRSZ;
|
||||
saw_xdigit = 0;
|
||||
break; /* '\0' was seen by inet_pton4(). */
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
if (saw_xdigit)
|
||||
{
|
||||
if (tp + NS_INT16SZ > endp)
|
||||
return (0);
|
||||
*tp++ = (u_char) (val >> 8) & 0xff;
|
||||
*tp++ = (u_char) val & 0xff;
|
||||
}
|
||||
if (colonp != NULL)
|
||||
{
|
||||
/*
|
||||
* Since some memmove()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const int n = tp - colonp;
|
||||
int i;
|
||||
|
||||
if (tp == endp)
|
||||
return (0);
|
||||
for (i = 1; i <= n; i++)
|
||||
{
|
||||
endp[-i] = colonp[n - i];
|
||||
colonp[n - i] = 0;
|
||||
}
|
||||
tp = endp;
|
||||
}
|
||||
if (tp != endp)
|
||||
return (0);
|
||||
memcpy (dst, tmp, NS_IN6ADDRSZ);
|
||||
return (1);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,605 @@
|
||||
# source this file; set up for tests
|
||||
|
||||
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Using this file in a test
|
||||
# =========================
|
||||
#
|
||||
# The typical skeleton of a test looks like this:
|
||||
#
|
||||
# #!/bin/sh
|
||||
# . "${srcdir=.}/init.sh"; path_prepend_ .
|
||||
# Execute some commands.
|
||||
# Note that these commands are executed in a subdirectory, therefore you
|
||||
# need to prepend "../" to relative filenames in the build directory.
|
||||
# Note that the "path_prepend_ ." is useful only if the body of your
|
||||
# test invokes programs residing in the initial directory.
|
||||
# For example, if the programs you want to test are in src/, and this test
|
||||
# script is named tests/test-1, then you would use "path_prepend_ ../src",
|
||||
# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
|
||||
# to all tests via automake's TESTS_ENVIRONMENT.
|
||||
# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
|
||||
# Use the skip_ and fail_ functions to print a diagnostic and then exit
|
||||
# with the corresponding exit code.
|
||||
# Exit $?
|
||||
|
||||
# Executing a test that uses this file
|
||||
# ====================================
|
||||
#
|
||||
# Running a single test:
|
||||
# $ make check TESTS=test-foo.sh
|
||||
#
|
||||
# Running a single test, with verbose output:
|
||||
# $ make check TESTS=test-foo.sh VERBOSE=yes
|
||||
#
|
||||
# Running a single test, keeping the temporary directory:
|
||||
# $ make check TESTS=test-foo.sh KEEP=yes
|
||||
#
|
||||
# Running a single test, with single-stepping:
|
||||
# 1. Go into a sub-shell:
|
||||
# $ bash
|
||||
# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the
|
||||
# Makefile:
|
||||
# $ export srcdir=../../tests # this is an example
|
||||
# 3. Execute the commands from the test, copy&pasting them one by one:
|
||||
# $ . "$srcdir/init.sh"; path_prepend_ .
|
||||
# ...
|
||||
# 4. Finally
|
||||
# $ exit
|
||||
|
||||
ME_=`expr "./$0" : '.*/\(.*\)$'`
|
||||
|
||||
# We use a trap below for cleanup. This requires us to go through
|
||||
# hoops to get the right exit status transported through the handler.
|
||||
# So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests.
|
||||
# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
|
||||
# sh inside this function.
|
||||
Exit () { set +e; (exit $1); exit $1; }
|
||||
|
||||
# Print warnings (e.g., about skipped and failed tests) to this file number.
|
||||
# Override by defining to say, 9, in init.cfg, and putting say,
|
||||
# export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2
|
||||
# in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file.
|
||||
# This is useful when using automake's parallel tests mode, to print
|
||||
# the reason for skip/failure to console, rather than to the .log files.
|
||||
: ${stderr_fileno_=2}
|
||||
|
||||
# Note that correct expansion of "$*" depends on IFS starting with ' '.
|
||||
# Always write the full diagnostic to stderr.
|
||||
# When stderr_fileno_ is not 2, also emit the first line of the
|
||||
# diagnostic to that file descriptor.
|
||||
warn_ ()
|
||||
{
|
||||
# If IFS does not start with ' ', set it and emit the warning in a subshell.
|
||||
case $IFS in
|
||||
' '*) printf '%s\n' "$*" >&2
|
||||
test $stderr_fileno_ = 2 \
|
||||
|| { printf '%s\n' "$*" | sed 1q >&$stderr_fileno_ ; } ;;
|
||||
*) (IFS=' '; warn_ "$@");;
|
||||
esac
|
||||
}
|
||||
fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; }
|
||||
skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; }
|
||||
fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; }
|
||||
framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; }
|
||||
|
||||
# This is used to simplify checking of the return value
|
||||
# which is useful when ensuring a command fails as desired.
|
||||
# I.e., just doing `command ... &&fail=1` will not catch
|
||||
# a segfault in command for example. With this helper you
|
||||
# instead check an explicit exit code like
|
||||
# returns_ 1 command ... || fail
|
||||
returns_ () {
|
||||
# Disable tracing so it doesn't interfere with stderr of the wrapped command
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
local exp_exit="$1"
|
||||
shift
|
||||
"$@"
|
||||
test $? -eq $exp_exit && ret_=0 || ret_=1
|
||||
|
||||
if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then
|
||||
set -x
|
||||
fi
|
||||
{ return $ret_; } 2>/dev/null
|
||||
}
|
||||
|
||||
# Sanitize this shell to POSIX mode, if possible.
|
||||
DUALCASE=1; export DUALCASE
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case `(set -o) 2>/dev/null` in
|
||||
*posix*) set -o posix ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# We require $(...) support unconditionally.
|
||||
# We require non-surprising "local" semantics (this eliminates dash).
|
||||
# This takes the admittedly draconian step of eliminating dash, because the
|
||||
# assignment tab=$(printf '\t') works fine, yet preceding it with "local "
|
||||
# transforms it into an assignment that sets the variable to the empty string.
|
||||
# That is too counter-intuitive, and can lead to subtle run-time malfunction.
|
||||
# The example below is less subtle in that with dash, it evokes the run-time
|
||||
# exception "dash: 1: local: 1: bad variable name".
|
||||
# We require a few additional shell features only when $EXEEXT is nonempty,
|
||||
# in order to support automatic $EXEEXT emulation:
|
||||
# - hyphen-containing alias names
|
||||
# - we prefer to use ${var#...} substitution, rather than having
|
||||
# to work around lack of support for that feature.
|
||||
# The following code attempts to find a shell with support for these features.
|
||||
# If the current shell passes the test, we're done. Otherwise, test other
|
||||
# shells until we find one that passes. If one is found, re-exec it.
|
||||
# If no acceptable shell is found, skip the current test.
|
||||
#
|
||||
# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that
|
||||
# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do.
|
||||
#
|
||||
# Use "9" to indicate success (rather than 0), in case some shell acts
|
||||
# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
|
||||
|
||||
# Eval this code in a subshell to determine a shell's suitability.
|
||||
# 10 - passes all tests; ok to use
|
||||
# 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score
|
||||
# ? - not ok
|
||||
gl_shell_test_script_='
|
||||
test $(echo y) = y || exit 1
|
||||
f_local_() { local v=1; }; f_local_ || exit 1
|
||||
f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_
|
||||
score_=10
|
||||
if test "$VERBOSE" = yes; then
|
||||
test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9
|
||||
fi
|
||||
test -z "$EXEEXT" && exit $score_
|
||||
shopt -s expand_aliases
|
||||
alias a-b="echo zoo"
|
||||
v=abx
|
||||
test ${v%x} = ab \
|
||||
&& test ${v#a} = bx \
|
||||
&& test $(a-b) = zoo \
|
||||
&& exit $score_
|
||||
'
|
||||
|
||||
if test "x$1" = "x--no-reexec"; then
|
||||
shift
|
||||
else
|
||||
# Assume a working shell. Export to subshells (setup_ needs this).
|
||||
gl_set_x_corrupts_stderr_=false
|
||||
export gl_set_x_corrupts_stderr_
|
||||
|
||||
# Record the first marginally acceptable shell.
|
||||
marginal_=
|
||||
|
||||
# Search for a shell that meets our requirements.
|
||||
for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \
|
||||
/bin/sh bash dash zsh pdksh fail
|
||||
do
|
||||
test "$re_shell_" = no_shell && continue
|
||||
|
||||
# If we've made it all the way to the sentinel, "fail" without
|
||||
# finding even a marginal shell, skip this test.
|
||||
if test "$re_shell_" = fail; then
|
||||
test -z "$marginal_" && skip_ failed to find an adequate shell
|
||||
re_shell_=$marginal_
|
||||
break
|
||||
fi
|
||||
|
||||
# When testing the current shell, simply "eval" the test code.
|
||||
# Otherwise, run it via $re_shell_ -c ...
|
||||
if test "$re_shell_" = __current__; then
|
||||
# 'eval'ing this code makes Solaris 10's /bin/sh exit with
|
||||
# $? set to 2. It does not evaluate any of the code after the
|
||||
# "unexpected" first '('. Thus, we must run it in a subshell.
|
||||
( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
|
||||
else
|
||||
"$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
|
||||
fi
|
||||
|
||||
st_=$?
|
||||
|
||||
# $re_shell_ works just fine. Use it.
|
||||
if test $st_ = 10; then
|
||||
gl_set_x_corrupts_stderr_=false
|
||||
break
|
||||
fi
|
||||
|
||||
# If this is our first marginally acceptable shell, remember it.
|
||||
if test "$st_:$marginal_" = 9: ; then
|
||||
marginal_="$re_shell_"
|
||||
gl_set_x_corrupts_stderr_=true
|
||||
fi
|
||||
done
|
||||
|
||||
if test "$re_shell_" != __current__; then
|
||||
# Found a usable shell. Preserve -v and -x.
|
||||
case $- in
|
||||
*v*x* | *x*v*) opts_=-vx ;;
|
||||
*v*) opts_=-v ;;
|
||||
*x*) opts_=-x ;;
|
||||
*) opts_= ;;
|
||||
esac
|
||||
re_shell=$re_shell_
|
||||
export re_shell
|
||||
exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
|
||||
echo "$ME_: exec failed" 1>&2
|
||||
exit 127
|
||||
fi
|
||||
fi
|
||||
|
||||
# If this is bash, turn off all aliases.
|
||||
test -n "$BASH_VERSION" && unalias -a
|
||||
|
||||
# Note that when supporting $EXEEXT (transparently mapping from PROG_NAME to
|
||||
# PROG_NAME.exe), we want to support hyphen-containing names like test-acos.
|
||||
# That is part of the shell-selection test above. Why use aliases rather
|
||||
# than functions? Because support for hyphen-containing aliases is more
|
||||
# widespread than that for hyphen-containing function names.
|
||||
test -n "$EXEEXT" && shopt -s expand_aliases
|
||||
|
||||
# Enable glibc's malloc-perturbing option.
|
||||
# This is useful for exposing code that depends on the fact that
|
||||
# malloc-related functions often return memory that is mostly zeroed.
|
||||
# If you have the time and cycles, use valgrind to do an even better job.
|
||||
: ${MALLOC_PERTURB_=87}
|
||||
export MALLOC_PERTURB_
|
||||
|
||||
# This is a stub function that is run upon trap (upon regular exit and
|
||||
# interrupt). Override it with a per-test function, e.g., to unmount
|
||||
# a partition, or to undo any other global state changes.
|
||||
cleanup_ () { :; }
|
||||
|
||||
# Emit a header similar to that from diff -u; Print the simulated "diff"
|
||||
# command so that the order of arguments is clear. Don't bother with @@ lines.
|
||||
emit_diff_u_header_ ()
|
||||
{
|
||||
printf '%s\n' "diff -u $*" \
|
||||
"--- $1 1970-01-01" \
|
||||
"+++ $2 1970-01-01"
|
||||
}
|
||||
|
||||
# Arrange not to let diff or cmp operate on /dev/null,
|
||||
# since on some systems (at least OSF/1 5.1), that doesn't work.
|
||||
# When there are not two arguments, or no argument is /dev/null, return 2.
|
||||
# When one argument is /dev/null and the other is not empty,
|
||||
# cat the nonempty file to stderr and return 1.
|
||||
# Otherwise, return 0.
|
||||
compare_dev_null_ ()
|
||||
{
|
||||
test $# = 2 || return 2
|
||||
|
||||
if test "x$1" = x/dev/null; then
|
||||
test -s "$2" || return 0
|
||||
emit_diff_u_header_ "$@"; sed 's/^/+/' "$2"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if test "x$2" = x/dev/null; then
|
||||
test -s "$1" || return 0
|
||||
emit_diff_u_header_ "$@"; sed 's/^/-/' "$1"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 2
|
||||
}
|
||||
|
||||
for diff_opt_ in -u -U3 -c '' no; do
|
||||
test "$diff_opt_" != no &&
|
||||
diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` &&
|
||||
break
|
||||
done
|
||||
if test "$diff_opt_" != no; then
|
||||
if test -z "$diff_out_"; then
|
||||
compare_ () { diff $diff_opt_ "$@"; }
|
||||
else
|
||||
compare_ ()
|
||||
{
|
||||
# If no differences were found, AIX and HP-UX 'diff' produce output
|
||||
# like "No differences encountered". Hide this output.
|
||||
diff $diff_opt_ "$@" > diff.out
|
||||
diff_status_=$?
|
||||
test $diff_status_ -eq 0 || cat diff.out || diff_status_=2
|
||||
rm -f diff.out || diff_status_=2
|
||||
return $diff_status_
|
||||
}
|
||||
fi
|
||||
elif cmp -s /dev/null /dev/null 2>/dev/null; then
|
||||
compare_ () { cmp -s "$@"; }
|
||||
else
|
||||
compare_ () { cmp "$@"; }
|
||||
fi
|
||||
|
||||
# Usage: compare EXPECTED ACTUAL
|
||||
#
|
||||
# Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more.
|
||||
# Otherwise, propagate $? to caller: any diffs have already been printed.
|
||||
compare ()
|
||||
{
|
||||
# This looks like it can be factored to use a simple "case $?"
|
||||
# after unchecked compare_dev_null_ invocation, but that would
|
||||
# fail in a "set -e" environment.
|
||||
if compare_dev_null_ "$@"; then
|
||||
return 0
|
||||
else
|
||||
case $? in
|
||||
1) return 1;;
|
||||
*) compare_ "$@";;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
# An arbitrary prefix to help distinguish test directories.
|
||||
testdir_prefix_ () { printf gt; }
|
||||
|
||||
# Run the user-overridable cleanup_ function, remove the temporary
|
||||
# directory and exit with the incoming value of $?.
|
||||
remove_tmp_ ()
|
||||
{
|
||||
__st=$?
|
||||
cleanup_
|
||||
if test "$KEEP" = yes; then
|
||||
echo "Not removing temporary directory $test_dir_"
|
||||
else
|
||||
# cd out of the directory we're about to remove
|
||||
cd "$initial_cwd_" || cd / || cd /tmp
|
||||
chmod -R u+rwx "$test_dir_"
|
||||
# If removal fails and exit status was to be 0, then change it to 1.
|
||||
rm -rf "$test_dir_" || { test $__st = 0 && __st=1; }
|
||||
fi
|
||||
exit $__st
|
||||
}
|
||||
|
||||
# Given a directory name, DIR, if every entry in it that matches *.exe
|
||||
# contains only the specified bytes (see the case stmt below), then print
|
||||
# a space-separated list of those names and return 0. Otherwise, don't
|
||||
# print anything and return 1. Naming constraints apply also to DIR.
|
||||
find_exe_basenames_ ()
|
||||
{
|
||||
feb_dir_=$1
|
||||
feb_fail_=0
|
||||
feb_result_=
|
||||
feb_sp_=
|
||||
for feb_file_ in $feb_dir_/*.exe; do
|
||||
# If there was no *.exe file, or there existed a file named "*.exe" that
|
||||
# was deleted between the above glob expansion and the existence test
|
||||
# below, just skip it.
|
||||
test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
|
||||
&& continue
|
||||
# Exempt [.exe, since we can't create a function by that name, yet
|
||||
# we can't invoke [ by PATH search anyways due to shell builtins.
|
||||
test "x$feb_file_" = "x$feb_dir_/[.exe" && continue
|
||||
case $feb_file_ in
|
||||
*[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
|
||||
*) # Remove leading file name components as well as the .exe suffix.
|
||||
feb_file_=${feb_file_##*/}
|
||||
feb_file_=${feb_file_%.exe}
|
||||
feb_result_="$feb_result_$feb_sp_$feb_file_";;
|
||||
esac
|
||||
feb_sp_=' '
|
||||
done
|
||||
test $feb_fail_ = 0 && printf %s "$feb_result_"
|
||||
return $feb_fail_
|
||||
}
|
||||
|
||||
# Consider the files in directory, $1.
|
||||
# For each file name of the form PROG.exe, create an alias named
|
||||
# PROG that simply invokes PROG.exe, then return 0. If any selected
|
||||
# file name or the directory name, $1, contains an unexpected character,
|
||||
# define no alias and return 1.
|
||||
create_exe_shims_ ()
|
||||
{
|
||||
case $EXEEXT in
|
||||
'') return 0 ;;
|
||||
.exe) ;;
|
||||
*) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;;
|
||||
esac
|
||||
|
||||
base_names_=`find_exe_basenames_ $1` \
|
||||
|| { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; }
|
||||
|
||||
if test -n "$base_names_"; then
|
||||
for base_ in $base_names_; do
|
||||
alias "$base_"="$base_$EXEEXT"
|
||||
done
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Use this function to prepend to PATH an absolute name for each
|
||||
# specified, possibly-$initial_cwd_-relative, directory.
|
||||
path_prepend_ ()
|
||||
{
|
||||
while test $# != 0; do
|
||||
path_dir_=$1
|
||||
case $path_dir_ in
|
||||
'') fail_ "invalid path dir: '$1'";;
|
||||
/*) abs_path_dir_=$path_dir_;;
|
||||
*) abs_path_dir_=$initial_cwd_/$path_dir_;;
|
||||
esac
|
||||
case $abs_path_dir_ in
|
||||
*:*) fail_ "invalid path dir: '$abs_path_dir_'";;
|
||||
esac
|
||||
PATH="$abs_path_dir_:$PATH"
|
||||
|
||||
# Create an alias, FOO, for each FOO.exe in this directory.
|
||||
create_exe_shims_ "$abs_path_dir_" \
|
||||
|| fail_ "something failed (above): $abs_path_dir_"
|
||||
shift
|
||||
done
|
||||
export PATH
|
||||
}
|
||||
|
||||
setup_ ()
|
||||
{
|
||||
if test "$VERBOSE" = yes; then
|
||||
# Test whether set -x may cause the selected shell to corrupt an
|
||||
# application's stderr. Many do, including zsh-4.3.10 and the /bin/sh
|
||||
# from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5.
|
||||
# If enabling verbose output this way would cause trouble, simply
|
||||
# issue a warning and refrain.
|
||||
if $gl_set_x_corrupts_stderr_; then
|
||||
warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr"
|
||||
else
|
||||
set -x
|
||||
fi
|
||||
fi
|
||||
|
||||
initial_cwd_=$PWD
|
||||
|
||||
pfx_=`testdir_prefix_`
|
||||
test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
|
||||
|| fail_ "failed to create temporary directory in $initial_cwd_"
|
||||
cd "$test_dir_" || fail_ "failed to cd to temporary directory"
|
||||
|
||||
# As autoconf-generated configure scripts do, ensure that IFS
|
||||
# is defined initially, so that saving and restoring $IFS works.
|
||||
gl_init_sh_nl_='
|
||||
'
|
||||
IFS=" "" $gl_init_sh_nl_"
|
||||
|
||||
# This trap statement, along with a trap on 0 below, ensure that the
|
||||
# temporary directory, $test_dir_, is removed upon exit as well as
|
||||
# upon receipt of any of the listed signals.
|
||||
for sig_ in 1 2 3 13 15; do
|
||||
eval "trap 'Exit $(expr $sig_ + 128)' $sig_"
|
||||
done
|
||||
}
|
||||
|
||||
# Create a temporary directory, much like mktemp -d does.
|
||||
# Written by Jim Meyering.
|
||||
#
|
||||
# Usage: mktempd_ /tmp phoey.XXXXXXXXXX
|
||||
#
|
||||
# First, try to use the mktemp program.
|
||||
# Failing that, we'll roll our own mktemp-like function:
|
||||
# - try to get random bytes from /dev/urandom
|
||||
# - failing that, generate output from a combination of quickly-varying
|
||||
# sources and gzip. Ignore non-varying gzip header, and extract
|
||||
# "random" bits from there.
|
||||
# - given those bits, map to file-name bytes using tr, and try to create
|
||||
# the desired directory.
|
||||
# - make only $MAX_TRIES_ attempts
|
||||
|
||||
# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9.
|
||||
rand_bytes_ ()
|
||||
{
|
||||
n_=$1
|
||||
|
||||
# Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first?
|
||||
# But if they have openssl, they probably have mktemp, too.
|
||||
|
||||
chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
|
||||
dev_rand_=/dev/urandom
|
||||
if test -r "$dev_rand_"; then
|
||||
# Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194.
|
||||
dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \
|
||||
| LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_
|
||||
return
|
||||
fi
|
||||
|
||||
n_plus_50_=`expr $n_ + 50`
|
||||
cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n'
|
||||
data_=` (eval "$cmds_") 2>&1 | gzip `
|
||||
|
||||
# Ensure that $data_ has length at least 50+$n_
|
||||
while :; do
|
||||
len_=`echo "$data_"|wc -c`
|
||||
test $n_plus_50_ -le $len_ && break;
|
||||
data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip `
|
||||
done
|
||||
|
||||
echo "$data_" \
|
||||
| dd bs=1 skip=50 count=$n_ 2>/dev/null \
|
||||
| LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_
|
||||
}
|
||||
|
||||
mktempd_ ()
|
||||
{
|
||||
case $# in
|
||||
2);;
|
||||
*) fail_ "Usage: mktempd_ DIR TEMPLATE";;
|
||||
esac
|
||||
|
||||
destdir_=$1
|
||||
template_=$2
|
||||
|
||||
MAX_TRIES_=4
|
||||
|
||||
# Disallow any trailing slash on specified destdir:
|
||||
# it would subvert the post-mktemp "case"-based destdir test.
|
||||
case $destdir_ in
|
||||
/ | //) destdir_slash_=$destdir;;
|
||||
*/) fail_ "invalid destination dir: remove trailing slash(es)";;
|
||||
*) destdir_slash_=$destdir_/;;
|
||||
esac
|
||||
|
||||
case $template_ in
|
||||
*XXXX) ;;
|
||||
*) fail_ \
|
||||
"invalid template: $template_ (must have a suffix of at least 4 X's)";;
|
||||
esac
|
||||
|
||||
# First, try to use mktemp.
|
||||
d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` &&
|
||||
|
||||
# The resulting name must be in the specified directory.
|
||||
case $d in "$destdir_slash_"*) :;; *) false;; esac &&
|
||||
|
||||
# It must have created the directory.
|
||||
test -d "$d" &&
|
||||
|
||||
# It must have 0700 permissions. Handle sticky "S" bits.
|
||||
perms=`ls -dgo "$d" 2>/dev/null` &&
|
||||
case $perms in drwx--[-S]---*) :;; *) false;; esac && {
|
||||
echo "$d"
|
||||
return
|
||||
}
|
||||
|
||||
# If we reach this point, we'll have to create a directory manually.
|
||||
|
||||
# Get a copy of the template without its suffix of X's.
|
||||
base_template_=`echo "$template_"|sed 's/XX*$//'`
|
||||
|
||||
# Calculate how many X's we've just removed.
|
||||
template_length_=`echo "$template_" | wc -c`
|
||||
nx_=`echo "$base_template_" | wc -c`
|
||||
nx_=`expr $template_length_ - $nx_`
|
||||
|
||||
err_=
|
||||
i_=1
|
||||
while :; do
|
||||
X_=`rand_bytes_ $nx_`
|
||||
candidate_dir_="$destdir_slash_$base_template_$X_"
|
||||
err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \
|
||||
&& { echo "$candidate_dir_"; return; }
|
||||
test $MAX_TRIES_ -le $i_ && break;
|
||||
i_=`expr $i_ + 1`
|
||||
done
|
||||
fail_ "$err_"
|
||||
}
|
||||
|
||||
# If you want to override the testdir_prefix_ function,
|
||||
# or to add more utility functions, use this file.
|
||||
test -f "$srcdir/init.cfg" \
|
||||
&& . "$srcdir/init.cfg"
|
||||
|
||||
setup_ "$@"
|
||||
# This trap is here, rather than in the setup_ function, because some
|
||||
# shells run the exit trap at shell function exit, rather than script exit.
|
||||
trap remove_tmp_ 0
|
||||
@@ -0,0 +1,92 @@
|
||||
/* ioctl.c --- wrappers for Windows ioctl function
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paolo Bonzini */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#if HAVE_IOCTL
|
||||
|
||||
/* Provide a wrapper with the POSIX prototype. */
|
||||
# undef ioctl
|
||||
int
|
||||
rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
|
||||
{
|
||||
void *buf;
|
||||
va_list args;
|
||||
|
||||
va_start (args, request);
|
||||
buf = va_arg (args, void *);
|
||||
va_end (args);
|
||||
|
||||
/* Cast 'request' so that when the system's ioctl function takes a 64-bit
|
||||
request argument, the value gets zero-extended, not sign-extended. */
|
||||
return ioctl (fd, (unsigned int) request, buf);
|
||||
}
|
||||
|
||||
#else /* mingw */
|
||||
|
||||
# include <errno.h>
|
||||
|
||||
/* Get HANDLE. */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
# include "fd-hook.h"
|
||||
/* Get _get_osfhandle. */
|
||||
# if GNULIB_MSVC_NOTHROW
|
||||
# include "msvc-nothrow.h"
|
||||
# else
|
||||
# include <io.h>
|
||||
# endif
|
||||
|
||||
static int
|
||||
primary_ioctl (int fd, int request, void *arg)
|
||||
{
|
||||
/* We don't support FIONBIO on pipes here. If you want to make pipe
|
||||
fds non-blocking, use the gnulib 'nonblocking' module, until
|
||||
gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK. */
|
||||
|
||||
if ((HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE)
|
||||
errno = ENOSYS;
|
||||
else
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
ioctl (int fd, int request, ... /* {void *,char *} arg */)
|
||||
{
|
||||
void *arg;
|
||||
va_list args;
|
||||
|
||||
va_start (args, request);
|
||||
arg = va_arg (args, void *);
|
||||
va_end (args);
|
||||
|
||||
# if WINDOWS_SOCKETS
|
||||
return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
|
||||
# else
|
||||
return primary_ioctl (fd, request, arg);
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/* listen.c --- wrappers for Windows listen function
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paolo Bonzini */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
/* Get winsock2.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
|
||||
#include "w32sock.h"
|
||||
|
||||
#undef listen
|
||||
|
||||
int
|
||||
rpl_listen (int fd, int backlog)
|
||||
{
|
||||
SOCKET sock = FD_TO_SOCKET (fd);
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int r = listen (sock, backlog);
|
||||
if (r < 0)
|
||||
set_winsock_errno ();
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/* Common macros used by gnulib tests.
|
||||
Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
/* This file contains macros that are used by many gnulib tests.
|
||||
Put here only frequently used macros, say, used by 10 tests or more. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef FALLTHROUGH
|
||||
# if __GNUC__ < 7
|
||||
# define FALLTHROUGH ((void) 0)
|
||||
# else
|
||||
# define FALLTHROUGH __attribute__ ((__fallthrough__))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define ASSERT_STREAM before including this file if ASSERT must
|
||||
target a stream other than stderr. */
|
||||
#ifndef ASSERT_STREAM
|
||||
# define ASSERT_STREAM stderr
|
||||
#endif
|
||||
|
||||
/* ASSERT (condition);
|
||||
verifies that the specified condition is fulfilled. If not, a message
|
||||
is printed to ASSERT_STREAM if defined (defaulting to stderr if
|
||||
undefined) and the program is terminated with an error code.
|
||||
|
||||
This macro has the following properties:
|
||||
- The programmer specifies the expected condition, not the failure
|
||||
condition. This simplifies thinking.
|
||||
- The condition is tested always, regardless of compilation flags.
|
||||
(Unlike the macro from <assert.h>.)
|
||||
- On Unix platforms, the tester can debug the test program with a
|
||||
debugger (provided core dumps are enabled: "ulimit -c unlimited").
|
||||
- For the sake of platforms where no debugger is available (such as
|
||||
some mingw systems), an error message is printed on the error
|
||||
stream that includes the source location of the ASSERT invocation.
|
||||
*/
|
||||
#define ASSERT(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n", \
|
||||
__FILE__, __LINE__, #expr); \
|
||||
fflush (ASSERT_STREAM); \
|
||||
abort (); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* SIZEOF (array)
|
||||
returns the number of elements of an array. It works for arrays that are
|
||||
declared outside functions and for local variables of array type. It does
|
||||
*not* work for function parameters of array type, because they are actually
|
||||
parameters of pointer type. */
|
||||
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
|
||||
|
||||
/* STREQ (str1, str2)
|
||||
Return true if two strings compare equal. */
|
||||
#define STREQ(a, b) (strcmp (a, b) == 0)
|
||||
|
||||
/* Some numbers in the interval [0,1). */
|
||||
extern const float randomf[1000];
|
||||
extern const double randomd[1000];
|
||||
extern const long double randoml[1000];
|
||||
@@ -0,0 +1,276 @@
|
||||
/* Provide a replacement for the POSIX nanosleep function.
|
||||
|
||||
Copyright (C) 1999-2000, 2002, 2004-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Jim Meyering
|
||||
and Bruno Haible for the native Windows part */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "intprops.h"
|
||||
#include "sig-handler.h"
|
||||
#include "verify.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
enum { BILLION = 1000 * 1000 * 1000 };
|
||||
|
||||
#if HAVE_BUG_BIG_NANOSLEEP
|
||||
|
||||
int
|
||||
nanosleep (const struct timespec *requested_delay,
|
||||
struct timespec *remaining_delay)
|
||||
# undef nanosleep
|
||||
{
|
||||
/* nanosleep mishandles large sleeps due to internal overflow problems.
|
||||
The worst known case of this is Linux 2.6.9 with glibc 2.3.4, which
|
||||
can't sleep more than 24.85 days (2^31 milliseconds). Similarly,
|
||||
cygwin 1.5.x, which can't sleep more than 49.7 days (2^32 milliseconds).
|
||||
Solve this by breaking the sleep up into smaller chunks. */
|
||||
|
||||
if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
/* Verify that time_t is large enough. */
|
||||
verify (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60);
|
||||
const time_t limit = 24 * 24 * 60 * 60;
|
||||
time_t seconds = requested_delay->tv_sec;
|
||||
struct timespec intermediate;
|
||||
intermediate.tv_nsec = requested_delay->tv_nsec;
|
||||
|
||||
while (limit < seconds)
|
||||
{
|
||||
int result;
|
||||
intermediate.tv_sec = limit;
|
||||
result = nanosleep (&intermediate, remaining_delay);
|
||||
seconds -= limit;
|
||||
if (result)
|
||||
{
|
||||
if (remaining_delay)
|
||||
remaining_delay->tv_sec += seconds;
|
||||
return result;
|
||||
}
|
||||
intermediate.tv_nsec = 0;
|
||||
}
|
||||
intermediate.tv_sec = seconds;
|
||||
return nanosleep (&intermediate, remaining_delay);
|
||||
}
|
||||
}
|
||||
|
||||
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* Native Windows platforms. */
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
/* The Windows API function Sleep() has a resolution of about 15 ms and takes
|
||||
at least 5 ms to execute. We use this function for longer time periods.
|
||||
Additionally, we use busy-looping over short time periods, to get a
|
||||
resolution of about 0.01 ms. In order to measure such short timespans,
|
||||
we use the QueryPerformanceCounter() function. */
|
||||
|
||||
int
|
||||
nanosleep (const struct timespec *requested_delay,
|
||||
struct timespec *remaining_delay)
|
||||
{
|
||||
static bool initialized;
|
||||
/* Number of performance counter increments per nanosecond,
|
||||
or zero if it could not be determined. */
|
||||
static double ticks_per_nanosecond;
|
||||
|
||||
if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* For requested delays of one second or more, 15ms resolution is
|
||||
sufficient. */
|
||||
if (requested_delay->tv_sec == 0)
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
/* Initialize ticks_per_nanosecond. */
|
||||
LARGE_INTEGER ticks_per_second;
|
||||
|
||||
if (QueryPerformanceFrequency (&ticks_per_second))
|
||||
ticks_per_nanosecond =
|
||||
(double) ticks_per_second.QuadPart / 1000000000.0;
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
if (ticks_per_nanosecond)
|
||||
{
|
||||
/* QueryPerformanceFrequency worked. We can use
|
||||
QueryPerformanceCounter. Use a combination of Sleep and
|
||||
busy-looping. */
|
||||
/* Number of milliseconds to pass to the Sleep function.
|
||||
Since Sleep can take up to 8 ms less or 8 ms more than requested
|
||||
(or maybe more if the system is loaded), we subtract 10 ms. */
|
||||
int sleep_millis = (int) requested_delay->tv_nsec / 1000000 - 10;
|
||||
/* Determine how many ticks to delay. */
|
||||
LONGLONG wait_ticks = requested_delay->tv_nsec * ticks_per_nanosecond;
|
||||
/* Start. */
|
||||
LARGE_INTEGER counter_before;
|
||||
if (QueryPerformanceCounter (&counter_before))
|
||||
{
|
||||
/* Wait until the performance counter has reached this value.
|
||||
We don't need to worry about overflow, because the performance
|
||||
counter is reset at reboot, and with a frequency of 3.6E6
|
||||
ticks per second 63 bits suffice for over 80000 years. */
|
||||
LONGLONG wait_until = counter_before.QuadPart + wait_ticks;
|
||||
/* Use Sleep for the longest part. */
|
||||
if (sleep_millis > 0)
|
||||
Sleep (sleep_millis);
|
||||
/* Busy-loop for the rest. */
|
||||
for (;;)
|
||||
{
|
||||
LARGE_INTEGER counter_after;
|
||||
if (!QueryPerformanceCounter (&counter_after))
|
||||
/* QueryPerformanceCounter failed, but succeeded earlier.
|
||||
Should not happen. */
|
||||
break;
|
||||
if (counter_after.QuadPart >= wait_until)
|
||||
/* The requested time has elapsed. */
|
||||
break;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Implementation for long delays and as fallback. */
|
||||
Sleep (requested_delay->tv_sec * 1000 + requested_delay->tv_nsec / 1000000);
|
||||
|
||||
done:
|
||||
/* Sleep is not interruptible. So there is no remaining delay. */
|
||||
if (remaining_delay != NULL)
|
||||
{
|
||||
remaining_delay->tv_sec = 0;
|
||||
remaining_delay->tv_nsec = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
/* Unix platforms lacking nanosleep. */
|
||||
|
||||
/* Some systems (MSDOS) don't have SIGCONT.
|
||||
Using SIGTERM here turns the signal-handling code below
|
||||
into a no-op on such systems. */
|
||||
# ifndef SIGCONT
|
||||
# define SIGCONT SIGTERM
|
||||
# endif
|
||||
|
||||
static sig_atomic_t volatile suspended;
|
||||
|
||||
/* Handle SIGCONT. */
|
||||
|
||||
static void
|
||||
sighandler (int sig)
|
||||
{
|
||||
suspended = 1;
|
||||
}
|
||||
|
||||
/* Suspend execution for at least *TS_DELAY seconds. */
|
||||
|
||||
static int
|
||||
my_usleep (const struct timespec *ts_delay)
|
||||
{
|
||||
struct timeval tv_delay;
|
||||
tv_delay.tv_sec = ts_delay->tv_sec;
|
||||
tv_delay.tv_usec = (ts_delay->tv_nsec + 999) / 1000;
|
||||
if (tv_delay.tv_usec == 1000000)
|
||||
{
|
||||
if (tv_delay.tv_sec == TYPE_MAXIMUM (time_t))
|
||||
tv_delay.tv_usec = 1000000 - 1; /* close enough */
|
||||
else
|
||||
{
|
||||
tv_delay.tv_sec++;
|
||||
tv_delay.tv_usec = 0;
|
||||
}
|
||||
}
|
||||
return select (0, NULL, NULL, NULL, &tv_delay);
|
||||
}
|
||||
|
||||
/* Suspend execution for at least *REQUESTED_DELAY seconds. The
|
||||
*REMAINING_DELAY part isn't implemented yet. */
|
||||
|
||||
int
|
||||
nanosleep (const struct timespec *requested_delay,
|
||||
struct timespec *remaining_delay)
|
||||
{
|
||||
static bool initialized;
|
||||
|
||||
if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* set up sig handler */
|
||||
if (! initialized)
|
||||
{
|
||||
struct sigaction oldact;
|
||||
|
||||
sigaction (SIGCONT, NULL, &oldact);
|
||||
if (get_handler (&oldact) != SIG_IGN)
|
||||
{
|
||||
struct sigaction newact;
|
||||
|
||||
newact.sa_handler = sighandler;
|
||||
sigemptyset (&newact.sa_mask);
|
||||
newact.sa_flags = 0;
|
||||
sigaction (SIGCONT, &newact, NULL);
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
suspended = 0;
|
||||
|
||||
if (my_usleep (requested_delay) == -1)
|
||||
{
|
||||
if (suspended)
|
||||
{
|
||||
/* Calculate time remaining. */
|
||||
/* FIXME: the code in sleep doesn't use this, so there's no
|
||||
rush to implement it. */
|
||||
|
||||
errno = EINTR;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* FIXME: Restore sig handler? */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,150 @@
|
||||
/* Assist in file system timestamp tests.
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Eric Blake <ebb9@byu.net>, 2009. */
|
||||
|
||||
#ifndef GLTEST_NAP_H
|
||||
# define GLTEST_NAP_H
|
||||
|
||||
# include <limits.h>
|
||||
# include <stdbool.h>
|
||||
|
||||
/* Name of the witness file. */
|
||||
#define TEMPFILE BASE "nap.tmp"
|
||||
|
||||
/* File descriptor used for the witness file. */
|
||||
static int nap_fd = -1;
|
||||
|
||||
/* Return A - B, in ns.
|
||||
Return 0 if the true result would be negative.
|
||||
Return INT_MAX if the true result would be greater than INT_MAX. */
|
||||
static int
|
||||
diff_timespec (struct timespec a, struct timespec b)
|
||||
{
|
||||
time_t as = a.tv_sec;
|
||||
time_t bs = b.tv_sec;
|
||||
int ans = a.tv_nsec;
|
||||
int bns = b.tv_nsec;
|
||||
|
||||
if (! (bs < as || (bs == as && bns < ans)))
|
||||
return 0;
|
||||
if (as - bs <= INT_MAX / 1000000000)
|
||||
{
|
||||
int sdiff = (as - bs) * 1000000000;
|
||||
int usdiff = ans - bns;
|
||||
if (usdiff < INT_MAX - sdiff)
|
||||
return sdiff + usdiff;
|
||||
}
|
||||
return INT_MAX;
|
||||
}
|
||||
|
||||
/* If DO_WRITE, bump the modification time of the file designated by NAP_FD.
|
||||
Then fetch the new STAT information of NAP_FD. */
|
||||
static void
|
||||
nap_get_stat (struct stat *st, int do_write)
|
||||
{
|
||||
if (do_write)
|
||||
{
|
||||
ASSERT (write (nap_fd, "\n", 1) == 1);
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* On native Windows, the modification times are not changed until NAP_FD
|
||||
is closed. See
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365747(v=vs.85).aspx */
|
||||
close (nap_fd);
|
||||
nap_fd = open (TEMPFILE, O_RDWR, 0600);
|
||||
ASSERT (nap_fd != -1);
|
||||
lseek (nap_fd, 0, SEEK_END);
|
||||
#endif
|
||||
}
|
||||
ASSERT (fstat (nap_fd, st) == 0);
|
||||
}
|
||||
|
||||
/* Given a file whose descriptor is FD, see whether delaying by DELAY
|
||||
nanoseconds causes a change in a file's mtime.
|
||||
OLD_ST is the file's status, recently gotten. */
|
||||
static bool
|
||||
nap_works (int delay, struct stat old_st)
|
||||
{
|
||||
struct stat st;
|
||||
struct timespec delay_spec;
|
||||
delay_spec.tv_sec = delay / 1000000000;
|
||||
delay_spec.tv_nsec = delay % 1000000000;
|
||||
ASSERT (nanosleep (&delay_spec, 0) == 0);
|
||||
nap_get_stat (&st, 1);
|
||||
|
||||
if (diff_timespec (get_stat_mtime (&st), get_stat_mtime (&old_st)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
clear_temp_file (void)
|
||||
{
|
||||
if (0 <= nap_fd)
|
||||
{
|
||||
ASSERT (close (nap_fd) != -1);
|
||||
ASSERT (unlink (TEMPFILE) != -1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Sleep long enough to notice a timestamp difference on the file
|
||||
system in the current directory. Use an adaptive approach, trying
|
||||
to find the smallest delay which works on the current file system
|
||||
to make the timestamp difference appear. Assert a maximum delay of
|
||||
~2 seconds, more precisely sum(2^n) from 0 to 30 = 2^31 - 1 = 2.1s.
|
||||
Assumes that BASE is defined, and requires that the test module
|
||||
depends on nanosleep. */
|
||||
static void
|
||||
nap (void)
|
||||
{
|
||||
struct stat old_st;
|
||||
static int delay = 1;
|
||||
|
||||
if (-1 == nap_fd)
|
||||
{
|
||||
atexit (clear_temp_file);
|
||||
ASSERT ((nap_fd = creat (TEMPFILE, 0600)) != -1);
|
||||
nap_get_stat (&old_st, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT (0 <= nap_fd);
|
||||
nap_get_stat (&old_st, 1);
|
||||
}
|
||||
|
||||
if (1 < delay)
|
||||
delay = delay / 2; /* Try half of the previous delay. */
|
||||
ASSERT (0 < delay);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (nap_works (delay, old_st))
|
||||
return;
|
||||
if (delay <= (2147483647 - 1) / 2)
|
||||
{
|
||||
delay = delay * 2 + 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* Bummer: even the highest nap delay didn't work. */
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
#endif /* GLTEST_NAP_H */
|
||||
@@ -0,0 +1,47 @@
|
||||
/* Substitute for <netinet/in.h>.
|
||||
Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_NETINET_IN_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#if @HAVE_NETINET_IN_H@
|
||||
|
||||
/* On many platforms, <netinet/in.h> assumes prior inclusion of
|
||||
<sys/types.h>. */
|
||||
# include <sys/types.h>
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_NETINET_IN_H
|
||||
#define _@GUARD_PREFIX@_NETINET_IN_H
|
||||
|
||||
#if !@HAVE_NETINET_IN_H@
|
||||
|
||||
/* A platform that lacks <netinet/in.h>. */
|
||||
|
||||
# include <sys/socket.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
|
||||
#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Print a message describing error code.
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible and Simon Josefsson.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "strerror-override.h"
|
||||
|
||||
/* Use the system functions, not the gnulib overrides in this file. */
|
||||
#undef fprintf
|
||||
|
||||
void
|
||||
perror (const char *string)
|
||||
{
|
||||
char stackbuf[STACKBUF_LEN];
|
||||
int ret;
|
||||
|
||||
/* Our implementation guarantees that this will be a non-empty
|
||||
string, even if it returns EINVAL; and stackbuf should be sized
|
||||
large enough to avoid ERANGE. */
|
||||
ret = strerror_r (errno, stackbuf, sizeof stackbuf);
|
||||
if (ret == ERANGE)
|
||||
abort ();
|
||||
|
||||
if (string != NULL && *string != '\0')
|
||||
fprintf (stderr, "%s: %s\n", string, stackbuf);
|
||||
else
|
||||
fprintf (stderr, "%s\n", stackbuf);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* Create a pipe.
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* Native Windows API. */
|
||||
|
||||
/* Get _pipe(). */
|
||||
# include <io.h>
|
||||
|
||||
/* Get _O_BINARY. */
|
||||
# include <fcntl.h>
|
||||
|
||||
int
|
||||
pipe (int fd[2])
|
||||
{
|
||||
/* Mingw changes fd to {-1,-1} on failure, but this violates
|
||||
http://austingroupbugs.net/view.php?id=467 */
|
||||
int tmp[2];
|
||||
int result = _pipe (tmp, 4096, _O_BINARY);
|
||||
if (!result)
|
||||
{
|
||||
fd[0] = tmp[0];
|
||||
fd[1] = tmp[1];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# error "This platform lacks a pipe function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,194 @@
|
||||
/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2017 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 3 of the License, or 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Include errno.h *after* sys/types.h to work around header problems
|
||||
on AIX 3.2.5. */
|
||||
#include <errno.h>
|
||||
#ifndef __set_errno
|
||||
# define __set_errno(ev) ((errno) = (ev))
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#if _LIBC
|
||||
# if HAVE_GNU_LD
|
||||
# define environ __environ
|
||||
# else
|
||||
extern char **environ;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _LIBC
|
||||
/* This lock protects against simultaneous modifications of 'environ'. */
|
||||
# include <bits/libc-lock.h>
|
||||
__libc_lock_define_initialized (static, envlock)
|
||||
# define LOCK __libc_lock_lock (envlock)
|
||||
# define UNLOCK __libc_lock_unlock (envlock)
|
||||
#else
|
||||
# define LOCK
|
||||
# define UNLOCK
|
||||
#endif
|
||||
|
||||
static int
|
||||
_unsetenv (const char *name)
|
||||
{
|
||||
size_t len;
|
||||
#if !HAVE_DECL__PUTENV
|
||||
char **ep;
|
||||
#endif
|
||||
|
||||
if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strlen (name);
|
||||
|
||||
#if HAVE_DECL__PUTENV
|
||||
{
|
||||
int putenv_result, putenv_errno;
|
||||
char *name_ = malloc (len + 2);
|
||||
memcpy (name_, name, len);
|
||||
name_[len] = '=';
|
||||
name_[len + 1] = 0;
|
||||
putenv_result = _putenv (name_);
|
||||
putenv_errno = errno;
|
||||
free (name_);
|
||||
__set_errno (putenv_errno);
|
||||
return putenv_result;
|
||||
}
|
||||
#else
|
||||
|
||||
LOCK;
|
||||
|
||||
ep = environ;
|
||||
while (*ep != NULL)
|
||||
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
|
||||
{
|
||||
/* Found it. Remove this pointer by moving later ones back. */
|
||||
char **dp = ep;
|
||||
|
||||
do
|
||||
dp[0] = dp[1];
|
||||
while (*dp++);
|
||||
/* Continue the loop in case NAME appears again. */
|
||||
}
|
||||
else
|
||||
++ep;
|
||||
|
||||
UNLOCK;
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Put STRING, which is of the form "NAME=VALUE", in the environment.
|
||||
If STRING contains no '=', then remove STRING from the environment. */
|
||||
int
|
||||
putenv (char *string)
|
||||
{
|
||||
const char *name_end = strchr (string, '=');
|
||||
char **ep;
|
||||
|
||||
if (name_end == NULL)
|
||||
{
|
||||
/* Remove the variable from the environment. */
|
||||
return _unsetenv (string);
|
||||
}
|
||||
|
||||
#if HAVE_DECL__PUTENV
|
||||
/* Rely on _putenv to allocate the new environment. If other
|
||||
parts of the application use _putenv, the !HAVE_DECL__PUTENV code
|
||||
would fight over who owns the environ vector, causing a crash. */
|
||||
if (name_end[1])
|
||||
return _putenv (string);
|
||||
else
|
||||
{
|
||||
/* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
|
||||
to allocate the environ vector and then replace the new
|
||||
entry with "NAME=". */
|
||||
int putenv_result, putenv_errno;
|
||||
char *name_x = malloc (name_end - string + sizeof "= ");
|
||||
if (!name_x)
|
||||
return -1;
|
||||
memcpy (name_x, string, name_end - string + 1);
|
||||
name_x[name_end - string + 1] = ' ';
|
||||
name_x[name_end - string + 2] = 0;
|
||||
putenv_result = _putenv (name_x);
|
||||
putenv_errno = errno;
|
||||
for (ep = environ; *ep; ep++)
|
||||
if (strcmp (*ep, name_x) == 0)
|
||||
{
|
||||
*ep = string;
|
||||
break;
|
||||
}
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
if (putenv_result == 0)
|
||||
{
|
||||
/* _putenv propagated "NAME= " into the subprocess environment;
|
||||
fix that by calling SetEnvironmentVariable directly. */
|
||||
name_x[name_end - string] = 0;
|
||||
putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
|
||||
putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
|
||||
}
|
||||
# endif
|
||||
free (name_x);
|
||||
__set_errno (putenv_errno);
|
||||
return putenv_result;
|
||||
}
|
||||
#else
|
||||
for (ep = environ; *ep; ep++)
|
||||
if (strncmp (*ep, string, name_end - string) == 0
|
||||
&& (*ep)[name_end - string] == '=')
|
||||
break;
|
||||
|
||||
if (*ep)
|
||||
*ep = string;
|
||||
else
|
||||
{
|
||||
static char **last_environ = NULL;
|
||||
size_t size = ep - environ;
|
||||
char **new_environ = malloc ((size + 2) * sizeof *new_environ);
|
||||
if (! new_environ)
|
||||
return -1;
|
||||
new_environ[0] = string;
|
||||
memcpy (new_environ + 1, environ, (size + 1) * sizeof *new_environ);
|
||||
free (last_environ);
|
||||
last_environ = new_environ;
|
||||
environ = new_environ;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/* Determine whether two stat buffers are known to refer to the same file.
|
||||
|
||||
Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef SAME_INODE_H
|
||||
# define SAME_INODE_H 1
|
||||
|
||||
# include <sys/types.h>
|
||||
|
||||
# ifdef __VMS
|
||||
# define SAME_INODE(a, b) \
|
||||
((a).st_ino[0] == (b).st_ino[0] \
|
||||
&& (a).st_ino[1] == (b).st_ino[1] \
|
||||
&& (a).st_ino[2] == (b).st_ino[2] \
|
||||
&& (a).st_dev == (b).st_dev)
|
||||
# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* Native Windows. */
|
||||
# if _GL_WINDOWS_STAT_INODES
|
||||
/* stat() and fstat() set st_dev and st_ino to 0 if information about
|
||||
the inode is not available. */
|
||||
# define SAME_INODE(a, b) \
|
||||
(!((a).st_ino == 0 && (a).st_dev == 0) \
|
||||
&& (a).st_ino == (b).st_ino && (a).st_dev == (b).st_dev)
|
||||
# else
|
||||
/* stat() and fstat() set st_ino to 0 always. */
|
||||
# define SAME_INODE(a, b) 0
|
||||
# endif
|
||||
# else
|
||||
# define SAME_INODE(a, b) \
|
||||
((a).st_ino == (b).st_ino \
|
||||
&& (a).st_dev == (b).st_dev)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,579 @@
|
||||
/* Emulation for select(2)
|
||||
Contributed by Paolo Bonzini.
|
||||
|
||||
Copyright 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of gnulib.
|
||||
|
||||
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, 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
#include <alloca.h>
|
||||
#include <assert.h>
|
||||
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* Native Windows. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <time.h>
|
||||
|
||||
/* Get the overridden 'struct timeval'. */
|
||||
#include <sys/time.h>
|
||||
|
||||
#if GNULIB_MSVC_NOTHROW
|
||||
# include "msvc-nothrow.h"
|
||||
#else
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#undef select
|
||||
|
||||
struct bitset {
|
||||
unsigned char in[FD_SETSIZE / CHAR_BIT];
|
||||
unsigned char out[FD_SETSIZE / CHAR_BIT];
|
||||
};
|
||||
|
||||
/* Declare data structures for ntdll functions. */
|
||||
typedef struct _FILE_PIPE_LOCAL_INFORMATION {
|
||||
ULONG NamedPipeType;
|
||||
ULONG NamedPipeConfiguration;
|
||||
ULONG MaximumInstances;
|
||||
ULONG CurrentInstances;
|
||||
ULONG InboundQuota;
|
||||
ULONG ReadDataAvailable;
|
||||
ULONG OutboundQuota;
|
||||
ULONG WriteQuotaAvailable;
|
||||
ULONG NamedPipeState;
|
||||
ULONG NamedPipeEnd;
|
||||
} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
|
||||
|
||||
typedef struct _IO_STATUS_BLOCK
|
||||
{
|
||||
union {
|
||||
DWORD Status;
|
||||
PVOID Pointer;
|
||||
} u;
|
||||
ULONG_PTR Information;
|
||||
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
||||
|
||||
typedef enum _FILE_INFORMATION_CLASS {
|
||||
FilePipeLocalInformation = 24
|
||||
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
||||
|
||||
typedef DWORD (WINAPI *PNtQueryInformationFile)
|
||||
(HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
|
||||
|
||||
#ifndef PIPE_BUF
|
||||
#define PIPE_BUF 512
|
||||
#endif
|
||||
|
||||
static BOOL IsConsoleHandle (HANDLE h)
|
||||
{
|
||||
DWORD mode;
|
||||
return GetConsoleMode (h, &mode) != 0;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
IsSocketHandle (HANDLE h)
|
||||
{
|
||||
WSANETWORKEVENTS ev;
|
||||
|
||||
if (IsConsoleHandle (h))
|
||||
return FALSE;
|
||||
|
||||
/* Under Wine, it seems that getsockopt returns 0 for pipes too.
|
||||
WSAEnumNetworkEvents instead distinguishes the two correctly. */
|
||||
ev.lNetworkEvents = 0xDEADBEEF;
|
||||
WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
|
||||
return ev.lNetworkEvents != 0xDEADBEEF;
|
||||
}
|
||||
|
||||
/* Compute output fd_sets for libc descriptor FD (whose Windows handle is
|
||||
H). */
|
||||
|
||||
static int
|
||||
windows_poll_handle (HANDLE h, int fd,
|
||||
struct bitset *rbits,
|
||||
struct bitset *wbits,
|
||||
struct bitset *xbits)
|
||||
{
|
||||
BOOL read, write, except;
|
||||
int i, ret;
|
||||
INPUT_RECORD *irbuffer;
|
||||
DWORD avail, nbuffer;
|
||||
BOOL bRet;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
FILE_PIPE_LOCAL_INFORMATION fpli;
|
||||
static PNtQueryInformationFile NtQueryInformationFile;
|
||||
static BOOL once_only;
|
||||
|
||||
read = write = except = FALSE;
|
||||
switch (GetFileType (h))
|
||||
{
|
||||
case FILE_TYPE_DISK:
|
||||
read = TRUE;
|
||||
write = TRUE;
|
||||
break;
|
||||
|
||||
case FILE_TYPE_PIPE:
|
||||
if (!once_only)
|
||||
{
|
||||
NtQueryInformationFile = (PNtQueryInformationFile)
|
||||
GetProcAddress (GetModuleHandle ("ntdll.dll"),
|
||||
"NtQueryInformationFile");
|
||||
once_only = TRUE;
|
||||
}
|
||||
|
||||
if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
|
||||
{
|
||||
if (avail)
|
||||
read = TRUE;
|
||||
}
|
||||
else if (GetLastError () == ERROR_BROKEN_PIPE)
|
||||
;
|
||||
|
||||
else
|
||||
{
|
||||
/* It was the write-end of the pipe. Check if it is writable.
|
||||
If NtQueryInformationFile fails, optimistically assume the pipe is
|
||||
writable. This could happen on Windows 9x, where
|
||||
NtQueryInformationFile is not available, or if we inherit a pipe
|
||||
that doesn't permit FILE_READ_ATTRIBUTES access on the write end
|
||||
(I think this should not happen since Windows XP SP2; WINE seems
|
||||
fine too). Otherwise, ensure that enough space is available for
|
||||
atomic writes. */
|
||||
memset (&iosb, 0, sizeof (iosb));
|
||||
memset (&fpli, 0, sizeof (fpli));
|
||||
|
||||
if (!NtQueryInformationFile
|
||||
|| NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
|
||||
FilePipeLocalInformation)
|
||||
|| fpli.WriteQuotaAvailable >= PIPE_BUF
|
||||
|| (fpli.OutboundQuota < PIPE_BUF &&
|
||||
fpli.WriteQuotaAvailable == fpli.OutboundQuota))
|
||||
write = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case FILE_TYPE_CHAR:
|
||||
write = TRUE;
|
||||
if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
|
||||
break;
|
||||
|
||||
ret = WaitForSingleObject (h, 0);
|
||||
if (ret == WAIT_OBJECT_0)
|
||||
{
|
||||
if (!IsConsoleHandle (h))
|
||||
{
|
||||
read = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
nbuffer = avail = 0;
|
||||
bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
|
||||
|
||||
/* Screen buffers handles are filtered earlier. */
|
||||
assert (bRet);
|
||||
if (nbuffer == 0)
|
||||
{
|
||||
except = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
|
||||
bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
|
||||
if (!bRet || avail == 0)
|
||||
{
|
||||
except = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < avail; i++)
|
||||
if (irbuffer[i].EventType == KEY_EVENT)
|
||||
read = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = WaitForSingleObject (h, 0);
|
||||
write = TRUE;
|
||||
if (ret == WAIT_OBJECT_0)
|
||||
read = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
if (read && (rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
|
||||
{
|
||||
rbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
|
||||
ret++;
|
||||
}
|
||||
|
||||
if (write && (wbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
|
||||
{
|
||||
wbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
|
||||
ret++;
|
||||
}
|
||||
|
||||
if (except && (xbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
|
||||
{
|
||||
xbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
|
||||
ret++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
|
||||
struct timeval *timeout)
|
||||
#undef timeval
|
||||
{
|
||||
static struct timeval tv0;
|
||||
static HANDLE hEvent;
|
||||
HANDLE h, handle_array[FD_SETSIZE + 2];
|
||||
fd_set handle_rfds, handle_wfds, handle_xfds;
|
||||
struct bitset rbits, wbits, xbits;
|
||||
unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT];
|
||||
DWORD ret, wait_timeout, nhandles, nsock, nbuffer;
|
||||
MSG msg;
|
||||
int i, fd, rc;
|
||||
clock_t tend;
|
||||
|
||||
if (nfds > FD_SETSIZE)
|
||||
nfds = FD_SETSIZE;
|
||||
|
||||
if (!timeout)
|
||||
wait_timeout = INFINITE;
|
||||
else
|
||||
{
|
||||
wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
|
||||
|
||||
/* select is also used as a portable usleep. */
|
||||
if (!rfds && !wfds && !xfds)
|
||||
{
|
||||
Sleep (wait_timeout);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hEvent)
|
||||
hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
|
||||
|
||||
handle_array[0] = hEvent;
|
||||
nhandles = 1;
|
||||
nsock = 0;
|
||||
|
||||
/* Copy descriptors to bitsets. At the same time, eliminate
|
||||
bits in the "wrong" direction for console input buffers
|
||||
and screen buffers, because screen buffers are waitable
|
||||
and they will block until a character is available. */
|
||||
memset (&rbits, 0, sizeof (rbits));
|
||||
memset (&wbits, 0, sizeof (wbits));
|
||||
memset (&xbits, 0, sizeof (xbits));
|
||||
memset (anyfds_in, 0, sizeof (anyfds_in));
|
||||
if (rfds)
|
||||
for (i = 0; i < rfds->fd_count; i++)
|
||||
{
|
||||
fd = rfds->fd_array[i];
|
||||
h = (HANDLE) _get_osfhandle (fd);
|
||||
if (IsConsoleHandle (h)
|
||||
&& !GetNumberOfConsoleInputEvents (h, &nbuffer))
|
||||
continue;
|
||||
|
||||
rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
|
||||
anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
|
||||
}
|
||||
else
|
||||
rfds = (fd_set *) alloca (sizeof (fd_set));
|
||||
|
||||
if (wfds)
|
||||
for (i = 0; i < wfds->fd_count; i++)
|
||||
{
|
||||
fd = wfds->fd_array[i];
|
||||
h = (HANDLE) _get_osfhandle (fd);
|
||||
if (IsConsoleHandle (h)
|
||||
&& GetNumberOfConsoleInputEvents (h, &nbuffer))
|
||||
continue;
|
||||
|
||||
wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
|
||||
anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
|
||||
}
|
||||
else
|
||||
wfds = (fd_set *) alloca (sizeof (fd_set));
|
||||
|
||||
if (xfds)
|
||||
for (i = 0; i < xfds->fd_count; i++)
|
||||
{
|
||||
fd = xfds->fd_array[i];
|
||||
xbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
|
||||
anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
|
||||
}
|
||||
else
|
||||
xfds = (fd_set *) alloca (sizeof (fd_set));
|
||||
|
||||
/* Zero all the fd_sets, including the application's. */
|
||||
FD_ZERO (rfds);
|
||||
FD_ZERO (wfds);
|
||||
FD_ZERO (xfds);
|
||||
FD_ZERO (&handle_rfds);
|
||||
FD_ZERO (&handle_wfds);
|
||||
FD_ZERO (&handle_xfds);
|
||||
|
||||
/* Classify handles. Create fd sets for sockets, poll the others. */
|
||||
for (i = 0; i < nfds; i++)
|
||||
{
|
||||
if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
|
||||
continue;
|
||||
|
||||
h = (HANDLE) _get_osfhandle (i);
|
||||
if (!h)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsSocketHandle (h))
|
||||
{
|
||||
int requested = FD_CLOSE;
|
||||
|
||||
/* See above; socket handles are mapped onto select, but we
|
||||
need to map descriptors to handles. */
|
||||
if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
|
||||
{
|
||||
requested |= FD_READ | FD_ACCEPT;
|
||||
FD_SET ((SOCKET) h, rfds);
|
||||
FD_SET ((SOCKET) h, &handle_rfds);
|
||||
}
|
||||
if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
|
||||
{
|
||||
requested |= FD_WRITE | FD_CONNECT;
|
||||
FD_SET ((SOCKET) h, wfds);
|
||||
FD_SET ((SOCKET) h, &handle_wfds);
|
||||
}
|
||||
if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
|
||||
{
|
||||
requested |= FD_OOB;
|
||||
FD_SET ((SOCKET) h, xfds);
|
||||
FD_SET ((SOCKET) h, &handle_xfds);
|
||||
}
|
||||
|
||||
WSAEventSelect ((SOCKET) h, hEvent, requested);
|
||||
nsock++;
|
||||
}
|
||||
else
|
||||
{
|
||||
handle_array[nhandles++] = h;
|
||||
|
||||
/* Poll now. If we get an event, do not wait below. */
|
||||
if (wait_timeout != 0
|
||||
&& windows_poll_handle (h, i, &rbits, &wbits, &xbits))
|
||||
wait_timeout = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Place a sentinel at the end of the array. */
|
||||
handle_array[nhandles] = NULL;
|
||||
|
||||
/* When will the waiting period expire? */
|
||||
if (wait_timeout != INFINITE)
|
||||
tend = clock () + wait_timeout;
|
||||
|
||||
restart:
|
||||
if (wait_timeout == 0 || nsock == 0)
|
||||
rc = 0;
|
||||
else
|
||||
{
|
||||
/* See if we need to wait in the loop below. If any select is ready,
|
||||
do MsgWaitForMultipleObjects anyway to dispatch messages, but
|
||||
no need to call select again. */
|
||||
rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
|
||||
if (rc == 0)
|
||||
{
|
||||
/* Restore the fd_sets for the other select we do below. */
|
||||
memcpy (&handle_rfds, rfds, sizeof (fd_set));
|
||||
memcpy (&handle_wfds, wfds, sizeof (fd_set));
|
||||
memcpy (&handle_xfds, xfds, sizeof (fd_set));
|
||||
}
|
||||
else
|
||||
wait_timeout = 0;
|
||||
}
|
||||
|
||||
/* How much is left to wait? */
|
||||
if (wait_timeout != INFINITE)
|
||||
{
|
||||
clock_t tnow = clock ();
|
||||
if (tend >= tnow)
|
||||
wait_timeout = tend - tnow;
|
||||
else
|
||||
wait_timeout = 0;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
|
||||
wait_timeout, QS_ALLINPUT);
|
||||
|
||||
if (ret == WAIT_OBJECT_0 + nhandles)
|
||||
{
|
||||
/* new input of some other kind */
|
||||
BOOL bRet;
|
||||
while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
|
||||
{
|
||||
TranslateMessage (&msg);
|
||||
DispatchMessage (&msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we haven't done it yet, check the status of the sockets. */
|
||||
if (rc == 0 && nsock > 0)
|
||||
rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
|
||||
|
||||
if (nhandles > 1)
|
||||
{
|
||||
/* Count results that are not counted in the return value of select. */
|
||||
nhandles = 1;
|
||||
for (i = 0; i < nfds; i++)
|
||||
{
|
||||
if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
|
||||
continue;
|
||||
|
||||
h = (HANDLE) _get_osfhandle (i);
|
||||
if (h == handle_array[nhandles])
|
||||
{
|
||||
/* Not a socket. */
|
||||
nhandles++;
|
||||
windows_poll_handle (h, i, &rbits, &wbits, &xbits);
|
||||
if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
|
||||
|| wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
|
||||
|| xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
|
||||
rc++;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == 0
|
||||
&& (wait_timeout == INFINITE
|
||||
/* If NHANDLES > 1, but no bits are set, it means we've
|
||||
been told incorrectly that some handle was signaled.
|
||||
This happens with anonymous pipes, which always cause
|
||||
MsgWaitForMultipleObjects to exit immediately, but no
|
||||
data is found ready to be read by windows_poll_handle.
|
||||
To avoid a total failure (whereby we return zero and
|
||||
don't wait at all), let's poll in a more busy loop. */
|
||||
|| (wait_timeout != 0 && nhandles > 1)))
|
||||
{
|
||||
/* Sleep 1 millisecond to avoid busy wait and retry with the
|
||||
original fd_sets. */
|
||||
memcpy (&handle_rfds, rfds, sizeof (fd_set));
|
||||
memcpy (&handle_wfds, wfds, sizeof (fd_set));
|
||||
memcpy (&handle_xfds, xfds, sizeof (fd_set));
|
||||
SleepEx (1, TRUE);
|
||||
goto restart;
|
||||
}
|
||||
if (timeout && wait_timeout == 0 && rc == 0)
|
||||
timeout->tv_sec = timeout->tv_usec = 0;
|
||||
}
|
||||
|
||||
/* Now fill in the results. */
|
||||
FD_ZERO (rfds);
|
||||
FD_ZERO (wfds);
|
||||
FD_ZERO (xfds);
|
||||
nhandles = 1;
|
||||
for (i = 0; i < nfds; i++)
|
||||
{
|
||||
if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
|
||||
continue;
|
||||
|
||||
h = (HANDLE) _get_osfhandle (i);
|
||||
if (h != handle_array[nhandles])
|
||||
{
|
||||
/* Perform handle->descriptor mapping. */
|
||||
WSAEventSelect ((SOCKET) h, NULL, 0);
|
||||
if (FD_ISSET (h, &handle_rfds))
|
||||
FD_SET (i, rfds);
|
||||
if (FD_ISSET (h, &handle_wfds))
|
||||
FD_SET (i, wfds);
|
||||
if (FD_ISSET (h, &handle_xfds))
|
||||
FD_SET (i, xfds);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not a socket. */
|
||||
nhandles++;
|
||||
if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
|
||||
FD_SET (i, rfds);
|
||||
if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
|
||||
FD_SET (i, wfds);
|
||||
if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
|
||||
FD_SET (i, xfds);
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#else /* ! Native Windows. */
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <stddef.h> /* NULL */
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#undef select
|
||||
|
||||
int
|
||||
rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */
|
||||
if (nfds < 0 || nfds > FD_SETSIZE)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < nfds; i++)
|
||||
{
|
||||
if (((rfds && FD_ISSET (i, rfds))
|
||||
|| (wfds && FD_ISSET (i, wfds))
|
||||
|| (xfds && FD_ISSET (i, xfds)))
|
||||
&& dup2 (i, i) != i)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Interix 3.5 has a bug: it does not support nfds == 0. */
|
||||
if (nfds == 0)
|
||||
{
|
||||
nfds = 1;
|
||||
rfds = NULL;
|
||||
wfds = NULL;
|
||||
xfds = NULL;
|
||||
}
|
||||
return select (nfds, rfds, wfds, xfds, timeout);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,946 @@
|
||||
/* Set the current locale. -*- coding: utf-8 -*-
|
||||
Copyright (C) 2009, 2011-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Override setlocale() so that when the default locale is requested
|
||||
(locale = ""), the environment variables LC_ALL, LC_*, and LANG are
|
||||
considered.
|
||||
Also include all the functionality from libintl's setlocale() override. */
|
||||
|
||||
/* Please keep this file in sync with
|
||||
gettext/gettext-runtime/intl/setlocale.c ! */
|
||||
|
||||
/* Specification. */
|
||||
#include <locale.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "localename.h"
|
||||
|
||||
#if 1
|
||||
|
||||
# undef setlocale
|
||||
|
||||
/* Return string representation of locale category CATEGORY. */
|
||||
static const char *
|
||||
category_to_name (int category)
|
||||
{
|
||||
const char *retval;
|
||||
|
||||
switch (category)
|
||||
{
|
||||
case LC_COLLATE:
|
||||
retval = "LC_COLLATE";
|
||||
break;
|
||||
case LC_CTYPE:
|
||||
retval = "LC_CTYPE";
|
||||
break;
|
||||
case LC_MONETARY:
|
||||
retval = "LC_MONETARY";
|
||||
break;
|
||||
case LC_NUMERIC:
|
||||
retval = "LC_NUMERIC";
|
||||
break;
|
||||
case LC_TIME:
|
||||
retval = "LC_TIME";
|
||||
break;
|
||||
case LC_MESSAGES:
|
||||
retval = "LC_MESSAGES";
|
||||
break;
|
||||
default:
|
||||
/* If you have a better idea for a default value let me know. */
|
||||
retval = "LC_XXX";
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
/* The native Windows setlocale() function expects locale names of the form
|
||||
"German" or "German_Germany" or "DEU", but not "de" or "de_DE". We need
|
||||
to convert the names from the form with ISO 639 language code and ISO 3166
|
||||
country code to the form with English names or with three-letter identifier.
|
||||
The three-letter identifiers known by a Windows XP SP2 or SP3 are:
|
||||
AFK Afrikaans_South Africa.1252
|
||||
ARA Arabic_Saudi Arabia.1256
|
||||
ARB Arabic_Lebanon.1256
|
||||
ARE Arabic_Egypt.1256
|
||||
ARG Arabic_Algeria.1256
|
||||
ARH Arabic_Bahrain.1256
|
||||
ARI Arabic_Iraq.1256
|
||||
ARJ Arabic_Jordan.1256
|
||||
ARK Arabic_Kuwait.1256
|
||||
ARL Arabic_Libya.1256
|
||||
ARM Arabic_Morocco.1256
|
||||
ARO Arabic_Oman.1256
|
||||
ARQ Arabic_Qatar.1256
|
||||
ARS Arabic_Syria.1256
|
||||
ART Arabic_Tunisia.1256
|
||||
ARU Arabic_U.A.E..1256
|
||||
ARY Arabic_Yemen.1256
|
||||
AZE Azeri (Latin)_Azerbaijan.1254
|
||||
BEL Belarusian_Belarus.1251
|
||||
BGR Bulgarian_Bulgaria.1251
|
||||
BSB Bosnian_Bosnia and Herzegovina.1250
|
||||
BSC Bosnian (Cyrillic)_Bosnia and Herzegovina.1250 (wrong encoding!)
|
||||
CAT Catalan_Spain.1252
|
||||
CHH Chinese_Hong Kong S.A.R..950
|
||||
CHI Chinese_Singapore.936
|
||||
CHS Chinese_People's Republic of China.936
|
||||
CHT Chinese_Taiwan.950
|
||||
CSY Czech_Czech Republic.1250
|
||||
CYM Welsh_United Kingdom.1252
|
||||
DAN Danish_Denmark.1252
|
||||
DEA German_Austria.1252
|
||||
DEC German_Liechtenstein.1252
|
||||
DEL German_Luxembourg.1252
|
||||
DES German_Switzerland.1252
|
||||
DEU German_Germany.1252
|
||||
ELL Greek_Greece.1253
|
||||
ENA English_Australia.1252
|
||||
ENB English_Caribbean.1252
|
||||
ENC English_Canada.1252
|
||||
ENG English_United Kingdom.1252
|
||||
ENI English_Ireland.1252
|
||||
ENJ English_Jamaica.1252
|
||||
ENL English_Belize.1252
|
||||
ENP English_Republic of the Philippines.1252
|
||||
ENS English_South Africa.1252
|
||||
ENT English_Trinidad and Tobago.1252
|
||||
ENU English_United States.1252
|
||||
ENW English_Zimbabwe.1252
|
||||
ENZ English_New Zealand.1252
|
||||
ESA Spanish_Panama.1252
|
||||
ESB Spanish_Bolivia.1252
|
||||
ESC Spanish_Costa Rica.1252
|
||||
ESD Spanish_Dominican Republic.1252
|
||||
ESE Spanish_El Salvador.1252
|
||||
ESF Spanish_Ecuador.1252
|
||||
ESG Spanish_Guatemala.1252
|
||||
ESH Spanish_Honduras.1252
|
||||
ESI Spanish_Nicaragua.1252
|
||||
ESL Spanish_Chile.1252
|
||||
ESM Spanish_Mexico.1252
|
||||
ESN Spanish_Spain.1252
|
||||
ESO Spanish_Colombia.1252
|
||||
ESP Spanish_Spain.1252
|
||||
ESR Spanish_Peru.1252
|
||||
ESS Spanish_Argentina.1252
|
||||
ESU Spanish_Puerto Rico.1252
|
||||
ESV Spanish_Venezuela.1252
|
||||
ESY Spanish_Uruguay.1252
|
||||
ESZ Spanish_Paraguay.1252
|
||||
ETI Estonian_Estonia.1257
|
||||
EUQ Basque_Spain.1252
|
||||
FAR Farsi_Iran.1256
|
||||
FIN Finnish_Finland.1252
|
||||
FOS Faroese_Faroe Islands.1252
|
||||
FPO Filipino_Philippines.1252
|
||||
FRA French_France.1252
|
||||
FRB French_Belgium.1252
|
||||
FRC French_Canada.1252
|
||||
FRL French_Luxembourg.1252
|
||||
FRM French_Principality of Monaco.1252
|
||||
FRS French_Switzerland.1252
|
||||
FYN Frisian_Netherlands.1252
|
||||
GLC Galician_Spain.1252
|
||||
HEB Hebrew_Israel.1255
|
||||
HRB Croatian_Bosnia and Herzegovina.1250
|
||||
HRV Croatian_Croatia.1250
|
||||
HUN Hungarian_Hungary.1250
|
||||
IND Indonesian_Indonesia.1252
|
||||
IRE Irish_Ireland.1252
|
||||
ISL Icelandic_Iceland.1252
|
||||
ITA Italian_Italy.1252
|
||||
ITS Italian_Switzerland.1252
|
||||
IUK Inuktitut (Latin)_Canada.1252
|
||||
JPN Japanese_Japan.932
|
||||
KKZ Kazakh_Kazakhstan.1251
|
||||
KOR Korean_Korea.949
|
||||
KYR Kyrgyz_Kyrgyzstan.1251
|
||||
LBX Luxembourgish_Luxembourg.1252
|
||||
LTH Lithuanian_Lithuania.1257
|
||||
LVI Latvian_Latvia.1257
|
||||
MKI FYRO Macedonian_Former Yugoslav Republic of Macedonia.1251
|
||||
MON Mongolian_Mongolia.1251
|
||||
MPD Mapudungun_Chile.1252
|
||||
MSB Malay_Brunei Darussalam.1252
|
||||
MSL Malay_Malaysia.1252
|
||||
MWK Mohawk_Canada.1252
|
||||
NLB Dutch_Belgium.1252
|
||||
NLD Dutch_Netherlands.1252
|
||||
NON Norwegian-Nynorsk_Norway.1252
|
||||
NOR Norwegian (Bokmål)_Norway.1252
|
||||
NSO Northern Sotho_South Africa.1252
|
||||
PLK Polish_Poland.1250
|
||||
PTB Portuguese_Brazil.1252
|
||||
PTG Portuguese_Portugal.1252
|
||||
QUB Quechua_Bolivia.1252
|
||||
QUE Quechua_Ecuador.1252
|
||||
QUP Quechua_Peru.1252
|
||||
RMC Romansh_Switzerland.1252
|
||||
ROM Romanian_Romania.1250
|
||||
RUS Russian_Russia.1251
|
||||
SKY Slovak_Slovakia.1250
|
||||
SLV Slovenian_Slovenia.1250
|
||||
SMA Sami (Southern)_Norway.1252
|
||||
SMB Sami (Southern)_Sweden.1252
|
||||
SME Sami (Northern)_Norway.1252
|
||||
SMF Sami (Northern)_Sweden.1252
|
||||
SMG Sami (Northern)_Finland.1252
|
||||
SMJ Sami (Lule)_Norway.1252
|
||||
SMK Sami (Lule)_Sweden.1252
|
||||
SMN Sami (Inari)_Finland.1252
|
||||
SMS Sami (Skolt)_Finland.1252
|
||||
SQI Albanian_Albania.1250
|
||||
SRB Serbian (Cyrillic)_Serbia and Montenegro.1251
|
||||
SRL Serbian (Latin)_Serbia and Montenegro.1250
|
||||
SRN Serbian (Cyrillic)_Bosnia and Herzegovina.1251
|
||||
SRS Serbian (Latin)_Bosnia and Herzegovina.1250
|
||||
SVE Swedish_Sweden.1252
|
||||
SVF Swedish_Finland.1252
|
||||
SWK Swahili_Kenya.1252
|
||||
THA Thai_Thailand.874
|
||||
TRK Turkish_Turkey.1254
|
||||
TSN Tswana_South Africa.1252
|
||||
TTT Tatar_Russia.1251
|
||||
UKR Ukrainian_Ukraine.1251
|
||||
URD Urdu_Islamic Republic of Pakistan.1256
|
||||
USA English_United States.1252
|
||||
UZB Uzbek (Latin)_Uzbekistan.1254
|
||||
VIT Vietnamese_Viet Nam.1258
|
||||
XHO Xhosa_South Africa.1252
|
||||
ZHH Chinese_Hong Kong S.A.R..950
|
||||
ZHI Chinese_Singapore.936
|
||||
ZHM Chinese_Macau S.A.R..950
|
||||
ZUL Zulu_South Africa.1252
|
||||
*/
|
||||
|
||||
/* Table from ISO 639 language code, optionally with country or script suffix,
|
||||
to English name.
|
||||
Keep in sync with the gl_locale_name_from_win32_LANGID function in
|
||||
localename.c! */
|
||||
struct table_entry
|
||||
{
|
||||
const char *code;
|
||||
const char *english;
|
||||
};
|
||||
static const struct table_entry language_table[] =
|
||||
{
|
||||
{ "af", "Afrikaans" },
|
||||
{ "am", "Amharic" },
|
||||
{ "ar", "Arabic" },
|
||||
{ "arn", "Mapudungun" },
|
||||
{ "as", "Assamese" },
|
||||
{ "az@cyrillic", "Azeri (Cyrillic)" },
|
||||
{ "az@latin", "Azeri (Latin)" },
|
||||
{ "ba", "Bashkir" },
|
||||
{ "be", "Belarusian" },
|
||||
{ "ber", "Tamazight" },
|
||||
{ "ber@arabic", "Tamazight (Arabic)" },
|
||||
{ "ber@latin", "Tamazight (Latin)" },
|
||||
{ "bg", "Bulgarian" },
|
||||
{ "bin", "Edo" },
|
||||
{ "bn", "Bengali" },
|
||||
{ "bn_BD", "Bengali (Bangladesh)" },
|
||||
{ "bn_IN", "Bengali (India)" },
|
||||
{ "bnt", "Sutu" },
|
||||
{ "bo", "Tibetan" },
|
||||
{ "br", "Breton" },
|
||||
{ "bs", "BSB" }, /* "Bosnian (Latin)" */
|
||||
{ "bs@cyrillic", "BSC" }, /* Bosnian (Cyrillic) */
|
||||
{ "ca", "Catalan" },
|
||||
{ "chr", "Cherokee" },
|
||||
{ "co", "Corsican" },
|
||||
{ "cpe", "Hawaiian" },
|
||||
{ "cs", "Czech" },
|
||||
{ "cy", "Welsh" },
|
||||
{ "da", "Danish" },
|
||||
{ "de", "German" },
|
||||
{ "dsb", "Lower Sorbian" },
|
||||
{ "dv", "Divehi" },
|
||||
{ "el", "Greek" },
|
||||
{ "en", "English" },
|
||||
{ "es", "Spanish" },
|
||||
{ "et", "Estonian" },
|
||||
{ "eu", "Basque" },
|
||||
{ "fa", "Farsi" },
|
||||
{ "ff", "Fulfulde" },
|
||||
{ "fi", "Finnish" },
|
||||
{ "fo", "Faroese" }, /* "Faeroese" does not work */
|
||||
{ "fr", "French" },
|
||||
{ "fy", "Frisian" },
|
||||
{ "ga", "IRE" }, /* Gaelic (Ireland) */
|
||||
{ "gd", "Gaelic (Scotland)" },
|
||||
{ "gd", "Scottish Gaelic" },
|
||||
{ "gl", "Galician" },
|
||||
{ "gn", "Guarani" },
|
||||
{ "gsw", "Alsatian" },
|
||||
{ "gu", "Gujarati" },
|
||||
{ "ha", "Hausa" },
|
||||
{ "he", "Hebrew" },
|
||||
{ "hi", "Hindi" },
|
||||
{ "hr", "Croatian" },
|
||||
{ "hsb", "Upper Sorbian" },
|
||||
{ "hu", "Hungarian" },
|
||||
{ "hy", "Armenian" },
|
||||
{ "id", "Indonesian" },
|
||||
{ "ig", "Igbo" },
|
||||
{ "ii", "Yi" },
|
||||
{ "is", "Icelandic" },
|
||||
{ "it", "Italian" },
|
||||
{ "iu", "IUK" }, /* Inuktitut */
|
||||
{ "ja", "Japanese" },
|
||||
{ "ka", "Georgian" },
|
||||
{ "kk", "Kazakh" },
|
||||
{ "kl", "Greenlandic" },
|
||||
{ "km", "Cambodian" },
|
||||
{ "km", "Khmer" },
|
||||
{ "kn", "Kannada" },
|
||||
{ "ko", "Korean" },
|
||||
{ "kok", "Konkani" },
|
||||
{ "kr", "Kanuri" },
|
||||
{ "ks", "Kashmiri" },
|
||||
{ "ks_IN", "Kashmiri_India" },
|
||||
{ "ks_PK", "Kashmiri (Arabic)_Pakistan" },
|
||||
{ "ky", "Kyrgyz" },
|
||||
{ "la", "Latin" },
|
||||
{ "lb", "Luxembourgish" },
|
||||
{ "lo", "Lao" },
|
||||
{ "lt", "Lithuanian" },
|
||||
{ "lv", "Latvian" },
|
||||
{ "mi", "Maori" },
|
||||
{ "mk", "FYRO Macedonian" },
|
||||
{ "mk", "Macedonian" },
|
||||
{ "ml", "Malayalam" },
|
||||
{ "mn", "Mongolian" },
|
||||
{ "mni", "Manipuri" },
|
||||
{ "moh", "Mohawk" },
|
||||
{ "mr", "Marathi" },
|
||||
{ "ms", "Malay" },
|
||||
{ "mt", "Maltese" },
|
||||
{ "my", "Burmese" },
|
||||
{ "nb", "NOR" }, /* Norwegian Bokmål */
|
||||
{ "ne", "Nepali" },
|
||||
{ "nic", "Ibibio" },
|
||||
{ "nl", "Dutch" },
|
||||
{ "nn", "NON" }, /* Norwegian Nynorsk */
|
||||
{ "no", "Norwegian" },
|
||||
{ "nso", "Northern Sotho" },
|
||||
{ "nso", "Sepedi" },
|
||||
{ "oc", "Occitan" },
|
||||
{ "om", "Oromo" },
|
||||
{ "or", "Oriya" },
|
||||
{ "pa", "Punjabi" },
|
||||
{ "pap", "Papiamentu" },
|
||||
{ "pl", "Polish" },
|
||||
{ "prs", "Dari" },
|
||||
{ "ps", "Pashto" },
|
||||
{ "pt", "Portuguese" },
|
||||
{ "qu", "Quechua" },
|
||||
{ "qut", "K'iche'" },
|
||||
{ "rm", "Romansh" },
|
||||
{ "ro", "Romanian" },
|
||||
{ "ru", "Russian" },
|
||||
{ "rw", "Kinyarwanda" },
|
||||
{ "sa", "Sanskrit" },
|
||||
{ "sah", "Yakut" },
|
||||
{ "sd", "Sindhi" },
|
||||
{ "se", "Sami (Northern)" },
|
||||
{ "se", "Northern Sami" },
|
||||
{ "si", "Sinhalese" },
|
||||
{ "sk", "Slovak" },
|
||||
{ "sl", "Slovenian" },
|
||||
{ "sma", "Sami (Southern)" },
|
||||
{ "sma", "Southern Sami" },
|
||||
{ "smj", "Sami (Lule)" },
|
||||
{ "smj", "Lule Sami" },
|
||||
{ "smn", "Sami (Inari)" },
|
||||
{ "smn", "Inari Sami" },
|
||||
{ "sms", "Sami (Skolt)" },
|
||||
{ "sms", "Skolt Sami" },
|
||||
{ "so", "Somali" },
|
||||
{ "sq", "Albanian" },
|
||||
{ "sr", "Serbian (Latin)" },
|
||||
{ "sr@cyrillic", "SRB" }, /* Serbian (Cyrillic) */
|
||||
{ "sv", "Swedish" },
|
||||
{ "sw", "Swahili" },
|
||||
{ "syr", "Syriac" },
|
||||
{ "ta", "Tamil" },
|
||||
{ "te", "Telugu" },
|
||||
{ "tg", "Tajik" },
|
||||
{ "th", "Thai" },
|
||||
{ "ti", "Tigrinya" },
|
||||
{ "tk", "Turkmen" },
|
||||
{ "tl", "Filipino" },
|
||||
{ "tn", "Tswana" },
|
||||
{ "tr", "Turkish" },
|
||||
{ "ts", "Tsonga" },
|
||||
{ "tt", "Tatar" },
|
||||
{ "ug", "Uighur" },
|
||||
{ "uk", "Ukrainian" },
|
||||
{ "ur", "Urdu" },
|
||||
{ "uz", "Uzbek" },
|
||||
{ "uz", "Uzbek (Latin)" },
|
||||
{ "uz@cyrillic", "Uzbek (Cyrillic)" },
|
||||
{ "ve", "Venda" },
|
||||
{ "vi", "Vietnamese" },
|
||||
{ "wen", "Sorbian" },
|
||||
{ "wo", "Wolof" },
|
||||
{ "xh", "Xhosa" },
|
||||
{ "yi", "Yiddish" },
|
||||
{ "yo", "Yoruba" },
|
||||
{ "zh", "Chinese" },
|
||||
{ "zu", "Zulu" }
|
||||
};
|
||||
|
||||
/* Table from ISO 3166 country code to English name.
|
||||
Keep in sync with the gl_locale_name_from_win32_LANGID function in
|
||||
localename.c! */
|
||||
static const struct table_entry country_table[] =
|
||||
{
|
||||
{ "AE", "U.A.E." },
|
||||
{ "AF", "Afghanistan" },
|
||||
{ "AL", "Albania" },
|
||||
{ "AM", "Armenia" },
|
||||
{ "AN", "Netherlands Antilles" },
|
||||
{ "AR", "Argentina" },
|
||||
{ "AT", "Austria" },
|
||||
{ "AU", "Australia" },
|
||||
{ "AZ", "Azerbaijan" },
|
||||
{ "BA", "Bosnia and Herzegovina" },
|
||||
{ "BD", "Bangladesh" },
|
||||
{ "BE", "Belgium" },
|
||||
{ "BG", "Bulgaria" },
|
||||
{ "BH", "Bahrain" },
|
||||
{ "BN", "Brunei Darussalam" },
|
||||
{ "BO", "Bolivia" },
|
||||
{ "BR", "Brazil" },
|
||||
{ "BT", "Bhutan" },
|
||||
{ "BY", "Belarus" },
|
||||
{ "BZ", "Belize" },
|
||||
{ "CA", "Canada" },
|
||||
{ "CG", "Congo" },
|
||||
{ "CH", "Switzerland" },
|
||||
{ "CI", "Cote d'Ivoire" },
|
||||
{ "CL", "Chile" },
|
||||
{ "CM", "Cameroon" },
|
||||
{ "CN", "People's Republic of China" },
|
||||
{ "CO", "Colombia" },
|
||||
{ "CR", "Costa Rica" },
|
||||
{ "CS", "Serbia and Montenegro" },
|
||||
{ "CZ", "Czech Republic" },
|
||||
{ "DE", "Germany" },
|
||||
{ "DK", "Denmark" },
|
||||
{ "DO", "Dominican Republic" },
|
||||
{ "DZ", "Algeria" },
|
||||
{ "EC", "Ecuador" },
|
||||
{ "EE", "Estonia" },
|
||||
{ "EG", "Egypt" },
|
||||
{ "ER", "Eritrea" },
|
||||
{ "ES", "Spain" },
|
||||
{ "ET", "Ethiopia" },
|
||||
{ "FI", "Finland" },
|
||||
{ "FO", "Faroe Islands" },
|
||||
{ "FR", "France" },
|
||||
{ "GB", "United Kingdom" },
|
||||
{ "GD", "Caribbean" },
|
||||
{ "GE", "Georgia" },
|
||||
{ "GL", "Greenland" },
|
||||
{ "GR", "Greece" },
|
||||
{ "GT", "Guatemala" },
|
||||
{ "HK", "Hong Kong" },
|
||||
{ "HK", "Hong Kong S.A.R." },
|
||||
{ "HN", "Honduras" },
|
||||
{ "HR", "Croatia" },
|
||||
{ "HT", "Haiti" },
|
||||
{ "HU", "Hungary" },
|
||||
{ "ID", "Indonesia" },
|
||||
{ "IE", "Ireland" },
|
||||
{ "IL", "Israel" },
|
||||
{ "IN", "India" },
|
||||
{ "IQ", "Iraq" },
|
||||
{ "IR", "Iran" },
|
||||
{ "IS", "Iceland" },
|
||||
{ "IT", "Italy" },
|
||||
{ "JM", "Jamaica" },
|
||||
{ "JO", "Jordan" },
|
||||
{ "JP", "Japan" },
|
||||
{ "KE", "Kenya" },
|
||||
{ "KG", "Kyrgyzstan" },
|
||||
{ "KH", "Cambodia" },
|
||||
{ "KR", "South Korea" },
|
||||
{ "KW", "Kuwait" },
|
||||
{ "KZ", "Kazakhstan" },
|
||||
{ "LA", "Laos" },
|
||||
{ "LB", "Lebanon" },
|
||||
{ "LI", "Liechtenstein" },
|
||||
{ "LK", "Sri Lanka" },
|
||||
{ "LT", "Lithuania" },
|
||||
{ "LU", "Luxembourg" },
|
||||
{ "LV", "Latvia" },
|
||||
{ "LY", "Libya" },
|
||||
{ "MA", "Morocco" },
|
||||
{ "MC", "Principality of Monaco" },
|
||||
{ "MD", "Moldava" },
|
||||
{ "MD", "Moldova" },
|
||||
{ "ME", "Montenegro" },
|
||||
{ "MK", "Former Yugoslav Republic of Macedonia" },
|
||||
{ "ML", "Mali" },
|
||||
{ "MM", "Myanmar" },
|
||||
{ "MN", "Mongolia" },
|
||||
{ "MO", "Macau S.A.R." },
|
||||
{ "MT", "Malta" },
|
||||
{ "MV", "Maldives" },
|
||||
{ "MX", "Mexico" },
|
||||
{ "MY", "Malaysia" },
|
||||
{ "NG", "Nigeria" },
|
||||
{ "NI", "Nicaragua" },
|
||||
{ "NL", "Netherlands" },
|
||||
{ "NO", "Norway" },
|
||||
{ "NP", "Nepal" },
|
||||
{ "NZ", "New Zealand" },
|
||||
{ "OM", "Oman" },
|
||||
{ "PA", "Panama" },
|
||||
{ "PE", "Peru" },
|
||||
{ "PH", "Philippines" },
|
||||
{ "PK", "Islamic Republic of Pakistan" },
|
||||
{ "PL", "Poland" },
|
||||
{ "PR", "Puerto Rico" },
|
||||
{ "PT", "Portugal" },
|
||||
{ "PY", "Paraguay" },
|
||||
{ "QA", "Qatar" },
|
||||
{ "RE", "Reunion" },
|
||||
{ "RO", "Romania" },
|
||||
{ "RS", "Serbia" },
|
||||
{ "RU", "Russia" },
|
||||
{ "RW", "Rwanda" },
|
||||
{ "SA", "Saudi Arabia" },
|
||||
{ "SE", "Sweden" },
|
||||
{ "SG", "Singapore" },
|
||||
{ "SI", "Slovenia" },
|
||||
{ "SK", "Slovak" },
|
||||
{ "SN", "Senegal" },
|
||||
{ "SO", "Somalia" },
|
||||
{ "SR", "Suriname" },
|
||||
{ "SV", "El Salvador" },
|
||||
{ "SY", "Syria" },
|
||||
{ "TH", "Thailand" },
|
||||
{ "TJ", "Tajikistan" },
|
||||
{ "TM", "Turkmenistan" },
|
||||
{ "TN", "Tunisia" },
|
||||
{ "TR", "Turkey" },
|
||||
{ "TT", "Trinidad and Tobago" },
|
||||
{ "TW", "Taiwan" },
|
||||
{ "TZ", "Tanzania" },
|
||||
{ "UA", "Ukraine" },
|
||||
{ "US", "United States" },
|
||||
{ "UY", "Uruguay" },
|
||||
{ "VA", "Vatican" },
|
||||
{ "VE", "Venezuela" },
|
||||
{ "VN", "Viet Nam" },
|
||||
{ "YE", "Yemen" },
|
||||
{ "ZA", "South Africa" },
|
||||
{ "ZW", "Zimbabwe" }
|
||||
};
|
||||
|
||||
/* Given a string STRING, find the set of indices i such that TABLE[i].code is
|
||||
the given STRING. It is a range [lo,hi-1]. */
|
||||
typedef struct { size_t lo; size_t hi; } range_t;
|
||||
static void
|
||||
search (const struct table_entry *table, size_t table_size, const char *string,
|
||||
range_t *result)
|
||||
{
|
||||
/* The table is sorted. Perform a binary search. */
|
||||
size_t hi = table_size;
|
||||
size_t lo = 0;
|
||||
while (lo < hi)
|
||||
{
|
||||
/* Invariant:
|
||||
for i < lo, strcmp (table[i].code, string) < 0,
|
||||
for i >= hi, strcmp (table[i].code, string) > 0. */
|
||||
size_t mid = (hi + lo) >> 1; /* >= lo, < hi */
|
||||
int cmp = strcmp (table[mid].code, string);
|
||||
if (cmp < 0)
|
||||
lo = mid + 1;
|
||||
else if (cmp > 0)
|
||||
hi = mid;
|
||||
else
|
||||
{
|
||||
/* Found an i with
|
||||
strcmp (language_table[i].code, string) == 0.
|
||||
Find the entire interval of such i. */
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = mid; i > lo; )
|
||||
{
|
||||
i--;
|
||||
if (strcmp (table[i].code, string) < 0)
|
||||
{
|
||||
lo = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = mid; i < hi; i++)
|
||||
{
|
||||
if (strcmp (table[i].code, string) > 0)
|
||||
{
|
||||
hi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* The set of i with
|
||||
strcmp (language_table[i].code, string) == 0
|
||||
is the interval [lo, hi-1]. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
result->lo = lo;
|
||||
result->hi = hi;
|
||||
}
|
||||
|
||||
/* Like setlocale, but accept also locale names in the form ll or ll_CC,
|
||||
where ll is an ISO 639 language code and CC is an ISO 3166 country code. */
|
||||
static char *
|
||||
setlocale_unixlike (int category, const char *locale)
|
||||
{
|
||||
char *result;
|
||||
char llCC_buf[64];
|
||||
char ll_buf[64];
|
||||
char CC_buf[64];
|
||||
|
||||
/* The native Windows implementation of setlocale understands the special
|
||||
locale name "C", but not "POSIX". Therefore map "POSIX" to "C". */
|
||||
#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
|
||||
if (locale != NULL && strcmp (locale, "POSIX") == 0)
|
||||
locale = "C";
|
||||
#endif
|
||||
|
||||
/* First, try setlocale with the original argument unchanged. */
|
||||
result = setlocale (category, locale);
|
||||
if (result != NULL)
|
||||
return result;
|
||||
|
||||
/* Otherwise, assume the argument is in the form
|
||||
language[_territory][.codeset][@modifier]
|
||||
and try to map it using the tables. */
|
||||
if (strlen (locale) < sizeof (llCC_buf))
|
||||
{
|
||||
/* Second try: Remove the codeset part. */
|
||||
{
|
||||
const char *p = locale;
|
||||
char *q = llCC_buf;
|
||||
|
||||
/* Copy the part before the dot. */
|
||||
for (; *p != '\0' && *p != '.'; p++, q++)
|
||||
*q = *p;
|
||||
if (*p == '.')
|
||||
/* Skip the part up to the '@', if any. */
|
||||
for (; *p != '\0' && *p != '@'; p++)
|
||||
;
|
||||
/* Copy the part starting with '@', if any. */
|
||||
for (; *p != '\0'; p++, q++)
|
||||
*q = *p;
|
||||
*q = '\0';
|
||||
}
|
||||
/* llCC_buf now contains
|
||||
language[_territory][@modifier]
|
||||
*/
|
||||
if (strcmp (llCC_buf, locale) != 0)
|
||||
{
|
||||
result = setlocale (category, llCC_buf);
|
||||
if (result != NULL)
|
||||
return result;
|
||||
}
|
||||
/* Look it up in language_table. */
|
||||
{
|
||||
range_t range;
|
||||
size_t i;
|
||||
|
||||
search (language_table,
|
||||
sizeof (language_table) / sizeof (language_table[0]),
|
||||
llCC_buf,
|
||||
&range);
|
||||
|
||||
for (i = range.lo; i < range.hi; i++)
|
||||
{
|
||||
/* Try the replacement in language_table[i]. */
|
||||
result = setlocale (category, language_table[i].english);
|
||||
if (result != NULL)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/* Split language[_territory][@modifier]
|
||||
into ll_buf = language[@modifier]
|
||||
and CC_buf = territory
|
||||
*/
|
||||
{
|
||||
const char *underscore = strchr (llCC_buf, '_');
|
||||
if (underscore != NULL)
|
||||
{
|
||||
const char *territory_start = underscore + 1;
|
||||
const char *territory_end = strchr (territory_start, '@');
|
||||
if (territory_end == NULL)
|
||||
territory_end = territory_start + strlen (territory_start);
|
||||
|
||||
memcpy (ll_buf, llCC_buf, underscore - llCC_buf);
|
||||
strcpy (ll_buf + (underscore - llCC_buf), territory_end);
|
||||
|
||||
memcpy (CC_buf, territory_start, territory_end - territory_start);
|
||||
CC_buf[territory_end - territory_start] = '\0';
|
||||
|
||||
{
|
||||
/* Look up ll_buf in language_table
|
||||
and CC_buf in country_table. */
|
||||
range_t language_range;
|
||||
|
||||
search (language_table,
|
||||
sizeof (language_table) / sizeof (language_table[0]),
|
||||
ll_buf,
|
||||
&language_range);
|
||||
if (language_range.lo < language_range.hi)
|
||||
{
|
||||
range_t country_range;
|
||||
|
||||
search (country_table,
|
||||
sizeof (country_table) / sizeof (country_table[0]),
|
||||
CC_buf,
|
||||
&country_range);
|
||||
if (country_range.lo < country_range.hi)
|
||||
{
|
||||
size_t i;
|
||||
size_t j;
|
||||
|
||||
for (i = language_range.lo; i < language_range.hi; i++)
|
||||
for (j = country_range.lo; j < country_range.hi; j++)
|
||||
{
|
||||
/* Concatenate the replacements. */
|
||||
const char *part1 = language_table[i].english;
|
||||
size_t part1_len = strlen (part1);
|
||||
const char *part2 = country_table[j].english;
|
||||
size_t part2_len = strlen (part2) + 1;
|
||||
char buf[64+64];
|
||||
|
||||
if (!(part1_len + 1 + part2_len <= sizeof (buf)))
|
||||
abort ();
|
||||
memcpy (buf, part1, part1_len);
|
||||
buf[part1_len] = '_';
|
||||
memcpy (buf + part1_len + 1, part2, part2_len);
|
||||
|
||||
/* Try the concatenated replacements. */
|
||||
result = setlocale (category, buf);
|
||||
if (result != NULL)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/* Try omitting the country entirely. This may set a locale
|
||||
corresponding to the wrong country, but is better than
|
||||
failing entirely. */
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = language_range.lo; i < language_range.hi; i++)
|
||||
{
|
||||
/* Try only the language replacement. */
|
||||
result =
|
||||
setlocale (category, language_table[i].english);
|
||||
if (result != NULL)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Failed. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
# else
|
||||
# define setlocale_unixlike setlocale
|
||||
# endif
|
||||
|
||||
# if LC_MESSAGES == 1729
|
||||
|
||||
/* The system does not store an LC_MESSAGES locale category. Do it here. */
|
||||
static char lc_messages_name[64] = "C";
|
||||
|
||||
/* Like setlocale, but support also LC_MESSAGES. */
|
||||
static char *
|
||||
setlocale_single (int category, const char *locale)
|
||||
{
|
||||
if (category == LC_MESSAGES)
|
||||
{
|
||||
if (locale != NULL)
|
||||
{
|
||||
lc_messages_name[sizeof (lc_messages_name) - 1] = '\0';
|
||||
strncpy (lc_messages_name, locale, sizeof (lc_messages_name) - 1);
|
||||
}
|
||||
return lc_messages_name;
|
||||
}
|
||||
else
|
||||
return setlocale_unixlike (category, locale);
|
||||
}
|
||||
|
||||
# else
|
||||
# define setlocale_single setlocale_unixlike
|
||||
# endif
|
||||
|
||||
char *
|
||||
rpl_setlocale (int category, const char *locale)
|
||||
{
|
||||
if (locale != NULL && locale[0] == '\0')
|
||||
{
|
||||
/* A request to the set the current locale to the default locale. */
|
||||
if (category == LC_ALL)
|
||||
{
|
||||
/* Set LC_CTYPE first. Then the other categories. */
|
||||
static int const categories[] =
|
||||
{
|
||||
LC_NUMERIC,
|
||||
LC_TIME,
|
||||
LC_COLLATE,
|
||||
LC_MONETARY,
|
||||
LC_MESSAGES
|
||||
};
|
||||
char *saved_locale;
|
||||
const char *base_name;
|
||||
unsigned int i;
|
||||
|
||||
/* Back up the old locale, in case one of the steps fails. */
|
||||
saved_locale = setlocale (LC_ALL, NULL);
|
||||
if (saved_locale == NULL)
|
||||
return NULL;
|
||||
saved_locale = strdup (saved_locale);
|
||||
if (saved_locale == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Set LC_CTYPE category. Set all other categories (except possibly
|
||||
LC_MESSAGES) to the same value in the same call; this is likely to
|
||||
save calls. */
|
||||
base_name =
|
||||
gl_locale_name_environ (LC_CTYPE, category_to_name (LC_CTYPE));
|
||||
if (base_name == NULL)
|
||||
base_name = gl_locale_name_default ();
|
||||
|
||||
if (setlocale_unixlike (LC_ALL, base_name) == NULL)
|
||||
goto fail;
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* On native Windows, setlocale(LC_ALL,...) may succeed but set the
|
||||
LC_CTYPE category to an invalid value ("C") when it does not
|
||||
support the specified encoding. Report a failure instead. */
|
||||
if (strchr (base_name, '.') != NULL
|
||||
&& strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
|
||||
goto fail;
|
||||
# endif
|
||||
|
||||
for (i = 0; i < sizeof (categories) / sizeof (categories[0]); i++)
|
||||
{
|
||||
int cat = categories[i];
|
||||
const char *name;
|
||||
|
||||
name = gl_locale_name_environ (cat, category_to_name (cat));
|
||||
if (name == NULL)
|
||||
name = gl_locale_name_default ();
|
||||
|
||||
/* If name is the same as base_name, it has already been set
|
||||
through the setlocale call before the loop. */
|
||||
if (strcmp (name, base_name) != 0
|
||||
# if LC_MESSAGES == 1729
|
||||
|| cat == LC_MESSAGES
|
||||
# endif
|
||||
)
|
||||
if (setlocale_single (cat, name) == NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* All steps were successful. */
|
||||
free (saved_locale);
|
||||
return setlocale (LC_ALL, NULL);
|
||||
|
||||
fail:
|
||||
if (saved_locale[0] != '\0') /* don't risk an endless recursion */
|
||||
setlocale (LC_ALL, saved_locale);
|
||||
free (saved_locale);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *name =
|
||||
gl_locale_name_environ (category, category_to_name (category));
|
||||
if (name == NULL)
|
||||
name = gl_locale_name_default ();
|
||||
|
||||
return setlocale_single (category, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
if (category == LC_ALL && locale != NULL && strchr (locale, '.') != NULL)
|
||||
{
|
||||
char *saved_locale;
|
||||
|
||||
/* Back up the old locale. */
|
||||
saved_locale = setlocale (LC_ALL, NULL);
|
||||
if (saved_locale == NULL)
|
||||
return NULL;
|
||||
saved_locale = strdup (saved_locale);
|
||||
if (saved_locale == NULL)
|
||||
return NULL;
|
||||
|
||||
if (setlocale_unixlike (LC_ALL, locale) == NULL)
|
||||
{
|
||||
free (saved_locale);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* On native Windows, setlocale(LC_ALL,...) may succeed but set the
|
||||
LC_CTYPE category to an invalid value ("C") when it does not
|
||||
support the specified encoding. Report a failure instead. */
|
||||
if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
|
||||
{
|
||||
if (saved_locale[0] != '\0') /* don't risk an endless recursion */
|
||||
setlocale (LC_ALL, saved_locale);
|
||||
free (saved_locale);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* It was really successful. */
|
||||
free (saved_locale);
|
||||
return setlocale (LC_ALL, NULL);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
return setlocale_single (category, locale);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
/* setsockopt.c --- wrappers for Windows setsockopt function
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paolo Bonzini */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
/* Get winsock2.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Get struct timeval. */
|
||||
#include <sys/time.h>
|
||||
|
||||
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
|
||||
#include "w32sock.h"
|
||||
|
||||
#undef setsockopt
|
||||
|
||||
int
|
||||
rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
|
||||
{
|
||||
SOCKET sock = FD_TO_SOCKET (fd);
|
||||
int r;
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (level == SOL_SOCKET
|
||||
&& (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
|
||||
{
|
||||
const struct timeval *tv = optval;
|
||||
int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000;
|
||||
optval = &milliseconds;
|
||||
r = setsockopt (sock, level, optname, optval, sizeof (int));
|
||||
}
|
||||
else
|
||||
{
|
||||
r = setsockopt (sock, level, optname, optval, optlen);
|
||||
}
|
||||
|
||||
if (r < 0)
|
||||
set_winsock_errno ();
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* Macro for checking that a function declaration is compliant.
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef SIGNATURE_CHECK
|
||||
|
||||
/* Check that the function FN takes the specified arguments ARGS with
|
||||
a return type of RET. This header is designed to be included after
|
||||
<config.h> and the one system header that is supposed to contain
|
||||
the function being checked, but prior to any other system headers
|
||||
that are necessary for the unit test. Therefore, this file does
|
||||
not include any system headers, nor reference anything outside of
|
||||
the macro arguments. For an example, if foo.h should provide:
|
||||
|
||||
extern int foo (char, float);
|
||||
|
||||
then the unit test named test-foo.c would start out with:
|
||||
|
||||
#include <config.h>
|
||||
#include <foo.h>
|
||||
#include "signature.h"
|
||||
SIGNATURE_CHECK (foo, int, (char, float));
|
||||
#include <other.h>
|
||||
...
|
||||
*/
|
||||
# define SIGNATURE_CHECK(fn, ret, args) \
|
||||
SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
|
||||
|
||||
/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test.
|
||||
Note that the checks must not occupy the same line. */
|
||||
# define SIGNATURE_CHECK1(fn, ret, args, id) \
|
||||
SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */
|
||||
# define SIGNATURE_CHECK2(fn, ret, args, id) \
|
||||
static ret (* _GL_UNUSED signature_check ## id) args = fn
|
||||
|
||||
#endif /* SIGNATURE_CHECK */
|
||||
@@ -0,0 +1,76 @@
|
||||
/* Pausing execution of the current thread.
|
||||
Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2007.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "verify.h"
|
||||
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
|
||||
# include <windows.h>
|
||||
|
||||
unsigned int
|
||||
sleep (unsigned int seconds)
|
||||
{
|
||||
unsigned int remaining;
|
||||
|
||||
/* Sleep for 1 second many times, because
|
||||
1. Sleep is not interruptible by Ctrl-C,
|
||||
2. we want to avoid arithmetic overflow while multiplying with 1000. */
|
||||
for (remaining = seconds; remaining > 0; remaining--)
|
||||
Sleep (1000);
|
||||
|
||||
return remaining;
|
||||
}
|
||||
|
||||
#elif HAVE_SLEEP
|
||||
|
||||
# undef sleep
|
||||
|
||||
/* Guarantee unlimited sleep and a reasonable return value. Cygwin
|
||||
1.5.x rejects attempts to sleep more than 49.7 days (2**32
|
||||
milliseconds), but uses uninitialized memory which results in a
|
||||
garbage answer. Similarly, Linux 2.6.9 with glibc 2.3.4 has a too
|
||||
small return value when asked to sleep more than 24.85 days. */
|
||||
unsigned int
|
||||
rpl_sleep (unsigned int seconds)
|
||||
{
|
||||
/* This requires int larger than 16 bits. */
|
||||
verify (UINT_MAX / 24 / 24 / 60 / 60);
|
||||
const unsigned int limit = 24 * 24 * 60 * 60;
|
||||
while (limit < seconds)
|
||||
{
|
||||
unsigned int result;
|
||||
seconds -= limit;
|
||||
result = sleep (limit);
|
||||
if (result)
|
||||
return seconds + result;
|
||||
}
|
||||
return sleep (seconds);
|
||||
}
|
||||
|
||||
#else /* !HAVE_SLEEP */
|
||||
|
||||
#error "Please port gnulib sleep.c to your platform, possibly using usleep() or select(), then report this to bug-gnulib."
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
/* Formatted output to strings.
|
||||
Copyright (C) 2004, 2006-2017 Free Software Foundation, Inc.
|
||||
Written by Simon Josefsson and Paul Eggert.
|
||||
|
||||
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, 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vasnprintf.h"
|
||||
|
||||
/* Print formatted output to string STR. Similar to sprintf, but
|
||||
additional length SIZE limit how much is written into STR. Returns
|
||||
string length of formatted string (which may be larger than SIZE).
|
||||
STR may be NULL, in which case nothing will be written. On error,
|
||||
return a negative value. */
|
||||
int
|
||||
snprintf (char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
char *output;
|
||||
size_t len;
|
||||
size_t lenbuf = size;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
output = vasnprintf (str, &lenbuf, format, args);
|
||||
len = lenbuf;
|
||||
va_end (args);
|
||||
|
||||
if (!output)
|
||||
return -1;
|
||||
|
||||
if (output != str)
|
||||
{
|
||||
if (size)
|
||||
{
|
||||
size_t pruned_len = (len < size ? len : size - 1);
|
||||
memcpy (str, output, pruned_len);
|
||||
str[pruned_len] = '\0';
|
||||
}
|
||||
|
||||
free (output);
|
||||
}
|
||||
|
||||
if (INT_MAX < len)
|
||||
{
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* socket.c --- wrappers for Windows socket function
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paolo Bonzini */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
/* Get winsock2.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
|
||||
#include "w32sock.h"
|
||||
|
||||
#include "sockets.h"
|
||||
|
||||
int
|
||||
rpl_socket (int domain, int type, int protocol)
|
||||
{
|
||||
SOCKET fh;
|
||||
|
||||
gl_sockets_startup (SOCKETS_1_1);
|
||||
|
||||
/* We have to use WSASocket() to create non-overlapped IO sockets.
|
||||
Overlapped IO sockets cannot be used with read/write. */
|
||||
fh = WSASocket (domain, type, protocol, NULL, 0, 0);
|
||||
|
||||
if (fh == INVALID_SOCKET)
|
||||
{
|
||||
set_winsock_errno ();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return SOCKET_TO_FD (fh);
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/* sockets.c --- wrappers for Windows socket functions
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Simon Josefsson */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "sockets.h"
|
||||
|
||||
#if WINDOWS_SOCKETS
|
||||
|
||||
/* This includes winsock2.h on MinGW. */
|
||||
# include <sys/socket.h>
|
||||
|
||||
# include "fd-hook.h"
|
||||
# if GNULIB_MSVC_NOTHROW
|
||||
# include "msvc-nothrow.h"
|
||||
# else
|
||||
# include <io.h>
|
||||
# endif
|
||||
|
||||
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
|
||||
# include "w32sock.h"
|
||||
|
||||
static int
|
||||
close_fd_maybe_socket (const struct fd_hook *remaining_list,
|
||||
gl_close_fn primary,
|
||||
int fd)
|
||||
{
|
||||
/* Note about multithread-safety: There is a race condition where, between
|
||||
our calls to closesocket() and the primary close(), some other thread
|
||||
could make system calls that allocate precisely the same HANDLE value
|
||||
as sock; then the primary close() would call CloseHandle() on it. */
|
||||
SOCKET sock;
|
||||
WSANETWORKEVENTS ev;
|
||||
|
||||
/* Test whether fd refers to a socket. */
|
||||
sock = FD_TO_SOCKET (fd);
|
||||
ev.lNetworkEvents = 0xDEADBEEF;
|
||||
WSAEnumNetworkEvents (sock, NULL, &ev);
|
||||
if (ev.lNetworkEvents != 0xDEADBEEF)
|
||||
{
|
||||
/* fd refers to a socket. */
|
||||
/* FIXME: other applications, like squid, use an undocumented
|
||||
_free_osfhnd free function. But this is not enough: The 'osfile'
|
||||
flags for fd also needs to be cleared, but it is hard to access it.
|
||||
Instead, here we just close twice the file descriptor. */
|
||||
if (closesocket (sock))
|
||||
{
|
||||
set_winsock_errno ();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This call frees the file descriptor and does a
|
||||
CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */
|
||||
_close (fd);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Some other type of file descriptor. */
|
||||
return execute_close_hooks (remaining_list, primary, fd);
|
||||
}
|
||||
|
||||
static int
|
||||
ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
|
||||
gl_ioctl_fn primary,
|
||||
int fd, int request, void *arg)
|
||||
{
|
||||
SOCKET sock;
|
||||
WSANETWORKEVENTS ev;
|
||||
|
||||
/* Test whether fd refers to a socket. */
|
||||
sock = FD_TO_SOCKET (fd);
|
||||
ev.lNetworkEvents = 0xDEADBEEF;
|
||||
WSAEnumNetworkEvents (sock, NULL, &ev);
|
||||
if (ev.lNetworkEvents != 0xDEADBEEF)
|
||||
{
|
||||
/* fd refers to a socket. */
|
||||
if (ioctlsocket (sock, request, arg) < 0)
|
||||
{
|
||||
set_winsock_errno ();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
/* Some other type of file descriptor. */
|
||||
return execute_ioctl_hooks (remaining_list, primary, fd, request, arg);
|
||||
}
|
||||
|
||||
static struct fd_hook fd_sockets_hook;
|
||||
|
||||
static int initialized_sockets_version /* = 0 */;
|
||||
|
||||
#endif /* WINDOWS_SOCKETS */
|
||||
|
||||
int
|
||||
gl_sockets_startup (int version _GL_UNUSED)
|
||||
{
|
||||
#if WINDOWS_SOCKETS
|
||||
if (version > initialized_sockets_version)
|
||||
{
|
||||
WSADATA data;
|
||||
int err;
|
||||
|
||||
err = WSAStartup (version, &data);
|
||||
if (err != 0)
|
||||
return 1;
|
||||
|
||||
if (data.wVersion != version)
|
||||
{
|
||||
WSACleanup ();
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (initialized_sockets_version == 0)
|
||||
register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
|
||||
&fd_sockets_hook);
|
||||
|
||||
initialized_sockets_version = version;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
gl_sockets_cleanup (void)
|
||||
{
|
||||
#if WINDOWS_SOCKETS
|
||||
int err;
|
||||
|
||||
initialized_sockets_version = 0;
|
||||
|
||||
unregister_fd_hook (&fd_sockets_hook);
|
||||
|
||||
err = WSACleanup ();
|
||||
if (err != 0)
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/* sockets.h - wrappers for Windows socket functions
|
||||
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Simon Josefsson */
|
||||
|
||||
#ifndef SOCKETS_H
|
||||
#define SOCKETS_H 1
|
||||
|
||||
#define SOCKETS_1_0 0x0001
|
||||
#define SOCKETS_1_1 0x0101
|
||||
#define SOCKETS_2_0 0x0002
|
||||
#define SOCKETS_2_1 0x0102
|
||||
#define SOCKETS_2_2 0x0202
|
||||
|
||||
int gl_sockets_startup (int version)
|
||||
#ifndef WINDOWS_SOCKETS
|
||||
_GL_ATTRIBUTE_CONST
|
||||
#endif
|
||||
;
|
||||
|
||||
int gl_sockets_cleanup (void)
|
||||
#ifndef WINDOWS_SOCKETS
|
||||
_GL_ATTRIBUTE_CONST
|
||||
#endif
|
||||
;
|
||||
|
||||
/* This function is useful it you create a socket using gnulib's
|
||||
Winsock wrappers but needs to pass on the socket handle to some
|
||||
other library that only accepts sockets. */
|
||||
#ifdef WINDOWS_SOCKETS
|
||||
|
||||
# include <sys/socket.h>
|
||||
|
||||
# if GNULIB_MSVC_NOTHROW
|
||||
# include "msvc-nothrow.h"
|
||||
# else
|
||||
# include <io.h>
|
||||
# endif
|
||||
|
||||
static inline SOCKET
|
||||
gl_fd_to_handle (int fd)
|
||||
{
|
||||
return _get_osfhandle (fd);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# define gl_fd_to_handle(x) (x)
|
||||
|
||||
#endif /* WINDOWS_SOCKETS */
|
||||
|
||||
#endif /* SOCKETS_H */
|
||||
@@ -0,0 +1,121 @@
|
||||
/* A substitute for ISO C11 <stdalign.h>.
|
||||
|
||||
Copyright 2011-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert and Bruno Haible. */
|
||||
|
||||
#ifndef _GL_STDALIGN_H
|
||||
#define _GL_STDALIGN_H
|
||||
|
||||
/* ISO C11 <stdalign.h> for platforms that lack it.
|
||||
|
||||
References:
|
||||
ISO C11 (latest free draft
|
||||
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
|
||||
sections 6.5.3.4, 6.7.5, 7.15.
|
||||
C++11 (latest free draft
|
||||
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
|
||||
section 18.10. */
|
||||
|
||||
/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
|
||||
requirement of a structure member (i.e., slot or field) that is of
|
||||
type TYPE, as an integer constant expression.
|
||||
|
||||
This differs from GCC's __alignof__ operator, which can yield a
|
||||
better-performing alignment for an object of that type. For
|
||||
example, on x86 with GCC, __alignof__ (double) and __alignof__
|
||||
(long long) are 8, whereas alignof (double) and alignof (long long)
|
||||
are 4 unless the option '-malign-double' is used.
|
||||
|
||||
The result cannot be used as a value for an 'enum' constant, if you
|
||||
want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
|
||||
|
||||
Include <stddef.h> for offsetof. */
|
||||
#include <stddef.h>
|
||||
|
||||
/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
|
||||
standard headers, defines conflicting implementations of _Alignas
|
||||
and _Alignof that are no better than ours; override them. */
|
||||
#undef _Alignas
|
||||
#undef _Alignof
|
||||
|
||||
/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
|
||||
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */
|
||||
#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
|
||||
|| (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9)))
|
||||
# ifdef __cplusplus
|
||||
# if 201103 <= __cplusplus
|
||||
# define _Alignof(type) alignof (type)
|
||||
# else
|
||||
template <class __t> struct __alignof_helper { char __a; __t __b; };
|
||||
# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
|
||||
# endif
|
||||
# else
|
||||
# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
|
||||
# endif
|
||||
#endif
|
||||
#if ! (defined __cplusplus && 201103 <= __cplusplus)
|
||||
# define alignof _Alignof
|
||||
#endif
|
||||
#define __alignof_is_defined 1
|
||||
|
||||
/* alignas (A), also known as _Alignas (A), aligns a variable or type
|
||||
to the alignment A, where A is an integer constant expression. For
|
||||
example:
|
||||
|
||||
int alignas (8) foo;
|
||||
struct s { int a; int alignas (8) bar; };
|
||||
|
||||
aligns the address of FOO and the offset of BAR to be multiples of 8.
|
||||
|
||||
A should be a power of two that is at least the type's alignment
|
||||
and at most the implementation's alignment limit. This limit is
|
||||
2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable
|
||||
to MSVC through at least version 10.0, A should be an integer
|
||||
constant, as MSVC does not support expressions such as 1 << 3.
|
||||
To be portable to Sun C 5.11, do not align auto variables to
|
||||
anything stricter than their default alignment.
|
||||
|
||||
The following C11 requirements are not supported here:
|
||||
|
||||
- If A is zero, alignas has no effect.
|
||||
- alignas can be used multiple times; the strictest one wins.
|
||||
- alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
|
||||
|
||||
*/
|
||||
|
||||
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
|
||||
# if defined __cplusplus && 201103 <= __cplusplus
|
||||
# define _Alignas(a) alignas (a)
|
||||
# elif ((defined __APPLE__ && defined __MACH__ \
|
||||
? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
|
||||
: __GNUC__) \
|
||||
|| (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
|
||||
|| __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)
|
||||
# define _Alignas(a) __attribute__ ((__aligned__ (a)))
|
||||
# elif 1300 <= _MSC_VER
|
||||
# define _Alignas(a) __declspec (align (a))
|
||||
# endif
|
||||
#endif
|
||||
#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \
|
||||
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
|
||||
# define alignas _Alignas
|
||||
#endif
|
||||
#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus)
|
||||
# define __alignas_is_defined 1
|
||||
#endif
|
||||
|
||||
#endif /* _GL_STDALIGN_H */
|
||||
@@ -0,0 +1,450 @@
|
||||
/* strerror_r.c --- POSIX compatible system error routine
|
||||
|
||||
Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>, 2010. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Enable declaration of sys_nerr and sys_errlist in <errno.h> on NetBSD. */
|
||||
#define _NETBSD_SOURCE 1
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if !HAVE_SNPRINTF
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "strerror-override.h"
|
||||
|
||||
#if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */
|
||||
|
||||
# define USE_XPG_STRERROR_R 1
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
|
||||
|
||||
#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__)
|
||||
|
||||
/* The system's strerror_r function is OK, except that its third argument
|
||||
is 'int', not 'size_t', or its return type is wrong. */
|
||||
|
||||
# include <limits.h>
|
||||
|
||||
# define USE_SYSTEM_STRERROR_R 1
|
||||
|
||||
#else /* (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__ ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) */
|
||||
|
||||
/* Use the system's strerror(). Exclude glibc and cygwin because the
|
||||
system strerror_r has the wrong return type, and cygwin 1.7.9
|
||||
strerror_r clobbers strerror. */
|
||||
# undef strerror
|
||||
|
||||
# define USE_SYSTEM_STRERROR 1
|
||||
|
||||
# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__
|
||||
|
||||
/* No locking needed. */
|
||||
|
||||
/* Get catgets internationalization functions. */
|
||||
# if HAVE_CATGETS
|
||||
# include <nl_types.h>
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Get sys_nerr, sys_errlist on HP-UX (otherwise only declared in C++ mode).
|
||||
Get sys_nerr, sys_errlist on IRIX (otherwise only declared with _SGIAPI). */
|
||||
# if defined __hpux || defined __sgi
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
# endif
|
||||
|
||||
/* Get sys_nerr on Solaris. */
|
||||
# if defined __sun && !defined _LP64
|
||||
extern int sys_nerr;
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# else
|
||||
|
||||
# include "glthread/lock.h"
|
||||
|
||||
/* This lock protects the buffer returned by strerror(). We assume that
|
||||
no other uses of strerror() exist in the program. */
|
||||
gl_lock_define_initialized(static, strerror_lock)
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* On MSVC, there is no snprintf() function, just a _snprintf().
|
||||
It is of lower quality, but sufficient for the simple use here.
|
||||
We only have to make sure to NUL terminate the result (_snprintf
|
||||
does not NUL terminate, like strncpy). */
|
||||
#if !HAVE_SNPRINTF
|
||||
static int
|
||||
local_snprintf (char *buf, size_t buflen, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int result;
|
||||
|
||||
va_start (args, format);
|
||||
result = _vsnprintf (buf, buflen, format, args);
|
||||
va_end (args);
|
||||
if (buflen > 0 && (result < 0 || result >= buflen))
|
||||
buf[buflen - 1] = '\0';
|
||||
return result;
|
||||
}
|
||||
# define snprintf local_snprintf
|
||||
#endif
|
||||
|
||||
/* Copy as much of MSG into BUF as possible, without corrupting errno.
|
||||
Return 0 if MSG fit in BUFLEN, otherwise return ERANGE. */
|
||||
static int
|
||||
safe_copy (char *buf, size_t buflen, const char *msg)
|
||||
{
|
||||
size_t len = strlen (msg);
|
||||
int ret;
|
||||
|
||||
if (len < buflen)
|
||||
{
|
||||
/* Although POSIX allows memcpy() to corrupt errno, we don't
|
||||
know of any implementation where this is a real problem. */
|
||||
memcpy (buf, msg, len + 1);
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (buf, msg, buflen - 1);
|
||||
buf[buflen - 1] = '\0';
|
||||
ret = ERANGE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
strerror_r (int errnum, char *buf, size_t buflen)
|
||||
#undef strerror_r
|
||||
{
|
||||
/* Filter this out now, so that rest of this replacement knows that
|
||||
there is room for a non-empty message and trailing NUL. */
|
||||
if (buflen <= 1)
|
||||
{
|
||||
if (buflen)
|
||||
*buf = '\0';
|
||||
return ERANGE;
|
||||
}
|
||||
*buf = '\0';
|
||||
|
||||
/* Check for gnulib overrides. */
|
||||
{
|
||||
char const *msg = strerror_override (errnum);
|
||||
|
||||
if (msg)
|
||||
return safe_copy (buf, buflen, msg);
|
||||
}
|
||||
|
||||
{
|
||||
int ret;
|
||||
int saved_errno = errno;
|
||||
|
||||
#if USE_XPG_STRERROR_R
|
||||
|
||||
{
|
||||
ret = __xpg_strerror_r (errnum, buf, buflen);
|
||||
if (ret < 0)
|
||||
ret = errno;
|
||||
if (!*buf)
|
||||
{
|
||||
/* glibc 2.13 would not touch buf on err, so we have to fall
|
||||
back to GNU strerror_r which always returns a thread-safe
|
||||
untruncated string to (partially) copy into our buf. */
|
||||
safe_copy (buf, buflen, strerror_r (errnum, buf, buflen));
|
||||
}
|
||||
}
|
||||
|
||||
#elif USE_SYSTEM_STRERROR_R
|
||||
|
||||
if (buflen > INT_MAX)
|
||||
buflen = INT_MAX;
|
||||
|
||||
# ifdef __hpux
|
||||
/* On HP-UX 11.31, strerror_r always fails when buflen < 80; it
|
||||
also fails to change buf on EINVAL. */
|
||||
{
|
||||
char stackbuf[80];
|
||||
|
||||
if (buflen < sizeof stackbuf)
|
||||
{
|
||||
ret = strerror_r (errnum, stackbuf, sizeof stackbuf);
|
||||
if (ret == 0)
|
||||
ret = safe_copy (buf, buflen, stackbuf);
|
||||
}
|
||||
else
|
||||
ret = strerror_r (errnum, buf, buflen);
|
||||
}
|
||||
# else
|
||||
ret = strerror_r (errnum, buf, buflen);
|
||||
|
||||
/* Some old implementations may return (-1, EINVAL) instead of EINVAL. */
|
||||
if (ret < 0)
|
||||
ret = errno;
|
||||
# endif
|
||||
|
||||
# ifdef _AIX
|
||||
/* AIX returns 0 rather than ERANGE when truncating strings; try
|
||||
again until we are sure we got the entire string. */
|
||||
if (!ret && strlen (buf) == buflen - 1)
|
||||
{
|
||||
char stackbuf[STACKBUF_LEN];
|
||||
size_t len;
|
||||
strerror_r (errnum, stackbuf, sizeof stackbuf);
|
||||
len = strlen (stackbuf);
|
||||
/* STACKBUF_LEN should have been large enough. */
|
||||
if (len + 1 == sizeof stackbuf)
|
||||
abort ();
|
||||
if (buflen <= len)
|
||||
ret = ERANGE;
|
||||
}
|
||||
# else
|
||||
/* Solaris 10 does not populate buf on ERANGE. OpenBSD 4.7
|
||||
truncates early on ERANGE rather than return a partial integer.
|
||||
We prefer the maximal string. We set buf[0] earlier, and we
|
||||
know of no implementation that modifies buf to be an
|
||||
unterminated string, so this strlen should be portable in
|
||||
practice (rather than pulling in a safer strnlen). */
|
||||
if (ret == ERANGE && strlen (buf) < buflen - 1)
|
||||
{
|
||||
char stackbuf[STACKBUF_LEN];
|
||||
|
||||
/* STACKBUF_LEN should have been large enough. */
|
||||
if (strerror_r (errnum, stackbuf, sizeof stackbuf) == ERANGE)
|
||||
abort ();
|
||||
safe_copy (buf, buflen, stackbuf);
|
||||
}
|
||||
# endif
|
||||
|
||||
#else /* USE_SYSTEM_STRERROR */
|
||||
|
||||
/* Try to do what strerror (errnum) does, but without clobbering the
|
||||
buffer used by strerror(). */
|
||||
|
||||
# if defined __NetBSD__ || defined __hpux || ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, native Windows, Cygwin */
|
||||
|
||||
/* NetBSD: sys_nerr, sys_errlist are declared through _NETBSD_SOURCE
|
||||
and <errno.h> above.
|
||||
HP-UX: sys_nerr, sys_errlist are declared explicitly above.
|
||||
native Windows: sys_nerr, sys_errlist are declared in <stdlib.h>.
|
||||
Cygwin: sys_nerr, sys_errlist are declared in <errno.h>. */
|
||||
if (errnum >= 0 && errnum < sys_nerr)
|
||||
{
|
||||
# if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)
|
||||
# if defined __NetBSD__
|
||||
nl_catd catd = catopen ("libc", NL_CAT_LOCALE);
|
||||
const char *errmsg =
|
||||
(catd != (nl_catd)-1
|
||||
? catgets (catd, 1, errnum, sys_errlist[errnum])
|
||||
: sys_errlist[errnum]);
|
||||
# endif
|
||||
# if defined __hpux
|
||||
nl_catd catd = catopen ("perror", NL_CAT_LOCALE);
|
||||
const char *errmsg =
|
||||
(catd != (nl_catd)-1
|
||||
? catgets (catd, 1, 1 + errnum, sys_errlist[errnum])
|
||||
: sys_errlist[errnum]);
|
||||
# endif
|
||||
# else
|
||||
const char *errmsg = sys_errlist[errnum];
|
||||
# endif
|
||||
if (errmsg == NULL || *errmsg == '\0')
|
||||
ret = EINVAL;
|
||||
else
|
||||
ret = safe_copy (buf, buflen, errmsg);
|
||||
# if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)
|
||||
if (catd != (nl_catd)-1)
|
||||
catclose (catd);
|
||||
# endif
|
||||
}
|
||||
else
|
||||
ret = EINVAL;
|
||||
|
||||
# elif defined __sgi || (defined __sun && !defined _LP64) /* IRIX, Solaris <= 9 32-bit */
|
||||
|
||||
/* For a valid error number, the system's strerror() function returns
|
||||
a pointer to a not copied string, not to a buffer. */
|
||||
if (errnum >= 0 && errnum < sys_nerr)
|
||||
{
|
||||
char *errmsg = strerror (errnum);
|
||||
|
||||
if (errmsg == NULL || *errmsg == '\0')
|
||||
ret = EINVAL;
|
||||
else
|
||||
ret = safe_copy (buf, buflen, errmsg);
|
||||
}
|
||||
else
|
||||
ret = EINVAL;
|
||||
|
||||
# else
|
||||
|
||||
gl_lock_lock (strerror_lock);
|
||||
|
||||
{
|
||||
char *errmsg = strerror (errnum);
|
||||
|
||||
/* For invalid error numbers, strerror() on
|
||||
- IRIX 6.5 returns NULL,
|
||||
- HP-UX 11 returns an empty string. */
|
||||
if (errmsg == NULL || *errmsg == '\0')
|
||||
ret = EINVAL;
|
||||
else
|
||||
ret = safe_copy (buf, buflen, errmsg);
|
||||
}
|
||||
|
||||
gl_lock_unlock (strerror_lock);
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
|
||||
/* MSVC 14 defines names for many error codes in the range 100..140,
|
||||
but _sys_errlist contains strings only for the error codes
|
||||
< _sys_nerr = 43. */
|
||||
if (ret == EINVAL)
|
||||
{
|
||||
const char *errmsg;
|
||||
|
||||
switch (errnum)
|
||||
{
|
||||
case 100 /* EADDRINUSE */:
|
||||
errmsg = "Address already in use";
|
||||
break;
|
||||
case 101 /* EADDRNOTAVAIL */:
|
||||
errmsg = "Cannot assign requested address";
|
||||
break;
|
||||
case 102 /* EAFNOSUPPORT */:
|
||||
errmsg = "Address family not supported by protocol";
|
||||
break;
|
||||
case 103 /* EALREADY */:
|
||||
errmsg = "Operation already in progress";
|
||||
break;
|
||||
case 105 /* ECANCELED */:
|
||||
errmsg = "Operation canceled";
|
||||
break;
|
||||
case 106 /* ECONNABORTED */:
|
||||
errmsg = "Software caused connection abort";
|
||||
break;
|
||||
case 107 /* ECONNREFUSED */:
|
||||
errmsg = "Connection refused";
|
||||
break;
|
||||
case 108 /* ECONNRESET */:
|
||||
errmsg = "Connection reset by peer";
|
||||
break;
|
||||
case 109 /* EDESTADDRREQ */:
|
||||
errmsg = "Destination address required";
|
||||
break;
|
||||
case 110 /* EHOSTUNREACH */:
|
||||
errmsg = "No route to host";
|
||||
break;
|
||||
case 112 /* EINPROGRESS */:
|
||||
errmsg = "Operation now in progress";
|
||||
break;
|
||||
case 113 /* EISCONN */:
|
||||
errmsg = "Transport endpoint is already connected";
|
||||
break;
|
||||
case 114 /* ELOOP */:
|
||||
errmsg = "Too many levels of symbolic links";
|
||||
break;
|
||||
case 115 /* EMSGSIZE */:
|
||||
errmsg = "Message too long";
|
||||
break;
|
||||
case 116 /* ENETDOWN */:
|
||||
errmsg = "Network is down";
|
||||
break;
|
||||
case 117 /* ENETRESET */:
|
||||
errmsg = "Network dropped connection on reset";
|
||||
break;
|
||||
case 118 /* ENETUNREACH */:
|
||||
errmsg = "Network is unreachable";
|
||||
break;
|
||||
case 119 /* ENOBUFS */:
|
||||
errmsg = "No buffer space available";
|
||||
break;
|
||||
case 123 /* ENOPROTOOPT */:
|
||||
errmsg = "Protocol not available";
|
||||
break;
|
||||
case 126 /* ENOTCONN */:
|
||||
errmsg = "Transport endpoint is not connected";
|
||||
break;
|
||||
case 128 /* ENOTSOCK */:
|
||||
errmsg = "Socket operation on non-socket";
|
||||
break;
|
||||
case 129 /* ENOTSUP */:
|
||||
errmsg = "Not supported";
|
||||
break;
|
||||
case 130 /* EOPNOTSUPP */:
|
||||
errmsg = "Operation not supported";
|
||||
break;
|
||||
case 132 /* EOVERFLOW */:
|
||||
errmsg = "Value too large for defined data type";
|
||||
break;
|
||||
case 133 /* EOWNERDEAD */:
|
||||
errmsg = "Owner died";
|
||||
break;
|
||||
case 134 /* EPROTO */:
|
||||
errmsg = "Protocol error";
|
||||
break;
|
||||
case 135 /* EPROTONOSUPPORT */:
|
||||
errmsg = "Protocol not supported";
|
||||
break;
|
||||
case 136 /* EPROTOTYPE */:
|
||||
errmsg = "Protocol wrong type for socket";
|
||||
break;
|
||||
case 138 /* ETIMEDOUT */:
|
||||
errmsg = "Connection timed out";
|
||||
break;
|
||||
case 140 /* EWOULDBLOCK */:
|
||||
errmsg = "Operation would block";
|
||||
break;
|
||||
default:
|
||||
errmsg = NULL;
|
||||
break;
|
||||
}
|
||||
if (errmsg != NULL)
|
||||
ret = safe_copy (buf, buflen, errmsg);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret == EINVAL && !*buf)
|
||||
snprintf (buf, buflen, "Unknown error %d", errnum);
|
||||
|
||||
errno = saved_errno;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/* Stub for symlink().
|
||||
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
#if HAVE_SYMLINK
|
||||
|
||||
# undef symlink
|
||||
|
||||
/* Create a symlink, but reject trailing slash. */
|
||||
int
|
||||
rpl_symlink (char const *contents, char const *name)
|
||||
{
|
||||
size_t len = strlen (name);
|
||||
if (len && name[len - 1] == '/')
|
||||
{
|
||||
struct stat st;
|
||||
if (lstat (name, &st) == 0)
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
return symlink (contents, name);
|
||||
}
|
||||
|
||||
#else /* !HAVE_SYMLINK */
|
||||
|
||||
/* The system does not support symlinks. */
|
||||
int
|
||||
symlink (char const *contents _GL_UNUSED,
|
||||
char const *name _GL_UNUSED)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* !HAVE_SYMLINK */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user