Imported from ../bash-4.0-rc1.tar.gz.

This commit is contained in:
Jari Aalto
2009-01-12 13:36:28 +00:00
parent f1be666c7d
commit 3185942a52
666 changed files with 188710 additions and 54674 deletions

View File

@@ -1,285 +1,626 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111 USA
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
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
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
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
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 give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
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.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
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.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
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.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
TERMS AND CONDITIONS
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
0. Definitions.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
"This License" refers to version 3 of the GNU General Public License.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
"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.
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
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.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
A "covered work" means either the unmodified Program or a work based
on the Program.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
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.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
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.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
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.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
1. Source Code.
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
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.
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
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.
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The "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 source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
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.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
The Corresponding Source for a work in source code form is that
same work.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
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.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
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.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
13. Use with the GNU Affero General Public License.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
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.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
14. Revised Versions of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
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.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
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.
NO WARRANTY
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.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
15. Disclaimer of Warranty.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
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.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
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
@@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
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) 19yy <name of author>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
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,
@@ -304,36 +645,30 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
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 is interactive, make it output a short notice like this
when it starts in an interactive mode:
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
<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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
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 your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
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/>.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
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>.

View File

@@ -4,21 +4,20 @@
# #
#############################################################################
# Copyright (C) 1994-2005 Free Software Foundation, Inc.
# Copyright (C) 1994-2009 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 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
@@ -33,6 +32,8 @@ VPATH = .:@srcdir@
topdir = @top_srcdir@
BUILD_DIR = @BUILD_DIR@
datarootdir = @datarootdir@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

View File

@@ -6,19 +6,19 @@
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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.
Bash 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.
Bash 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.
Bash 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 Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_STDLIB_H_)
#define _STDLIB_H_ 1

View File

@@ -1,24 +1,23 @@
/* bind.c -- key binding and startup file support for the readline library. */
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
@@ -80,7 +79,7 @@ static int glean_key_from_name PARAMS((char *));
static int find_boolean_var PARAMS((const char *));
static char *_rl_get_string_variable_value PARAMS((const char *));
static int substring_member_of_array PARAMS((char *, const char **));
static int substring_member_of_array PARAMS((const char *, const char * const *));
static int currently_reading_init_file;
@@ -317,7 +316,7 @@ rl_macro_bind (keyseq, macro, map)
if (rl_translate_keyseq (macro, macro_keys, &macro_keys_len))
{
free (macro_keys);
xfree (macro_keys);
return -1;
}
rl_generic_bind (ISMACR, keyseq, macro_keys, map);
@@ -347,7 +346,7 @@ rl_generic_bind (type, keyseq, data, map)
if (keyseq == 0 || *keyseq == 0)
{
if (type == ISMACR)
free (data);
xfree (data);
return -1;
}
@@ -358,7 +357,7 @@ rl_generic_bind (type, keyseq, data, map)
KEYS into KEYS_LEN. */
if (rl_translate_keyseq (keyseq, keys, &keys_len))
{
free (keys);
xfree (keys);
return -1;
}
@@ -371,7 +370,7 @@ rl_generic_bind (type, keyseq, data, map)
ic = uc;
if (ic < 0 || ic >= KEYMAP_SIZE)
{
free (keys);
xfree (keys);
return -1;
}
@@ -414,7 +413,7 @@ rl_generic_bind (type, keyseq, data, map)
else
{
if (map[ic].type == ISMACR)
free ((char *)map[ic].function);
xfree ((char *)map[ic].function);
else if (map[ic].type == ISKMAP)
{
map = FUNCTION_TO_KEYMAP (map, ic);
@@ -427,7 +426,7 @@ rl_generic_bind (type, keyseq, data, map)
rl_binding_keymap = map;
}
free (keys);
xfree (keys);
return 0;
}
@@ -793,7 +792,7 @@ _rl_read_file (filename, sizep)
if (i < 0)
{
free (buffer);
xfree (buffer);
return ((char *)NULL);
}
@@ -863,7 +862,7 @@ _rl_read_init_file (filename, include_level)
openname = tilde_expand (filename);
buffer = _rl_read_file (openname, &file_size);
free (openname);
xfree (openname);
if (buffer == 0)
return (errno);
@@ -911,7 +910,7 @@ _rl_read_init_file (filename, include_level)
current_readline_init_lineno++;
}
free (buffer);
xfree (buffer);
currently_reading_init_file = 0;
return (0);
}
@@ -921,10 +920,10 @@ _rl_init_file_error (msg)
const char *msg;
{
if (currently_reading_init_file)
fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
_rl_errmsg ("%s: line %d: %s\n", current_readline_init_file,
current_readline_init_lineno, msg);
else
fprintf (stderr, "readline: %s\n", msg);
_rl_errmsg ("%s", msg);
}
/* **************************************************************** */
@@ -936,11 +935,11 @@ _rl_init_file_error (msg)
typedef int _rl_parser_func_t PARAMS((char *));
/* Things that mean `Control'. */
const char *_rl_possible_control_prefixes[] = {
const char * const _rl_possible_control_prefixes[] = {
"Control-", "C-", "CTRL-", (const char *)NULL
};
const char *_rl_possible_meta_prefixes[] = {
const char * const _rl_possible_meta_prefixes[] = {
"Meta", "M-", (const char *)NULL
};
@@ -1002,7 +1001,7 @@ parser_if (args)
`$if term=sun-cmd' into their .inputrc. */
_rl_parsing_conditionalized_out = _rl_stricmp (args + 5, tname) &&
_rl_stricmp (args + 5, rl_terminal_name);
free (tname);
xfree (tname);
}
#if defined (VI_MODE)
else if (_rl_strnicmp (args, "mode=", 5) == 0)
@@ -1099,8 +1098,8 @@ parser_include (args)
}
/* Associate textual names with actual functions. */
static struct {
const char *name;
static const struct {
const char * const name;
_rl_parser_func_t *function;
} parser_directives [] = {
{ "if", parser_if },
@@ -1352,7 +1351,7 @@ rl_parse_and_bind (string)
else
rl_bind_keyseq (seq, rl_named_function (funname));
free (seq);
xfree (seq);
return 0;
}
@@ -1406,8 +1405,8 @@ rl_parse_and_bind (string)
#define V_SPECIAL 0x1
static struct {
const char *name;
static const struct {
const char * const name;
int *value;
int flags;
} boolean_varlist [] = {
@@ -1431,6 +1430,7 @@ static struct {
{ "page-completions", &_rl_page_completions, 0 },
{ "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL },
{ "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
{ "revert-all-at-newline", &_rl_revert_all_at_newline, 0 },
{ "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
{ "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 },
#if defined (VISIBLE_STATS)
@@ -1489,20 +1489,24 @@ typedef int _rl_sv_func_t PARAMS((const char *));
/* Forward declarations */
static int sv_bell_style PARAMS((const char *));
static int sv_combegin PARAMS((const char *));
static int sv_dispprefix PARAMS((const char *));
static int sv_compquery PARAMS((const char *));
static int sv_editmode PARAMS((const char *));
static int sv_histsize PARAMS((const char *));
static int sv_isrchterm PARAMS((const char *));
static int sv_keymap PARAMS((const char *));
static struct {
const char *name;
static const struct {
const char * const name;
int flags;
_rl_sv_func_t *set_func;
} string_varlist[] = {
{ "bell-style", V_STRING, sv_bell_style },
{ "comment-begin", V_STRING, sv_combegin },
{ "completion-prefix-display-length", V_INT, sv_dispprefix },
{ "completion-query-items", V_INT, sv_compquery },
{ "editing-mode", V_STRING, sv_editmode },
{ "history-size", V_INT, sv_histsize },
{ "isearch-terminators", V_STRING, sv_isrchterm },
{ "keymap", V_STRING, sv_keymap },
{ (char *)NULL, 0 }
@@ -1613,6 +1617,22 @@ sv_combegin (value)
return 1;
}
static int
sv_dispprefix (value)
const char *value;
{
int nval = 0;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
nval = 0;
}
_rl_completion_prefix_display_length = nval;
return 0;
}
static int
sv_compquery (value)
const char *value;
@@ -1629,6 +1649,22 @@ sv_compquery (value)
return 0;
}
static int
sv_histsize (value)
const char *value;
{
int nval = 500;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
return 1;
}
stifle_history (nval);
return 0;
}
static int
sv_keymap (value)
const char *value;
@@ -1693,7 +1729,7 @@ sv_isrchterm (value)
rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
_rl_isearch_terminators[end] = '\0';
free (v);
xfree (v);
return 0;
}
@@ -1701,11 +1737,11 @@ sv_isrchterm (value)
For example, `Space' returns ' '. */
typedef struct {
const char *name;
const char * const name;
int value;
} assoc_list;
static assoc_list name_key_alist[] = {
static const assoc_list name_key_alist[] = {
{ "DEL", 0x7f },
{ "ESC", '\033' },
{ "Escape", '\033' },
@@ -1734,8 +1770,8 @@ glean_key_from_name (name)
}
/* Auxiliary functions to manage keymaps. */
static struct {
const char *name;
static const struct {
const char * const name;
Keymap map;
} keymap_names[] = {
{ "emacs", emacs_standard_keymap },
@@ -1838,7 +1874,7 @@ rl_list_funmap_names ()
for (i = 0; funmap_names[i]; i++)
fprintf (rl_outstream, "%s\n", funmap_names[i]);
free (funmap_names);
xfree (funmap_names);
}
static char *
@@ -2004,7 +2040,7 @@ rl_invoking_keyseqs_in_map (function, map)
}
strcat (keyname, seqs[i]);
free (seqs[i]);
xfree (seqs[i]);
if (result_index + 2 > result_size)
{
@@ -2016,7 +2052,7 @@ rl_invoking_keyseqs_in_map (function, map)
result[result_index] = (char *)NULL;
}
free (seqs);
xfree (seqs);
}
break;
}
@@ -2068,10 +2104,10 @@ rl_function_dumper (print_readably)
{
fprintf (rl_outstream, "\"%s\": %s\n",
invokers[j], name);
free (invokers[j]);
xfree (invokers[j]);
}
free (invokers);
xfree (invokers);
}
}
else
@@ -2095,9 +2131,9 @@ rl_function_dumper (print_readably)
fprintf (rl_outstream, "...\n");
for (j = 0; invokers[j]; j++)
free (invokers[j]);
xfree (invokers[j]);
free (invokers);
xfree (invokers);
}
}
}
@@ -2143,8 +2179,8 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
fprintf (rl_outstream, "%s%s outputs %s\n", prefix ? prefix : "",
keyname,
out ? out : "");
free (keyname);
free (out);
xfree (keyname);
xfree (out);
break;
case ISFUNC:
break;
@@ -2167,13 +2203,13 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
out = (char *)xmalloc (strlen (keyname) + prefix_len + 1);
strcpy (out, prefix);
strcpy (out + prefix_len, keyname);
free (keyname);
xfree (keyname);
keyname = out;
}
}
_rl_macro_dumper_internal (print_readably, FUNCTION_TO_KEYMAP (map, key), keyname);
free (keyname);
xfree (keyname);
break;
}
}
@@ -2219,6 +2255,11 @@ _rl_get_string_variable_value (name)
}
else if (_rl_stricmp (name, "comment-begin") == 0)
return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
else if (_rl_stricmp (name, "completion-prefix-display-length") == 0)
{
sprintf (numbuf, "%d", _rl_completion_prefix_display_length);
return (numbuf);
}
else if (_rl_stricmp (name, "completion-query-items") == 0)
{
sprintf (numbuf, "%d", rl_completion_query_items);
@@ -2226,6 +2267,11 @@ _rl_get_string_variable_value (name)
}
else if (_rl_stricmp (name, "editing-mode") == 0)
return (rl_get_keymap_name_from_edit_mode ());
else if (_rl_stricmp (name, "history-size") == 0)
{
sprintf (numbuf, "%d", history_is_stifled() ? history_max_entries : 0);
return (numbuf);
}
else if (_rl_stricmp (name, "isearch-terminators") == 0)
{
if (_rl_isearch_terminators == 0)
@@ -2234,7 +2280,7 @@ _rl_get_string_variable_value (name)
if (ret)
{
strncpy (numbuf, ret, sizeof (numbuf) - 1);
free (ret);
xfree (ret);
numbuf[sizeof(numbuf) - 1] = '\0';
}
else
@@ -2298,8 +2344,8 @@ rl_dump_variables (count, key)
/* Return non-zero if any members of ARRAY are a substring in STRING. */
static int
substring_member_of_array (string, array)
char *string;
const char **array;
const char *string;
const char * const *array;
{
while (*array)
{

View File

@@ -1,24 +1,24 @@
/* callback.c -- functions to use readline as an X `callback' mechanism. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -111,17 +111,17 @@ rl_callback_read_char ()
if (rl_linefunc == NULL)
{
fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n");
_rl_errmsg ("readline_callback_read_char() called with no handler!");
abort ();
}
memcpy ((void *)olevel, (void *)readline_top_level, sizeof (procenv_t));
jcode = setjmp (readline_top_level);
memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t));
jcode = setjmp (_rl_top_level);
if (jcode)
{
(*rl_redisplay_function) ();
_rl_want_redisplay = 0;
memcpy ((void *)readline_top_level, (void *)olevel, sizeof (procenv_t));
memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t));
return;
}
@@ -251,8 +251,7 @@ _rl_callback_data_alloc (count)
void _rl_callback_data_dispose (arg)
_rl_callback_generic_arg *arg;
{
if (arg)
free (arg);
xfree (arg);
}
#endif

View File

@@ -1,24 +1,23 @@
/* chardefs.h -- Character definitions for readline. */
/* Copyright (C) 1994 Free Software Foundation, Inc.
/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CHARDEFS_H_
#define _CHARDEFS_H_

View File

@@ -1,24 +1,24 @@
/* compat.c -- backwards compatibility functions. */
/* Copyright (C) 2000 Free Software Foundation, Inc.
/* Copyright (C) 2000-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)

View File

@@ -1,24 +1,24 @@
/* complete.c -- filename completion for readline. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -110,8 +110,8 @@ static int get_y_or_n PARAMS((int));
static int _rl_internal_pager PARAMS((int));
static char *printable_part PARAMS((char *));
static int fnwidth PARAMS((const char *));
static int fnprint PARAMS((const char *));
static int print_filename PARAMS((char *, char *));
static int fnprint PARAMS((const char *, int));
static int print_filename PARAMS((char *, char *, int));
static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
@@ -164,6 +164,12 @@ int _rl_completion_case_fold;
Unix) when doing filename completion. */
int _rl_match_hidden_files = 1;
/* Length in characters of a common prefix replaced with an ellipsis (`...')
when displaying completion matches. Matches whose printable portion has
more than this number of displaying characters in common will have the common
display prefix replaced with an ellipsis. */
int _rl_completion_prefix_display_length = 0;
/* Global variables available to applications using readline. */
#if defined (VISIBLE_STATS)
@@ -188,6 +194,10 @@ int rl_complete_with_tilde_expansion = 0;
completer. */
rl_compentry_func_t *rl_completion_entry_function = (rl_compentry_func_t *)NULL;
/* Pointer to generator function for rl_menu_complete (). NULL means to use
*rl_completion_entry_function (see above). */
rl_compentry_func_t *rl_menu_completion_entry_function = (rl_compentry_func_t *)NULL;
/* Pointer to alternative function to create matches.
Function is called with TEXT, START, and END.
START and END are indices in RL_LINE_BUFFER saying what the boundaries
@@ -325,11 +335,20 @@ int rl_completion_mark_symlink_dirs;
/* If non-zero, inhibit completion (temporarily). */
int rl_inhibit_completion;
/* Set to the last key used to invoke one of the completion functions */
int rl_completion_invoking_key;
/* If non-zero, sort the completion matches. On by default. */
int rl_sort_completion_matches = 1;
/* Variables local to this file. */
/* Local variable states what happened during the last completion attempt. */
static int completion_changed_buffer;
/* The result of the query to the user about displaying completion matches */
static int completion_y_or_n;
/*************************************/
/* */
/* Bindable completion functions */
@@ -343,6 +362,8 @@ int
rl_complete (ignore, invoking_key)
int ignore, invoking_key;
{
rl_completion_invoking_key = invoking_key;
if (rl_inhibit_completion)
return (_rl_insert_char (ignore, invoking_key));
else if (rl_last_func == rl_complete && !completion_changed_buffer)
@@ -360,6 +381,7 @@ int
rl_possible_completions (ignore, invoking_key)
int ignore, invoking_key;
{
rl_completion_invoking_key = invoking_key;
return (rl_complete_internal ('?'));
}
@@ -367,6 +389,7 @@ int
rl_insert_completions (ignore, invoking_key)
int ignore, invoking_key;
{
rl_completion_invoking_key = invoking_key;
return (rl_complete_internal ('*'));
}
@@ -395,6 +418,14 @@ rl_completion_mode (cfunc)
/* */
/************************************/
/* Reset readline state on a signal or other event. */
void
_rl_reset_completion_state ()
{
rl_completion_found_quote = 0;
rl_completion_quote_character = 0;
}
/* Set default values for readline word completion. These are the variables
that application completion functions can change or inspect. */
static void
@@ -406,6 +437,7 @@ set_completion_defaults (what_to_do)
rl_filename_quoting_desired = 1;
rl_completion_type = what_to_do;
rl_completion_suppress_append = rl_completion_suppress_quote = 0;
rl_completion_append_character = ' ';
/* The completion entry function may optionally change this. */
rl_completion_mark_symlink_dirs = _rl_complete_mark_symlink_dirs;
@@ -481,6 +513,13 @@ stat_char (filename)
struct stat finfo;
int character, r;
/* Short-circuit a //server on cygwin, since that will always behave as
a directory. */
#if __CYGWIN__
if (filename[0] == '/' && filename[1] == '/' && strchr (filename+2, '/') == 0)
return '/';
#endif
#if defined (HAVE_LSTAT) && defined (S_ISLNK)
r = lstat (filename, &finfo);
#else
@@ -581,7 +620,7 @@ fnwidth (string)
width = pos = 0;
while (string[pos])
{
if (CTRL_CHAR (*string) || *string == RUBOUT)
if (CTRL_CHAR (string[pos]) || string[pos] == RUBOUT)
{
width += 2;
pos++;
@@ -614,17 +653,20 @@ fnwidth (string)
return width;
}
#define ELLIPSIS_LEN 3
static int
fnprint (to_print)
fnprint (to_print, prefix_bytes)
const char *to_print;
int prefix_bytes;
{
int printed_len;
int printed_len, w;
const char *s;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps;
const char *end;
size_t tlen;
int width, w;
int width;
wchar_t wc;
end = to_print + strlen (to_print) + 1;
@@ -632,7 +674,23 @@ fnprint (to_print)
#endif
printed_len = 0;
s = to_print;
/* Don't print only the ellipsis if the common prefix is one of the
possible completions */
if (to_print[prefix_bytes] == '\0')
prefix_bytes = 0;
if (prefix_bytes)
{
char ellipsis;
ellipsis = (to_print[prefix_bytes] == '.') ? '_' : '.';
for (w = 0; w < ELLIPSIS_LEN; w++)
putc (ellipsis, rl_outstream);
printed_len = ELLIPSIS_LEN;
}
s = to_print + prefix_bytes;
while (*s)
{
if (CTRL_CHAR (*s))
@@ -691,14 +749,15 @@ fnprint (to_print)
filenames. Return the number of characters we output. */
static int
print_filename (to_print, full_pathname)
print_filename (to_print, full_pathname, prefix_bytes)
char *to_print, *full_pathname;
int prefix_bytes;
{
int printed_len, extension_char, slen, tlen;
char *s, c, *new_full_pathname, *dn;
extension_char = 0;
printed_len = fnprint (to_print);
printed_len = fnprint (to_print, prefix_bytes);
#if defined (VISIBLE_STATS)
if (rl_filename_completion_desired && (rl_visible_stats || _rl_complete_mark_directories))
@@ -992,7 +1051,7 @@ remove_duplicate_matches (matches)
/* Sort the array without matches[0], since we need it to
stay in place no matter what. */
if (i)
if (i && rl_sort_completion_matches)
qsort (matches+1, i-1, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
/* Remember the lowest common denominator for it may be unique. */
@@ -1256,8 +1315,24 @@ rl_display_match_list (matches, len, max)
int len, max;
{
int count, limit, printed_len, lines;
int i, j, k, l;
char *temp;
int i, j, k, l, common_length, sind;
char *temp, *t;
/* Find the length of the prefix common to all items: length as displayed
characters (common_length) and as a byte index into the matches (sind) */
common_length = sind = 0;
if (_rl_completion_prefix_display_length > 0)
{
t = printable_part (matches[0]);
temp = strrchr (t, '/');
common_length = temp ? fnwidth (temp) : fnwidth (t);
sind = temp ? strlen (temp) : strlen (t);
if (common_length > _rl_completion_prefix_display_length && common_length > ELLIPSIS_LEN)
max -= common_length - ELLIPSIS_LEN;
else
common_length = sind = 0;
}
/* How many items of MAX length can we fit in the screen window? */
max += 2;
@@ -1278,7 +1353,7 @@ rl_display_match_list (matches, len, max)
0 < len <= limit implies count = 1. */
/* Sort the items if they are not already sorted. */
if (rl_ignore_completion_duplicates == 0)
if (rl_ignore_completion_duplicates == 0 && rl_sort_completion_matches)
qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
rl_crlf ();
@@ -1296,7 +1371,7 @@ rl_display_match_list (matches, len, max)
else
{
temp = printable_part (matches[l]);
printed_len = print_filename (temp, matches[l]);
printed_len = print_filename (temp, matches[l], sind);
if (j + 1 < limit)
for (k = 0; k < max - printed_len; k++)
@@ -1320,7 +1395,7 @@ rl_display_match_list (matches, len, max)
for (i = 1; matches[i]; i++)
{
temp = printable_part (matches[i]);
printed_len = print_filename (temp, matches[i]);
printed_len = print_filename (temp, matches[i], sind);
/* Have we reached the end of this line? */
if (matches[i+1])
{
@@ -1370,7 +1445,7 @@ display_matches (matches)
{
temp = printable_part (matches[0]);
rl_crlf ();
print_filename (temp, matches[0]);
print_filename (temp, matches[0], 0);
rl_crlf ();
rl_forced_update_display ();
@@ -1406,7 +1481,7 @@ display_matches (matches)
rl_crlf ();
fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len);
fflush (rl_outstream);
if (get_y_or_n (0) == 0)
if ((completion_y_or_n = get_y_or_n (0)) == 0)
{
rl_crlf ();
@@ -1678,6 +1753,7 @@ rl_complete_internal (what_to_do)
FREE (saved_line_buffer);
completion_changed_buffer = 0;
RL_UNSETSTATE(RL_STATE_COMPLETING);
_rl_reset_completion_state ();
return (0);
}
@@ -1692,6 +1768,7 @@ rl_complete_internal (what_to_do)
FREE (saved_line_buffer);
completion_changed_buffer = 0;
RL_UNSETSTATE(RL_STATE_COMPLETING);
_rl_reset_completion_state ();
return (0);
}
@@ -1742,10 +1819,11 @@ rl_complete_internal (what_to_do)
break;
default:
fprintf (stderr, "\r\nreadline: bad value %d for what_to_do in rl_complete\n", what_to_do);
_rl_ttymsg ("bad value %d for what_to_do in rl_complete", what_to_do);
rl_ding ();
FREE (saved_line_buffer);
RL_UNSETSTATE(RL_STATE_COMPLETING);
_rl_reset_completion_state ();
return 1;
}
@@ -1759,6 +1837,7 @@ rl_complete_internal (what_to_do)
}
RL_UNSETSTATE(RL_STATE_COMPLETING);
_rl_reset_completion_state ();
return 0;
}
@@ -2109,8 +2188,8 @@ rl_filename_completion_function (text, state)
hit the end of the match list, we restore the original unmatched text,
ring the bell, and reset the counter to zero. */
int
rl_menu_complete (count, ignore)
int count, ignore;
rl_old_menu_complete (count, invoking_key)
int count, invoking_key;
{
rl_compentry_func_t *our_func;
int matching_filenames, found_quote;
@@ -2135,10 +2214,14 @@ rl_menu_complete (count, ignore)
match_list_index = match_list_size = 0;
matches = (char **)NULL;
rl_completion_invoking_key = invoking_key;
/* Only the completion entry function can change these. */
set_completion_defaults ('%');
our_func = rl_completion_entry_function
our_func = rl_menu_completion_entry_function;
if (our_func == 0)
our_func = rl_completion_entry_function
? rl_completion_entry_function
: rl_filename_completion_function;
@@ -2179,6 +2262,9 @@ rl_menu_complete (count, ignore)
;
/* matches[0] is lcd if match_list_size > 1, but the circular buffer
code below should take care of it. */
if (match_list_size > 1 && _rl_complete_show_all)
display_matches (matches);
}
/* Now we have the list of matches. Replace the text between
@@ -2215,3 +2301,158 @@ rl_menu_complete (count, ignore)
completion_changed_buffer = 1;
return (0);
}
int
rl_menu_complete (count, ignore)
int count, ignore;
{
rl_compentry_func_t *our_func;
int matching_filenames, found_quote;
static char *orig_text;
static char **matches = (char **)0;
static int match_list_index = 0;
static int match_list_size = 0;
static int nontrivial_lcd = 0;
static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */
static int orig_start, orig_end;
static char quote_char;
static int delimiter;
/* The first time through, we generate the list of matches and set things
up to insert them. */
if (rl_last_func != rl_menu_complete || full_completion)
{
/* Clean up from previous call, if any. */
FREE (orig_text);
if (matches)
_rl_free_match_list (matches);
match_list_index = match_list_size = 0;
matches = (char **)NULL;
full_completion = 0;
/* Only the completion entry function can change these. */
set_completion_defaults ('%');
our_func = rl_menu_completion_entry_function;
if (our_func == 0)
our_func = rl_completion_entry_function
? rl_completion_entry_function
: rl_filename_completion_function;
/* We now look backwards for the start of a filename/variable word. */
orig_end = rl_point;
found_quote = delimiter = 0;
quote_char = '\0';
if (rl_point)
/* This (possibly) changes rl_point. If it returns a non-zero char,
we know we have an open quote. */
quote_char = _rl_find_completion_word (&found_quote, &delimiter);
orig_start = rl_point;
rl_point = orig_end;
orig_text = rl_copy_text (orig_start, orig_end);
matches = gen_completion_matches (orig_text, orig_start, orig_end,
our_func, found_quote, quote_char);
nontrivial_lcd = matches && strcmp (orig_text, matches[0]) != 0;
/* If we are matching filenames, the attempted completion function will
have set rl_filename_completion_desired to a non-zero value. The basic
rl_filename_completion_function does this. */
matching_filenames = rl_filename_completion_desired;
if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
FREE (orig_text);
orig_text = (char *)0;
completion_changed_buffer = 0;
return (0);
}
for (match_list_size = 0; matches[match_list_size]; match_list_size++)
;
if (match_list_size == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
match_list_index = 0;
completion_changed_buffer = 0;
return (0);
}
/* matches[0] is lcd if match_list_size > 1, but the circular buffer
code below should take care of it. */
if (*matches[0])
{
insert_match (matches[0], orig_start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
orig_end = orig_start + strlen (matches[0]);
completion_changed_buffer = STREQ (orig_text, matches[0]) == 0;
}
if (match_list_size > 1 && _rl_complete_show_all)
{
display_matches (matches);
/* If there are so many matches that the user has to be asked
whether or not he wants to see the matches, menu completion
is unwieldy. */
if (rl_completion_query_items > 0 && match_list_size >= rl_completion_query_items)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
full_completion = 1;
return (0);
}
}
else if (match_list_size <= 1)
{
append_to_match (matches[0], delimiter, quote_char, nontrivial_lcd);
full_completion = 1;
return (0);
}
}
/* Now we have the list of matches. Replace the text between
rl_line_buffer[orig_start] and rl_line_buffer[rl_point] with
matches[match_list_index], and add any necessary closing char. */
if (matches == 0 || match_list_size == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
completion_changed_buffer = 0;
return (0);
}
match_list_index += count;
if (match_list_index < 0)
match_list_index += match_list_size;
else
match_list_index %= match_list_size;
if (match_list_index == 0 && match_list_size > 1)
{
rl_ding ();
insert_match (matches[0], orig_start, MULT_MATCH, &quote_char);
}
else
{
insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
append_to_match (matches[match_list_index], delimiter, quote_char,
strcmp (orig_text, matches[match_list_index]));
}
completion_changed_buffer = 1;
return (0);
}

View File

@@ -1,24 +1,24 @@
/* display.c -- readline redisplay facility. */
/* Copyright (C) 1987-2006 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -65,16 +65,40 @@ static void delete_chars PARAMS((int));
static void insert_some_chars PARAMS((char *, int, int));
static void cr PARAMS((void));
/* State of visible and invisible lines. */
struct line_state
{
char *line;
int *lbreaks;
int lbsize;
#if defined (HANDLE_MULTIBYTE)
int *wrapped_line;
int wbsize;
#endif
};
/* The line display buffers. One is the line currently displayed on
the screen. The other is the line about to be displayed. */
static struct line_state line_state_array[2];
static struct line_state *line_state_visible = &line_state_array[0];
static struct line_state *line_state_invisible = &line_state_array[1];
static int line_structures_initialized = 0;
/* Backwards-compatible names. */
#define inv_lbreaks (line_state_invisible->lbreaks)
#define inv_lbsize (line_state_invisible->lbsize)
#define vis_lbreaks (line_state_visible->lbreaks)
#define vis_lbsize (line_state_visible->lbsize)
#define visible_line (line_state_visible->line)
#define invisible_line (line_state_invisible->line)
#if defined (HANDLE_MULTIBYTE)
static int _rl_col_width PARAMS((const char *, int, int));
static int *_rl_wrapped_line;
#else
# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
#endif
static int *inv_lbreaks, *vis_lbreaks;
static int inv_lbsize, vis_lbsize;
/* Heuristic used to decide whether it is faster to move from CUR to NEW
by backing up or outputting a carriage return and moving forward. CUR
and NEW are either both buffer positions or absolute screen positions. */
@@ -83,7 +107,7 @@ static int inv_lbsize, vis_lbsize;
/* _rl_last_c_pos is an absolute cursor position in multibyte locales and a
buffer index in others. This macro is used when deciding whether the
current cursor position is in the middle of a prompt string containing
invisible characters. */
invisible characters. XXX - might need to take `modmark' into account. */
#define PROMPT_ENDING_INDEX \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
@@ -141,6 +165,7 @@ int _rl_last_v_pos = 0;
static int cpos_adjusted;
static int cpos_buffer_position;
static int prompt_multibyte_chars;
/* Number of lines currently on screen minus 1. */
int _rl_vis_botlin = 0;
@@ -150,11 +175,6 @@ int _rl_vis_botlin = 0;
doing horizontal scrolling. It shifts in thirds of a screenwidth. */
static int last_lmargin;
/* The line display buffers. One is the line currently displayed on
the screen. The other is the line about to be displayed. */
static char *visible_line = (char *)NULL;
static char *invisible_line = (char *)NULL;
/* A buffer for `modeline' messages. */
static char msg_buf[128];
@@ -195,6 +215,10 @@ static int prompt_last_screen_line;
static int prompt_physical_chars;
/* set to a non-zero value by rl_redisplay if we are marking modified history
lines and the current line is so marked. */
static int modmark;
/* Variables to save and restore prompt and display information. */
/* These are getting numerous enough that it's time to create a struct. */
@@ -282,6 +306,11 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
*r++ = *p++;
if (!ignoring)
{
/* rl ends up being assigned to prompt_visible_length,
which is the number of characters in the buffer that
contribute to characters on the screen, which might
not be the same as the number of physical characters
on the screen in the presence of multibyte characters */
rl += ind - pind;
physchars += _rl_col_width (pmt, pind, ind);
}
@@ -443,13 +472,21 @@ init_line_structures (minsize)
{
/* should be enough. */
inv_lbsize = vis_lbsize = 256;
#if defined (HANDLE_MULTIBYTE)
line_state_visible->wbsize = vis_lbsize;
line_state_visible->wrapped_line = (int *)xmalloc (line_state_visible->wbsize * sizeof (int));
line_state_invisible->wbsize = inv_lbsize;
line_state_invisible->wrapped_line = (int *)xmalloc (line_state_invisible->wbsize * sizeof (int));
#endif
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
#if defined (HANDLE_MULTIBYTE)
_rl_wrapped_line = (int *)xmalloc (vis_lbsize * sizeof (int));
#endif
inv_lbreaks[0] = vis_lbreaks[0] = 0;
}
line_structures_initialized = 1;
}
/* Basic redisplay algorithm. */
@@ -459,7 +496,7 @@ rl_redisplay ()
register int in, out, c, linenum, cursor_linenum;
register char *line;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, modmark, n0, num;
int newlines, lpos, temp, n0, num, prompt_lines_estimate;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
@@ -469,13 +506,17 @@ rl_redisplay ()
int _rl_wrapped_multicolumn = 0;
#endif
if (!readline_echoing_p)
if (_rl_echoing_p == 0)
return;
/* Block keyboard interrupts because this function manipulates global
data structures. */
_rl_block_sigint ();
if (!rl_display_prompt)
rl_display_prompt = "";
if (invisible_line == 0 || vis_lbreaks == 0)
if (line_structures_initialized == 0)
{
init_line_structures (0);
rl_on_new_line ();
@@ -484,6 +525,8 @@ rl_redisplay ()
/* Draw the line into the buffer. */
cpos_buffer_position = -1;
prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars;
line = invisible_line;
out = inv_botlin = 0;
@@ -561,17 +604,6 @@ rl_redisplay ()
wrap_offset = prompt_invis_chars_first_line = 0;
}
#if defined (HANDLE_MULTIBYTE)
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
_rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
} \
} while (0)
#else
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
@@ -580,7 +612,6 @@ rl_redisplay ()
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \
} while (0)
#endif /* HANDLE_MULTIBYTE */
#if defined (HANDLE_MULTIBYTE)
#define CHECK_LPOS() \
@@ -592,10 +623,14 @@ rl_redisplay ()
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
_rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
} \
inv_lbreaks[++newlines] = out; \
_rl_wrapped_line[newlines] = _rl_wrapped_multicolumn; \
if (newlines >= (line_state_invisible->wbsize - 1)) \
{ \
line_state_invisible->wbsize *= 2; \
line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); \
} \
line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; \
lpos = 0; \
} \
} while (0)
@@ -618,21 +653,20 @@ rl_redisplay ()
/* inv_lbreaks[i] is where line i starts in the buffer. */
inv_lbreaks[newlines = 0] = 0;
#if 0
lpos = out - wrap_offset;
#else
lpos = prompt_physical_chars + modmark;
#endif
#if defined (HANDLE_MULTIBYTE)
memset (_rl_wrapped_line, 0, vis_lbsize);
memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int));
num = 0;
#endif
/* prompt_invis_chars_first_line is the number of invisible characters in
the first physical line of the prompt.
wrap_offset - prompt_invis_chars_first_line is the number of invis
chars on the second line. */
chars on the second (or, more generally, last) line. */
/* This is zero-based, used to set the newlines */
prompt_lines_estimate = lpos / _rl_screenwidth;
/* what if lpos is already >= _rl_screenwidth before we start drawing the
contents of the command line? */
@@ -647,7 +681,7 @@ rl_redisplay ()
prompts that exceed two physical lines?
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
{
n0 = num;
temp = local_prompt_len;
@@ -670,13 +704,15 @@ rl_redisplay ()
temp = ((newlines + 1) * _rl_screenwidth);
/* Now account for invisible characters in the current line. */
/* XXX - this assumes that the invisible characters may be split, but only
between the first and the last lines. */
temp += ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
: ((newlines == 1) ? wrap_offset : 0))
: ((newlines == 0) ? wrap_offset :0));
: ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line))
: ((newlines == 0) ? wrap_offset : 0));
inv_lbreaks[++newlines] = temp;
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
lpos -= _rl_col_width (local_prompt, n0, num);
else
#endif
@@ -935,7 +971,7 @@ rl_redisplay ()
take invisible characters into account, since _rl_last_c_pos
is an absolute cursor position in a multibyte locale. See
if compensating here is the right thing, or if we have to
change update_line itself. There is one case in which
change update_line itself. There are several cases in which
update_line adjusts _rl_last_c_pos itself (so it can pass
_rl_move_cursor_relative accurate values); it communicates
this back by setting cpos_adjusted. If we assume that
@@ -974,6 +1010,19 @@ rl_redisplay ()
if (nleft)
_rl_clear_to_eol (nleft);
}
#if 0
/* This segment is intended to handle the case where the prompt
has invisible characters on the second line and the new line
to be displayed needs to clear the rest of the old characters
out (e.g., when printing the i-search prompt). In general,
the case of the new line being shorter than the old.
Incomplete */
else if (linenum == prompt_last_screen_line &&
prompt_physical_chars > _rl_screenwidth &&
wrap_offset != prompt_invis_chars_first_line &&
_rl_last_c_pos == out &&
#endif
/* Since the new first line is now visible, save its length. */
if (linenum == 0)
@@ -1029,11 +1078,14 @@ rl_redisplay ()
if (_rl_term_cr)
tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, nleft);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft) - wrap_offset;
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft) - wrap_offset + modmark;
else
_rl_last_c_pos = nleft;
_rl_last_c_pos = nleft + modmark;
}
/* Where on that line? And where does that line start
@@ -1169,17 +1221,10 @@ rl_redisplay ()
/* Swap visible and non-visible lines. */
{
char *vtemp = visible_line;
int *itemp = vis_lbreaks, ntemp = vis_lbsize;
struct line_state *vtemp = line_state_visible;
visible_line = invisible_line;
invisible_line = vtemp;
vis_lbreaks = inv_lbreaks;
inv_lbreaks = itemp;
vis_lbsize = inv_lbsize;
inv_lbsize = ntemp;
line_state_visible = line_state_invisible;
line_state_invisible = vtemp;
rl_display_fixed = 0;
/* If we are displaying on a single line, and last_lmargin is > 0, we
@@ -1190,6 +1235,8 @@ rl_redisplay ()
else
visible_wrap_offset = wrap_offset;
}
_rl_release_sigint ();
}
/* PWP: update_line() is based on finding the middle difference of each
@@ -1245,8 +1292,8 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
/* This fixes only double-column characters, but if the wrapped
character comsumes more than three columns, spaces will be
inserted in the string buffer. */
if (_rl_wrapped_line[current_line] > 0)
_rl_clear_to_eol (_rl_wrapped_line[current_line]);
if (current_line < line_state_visible->wbsize && line_state_visible->wrapped_line[current_line] > 0)
_rl_clear_to_eol (line_state_visible->wrapped_line[current_line]);
memset (&ps, 0, sizeof (mbstate_t));
ret = mbrtowc (&wc, new, MB_CUR_MAX, &ps);
@@ -1310,7 +1357,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
/* See if the old line is a subset of the new line, so that the
only change is adding characters. */
temp = (omax < nmax) ? omax : nmax;
if (memcmp (old, new, temp) == 0)
if (memcmp (old, new, temp) == 0) /* adding at the end */
{
ofd = old + temp;
nfd = new + temp;
@@ -1463,16 +1510,18 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
#else
tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, lendiff);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
/* We take wrap_offset into account here so we can pass correct
information to _rl_move_cursor_relative. */
_rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff) - wrap_offset;
_rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff) - wrap_offset + modmark;
cpos_adjusted = 1;
}
else
_rl_last_c_pos = lendiff;
_rl_last_c_pos = lendiff + modmark;
}
o_cpos = _rl_last_c_pos;
@@ -1486,7 +1535,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
/* We need to indicate that the cursor position is correct in the presence of
invisible characters in the prompt string. Let's see if setting this when
we make sure we're at the end of the drawn prompt string works. */
if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
(_rl_last_c_pos > 0 || o_cpos > 0) &&
_rl_last_c_pos == prompt_physical_chars)
cpos_adjusted = 1;
@@ -1562,12 +1611,30 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
_rl_horizontal_scroll_mode == 1, inserting the characters with
_rl_term_IC or _rl_term_ic will screw up the screen because of the
invisible characters. We need to just draw them. */
if (*ols && (!_rl_horizontal_scroll_mode || _rl_last_c_pos > 0 ||
lendiff <= prompt_visible_length || !current_invis_chars))
/* The same thing happens if we're trying to draw before the last
invisible character in the prompt string or we're increasing the
number of invisible characters in the line and we're not drawing
the entire prompt string. */
if (*ols && ((_rl_horizontal_scroll_mode &&
_rl_last_c_pos == 0 &&
lendiff > prompt_visible_length &&
current_invis_chars > 0) == 0) &&
(((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
current_line == 0 && wrap_offset &&
((nfd - new) <= prompt_last_invisible) &&
(col_lendiff < prompt_visible_length)) == 0) &&
(visible_wrap_offset >= current_invis_chars))
{
insert_some_chars (nfd, lendiff, col_lendiff);
_rl_last_c_pos += col_lendiff;
}
#if 0 /* XXX - for now */
else if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && _rl_last_c_pos == 0 && wrap_offset && (nfd-new) <= prompt_last_invisible && col_lendiff < prompt_visible_length && visible_wrap_offset >= current_invis_chars)
{
_rl_output_some_chars (nfd, lendiff);
_rl_last_c_pos += col_lendiff;
}
#endif
else if ((MB_CUR_MAX == 1 || rl_byte_oriented != 0) && *ols == 0 && lendiff > 0)
{
/* At the end of a line the characters do not have to
@@ -1581,10 +1648,10 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
{
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp;
/* If nfd begins before any invisible characters in the prompt,
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
/* If nfd begins before the last invisible character in the
prompt, adjust _rl_last_c_pos to account for wrap_offset
and set cpos_adjusted to let the caller know. */
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
cpos_adjusted = 1;
@@ -1605,6 +1672,14 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
else
twidth = temp - lendiff;
_rl_last_c_pos += twidth;
/* If nfd begins before the last invisible character in the
prompt, adjust _rl_last_c_pos to account for wrap_offset
and set cpos_adjusted to let the caller know. */
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
cpos_adjusted = 1;
}
}
}
else
@@ -1616,6 +1691,14 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
char in the current line (which implies we just output some invisible
characters) we need to adjust _rl_last_c_pos, since it represents
a physical character position. */
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
current_line == prompt_last_screen_line && wrap_offset &&
wrap_offset != prompt_invis_chars_first_line &&
((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth))))
{
_rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
cpos_adjusted = 1;
}
}
}
else /* Delete characters from line. */
@@ -1644,15 +1727,15 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
_rl_output_some_chars (nfd, temp);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
_rl_last_c_pos += _rl_col_width (nfd, 0, temp);
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
_rl_last_c_pos += _rl_col_width (nfd, 0, temp);
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
cpos_adjusted = 1;
}
}
else
_rl_last_c_pos += temp;
else
_rl_last_c_pos += temp;
}
}
/* Otherwise, print over the existing material. */
@@ -1681,7 +1764,16 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
else
col_lendiff = lendiff;
#if 0
if (col_lendiff)
#else
/* If we've already printed over the entire width of the screen,
including the old material, then col_lendiff doesn't matter and
space_to_eol will insert too many spaces. XXX - maybe we should
adjust col_lendiff based on the difference between _rl_last_c_pos
and _rl_screenwidth */
if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth))
#endif
{
if (_rl_term_autowrap && current_line < inv_botlin)
space_to_eol (col_lendiff);
@@ -1815,8 +1907,9 @@ _rl_move_cursor_relative (new, data)
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
(prompt_physical_chars > _rl_screenwidth &&
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset != woff &&
new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
wrap_offset >= woff &&
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
/* XXX last comparison might need to be >= */
{
dpos -= woff;
/* Since this will be assigned to _rl_last_c_pos at the end (more
@@ -2229,7 +2322,7 @@ insert_some_chars (string, count, col)
/* DEBUGGING */
if (MB_CUR_MAX == 1 || rl_byte_oriented)
if (count != col)
fprintf(stderr, "readline: debug: insert_some_chars: count (%d) != col (%d)\n", count, col);
_rl_ttymsg ("debug: insert_some_chars: count (%d) != col (%d)", count, col);
/* If IC is defined, then we do not have to "enter" insert mode. */
if (_rl_term_IC)
@@ -2370,10 +2463,14 @@ _rl_redisplay_after_sigwinch ()
{
char *t;
/* Clear the current line and put the cursor at column 0. Make sure
the right thing happens if we have wrapped to a new screen line. */
/* Clear the last line (assuming that the screen size change will result in
either more or fewer characters on that line only) and put the cursor at
column 0. Make sure the right thing happens if we have wrapped to a new
screen line. */
if (_rl_term_cr)
{
_rl_move_vert (_rl_vis_botlin);
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
#else
@@ -2409,7 +2506,7 @@ _rl_redisplay_after_sigwinch ()
void
_rl_clean_up_for_exit ()
{
if (readline_echoing_p)
if (_rl_echoing_p)
{
_rl_move_vert (_rl_vis_botlin);
_rl_vis_botlin = 0;
@@ -2465,7 +2562,10 @@ _rl_col_width (str, start, end)
if (end <= start)
return 0;
if (MB_CUR_MAX == 1 || rl_byte_oriented)
{
_rl_ttymsg ("_rl_col_width: called with MB_CUR_MAX == 1");
return (end - start);
}
memset (&ps, 0, sizeof (mbstate_t));

View File

@@ -2,21 +2,22 @@
# This makefile for Readline library documentation is in -*- text -*- mode.
# Emacs likes it that way.
# Copyright (C) 1996-2002 Free Software Foundation, Inc.
# Copyright (C) 1996-2002 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 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
topdir = .
srcdir = .

View File

@@ -1,13 +1,12 @@
@node GNU Free Documentation License
@appendixsec GNU Free Documentation License
@cindex FDL, GNU Free Documentation License
@c The GNU Free Documentation License.
@center Version 1.2, November 2002
@c This file is intended to be included within another document,
@c hence no sectioning command or @node.
@display
Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -344,7 +343,7 @@ 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 an aggregate, this License does not
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.
@@ -408,7 +407,7 @@ as a draft) by the Free Software Foundation.
@end enumerate
@page
@appendixsubsec ADDENDUM: How to use this License for your documents
@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
@@ -420,14 +419,14 @@ license notices just after the title page:
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
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
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...Texts.'' line with this:
replace the ``with@dots{}Texts.'' line with this:
@smallexample
@group

View File

@@ -4,8 +4,6 @@
@settitle GNU History Library
@c %**end of header (This is for running Texinfo on a region.)
@setchapternewpage odd
@include version.texi
@copying
@@ -14,7 +12,7 @@ This document describes the GNU History library
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
Copyright @copyright{} 1988-2006 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2009 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -24,13 +22,14 @@ are preserved on all copies.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
and with the Back-Cover Texts as in (a) below. A copy of the license is
included in the section entitled ``GNU Free Documentation License.''
included in the section entitled ``GNU Free Documentation License''.
(a) The FSF's Back-Cover Text is: You are free to copy and modify
this GNU manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
this GNU Manual, like GNU software. Copies published by the Free
Software Foundation raise funds for GNU development.''
@end quotation
@end copying
@@ -72,7 +71,7 @@ typed input.
@menu
* Using History Interactively:: GNU History User's Manual.
* Programming with GNU History:: GNU History Programmer's Manual.
* Copying This Manual:: Copying This Manual.
* GNU Free Documentation License:: License for copying this manual.
* Concept Index:: Index of concepts described in this manual.
* Function and Variable Index:: Index of externally visible functions
and variables.
@@ -84,12 +83,8 @@ typed input.
@include hsuser.texi
@include hstech.texi
@node Copying This Manual
@appendix Copying This Manual
@menu
* GNU Free Documentation License:: License for copying this manual.
@end menu
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include fdl.texi

View File

@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988-2006 Free Software Foundation, Inc.
Copyright (C) 1988-2007 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual

View File

@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988-2006 Free Software Foundation, Inc.
Copyright (C) 1988-2007 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -97,7 +97,11 @@ to contain no more than @env{$HISTFILESIZE}
lines. If @env{HISTFILESIZE} is not set, no truncation is performed.
If the @env{HISTTIMEFORMAT} is set, the time stamp information
associated with each history entry is written to the history file.
associated with each history entry is written to the history file,
marked with the history comment character.
When the history file is read, lines beginning with the history
comment character followed immediately by a digit are interpreted
as timestamps for the previous history line.
The builtin command @code{fc} may be used to list or edit and re-execute
a portion of the history list.
@@ -133,7 +137,7 @@ history list and history file.
@item fc
@btindex fc
@example
@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
@code{fc [-e @var{ename}] [-lnr] [@var{first}] [@var{last}]}
@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
@end example
@@ -277,7 +281,10 @@ them, so that they are available for subsequent recall.
This is most useful in conjunction with Readline.
The shell allows control of the various characters used by the
history expansion mechanism with the @code{histchars} variable.
history expansion mechanism with the @code{histchars} variable,
as explained above (@pxref{Bash Variables}). The shell uses
the history comment character to mark history timestamps when
writing the history file.
@end ifset
@menu
@@ -412,7 +419,7 @@ of the following modifiers, each preceded by a @samp{:}.
Remove a trailing pathname component, leaving only the head.
@item t
Remove all leading pathname components, leaving the tail.
Remove all leading pathname components, leaving the tail.
@item r
Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving

View File

@@ -4,7 +4,6 @@
@settitle GNU Readline Library
@comment %**end of header (This is for running Texinfo on a region.)
@synindex vr fn
@setchapternewpage odd
@include version.texi
@@ -14,7 +13,7 @@ This manual describes the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988-2006 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2009 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -24,13 +23,14 @@ are preserved on all copies.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
and with the Back-Cover Texts as in (a) below. A copy of the license is
included in the section entitled ``GNU Free Documentation License.''
included in the section entitled ``GNU Free Documentation License''.
(a) The FSF's Back-Cover Text is: You are free to copy and modify
this GNU manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
this GNU Manual, like GNU software. Copies published by the Free
Software Foundation raise funds for GNU development.''
@end quotation
@end copying
@@ -71,7 +71,7 @@ provide a command line interface.
@menu
* Command Line Editing:: GNU Readline User's Manual.
* Programming with GNU Readline:: GNU Readline Programmer's Manual.
* Copying This Manual:: Copying this manual.
* GNU Free Documentation License:: License for copying this manual.
* Concept Index:: Index of concepts described in this manual.
* Function and Variable Index:: Index of externally visible functions
and variables.
@@ -81,12 +81,8 @@ provide a command line interface.
@include rluser.texi
@include rltech.texi
@node Copying This Manual
@appendix Copying This Manual
@menu
* GNU Free Documentation License:: License for copying this manual.
@end menu
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include fdl.texi

View File

@@ -1,14 +1,13 @@
@comment %**start of header (This is for running Texinfo on a region.)
@setfilename rltech.info
@comment %**end of header (This is for running Texinfo on a region.)
@setchapternewpage odd
@ifinfo
This document describes the GNU Readline Library, a utility for aiding
in the consistency of user interface across discrete programs that need
to provide a command line interface.
Copyright (C) 1988-2006 Free Software Foundation, Inc.
Copyright (C) 1988-2007 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -351,6 +350,12 @@ The @code{rl_set_prompt()} function (@pxref{Redisplay}) may
be used to modify the prompt string after calling @code{readline()}.
@end deftypevar
@deftypevar {char *} rl_display_prompt
The string displayed as the prompt. This is usually identical to
@var{rl_prompt}, but may be changed temporarily by functions that
use the prompt string as a message area, such as incremental search.
@end deftypevar
@deftypevar int rl_already_prompted
If an application wishes to display the prompt itself, rather than have
Readline do it the first time @code{readline()} is called, it should set
@@ -518,6 +523,20 @@ Readline is performing word completion.
Readline is currently executing the readline signal handler.
@item RL_STATE_UNDOING
Readline is performing an undo.
@item RL_STATE_INPUTPENDING
Readline has input pending due to a call to @code{rl_execute_next()}.
@item RL_STATE_TTYCSAVED
Readline has saved the values of the terminal's special characters.
@item RL_STATE_CALLBACK
Readline is currently using the alternate (callback) interface
(@pxref{Alternate Interface}).
@item RL_STATE_VIMOTION
Readline is reading the argument to a vi-mode "motion" command.
@item RL_STATE_MULTIKEY
Readline is reading a multiple-keystroke command.
@item RL_STATE_VICMDONCE
Readline has entered vi command (movement) mode at least one time during
the current call to @code{readline()}.
@item RL_STATE_DONE
Readline has read a key sequence bound to @code{accept-line}
and is about to return the line to the caller.
@@ -793,7 +812,8 @@ Print the names of all bindable Readline functions to @code{rl_outstream}.
@deftypefun {const char **} rl_funmap_names (void)
Return a NULL terminated array of known function names. The array is
sorted. The array itself is allocated, but not the strings inside. You
should @code{free()} the array when you are done, but not the pointers.
should free the array, but not the pointers, using @code{free} or
@code{rl_free} when you are done.
@end deftypefun
@deftypefun int rl_add_funmap_entry (const char *name, rl_command_func_t *function)
@@ -1077,6 +1097,26 @@ environment variable is used.
@node Utility Functions
@subsection Utility Functions
@deftypefun int rl_save_state (struct readline_state *sp)
Save a snapshot of Readline's internal state to @var{sp}.
The contents of the @var{readline_state} structure are documented
in @file{readline.h}.
The caller is responsible for allocating the structure.
@end deftypefun
@deftypefun int rl_restore_state (struct readline_state *sp)
Restore Readline's internal state to that stored in @var{sp}, which must
have been saved by a call to @code{rl_save_state}.
The contents of the @var{readline_state} structure are documented
in @file{readline.h}.
The caller is responsible for freeing the structure.
@end deftypefun
@deftypefun void rl_free (void *mem)
Deallocate the memory pointed to by @var{mem}. @var{mem} must have been
allocated by @code{malloc}.
@end deftypefun
@deftypefun void rl_replace_line (const char *text, int clear_undo)
Replace the contents of @code{rl_line_buffer} with @var{text}.
The point and mark are preserved, if possible.
@@ -1084,7 +1124,7 @@ If @var{clear_undo} is non-zero, the undo list associated with the
current line is cleared.
@end deftypefun
@deftypefun int rl_extend_line_buffer (int len)
@deftypefun void rl_extend_line_buffer (int len)
Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
characters, possibly reallocating it if necessary.
@end deftypefun
@@ -1394,6 +1434,13 @@ call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force
Readline to update its idea of the terminal size when a @code{SIGWINCH}
is received.
@deftypefun void rl_echo_signal_char (int sig)
If an application wishes to install its own signal handlers, but still
have readline display characters that generate signals, calling this
function with @var{sig} set to @code{SIGINT}, @code{SIGQUIT}, or
@code{SIGTSTP} will display the character generating that signal.
@end deftypefun
@deftypefun void rl_resize_terminal (void)
Update Readline's internal screen size by reading values from the kernel.
@end deftypefun
@@ -1827,6 +1874,15 @@ if the application's completion function returns no matches.
It should be set only by an application's completion function.
@end deftypevar
@deftypevar int rl_sort_completion_matches
If an application sets this variable to 0, Readline will not sort the
list of completions (which implies that it cannot remove any duplicate
completions). The default value is 1, which means that Readline will
sort the completions and, depending on the value of
@code{rl_ignore_completion_duplicates}, will attempt to remove duplicate
matches.
@end deftypevar
@deftypevar int rl_completion_type
Set to a character describing the type of completion Readline is currently
attempting; see the description of @code{rl_complete_internal()}
@@ -1836,6 +1892,13 @@ completion function is called, allowing such functions to present
the same interface as @code{rl_complete()}.
@end deftypevar
@deftypevar int rl_completion_invoking_key
Set to the final character in the key sequence that invoked one of the
completion functions that call @code{rl_complete_internal()}. This is
set to the appropriate value before any application-specific completion
function is called.
@end deftypevar
@deftypevar int rl_inhibit_completion
If this variable is non-zero, completion is inhibited. The completion
character will be inserted as any other bound to @code{self-insert}.
@@ -1856,27 +1919,51 @@ history list.
GNU Readline library. This application interactively allows users
to manipulate files and their modes. */
#include <stdio.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/file.h>
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
#endif
#include <sys/stat.h>
#include <sys/errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#if defined (HAVE_STRING_H)
# include <string.h>
#else /* !HAVE_STRING_H */
# include <strings.h>
#endif /* !HAVE_STRING_H */
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <time.h>
#include <readline/readline.h>
#include <readline/history.h>
extern char *xmalloc ();
extern char *xmalloc PARAMS((size_t));
/* The names of functions that actually do the manipulation. */
int com_list __P((char *));
int com_view __P((char *));
int com_rename __P((char *));
int com_stat __P((char *));
int com_pwd __P((char *));
int com_delete __P((char *));
int com_help __P((char *));
int com_cd __P((char *));
int com_quit __P((char *));
int com_list PARAMS((char *));
int com_view PARAMS((char *));
int com_rename PARAMS((char *));
int com_stat PARAMS((char *));
int com_pwd PARAMS((char *));
int com_delete PARAMS((char *));
int com_help PARAMS((char *));
int com_cd PARAMS((char *));
int com_quit PARAMS((char *));
/* A structure which contains information on the commands this program
can understand. */
@@ -1909,12 +1996,12 @@ COMMAND *find_command ();
/* The name of this program, as taken from argv[0]. */
char *progname;
/* When non-zero, this means the user is done using this program. */
/* When non-zero, this global means the user is done using this program. */
int done;
char *
dupstr (s)
int s;
char *s;
@{
char *r;
@@ -2039,12 +2126,12 @@ stripwhite (string)
/* */
/* **************************************************************** */
char *command_generator __P((const char *, int));
char **fileman_completion __P((const char *, int, int));
char *command_generator PARAMS((const char *, int));
char **fileman_completion PARAMS((const char *, int, int));
/* Tell the GNU Readline library how to complete. We want to try to
complete on command names if this is the first word in the line, or
on filenames if not. */
/* Tell the GNU Readline library how to complete. We want to try to complete
on command names if this is the first word in the line, or on filenames
if not. */
initialize_readline ()
@{
/* Allow conditional parsing of the ~/.inputrc file. */
@@ -2054,11 +2141,11 @@ initialize_readline ()
rl_attempted_completion_function = fileman_completion;
@}
/* Attempt to complete on the contents of TEXT. START and END
bound the region of rl_line_buffer that contains the word to
complete. TEXT is the word to complete. We can use the entire
contents of rl_line_buffer in case we want to do some simple
parsing. Returnthe array of matches, or NULL if there aren't any. */
/* Attempt to complete on the contents of TEXT. START and END bound the
region of rl_line_buffer that contains the word to complete. TEXT is
the word to complete. We can use the entire contents of rl_line_buffer
in case we want to do some simple parsing. Return the array of matches,
or NULL if there aren't any. */
char **
fileman_completion (text, start, end)
const char *text;
@@ -2077,9 +2164,9 @@ fileman_completion (text, start, end)
return (matches);
@}
/* Generator function for command completion. STATE lets us
know whether to start from scratch; without any state
(i.e. STATE == 0), then we start at the top of the list. */
/* Generator function for command completion. STATE lets us know whether
to start from scratch; without any state (i.e. STATE == 0), then we
start at the top of the list. */
char *
command_generator (text, state)
const char *text;
@@ -2088,17 +2175,16 @@ command_generator (text, state)
static int list_index, len;
char *name;
/* If this is a new word to complete, initialize now. This
includes saving the length of TEXT for efficiency, and
initializing the index variable to 0. */
/* If this is a new word to complete, initialize now. This includes
saving the length of TEXT for efficiency, and initializing the index
variable to 0. */
if (!state)
@{
list_index = 0;
len = strlen (text);
@}
/* Return the next name which partially matches from the
command list. */
/* Return the next name which partially matches from the command list. */
while (name = commands[list_index].name)
@{
list_index++;
@@ -2138,7 +2224,12 @@ com_view (arg)
if (!valid_argument ("view", arg))
return 1;
#if defined (__MSDOS__)
/* more.com doesn't grok slashes in pathnames */
sprintf (syscom, "less %s", arg);
#else
sprintf (syscom, "more %s", arg);
#endif
return (system (syscom));
@}
@@ -2165,7 +2256,8 @@ com_stat (arg)
printf ("Statistics for `%s':\n", arg);
printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
printf ("%s has %d link%s, and is %d byte%s in length.\n",
arg,
finfo.st_nlink,
(finfo.st_nlink == 1) ? "" : "s",
finfo.st_size,
@@ -2254,8 +2346,7 @@ com_pwd (ignore)
return 0;
@}
/* The user wishes to quit using this program. Just set DONE
non-zero. */
/* The user wishes to quit using this program. Just set DONE non-zero. */
com_quit (arg)
char *arg;
@{
@@ -2268,13 +2359,12 @@ too_dangerous (caller)
char *caller;
@{
fprintf (stderr,
"%s: Too dangerous for me to distribute.\n",
"%s: Too dangerous for me to distribute. Write it yourself.\n",
caller);
fprintf (stderr, "Write it yourself.\n");
@}
/* Return non-zero if ARG is a valid argument for CALLER,
else print an error message and return zero. */
/* Return non-zero if ARG is a valid argument for CALLER, else print
an error message and return zero. */
int
valid_argument (caller, arg)
char *caller, *arg;

View File

@@ -1,7 +1,6 @@
@comment %**start of header (This is for running Texinfo on a region.)
@setfilename rluser.info
@comment %**end of header (This is for running Texinfo on a region.)
@setchapternewpage odd
@ignore
This file documents the end user interface to the GNU command line
@@ -10,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the
GNU Readline Library.
Copyright (C) 1988-2006 Free Software Foundation, Inc.
Copyright (C) 1988--2009 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@@ -48,6 +47,16 @@ command line editing interface.
@ifset BashFeatures
Command line editing is provided by the Readline library, which is
used by several different programs, including Bash.
Command line editing is enabled by default when using an interactive shell,
unless the @option{--noediting} option is supplied at shell invocation.
Line editing is also used when using the @option{-e} option to the
@code{read} builtin command (@pxref{Bash Builtins}).
By default, the line editing commands are similar to those of emacs.
A vi-style line editing interface is also available.
Line editing can be enabled at any time using the @option{-o emacs} or
@option{-o vi} options to the @code{set} builtin command
(@pxref{The Set Builtin}), or disabled using the @option{+o emacs} or
@option{+o vi} options to @code{set}.
@end ifset
@menu
@@ -427,6 +436,13 @@ If set to @samp{on}, Readline performs filename matching and completion
in a case-insensitive fashion.
The default value is @samp{off}.
@item completion-prefix-display-length
@vindex completion-prefix-display-length
The length in characters of the common prefix of a list of possible
completions that is displayed without modification. When set to a
value greater than zero, common prefixes longer than this value are
replaced with an ellipsis when displaying possible completions.
@item completion-query-items
@vindex completion-query-items
The number of possible completions that determines when the user is
@@ -471,10 +487,16 @@ attempts word completion. The default is @samp{off}.
@item history-preserve-point
@vindex history-preserve-point
If set to @samp{on}, the history code attempts to place point at the
If set to @samp{on}, the history code attempts to place the point (the
current cursor position) at the
same location on each history line retrieved with @code{previous-history}
or @code{next-history}. The default is @samp{off}.
@item history-size
@vindex history-size
Set the maximum number of history entries saved in the history list. If
set to zero, the number of entries in the history list is not limited.
@item horizontal-scroll-mode
@vindex horizontal-scroll-mode
This variable can be set to either @samp{on} or @samp{off}. Setting it
@@ -558,6 +580,13 @@ If set to @samp{on}, Readline will display completions with matches
sorted horizontally in alphabetical order, rather than down the screen.
The default is @samp{off}.
@item revert-all-at-newline
@vindex revert-all-at-newline
If set to @samp{on}, Readline will undo all changes to history lines
before returning when @code{accept-line} is executed. By default,
history lines may be modified and retain individual undo lists across
calls to @code{readline}. The default is @samp{off}.
@item show-all-if-ambiguous
@vindex show-all-if-ambiguous
This alters the default behavior of the completion functions. If
@@ -941,12 +970,22 @@ Move forward a character.
Move back a character.
@item forward-word (M-f)
Move forward to the end of the next word. Words are composed of
letters and digits.
Move forward to the end of the next word.
Words are composed of letters and digits.
@item backward-word (M-b)
Move back to the start of the current or previous word. Words are
composed of letters and digits.
Move back to the start of the current or previous word.
Words are composed of letters and digits.
@ifset BashFeatures
@item shell-forward-word ()
Move forward to the end of the next word.
Words are delimited by non-quoted shell metacharacters.
@item shell-backward-word ()
Move back to the start of the current or previous word.
Words are delimited by non-quoted shell metacharacters.
@end ifset
@item clear-screen (C-l)
Clear the screen and redraw the current line,
@@ -1142,6 +1181,17 @@ Word boundaries are the same as @code{forward-word}.
Kill the word behind point.
Word boundaries are the same as @code{backward-word}.
@ifset BashFeatures
@item shell-kill-word ()
Kill from point to the end of the current word, or if between
words, to the end of the next word.
Word boundaries are the same as @code{shell-forward-word}.
@item backward-kill-word ()
Kill the word behind point.
Word boundaries are the same as @code{shell-backward-word}.
@end ifset
@item unix-word-rubout (C-w)
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
@@ -1297,6 +1347,11 @@ Attempt completion on the text before point, comparing
the text against lines from the history list for possible
completion matches.
@item dabbrev-expand ()
Attempt menu completion on the text before point, comparing
the text against lines from the history list for possible
completion matches.
@item complete-into-braces (M-@{)
Perform filename completion and insert the list of possible completions
enclosed within braces so the list is available to the shell
@@ -1559,9 +1614,9 @@ completed, and the matching words become the possible completions.
After these matches have been generated, any shell function or command
specified with the @option{-F} and @option{-C} options is invoked.
When the command or function is invoked, the @env{COMP_LINE} and
@env{COMP_POINT} variables are assigned values as described above
(@pxref{Bash Variables}).
When the command or function is invoked, the @env{COMP_LINE},
@env{COMP_POINT}, @env{COMP_KEY}, and @env{COMP_TYPE} variables are
assigned values as described above (@pxref{Bash Variables}).
If a shell function is being invoked, the @env{COMP_WORDS} and
@env{COMP_CWORD} variables are also set.
When the function or command is invoked, the first argument is the
@@ -1574,7 +1629,7 @@ the matches.
Any function specified with @option{-F} is invoked first.
The function may use any of the shell facilities, including the
@code{compgen} builtin described below
@code{compgen} and @code{compopt} builtins described below
(@pxref{Programmable Completion Builtins}), to generate the matches.
It must put the possible completions in the @env{COMPREPLY} array
variable.
@@ -1661,10 +1716,10 @@ matches were generated.
@item complete
@btindex complete
@example
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}]
[-C @var{command}] @var{name} [@var{name} @dots{}]}
@code{complete -pr [@var{name} @dots{}]}
@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-E] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
[-F @var{function}] [-C @var{command}] [-X @var{filterpat}]
[-P @var{prefix}] [-S @var{suffix}] @var{name} [@var{name} @dots{}]}
@code{complete -pr [-E] [@var{name} @dots{}]}
@end example
Specify how arguments to each @var{name} should be completed.
@@ -1674,6 +1729,9 @@ reused as input.
The @option{-r} option removes a completion specification for
each @var{name}, or, if no @var{name}s are supplied, all
completion specifications.
The @option{-E} option indicates that the remaining options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The process of applying these completion specifications when word completion
is attempted is described above (@pxref{Programmable Completion}).
@@ -1706,9 +1764,10 @@ Perform directory name completion if the compspec generates no matches.
@item filenames
Tell Readline that the compspec generates filenames, so it can perform any
filename-specific processing (like adding a slash to directory names or
suppressing trailing spaces). This option is intended to be used with
shell functions specified with @option{-F}.
filename-specific processing (like adding a slash to directory names
quoting special characters, or suppressing trailing spaces).
This option is intended to be used with shell functions specified
with @option{-F}.
@item nospace
Tell Readline not to append a space (the default) to words completed at
@@ -1846,5 +1905,23 @@ argument, an attempt is made to remove a completion specification for
a @var{name} for which no specification exists, or
an error occurs adding a completion specification.
@item compopt
@btindex compopt
@example
@code{compopt} [-o @var{option}] [+o @var{option}] [@var{name}]
@end example
Modify completion options for each @var{name} according to the
@var{option}s, or for the currently-execution completion if no @var{name}s
are supplied.
If no @var{option}s are given, display the completion options for each
@var{name} or the current completion.
The possible values of @var{option} are those valid for the @code{complete}
builtin described above.
The return value is true unless an invalid option is supplied, an attempt
is made to modify the options for a @var{name} for which no completion
specification exists, or an output error occurs.
@end table
@end ifset

View File

@@ -4,8 +4,6 @@
@settitle GNU Readline Library
@comment %**end of header (This is for running Texinfo on a region.)
@setchapternewpage odd
@include version.texi
@copying
@@ -14,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988-2006 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2009 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -24,13 +22,14 @@ are preserved on all copies.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
and with the Back-Cover Texts as in (a) below. A copy of the license is
included in the section entitled ``GNU Free Documentation License.''
included in the section entitled ``GNU Free Documentation License''.
(a) The FSF's Back-Cover Text is: You are free to copy and modify
this GNU manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
this GNU Manual, like GNU software. Copies published by the Free
Software Foundation raise funds for GNU development.''
@end quotation
@end copying
@@ -70,18 +69,14 @@ programs which provide a command line interface.
@menu
* Command Line Editing:: GNU Readline User's Manual.
* Copying This Manual:: Copying This Manual.
* GNU Free Documentation License:: License for copying this manual.
@end menu
@end ifnottex
@include rluser.texi
@node Copying This Manual
@appendix Copying This Manual
@menu
* GNU Free Documentation License:: License for copying this manual.
@end menu
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include fdl.texi

View File

@@ -1,10 +1,10 @@
@ignore
Copyright (C) 1988-2006 Free Software Foundation, Inc.
Copyright (C) 1988-2009 Free Software Foundation, Inc.
@end ignore
@set EDITION 5.2
@set VERSION 5.2
@set UPDATED 26 April 2006
@set UPDATED-MONTH April 2006
@set EDITION 6.0
@set VERSION 6.0
@set UPDATED 28 October 2008
@set UPDATED-MONTH October 2008
@set LASTCHANGE Wed Apr 26 09:22:57 EDT 2006
@set LASTCHANGE Tue Oct 28 11:25:24 EDT 2008

View File

@@ -1,24 +1,23 @@
/* emacs_keymap.c -- the keymap for emacs_mode in readline (). */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (BUFSIZ)
#include <stdio.h>

View File

@@ -4,21 +4,21 @@
# on which program is running, or what terminal is active.
#
# Copyright (C) 1989-2002 Free Software Foundation, Inc.
# Copyright (C) 1989-2009 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 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.
# 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/>.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
# In all programs, all terminals, make sure this is bound.
"\C-x\C-r": re-read-init-file

View File

@@ -2,19 +2,19 @@
#
# Copyright (C) 1994 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
# 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/>.
#
EXECUTABLES = fileman rltest rl
CFLAGS = -g -I../.. -I.. -DREADLINE_LIBRARY

View File

@@ -1,22 +1,23 @@
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* fileman.c - file manager example for readline library. */
This file is part of the GNU Readline Library, a library for
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
/* fileman.c -- A tiny application which demonstrates how to use the
GNU Readline library. This application interactively allows users
@@ -50,6 +51,8 @@
# include <stdlib.h>
#endif
#include <time.h>
#ifdef READLINE_LIBRARY
# include "readline.h"
# include "history.h"
@@ -58,7 +61,7 @@
# include <readline/history.h>
#endif
extern char *xmalloc ();
extern char *xmalloc PARAMS((size_t));
/* The names of functions that actually do the manipulation. */
int com_list PARAMS((char *));

View File

@@ -1,22 +1,23 @@
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* histexamp.c - history library example program. */
This file is part of the GNU Readline Library, a library for
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>

View File

@@ -1,24 +1,23 @@
/* manexamp.c -- The examples which appear in the documentation are here. */
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <readline/readline.h>

View File

@@ -5,25 +5,24 @@
* usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
*/
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined (HAVE_CONFIG_H)
# include <config.h>

View File

@@ -4,25 +4,24 @@
* usage: rlcat
*/
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined (HAVE_CONFIG_H)
# include <config.h>

View File

@@ -4,25 +4,24 @@
/* */
/* **************************************************************** */
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined (HAVE_CONFIG_H)
#include <config.h>

View File

@@ -1,24 +1,24 @@
/* funmap.c -- attach names to functions. */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -56,7 +56,7 @@ static int funmap_entry;
program specific function. */
int funmap_program_specific_entry_start;
static FUNMAP default_funmap[] = {
static const FUNMAP default_funmap[] = {
{ "abort", rl_abort },
{ "accept-line", rl_newline },
{ "arrow-key-prefix", rl_arrow_keys },

View File

@@ -1,24 +1,23 @@
/* histexpand.c -- history expansion. */
/* Copyright (C) 1989-2004 Free Software Foundation, Inc.
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
The Library is free software; you can redistribute it and/or modify
History 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
History 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with History. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
@@ -64,9 +63,11 @@ static int subst_lhs_len;
static int subst_rhs_len;
static char *get_history_word_specifier PARAMS((char *, char *, int *));
static char *history_find_word PARAMS((char *, int));
static int history_tokenize_word PARAMS((const char *, int));
static char **history_tokenize_internal PARAMS((const char *, int, int *));
static char *history_substring PARAMS((const char *, int, int));
static void freewords PARAMS((char **, int));
static char *history_find_word PARAMS((char *, int));
static char *quote_breaks PARAMS((char *));
@@ -1569,6 +1570,18 @@ history_tokenize (string)
return (history_tokenize_internal (string, -1, (int *)NULL));
}
/* Free members of WORDS from START to an empty string */
static void
freewords (words, start)
char **words;
int start;
{
register int i;
for (i = start; words[i]; i++)
free (words[i]);
}
/* Find and return the word which contains the character at index IND
in the history line LINE. Used to save the word matched by the
last history !?string? search. */
@@ -1582,12 +1595,16 @@ history_find_word (line, ind)
words = history_tokenize_internal (line, ind, &wind);
if (wind == -1 || words == 0)
return ((char *)NULL);
{
if (words)
freewords (words, 0);
FREE (words);
return ((char *)NULL);
}
s = words[wind];
for (i = 0; i < wind; i++)
free (words[i]);
for (i = wind + 1; words[i]; i++)
free (words[i]);
freewords (words, wind + 1);
free (words);
return s;
}

View File

@@ -1,24 +1,23 @@
/* histfile.c - functions to manipulate the history file. */
/* Copyright (C) 1989-2003 Free Software Foundation, Inc.
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
The Library is free software; you can redistribute it and/or modify
History 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
History 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with History. If not, see <http://www.gnu.org/licenses/>.
*/
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@@ -53,7 +52,9 @@
# include <unistd.h>
#endif
#if defined (__EMX__) || defined (__CYGWIN__)
#include <ctype.h>
#if defined (__EMX__)
# undef HAVE_MMAP
#endif
@@ -103,7 +104,7 @@ int history_write_timestamps = 0;
/* Does S look like the beginning of a history timestamp entry? Placeholder
for more extensive tests. */
#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char)
#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((s)[1]) )
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the

View File

@@ -1,23 +1,23 @@
/* histlib.h -- internal definitions for the history library. */
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
The Library is free software; you can redistribute it and/or modify
History 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
History 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with History. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_HISTLIB_H_)
#define _HISTLIB_H_

View File

@@ -1,24 +1,23 @@
/* history.c -- standalone history library */
/* Copyright (C) 1989-2005 Free Software Foundation, Inc.
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
The Library is free software; you can redistribute it and/or modify
History 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
History 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with History. If not, see <http://www.gnu.org/licenses/>.
*/
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@@ -158,7 +157,7 @@ history_set_pos (pos)
return (1);
}
/* Return the current history array. The caller has to be carefull, since this
/* Return the current history array. The caller has to be careful, since this
is the actual array of data, and could be bashed or made corrupt easily.
The array is terminated with a NULL pointer. */
HIST_ENTRY **
@@ -319,6 +318,8 @@ add_history_time (string)
{
HIST_ENTRY *hs;
if (string == 0)
return;
hs = the_history[history_length - 1];
FREE (hs->timestamp);
hs->timestamp = savestring (string);
@@ -483,7 +484,7 @@ stifle_history (max)
/* Stop stifling the history. This returns the previous maximum
number of history entries. The value is positive if the history
was stifled, negative if it wasn't. */
was stifled, negative if it wasn't. */
int
unstifle_history ()
{

View File

@@ -1,23 +1,23 @@
/* history.h -- the names of functions that you can call in history. */
/* Copyright (C) 1989-2003 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
The Library is free software; you can redistribute it and/or modify
History 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
History 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with History. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _HISTORY_H_
#define _HISTORY_H_

View File

@@ -1,24 +1,23 @@
/* histsearch.c -- searching the history list. */
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
/* Copyright (C) 1989, 1992-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (the Library), a set of
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
The Library is free software; you can redistribute it and/or modify
History 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
History 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with History. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY

View File

@@ -1,24 +1,24 @@
/* input.c -- character input functions for readline. */
/* Copyright (C) 1994-2005 Free Software Foundation, Inc.
/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (__TANDEM)
@@ -358,7 +358,7 @@ _rl_insert_typein (c)
string[i] = '\0';
rl_insert_text (string);
free (string);
xfree (string);
}
/* Add KEY to the buffer of characters to be read. Returns 1 if the

View File

@@ -1,29 +1,30 @@
/* isearch.c - incremental searching */
/* **************************************************************** */
/* */
/* I-Search and Searching */
/* */
/* **************************************************************** */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>.
*/
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -75,7 +76,7 @@ static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
static char *last_isearch_string;
static int last_isearch_string_len;
static char *default_isearch_terminators = "\033\012";
static char * const default_isearch_terminators = "\033\012";
_rl_search_cxt *
_rl_scxt_alloc (type, flags)
@@ -125,7 +126,7 @@ _rl_scxt_dispose (cxt, flags)
FREE (cxt->allocated_line);
FREE (cxt->lines);
free (cxt);
xfree (cxt);
}
/* Search backwards through the history looking for a string which is typed
@@ -192,7 +193,7 @@ rl_display_search (search_string, reverse_p, where)
strcpy (message + msglen, "': ");
rl_message ("%s", message);
free (message);
xfree (message);
(*rl_redisplay_function) ();
}

View File

@@ -1,23 +1,24 @@
/* keymaps.c -- Functions and keymaps for the GNU Readline library. */
/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
/* Copyright (C) 1988,1989-2009 Free Software Foundation, Inc.
This file is part of GNU Readline, a library for reading lines
of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline 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.
Readline 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.
Readline 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.
Readline 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 Readline; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)

View File

@@ -2,23 +2,22 @@
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KEYMAPS_H_
#define _KEYMAPS_H_

View File

@@ -2,23 +2,23 @@
/* Copyright (C) 1994 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -115,7 +115,7 @@ _rl_copy_to_kill_ring (text, append)
if (slot == rl_max_kills)
{
register int i;
free (rl_kill_ring[0]);
xfree (rl_kill_ring[0]);
for (i = 0; i < slot; i++)
rl_kill_ring[i] = rl_kill_ring[i + 1];
}
@@ -146,7 +146,7 @@ _rl_copy_to_kill_ring (text, append)
strcpy (new, text);
strcat (new, old);
}
free (old);
xfree (old);
free (text);
rl_kill_ring[slot] = new;
}
@@ -686,7 +686,7 @@ rl_paste_from_clipboard (count, key)
_rl_set_mark_at_pos (rl_point);
rl_insert_text (ptr);
if (ptr != data)
free (ptr);
xfree (ptr);
CloseClipboard ();
}
return (0);

View File

@@ -1,24 +1,24 @@
/* macro.c -- keyboard macros for readline. */
/* Copyright (C) 1994 Free Software Foundation, Inc.
/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -152,7 +152,7 @@ _rl_pop_executing_macro ()
rl_executing_macro = macro_list->string;
executing_macro_index = macro_list->sindex;
macro_list = macro_list->next;
free (macro);
xfree (macro);
}
if (rl_executing_macro == 0)
@@ -181,7 +181,7 @@ _rl_kill_kbd_macro ()
{
if (current_macro)
{
free (current_macro);
xfree (current_macro);
current_macro = (char *) NULL;
}
current_macro_size = current_macro_index = 0;

View File

@@ -1,24 +1,24 @@
/* mbutil.c -- readline multibyte character utility functions */
/* Copyright (C) 2001-2005 Free Software Foundation, Inc.
/* Copyright (C) 2001-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -91,8 +91,9 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
return seed;
point = seed + _rl_adjust_point (string, seed, &ps);
/* if this is true, means that seed was not pointed character
started byte. So correct the point and consume count */
/* if this is true, means that seed was not pointing to a byte indicating
the beginning of a multibyte character. Correct the point and consume
one char. */
if (seed < point)
count--;
@@ -101,7 +102,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps);
if (MB_INVALIDCH ((size_t)tmp))
{
/* invalid bytes. asume a byte represents a character */
/* invalid bytes. assume a byte represents a character */
point++;
count--;
/* reset states. */
@@ -128,12 +129,10 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
if (find_non_zero)
{
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
while (tmp > 0 && wcwidth (wc) == 0)
while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && wcwidth (wc) == 0)
{
point += tmp;
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp))
break;
}
}

View File

@@ -1,24 +1,24 @@
/* misc.c -- miscellaneous bindable readline functions. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -431,6 +431,56 @@ rl_replace_from_history (entry, flags)
rl_mark = rl_end;
}
#endif
}
/* Process and free undo lists attached to each history entry prior to the
current entry, inclusive, reverting each line to its saved state. This
is destructive, and state about the current line is lost. This is not
intended to be called while actively editing, and the current line is
not assumed to have been added to the history list. */
void
_rl_revert_all_lines ()
{
int hpos;
HIST_ENTRY *entry;
UNDO_LIST *ul, *saved_undo_list;
char *lbuf;
lbuf = savestring (rl_line_buffer);
saved_undo_list = rl_undo_list;
hpos = where_history ();
entry = (hpos == history_length) ? previous_history () : current_history ();
while (entry)
{
if (ul = (UNDO_LIST *)entry->data)
{
if (ul == saved_undo_list)
saved_undo_list = 0;
/* Set up rl_line_buffer and other variables from history entry */
rl_replace_from_history (entry, 0); /* entry->line is now current */
/* Undo all changes to this history entry */
while (rl_undo_list)
rl_do_undo ();
/* And copy the reverted line back to the history entry, preserving
the timestamp. */
FREE (entry->line);
entry->line = savestring (rl_line_buffer);
entry->data = 0;
}
entry = previous_history ();
}
/* Restore history state */
rl_undo_list = saved_undo_list; /* may have been set to null */
history_set_pos (hpos);
/* reset the line buffer */
rl_replace_line (lbuf, 0);
_rl_set_the_line ();
/* and clean up */
free (lbuf);
}
/* **************************************************************** */
@@ -560,7 +610,7 @@ rl_vi_editing_mode (count, key)
#if defined (VI_MODE)
_rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */
rl_editing_mode = vi_mode;
rl_vi_insertion_mode (1, key);
rl_vi_insert_mode (1, key);
#endif /* VI_MODE */
return 0;

View File

@@ -1,24 +1,24 @@
/* nls.c -- skeletal internationalization code. */
/* Copyright (C) 1996 Free Software Foundation, Inc.
/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)

View File

@@ -1,24 +1,24 @@
/* parens.c -- Implementation of matching parentheses feature. */
/* parens.c -- implementation of matching parentheses feature. */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
/* Copyright (C) 1987, 1989, 1992-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (__TANDEM)

View File

@@ -4,19 +4,19 @@
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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.
Bash 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.
Bash 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.
Bash 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 Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
/* This file should be included instead of <dirent.h> or <sys/dir.h>. */

View File

@@ -4,19 +4,19 @@
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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.
Bash 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.
Bash 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.
Bash 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 Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _POSIXJMP_H_
#define _POSIXJMP_H_

View File

@@ -5,19 +5,19 @@
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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.
Bash 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.
Bash 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.
Bash 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 Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
/* This file should be included instead of <sys/stat.h>.
It relies on the local sys/stat.h to work though. */

View File

@@ -1,25 +1,25 @@
/* readline.c -- a general facility for reading lines of input
with emacs style editing and completion. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -163,7 +163,7 @@ int rl_done;
rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL;
/* Top level environment for readline_internal (). */
procenv_t readline_top_level;
procenv_t _rl_top_level;
/* The streams we interact with. */
FILE *_rl_in_stream, *_rl_out_stream;
@@ -176,7 +176,7 @@ FILE *rl_outstream = (FILE *)NULL;
set to 1 if there is a controlling terminal, we can get its attributes,
and the attributes include `echo'. Look at rltty.c:prepare_terminal_settings
for the code that sets it. */
int readline_echoing_p = 0;
int _rl_echoing_p = 0;
/* Current prompt. */
char *rl_prompt = (char *)NULL;
@@ -270,6 +270,11 @@ int _rl_output_meta_chars = 0;
them to equivalent readline functions at startup. */
int _rl_bind_stty_chars = 1;
/* Non-zero means to go through the history list at every newline (or
whenever rl_done is set and readline returns) and revert each line to
its initial state. */
int _rl_revert_all_at_newline = 0;
/* **************************************************************** */
/* */
/* Top Level Functions */
@@ -300,6 +305,9 @@ readline (prompt)
const char *prompt;
{
char *value;
#if 0
int in_callback;
#endif
/* If we are at EOF return a NULL string. */
if (rl_pending_input == EOF)
@@ -308,6 +316,15 @@ readline (prompt)
return ((char *)NULL);
}
#if 0
/* If readline() is called after installing a callback handler, temporarily
turn off the callback state to avoid ensuing messiness. Patch supplied
by the gdb folks. XXX -- disabled. This can be fooled and readline
left in a strange state by a poorly-timed longjmp. */
if (in_callback = RL_ISSTATE (RL_STATE_CALLBACK))
RL_UNSETSTATE (RL_STATE_CALLBACK);
#endif
rl_set_prompt (prompt);
rl_initialize ();
@@ -326,6 +343,11 @@ readline (prompt)
rl_clear_signals ();
#endif
#if 0
if (in_callback)
RL_SETSTATE (RL_STATE_CALLBACK);
#endif
return (value);
}
@@ -349,7 +371,7 @@ readline_internal_setup ()
/* If we're not echoing, we still want to at least print a prompt, because
rl_redisplay will not do it for us. If the calling application has a
custom redisplay function, though, let that function handle it. */
if (readline_echoing_p == 0 && rl_redisplay_function == rl_redisplay)
if (_rl_echoing_p == 0 && rl_redisplay_function == rl_redisplay)
{
if (rl_prompt && rl_already_prompted == 0)
{
@@ -370,7 +392,7 @@ readline_internal_setup ()
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
rl_vi_insertion_mode (1, 'i');
rl_vi_insert_mode (1, 'i');
#endif /* VI_MODE */
if (rl_pre_input_hook)
@@ -399,6 +421,9 @@ readline_internal_teardown (eof)
free (temp);
}
if (_rl_revert_all_at_newline)
_rl_revert_all_lines ();
/* At any rate, it is highly likely that this line has an undo list. Get
rid of it now. */
if (rl_undo_list)
@@ -459,7 +484,7 @@ readline_internal_charloop ()
#endif
lk = _rl_last_command_was_kill;
code = setjmp (readline_top_level);
code = setjmp (_rl_top_level);
if (code)
{
@@ -467,7 +492,7 @@ readline_internal_charloop ()
_rl_want_redisplay = 0;
/* If we get here, we're not being called from something dispatched
from _rl_callback_read_char(), which sets up its own value of
readline_top_level (saving and restoring the old, of course), so
_rl_top_level (saving and restoring the old, of course), so
we can just return here. */
if (RL_ISSTATE (RL_STATE_CALLBACK))
return (0);

View File

@@ -1,24 +1,23 @@
/* Readline.h -- the names of functions callable from within readline. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_READLINE_H_)
#define _READLINE_H_
@@ -40,9 +39,9 @@ extern "C" {
#endif
/* Hex-encoded Readline version number. */
#define RL_READLINE_VERSION 0x0502 /* Readline 5.2 */
#define RL_VERSION_MAJOR 5
#define RL_VERSION_MINOR 2
#define RL_READLINE_VERSION 0x0600 /* Readline 6.0 */
#define RL_VERSION_MAJOR 6
#define RL_VERSION_MINOR 0
/* Readline data structures. */
@@ -233,6 +232,7 @@ extern int rl_vi_append_mode PARAMS((int, int));
extern int rl_vi_append_eol PARAMS((int, int));
extern int rl_vi_eof_maybe PARAMS((int, int));
extern int rl_vi_insertion_mode PARAMS((int, int));
extern int rl_vi_insert_mode PARAMS((int, int));
extern int rl_vi_movement_mode PARAMS((int, int));
extern int rl_vi_arg_digit PARAMS((int, int));
extern int rl_vi_change_case PARAMS((int, int));
@@ -420,6 +420,7 @@ extern int rl_set_keyboard_input_timeout PARAMS((int));
extern void rl_extend_line_buffer PARAMS((int));
extern int rl_ding PARAMS((void));
extern int rl_alphabetic PARAMS((int));
extern void rl_free PARAMS((void *));
/* Readline signal handling, from signals.c */
extern int rl_set_signals PARAMS((void));
@@ -427,7 +428,9 @@ extern int rl_clear_signals PARAMS((void));
extern void rl_cleanup_after_signal PARAMS((void));
extern void rl_reset_after_signal PARAMS((void));
extern void rl_free_line_state PARAMS((void));
extern void rl_echo_signal_char PARAMS((int));
extern int rl_set_paren_blink_timeout PARAMS((int));
/* Undocumented. */
@@ -493,6 +496,10 @@ extern const char *rl_readline_name;
readline (), and should not be assigned to directly. */
extern char *rl_prompt;
/* The prompt string that is actually displayed by rl_redisplay. Public so
applications can more easily supply their own redisplay functions. */
extern char *rl_display_prompt;
/* The line buffer that is in use. */
extern char *rl_line_buffer;
@@ -599,6 +606,10 @@ extern int rl_catch_sigwinch;
filename completer. */
extern rl_compentry_func_t *rl_completion_entry_function;
/* Optional generator for menu completion. Default is
rl_completion_entry_function (rl_filename_completion_function). */
extern rl_compentry_func_t *rl_menu_completion_entry_function;
/* If rl_ignore_some_completions_function is non-NULL it is the address
of a function to call after all of the possible matches have been
generated, but before the actual completion is done to the input line.
@@ -713,6 +724,9 @@ extern int rl_attempted_completion_over;
functions. */
extern int rl_completion_type;
/* Set to the last key used to invoke one of the completion functions */
extern int rl_completion_invoking_key;
/* Up to this many items will be displayed in response to a
possible-completions call. After that, we ask the user if she
is sure she wants to see them all. The default value is 100. */
@@ -739,6 +753,9 @@ extern int rl_completion_found_quote;
application-specific completion function. */
extern int rl_completion_suppress_quote;
/* If non-zero, readline will sort the completion matches. On by default. */
extern int rl_sort_completion_matches;
/* If non-zero, a slash will be appended to completed filenames that are
symbolic links to directory names, subject to the value of the
mark-directories variable (which is user-settable). This exists so

View File

@@ -1,25 +1,23 @@
/* rlconf.h -- readline configuration definitions */
/* Copyright (C) 1994 Free Software Foundation, Inc.
/* Copyright (C) 1992-2009 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RLCONF_H_)
#define _RLCONF_H_

View File

@@ -2,26 +2,24 @@
for readline. This should be included after any files that define
system-specific constants like _POSIX_VERSION or USG. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RLDEFS_H_)
#define _RLDEFS_H_
@@ -32,6 +30,10 @@
#include "rlstdc.h"
#if defined (STRCOLL_BROKEN)
# undef HAVE_STRCOLL
#endif
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
# define TERMIOS_TTY_DRIVER
#else

View File

@@ -1,24 +1,23 @@
/* rlmbutil.h -- utility functions for multibyte characters. */
/* Copyright (C) 2001 Free Software Foundation, Inc.
/* Copyright (C) 2001-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_MBUTIL_H_)
#define _RL_MBUTIL_H_

View File

@@ -1,25 +1,24 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999-2005 Free Software Foundation, Inc.
/* Copyright (C) 1999-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_PRIVATE_H_)
#define _RL_PRIVATE_H_
@@ -28,6 +27,16 @@
#include "rlstdc.h"
#include "posixjmp.h" /* defines procenv_t */
/*************************************************************************
* *
* Convenience definitions *
* *
*************************************************************************/
#define EMACS_MODE() (rl_editing_mode == emacs_mode)
#define VI_COMMAND_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
#define VI_INSERT_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_insertion_keymap)
/*************************************************************************
* *
* Global structs undocumented in texinfo manual and not in readline.h *
@@ -139,12 +148,9 @@ extern int rl_visible_stats;
extern int rl_line_buffer_len;
extern int rl_arg_sign;
extern int rl_visible_prompt_length;
extern int readline_echoing_p;
extern int rl_key_sequence_length;
extern int rl_byte_oriented;
extern _rl_keyseq_cxt *_rl_kscxt;
/* display.c */
extern int rl_display_fixed;
@@ -206,6 +212,7 @@ extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
/* bind.c */
/* complete.c */
extern void _rl_reset_completion_state PARAMS((void));
extern char _rl_find_completion_word PARAMS((int *, int *));
extern void _rl_free_match_list PARAMS((char **));
@@ -261,6 +268,8 @@ extern void _rl_start_using_history PARAMS((void));
extern int _rl_free_saved_history_line PARAMS((void));
extern void _rl_set_insert_mode PARAMS((int, int));
extern void _rl_revert_all_lines PARAMS((void));
/* nls.c */
extern int _rl_init_eightbit PARAMS((void));
@@ -281,6 +290,10 @@ extern int _rl_restore_tty_signals PARAMS((void));
/* search.c */
extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
/* signals.c */
extern void _rl_block_sigint PARAMS((void));
extern void _rl_release_sigint PARAMS((void));
/* terminal.c */
extern void _rl_get_screen_size PARAMS((int, int));
extern int _rl_init_terminal_io PARAMS((const char *));
@@ -314,6 +327,18 @@ extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
/* util.c */
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern void _rl_ttymsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_errmsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_trace (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern void _rl_ttymsg ();
extern void _rl_errmsg ();
extern void _rl_trace ();
#endif
extern int _rl_tropen PARAMS((void));
extern int _rl_abort_internal PARAMS((void));
extern char *_rl_strindex PARAMS((const char *, const char *));
extern int _rl_qsort_string_compare PARAMS((char **, char **));
@@ -337,8 +362,8 @@ extern void _rl_vi_done_inserting PARAMS((void));
*************************************************************************/
/* bind.c */
extern const char *_rl_possible_control_prefixes[];
extern const char *_rl_possible_meta_prefixes[];
extern const char * const _rl_possible_control_prefixes[];
extern const char * const _rl_possible_meta_prefixes[];
/* callback.c */
extern _rl_callback_func_t *_rl_callback_func;
@@ -349,6 +374,7 @@ extern int _rl_complete_show_all;
extern int _rl_complete_show_unmodified;
extern int _rl_complete_mark_directories;
extern int _rl_complete_mark_symlink_dirs;
extern int _rl_completion_prefix_display_length;
extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_match_hidden_files;
@@ -359,7 +385,6 @@ extern int _rl_vis_botlin;
extern int _rl_last_c_pos;
extern int _rl_suppress_redisplay;
extern int _rl_want_redisplay;
extern char *rl_display_prompt;
/* isearch.c */
extern char *_rl_isearch_terminators;
@@ -376,6 +401,7 @@ extern int _rl_history_saved_point;
extern _rl_arg_cxt _rl_argcxt;
/* readline.c */
extern int _rl_echoing_p;
extern int _rl_horizontal_scroll_mode;
extern int _rl_mark_modified_lines;
extern int _rl_bell_preference;
@@ -383,6 +409,7 @@ extern int _rl_meta_flag;
extern int _rl_convert_meta_chars_to_ascii;
extern int _rl_output_meta_chars;
extern int _rl_bind_stty_chars;
extern int _rl_revert_all_at_newline;
extern char *_rl_comment_begin;
extern unsigned char _rl_parsing_conditionalized_out;
extern Keymap _rl_keymap;
@@ -390,11 +417,19 @@ extern FILE *_rl_in_stream;
extern FILE *_rl_out_stream;
extern int _rl_last_command_was_kill;
extern int _rl_eof_char;
extern procenv_t readline_top_level;
extern procenv_t _rl_top_level;
extern _rl_keyseq_cxt *_rl_kscxt;
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
/* signals.c */
extern int _rl_echoctl;
extern int _rl_intr_char;
extern int _rl_quit_char;
extern int _rl_susp_char;
/* terminal.c */
extern int _rl_enable_keypad;
extern int _rl_enable_meta;

View File

@@ -1,24 +1,23 @@
/* rlshell.h -- utility functions normally provided by bash. */
/* Copyright (C) 1999 Free Software Foundation, Inc.
/* Copyright (C) 1999-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_SHELL_H_)
#define _RL_SHELL_H_

View File

@@ -1,23 +1,23 @@
/* stdc.h -- macros to make source compile on both ANSI C and K&R C
compilers. */
/* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. */
/* Copyright (C) 1993 Free Software Foundation, Inc.
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Bash 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.
Readline 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.
Bash 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.
Readline 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 Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RL_STDC_H_)
#define _RL_STDC_H_

View File

@@ -3,23 +3,23 @@
/* Copyright (C) 1992-2005 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -52,75 +52,8 @@ extern int errno;
rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
static void block_sigint PARAMS((void));
static void release_sigint PARAMS((void));
static void set_winsize PARAMS((int));
/* **************************************************************** */
/* */
/* Signal Management */
/* */
/* **************************************************************** */
#if defined (HAVE_POSIX_SIGNALS)
static sigset_t sigint_set, sigint_oset;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
static int sigint_oldmask;
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
static int sigint_blocked;
/* Cause SIGINT to not be delivered until the corresponding call to
release_sigint(). */
static void
block_sigint ()
{
if (sigint_blocked)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&sigint_set);
sigemptyset (&sigint_oset);
sigaddset (&sigint_set, SIGINT);
sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
sigint_oldmask = sigblock (sigmask (SIGINT));
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sighold (SIGINT);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigint_blocked = 1;
}
/* Allow SIGINT to be delivered. */
static void
release_sigint ()
{
if (sigint_blocked == 0)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
#else
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (sigint_oldmask);
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sigrelse (SIGINT);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigint_blocked = 0;
}
/* **************************************************************** */
/* */
/* Saving and Restoring the TTY */
@@ -204,8 +137,9 @@ save_tty_chars (tiop)
if (tiop->flags & TCHARS_SET)
{
_rl_tty_chars.t_intr = tiop->tchars.t_intrc;
_rl_tty_chars.t_quit = tiop->tchars.t_quitc;
_rl_intr_char = _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
_rl_quit_char = _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
_rl_tty_chars.t_start = tiop->tchars.t_startc;
_rl_tty_chars.t_stop = tiop->tchars.t_stopc;
_rl_tty_chars.t_eof = tiop->tchars.t_eofc;
@@ -215,7 +149,8 @@ save_tty_chars (tiop)
if (tiop->flags & LTCHARS_SET)
{
_rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
_rl_susp_char = _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
_rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
_rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
_rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
@@ -268,7 +203,7 @@ set_tty_settings (tty, tiop)
ioctl (tty, TIOCSETN, &(tiop->sgttyb));
tiop->flags &= ~SGTTY_SET;
}
readline_echoing_p = 1;
_rl_echoing_p = 1;
#if defined (TIOCLSET)
if (tiop->flags & LFLAG_SET)
@@ -302,7 +237,8 @@ prepare_terminal_settings (meta_flag, oldtio, tiop)
int meta_flag;
TIOTYPE oldtio, *tiop;
{
readline_echoing_p = (oldtio.sgttyb.sg_flags & ECHO);
_rl_echoing_p = (oldtio.sgttyb.sg_flags & ECHO);
_rl_echoctl = (oldtio.sgttyb.sg_flags & ECHOCTL);
/* Copy the original settings to the structure we're going to use for
our settings. */
@@ -433,10 +369,10 @@ save_tty_chars (tiop)
#ifdef VREPRINT
_rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
#endif
_rl_tty_chars.t_intr = tiop->c_cc[VINTR];
_rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
_rl_intr_char = _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
_rl_quit_char = _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
#ifdef VSUSP
_rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
_rl_susp_char = _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
#endif
#ifdef VDSUSP
_rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
@@ -464,7 +400,7 @@ static void
rltty_warning (msg)
char *msg;
{
fprintf (stderr, "readline: warning: %s\n", msg);
_rl_errmsg ("warning: %s", msg);
}
#endif
@@ -475,7 +411,7 @@ TIOTYPE *tp;
{
if ((tp->c_oflag & OPOST) == 0)
{
rltty_warning ("turning on OPOST for terminal\r");
_rl_errmsg ("warning: turning on OPOST for terminal\r");
tp->c_oflag |= OPOST|ONLCR;
}
}
@@ -500,8 +436,8 @@ _get_tty_settings (tty, tiop)
}
if (OUTPUT_BEING_FLUSHED (tiop))
{
#if defined (FLUSHO) && defined (_AIX41)
rltty_warning ("turning off output flushing");
#if defined (FLUSHO)
_rl_errmsg ("warning: turning off output flushing");
tiop->c_lflag &= ~FLUSHO;
break;
#else
@@ -580,7 +516,8 @@ prepare_terminal_settings (meta_flag, oldtio, tiop)
int meta_flag;
TIOTYPE oldtio, *tiop;
{
readline_echoing_p = (oldtio.c_lflag & ECHO);
_rl_echoing_p = (oldtio.c_lflag & ECHO);
_rl_echoctl = (oldtio.c_lflag & ECHOCTL);
tiop->c_lflag &= ~(ICANON | ECHO);
@@ -643,7 +580,7 @@ void
rl_prep_terminal (meta_flag)
int meta_flag;
{
readline_echoing_p = 1;
_rl_echoing_p = 1;
}
void
@@ -663,20 +600,22 @@ rl_prep_terminal (meta_flag)
return;
/* Try to keep this function from being INTerrupted. */
block_sigint ();
_rl_block_sigint ();
tty = fileno (rl_instream);
if (get_tty_settings (tty, &tio) < 0)
{
#if defined (ENOTSUP)
/* MacOS X, at least, lies about the value of errno if tcgetattr fails. */
if (errno == ENOTTY || errno == ENOTSUP)
/* MacOS X and Linux, at least, lie about the value of errno if
tcgetattr fails. */
if (errno == ENOTTY || errno == EINVAL || errno == ENOTSUP)
#else
if (errno == ENOTTY)
if (errno == ENOTTY || errno == EINVAL)
#endif
readline_echoing_p = 1; /* XXX */
release_sigint ();
_rl_echoing_p = 1; /* XXX */
_rl_release_sigint ();
return;
}
@@ -711,7 +650,7 @@ rl_prep_terminal (meta_flag)
if (set_tty_settings (tty, &tio) < 0)
{
release_sigint ();
_rl_release_sigint ();
return;
}
@@ -722,7 +661,7 @@ rl_prep_terminal (meta_flag)
terminal_prepped = 1;
RL_SETSTATE(RL_STATE_TERMPREPPED);
release_sigint ();
_rl_release_sigint ();
}
/* Restore the terminal's normal settings and modes. */
@@ -735,7 +674,7 @@ rl_deprep_terminal ()
return;
/* Try to keep this function from being interrupted. */
block_sigint ();
_rl_block_sigint ();
tty = fileno (rl_instream);
@@ -746,14 +685,14 @@ rl_deprep_terminal ()
if (set_tty_settings (tty, &otio) < 0)
{
release_sigint ();
_rl_release_sigint ();
return;
}
terminal_prepped = 0;
RL_UNSETSTATE(RL_STATE_TERMPREPPED);
release_sigint ();
_rl_release_sigint ();
}
#endif /* !NO_TTY_DRIVER */
@@ -862,7 +801,7 @@ set_special_char (kmap, tiop, sc, func)
}
#define RESET_SPECIAL(c) \
if (c != -1 && kmap[(unsigned char)c].type == ISFUNC)
if (c != -1 && kmap[(unsigned char)c].type == ISFUNC) \
kmap[(unsigned char)c].function = rl_insert;
static void

View File

@@ -1,25 +1,23 @@
/* rltty.h - tty driver-related definitions used by some library files. */
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995-2009 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RLTTY_H_)
#define _RLTTY_H_

View File

@@ -1,24 +1,23 @@
/* rltypedefs.h -- Type declarations for readline functions. */
/* Copyright (C) 2000-2004 Free Software Foundation, Inc.
/* Copyright (C) 2000-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RL_TYPEDEFS_H_
#define _RL_TYPEDEFS_H_

View File

@@ -1,26 +1,24 @@
/* rlwinsize.h -- an attempt to isolate some of the system-specific defines
for `struct winsize' and TIOCGWINSZ. */
/* Copyright (C) 1997 Free Software Foundation, Inc.
/* Copyright (C) 1997-2009 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RLWINSIZE_H_)
#define _RLWINSIZE_H_
@@ -53,5 +51,8 @@
# endif /* HAVE_SYS_PTE_H */
#endif /* !STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
#endif /* _RL_WINSIZE_H */
#if defined (M_UNIX) && !defined (_SCO_DS) && !defined (tcflow)
# define tcflow(fd, action) ioctl(fd, TCXONC, action)
#endif
#endif /* _RL_WINSIZE_H */

View File

@@ -1,24 +1,24 @@
/* savestring.c */
/* savestring.c - function version of savestring for backwards compatibility */
/* Copyright (C) 1998,2003 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#include <config.h>

View File

@@ -1,25 +1,24 @@
/* search.c - code for non-incremental searching in emacs and vi modes. */
/* Copyright (C) 1992-2005 Free Software Foundation, Inc.
/* Copyright (C) 1992-2009 Free Software Foundation, Inc.
This file is part of the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>.
*/
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)

View File

@@ -1,25 +1,25 @@
/* shell.c -- readline utility functions that are normally provided by
bash when readline is linked as part of the shell. */
/* Copyright (C) 1997 Free Software Foundation, Inc.
/* Copyright (C) 1997-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)

View File

@@ -1,24 +1,24 @@
/* signals.c -- signal handling support for readline. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -40,13 +40,14 @@
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL */
#if defined (HANDLE_SIGNALS)
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#if defined (HANDLE_SIGNALS)
#if !defined (RETSIGTYPE)
# if defined (VOID_SIGHANDLER)
# define RETSIGTYPE void
@@ -93,6 +94,14 @@ int rl_catch_sigwinch = 1;
int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
#endif
/* Private variables. */
/* If non-zero, print characters corresponding to received signals. */
int _rl_echoctl = 0;
int _rl_intr_char = 0;
int _rl_quit_char = 0;
int _rl_susp_char = 0;
static int signals_set_flag;
static int sigwinch_set_flag;
@@ -142,6 +151,7 @@ rl_signal_handler (sig)
switch (sig)
{
case SIGINT:
_rl_reset_completion_state ();
rl_free_line_state ();
/* FALLTHROUGH */
@@ -157,6 +167,7 @@ rl_signal_handler (sig)
#if defined (SIGQUIT)
case SIGQUIT:
#endif
rl_echo_signal_char (sig);
rl_cleanup_after_signal ();
#if defined (HAVE_POSIX_SIGNALS)
@@ -252,7 +263,11 @@ rl_set_sighandler (sig, handler, ohandler)
struct sigaction act;
act.sa_handler = handler;
# if defined (SIGWINCH)
act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
# else
act.sa_flags = 0;
# endif /* SIGWINCH */
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
sigaction (sig, &act, &old_handler);
@@ -300,7 +315,7 @@ rl_set_signals ()
sigemptyset (&bset);
sigaddset (&bset, SIGINT);
sigaddset (&bset, SIGINT);
sigaddset (&bset, SIGTERM);
#if defined (SIGQUIT)
sigaddset (&bset, SIGQUIT);
#endif
@@ -464,3 +479,105 @@ rl_free_line_state ()
}
#endif /* HANDLE_SIGNALS */
/* **************************************************************** */
/* */
/* SIGINT Management */
/* */
/* **************************************************************** */
#if defined (HAVE_POSIX_SIGNALS)
static sigset_t sigint_set, sigint_oset;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
static int sigint_oldmask;
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
static int sigint_blocked;
/* Cause SIGINT to not be delivered until the corresponding call to
release_sigint(). */
void
_rl_block_sigint ()
{
if (sigint_blocked)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&sigint_set);
sigemptyset (&sigint_oset);
sigaddset (&sigint_set, SIGINT);
sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
sigint_oldmask = sigblock (sigmask (SIGINT));
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sighold (SIGINT);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigint_blocked = 1;
}
/* Allow SIGINT to be delivered. */
void
_rl_release_sigint ()
{
if (sigint_blocked == 0)
return;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
#else
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (sigint_oldmask);
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sigrelse (SIGINT);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigint_blocked = 0;
}
/* **************************************************************** */
/* */
/* Echoing special control characters */
/* */
/* **************************************************************** */
void
rl_echo_signal_char (sig)
int sig;
{
char cstr[3];
int cslen, c;
if (_rl_echoctl == 0)
return;
switch (sig)
{
case SIGINT: c = _rl_intr_char; break;
case SIGQUIT: c = _rl_quit_char; break;
case SIGTSTP: c = _rl_susp_char; break;
default: return;
}
if (CTRL_CHAR (c) || c == RUBOUT)
{
cstr[0] = '^';
cstr[1] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
cstr[cslen = 2] = '\0';
}
else
{
cstr[0] = c;
cstr[cslen = 1] = '\0';
}
_rl_output_some_chars (cstr, cslen);
}

View File

@@ -1,25 +1,23 @@
/* tcap.h -- termcap library functions and variables. */
/* Copyright (C) 1996 Free Software Foundation, Inc.
/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
for it.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_RLTCAP_H_)
#define _RLTCAP_H_

View File

@@ -1,24 +1,24 @@
/* terminal.c -- controlling the terminal with termcap. */
/* Copyright (C) 1996-2006 Free Software Foundation, Inc.
/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -350,7 +350,7 @@ rl_reset_screen_size ()
void
rl_resize_terminal ()
{
if (readline_echoing_p)
if (_rl_echoing_p)
{
_rl_get_screen_size (fileno (rl_instream), 1);
if (CUSTOM_REDISPLAY_FUNC ())
@@ -361,13 +361,13 @@ rl_resize_terminal ()
}
struct _tc_string {
const char *tc_var;
const char * const tc_var;
char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
search algorithm to something smarter. */
static struct _tc_string tc_strings[] =
static const struct _tc_string tc_strings[] =
{
{ "@7", &_rl_term_at7 },
{ "DC", &_rl_term_DC },
@@ -641,10 +641,10 @@ _rl_backspace (count)
int
rl_crlf ()
{
#if defined (NEW_TTY_DRIVER)
#if defined (NEW_TTY_DRIVER) || defined (__MINT__)
if (_rl_term_cr)
tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif /* NEW_TTY_DRIVER */
#endif /* NEW_TTY_DRIVER || __MINT__ */
putc ('\n', _rl_out_stream);
return 0;
}
@@ -653,7 +653,7 @@ rl_crlf ()
int
rl_ding ()
{
if (readline_echoing_p)
if (_rl_echoing_p)
{
switch (_rl_bell_preference)
{

View File

@@ -1,24 +1,24 @@
/* text.c -- text handling commands for readline. */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -260,7 +260,7 @@ rl_forward_byte (count, key)
{
int end = rl_point + count;
#if defined (VI_MODE)
int lend = rl_end > 0 ? rl_end - (rl_editing_mode == vi_mode) : rl_end;
int lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
#else
int lend = rl_end;
#endif
@@ -296,10 +296,16 @@ rl_forward_char (count, key)
if (count > 0)
{
if (rl_point == rl_end && EMACS_MODE())
{
rl_ding ();
return 0;
}
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
#if defined (VI_MODE)
if (rl_end <= point && rl_editing_mode == vi_mode)
if (point >= rl_end && VI_COMMAND_MODE())
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
#endif
@@ -943,7 +949,7 @@ rl_newline (count, key)
if (rl_erase_empty_line && rl_point == 0 && rl_end == 0)
return 0;
if (readline_echoing_p)
if (_rl_echoing_p)
_rl_update_final ();
return 0;
}

View File

@@ -1,23 +1,23 @@
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
/* Copyright (C) 1988-2009 Free Software Foundation, Inc.
This file is part of GNU Readline, a library for reading lines
of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline 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.
Readline 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.
Readline 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.
Readline 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 Readline; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined (HAVE_CONFIG_H)
# include <config.h>
@@ -236,7 +236,7 @@ tilde_expand (string)
string += end;
expansion = tilde_expand_word (tilde_word);
free (tilde_word);
xfree (tilde_word);
len = strlen (expansion);
#ifdef __CYGWIN__
@@ -251,7 +251,7 @@ tilde_expand (string)
strcpy (result + result_index, expansion);
result_index += len;
}
free (expansion);
xfree (expansion);
}
result[result_index] = '\0';
@@ -377,7 +377,7 @@ tilde_expand_word (filename)
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
free (username);
xfree (username);
free (expansion);
return (dirname);
}
@@ -414,7 +414,7 @@ tilde_expand_word (filename)
dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
#endif
free (username);
xfree (username);
#if defined (HAVE_GETPWENT)
endpwent ();
#endif

View File

@@ -1,25 +1,24 @@
/* tilde.h: Externally available variables and function in libtilde.a. */
/* Copyright (C) 1992 Free Software Foundation, Inc.
/* Copyright (C) 1992-2009 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
This file contains the Readline Library (Readline), a set of
routines for providing Emacs style line input to programs that ask
for it.
The Library is free software; you can redistribute it and/or modify
Readline 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.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Library 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.
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_TILDE_H_)
# define _TILDE_H_

View File

@@ -1,25 +1,25 @@
/* readline.c -- a general facility for reading lines of input
with emacs style editing and completion. */
/* Copyright (C) 1987, 1989, 1992, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -116,7 +116,7 @@ rl_free_undo_list ()
if (release->what == UNDO_DELETE)
free (release->text);
free (release);
xfree (release);
}
rl_undo_list = (UNDO_LIST *)NULL;
replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
@@ -171,7 +171,7 @@ rl_do_undo ()
start = end = waiting_for_begin = 0;
do
{
if (!rl_undo_list)
if (rl_undo_list == 0)
return (0);
_rl_doing_an_undo = 1;
@@ -221,7 +221,7 @@ rl_do_undo ()
rl_undo_list = rl_undo_list->next;
replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
free (release);
xfree (release);
}
while (waiting_for_begin);
@@ -291,7 +291,7 @@ int
rl_revert_line (count, key)
int count, key;
{
if (!rl_undo_list)
if (rl_undo_list == 0)
rl_ding ();
else
{

View File

@@ -1,24 +1,24 @@
/* util.c -- readline utility functions */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -66,7 +66,7 @@
in words, or 1 if it is. */
int _rl_allow_pathname_alphabetic_chars = 0;
static const char *pathname_alphabetic_chars = "/-_=~.#$";
static const char * const pathname_alphabetic_chars = "/-_=~.#$";
int
rl_alphabetic (c)
@@ -109,7 +109,7 @@ _rl_abort_internal ()
_rl_pop_executing_macro ();
rl_last_func = (rl_command_func_t *)NULL;
longjmp (readline_top_level, 1);
longjmp (_rl_top_level, 1);
return (0);
}
@@ -185,6 +185,7 @@ rl_tilde_expand (ignore, key)
{
homedir = tilde_expand ("~");
_rl_replace_text (homedir, start, end);
xfree (homedir);
return (0);
}
else if (rl_line_buffer[start] != '~')
@@ -212,14 +213,96 @@ rl_tilde_expand (ignore, key)
strncpy (temp, rl_line_buffer + start, len);
temp[len] = '\0';
homedir = tilde_expand (temp);
free (temp);
xfree (temp);
_rl_replace_text (homedir, start, end);
xfree (homedir);
}
return (0);
}
#if defined (USE_VARARGS)
void
#if defined (PREFER_STDARG)
_rl_ttymsg (const char *format, ...)
#else
_rl_ttymsg (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
rl_forced_update_display ();
}
void
#if defined (PREFER_STDARG)
_rl_errmsg (const char *format, ...)
#else
_rl_errmsg (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
}
#else /* !USE_VARARGS */
void
_rl_ttymsg (format, arg1, arg2)
char *format;
{
fprintf (stderr, "readline: ");
fprintf (stderr, format, arg1, arg2);
fprintf (stderr, "\n");
rl_forced_update_display ();
}
void
_rl_errmsg (format, arg1, arg2)
char *format;
{
fprintf (stderr, "readline: ");
fprintf (stderr, format, arg1, arg2);
fprintf (stderr, "\n");
}
#endif /* !USE_VARARGS */
/* **************************************************************** */
/* */
/* String Utility Functions */
@@ -344,6 +427,16 @@ FUNCTION_FOR_MACRO (_rl_to_lower)
FUNCTION_FOR_MACRO (_rl_to_upper)
FUNCTION_FOR_MACRO (_rl_uppercase_p)
/* A convenience function, to force memory deallocation to be performed
by readline. DLLs on Windows apparently require this. */
void
rl_free (mem)
void *mem;
{
if (mem)
free (mem);
}
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
#undef _rl_savestring
@@ -353,3 +446,60 @@ _rl_savestring (s)
{
return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s)));
}
#if defined (USE_VARARGS)
static FILE *_rl_tracefp;
void
#if defined (PREFER_STDARG)
_rl_trace (const char *format, ...)
#else
_rl_trace (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
if (_rl_tracefp == 0)
_rl_tropen ();
vfprintf (_rl_tracefp, format, args);
fprintf (_rl_tracefp, "\n");
fflush (_rl_tracefp);
va_end (args);
}
int
_rl_tropen ()
{
char fnbuf[128];
if (_rl_tracefp)
fclose (_rl_tracefp);
sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid());
unlink(fnbuf);
_rl_tracefp = fopen (fnbuf, "w+");
return _rl_tracefp != 0;
}
int
_rl_trclose ()
{
int r;
r = fclose (_rl_tracefp);
_rl_tracefp = 0;
return r;
}
#endif

View File

@@ -1,24 +1,23 @@
/* vi_keymap.c -- the keymap for vi_mode in readline (). */
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (BUFSIZ)
#include <stdio.h>
@@ -151,7 +150,7 @@ KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
{ ISFUNC, rl_vi_char_search }, /* f */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* g */
{ ISFUNC, rl_backward_char }, /* h */
{ ISFUNC, rl_vi_insertion_mode }, /* i */
{ ISFUNC, rl_vi_insert_mode }, /* i */
{ ISFUNC, rl_get_next_history }, /* j */
{ ISFUNC, rl_get_previous_history }, /* k */
{ ISFUNC, rl_forward_char }, /* l */

View File

@@ -1,25 +1,25 @@
/* vi_mode.c -- A vi emulation mode for Bash.
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
/* **************************************************************** */
@@ -69,7 +69,7 @@ int _rl_vi_last_command = 'i'; /* default `.' puts you in insert mode */
static int _rl_vi_doing_insert;
/* Command keys which do movement for xxx_to commands. */
static const char *vi_motion = " hl^$0ftFT;,%wbeWBE|";
static const char * const vi_motion = " hl^$0ftFT;,%wbeWBE|`";
/* Keymap used for vi replace characters. Created dynamically since
rarely used. */
@@ -101,7 +101,7 @@ static int _rl_vi_last_key_before_insert;
static int vi_redoing;
/* Text modification commands. These are the `redoable' commands. */
static const char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
static const char * const vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
/* Arrays for the saved marks. */
static int vi_mark_chars['z' - 'a' + 1];
@@ -211,6 +211,15 @@ rl_vi_redo (count, c)
if (rl_point > 0)
_rl_vi_backup ();
}
/* Ditto for redoing an insert with `I', but move to the beginning of the
line like the `I' command does. */
else if (_rl_vi_last_command == 'I' && vi_insert_buffer && *vi_insert_buffer)
{
rl_beg_of_line (1, 'I');
_rl_vi_stuff_insert (count);
if (rl_point > 0)
_rl_vi_backup ();
}
/* Ditto for redoing an insert with `a', but move forward a character first
like the `a' command does. */
else if (_rl_vi_last_command == 'a' && vi_insert_buffer && *vi_insert_buffer)
@@ -220,6 +229,15 @@ rl_vi_redo (count, c)
if (rl_point > 0)
_rl_vi_backup ();
}
/* Ditto for redoing an insert with `A', but move to the end of the line
like the `A' command does. */
else if (_rl_vi_last_command == 'A' && vi_insert_buffer && *vi_insert_buffer)
{
rl_end_of_line (1, 'A');
_rl_vi_stuff_insert (count);
if (rl_point > 0)
_rl_vi_backup ();
}
else
r = _rl_dispatch (_rl_vi_last_command, _rl_keymap);
vi_redoing = 0;
@@ -584,7 +602,7 @@ rl_vi_insert_beg (count, key)
int count, key;
{
rl_beg_of_line (1, key);
rl_vi_insertion_mode (1, key);
rl_vi_insert_mode (1, key);
return (0);
}
@@ -647,6 +665,14 @@ rl_vi_insertion_mode (count, key)
return (0);
}
int
rl_vi_insert_mode (count, key)
int count, key;
{
rl_vi_start_inserting (key, 1, rl_arg_sign);
return (0);
}
static void
_rl_vi_save_insert (up)
UNDO_LIST *up;
@@ -690,7 +716,10 @@ _rl_vi_done_inserting ()
}
else
{
if ((_rl_vi_last_key_before_insert == 'i' || _rl_vi_last_key_before_insert == 'a') && rl_undo_list)
if (rl_undo_list && (_rl_vi_last_key_before_insert == 'i' ||
_rl_vi_last_key_before_insert == 'a' ||
_rl_vi_last_key_before_insert == 'I' ||
_rl_vi_last_key_before_insert == 'A'))
_rl_vi_save_insert (rl_undo_list);
/* XXX - Other keys probably need to be checked. */
else if (_rl_vi_last_key_before_insert == 'C')
@@ -1045,13 +1074,15 @@ int
rl_vi_delete_to (count, key)
int count, key;
{
int c;
int c, start_pos;
if (_rl_uppercase_p (key))
rl_stuff_char ('$');
else if (vi_redoing)
rl_stuff_char (_rl_vi_last_motion);
start_pos = rl_point;
if (rl_vi_domove (key, &c))
{
rl_ding ();
@@ -1060,7 +1091,8 @@ rl_vi_delete_to (count, key)
/* These are the motion commands that do not require adjusting the
mark. */
if ((strchr (" l|h^0bB", c) == 0) && (rl_mark < rl_end))
if (((strchr (" l|h^0bBFT`", c) == 0) && (rl_point >= start_pos)) &&
(rl_mark < rl_end))
rl_mark++;
rl_kill_text (rl_point, rl_mark);
@@ -1089,7 +1121,8 @@ rl_vi_change_to (count, key)
/* These are the motion commands that do not require adjusting the
mark. c[wW] are handled by special-case code in rl_vi_domove(),
and already leave the mark at the correct location. */
if ((strchr (" l|hwW^0bB", c) == 0) && (rl_mark < rl_end))
if (((strchr (" l|hwW^0bBFT`", c) == 0) && (rl_point >= start_pos)) &&
(rl_mark < rl_end))
rl_mark++;
/* The cursor never moves with c[wW]. */
@@ -1124,12 +1157,13 @@ int
rl_vi_yank_to (count, key)
int count, key;
{
int c, save;
int c, start_pos;
save = rl_point;
if (_rl_uppercase_p (key))
rl_stuff_char ('$');
start_pos = rl_point;
if (rl_vi_domove (key, &c))
{
rl_ding ();
@@ -1138,14 +1172,15 @@ rl_vi_yank_to (count, key)
/* These are the motion commands that do not require adjusting the
mark. */
if ((strchr (" l|h^0%bB", c) == 0) && (rl_mark < rl_end))
if (((strchr (" l|h^0%bBFT`", c) == 0) && (rl_point >= start_pos)) &&
(rl_mark < rl_end))
rl_mark++;
rl_begin_undo_group ();
rl_kill_text (rl_point, rl_mark);
rl_end_undo_group ();
rl_do_undo ();
rl_point = save;
rl_point = start_pos;
return (0);
}

View File

@@ -1,23 +1,24 @@
/* xmalloc.c -- safe versions of malloc and realloc */
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991-2009 Free Software Foundation, Inc.
This file is part of GNU Readline, a library for reading lines
of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
Readline 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.
Readline 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.
Readline 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.
Readline 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 Readline; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)

View File

@@ -1,24 +1,23 @@
/* xmalloc.h -- memory allocation that aborts on errors. */
/* Copyright (C) 1999 Free Software Foundation, Inc.
/* Copyright (C) 1999-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
The GNU Readline Library 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
Readline 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.
The GNU Readline Library 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
Readline 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.
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (_XMALLOC_H_)
#define _XMALLOC_H_