Revert "Sync readline/ to version 7.0 alpha"
This reverts commitb558ff043d
. This reverts commit4a11f20659
. The initial import commit failed to retain local changes made to readline's configure.in (and the commit message erroneously stated that there were no local changes that needed to be reapplied). Also the import caused a couple of build errors and a scattering of testsuite regressions throughout many arches. It's probably better to start over with this import, hopefully more carefully next time.
This commit is contained in:
parent
b8cc7b2e9a
commit
5836a818ec
98 changed files with 4552 additions and 10099 deletions
|
@ -1,8 +1,3 @@
|
|||
2015-07-25 Patrick Palka <patrick@parcs.ath.cx>
|
||||
|
||||
* completer.c (gdb_printable_part): Sync with readline function
|
||||
it is based off of.
|
||||
|
||||
2015-07-24 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* s390-linux-nat.c (fetch_regs, store_regs, fetch_fpregs)
|
||||
|
|
|
@ -1318,7 +1318,7 @@ gdb_printable_part (char *pathname)
|
|||
return (pathname);
|
||||
|
||||
temp = strrchr (pathname, '/');
|
||||
#if defined (__MSDOS__) || defined (_WIN32)
|
||||
#if defined (__MSDOS__)
|
||||
if (temp == 0 && ISALPHA ((unsigned char)pathname[0]) && pathname[1] == ':')
|
||||
temp = pathname + 1;
|
||||
#endif
|
||||
|
|
|
@ -14,12 +14,6 @@
|
|||
(GDB_PARALLEL handling): Make outputs,temp,cache directories as subdirs
|
||||
of $GDB_PARALLEL.
|
||||
|
||||
2015-07-25 Patrick Palka <patrick@parcs.ath.cx>
|
||||
|
||||
* gdb.gdb/selftest.exp (test_with_self): Update test to now
|
||||
expect the GDB inferior to no longer immediately stop after
|
||||
being resumed with "signal SIGINT".
|
||||
|
||||
2015-07-24 Doug Evans <dje@google.com>
|
||||
|
||||
* gdb.perf/README: New file.
|
||||
|
|
|
@ -444,26 +444,9 @@ proc test_with_self { executable } {
|
|||
}
|
||||
|
||||
set description "send SIGINT signal to child process"
|
||||
gdb_test_multiple "signal SIGINT" "$description" {
|
||||
-re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\nQuit\r\n.* $" {
|
||||
pass "$description"
|
||||
}
|
||||
}
|
||||
|
||||
set description "send ^C to child process again"
|
||||
send_gdb "\003"
|
||||
gdb_expect {
|
||||
-re "Program received signal SIGINT.*$gdb_prompt $" {
|
||||
pass "$description"
|
||||
}
|
||||
-re ".*$gdb_prompt $" {
|
||||
fail "$description"
|
||||
}
|
||||
timeout {
|
||||
fail "$description (timeout)"
|
||||
}
|
||||
}
|
||||
|
||||
gdb_test "signal SIGINT" \
|
||||
"Continuing with signal SIGINT.*" \
|
||||
"$description"
|
||||
|
||||
# get a stack trace
|
||||
#
|
||||
|
|
|
@ -1093,209 +1093,3 @@ xfree.c
|
|||
-----
|
||||
{examples,shlib}/Makefile.in
|
||||
- Cygwin-based changes from Eric Blake <eblake@redhat.com>
|
||||
|
||||
3/26/2011
|
||||
---------
|
||||
Makefile.in
|
||||
- don't ignore failures when building, installing, or cleaning in
|
||||
the shlib subdirectory. Sample patch from Mike Frysinger
|
||||
<vapier@gentoo.org>
|
||||
|
||||
shlib/Makefile.in
|
||||
- split the install and uninstall targets into install-supported and
|
||||
install-unsupported targets that depend on the value of
|
||||
SHLIB_STATUS
|
||||
|
||||
4/2
|
||||
---
|
||||
{,shlib}/Makefile.in
|
||||
- add dependency for callback.o/callback.so on xmalloc.h. From
|
||||
Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
{,doc,examples,shlib}/Makefile.in
|
||||
- fix typo: htm target should be html. From Jan Kratochvil
|
||||
<jan.kratochvil@redhat.com>
|
||||
- remove `.' from VPATH. From Jan Kratochvil
|
||||
<jan.kratochvil@redhat.com>
|
||||
|
||||
examples/rlfe/configure.in
|
||||
- quote AC_PROGRAM_SOURCE. From Jan Kratochvil
|
||||
<jan.kratochvil@redhat.com>
|
||||
|
||||
5/17
|
||||
----
|
||||
config.h.in
|
||||
- WCWIDTH_BROKEN: new define, picked up from bash, defined on systems
|
||||
where wcwidth returns 1 for Unicode combining characters
|
||||
|
||||
11/28
|
||||
-----
|
||||
support/shlib-install
|
||||
- make sure solaris2 systems make the installed shared library
|
||||
executable. ldd warns about it otherwise. Bug and fix from
|
||||
Tim Mooney <tim.mooney@ndsu.edu>
|
||||
|
||||
examples/hist_erasedups.c
|
||||
- new example program, shows how to erase duplicates from the history
|
||||
list
|
||||
|
||||
examples/hist_purgecmd.c
|
||||
- new example program, shows how to remove all entries matching a
|
||||
string or pattern from the history list
|
||||
|
||||
1/12/2012
|
||||
---------
|
||||
colors.[ch],parse-colors.[ch]}
|
||||
- new files, part of color infrastructure support
|
||||
|
||||
Makefile.in,shlib/Makefile.in
|
||||
- arrange to have colors.o and parse-colors.o added to library
|
||||
(static and shared versions)
|
||||
|
||||
{configure,config.h}.in
|
||||
- check for stdbool.h, define HAVE_STDBOOL_H if found
|
||||
|
||||
rldefs.h
|
||||
- COLOR_SUPPORT: if defined, compile in colors.c and parse-colors.c
|
||||
for color support
|
||||
|
||||
1/18
|
||||
----
|
||||
|
||||
{configure,config.h}.in
|
||||
- new check: check for AUDIT_USER_TTY defined in <linux/audit.h>,
|
||||
define HAVE_DECL_AUDIT_USER_TTY if both are found
|
||||
|
||||
8/7
|
||||
---
|
||||
configure.in
|
||||
- AC_CANONICAL_BUILD: call to set the build_xxx variables
|
||||
- use $build_os instead of $host_os to decide when DJGPP should run
|
||||
`pwd.exe' to figure out the build directory. Report and fix from
|
||||
Yao Qi <yao@codesourcery.com>
|
||||
|
||||
8/29
|
||||
----
|
||||
configure.ac
|
||||
- new name for configure.in
|
||||
|
||||
MANIFEST,Makefile.in
|
||||
- configure.in -> configure.ac
|
||||
|
||||
1/5/2013
|
||||
--------
|
||||
configure.ac
|
||||
- move version number up to 6.3
|
||||
|
||||
1/31
|
||||
----
|
||||
configure.ac
|
||||
- use AC_CHECK_TOOL instead of AC_CHECK_PROG to check for ar, since it
|
||||
will find $host-prefixed versions of utilities. Report and fix from
|
||||
Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
3/4
|
||||
---
|
||||
Makefile.in
|
||||
- PACKAGE_TARNAME, docdir: new variables substituted by autoconf
|
||||
- OTHER_DOCS,OTHER_INSTALLED_DOCS: new variables with auxiliary
|
||||
documentation files to be installed into $(docdir)
|
||||
- install: add new rule to install $(OTHER_DOCS)
|
||||
- uninstall: add new rule to uninstall $(docdir)/$(OTHER_INSTALLED_DOCS)
|
||||
|
||||
4/29
|
||||
----
|
||||
Makefile.in
|
||||
- installdirs: make sure to create $(DESTDIR)$(docdir). Report from
|
||||
<hiroo.hayashi@computer.org>
|
||||
|
||||
1/27/2014
|
||||
---------
|
||||
Makefile.in
|
||||
- install-examples: should not depend on `shared', since the examples
|
||||
themselves are not built using shared libraries. Report from
|
||||
<hiroo.hayashi@computer.org>
|
||||
|
||||
support/shobj-conf
|
||||
- [from bash] darwin: changed the install_name embedded into the
|
||||
shared library to contain only the major version number, not the
|
||||
minor one. The idea is that the minor versions should all be API/ABI
|
||||
compatible, and it is better to link automatically with the latest
|
||||
one. Idea from Max Horn <max@quendi.de>
|
||||
|
||||
2/26/2014
|
||||
---------
|
||||
[readline-6.3 released]
|
||||
|
||||
3/14
|
||||
----
|
||||
shlib/Makefile.in
|
||||
- fix typo in dependency list for vi_mode.so: it should not depend on
|
||||
just $(topdir). Report and fix from Natanael Copa
|
||||
<ncopa@alpinelinux.org>
|
||||
|
||||
4/15
|
||||
----
|
||||
{.,shlib,examples}/Makefile.in
|
||||
- make sure $(INCLUDES) appears before $(CPPFLAGS) in the various
|
||||
CFLAGS assignments so readline looks in its own source and build
|
||||
directories (INCLUDES) before some directories specified by the
|
||||
user or builder (CPPFLAGS). Report and fix from Max Horn
|
||||
<max@quendi.de>
|
||||
|
||||
6/2
|
||||
---
|
||||
config.h.in
|
||||
- use correct symbols: HAVE_STRUCT_DIRENT_D_INO, HAVE_STRUCT_DIRENT_D_FILENO
|
||||
HAVE_STRUCT_DIRENT_D_NAMLEN. They don't really matter, but they are
|
||||
what posixdir.h looks for. Report from Ross Burton <ross.burton@intel.com>
|
||||
|
||||
6/11
|
||||
----
|
||||
readline.pc.in
|
||||
- new file, config file for pkgconfig. Patch to add from Jirka Klimes
|
||||
<jklimes@redhat.com>
|
||||
|
||||
{MANIFEST,configure.ac,Makefile.in}
|
||||
- readline.pc: changes to create file for pkgconfig
|
||||
|
||||
10/13
|
||||
-----
|
||||
doc/Makefile.in
|
||||
- readline.pdf, history.pdf, rluserman.pdf: use texi2dvi --pdf to generate
|
||||
these. Suggestion from Siep Kroonenberg <siepo@cybercomm.nl>
|
||||
|
||||
11/29
|
||||
-----
|
||||
config.h.in
|
||||
- HAVE_PSELECT: define if pselect(2) available
|
||||
|
||||
configure.ac
|
||||
- check for pselect(2), define HAVE_PSELECT if found
|
||||
|
||||
12/29
|
||||
-----
|
||||
configure.ac
|
||||
- bump version number up to 6.4
|
||||
|
||||
1/6/2015
|
||||
--------
|
||||
configure.ac,config.h.in
|
||||
- look for ncurses/termcap.h, define HAVE_NCURSES_TERMCAP_H
|
||||
|
||||
4/20
|
||||
----
|
||||
configure.ac
|
||||
- add template definitions set by AC_USE_SYSTEM_EXTENSIONS from a report
|
||||
from Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
4/24
|
||||
----
|
||||
configure.ac,config.h.in
|
||||
- add check for sys/ioctl.h to AC_CHECK_HEADERS, define HAVE_SYS_IOCTL_H
|
||||
if found
|
||||
|
||||
5/29
|
||||
----
|
||||
configure.ac
|
||||
- bump library version to 7.0 because of addition of rl_callback_sigcleanup
|
||||
|
|
231
readline/CHANGES
231
readline/CHANGES
|
@ -1,234 +1,3 @@
|
|||
This document details the changes between this version, readline-7.0, and the
|
||||
previous version, readline-6.3.
|
||||
|
||||
1. Changes to Readline
|
||||
|
||||
a. A bug that caused vi-mode `.' to be unable to redo `c', `d', and `y'
|
||||
commands with modifiers was fixed.
|
||||
|
||||
b. Fixed a bug that caused callback mode to dump core when reading a
|
||||
multiple-key sequence (e.g., arrow keys).
|
||||
|
||||
c. Fixed a bug that caused the redisplay code to erase some of the line when
|
||||
using horizontal scrolling with incremental search.
|
||||
|
||||
d. Readline's input handler now performs signal processing if read(2) is
|
||||
interrupted by SIGALRM or SIGVTALRM.
|
||||
|
||||
e. Fixed a problem with revert-all-at-newline freeing freed memory.
|
||||
|
||||
f. Clarified the documentation for the history_quotes_inhibit_expansion
|
||||
variable to note that it inhibits scanning for the history comment
|
||||
character and that it only affects double-quoted strings.
|
||||
|
||||
g. Fixed an off-by-one error in the prompt printed when performing searches.
|
||||
|
||||
h. Use pselect(2), if available, to wait for input before calling read(2), so
|
||||
a SIGWINCH can interrupt it, since it doesn't interrupt read(2).
|
||||
|
||||
i. Some memory leaks caused by signals interrupting filename completion have
|
||||
been fixed.
|
||||
|
||||
j. Reading EOF twice on a non-empty line causes EOF to be returned, rather
|
||||
than the partial line. This can cause partial lines to be executed on
|
||||
SIGHUP, for example.
|
||||
|
||||
k. Fixed a bug concerning deleting multibyte characters from the search
|
||||
string while performing an incremental search.
|
||||
|
||||
l. Fixed a bug with tilde expanding directory names in filename completion.
|
||||
|
||||
m. Fixed a bug that did not allow binding sequences beginning with a `\'.
|
||||
|
||||
n. Fixed a redisplay bug involving incorrect line wrapping when the prompt
|
||||
contains a multibyte character in the last screen column.
|
||||
|
||||
o. Fixed a bug that caused history expansion to disregard characters that are
|
||||
documented to delimit a history event specifier without requiring `:'.
|
||||
|
||||
p. Fixed a bug that could cause reading past the end of a string when reading
|
||||
the value when binding the set of isearch terminators.
|
||||
|
||||
q. Fixed a bug that caused readline commands that depend on knowing which
|
||||
key invoked them to misbehave when dispatching key sequences that are
|
||||
prefixes of other key bindings.
|
||||
|
||||
r. Paren matching now works in vi insert mode.
|
||||
|
||||
2. New Features in Readline
|
||||
|
||||
a. The history truncation code now uses the same error recovery mechansim as
|
||||
the history writing code, and restores the old version of the history file
|
||||
on error. The error recovery mechanism handles symlinked history files.
|
||||
|
||||
b. There is a new bindable variable, `enable-bracketed-paste', which enables
|
||||
support for a terminal's bracketed paste mode.
|
||||
|
||||
c. The editing mode indicators can now be strings and are user-settable
|
||||
(new `emacs-mode-string', `vi-cmd-mode-string' and `vi-ins-mode-string'
|
||||
variables). Mode strings can contain invisible character sequences.
|
||||
Setting mode strings to null strings restores the defaults.
|
||||
|
||||
d. Prompt expansion adds the mode string to the last line of a multi-line
|
||||
prompt (one with embedded newlines).
|
||||
|
||||
e. There is a new bindable variable, `colored-completion-prefix', which, if
|
||||
set, causes the common prefix of a set of possible completions to be
|
||||
displayed in color.
|
||||
|
||||
f. There is a new bindable command `vi-yank-pop', a vi-mode version of emacs-
|
||||
mode yank-pop.
|
||||
|
||||
g. The redisplay code underwent several efficiency improvements for multibyte
|
||||
locales.
|
||||
|
||||
h. The insert-char function attempts to batch-insert all pending typeahead
|
||||
that maps to self-insert, as long as it is coming from the terminal.
|
||||
|
||||
i. rl_callback_sigcleanup: a new application function that can clean up and
|
||||
unset any state set by readline's callback mode. Intended to be used
|
||||
after a signal.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This document details the changes between this version, readline-6.3, and the
|
||||
previous version, readline-6.2.
|
||||
|
||||
1. Changes to Readline
|
||||
|
||||
a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
|
||||
commands to work on the entire line.
|
||||
|
||||
b. Fixed a bug that caused redisplay problems with prompts longer than 128
|
||||
characters and history searches.
|
||||
|
||||
c. Fixed a bug that caused readline to try and run code to modify its idea
|
||||
of the screen size in a signal handler context upon receiving a SIGWINCH.
|
||||
|
||||
d. Fixed a bug that caused the `meta' key to be enabled beyond the duration
|
||||
of an individual call top readline().
|
||||
|
||||
e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's
|
||||
redisplay to mishandle zero-width combining characters.
|
||||
|
||||
f. Fixed a bug that caused readline to `forget' part of a key sequence when
|
||||
a multiple-key sequence caused it to break out of an incremental search.
|
||||
|
||||
g. Fixed bugs that caused readline to execute code in a signal handler
|
||||
context if interrupted while reading from the file system during completion.
|
||||
|
||||
h. Fixed a bug that caused readline to `forget' part of a key sequence when
|
||||
reading an unbound multi-character key sequence.
|
||||
|
||||
i. Fixed a bug that caused Readline's signal handlers to be installed beyond
|
||||
the bounds of a single call to readline().
|
||||
|
||||
j. Fixed a bug that caused the `.' command to not redo the most recent `R'
|
||||
command in vi mode.
|
||||
|
||||
k. Fixed a bug that caused ignoring case in completion matches to result in
|
||||
readline using the wrong match.
|
||||
|
||||
l. Paren matching now works in vi insert mode.
|
||||
|
||||
m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix
|
||||
work together.
|
||||
|
||||
n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone
|
||||
in vi editing mode.
|
||||
|
||||
o. Fixed a bug that caused the filename comparison code to not compare
|
||||
multibyte characters correctly when using case-sensitive or case-mapping
|
||||
comparisons.
|
||||
|
||||
p. Fixed the input reading loop to call the input hook function only when there
|
||||
is no terminal input available.
|
||||
|
||||
q. Fixed a bug that caused binding a macro to a multi-character key sequence
|
||||
where the sequence and macro value share a common prefix to not perform
|
||||
the macro replacement.
|
||||
|
||||
r. Fixed several redisplay errors with multibyte characters and prompts
|
||||
containing invisible characters when using horizontal scrolling.
|
||||
|
||||
s. Fixed a bug that caused redisplay errors when trying to overwrite
|
||||
existing characters using multibyte characters.
|
||||
|
||||
t. Fixed a bug in vi mode that caused the arrow keys to set the saved last
|
||||
vi-mode command to the wrong value.
|
||||
|
||||
u. Fixed a bug that caused double-quoted strings to be scanned incorrectly
|
||||
when being used as the value of a readline variable assignment.
|
||||
|
||||
v. Fixed a bug with vi mode that prevented `.' from repeating a command
|
||||
entered on a previous line (command).
|
||||
|
||||
w. Fixed a bug that could cause completion to core dump if it was interrupted
|
||||
by a signal.
|
||||
|
||||
x. Fixed a bug that could cause readline to crash and seg fault attempting to
|
||||
expand an empty history entry.
|
||||
|
||||
y. Fixed a bug that caused display problems with multi-line prompts containing
|
||||
invisible characters on multiple lines.
|
||||
|
||||
z. Fixed a bug that caused effects made by undoing changes to a history line to
|
||||
be discarded.
|
||||
|
||||
2. New Features in Readline
|
||||
|
||||
a. Readline is now more responsive to SIGHUP and other fatal signals when
|
||||
reading input from the terminal or performing word completion but no
|
||||
longer attempts to run any not-allowable functions from a signal handler
|
||||
context.
|
||||
|
||||
b. There are new bindable commands to search the history for the string of
|
||||
characters between the beginning of the line and the point
|
||||
(history-substring-search-forward, history-substring-search-backward)
|
||||
|
||||
c. Readline allows quoted strings as the values of variables when setting
|
||||
them with `set'. As a side effect, trailing spaces and tabs are ignored
|
||||
when setting a string variable's value.
|
||||
|
||||
d. The history library creates a backup of the history file when writing it
|
||||
and restores the backup on a write error.
|
||||
|
||||
e. New application-settable variable: rl_filename_stat_hook: a function called
|
||||
with a filename before using it in a call to stat(2). Bash uses it to
|
||||
expand shell variables so things like $HOME/Downloads have a slash
|
||||
appended.
|
||||
|
||||
f. New bindable function `print-last-kbd-macro', prints the most-recently-
|
||||
defined keyboard macro in a reusable format.
|
||||
|
||||
g. New user-settable variable `colored-stats', enables use of colored text
|
||||
to denote file types when displaying possible completions (colored analog
|
||||
of visible-stats).
|
||||
|
||||
h. New user-settable variable `keyseq-timout', acts as an inter-character
|
||||
timeout when reading input or incremental search strings.
|
||||
|
||||
i. New application-callable function: rl_clear_history. Clears the history list
|
||||
and frees all readline-associated private data.
|
||||
|
||||
j. New user-settable variable, show-mode-in-prompt, adds a characters to the
|
||||
beginning of the prompt indicating the current editing mode.
|
||||
|
||||
k. New application-settable variable: rl_input_available_hook; function to be
|
||||
called when readline needs to check whether there is data available on its
|
||||
input source. The default hook checks rl_instream.
|
||||
|
||||
l. Readline calls an application-set event hook (rl_signal_event_hook) after
|
||||
it gets a signal while reading input (read returns -1/EINTR but readline
|
||||
does not handle the signal immediately) to allow the application to handle
|
||||
or otherwise note it. Not currently called for SIGHUP or SIGTERM.
|
||||
|
||||
m. If the user-settable variable `history-size' is set to a value less than
|
||||
0, the history list size is unlimited.
|
||||
|
||||
n. When creating shared libraries on Mac OS X, the pathname written into the
|
||||
library (install_name) no longer includes the minor version number.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This document details the changes between this version, readline-6.2,
|
||||
and the previous version, readline-6.1.
|
||||
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
2015-07-25 Patrick Palka <patrick@parcs.ath.cx>
|
||||
|
||||
* configure.ac: Default opt_shared_libs to no.
|
||||
* configure: Regenerate.
|
||||
|
||||
2015-07-25 Patrick Palka <patrick@parcs.ath.cx>
|
||||
|
||||
Import readline 7.0 alpha
|
||||
* configure: Regenerate.
|
||||
* examples/rlfe/configure: Regenerate.
|
||||
|
||||
2014-12-30 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Basic Installation
|
||||
==================
|
||||
|
||||
These are installation instructions for Readline-7.0.
|
||||
These are installation instructions for Readline-6.2.
|
||||
|
||||
The simplest way to compile readline is:
|
||||
|
||||
|
|
|
@ -18,16 +18,13 @@ USAGE f
|
|||
aclocal.m4 f
|
||||
config.h.in f
|
||||
configure f
|
||||
configure.ac f
|
||||
configure.in f
|
||||
Makefile.in f
|
||||
readline.pc.in f
|
||||
ansi_stdlib.h f
|
||||
chardefs.h f
|
||||
colors.h f
|
||||
history.h f
|
||||
histlib.h f
|
||||
keymaps.h f
|
||||
parse-colors.h f
|
||||
posixdir.h f
|
||||
posixjmp.h f
|
||||
posixselect.h f
|
||||
|
@ -47,7 +44,6 @@ tilde.h f
|
|||
xmalloc.h f
|
||||
bind.c f
|
||||
callback.c f
|
||||
colors.c f
|
||||
compat.c f
|
||||
complete.c f
|
||||
display.c f
|
||||
|
@ -62,7 +58,6 @@ mbutil.c f
|
|||
misc.c f
|
||||
nls.c f
|
||||
parens.c f
|
||||
parse-colors.c f
|
||||
readline.c f
|
||||
rltty.c f
|
||||
savestring.c f
|
||||
|
@ -115,17 +110,13 @@ examples/fileman.c f
|
|||
examples/manexamp.c f
|
||||
examples/readlinebuf.h f
|
||||
examples/rl-fgets.c f
|
||||
examples/rlbasic.c f
|
||||
examples/rlcat.c f
|
||||
examples/rlevent.c f
|
||||
examples/rltest.c f
|
||||
examples/rl-callbacktest.c f
|
||||
examples/rl.c f
|
||||
examples/rlptytest.c f
|
||||
examples/rlversion.c f
|
||||
examples/histexamp.c f
|
||||
examples/hist_erasedups.c f
|
||||
examples/hist_purgecmd.c f
|
||||
examples/Inputrc f
|
||||
examples/autoconf/BASH_CHECK_LIB_TERMCAP f
|
||||
examples/autoconf/RL_LIB_READLINE_VERSION f
|
||||
|
|
|
@ -26,8 +26,6 @@ PACKAGE_NAME = @PACKAGE_NAME@
|
|||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
@ -64,8 +62,6 @@ localedir = @localedir@
|
|||
|
||||
infodir = @infodir@
|
||||
|
||||
docdir = @docdir@
|
||||
|
||||
man3dir = $(mandir)/man3
|
||||
|
||||
# Support an alternate destination root directory for package building
|
||||
|
@ -87,7 +83,7 @@ TERMCAP_LIB = @TERMCAP_LIB@
|
|||
# For libraries which include headers from other libraries.
|
||||
INCLUDES = -I. -I$(srcdir)
|
||||
|
||||
XCCFLAGS = $(DEFS) $(LOCAL_DEFS) $(INCLUDES) $(CPPFLAGS)
|
||||
XCCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES)
|
||||
CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
|
||||
# could add -Werror here
|
||||
|
@ -116,7 +112,7 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
|
|||
$(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
|
||||
$(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
|
||||
$(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
|
||||
$(srcdir)/mbutil.c $(srcdir)/xfree.c
|
||||
$(srcdir)/mbutil.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \
|
||||
|
@ -125,17 +121,14 @@ HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \
|
|||
$(srcdir)/tilde.h $(srcdir)/rlconf.h $(srcdir)/rltty.h \
|
||||
$(srcdir)/ansi_stdlib.h $(srcdir)/tcap.h $(srcdir)/rlstdc.h \
|
||||
$(srcdir)/xmalloc.h $(srcdir)/rlprivate.h $(srcdir)/rlshell.h \
|
||||
$(srcdir)/rltypedefs.h $(srcdir)/rlmbutil.h \
|
||||
$(srcdir)/colors.h $(srcdir)/parse-colors.h
|
||||
$(srcdir)/rltypedefs.h $(srcdir)/rlmbutil.h
|
||||
|
||||
HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o
|
||||
TILDEOBJ = tilde.o
|
||||
COLORSOBJ = colors.o parse-colors.o
|
||||
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
|
||||
rltty.o complete.o bind.o isearch.o display.o signals.o \
|
||||
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
|
||||
text.o nls.o misc.o $(HISTOBJ) $(TILDEOBJ) $(COLORSOBJ) \
|
||||
xmalloc.o xfree.o compat.o
|
||||
text.o nls.o misc.o compat.o xfree.o xmalloc.o $(HISTOBJ) $(TILDEOBJ)
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
|
||||
|
@ -145,15 +138,12 @@ DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
|
|||
|
||||
CREATED_MAKEFILES = Makefile doc/Makefile examples/Makefile shlib/Makefile
|
||||
CREATED_CONFIGURE = config.status config.h config.cache config.log \
|
||||
stamp-config stamp-h readline.pc
|
||||
stamp-config stamp-h
|
||||
CREATED_TAGS = TAGS tags
|
||||
|
||||
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
|
||||
rlstdc.h rlconf.h rltypedefs.h
|
||||
|
||||
OTHER_DOCS = $(srcdir)/CHANGES $(srcdir)/INSTALL $(srcdir)/README
|
||||
OTHER_INSTALLED_DOCS = CHANGES INSTALL README
|
||||
|
||||
##########################################################################
|
||||
TARGETS = @STATIC_TARGET@ @SHARED_TARGET@
|
||||
INSTALL_TARGETS = @STATIC_INSTALL_TARGET@ @SHARED_INSTALL_TARGET@
|
||||
|
@ -203,13 +193,13 @@ stamp-h: config.status $(srcdir)/config.h.in
|
|||
CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
|
||||
echo > $@
|
||||
|
||||
#$(srcdir)/configure: $(srcdir)/configure.ac ## Comment-me-out in distribution
|
||||
#$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
|
||||
# cd $(srcdir) && autoconf ## Comment-me-out in distribution
|
||||
|
||||
|
||||
shared: force
|
||||
-test -d shlib || mkdir shlib
|
||||
( cd shlib ; ${MAKE} ${MFLAGS} all )
|
||||
-( cd shlib ; ${MAKE} ${MFLAGS} all )
|
||||
|
||||
documentation: force
|
||||
-test -d doc || mkdir doc
|
||||
|
@ -221,7 +211,17 @@ examples: force
|
|||
|
||||
force:
|
||||
|
||||
install: $(INSTALL_TARGETS)
|
||||
## GDB LOCAL
|
||||
## Don't mess with people's installed readline's.
|
||||
## This tries to install this version of readline over whatever
|
||||
## version is already installed on the system (which could be a
|
||||
## newer version). There is no real reason for us to install
|
||||
## readline along with GDB. GDB links statically against readline,
|
||||
## so it doesn't depend on us installing it on the system.
|
||||
|
||||
install:
|
||||
|
||||
#install: $(INSTALL_TARGETS)
|
||||
|
||||
install-headers: installdirs ${INSTALLED_HEADERS}
|
||||
for f in ${INSTALLED_HEADERS}; do \
|
||||
|
@ -245,7 +245,7 @@ install-static: installdirs $(STATIC_LIBS) install-headers install-doc install-e
|
|||
installdirs: $(srcdir)/support/mkinstalldirs
|
||||
-$(SHELL) $(srcdir)/support/mkinstalldirs $(DESTDIR)$(includedir) \
|
||||
$(DESTDIR)$(includedir)/readline $(DESTDIR)$(libdir) \
|
||||
$(DESTDIR)$(infodir) $(DESTDIR)$(man3dir) $(DESTDIR)$(docdir)
|
||||
$(DESTDIR)$(infodir) $(DESTDIR)$(man3dir)
|
||||
|
||||
uninstall: uninstall-headers uninstall-doc uninstall-examples
|
||||
-test -n "$(DESTDIR)$(libdir)" && cd $(DESTDIR)$(libdir) && \
|
||||
|
@ -253,26 +253,24 @@ uninstall: uninstall-headers uninstall-doc uninstall-examples
|
|||
-( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
|
||||
|
||||
install-shared: installdirs install-headers shared install-doc
|
||||
( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
|
||||
-( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
|
||||
|
||||
uninstall-shared: maybe-uninstall-headers
|
||||
-( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
|
||||
|
||||
install-examples: installdirs install-headers
|
||||
install-examples: installdirs install-headers shared
|
||||
-( cd examples ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
|
||||
|
||||
uninstall-examples: maybe-uninstall-headers
|
||||
-( cd examples; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
|
||||
|
||||
install-doc: installdirs
|
||||
$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
|
||||
-( if test -d doc ; then \
|
||||
cd doc && \
|
||||
${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
|
||||
fi )
|
||||
|
||||
uninstall-doc:
|
||||
-( cd $(DESTDIR)$(docdir) && ${RM} ${OTHER_INSTALLED_DOCS} )
|
||||
-( if test -d doc ; then \
|
||||
cd doc && \
|
||||
${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} uninstall; \
|
||||
|
@ -287,26 +285,23 @@ tags: force
|
|||
clean: force
|
||||
$(RM) $(OBJECTS) $(STATIC_LIBS)
|
||||
$(RM) readline readline.exe
|
||||
( cd shlib && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd shlib && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd examples && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
mostlyclean: clean
|
||||
( cd shlib && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd shlib && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd examples && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
distclean maintainer-clean: clean
|
||||
( cd shlib && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd shlib && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
-( cd examples && $(MAKE) $(MFLAGS) $@ )
|
||||
$(RM) Makefile
|
||||
$(RM) $(CREATED_CONFIGURE)
|
||||
$(RM) $(CREATED_TAGS)
|
||||
|
||||
readline.pc: config.status $(srcdir)/readline.pc.in
|
||||
$(SHELL) config.status
|
||||
|
||||
info dvi html pdf ps:
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
|
@ -337,8 +332,7 @@ bind.o: history.h
|
|||
callback.o: rlconf.h
|
||||
callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
callback.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
|
||||
compat.o: ${BUILD_DIR}/config.h
|
||||
compat.o: rlstdc.h rltypedefs.h
|
||||
compat.o: rlstdc.h
|
||||
complete.o: ansi_stdlib.h posixdir.h posixstat.h
|
||||
complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
complete.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
|
||||
|
@ -399,7 +393,6 @@ readline.o: posixstat.h ansi_stdlib.h posixjmp.h
|
|||
rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
rltty.o: rltty.h
|
||||
rltty.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
|
||||
savestring.o: ${BUILD_DIR}/config.h
|
||||
search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
||||
search.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
|
||||
search.o: ansi_stdlib.h history.h rlstdc.h
|
||||
|
@ -429,18 +422,10 @@ vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
|
|||
vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
|
||||
vi_mode.o: history.h ansi_stdlib.h rlstdc.h
|
||||
xfree.o: ${BUILD_DIR}/config.h
|
||||
xfree.o: ansi_stdlib.h
|
||||
xfree.o: ansi_stdlib.h readline.h
|
||||
xmalloc.o: ${BUILD_DIR}/config.h
|
||||
xmalloc.o: ansi_stdlib.h
|
||||
|
||||
colors.o: ${BUILD_DIR}/config.h colors.h
|
||||
colors.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
|
||||
colors.o: rlconf.h
|
||||
colors.o: ansi_stdlib.h posixstat.h
|
||||
parse-colors.o: ${BUILD_DIR}/config.h colors.h parse-colors.h
|
||||
parse-colors.o: rldefs.h rlconf.h
|
||||
parse-colors.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
|
||||
|
||||
bind.o: rlshell.h
|
||||
histfile.o: rlshell.h
|
||||
nls.o: rlshell.h
|
||||
|
@ -470,8 +455,6 @@ text.o: rlprivate.h
|
|||
undo.o: rlprivate.h
|
||||
util.o: rlprivate.h
|
||||
vi_mode.o: rlprivate.h
|
||||
colors.o: rlprivate.h
|
||||
parse-colors.o: rlprivate.h
|
||||
|
||||
bind.o: xmalloc.h
|
||||
callback.o: xmalloc.h
|
||||
|
@ -500,8 +483,6 @@ util.o: xmalloc.h
|
|||
vi_mode.o: xmalloc.h
|
||||
xfree.o: xmalloc.h
|
||||
xmalloc.o: xmalloc.h
|
||||
colors.o: xmalloc.h
|
||||
parse-colors.o: xmalloc.h
|
||||
|
||||
complete.o: rlmbutil.h
|
||||
display.o: rlmbutil.h
|
||||
|
@ -545,9 +526,6 @@ vi_mode.o: $(srcdir)/vi_mode.c
|
|||
xfree.o: $(srcdir)/xfree.c
|
||||
xmalloc.o: $(srcdir)/xmalloc.c
|
||||
|
||||
colors.o: $(srcdir)/parse-colors.c
|
||||
parse-colors.o: $(srcdir)/parse-colors.c
|
||||
|
||||
histexpand.o: $(srcdir)/histexpand.c
|
||||
histfile.o: $(srcdir)/histfile.c
|
||||
history.o: $(srcdir)/history.c
|
||||
|
|
291
readline/NEWS
291
readline/NEWS
|
@ -1,282 +1,19 @@
|
|||
This is a terse description of the new features added to readline-7.0 since
|
||||
the release of readline-6.3.
|
||||
This is a terse description of the new features added to readline-6.2 since
|
||||
the release of readline-6.1.
|
||||
|
||||
New Features in Readline
|
||||
a. The history library does not try to write the history filename in the
|
||||
current directory if $HOME is unset. This closes a potential security
|
||||
problem if the application does not specify a history filename.
|
||||
|
||||
a. The history truncation code now uses the same error recovery mechansim as
|
||||
the history writing code, and restores the old version of the history file
|
||||
on error. The error recovery mechanism handles symlinked history files.
|
||||
b. New bindable variable `completion-display-width' to set the number of
|
||||
columns used when displaying completions.
|
||||
|
||||
b. There is a new bindable variable, `enable-bracketed-paste', which enables
|
||||
support for a terminal's bracketed paste mode.
|
||||
c. New bindable variable `completion-case-map' to cause case-insensitive
|
||||
completion to treat `-' and `_' as identical.
|
||||
|
||||
c. The editing mode indicators can now be strings and are user-settable
|
||||
(new `emacs-mode-string', `vi-cmd-mode-string' and `vi-ins-mode-string'
|
||||
variables). Mode strings can contain invisible character sequences.
|
||||
Setting mode strings to null strings restores the defaults.
|
||||
d. There are new bindable vi-mode command names to avoid readline's case-
|
||||
insensitive matching not allowing them to be bound separately.
|
||||
|
||||
d. Prompt expansion adds the mode string to the last line of a multi-line
|
||||
prompt (one with embedded newlines).
|
||||
|
||||
e. There is a new bindable variable, `colored-completion-prefix', which, if
|
||||
set, causes the common prefix of a set of possible completions to be
|
||||
displayed in color.
|
||||
|
||||
f. There is a new bindable command `vi-yank-pop', a vi-mode version of emacs-
|
||||
mode yank-pop.
|
||||
|
||||
g. The redisplay code underwent several efficiency improvements for multibyte
|
||||
locales.
|
||||
|
||||
h. The insert-char function attempts to batch-insert all pending typeahead
|
||||
that maps to self-insert, as long as it is coming from the terminal.
|
||||
|
||||
i. rl_callback_sigcleanup: a new application function that can clean up and
|
||||
unset any state set by readline's callback mode. Intended to be used
|
||||
after a signal.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This is a terse description of the new features added to readline-6.3 since
|
||||
the release of readline-6.2.
|
||||
|
||||
New Features in Readline
|
||||
|
||||
a. Readline is now more responsive to SIGHUP and other fatal signals when
|
||||
reading input from the terminal or performing word completion but no
|
||||
longer attempts to run any not-allowable functions from a signal handler
|
||||
context.
|
||||
|
||||
b. There are new bindable commands to search the history for the string of
|
||||
characters between the beginning of the line and the point
|
||||
(history-substring-search-forward, history-substring-search-backward)
|
||||
|
||||
c. Readline allows quoted strings as the values of variables when setting
|
||||
them with `set'. As a side effect, trailing spaces and tabs are ignored
|
||||
when setting a string variable's value.
|
||||
|
||||
d. The history library creates a backup of the history file when writing it
|
||||
and restores the backup on a write error.
|
||||
|
||||
e. New application-settable variable: rl_filename_stat_hook: a function called
|
||||
with a filename before using it in a call to stat(2). Bash uses it to
|
||||
expand shell variables so things like $HOME/Downloads have a slash
|
||||
appended.
|
||||
|
||||
f. New bindable function `print-last-kbd-macro', prints the most-recently-
|
||||
defined keyboard macro in a reusable format.
|
||||
|
||||
g. New user-settable variable `colored-stats', enables use of colored text
|
||||
to denote file types when displaying possible completions (colored analog
|
||||
of visible-stats).
|
||||
|
||||
h. New user-settable variable `keyseq-timout', acts as an inter-character
|
||||
timeout when reading input or incremental search strings.
|
||||
|
||||
i. New application-callable function: rl_clear_history. Clears the history list
|
||||
and frees all readline-associated private data.
|
||||
|
||||
j. New user-settable variable, show-mode-in-prompt, adds a characters to the
|
||||
beginning of the prompt indicating the current editing mode.
|
||||
|
||||
k. New application-settable variable: rl_input_available_hook; function to be
|
||||
called when readline detects there is data available on its input file
|
||||
descriptor.
|
||||
|
||||
l. Readline calls an application-set event hook (rl_event_hook) after it gets
|
||||
a signal while reading input (read returns -1/EINTR but readline does not
|
||||
handle the signal immediately) to allow the application to handle or
|
||||
otherwise note it.
|
||||
|
||||
m. If the user-settable variable `history-size' is set to a value less than
|
||||
0, the history list size is unlimited.
|
||||
|
||||
n. New application-settable variable: rl_signal_event_hook; function that is
|
||||
called when readline is reading terminal input and read(2) is interrupted
|
||||
by a signal. Currently not called for SIGHUP or SIGTERM.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This is a terse description of the new features added to readline-6.1 since
|
||||
the release of readline-6.0.
|
||||
|
||||
New Features in Readline
|
||||
|
||||
a. New bindable function: menu-complete-backward.
|
||||
|
||||
b. In the vi insertion keymap, C-n is now bound to menu-complete by default,
|
||||
and C-p to menu-complete-backward.
|
||||
|
||||
c. When in vi command mode, repeatedly hitting ESC now does nothing, even
|
||||
when ESC introduces a bound key sequence. This is closer to how
|
||||
historical vi behaves.
|
||||
|
||||
d. New bindable function: skip-csi-sequence. Can be used as a default to
|
||||
consume key sequences generated by keys like Home and End without having
|
||||
to bind all keys.
|
||||
|
||||
e. New application-settable function: rl_filename_rewrite_hook. Can be used
|
||||
to rewite or modify filenames read from the file system before they are
|
||||
compared to the word to be completed.
|
||||
|
||||
f. New bindable variable: skip-completed-text, active when completing in the
|
||||
middle of a word. If enabled, it means that characters in the completion
|
||||
that match characters in the remainder of the word are "skipped" rather
|
||||
than inserted into the line.
|
||||
|
||||
g. The pre-readline-6.0 version of menu completion is available as
|
||||
"old-menu-complete" for users who do not like the readline-6.0 version.
|
||||
|
||||
h. New bindable variable: echo-control-characters. If enabled, and the
|
||||
tty ECHOCTL bit is set, controls the echoing of characters corresponding
|
||||
to keyboard-generated signals.
|
||||
|
||||
i. New bindable variable: enable-meta-key. Controls whether or not readline
|
||||
sends the smm/rmm sequences if the terminal indicates it has a meta key
|
||||
that enables eight-bit characters.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This is a terse description of the new features added to readline-6.0 since
|
||||
the release of readline-5.2.
|
||||
|
||||
New Features in Readline
|
||||
|
||||
a. A new variable, rl_sort_completion_matches; allows applications to inhibit
|
||||
match list sorting (but beware: some things don't work right if
|
||||
applications do this).
|
||||
|
||||
b. A new variable, rl_completion_invoking_key; allows applications to discover
|
||||
the key that invoked rl_complete or rl_menu_complete.
|
||||
|
||||
c. The functions rl_block_sigint and rl_release_sigint are now public and
|
||||
available to calling applications who want to protect critical sections
|
||||
(like redisplay).
|
||||
|
||||
d. The functions rl_save_state and rl_restore_state are now public and
|
||||
available to calling applications; documented rest of readline's state
|
||||
flag values.
|
||||
|
||||
e. A new user-settable variable, `history-size', allows setting the maximum
|
||||
number of entries in the history list.
|
||||
|
||||
f. There is a new implementation of menu completion, with several improvements
|
||||
over the old; the most notable improvement is a better `completions
|
||||
browsing' mode.
|
||||
|
||||
g. The menu completion code now uses the rl_menu_completion_entry_function
|
||||
variable, allowing applications to provide their own menu completion
|
||||
generators.
|
||||
|
||||
h. There is support for replacing a prefix of a pathname with a `...' when
|
||||
displaying possible completions. This is controllable by setting the
|
||||
`completion-prefix-display-length' variable. Matches with a common prefix
|
||||
longer than this value have the common prefix replaced with `...'.
|
||||
|
||||
i. There is a new `revert-all-at-newline' variable. If enabled, readline will
|
||||
undo all outstanding changes to all history lines when `accept-line' is
|
||||
executed.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This is a terse description of the new features added to readline-5.2 since
|
||||
the release of readline-5.1.
|
||||
|
||||
New Features in Readline
|
||||
|
||||
a. Calling applications can now set the keyboard timeout to 0, allowing
|
||||
poll-like behavior.
|
||||
|
||||
b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
|
||||
the default last-ditch startup file.
|
||||
|
||||
c. The history file reading functions now allow windows-like \r\n line
|
||||
terminators.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This is a terse description of the new features added to readline-5.1 since
|
||||
the release of readline-5.0.
|
||||
|
||||
New Features in Readline
|
||||
|
||||
a. The key sequence sent by the keypad `delete' key is now automatically
|
||||
bound to delete-char.
|
||||
|
||||
b. A negative argument to menu-complete now cycles backward through the
|
||||
completion list.
|
||||
|
||||
c. A new bindable readline variable: bind-tty-special-chars. If non-zero,
|
||||
readline will bind the terminal special characters to their readline
|
||||
equivalents when it's called (on by default).
|
||||
|
||||
d. New bindable command: vi-rubout. Saves deleted text for possible
|
||||
reinsertion, as with any vi-mode `text modification' command; `X' is bound
|
||||
to this in vi command mode.
|
||||
|
||||
e. If the rl_completion_query_items is set to a value < 0, readline never
|
||||
asks the user whether or not to view the possible completions.
|
||||
|
||||
f. New application-callable auxiliary function, rl_variable_value, returns
|
||||
a string corresponding to a readline variable's value.
|
||||
|
||||
g. When parsing inputrc files and variable binding commands, the parser
|
||||
strips trailing whitespace from values assigned to boolean variables
|
||||
before checking them.
|
||||
|
||||
h. A new external application-controllable variable that allows the LINES
|
||||
and COLUMNS environment variables to set the window size regardless of
|
||||
what the kernel returns.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
This is a terse description of the new features added to readline-5.0 since
|
||||
the release of readline-4.3.
|
||||
|
||||
New Features in Readline
|
||||
|
||||
a. History expansion has a new `a' modifier equivalent to the `g' modifier
|
||||
for compatibility with the BSD csh.
|
||||
|
||||
b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
|
||||
modifier, which performs a substitution once per word.
|
||||
|
||||
c. All non-incremental search operations may now undo the operation of
|
||||
replacing the current line with the history line.
|
||||
|
||||
d. The text inserted by an `a' command in vi mode can be reinserted with
|
||||
`.'.
|
||||
|
||||
e. New bindable variable, `show-all-if-unmodified'. If set, the readline
|
||||
completer will list possible completions immediately if there is more
|
||||
than one completion and partial completion cannot be performed.
|
||||
|
||||
f. There is a new application-callable `free_history_entry()' function.
|
||||
|
||||
g. History list entries now contain timestamp information; the history file
|
||||
functions know how to read and write timestamp information associated
|
||||
with each entry.
|
||||
|
||||
h. Four new key binding functions have been added:
|
||||
|
||||
rl_bind_key_if_unbound()
|
||||
rl_bind_key_if_unbound_in_map()
|
||||
rl_bind_keyseq_if_unbound()
|
||||
rl_bind_keyseq_if_unbound_in_map()
|
||||
|
||||
i. New application variable, rl_completion_quote_character, set to any
|
||||
quote character readline finds before it calls the application completion
|
||||
function.
|
||||
|
||||
j. New application variable, rl_completion_suppress_quote, settable by an
|
||||
application completion function. If set to non-zero, readline does not
|
||||
attempt to append a closing quote to a completed word.
|
||||
|
||||
k. New application variable, rl_completion_found_quote, set to a non-zero
|
||||
value if readline determines that the word to be completed is quoted.
|
||||
Set before readline calls any application completion function.
|
||||
|
||||
l. New function hook, rl_completion_word_break_hook, called when readline
|
||||
needs to break a line into words when completion is attempted. Allows
|
||||
the word break characters to vary based on position in the line.
|
||||
|
||||
m. New bindable command: unix-filename-rubout. Does the same thing as
|
||||
unix-word-rubout, but adds `/' to the set of word delimiters.
|
||||
|
||||
n. When listing completions, directories have a `/' appended if the
|
||||
`mark-directories' option has been enabled.
|
||||
e. New bindable variable `menu-complete-display-prefix' causes the menu
|
||||
completion code to display the common prefix of the possible completions
|
||||
before cycling through the list, instead of after.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Introduction
|
||||
============
|
||||
|
||||
This is the Gnu Readline library, version 7.0.
|
||||
This is the Gnu Readline library, version 6.2.
|
||||
|
||||
The Readline library provides a set of functions for use by applications
|
||||
that allow users to edit command lines as they are typed in. Both
|
||||
|
@ -159,15 +159,6 @@ Readline library. The texinfo files include both user and
|
|||
programmer's manuals. HTML versions of the manuals appear in the
|
||||
`doc' subdirectory as well.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Our position on the use of Readline through a shared-library linking
|
||||
mechanism is that there is no legal difference between shared-library
|
||||
linking and static linking--either kind of linking combines various
|
||||
modules into a single larger work. The conditions for using Readline
|
||||
in a larger work are stated in section 3 of the GNU GPL.
|
||||
|
||||
Reporting Bugs
|
||||
==============
|
||||
|
||||
|
|
38
readline/aclocal.m4
vendored
38
readline/aclocal.m4
vendored
|
@ -1692,14 +1692,13 @@ AC_CHECK_HEADERS(wctype.h)
|
|||
AC_CHECK_HEADERS(wchar.h)
|
||||
AC_CHECK_HEADERS(langinfo.h)
|
||||
|
||||
AC_CHECK_HEADERS(mbstr.h)
|
||||
|
||||
AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
|
||||
AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))
|
||||
AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
|
||||
AC_CHECK_FUNC(mbsnrtowcs, AC_DEFINE(HAVE_MBSNRTOWCS))
|
||||
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
|
||||
|
||||
|
||||
AC_REPLACE_FUNCS(mbschr)
|
||||
|
||||
AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
|
||||
|
@ -1764,36 +1763,9 @@ if test $bash_cv_type_wint_t = yes; then
|
|||
AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
|
||||
fi
|
||||
|
||||
dnl check for broken wcwidth
|
||||
AC_CACHE_CHECK([for wcwidth broken with unicode combining characters],
|
||||
bash_cv_wcwidth_broken,
|
||||
[AC_TRY_RUN([
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <locale.h>
|
||||
#include <wchar.h>
|
||||
|
||||
main(c, v)
|
||||
int c;
|
||||
char **v;
|
||||
{
|
||||
int w;
|
||||
|
||||
setlocale(LC_ALL, "en_US.UTF-8");
|
||||
w = wcwidth (0x0301);
|
||||
exit (w == 0); /* exit 0 if wcwidth broken */
|
||||
}
|
||||
],
|
||||
bash_cv_wcwidth_broken=yes, bash_cv_wcwidth_broken=no, bash_cv_wcwidth_broken=no)])
|
||||
if test "$bash_cv_wcwidth_broken" = yes; then
|
||||
AC_DEFINE(WCWIDTH_BROKEN, 1, [wcwidth is usually not broken])
|
||||
fi
|
||||
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBINTL $LIBICONV"
|
||||
LIBS="$LIBS $LIBICONV"
|
||||
AC_CHECK_FUNCS(locale_charset)
|
||||
LIBS="$OLDLIBS"
|
||||
fi
|
||||
|
@ -3126,7 +3098,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
|||
found_so=
|
||||
found_a=
|
||||
if test $use_additional = yes; then
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_so="$additional_libdir/lib$name.$shlibext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
|
@ -3148,7 +3120,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
|||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/lib$name.$shlibext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
|
@ -4151,7 +4123,7 @@ main()
|
|||
AC_DEFUN(BASH_STRUCT_WEXITSTATUS_OFFSET,
|
||||
[AC_MSG_CHECKING(for offset of exit status in return status from wait)
|
||||
AC_CACHE_VAL(bash_cv_wexitstatus_offset,
|
||||
[AC_TRY_RUN([
|
||||
[AC_RUN_IFELSE([
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
342
readline/bind.c
342
readline/bind.c
|
@ -1,6 +1,6 @@
|
|||
/* bind.c -- key binding and startup file support for the readline library. */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2010 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.
|
||||
|
@ -72,15 +72,11 @@ extern char *strchr (), *strrchr ();
|
|||
/* Variables exported by this file. */
|
||||
Keymap rl_binding_keymap;
|
||||
|
||||
static int _rl_skip_to_delim PARAMS((char *, int, int));
|
||||
|
||||
static char *_rl_read_file PARAMS((char *, size_t *));
|
||||
static void _rl_init_file_error PARAMS((const char *));
|
||||
static int _rl_read_init_file PARAMS((const char *, int));
|
||||
static int glean_key_from_name PARAMS((char *));
|
||||
|
||||
static int find_boolean_var PARAMS((const char *));
|
||||
static int find_string_var PARAMS((const char *));
|
||||
|
||||
static char *_rl_get_string_variable_value PARAMS((const char *));
|
||||
static int substring_member_of_array PARAMS((const char *, const char * const *));
|
||||
|
@ -117,9 +113,6 @@ rl_bind_key (key, function)
|
|||
int key;
|
||||
rl_command_func_t *function;
|
||||
{
|
||||
char keyseq[3];
|
||||
int l;
|
||||
|
||||
if (key < 0)
|
||||
return (key);
|
||||
|
||||
|
@ -138,24 +131,8 @@ rl_bind_key (key, function)
|
|||
return (key);
|
||||
}
|
||||
|
||||
/* If it's bound to a function or macro, just overwrite. Otherwise we have
|
||||
to treat it as a key sequence so rl_generic_bind handles shadow keymaps
|
||||
for us. If we are binding '\' make sure to escape it so it makes it
|
||||
through the call to rl_translate_keyseq. */
|
||||
if (_rl_keymap[key].type != ISKMAP)
|
||||
{
|
||||
_rl_keymap[key].type = ISFUNC;
|
||||
_rl_keymap[key].function = function;
|
||||
}
|
||||
else
|
||||
{
|
||||
l = 0;
|
||||
if (key == '\\')
|
||||
keyseq[l++] = '\\';
|
||||
keyseq[l++] = key;
|
||||
keyseq[l] = '\0';
|
||||
rl_bind_keyseq (keyseq, function);
|
||||
}
|
||||
_rl_keymap[key].type = ISFUNC;
|
||||
_rl_keymap[key].function = function;
|
||||
rl_binding_keymap = _rl_keymap;
|
||||
return (0);
|
||||
}
|
||||
|
@ -561,7 +538,7 @@ rl_translate_keyseq (seq, array, len)
|
|||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
i++;
|
||||
for (temp = 2, c -= '0'; ISOCTAL ((unsigned char)seq[i]) && temp--; i++)
|
||||
for (temp = 2, c -= '0'; ISOCTAL (seq[i]) && temp--; i++)
|
||||
c = (c * 8) + OCTVALUE (seq[i]);
|
||||
i--; /* auto-increment in for loop */
|
||||
array[l++] = c & largest_char;
|
||||
|
@ -590,40 +567,6 @@ rl_translate_keyseq (seq, array, len)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
_rl_isescape (c)
|
||||
int c;
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '\007':
|
||||
case '\b':
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case TAB:
|
||||
case 0x0b: return (1);
|
||||
default: return (0);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_rl_escchar (c)
|
||||
int c;
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '\007': return ('a');
|
||||
case '\b': return ('b');
|
||||
case '\f': return ('f');
|
||||
case '\n': return ('n');
|
||||
case '\r': return ('r');
|
||||
case TAB: return ('t');
|
||||
case 0x0b: return ('v');
|
||||
default: return (c);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
rl_untranslate_keyseq (seq)
|
||||
int seq;
|
||||
|
@ -675,10 +618,9 @@ rl_untranslate_keyseq (seq)
|
|||
return kseq;
|
||||
}
|
||||
|
||||
char *
|
||||
_rl_untranslate_macro_value (seq, use_escapes)
|
||||
static char *
|
||||
_rl_untranslate_macro_value (seq)
|
||||
char *seq;
|
||||
int use_escapes;
|
||||
{
|
||||
char *ret, *r, *s;
|
||||
int c;
|
||||
|
@ -702,14 +644,9 @@ _rl_untranslate_macro_value (seq, use_escapes)
|
|||
else if (CTRL_CHAR (c))
|
||||
{
|
||||
*r++ = '\\';
|
||||
if (use_escapes && _rl_isescape (c))
|
||||
c = _rl_escchar (c);
|
||||
else
|
||||
{
|
||||
*r++ = 'C';
|
||||
*r++ = '-';
|
||||
c = _rl_to_lower (UNCTRL (c));
|
||||
}
|
||||
*r++ = 'C';
|
||||
*r++ = '-';
|
||||
c = _rl_to_lower (UNCTRL (c));
|
||||
}
|
||||
else if (c == RUBOUT)
|
||||
{
|
||||
|
@ -1220,38 +1157,6 @@ handle_parser_directive (statement)
|
|||
return (1);
|
||||
}
|
||||
|
||||
/* Start at STRING[START] and look for DELIM. Return I where STRING[I] ==
|
||||
DELIM or STRING[I] == 0. DELIM is usually a double quote. */
|
||||
static int
|
||||
_rl_skip_to_delim (string, start, delim)
|
||||
char *string;
|
||||
int start, delim;
|
||||
{
|
||||
int i, c, passc;
|
||||
|
||||
for (i = start,passc = 0; c = string[i]; i++)
|
||||
{
|
||||
if (passc)
|
||||
{
|
||||
passc = 0;
|
||||
if (c == 0)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\\')
|
||||
{
|
||||
passc = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == delim)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Read the binding command from STRING and perform it.
|
||||
A key binding command looks like: Keyname: function-name\0,
|
||||
a variable binding command looks like: set variable value.
|
||||
|
@ -1267,7 +1172,7 @@ rl_parse_and_bind (string)
|
|||
while (string && whitespace (*string))
|
||||
string++;
|
||||
|
||||
if (string == 0 || *string == 0 || *string == '#')
|
||||
if (!string || !*string || *string == '#')
|
||||
return 0;
|
||||
|
||||
/* If this is a parser directive, act on it. */
|
||||
|
@ -1287,16 +1192,31 @@ rl_parse_and_bind (string)
|
|||
backslash to quote characters in the key expression. */
|
||||
if (*string == '"')
|
||||
{
|
||||
i = _rl_skip_to_delim (string, 1, '"');
|
||||
int passc = 0;
|
||||
|
||||
for (i = 1; c = string[i]; i++)
|
||||
{
|
||||
if (passc)
|
||||
{
|
||||
passc = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\\')
|
||||
{
|
||||
passc++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '"')
|
||||
break;
|
||||
}
|
||||
/* If we didn't find a closing quote, abort the line. */
|
||||
if (string[i] == '\0')
|
||||
{
|
||||
_rl_init_file_error ("no closing `\"' in key binding");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
i++; /* skip past closing double quote */
|
||||
}
|
||||
|
||||
/* Advance to the colon (:) or whitespace which separates the two objects. */
|
||||
|
@ -1316,7 +1236,6 @@ rl_parse_and_bind (string)
|
|||
if (_rl_stricmp (string, "set") == 0)
|
||||
{
|
||||
char *var, *value, *e;
|
||||
int s;
|
||||
|
||||
var = string + i;
|
||||
/* Make VAR point to start of variable name. */
|
||||
|
@ -1324,37 +1243,25 @@ rl_parse_and_bind (string)
|
|||
|
||||
/* Make VALUE point to start of value string. */
|
||||
value = var;
|
||||
while (*value && whitespace (*value) == 0) value++;
|
||||
while (*value && !whitespace (*value)) value++;
|
||||
if (*value)
|
||||
*value++ = '\0';
|
||||
while (*value && whitespace (*value)) value++;
|
||||
|
||||
/* Strip trailing whitespace from values of boolean variables. */
|
||||
if (find_boolean_var (var) >= 0)
|
||||
/* Strip trailing whitespace from values to boolean variables. Temp
|
||||
fix until I get a real quoted-string parser here. */
|
||||
i = find_boolean_var (var);
|
||||
if (i >= 0)
|
||||
{
|
||||
/* remove trailing whitespace */
|
||||
remove_trailing:
|
||||
e = value + strlen (value) - 1;
|
||||
while (e >= value && whitespace (*e))
|
||||
e--;
|
||||
e++; /* skip back to whitespace or EOS */
|
||||
|
||||
if (*e && e >= value)
|
||||
*e = '\0';
|
||||
}
|
||||
else if ((i = find_string_var (var)) >= 0)
|
||||
{
|
||||
/* Allow quoted strings in variable values */
|
||||
if (*value == '"')
|
||||
{
|
||||
i = _rl_skip_to_delim (value, 1, *value);
|
||||
value[i] = '\0';
|
||||
value++; /* skip past the quote */
|
||||
}
|
||||
else
|
||||
goto remove_trailing;
|
||||
}
|
||||
|
||||
|
||||
rl_variable_bind (var, value);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1375,13 +1282,32 @@ remove_trailing:
|
|||
the quoted string delimiter, like the shell. */
|
||||
if (*funname == '\'' || *funname == '"')
|
||||
{
|
||||
i = _rl_skip_to_delim (string, i+1, *funname);
|
||||
if (string[i])
|
||||
int delimiter, passc;
|
||||
|
||||
delimiter = string[i++];
|
||||
for (passc = 0; c = string[i]; i++)
|
||||
{
|
||||
if (passc)
|
||||
{
|
||||
passc = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\\')
|
||||
{
|
||||
passc = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == delimiter)
|
||||
break;
|
||||
}
|
||||
if (c)
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Advance to the end of the string. */
|
||||
for (; string[i] && whitespace (string[i]) == 0; i++);
|
||||
for (; string[i] && !whitespace (string[i]); i++);
|
||||
|
||||
/* No extra whitespace at the end of the string. */
|
||||
string[i] = '\0';
|
||||
|
@ -1441,7 +1367,7 @@ remove_trailing:
|
|||
|
||||
/* Get the actual character we want to deal with. */
|
||||
kname = strrchr (string, '-');
|
||||
if (kname == 0)
|
||||
if (!kname)
|
||||
kname = string;
|
||||
else
|
||||
kname++;
|
||||
|
@ -1497,16 +1423,11 @@ static const struct {
|
|||
{ "bind-tty-special-chars", &_rl_bind_stty_chars, 0 },
|
||||
{ "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
|
||||
{ "byte-oriented", &rl_byte_oriented, 0 },
|
||||
#if defined (COLOR_SUPPORT)
|
||||
{ "colored-completion-prefix",&_rl_colored_completion_prefix, 0 },
|
||||
{ "colored-stats", &_rl_colored_stats, 0 },
|
||||
#endif
|
||||
{ "completion-ignore-case", &_rl_completion_case_fold, 0 },
|
||||
{ "completion-map-case", &_rl_completion_case_map, 0 },
|
||||
{ "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
|
||||
{ "disable-completion", &rl_inhibit_completion, 0 },
|
||||
{ "echo-control-characters", &_rl_echo_control_chars, 0 },
|
||||
{ "enable-bracketed-paste", &_rl_enable_bracketed_paste, 0 },
|
||||
{ "enable-keypad", &_rl_enable_keypad, 0 },
|
||||
{ "enable-meta-key", &_rl_enable_meta, 0 },
|
||||
{ "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
|
||||
|
@ -1526,7 +1447,6 @@ static const struct {
|
|||
{ "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 },
|
||||
{ "show-mode-in-prompt", &_rl_show_mode_in_prompt, 0 },
|
||||
{ "skip-completed-text", &_rl_skip_completed_text, 0 },
|
||||
#if defined (VISIBLE_STATS)
|
||||
{ "visible-stats", &rl_visible_stats, 0 },
|
||||
|
@ -1566,8 +1486,6 @@ hack_special_boolean_var (i)
|
|||
else
|
||||
_rl_bell_preference = AUDIBLE_BELL;
|
||||
}
|
||||
else if (_rl_stricmp (name, "show-mode-in-prompt") == 0)
|
||||
_rl_reset_prompt ();
|
||||
}
|
||||
|
||||
typedef int _rl_sv_func_t PARAMS((const char *));
|
||||
|
@ -1590,13 +1508,9 @@ static int sv_dispprefix PARAMS((const char *));
|
|||
static int sv_compquery PARAMS((const char *));
|
||||
static int sv_compwidth PARAMS((const char *));
|
||||
static int sv_editmode PARAMS((const char *));
|
||||
static int sv_emacs_modestr 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 int sv_seqtimeout PARAMS((const char *));
|
||||
static int sv_viins_modestr PARAMS((const char *));
|
||||
static int sv_vicmd_modestr PARAMS((const char *));
|
||||
|
||||
static const struct {
|
||||
const char * const name;
|
||||
|
@ -1609,13 +1523,9 @@ static const struct {
|
|||
{ "completion-prefix-display-length", V_INT, sv_dispprefix },
|
||||
{ "completion-query-items", V_INT, sv_compquery },
|
||||
{ "editing-mode", V_STRING, sv_editmode },
|
||||
{ "emacs-mode-string", V_STRING, sv_emacs_modestr },
|
||||
{ "history-size", V_INT, sv_histsize },
|
||||
{ "isearch-terminators", V_STRING, sv_isrchterm },
|
||||
{ "keymap", V_STRING, sv_keymap },
|
||||
{ "keyseq-timeout", V_INT, sv_seqtimeout },
|
||||
{ "vi-cmd-mode-string", V_STRING, sv_vicmd_modestr },
|
||||
{ "vi-ins-mode-string", V_STRING, sv_viins_modestr },
|
||||
{ (char *)NULL, 0, (_rl_sv_func_t *)0 }
|
||||
};
|
||||
|
||||
|
@ -1632,7 +1542,7 @@ find_string_var (name)
|
|||
}
|
||||
|
||||
/* A boolean value that can appear in a `set variable' command is true if
|
||||
the value is null or empty, `on' (case-insensitive), or "1". Any other
|
||||
the value is null or empty, `on' (case-insenstive), or "1". Any other
|
||||
values result in 0 (false). */
|
||||
static int
|
||||
bool_to_int (value)
|
||||
|
@ -1773,17 +1683,13 @@ static int
|
|||
sv_histsize (value)
|
||||
const char *value;
|
||||
{
|
||||
int nval;
|
||||
int nval = 500;
|
||||
|
||||
nval = 500;
|
||||
if (value && *value)
|
||||
{
|
||||
nval = atoi (value);
|
||||
if (nval < 0)
|
||||
{
|
||||
unstifle_history ();
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
stifle_history (nval);
|
||||
return 0;
|
||||
|
@ -1804,23 +1710,6 @@ sv_keymap (value)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
sv_seqtimeout (value)
|
||||
const char *value;
|
||||
{
|
||||
int nval;
|
||||
|
||||
nval = 0;
|
||||
if (value && *value)
|
||||
{
|
||||
nval = atoi (value);
|
||||
if (nval < 0)
|
||||
nval = 0;
|
||||
}
|
||||
_rl_keyseq_timeout = nval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
sv_bell_style (value)
|
||||
const char *value;
|
||||
|
@ -1859,7 +1748,7 @@ sv_isrchterm (value)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (beg = end = 0; v[end] && whitespace (v[end]) == 0; end++)
|
||||
for (beg = end = 0; whitespace (v[end]) == 0; end++)
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -1873,96 +1762,7 @@ sv_isrchterm (value)
|
|||
xfree (v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern char *_rl_emacs_mode_str;
|
||||
|
||||
static int
|
||||
sv_emacs_modestr (value)
|
||||
const char *value;
|
||||
{
|
||||
if (value && *value)
|
||||
{
|
||||
FREE (_rl_emacs_mode_str);
|
||||
_rl_emacs_mode_str = (char *)xmalloc (2 * strlen (value) + 1);
|
||||
rl_translate_keyseq (value, _rl_emacs_mode_str, &_rl_emacs_modestr_len);
|
||||
_rl_emacs_mode_str[_rl_emacs_modestr_len] = '\0';
|
||||
return 0;
|
||||
}
|
||||
else if (value)
|
||||
{
|
||||
FREE (_rl_emacs_mode_str);
|
||||
_rl_emacs_mode_str = (char *)xmalloc (1);
|
||||
_rl_emacs_mode_str[_rl_emacs_modestr_len = 0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
else if (value == 0)
|
||||
{
|
||||
FREE (_rl_emacs_mode_str);
|
||||
_rl_emacs_mode_str = 0; /* prompt_modestr does the right thing */
|
||||
_rl_emacs_modestr_len = 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
sv_viins_modestr (value)
|
||||
const char *value;
|
||||
{
|
||||
if (value && *value)
|
||||
{
|
||||
FREE (_rl_vi_ins_mode_str);
|
||||
_rl_vi_ins_mode_str = (char *)xmalloc (2 * strlen (value) + 1);
|
||||
rl_translate_keyseq (value, _rl_vi_ins_mode_str, &_rl_vi_ins_modestr_len);
|
||||
_rl_vi_ins_mode_str[_rl_vi_ins_modestr_len] = '\0';
|
||||
return 0;
|
||||
}
|
||||
else if (value)
|
||||
{
|
||||
FREE (_rl_vi_ins_mode_str);
|
||||
_rl_vi_ins_mode_str = (char *)xmalloc (1);
|
||||
_rl_vi_ins_mode_str[_rl_vi_ins_modestr_len = 0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
else if (value == 0)
|
||||
{
|
||||
FREE (_rl_vi_ins_mode_str);
|
||||
_rl_vi_ins_mode_str = 0; /* prompt_modestr does the right thing */
|
||||
_rl_vi_ins_modestr_len = 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
sv_vicmd_modestr (value)
|
||||
const char *value;
|
||||
{
|
||||
if (value && *value)
|
||||
{
|
||||
FREE (_rl_vi_cmd_mode_str);
|
||||
_rl_vi_cmd_mode_str = (char *)xmalloc (2 * strlen (value) + 1);
|
||||
rl_translate_keyseq (value, _rl_vi_cmd_mode_str, &_rl_vi_cmd_modestr_len);
|
||||
_rl_vi_cmd_mode_str[_rl_vi_cmd_modestr_len] = '\0';
|
||||
return 0;
|
||||
}
|
||||
else if (value)
|
||||
{
|
||||
FREE (_rl_vi_cmd_mode_str);
|
||||
_rl_vi_cmd_mode_str = (char *)xmalloc (1);
|
||||
_rl_vi_cmd_mode_str[_rl_vi_cmd_modestr_len = 0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
else if (value == 0)
|
||||
{
|
||||
FREE (_rl_vi_cmd_mode_str);
|
||||
_rl_vi_cmd_mode_str = 0; /* prompt_modestr does the right thing */
|
||||
_rl_vi_cmd_modestr_len = 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Return the character which matches NAME.
|
||||
For example, `Space' returns ' '. */
|
||||
|
||||
|
@ -2367,8 +2167,7 @@ rl_function_dumper (print_readably)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
xfree (names);
|
||||
free (names);
|
||||
}
|
||||
|
||||
/* Print all of the current functions and their bindings to
|
||||
|
@ -2401,7 +2200,7 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
|
|||
{
|
||||
case ISMACR:
|
||||
keyname = _rl_get_keyname (key);
|
||||
out = _rl_untranslate_macro_value ((char *)map[key].function, 0);
|
||||
out = _rl_untranslate_macro_value ((char *)map[key].function);
|
||||
|
||||
if (print_readably)
|
||||
fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "",
|
||||
|
@ -2513,7 +2312,7 @@ _rl_get_string_variable_value (name)
|
|||
{
|
||||
if (_rl_isearch_terminators == 0)
|
||||
return 0;
|
||||
ret = _rl_untranslate_macro_value (_rl_isearch_terminators, 0);
|
||||
ret = _rl_untranslate_macro_value (_rl_isearch_terminators);
|
||||
if (ret)
|
||||
{
|
||||
strncpy (numbuf, ret, sizeof (numbuf) - 1);
|
||||
|
@ -2531,17 +2330,6 @@ _rl_get_string_variable_value (name)
|
|||
ret = rl_get_keymap_name_from_edit_mode ();
|
||||
return (ret ? ret : "none");
|
||||
}
|
||||
else if (_rl_stricmp (name, "keyseq-timeout") == 0)
|
||||
{
|
||||
sprintf (numbuf, "%d", _rl_keyseq_timeout);
|
||||
return (numbuf);
|
||||
}
|
||||
else if (_rl_stricmp (name, "emacs-mode-string") == 0)
|
||||
return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_EMACS_MODESTR_DEFAULT);
|
||||
else if (_rl_stricmp (name, "vi-cmd-mode-string") == 0)
|
||||
return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_VI_CMD_MODESTR_DEFAULT);
|
||||
else if (_rl_stricmp (name, "vi-ins-mode-string") == 0)
|
||||
return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_VI_INS_MODESTR_DEFAULT);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -62,10 +62,8 @@ _rl_callback_generic_arg *_rl_callback_data = 0;
|
|||
whenever a complete line of input is ready. The user must then
|
||||
call rl_callback_read_char() every time some input is available, and
|
||||
rl_callback_read_char() will call the user's function with the complete
|
||||
text read in at each end of line. The terminal is kept prepped
|
||||
all the time, except during calls to the user's function. Signal
|
||||
handlers are only installed when the application calls back into
|
||||
readline, so readline doesn't `steal' signals from the application. */
|
||||
text read in at each end of line. The terminal is kept prepped and
|
||||
signals handled all the time, except during calls to the user's function. */
|
||||
|
||||
rl_vcpfunc_t *rl_linefunc; /* user callback function */
|
||||
static int in_handler; /* terminal_prepped and signals set? */
|
||||
|
@ -82,6 +80,10 @@ _rl_callback_newline ()
|
|||
|
||||
if (rl_prep_term_function)
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_set_signals ();
|
||||
#endif
|
||||
}
|
||||
|
||||
readline_internal_setup ();
|
||||
|
@ -100,16 +102,6 @@ rl_callback_handler_install (prompt, linefunc)
|
|||
_rl_callback_newline ();
|
||||
}
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
#define CALLBACK_READ_RETURN() \
|
||||
do { \
|
||||
rl_clear_signals (); \
|
||||
return; \
|
||||
} while (0)
|
||||
#else
|
||||
#define CALLBACK_READ_RETURN() return
|
||||
#endif
|
||||
|
||||
/* Read one character, and dispatch to the handler if it ends the line. */
|
||||
void
|
||||
rl_callback_read_char ()
|
||||
|
@ -125,24 +117,15 @@ rl_callback_read_char ()
|
|||
}
|
||||
|
||||
memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t));
|
||||
#if defined (HAVE_POSIX_SIGSETJMP)
|
||||
jcode = sigsetjmp (_rl_top_level, 0);
|
||||
#else
|
||||
jcode = setjmp (_rl_top_level);
|
||||
#endif
|
||||
if (jcode)
|
||||
{
|
||||
(*rl_redisplay_function) ();
|
||||
_rl_want_redisplay = 0;
|
||||
memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t));
|
||||
CALLBACK_READ_RETURN ();
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
/* Install signal handlers only when readline has control. */
|
||||
rl_set_signals ();
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
RL_CHECK_SIGNALS ();
|
||||
|
@ -152,13 +135,12 @@ rl_callback_read_char ()
|
|||
if (eof == 0 && (RL_ISSTATE (RL_STATE_ISEARCH) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
|
||||
rl_callback_read_char ();
|
||||
|
||||
CALLBACK_READ_RETURN ();
|
||||
return;
|
||||
}
|
||||
else if (RL_ISSTATE (RL_STATE_NSEARCH))
|
||||
{
|
||||
eof = _rl_nsearch_callback (_rl_nscxt);
|
||||
|
||||
CALLBACK_READ_RETURN ();
|
||||
return;
|
||||
}
|
||||
#if defined (VI_MODE)
|
||||
else if (RL_ISSTATE (RL_STATE_VIMOTION))
|
||||
|
@ -169,7 +151,7 @@ rl_callback_read_char ()
|
|||
if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
|
||||
_rl_internal_char_cleanup ();
|
||||
|
||||
CALLBACK_READ_RETURN ();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else if (RL_ISSTATE (RL_STATE_NUMERICARG))
|
||||
|
@ -181,7 +163,7 @@ rl_callback_read_char ()
|
|||
else if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
|
||||
_rl_internal_char_cleanup ();
|
||||
|
||||
CALLBACK_READ_RETURN ();
|
||||
return;
|
||||
}
|
||||
else if (RL_ISSTATE (RL_STATE_MULTIKEY))
|
||||
{
|
||||
|
@ -198,7 +180,7 @@ rl_callback_read_char ()
|
|||
{
|
||||
/* This allows functions that simply need to read an additional
|
||||
character (like quoted-insert) to register a function to be
|
||||
called when input is available. _rl_callback_data is a
|
||||
called when input is available. _rl_callback_data is simply a
|
||||
pointer to a struct that has the argument count originally
|
||||
passed to the registering function and space for any additional
|
||||
parameters. */
|
||||
|
@ -248,8 +230,6 @@ rl_callback_read_char ()
|
|||
}
|
||||
}
|
||||
while (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT));
|
||||
|
||||
CALLBACK_READ_RETURN ();
|
||||
}
|
||||
|
||||
/* Remove the handler, and make sure the terminal is in its normal state. */
|
||||
|
@ -284,34 +264,10 @@ _rl_callback_data_alloc (count)
|
|||
return arg;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_callback_data_dispose (arg)
|
||||
void _rl_callback_data_dispose (arg)
|
||||
_rl_callback_generic_arg *arg;
|
||||
{
|
||||
xfree (arg);
|
||||
}
|
||||
|
||||
/* Make sure that this agrees with cases in rl_callback_read_char */
|
||||
void
|
||||
rl_callback_sigcleanup ()
|
||||
{
|
||||
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
|
||||
return;
|
||||
|
||||
if (RL_ISSTATE (RL_STATE_ISEARCH))
|
||||
_rl_isearch_cleanup (_rl_iscxt, 0);
|
||||
else if (RL_ISSTATE (RL_STATE_NSEARCH))
|
||||
_rl_nsearch_cleanup (_rl_nscxt, 0);
|
||||
else if (RL_ISSTATE (RL_STATE_VIMOTION))
|
||||
RL_UNSETSTATE (RL_STATE_VIMOTION);
|
||||
else if (RL_ISSTATE (RL_STATE_NUMERICARG))
|
||||
{
|
||||
_rl_argcxt = 0;
|
||||
RL_UNSETSTATE (RL_STATE_NUMERICARG);
|
||||
}
|
||||
else if (RL_ISSTATE (RL_STATE_MULTIKEY))
|
||||
RL_UNSETSTATE (RL_STATE_MULTIKEY);
|
||||
|
||||
_rl_callback_func = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus)
|
||||
# define isxdigit(c) (isdigit((unsigned char)(c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
|
||||
#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT)
|
||||
# define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
|
||||
#endif
|
||||
|
||||
#if defined (CTYPE_NON_ASCII)
|
||||
|
@ -87,13 +87,13 @@
|
|||
|
||||
/* Beware: these only work with single-byte ASCII characters. */
|
||||
|
||||
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum ((unsigned char)c))
|
||||
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha ((unsigned char)c))
|
||||
#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit ((unsigned char)c))
|
||||
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower ((unsigned char)c))
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint ((unsigned char)c))
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char)c))
|
||||
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char)c))
|
||||
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
|
||||
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
|
||||
#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
|
||||
|
||||
#define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c))
|
||||
#define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c))
|
||||
|
|
|
@ -1,279 +0,0 @@
|
|||
/* `dir', `vdir' and `ls' directory listing programs for GNU.
|
||||
|
||||
Modified by Chet Ramey for Readline.
|
||||
|
||||
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Richard Stallman and David MacKenzie. */
|
||||
|
||||
/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis
|
||||
Flaherty <dennisf@denix.elk.miles.com> based on original patches by
|
||||
Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */
|
||||
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "rlconf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "posixstat.h" // stat related macros (S_ISREG, ...)
|
||||
#include <fcntl.h> // S_ISUID
|
||||
|
||||
// strlen()
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
// abort()
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include "readline.h"
|
||||
#include "rldefs.h"
|
||||
|
||||
#ifdef COLOR_SUPPORT
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "colors.h"
|
||||
|
||||
static bool is_colored (enum indicator_no type);
|
||||
static void restore_default_color (void);
|
||||
|
||||
COLOR_EXT_TYPE *_rl_color_ext_list = 0;
|
||||
|
||||
/* Output a color indicator (which may contain nulls). */
|
||||
void
|
||||
_rl_put_indicator (const struct bin_str *ind) {
|
||||
fwrite (ind->string, ind->len, 1, rl_outstream);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_colored (enum indicator_no colored_filetype)
|
||||
{
|
||||
size_t len = _rl_color_indicator[colored_filetype].len;
|
||||
char const *s = _rl_color_indicator[colored_filetype].string;
|
||||
return ! (len == 0
|
||||
|| (len == 1 && strncmp (s, "0", 1) == 0)
|
||||
|| (len == 2 && strncmp (s, "00", 2) == 0));
|
||||
}
|
||||
|
||||
static void
|
||||
restore_default_color (void)
|
||||
{
|
||||
_rl_put_indicator (&_rl_color_indicator[C_LEFT]);
|
||||
_rl_put_indicator (&_rl_color_indicator[C_RIGHT]);
|
||||
}
|
||||
|
||||
void
|
||||
_rl_set_normal_color (void)
|
||||
{
|
||||
if (is_colored (C_NORM))
|
||||
{
|
||||
_rl_put_indicator (&_rl_color_indicator[C_LEFT]);
|
||||
_rl_put_indicator (&_rl_color_indicator[C_NORM]);
|
||||
_rl_put_indicator (&_rl_color_indicator[C_RIGHT]);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
_rl_print_prefix_color (void)
|
||||
{
|
||||
struct bin_str *s;
|
||||
|
||||
/* What do we want to use for the prefix? Let's try cyan first, see colors.h */
|
||||
s = &_rl_color_indicator[C_PREFIX];
|
||||
if (s->string != NULL)
|
||||
{
|
||||
if (is_colored (C_NORM))
|
||||
restore_default_color ();
|
||||
_rl_put_indicator (&_rl_color_indicator[C_LEFT]);
|
||||
_rl_put_indicator (s);
|
||||
_rl_put_indicator (&_rl_color_indicator[C_RIGHT]);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Returns whether any color sequence was printed. */
|
||||
bool
|
||||
_rl_print_color_indicator (char *f)
|
||||
{
|
||||
enum indicator_no colored_filetype;
|
||||
COLOR_EXT_TYPE *ext; /* Color extension */
|
||||
size_t len; /* Length of name */
|
||||
|
||||
const char* name;
|
||||
char *filename;
|
||||
struct stat astat, linkstat;
|
||||
mode_t mode;
|
||||
int linkok; /* 1 == ok, 0 == dangling symlink, -1 == missing */
|
||||
int stat_ok;
|
||||
|
||||
name = f;
|
||||
|
||||
/* This should already have undergone tilde expansion */
|
||||
filename = 0;
|
||||
if (rl_filename_stat_hook)
|
||||
{
|
||||
filename = savestring (f);
|
||||
(*rl_filename_stat_hook) (&filename);
|
||||
name = filename;
|
||||
}
|
||||
|
||||
#if defined (HAVE_LSTAT)
|
||||
stat_ok = lstat(name, &astat);
|
||||
#else
|
||||
stat_ok = stat(name, &astat);
|
||||
#endif
|
||||
if (stat_ok == 0)
|
||||
{
|
||||
mode = astat.st_mode;
|
||||
#if defined (HAVE_LSTAT)
|
||||
if (S_ISLNK (mode))
|
||||
{
|
||||
linkok = stat (name, &linkstat) == 0;
|
||||
if (linkok && strncmp (_rl_color_indicator[C_LINK].string, "target", 6) == 0)
|
||||
mode = linkstat.st_mode;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
linkok = 1;
|
||||
}
|
||||
else
|
||||
linkok = -1;
|
||||
|
||||
/* Is this a nonexistent file? If so, linkok == -1. */
|
||||
|
||||
if (linkok == -1 && _rl_color_indicator[C_MISSING].string != NULL)
|
||||
colored_filetype = C_MISSING;
|
||||
else if (linkok == 0 && S_ISLNK(mode) && _rl_color_indicator[C_ORPHAN].string != NULL)
|
||||
colored_filetype = C_ORPHAN; /* dangling symlink */
|
||||
else if(stat_ok != 0)
|
||||
{
|
||||
static enum indicator_no filetype_indicator[] = FILETYPE_INDICATORS;
|
||||
colored_filetype = filetype_indicator[normal]; //f->filetype];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (S_ISREG (mode))
|
||||
{
|
||||
colored_filetype = C_FILE;
|
||||
|
||||
if ((mode & S_ISUID) != 0 && is_colored (C_SETUID))
|
||||
colored_filetype = C_SETUID;
|
||||
else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
|
||||
colored_filetype = C_SETGID;
|
||||
else if (is_colored (C_CAP) && 0) //f->has_capability)
|
||||
colored_filetype = C_CAP;
|
||||
else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
|
||||
colored_filetype = C_EXEC;
|
||||
else if ((1 < astat.st_nlink) && is_colored (C_MULTIHARDLINK))
|
||||
colored_filetype = C_MULTIHARDLINK;
|
||||
}
|
||||
else if (S_ISDIR (mode))
|
||||
{
|
||||
colored_filetype = C_DIR;
|
||||
|
||||
#if defined (S_ISVTX)
|
||||
if ((mode & S_ISVTX) && (mode & S_IWOTH)
|
||||
&& is_colored (C_STICKY_OTHER_WRITABLE))
|
||||
colored_filetype = C_STICKY_OTHER_WRITABLE;
|
||||
else
|
||||
#endif
|
||||
if ((mode & S_IWOTH) != 0 && is_colored (C_OTHER_WRITABLE))
|
||||
colored_filetype = C_OTHER_WRITABLE;
|
||||
#if defined (S_ISVTX)
|
||||
else if ((mode & S_ISVTX) != 0 && is_colored (C_STICKY))
|
||||
colored_filetype = C_STICKY;
|
||||
#endif
|
||||
}
|
||||
else if (S_ISLNK (mode))
|
||||
colored_filetype = C_LINK;
|
||||
else if (S_ISFIFO (mode))
|
||||
colored_filetype = C_FIFO;
|
||||
else if (S_ISSOCK (mode))
|
||||
colored_filetype = C_SOCK;
|
||||
else if (S_ISBLK (mode))
|
||||
colored_filetype = C_BLK;
|
||||
else if (S_ISCHR (mode))
|
||||
colored_filetype = C_CHR;
|
||||
else
|
||||
{
|
||||
/* Classify a file of some other type as C_ORPHAN. */
|
||||
colored_filetype = C_ORPHAN;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check the file's suffix only if still classified as C_FILE. */
|
||||
ext = NULL;
|
||||
if (colored_filetype == C_FILE)
|
||||
{
|
||||
/* Test if NAME has a recognized suffix. */
|
||||
len = strlen (name);
|
||||
name += len; /* Pointer to final \0. */
|
||||
for (ext = _rl_color_ext_list; ext != NULL; ext = ext->next)
|
||||
{
|
||||
if (ext->ext.len <= len
|
||||
&& strncmp (name - ext->ext.len, ext->ext.string,
|
||||
ext->ext.len) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free (filename); /* NULL or savestring return value */
|
||||
|
||||
{
|
||||
const struct bin_str *const s
|
||||
= ext ? &(ext->seq) : &_rl_color_indicator[colored_filetype];
|
||||
if (s->string != NULL)
|
||||
{
|
||||
/* Need to reset so not dealing with attribute combinations */
|
||||
if (is_colored (C_NORM))
|
||||
restore_default_color ();
|
||||
_rl_put_indicator (&_rl_color_indicator[C_LEFT]);
|
||||
_rl_put_indicator (s);
|
||||
_rl_put_indicator (&_rl_color_indicator[C_RIGHT]);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_rl_prep_non_filename_text (void)
|
||||
{
|
||||
if (_rl_color_indicator[C_END].string != NULL)
|
||||
_rl_put_indicator (&_rl_color_indicator[C_END]);
|
||||
else
|
||||
{
|
||||
_rl_put_indicator (&_rl_color_indicator[C_LEFT]);
|
||||
_rl_put_indicator (&_rl_color_indicator[C_RESET]);
|
||||
_rl_put_indicator (&_rl_color_indicator[C_RIGHT]);
|
||||
}
|
||||
}
|
||||
#endif /* COLOR_SUPPORT */
|
|
@ -1,126 +0,0 @@
|
|||
/* `dir', `vdir' and `ls' directory listing programs for GNU.
|
||||
|
||||
Modified by Chet Ramey for Readline.
|
||||
|
||||
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Richard Stallman and David MacKenzie. */
|
||||
|
||||
/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis
|
||||
Flaherty <dennisf@denix.elk.miles.com> based on original patches by
|
||||
Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */
|
||||
|
||||
#ifndef _COLORS_H_
|
||||
#define _COLORS_H_
|
||||
|
||||
#include <stdio.h> // size_t
|
||||
|
||||
#if defined(__TANDEM) && defined(HAVE_STDBOOL_H) && (__STDC_VERSION__ < 199901L)
|
||||
typedef int _Bool;
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STDBOOL_H)
|
||||
# include <stdbool.h> // bool
|
||||
#else
|
||||
typedef int _rl_bool_t;
|
||||
|
||||
#ifdef bool
|
||||
# undef bool
|
||||
#endif
|
||||
#define bool _rl_bool_t
|
||||
|
||||
#ifndef true
|
||||
# define true 1
|
||||
# define false 0
|
||||
#endif
|
||||
|
||||
#endif /* !HAVE_STDBOOL_H */
|
||||
|
||||
/* Null is a valid character in a color indicator (think about Epson
|
||||
printers, for example) so we have to use a length/buffer string
|
||||
type. */
|
||||
struct bin_str
|
||||
{
|
||||
size_t len;
|
||||
const char *string;
|
||||
};
|
||||
|
||||
/* file type indicators (dir, sock, fifo, ...)
|
||||
Default value is initialized in parse-colors.c.
|
||||
It is then modified from the values of $LS_COLORS. */
|
||||
extern struct bin_str _rl_color_indicator[];
|
||||
|
||||
/* The LS_COLORS variable is in a termcap-like format. */
|
||||
typedef struct _color_ext_type
|
||||
{
|
||||
struct bin_str ext; /* The extension we're looking for */
|
||||
struct bin_str seq; /* The sequence to output when we do */
|
||||
struct _color_ext_type *next; /* Next in list */
|
||||
} COLOR_EXT_TYPE;
|
||||
|
||||
/* file extensions indicators (.txt, .log, .jpg, ...)
|
||||
Values are taken from $LS_COLORS in rl_parse_colors(). */
|
||||
extern COLOR_EXT_TYPE *_rl_color_ext_list;
|
||||
|
||||
#define FILETYPE_INDICATORS \
|
||||
{ \
|
||||
C_ORPHAN, C_FIFO, C_CHR, C_DIR, C_BLK, C_FILE, \
|
||||
C_LINK, C_SOCK, C_FILE, C_DIR \
|
||||
}
|
||||
|
||||
/* Whether we used any colors in the output so far. If so, we will
|
||||
need to restore the default color later. If not, we will need to
|
||||
call prep_non_filename_text before using color for the first time. */
|
||||
|
||||
enum indicator_no
|
||||
{
|
||||
C_LEFT, C_RIGHT, C_END, C_RESET, C_NORM, C_FILE, C_DIR, C_LINK,
|
||||
C_FIFO, C_SOCK,
|
||||
C_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR, C_SETUID, C_SETGID,
|
||||
C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE, C_CAP, C_MULTIHARDLINK,
|
||||
C_CLR_TO_EOL
|
||||
};
|
||||
|
||||
|
||||
#if !S_IXUGO
|
||||
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
|
||||
#endif
|
||||
|
||||
enum filetype
|
||||
{
|
||||
unknown,
|
||||
fifo,
|
||||
chardev,
|
||||
directory,
|
||||
blockdev,
|
||||
normal,
|
||||
symbolic_link,
|
||||
sock,
|
||||
whiteout,
|
||||
arg_directory
|
||||
};
|
||||
|
||||
/* Prefix color, currently same as directory */
|
||||
#define C_PREFIX C_DIR
|
||||
|
||||
extern void _rl_put_indicator (const struct bin_str *ind);
|
||||
extern void _rl_set_normal_color (void);
|
||||
extern bool _rl_print_prefix_color (void);
|
||||
extern bool _rl_print_color_indicator (char *f);
|
||||
extern void _rl_prep_non_filename_text (void);
|
||||
|
||||
#endif /* !_COLORS_H_ */
|
|
@ -1,6 +1,6 @@
|
|||
/* complete.c -- filename completion for readline. */
|
||||
|
||||
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2011 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.
|
||||
|
@ -31,8 +31,6 @@
|
|||
# include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
@ -66,10 +64,6 @@ extern int errno;
|
|||
#include "xmalloc.h"
|
||||
#include "rlprivate.h"
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
# include "colors.h"
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
typedef int QSFUNC (const void *, const void *);
|
||||
#else
|
||||
|
@ -100,29 +94,17 @@ extern struct passwd *getpwent PARAMS((void));
|
|||
longest string in that array. */
|
||||
rl_compdisp_func_t *rl_completion_display_matches_hook = (rl_compdisp_func_t *)NULL;
|
||||
|
||||
#if defined (VISIBLE_STATS) || defined (COLOR_SUPPORT)
|
||||
#if defined (VISIBLE_STATS)
|
||||
# if !defined (X_OK)
|
||||
# define X_OK 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (VISIBLE_STATS)
|
||||
static int stat_char PARAMS((char *));
|
||||
#endif
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
static int colored_stat_start PARAMS((char *));
|
||||
static void colored_stat_end PARAMS((void));
|
||||
static int colored_prefix_start PARAMS((void));
|
||||
static void colored_prefix_end PARAMS((void));
|
||||
#endif
|
||||
|
||||
static int path_isdir PARAMS((const char *));
|
||||
|
||||
static char *rl_quote_filename PARAMS((char *, int, char *));
|
||||
|
||||
static void _rl_complete_sigcleanup PARAMS((int, void *));
|
||||
|
||||
static void set_completion_defaults PARAMS((int));
|
||||
static int get_y_or_n PARAMS((int));
|
||||
static int _rl_internal_pager PARAMS((int));
|
||||
|
@ -174,7 +156,7 @@ int _rl_complete_mark_symlink_dirs = 0;
|
|||
int _rl_print_completions_horizontally;
|
||||
|
||||
/* Non-zero means that case is not significant in filename completion. */
|
||||
#if (defined (__MSDOS__) && !defined (__DJGPP__)) || (defined (_WIN32) && !defined (__CYGWIN__))
|
||||
#if defined (__MSDOS__) && !defined (__DJGPP__)
|
||||
int _rl_completion_case_fold = 1;
|
||||
#else
|
||||
int _rl_completion_case_fold = 0;
|
||||
|
@ -207,14 +189,6 @@ int _rl_completion_columns = -1;
|
|||
int rl_visible_stats = 0;
|
||||
#endif /* VISIBLE_STATS */
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
/* Non-zero means to use colors to indicate file type when listing possible
|
||||
completions. The colors used are taken from $LS_COLORS, if set. */
|
||||
int _rl_colored_stats = 0;
|
||||
|
||||
int _rl_colored_completion_prefix = 1;
|
||||
#endif
|
||||
|
||||
/* If non-zero, when completing in the middle of a word, don't insert
|
||||
characters from the match that match characters following point in
|
||||
the word. This means, for instance, completing when the cursor is
|
||||
|
@ -232,8 +206,6 @@ rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
|
|||
|
||||
rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
rl_icppfunc_t *rl_filename_stat_hook = (rl_icppfunc_t *)NULL;
|
||||
|
||||
/* If non-zero, this is the address of a function to call when reading
|
||||
directory entries from the filesystem for completion and comparing
|
||||
them to the partial word to be completed. The function should
|
||||
|
@ -408,8 +380,6 @@ static int completion_changed_buffer;
|
|||
/* The result of the query to the user about displaying completion matches */
|
||||
static int completion_y_or_n;
|
||||
|
||||
static int _rl_complete_display_matches_interrupt = 0;
|
||||
|
||||
/*************************************/
|
||||
/* */
|
||||
/* Bindable completion functions */
|
||||
|
@ -487,18 +457,6 @@ _rl_reset_completion_state ()
|
|||
rl_completion_quote_character = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_rl_complete_sigcleanup (sig, ptr)
|
||||
int sig;
|
||||
void *ptr;
|
||||
{
|
||||
if (sig == SIGINT) /* XXX - for now */
|
||||
{
|
||||
_rl_free_match_list ((char **)ptr);
|
||||
_rl_complete_display_matches_interrupt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set default values for readline word completion. These are the variables
|
||||
that application completion functions can change or inspect. */
|
||||
static void
|
||||
|
@ -514,9 +472,6 @@ set_completion_defaults (what_to_do)
|
|||
|
||||
/* The completion entry function may optionally change this. */
|
||||
rl_completion_mark_symlink_dirs = _rl_complete_mark_symlink_dirs;
|
||||
|
||||
/* Reset private state. */
|
||||
_rl_complete_display_matches_interrupt = 0;
|
||||
}
|
||||
|
||||
/* The user must press "y" or "n". Non-zero return means "y" pressed. */
|
||||
|
@ -526,12 +481,17 @@ get_y_or_n (for_pager)
|
|||
{
|
||||
int c;
|
||||
|
||||
/* Disabled for GDB due to the gdb.base/readline-ask.exp regression.
|
||||
[patch] testsuite: Test readline-6.2 "ask" regression
|
||||
http://sourceware.org/ml/gdb-patches/2011-05/msg00002.html */
|
||||
#if 0
|
||||
/* For now, disable pager in callback mode, until we later convert to state
|
||||
driven functions. Have to wait until next major version to add new
|
||||
state definition, since it will change value of RL_STATE_DONE. */
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
if (RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
return 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (;;)
|
||||
|
@ -596,8 +556,6 @@ stat_char (filename)
|
|||
{
|
||||
struct stat finfo;
|
||||
int character, r;
|
||||
char *f;
|
||||
const char *fn;
|
||||
|
||||
/* Short-circuit a //server on cygwin, since that will always behave as
|
||||
a directory. */
|
||||
|
@ -606,20 +564,10 @@ stat_char (filename)
|
|||
return '/';
|
||||
#endif
|
||||
|
||||
f = 0;
|
||||
if (rl_filename_stat_hook)
|
||||
{
|
||||
f = savestring (filename);
|
||||
(*rl_filename_stat_hook) (&f);
|
||||
fn = f;
|
||||
}
|
||||
else
|
||||
fn = filename;
|
||||
|
||||
#if defined (HAVE_LSTAT) && defined (S_ISLNK)
|
||||
r = lstat (fn, &finfo);
|
||||
r = lstat (filename, &finfo);
|
||||
#else
|
||||
r = stat (fn, &finfo);
|
||||
r = stat (filename, &finfo);
|
||||
#endif
|
||||
|
||||
if (r == -1)
|
||||
|
@ -651,56 +599,25 @@ stat_char (filename)
|
|||
else if (S_ISREG (finfo.st_mode))
|
||||
{
|
||||
#if defined (_WIN32) && !defined (__CYGWIN__)
|
||||
char *ext;
|
||||
/* Windows 'access' doesn't support X_OK and on latest Windows
|
||||
versions even invokes an invalid parameter exception. */
|
||||
char *ext = strrchr (filename, '.');
|
||||
|
||||
/* Windows doesn't do access and X_OK; check file extension instead */
|
||||
ext = strrchr (fn, '.');
|
||||
if (ext && (_rl_stricmp (ext, ".exe") == 0 ||
|
||||
_rl_stricmp (ext, ".cmd") == 0 ||
|
||||
_rl_stricmp (ext, ".bat") == 0 ||
|
||||
_rl_stricmp (ext, ".com") == 0))
|
||||
if (ext
|
||||
&& (_rl_stricmp (ext, ".exe") == 0
|
||||
|| _rl_stricmp (ext, ".cmd") == 0
|
||||
|| _rl_stricmp (ext, ".bat") == 0
|
||||
|| _rl_stricmp (ext, ".com") == 0))
|
||||
character = '*';
|
||||
#else
|
||||
if (access (filename, X_OK) == 0)
|
||||
character = '*';
|
||||
#endif
|
||||
}
|
||||
|
||||
xfree (f);
|
||||
return (character);
|
||||
}
|
||||
#endif /* VISIBLE_STATS */
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
static int
|
||||
colored_stat_start (filename)
|
||||
char *filename;
|
||||
{
|
||||
_rl_set_normal_color ();
|
||||
return (_rl_print_color_indicator (filename));
|
||||
}
|
||||
|
||||
static void
|
||||
colored_stat_end ()
|
||||
{
|
||||
_rl_prep_non_filename_text ();
|
||||
_rl_put_indicator (&_rl_color_indicator[C_CLR_TO_EOL]);
|
||||
}
|
||||
|
||||
static int
|
||||
colored_prefix_start ()
|
||||
{
|
||||
_rl_set_normal_color ();
|
||||
return (_rl_print_prefix_color ());
|
||||
}
|
||||
|
||||
static void
|
||||
colored_prefix_end ()
|
||||
{
|
||||
colored_stat_end (); /* for now */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return the portion of PATHNAME that should be output when listing
|
||||
possible completions. If we are hacking filename completion, we
|
||||
are only interested in the basename, the portion following the
|
||||
|
@ -719,7 +636,7 @@ printable_part (pathname)
|
|||
return (pathname);
|
||||
|
||||
temp = strrchr (pathname, '/');
|
||||
#if defined (__MSDOS__) || defined (_WIN32)
|
||||
#if defined (__MSDOS__)
|
||||
if (temp == 0 && ISALPHA ((unsigned char)pathname[0]) && pathname[1] == ':')
|
||||
temp = pathname + 1;
|
||||
#endif
|
||||
|
@ -780,7 +697,7 @@ fnwidth (string)
|
|||
else
|
||||
{
|
||||
pos += clen;
|
||||
w = WCWIDTH (wc);
|
||||
w = wcwidth (wc);
|
||||
width += (w >= 0) ? w : 1;
|
||||
}
|
||||
#else
|
||||
|
@ -802,7 +719,6 @@ fnprint (to_print, prefix_bytes)
|
|||
{
|
||||
int printed_len, w;
|
||||
const char *s;
|
||||
int common_prefix_len;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t ps;
|
||||
const char *end;
|
||||
|
@ -814,14 +730,14 @@ fnprint (to_print, prefix_bytes)
|
|||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
printed_len = common_prefix_len = 0;
|
||||
printed_len = 0;
|
||||
|
||||
/* 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 && _rl_completion_prefix_display_length > 0)
|
||||
if (prefix_bytes)
|
||||
{
|
||||
char ellipsis;
|
||||
|
||||
|
@ -830,15 +746,6 @@ fnprint (to_print, prefix_bytes)
|
|||
putc (ellipsis, rl_outstream);
|
||||
printed_len = ELLIPSIS_LEN;
|
||||
}
|
||||
#if defined (COLOR_SUPPORT)
|
||||
else if (prefix_bytes && _rl_colored_completion_prefix > 0)
|
||||
{
|
||||
common_prefix_len = prefix_bytes;
|
||||
prefix_bytes = 0;
|
||||
/* XXX - print color indicator start here */
|
||||
colored_prefix_start ();
|
||||
}
|
||||
#endif
|
||||
|
||||
s = to_print + prefix_bytes;
|
||||
while (*s)
|
||||
|
@ -877,7 +784,7 @@ fnprint (to_print, prefix_bytes)
|
|||
break;
|
||||
else
|
||||
{
|
||||
w = WCWIDTH (wc);
|
||||
w = wcwidth (wc);
|
||||
width = (w >= 0) ? w : 1;
|
||||
}
|
||||
fwrite (s, 1, tlen, rl_outstream);
|
||||
|
@ -889,13 +796,6 @@ fnprint (to_print, prefix_bytes)
|
|||
printed_len++;
|
||||
#endif
|
||||
}
|
||||
if (common_prefix_len > 0 && (s - to_print) >= common_prefix_len)
|
||||
{
|
||||
/* printed bytes = s - to_print */
|
||||
/* printed bytes should never be > but check for paranoia's sake */
|
||||
colored_prefix_end ();
|
||||
common_prefix_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return printed_len;
|
||||
|
@ -914,20 +814,13 @@ print_filename (to_print, full_pathname, prefix_bytes)
|
|||
char *s, c, *new_full_pathname, *dn;
|
||||
|
||||
extension_char = 0;
|
||||
#if defined (COLOR_SUPPORT)
|
||||
/* Defer printing if we want to prefix with a color indicator */
|
||||
if (_rl_colored_stats == 0 || rl_filename_completion_desired == 0)
|
||||
#endif
|
||||
printed_len = fnprint (to_print, prefix_bytes);
|
||||
printed_len = fnprint (to_print, prefix_bytes);
|
||||
|
||||
if (rl_filename_completion_desired && (
|
||||
#if defined (VISIBLE_STATS)
|
||||
rl_visible_stats ||
|
||||
if (rl_filename_completion_desired && (rl_visible_stats || _rl_complete_mark_directories))
|
||||
#else
|
||||
if (rl_filename_completion_desired && _rl_complete_mark_directories)
|
||||
#endif
|
||||
#if defined (COLOR_SUPPORT)
|
||||
_rl_colored_stats ||
|
||||
#endif
|
||||
_rl_complete_mark_directories))
|
||||
{
|
||||
/* If to_print != full_pathname, to_print is the basename of the
|
||||
path passed. In this case, we try to expand the directory
|
||||
|
@ -973,28 +866,8 @@ print_filename (to_print, full_pathname, prefix_bytes)
|
|||
extension_char = stat_char (new_full_pathname);
|
||||
else
|
||||
#endif
|
||||
if (_rl_complete_mark_directories)
|
||||
{
|
||||
dn = 0;
|
||||
if (rl_directory_completion_hook == 0 && rl_filename_stat_hook)
|
||||
{
|
||||
dn = savestring (new_full_pathname);
|
||||
(*rl_filename_stat_hook) (&dn);
|
||||
xfree (new_full_pathname);
|
||||
new_full_pathname = dn;
|
||||
}
|
||||
if (path_isdir (new_full_pathname))
|
||||
extension_char = '/';
|
||||
}
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
if (_rl_colored_stats)
|
||||
{
|
||||
colored_stat_start (new_full_pathname);
|
||||
printed_len = fnprint (to_print, prefix_bytes);
|
||||
colored_stat_end ();
|
||||
}
|
||||
#endif
|
||||
if (path_isdir (new_full_pathname))
|
||||
extension_char = '/';
|
||||
|
||||
xfree (new_full_pathname);
|
||||
to_print[-1] = c;
|
||||
|
@ -1007,18 +880,8 @@ print_filename (to_print, full_pathname, prefix_bytes)
|
|||
extension_char = stat_char (s);
|
||||
else
|
||||
#endif
|
||||
if (_rl_complete_mark_directories && path_isdir (s))
|
||||
if (path_isdir (s))
|
||||
extension_char = '/';
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
if (_rl_colored_stats)
|
||||
{
|
||||
colored_stat_start (s);
|
||||
printed_len = fnprint (to_print, prefix_bytes);
|
||||
colored_stat_end ();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
xfree (s);
|
||||
|
@ -1213,13 +1076,10 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
|
|||
variable rl_attempted_completion_function. */
|
||||
if (rl_attempted_completion_function)
|
||||
{
|
||||
_rl_interrupt_immediately++;
|
||||
matches = (*rl_attempted_completion_function) (text, start, end);
|
||||
if (RL_SIG_RECEIVED())
|
||||
{
|
||||
_rl_free_match_list (matches);
|
||||
matches = 0;
|
||||
RL_CHECK_SIGNALS ();
|
||||
}
|
||||
if (_rl_interrupt_immediately > 0)
|
||||
_rl_interrupt_immediately--;
|
||||
|
||||
if (matches || rl_attempted_completion_over)
|
||||
{
|
||||
|
@ -1230,15 +1090,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
|
|||
|
||||
/* XXX -- filename dequoting moved into rl_filename_completion_function */
|
||||
|
||||
/* rl_completion_matches will check for signals as well to avoid a long
|
||||
delay while reading a directory. */
|
||||
matches = rl_completion_matches (text, our_func);
|
||||
if (RL_SIG_RECEIVED())
|
||||
{
|
||||
_rl_free_match_list (matches);
|
||||
matches = 0;
|
||||
RL_CHECK_SIGNALS ();
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
|
@ -1313,11 +1165,9 @@ compute_lcd_of_matches (match_list, matches, text)
|
|||
{
|
||||
register int i, c1, c2, si;
|
||||
int low; /* Count of max-matched characters. */
|
||||
int lx;
|
||||
char *dtext; /* dequoted TEXT, if needed */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
int v;
|
||||
size_t v1, v2;
|
||||
mbstate_t ps1, ps2;
|
||||
wchar_t wc1, wc2;
|
||||
#endif
|
||||
|
@ -1350,20 +1200,14 @@ compute_lcd_of_matches (match_list, matches, text)
|
|||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
v1 = mbrtowc(&wc1, match_list[i]+si, strlen (match_list[i]+si), &ps1);
|
||||
v2 = mbrtowc (&wc2, match_list[i+1]+si, strlen (match_list[i+1]+si), &ps2);
|
||||
if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2))
|
||||
{
|
||||
if (c1 != c2) /* do byte comparison */
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
v = mbrtowc (&wc1, match_list[i]+si, strlen (match_list[i]+si), &ps1);
|
||||
mbrtowc (&wc2, match_list[i+1]+si, strlen (match_list[i+1]+si), &ps2);
|
||||
wc1 = towlower (wc1);
|
||||
wc2 = towlower (wc2);
|
||||
if (wc1 != wc2)
|
||||
break;
|
||||
else if (v1 > 1)
|
||||
si += v1 - 1;
|
||||
else if (v > 1)
|
||||
si += v - 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -1438,20 +1282,21 @@ compute_lcd_of_matches (match_list, matches, text)
|
|||
qsort (match_list+1, matches, sizeof(char *), (QSFUNC *)_rl_qsort_string_compare);
|
||||
|
||||
si = strlen (text);
|
||||
lx = (si <= low) ? si : low; /* check shorter of text and matches */
|
||||
/* Try to preserve the case of what the user typed in the presence of
|
||||
multiple matches: check each match for something that matches
|
||||
what the user typed taking case into account; use it up to common
|
||||
length of matches if one is found. If not, just use first match. */
|
||||
for (i = 1; i <= matches; i++)
|
||||
if (strncmp (match_list[i], text, lx) == 0)
|
||||
{
|
||||
strncpy (match_list[0], match_list[i], low);
|
||||
break;
|
||||
}
|
||||
/* no casematch, use first entry */
|
||||
if (i > matches)
|
||||
strncpy (match_list[0], match_list[1], low);
|
||||
if (si <= low)
|
||||
{
|
||||
for (i = 1; i <= matches; i++)
|
||||
if (strncmp (match_list[i], text, si) == 0)
|
||||
{
|
||||
strncpy (match_list[0], match_list[i], low);
|
||||
break;
|
||||
}
|
||||
/* no casematch, use first entry */
|
||||
if (i > matches)
|
||||
strncpy (match_list[0], match_list[1], low);
|
||||
}
|
||||
else
|
||||
/* otherwise, just use the text the user typed. */
|
||||
strncpy (match_list[0], text, low);
|
||||
|
||||
FREE (dtext);
|
||||
}
|
||||
|
@ -1478,7 +1323,7 @@ postprocess_matches (matchesp, matching_filenames)
|
|||
return 0;
|
||||
|
||||
/* It seems to me that in all the cases we handle we would like
|
||||
to ignore duplicate possibilities. Scan for the text to
|
||||
to ignore duplicate possiblilities. Scan for the text to
|
||||
insert being identical to the other completions. */
|
||||
if (rl_ignore_completion_duplicates)
|
||||
{
|
||||
|
@ -1556,7 +1401,7 @@ rl_display_match_list (matches, len, max)
|
|||
if (_rl_completion_prefix_display_length > 0)
|
||||
{
|
||||
t = printable_part (matches[0]);
|
||||
temp = strrchr (t, '/'); /* check again in case of /usr/src/ */
|
||||
temp = strrchr (t, '/');
|
||||
common_length = temp ? fnwidth (temp) : fnwidth (t);
|
||||
sind = temp ? strlen (temp) : strlen (t);
|
||||
|
||||
|
@ -1565,15 +1410,6 @@ rl_display_match_list (matches, len, max)
|
|||
else
|
||||
common_length = sind = 0;
|
||||
}
|
||||
#if defined (COLOR_SUPPORT)
|
||||
else if (_rl_colored_completion_prefix > 0)
|
||||
{
|
||||
t = printable_part (matches[0]);
|
||||
temp = strrchr (t, '/');
|
||||
common_length = temp ? fnwidth (temp) : fnwidth (t);
|
||||
sind = temp ? RL_STRLEN (temp+1) : RL_STRLEN (t); /* want portion after final slash */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* How many items of MAX length can we fit in the screen window? */
|
||||
cols = complete_get_screenwidth ();
|
||||
|
@ -1626,12 +1462,6 @@ rl_display_match_list (matches, len, max)
|
|||
l += count;
|
||||
}
|
||||
rl_crlf ();
|
||||
#if defined (SIGWINCH)
|
||||
if (RL_SIG_RECEIVED () && RL_SIGWINCH_RECEIVED() == 0)
|
||||
#else
|
||||
if (RL_SIG_RECEIVED ())
|
||||
#endif
|
||||
return;
|
||||
lines++;
|
||||
if (_rl_page_completions && lines >= (_rl_screenheight - 1) && i < count)
|
||||
{
|
||||
|
@ -1649,15 +1479,9 @@ rl_display_match_list (matches, len, max)
|
|||
temp = printable_part (matches[i]);
|
||||
printed_len = print_filename (temp, matches[i], sind);
|
||||
/* Have we reached the end of this line? */
|
||||
#if defined (SIGWINCH)
|
||||
if (RL_SIG_RECEIVED () && RL_SIGWINCH_RECEIVED() == 0)
|
||||
#else
|
||||
if (RL_SIG_RECEIVED ())
|
||||
#endif
|
||||
return;
|
||||
if (matches[i+1])
|
||||
{
|
||||
if (limit == 1 || (i && (limit > 1) && (i % limit) == 0))
|
||||
if (i && (limit > 1) && (i % limit) == 0)
|
||||
{
|
||||
rl_crlf ();
|
||||
lines++;
|
||||
|
@ -1866,7 +1690,7 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
|
|||
char *text;
|
||||
int delimiter, quote_char, nontrivial_match;
|
||||
{
|
||||
char temp_string[4], *filename, *fn;
|
||||
char temp_string[4], *filename;
|
||||
int temp_string_index, s;
|
||||
struct stat finfo;
|
||||
|
||||
|
@ -1885,13 +1709,6 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
|
|||
if (rl_filename_completion_desired)
|
||||
{
|
||||
filename = tilde_expand (text);
|
||||
if (rl_filename_stat_hook)
|
||||
{
|
||||
fn = savestring (filename);
|
||||
(*rl_filename_stat_hook) (&fn);
|
||||
xfree (filename);
|
||||
filename = fn;
|
||||
}
|
||||
s = (nontrivial_match && rl_completion_mark_symlink_dirs == 0)
|
||||
? LSTAT (filename, &finfo)
|
||||
: stat (filename, &finfo);
|
||||
|
@ -1911,7 +1728,8 @@ append_to_match (text, delimiter, quote_char, nontrivial_match)
|
|||
#ifdef S_ISLNK
|
||||
/* Don't add anything if the filename is a symlink and resolves to a
|
||||
directory. */
|
||||
else if (s == 0 && S_ISLNK (finfo.st_mode) && path_isdir (filename))
|
||||
else if (s == 0 && S_ISLNK (finfo.st_mode) &&
|
||||
stat (filename, &finfo) == 0 && S_ISDIR (finfo.st_mode))
|
||||
;
|
||||
#endif
|
||||
else
|
||||
|
@ -2031,8 +1849,10 @@ rl_complete_internal (what_to_do)
|
|||
/* nontrivial_lcd is set if the common prefix adds something to the word
|
||||
being completed. */
|
||||
nontrivial_lcd = matches && strcmp (text, matches[0]) != 0;
|
||||
#if 1
|
||||
if (what_to_do == '!' || what_to_do == '@')
|
||||
tlen = strlen (text);
|
||||
#endif
|
||||
xfree (text);
|
||||
|
||||
if (matches == 0)
|
||||
|
@ -2066,6 +1886,10 @@ rl_complete_internal (what_to_do)
|
|||
case '!':
|
||||
case '@':
|
||||
/* Insert the first match with proper quoting. */
|
||||
#if 0
|
||||
if (*matches[0])
|
||||
insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char);
|
||||
#else
|
||||
if (what_to_do == TAB)
|
||||
{
|
||||
if (*matches[0])
|
||||
|
@ -2080,6 +1904,7 @@ rl_complete_internal (what_to_do)
|
|||
if (mlen >= tlen)
|
||||
insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If there are more matches, ring the bell to indicate.
|
||||
If we are in vi mode, Posix.2 says to not ring the bell.
|
||||
|
@ -2115,22 +1940,7 @@ rl_complete_internal (what_to_do)
|
|||
break;
|
||||
|
||||
case '?':
|
||||
if (rl_completion_display_matches_hook == 0)
|
||||
{
|
||||
_rl_sigcleanup = _rl_complete_sigcleanup;
|
||||
_rl_sigcleanarg = matches;
|
||||
_rl_complete_display_matches_interrupt = 0;
|
||||
}
|
||||
display_matches (matches);
|
||||
if (_rl_complete_display_matches_interrupt)
|
||||
{
|
||||
matches = 0; /* already freed by rl_complete_sigcleanup */
|
||||
_rl_complete_display_matches_interrupt = 0;
|
||||
if (rl_signal_event_hook)
|
||||
(*rl_signal_event_hook) (); /* XXX */
|
||||
}
|
||||
_rl_sigcleanup = 0;
|
||||
_rl_sigcleanarg = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2138,7 +1948,6 @@ rl_complete_internal (what_to_do)
|
|||
rl_ding ();
|
||||
FREE (saved_line_buffer);
|
||||
RL_UNSETSTATE(RL_STATE_COMPLETING);
|
||||
_rl_free_match_list (matches);
|
||||
_rl_reset_completion_state ();
|
||||
return 1;
|
||||
}
|
||||
|
@ -2154,8 +1963,6 @@ rl_complete_internal (what_to_do)
|
|||
|
||||
RL_UNSETSTATE(RL_STATE_COMPLETING);
|
||||
_rl_reset_completion_state ();
|
||||
|
||||
RL_CHECK_SIGNALS ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2182,8 +1989,6 @@ rl_completion_matches (text, entry_function)
|
|||
const char *text;
|
||||
rl_compentry_func_t *entry_function;
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* Number of slots in match_list. */
|
||||
int match_list_size;
|
||||
|
||||
|
@ -2201,36 +2006,18 @@ rl_completion_matches (text, entry_function)
|
|||
match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
|
||||
match_list[1] = (char *)NULL;
|
||||
|
||||
_rl_interrupt_immediately++;
|
||||
while (string = (*entry_function) (text, matches))
|
||||
{
|
||||
if (RL_SIG_RECEIVED ())
|
||||
{
|
||||
/* Start at 1 because we don't set matches[0] in this function.
|
||||
Only free the list members if we're building match list from
|
||||
rl_filename_completion_function, since we know that doesn't
|
||||
free the strings it returns. */
|
||||
if (entry_function == rl_filename_completion_function)
|
||||
{
|
||||
for (i = 1; match_list[i]; i++)
|
||||
xfree (match_list[i]);
|
||||
}
|
||||
xfree (match_list);
|
||||
match_list = 0;
|
||||
match_list_size = 0;
|
||||
matches = 0;
|
||||
RL_CHECK_SIGNALS ();
|
||||
}
|
||||
|
||||
if (matches + 1 >= match_list_size)
|
||||
if (matches + 1 == match_list_size)
|
||||
match_list = (char **)xrealloc
|
||||
(match_list, ((match_list_size += 10) + 1) * sizeof (char *));
|
||||
|
||||
if (match_list == 0)
|
||||
return (match_list);
|
||||
|
||||
match_list[++matches] = string;
|
||||
match_list[matches + 1] = (char *)NULL;
|
||||
}
|
||||
if (_rl_interrupt_immediately > 0)
|
||||
_rl_interrupt_immediately--;
|
||||
|
||||
/* If there were any matches, then look through them finding out the
|
||||
lowest common denominator. That then becomes match_list[0]. */
|
||||
|
@ -2269,9 +2056,7 @@ rl_username_completion_function (text, state)
|
|||
|
||||
username = savestring (&text[first_char_loc]);
|
||||
namelen = strlen (username);
|
||||
#if defined (HAVE_GETPWENT)
|
||||
setpwent ();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (HAVE_GETPWENT)
|
||||
|
@ -2308,9 +2093,8 @@ rl_username_completion_function (text, state)
|
|||
|
||||
/* Return non-zero if CONVFN matches FILENAME up to the length of FILENAME
|
||||
(FILENAME_LEN). If _rl_completion_case_fold is set, compare without
|
||||
regard to the alphabetic case of characters. If
|
||||
_rl_completion_case_map is set, make `-' and `_' equivalent. CONVFN is
|
||||
the possibly-converted directory entry; FILENAME is what the user typed. */
|
||||
regard to the alphabetic case of characters. CONVFN is the possibly-
|
||||
converted directory entry; FILENAME is what the user typed. */
|
||||
static int
|
||||
complete_fncmp (convfn, convlen, filename, filename_len)
|
||||
const char *convfn;
|
||||
|
@ -2320,110 +2104,34 @@ complete_fncmp (convfn, convlen, filename, filename_len)
|
|||
{
|
||||
register char *s1, *s2;
|
||||
int d, len;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t v1, v2;
|
||||
mbstate_t ps1, ps2;
|
||||
wchar_t wc1, wc2;
|
||||
#endif
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
memset (&ps1, 0, sizeof (mbstate_t));
|
||||
memset (&ps2, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
if (filename_len == 0)
|
||||
return 1;
|
||||
if (convlen < filename_len)
|
||||
return 0;
|
||||
|
||||
len = filename_len;
|
||||
s1 = (char *)convfn;
|
||||
s2 = (char *)filename;
|
||||
|
||||
/* Otherwise, if these match up to the length of filename, then
|
||||
it is a match. */
|
||||
if (_rl_completion_case_fold && _rl_completion_case_map)
|
||||
{
|
||||
/* Case-insensitive comparison treating _ and - as equivalent */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (filename_len == 0)
|
||||
return 1;
|
||||
if (convlen < filename_len)
|
||||
return 0;
|
||||
s1 = (char *)convfn;
|
||||
s2 = (char *)filename;
|
||||
len = filename_len;
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
v1 = mbrtowc (&wc1, s1, convlen, &ps1);
|
||||
v2 = mbrtowc (&wc2, s2, filename_len, &ps2);
|
||||
if (v1 == 0 && v2 == 0)
|
||||
return 1;
|
||||
else if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2))
|
||||
{
|
||||
if (*s1 != *s2) /* do byte comparison */
|
||||
return 0;
|
||||
else if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_'))
|
||||
return 0;
|
||||
s1++; s2++; len--;
|
||||
continue;
|
||||
}
|
||||
wc1 = towlower (wc1);
|
||||
wc2 = towlower (wc2);
|
||||
s1 += v1;
|
||||
s2 += v1;
|
||||
len -= v1;
|
||||
if ((wc1 == L'-' || wc1 == L'_') && (wc2 == L'-' || wc2 == L'_'))
|
||||
continue;
|
||||
if (wc1 != wc2)
|
||||
return 0;
|
||||
}
|
||||
while (len != 0);
|
||||
d = _rl_to_lower (*s1) - _rl_to_lower (*s2);
|
||||
/* *s1 == [-_] && *s2 == [-_] */
|
||||
if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_'))
|
||||
d = 0;
|
||||
if (d != 0)
|
||||
return 0;
|
||||
s1++; s2++; /* already checked convlen >= filename_len */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
do
|
||||
{
|
||||
d = _rl_to_lower (*s1) - _rl_to_lower (*s2);
|
||||
/* *s1 == [-_] && *s2 == [-_] */
|
||||
if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_'))
|
||||
d = 0;
|
||||
if (d != 0)
|
||||
return 0;
|
||||
s1++; s2++; /* already checked convlen >= filename_len */
|
||||
}
|
||||
while (--len != 0);
|
||||
}
|
||||
|
||||
while (--len != 0);
|
||||
return 1;
|
||||
}
|
||||
else if (_rl_completion_case_fold)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
v1 = mbrtowc (&wc1, s1, convlen, &ps1);
|
||||
v2 = mbrtowc (&wc2, s2, filename_len, &ps2);
|
||||
if (v1 == 0 && v2 == 0)
|
||||
return 1;
|
||||
else if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2))
|
||||
{
|
||||
if (*s1 != *s2) /* do byte comparison */
|
||||
return 0;
|
||||
s1++; s2++; len--;
|
||||
continue;
|
||||
}
|
||||
wc1 = towlower (wc1);
|
||||
wc2 = towlower (wc2);
|
||||
if (wc1 != wc2)
|
||||
return 0;
|
||||
s1 += v1;
|
||||
s2 += v1;
|
||||
len -= v1;
|
||||
}
|
||||
while (len != 0);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((_rl_to_lower (convfn[0]) == _rl_to_lower (filename[0])) &&
|
||||
(convlen >= filename_len) &&
|
||||
(_rl_strnicmp (filename, convfn, filename_len) == 0))
|
||||
|
@ -2455,7 +2163,6 @@ rl_filename_completion_function (text, state)
|
|||
static int filename_len;
|
||||
char *temp, *dentry, *convfn;
|
||||
int dirlen, dentlen, convlen;
|
||||
int tilde_dirname;
|
||||
struct dirent *entry;
|
||||
|
||||
/* If we don't have any state, then do some initialization. */
|
||||
|
@ -2479,7 +2186,7 @@ rl_filename_completion_function (text, state)
|
|||
|
||||
temp = strrchr (dirname, '/');
|
||||
|
||||
#if defined (__MSDOS__) || defined (_WIN32)
|
||||
#if defined (__MSDOS__)
|
||||
/* special hack for //X/... */
|
||||
if (dirname[0] == '/' && dirname[1] == '/' && ISALPHA ((unsigned char)dirname[2]) && dirname[3] == '/')
|
||||
temp = strrchr (dirname + 3, '/');
|
||||
|
@ -2490,7 +2197,7 @@ rl_filename_completion_function (text, state)
|
|||
strcpy (filename, ++temp);
|
||||
*temp = '\0';
|
||||
}
|
||||
#if defined (__MSDOS__) || (defined (_WIN32) && !defined (__CYGWIN__))
|
||||
#if defined (__MSDOS__)
|
||||
/* searches from current directory on the drive */
|
||||
else if (ISALPHA ((unsigned char)dirname[0]) && dirname[1] == ':')
|
||||
{
|
||||
|
@ -2513,13 +2220,11 @@ rl_filename_completion_function (text, state)
|
|||
else
|
||||
users_dirname = savestring (dirname);
|
||||
|
||||
tilde_dirname = 0;
|
||||
if (*dirname == '~')
|
||||
{
|
||||
temp = tilde_expand (dirname);
|
||||
xfree (dirname);
|
||||
dirname = temp;
|
||||
tilde_dirname = 1;
|
||||
}
|
||||
|
||||
/* We have saved the possibly-dequoted version of the directory name
|
||||
|
@ -2538,7 +2243,7 @@ rl_filename_completion_function (text, state)
|
|||
xfree (users_dirname);
|
||||
users_dirname = savestring (dirname);
|
||||
}
|
||||
else if (tilde_dirname == 0 && rl_completion_found_quote && rl_filename_dequoting_function)
|
||||
else if (rl_completion_found_quote && rl_filename_dequoting_function)
|
||||
{
|
||||
/* delete single and double quotes */
|
||||
xfree (dirname);
|
||||
|
@ -2546,9 +2251,8 @@ rl_filename_completion_function (text, state)
|
|||
}
|
||||
directory = opendir (dirname);
|
||||
|
||||
/* Now dequote a non-null filename. FILENAME will not be NULL, but may
|
||||
be empty. */
|
||||
if (*filename && rl_completion_found_quote && rl_filename_dequoting_function)
|
||||
/* Now dequote a non-null filename. */
|
||||
if (filename && *filename && rl_completion_found_quote && rl_filename_dequoting_function)
|
||||
{
|
||||
/* delete single and double quotes */
|
||||
temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character);
|
||||
|
@ -2912,11 +2616,6 @@ rl_menu_complete (count, ignore)
|
|||
full_completion = 1;
|
||||
return (0);
|
||||
}
|
||||
else if (_rl_menu_complete_prefix_first)
|
||||
{
|
||||
rl_ding ();
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
else if (match_list_size <= 1)
|
||||
{
|
||||
|
|
|
@ -1,21 +1,14 @@
|
|||
/* config.h.in. Maintained by hand. */
|
||||
|
||||
/* Template definitions for autoconf */
|
||||
#undef __EXTENSIONS__
|
||||
#undef _ALL_SOURCE
|
||||
#undef _GNU_SOURCE
|
||||
#undef _POSIX_SOURCE
|
||||
#undef _POSIX_1_SOURCE
|
||||
#undef _POSIX_PTHREAD_SEMANTICS
|
||||
#undef _TANDEM_SOURCE
|
||||
#undef _MINIX
|
||||
|
||||
/* Define NO_MULTIBYTE_SUPPORT to not compile in support for multibyte
|
||||
characters, even if the OS supports them. */
|
||||
#undef NO_MULTIBYTE_SUPPORT
|
||||
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
|
@ -33,16 +26,12 @@
|
|||
#undef volatile
|
||||
|
||||
#undef PROTOTYPES
|
||||
#undef __PROTOTYPES
|
||||
|
||||
#undef __CHAR_UNSIGNED__
|
||||
|
||||
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
#undef STAT_MACROS_BROKEN
|
||||
|
||||
/* Define if you have the chown function. */
|
||||
#undef HAVE_CHOWN
|
||||
|
||||
/* Define if you have the fcntl function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
|
@ -88,15 +77,9 @@
|
|||
/* Define if you have the memmove function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define if you have the pselect function. */
|
||||
#undef HAVE_PSELECT
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define if you have the readlink function. */
|
||||
#undef HAVE_READLINK
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
|
@ -141,9 +124,6 @@
|
|||
/* Define if you have the wcwidth function. */
|
||||
#undef HAVE_WCWIDTH
|
||||
|
||||
/* and whether it works */
|
||||
#undef WCWIDTH_BROKEN
|
||||
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
|
@ -167,18 +147,12 @@
|
|||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <ncurses/termcap.h> header file. */
|
||||
#undef HAVE_NCURSES_TERMCAP_H
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
/* Define if you have the <stdbool.h> header file. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
|
@ -194,9 +168,6 @@
|
|||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
|
@ -247,9 +218,6 @@
|
|||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
#undef HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
|
||||
#undef HAVE_DECL_AUDIT_USER_TTY
|
||||
|
||||
/* Definitions pulled in from aclocal.m4. */
|
||||
#undef VOID_SIGHANDLER
|
||||
|
||||
|
@ -267,11 +235,9 @@
|
|||
|
||||
#undef HAVE_GETPW_DECLS
|
||||
|
||||
#undef HAVE_STRUCT_DIRENT_D_INO
|
||||
#undef STRUCT_DIRENT_HAS_D_INO
|
||||
|
||||
#undef HAVE_STRUCT_DIRENT_D_FILENO
|
||||
|
||||
#undef HAVE_STRUCT_DIRENT_D_NAMLEN
|
||||
#undef STRUCT_DIRENT_HAS_D_FILENO
|
||||
|
||||
#undef HAVE_BSD_SIGNALS
|
||||
|
||||
|
@ -293,4 +259,12 @@
|
|||
# define TERMIOS_MISSING
|
||||
#endif
|
||||
|
||||
/* VARARGS defines moved to rlstdc.h */
|
||||
#if defined (__STDC__) && defined (HAVE_STDARG_H)
|
||||
# define PREFER_STDARG
|
||||
# define USE_VARARGS
|
||||
#else
|
||||
# if defined (HAVE_VARARGS_H)
|
||||
# define PREFER_VARARGS
|
||||
# define USE_VARARGS
|
||||
# endif
|
||||
#endif
|
||||
|
|
340
readline/configure
vendored
340
readline/configure
vendored
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
# From configure.ac for Readline 7.0, version 2.80.
|
||||
# From configure.in for Readline 6.2, version 2.67.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.64 for readline 7.0.
|
||||
# Generated by GNU Autoconf 2.64 for readline 6.2.
|
||||
#
|
||||
# Report bugs to <bug-readline@gnu.org>.
|
||||
#
|
||||
|
@ -550,8 +550,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='readline'
|
||||
PACKAGE_TARNAME='readline'
|
||||
PACKAGE_VERSION='7.0'
|
||||
PACKAGE_STRING='readline 7.0'
|
||||
PACKAGE_VERSION='6.2'
|
||||
PACKAGE_STRING='readline 6.2'
|
||||
PACKAGE_BUGREPORT='bug-readline@gnu.org'
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
@ -693,7 +693,6 @@ enable_option_checking
|
|||
with_curses
|
||||
with_purify
|
||||
enable_multibyte
|
||||
enable_shared
|
||||
enable_static
|
||||
enable_largefile
|
||||
'
|
||||
|
@ -1247,7 +1246,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures readline 7.0 to adapt to many kinds of systems.
|
||||
\`configure' configures readline 6.2 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1312,7 +1311,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of readline 7.0:";;
|
||||
short | recursive ) echo "Configuration of readline 6.2:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1321,7 +1320,6 @@ Optional Features:
|
|||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-multibyte enable multibyte characters if OS supports them
|
||||
--enable-shared build shared libraries [default=YES]
|
||||
--enable-static build static libraries [default=YES]
|
||||
--disable-largefile omit support for large files
|
||||
|
||||
|
@ -1408,7 +1406,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
readline configure 7.0
|
||||
readline configure 6.2
|
||||
generated by GNU Autoconf 2.64
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
@ -1829,50 +1827,11 @@ $as_echo "$ac_res" >&6; }
|
|||
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
|
||||
|
||||
} # ac_fn_c_check_func
|
||||
|
||||
# ac_fn_c_check_decl LINENO SYMBOL VAR
|
||||
# ------------------------------------
|
||||
# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
|
||||
ac_fn_c_check_decl ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
|
||||
$as_echo_n "checking whether $2 is declared... " >&6; }
|
||||
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$4
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#ifndef $2
|
||||
(void) $2;
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
eval "$3=yes"
|
||||
else
|
||||
eval "$3=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
eval ac_res=\$$3
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
|
||||
|
||||
} # ac_fn_c_check_decl
|
||||
cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by readline $as_me 7.0, which was
|
||||
It was created by readline $as_me 6.2, which was
|
||||
generated by GNU Autoconf 2.64. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
@ -2223,8 +2182,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ac_aux_dir=
|
||||
for ac_dir in ./support "$srcdir"/./support; do
|
||||
for ac_dir in `cd $srcdir;pwd`/.. "$srcdir"/`cd $srcdir;pwd`/..; do
|
||||
for ac_t in install-sh install.sh shtool; do
|
||||
if test -f "$ac_dir/$ac_t"; then
|
||||
ac_aux_dir=$ac_dir
|
||||
|
@ -2234,7 +2196,7 @@ for ac_dir in ./support "$srcdir"/./support; do
|
|||
done
|
||||
done
|
||||
if test -z "$ac_aux_dir"; then
|
||||
as_fn_error "cannot find install-sh, install.sh, or shtool in ./support \"$srcdir\"/./support" "$LINENO" 5
|
||||
as_fn_error "cannot find install-sh, install.sh, or shtool in \`cd $srcdir;pwd\`/.. \"$srcdir\"/\`cd $srcdir;pwd\`/.." "$LINENO" 5
|
||||
fi
|
||||
|
||||
# These three variables are undocumented and unsupported,
|
||||
|
@ -2249,7 +2211,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
|||
ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
LIBVERSION=7.0
|
||||
LIBVERSION=6.2
|
||||
|
||||
# Make sure we can run config.sub.
|
||||
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
|
||||
|
@ -2359,11 +2321,6 @@ if test "${enable_multibyte+set}" = set; then :
|
|||
enableval=$enable_multibyte; opt_multibyte=$enableval
|
||||
fi
|
||||
|
||||
# Check whether --enable-shared was given.
|
||||
if test "${enable_shared+set}" = set; then :
|
||||
enableval=$enable_shared; opt_shared_libs=$enableval
|
||||
fi
|
||||
|
||||
# Check whether --enable-static was given.
|
||||
if test "${enable_static+set}" = set; then :
|
||||
enableval=$enable_static; opt_static_libs=$enableval
|
||||
|
@ -2769,12 +2726,10 @@ done
|
|||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
FILE *f = fopen ("conftest.out", "w");
|
||||
return ferror (f) || fclose (f) != 0;
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
@ -3806,9 +3761,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
|
|||
|
||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
||||
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}ar; ac_word=$2
|
||||
# Extract the first word of "ar", so it can be a program name with args.
|
||||
set dummy ar; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if test "${ac_cv_prog_AR+set}" = set; then :
|
||||
|
@ -3824,7 +3778,7 @@ do
|
|||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_prog_AR="${ac_tool_prefix}ar"
|
||||
ac_cv_prog_AR=""
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
|
@ -3832,6 +3786,7 @@ done
|
|||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
|
||||
fi
|
||||
fi
|
||||
AR=$ac_cv_prog_AR
|
||||
|
@ -3844,60 +3799,6 @@ $as_echo "no" >&6; }
|
|||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_prog_AR"; then
|
||||
ac_ct_AR=$AR
|
||||
# Extract the first word of "ar", so it can be a program name with args.
|
||||
set dummy ar; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$ac_ct_AR"; then
|
||||
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_prog_ac_ct_AR="ar"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_AR=$ac_cv_prog_ac_ct_AR
|
||||
if test -n "$ac_ct_AR"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
|
||||
$as_echo "$ac_ct_AR" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$ac_ct_AR" = x; then
|
||||
AR=""
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||
ac_tool_warned=yes ;;
|
||||
esac
|
||||
AR=$ac_ct_AR
|
||||
fi
|
||||
else
|
||||
AR="$ac_cv_prog_AR"
|
||||
fi
|
||||
|
||||
test -n "$ARFLAGS" || ARFLAGS="cr"
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
|
||||
|
@ -4530,7 +4431,7 @@ fi
|
|||
fi
|
||||
|
||||
|
||||
for ac_func in fcntl kill lstat readlink
|
||||
for ac_func in fcntl kill lstat
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
|
@ -4543,7 +4444,7 @@ _ACEOF
|
|||
fi
|
||||
done
|
||||
|
||||
for ac_func in memmove pselect putenv select setenv setlocale \
|
||||
for ac_func in memmove putenv select setenv setlocale \
|
||||
strcasecmp strpbrk tcgetattr vsnprintf
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
|
@ -4584,101 +4485,6 @@ fi
|
|||
done
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
|
||||
$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
|
||||
if test "${ac_cv_type_uid_t+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <sys/types.h>
|
||||
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "uid_t" >/dev/null 2>&1; then :
|
||||
ac_cv_type_uid_t=yes
|
||||
else
|
||||
ac_cv_type_uid_t=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
|
||||
$as_echo "$ac_cv_type_uid_t" >&6; }
|
||||
if test $ac_cv_type_uid_t = no; then
|
||||
|
||||
$as_echo "#define uid_t int" >>confdefs.h
|
||||
|
||||
|
||||
$as_echo "#define gid_t int" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
for ac_header in unistd.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_unistd_h" = x""yes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_UNISTD_H 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
|
||||
$as_echo_n "checking for working chown... " >&6; }
|
||||
if test "${ac_cv_func_chown_works+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
ac_cv_func_chown_works=no
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <fcntl.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char *f = "conftest.chown";
|
||||
struct stat before, after;
|
||||
|
||||
if (creat (f, 0600) < 0)
|
||||
return 1;
|
||||
if (stat (f, &before) < 0)
|
||||
return 1;
|
||||
if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
|
||||
return 1;
|
||||
if (stat (f, &after) < 0)
|
||||
return 1;
|
||||
return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
ac_cv_func_chown_works=yes
|
||||
else
|
||||
ac_cv_func_chown_works=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
rm -f conftest.chown
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5
|
||||
$as_echo "$ac_cv_func_chown_works" >&6; }
|
||||
if test $ac_cv_func_chown_works = yes; then
|
||||
|
||||
$as_echo "#define HAVE_CHOWN 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5
|
||||
$as_echo_n "checking for working strcoll... " >&6; }
|
||||
if test "${ac_cv_func_strcoll_works+set}" = set; then :
|
||||
|
@ -4719,8 +4525,7 @@ $as_echo "#define HAVE_STRCOLL 1" >>confdefs.h
|
|||
fi
|
||||
|
||||
|
||||
for ac_header in fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
|
||||
string.h strings.h \
|
||||
for ac_header in fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
|
||||
limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
|
@ -4735,7 +4540,7 @@ fi
|
|||
|
||||
done
|
||||
|
||||
for ac_header in sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h
|
||||
for ac_header in sys/pte.h sys/stream.h sys/select.h sys/file.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||
|
@ -5818,19 +5623,6 @@ $as_echo "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h
|
|||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_decl "$LINENO" "AUDIT_USER_TTY" "ac_cv_have_decl_AUDIT_USER_TTY" "#include <linux/audit.h>
|
||||
"
|
||||
if test "x$ac_cv_have_decl_AUDIT_USER_TTY" = x""yes; then :
|
||||
ac_have_decl=1
|
||||
else
|
||||
ac_have_decl=0
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_AUDIT_USER_TTY $ac_have_decl
|
||||
_ACEOF
|
||||
|
||||
|
||||
case "$host_os" in
|
||||
aix*) prefer_curses=yes ;;
|
||||
esac
|
||||
|
@ -6052,21 +5844,6 @@ if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
|
|||
TERMCAP_LIB=-ltermcap #default
|
||||
fi
|
||||
fi
|
||||
# Windows ncurses installation
|
||||
if test "$TERMCAP_LIB" = "-lncurses"; then
|
||||
for ac_header in ncurses/termcap.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "ncurses/termcap.h" "ac_cv_header_ncurses_termcap_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_ncurses_termcap_h" = x""yes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_NCURSES_TERMCAP_H 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
|
||||
for ac_header in wctype.h
|
||||
|
@ -6106,19 +5883,6 @@ fi
|
|||
done
|
||||
|
||||
|
||||
for ac_header in mbstr.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "mbstr.h" "ac_cv_header_mbstr_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_mbstr_h" = x""yes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_MBSTR_H 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "mbrlen" "ac_cv_func_mbrlen"
|
||||
if test "x$ac_cv_func_mbrlen" = x""yes; then :
|
||||
$as_echo "#define HAVE_MBRLEN 1" >>confdefs.h
|
||||
|
@ -6150,6 +5914,7 @@ if test "x$ac_cv_func_mbsrtowcs" = x""yes; then :
|
|||
fi
|
||||
|
||||
|
||||
|
||||
for ac_func in mbschr
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "mbschr" "ac_cv_func_mbschr"
|
||||
|
@ -6411,57 +6176,9 @@ $as_echo "#define HAVE_WINT_T 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wcwidth broken with unicode combining characters" >&5
|
||||
$as_echo_n "checking for wcwidth broken with unicode combining characters... " >&6; }
|
||||
if test "${bash_cv_wcwidth_broken+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
bash_cv_wcwidth_broken=no
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <locale.h>
|
||||
#include <wchar.h>
|
||||
|
||||
main(c, v)
|
||||
int c;
|
||||
char **v;
|
||||
{
|
||||
int w;
|
||||
|
||||
setlocale(LC_ALL, "en_US.UTF-8");
|
||||
w = wcwidth (0x0301);
|
||||
exit (w == 0); /* exit 0 if wcwidth broken */
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
bash_cv_wcwidth_broken=yes
|
||||
else
|
||||
bash_cv_wcwidth_broken=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_wcwidth_broken" >&5
|
||||
$as_echo "$bash_cv_wcwidth_broken" >&6; }
|
||||
if test "$bash_cv_wcwidth_broken" = yes; then
|
||||
|
||||
$as_echo "#define WCWIDTH_BROKEN 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBINTL $LIBICONV"
|
||||
LIBS="$LIBS $LIBICONV"
|
||||
for ac_func in locale_charset
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "locale_charset" "ac_cv_func_locale_charset"
|
||||
|
@ -6576,7 +6293,7 @@ esac
|
|||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc"
|
||||
ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile"
|
||||
|
||||
ac_config_commands="$ac_config_commands default"
|
||||
|
||||
|
@ -7085,7 +6802,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by readline $as_me 7.0, which was
|
||||
This file was extended by readline $as_me 6.2, which was
|
||||
generated by GNU Autoconf 2.64. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -7149,7 +6866,7 @@ Report bugs to <bug-readline@gnu.org>."
|
|||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_version="\\
|
||||
readline config.status 7.0
|
||||
readline config.status 6.2
|
||||
configured by $0, generated by GNU Autoconf 2.64,
|
||||
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
@ -7268,7 +6985,6 @@ do
|
|||
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
|
||||
"examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
|
||||
"shlib/Makefile") CONFIG_FILES="$CONFIG_FILES shlib/Makefile" ;;
|
||||
"readline.pc") CONFIG_FILES="$CONFIG_FILES readline.pc" ;;
|
||||
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
|
||||
|
||||
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
|
||||
|
|
|
@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu
|
|||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1987-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
|
||||
|
@ -20,19 +20,23 @@ dnl Process this file with autoconf to produce a configure script.
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Readline 7.0, version 2.80])
|
||||
AC_REVISION([for Readline 6.2, version 2.67])
|
||||
|
||||
AC_INIT(readline, 7.0, bug-readline@gnu.org)
|
||||
m4_include([../config/override.m4])
|
||||
|
||||
AC_INIT(readline, 6.2, bug-readline@gnu.org)
|
||||
|
||||
dnl make sure we are using a recent autoconf version
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
AC_CONFIG_SRCDIR(readline.h)
|
||||
AC_CONFIG_AUX_DIR(./support)
|
||||
dnl GDB LOCAL
|
||||
dnl AC_CONFIG_AUX_DIR(./support)
|
||||
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
dnl update the value of RL_READLINE_VERSION in readline.h when this changes
|
||||
LIBVERSION=7.0
|
||||
LIBVERSION=6.2
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_BUILD
|
||||
|
@ -61,7 +65,7 @@ opt_static_libs=yes
|
|||
opt_shared_libs=no
|
||||
|
||||
AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
|
||||
AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
|
||||
dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
|
||||
AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
|
||||
|
||||
if test $opt_multibyte = no; then
|
||||
|
@ -115,7 +119,7 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
|
|||
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_INSTALL
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_PROG(AR, ar, , ar)
|
||||
dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
|
||||
dnl This allows people to set it when running configure or make
|
||||
test -n "$ARFLAGS" || ARFLAGS="cr"
|
||||
|
@ -139,19 +143,17 @@ AC_HEADER_STDC
|
|||
AC_HEADER_STAT
|
||||
AC_HEADER_DIRENT
|
||||
|
||||
AC_CHECK_FUNCS(fcntl kill lstat readlink)
|
||||
AC_CHECK_FUNCS(memmove pselect putenv select setenv setlocale \
|
||||
AC_CHECK_FUNCS(fcntl kill lstat)
|
||||
AC_CHECK_FUNCS(memmove putenv select setenv setlocale \
|
||||
strcasecmp strpbrk tcgetattr vsnprintf)
|
||||
AC_CHECK_FUNCS(isascii isxdigit)
|
||||
AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
|
||||
|
||||
AC_FUNC_CHOWN
|
||||
AC_FUNC_STRCOLL
|
||||
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
|
||||
string.h strings.h \
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
|
||||
limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
|
||||
AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h)
|
||||
AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h)
|
||||
|
||||
AC_CHECK_HEADERS(sys/ptem.h,,,
|
||||
[[
|
||||
|
@ -184,8 +186,6 @@ BASH_STRUCT_WINSIZE
|
|||
BASH_STRUCT_DIRENT_D_INO
|
||||
BASH_STRUCT_DIRENT_D_FILENO
|
||||
|
||||
AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
|
||||
|
||||
dnl yuck
|
||||
case "$host_os" in
|
||||
aix*) prefer_curses=yes ;;
|
||||
|
@ -198,10 +198,6 @@ if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
|
|||
TERMCAP_LIB=-ltermcap #default
|
||||
fi
|
||||
fi
|
||||
# Windows ncurses installation
|
||||
if test "$TERMCAP_LIB" = "-lncurses"; then
|
||||
AC_CHECK_HEADERS(ncurses/termcap.h)
|
||||
fi
|
||||
|
||||
BASH_CHECK_MULTIBYTE
|
||||
|
||||
|
@ -301,7 +297,7 @@ AC_SUBST(LIBVERSION)
|
|||
|
||||
AC_SUBST(TERMCAP_LIB)
|
||||
|
||||
AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc],
|
||||
AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
|
||||
[
|
||||
# Makefile uses this timestamp file to record whether config.h is up to date.
|
||||
echo > stamp-h
|
File diff suppressed because it is too large
Load diff
|
@ -16,8 +16,6 @@
|
|||
# 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_TARNAME = @PACKAGE_TARNAME@
|
||||
|
||||
topdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
@ -26,7 +24,6 @@ prefix = @prefix@
|
|||
|
||||
datarootdir = @datarootdir@
|
||||
|
||||
docdir = @docdir@
|
||||
infodir = @infodir@
|
||||
|
||||
mandir = @mandir@
|
||||
|
@ -59,8 +56,6 @@ QUIETPS = #set this to -q to shut up dvips
|
|||
PAPERSIZE = letter
|
||||
PSDPI = 600
|
||||
DVIPS = dvips -D ${PSDPI} $(QUIETPS) -t ${PAPERSIZE} -o $@ # tricky
|
||||
# experimental; uses external texi2dvi for now; this needs pdftex to be present
|
||||
TEXI2PDF = texi2dvi --pdf
|
||||
|
||||
# These tools might not be available; they're not required
|
||||
DVIPDF = dvipdfm -o $@ -p ${PAPERSIZE}
|
||||
|
@ -103,10 +98,6 @@ DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ) $(INFOOBJ) $(TEXTOBJ) $(PDFOBJ)
|
|||
$(RM) $@
|
||||
-${DVIPDF} $<
|
||||
|
||||
#.texi.pdf:
|
||||
# $(RM) $@
|
||||
# -${TEXI2PDF} $<
|
||||
|
||||
all: info dvi html ps text pdf
|
||||
nodvi: info html text
|
||||
|
||||
|
@ -176,15 +167,9 @@ history_3.ps: $(srcdir)/history.3
|
|||
${RM} $@
|
||||
${GROFF} -man < $(srcdir)/history.3 > $@
|
||||
|
||||
readline.pdf: $(RLSRC)
|
||||
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) $(srcdir)/rlman.texi
|
||||
mv rlman.pdf $@
|
||||
|
||||
history.pdf: $(HISTSRC)
|
||||
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) $(srcdir)/history.texi
|
||||
|
||||
rluserman.pdf: $(RLSRC)
|
||||
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) $(srcdir)/rluserman.texi
|
||||
readline.pdf: readline.dvi
|
||||
history.pdf: history.dvi
|
||||
rluserman.pdf: rluserman.dvi
|
||||
|
||||
clean:
|
||||
$(RM) *.aux *.bak *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps \
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
.\" Chet Ramey
|
||||
.\" Information Network Services
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\" chet@ins.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Sun May 24 18:01:17 EDT 2015
|
||||
.\" Last Change: Thu Aug 12 22:24:41 EDT 2010
|
||||
.\"
|
||||
.TH HISTORY 3 "2015 May 24" "GNU History 6.3"
|
||||
.TH HISTORY 3 "2010 August 12" "GNU History 6.2"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
|
@ -40,8 +40,8 @@
|
|||
.SH NAME
|
||||
history \- GNU History Library
|
||||
.SH COPYRIGHT
|
||||
.if t The GNU History Library is Copyright \(co 1989-2014 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2014 by the Free Software Foundation, Inc.
|
||||
.if t The GNU History Library is Copyright \(co 1989-2011 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2011 by the Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
Many programs read input from the user a line at a time. The GNU
|
||||
History library is able to keep track of those lines, associate arbitrary
|
||||
|
@ -112,7 +112,7 @@ starting with
|
|||
.TP
|
||||
.B !?\fIstring\fR\fB[?]\fR
|
||||
Refer to the most recent command
|
||||
preceding the current position in the history list
|
||||
preceding the current postition in the history list
|
||||
containing
|
||||
.IR string .
|
||||
The trailing \fB?\fP may be omitted if
|
||||
|
@ -134,7 +134,7 @@ The entire command line typed so far.
|
|||
.SS Word Designators
|
||||
.PP
|
||||
Word designators are used to select desired words from the event.
|
||||
A
|
||||
A
|
||||
.B :
|
||||
separates the event specification from the word designator.
|
||||
It may be omitted if the word designator begins with a
|
||||
|
@ -161,8 +161,7 @@ The \fIn\fRth word.
|
|||
The first argument. That is, word 1.
|
||||
.TP
|
||||
.B $
|
||||
The last word. This is usually the last argument, but will expand to the
|
||||
zeroth word if there is only one word in the line.
|
||||
The last argument.
|
||||
.TP
|
||||
.B %
|
||||
The word matched by the most recent `?\fIstring\fR?' search.
|
||||
|
@ -441,11 +440,9 @@ return a pointer to that entry. If there is no previous entry, return
|
|||
a \fBNULL\fP pointer.
|
||||
|
||||
.Fn1 "HIST_ENTRY *" next_history "void"
|
||||
If the current history offset refers to a valid history entry,
|
||||
increment the current history offset.
|
||||
If the possibly-incremented history offset refers to a valid history
|
||||
entry, return a pointer to that entry;
|
||||
otherwise, return a \fBNULL\fP pointer.
|
||||
Move the current history offset forward to the next history entry, and
|
||||
return the a pointer to that entry. If there is no next entry, return
|
||||
a \fBNULL\fP pointer.
|
||||
|
||||
.SS Searching the History List
|
||||
|
||||
|
@ -615,8 +612,8 @@ string, in addition to space, tab, \fI:\fP and \fI?\fP in the case of
|
|||
a substring search. The default is empty.
|
||||
|
||||
.Vb int history_quotes_inhibit_expansion
|
||||
If non-zero, double-quoted words are not scanned for the history expansion
|
||||
character or the history comment character. The default value is 0.
|
||||
If non-zero, single-quoted words are not scanned for the history expansion
|
||||
character. The default value is 0.
|
||||
|
||||
.Vb "rl_linebuf_func_t *" history_inhibit_expansion_function
|
||||
This should be set to the address of a function that takes two arguments:
|
||||
|
@ -652,7 +649,7 @@ bfox@gnu.org
|
|||
.PP
|
||||
Chet Ramey, Case Western Reserve University
|
||||
.br
|
||||
chet.ramey@case.edu
|
||||
chet@ins.CWRU.Edu
|
||||
.SH BUG REPORTS
|
||||
If you find a bug in the
|
||||
.B history
|
||||
|
@ -672,4 +669,4 @@ newsgroup
|
|||
.PP
|
||||
Comments and bug reports concerning
|
||||
this manual page should be directed to
|
||||
.IR chet.ramey@case.edu .
|
||||
.IR chet@ins.CWRU.Edu .
|
||||
|
|
|
@ -2,25 +2,33 @@
|
|||
@c %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename history.info
|
||||
@settitle GNU History Library
|
||||
@include version.texi
|
||||
|
||||
@c %**end of header (This is for running Texinfo on a region.)
|
||||
|
||||
@include version.texi
|
||||
|
||||
@copying
|
||||
This document describes the GNU History library
|
||||
(version @value{VERSION}, @value{UPDATED}),
|
||||
a programming tool that provides a consistent user interface for
|
||||
recalling lines of previously typed input.
|
||||
|
||||
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2011 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled
|
||||
``GNU Free Documentation License''.
|
||||
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''.
|
||||
|
||||
(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.''
|
||||
|
||||
@end quotation
|
||||
@end copying
|
||||
|
@ -42,6 +50,12 @@ A copy of the license is included in the section entitled
|
|||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
|
||||
@sp 1
|
||||
Published by the Free Software Foundation @*
|
||||
59 Temple Place, Suite 330, @*
|
||||
Boston, MA 02111-1307 @*
|
||||
USA @*
|
||||
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2011 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
|
@ -270,11 +270,9 @@ a @code{NULL} pointer.
|
|||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} next_history (void)
|
||||
If the current history offset refers to a valid history entry,
|
||||
increment the current history offset.
|
||||
If the possibly-incremented history offset refers to a valid history
|
||||
entry, return a pointer to that entry;
|
||||
otherwise, return a @code{BNULL} pointer.
|
||||
Move the current history offset forward to the next history entry, and
|
||||
return the a pointer to that entry. If there is no next entry, return
|
||||
a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@node Searching the History List
|
||||
|
@ -379,7 +377,7 @@ if the returned line should be displayed, but not executed,
|
|||
as with the @code{:p} modifier (@pxref{Modifiers}).
|
||||
@end table
|
||||
|
||||
If an error occurred in expansion, then @var{output} contains a descriptive
|
||||
If an error ocurred in expansion, then @var{output} contains a descriptive
|
||||
error message.
|
||||
@end deftypefun
|
||||
|
||||
|
@ -469,8 +467,8 @@ carriage return, and @samp{=}.
|
|||
@end deftypevar
|
||||
|
||||
@deftypevar int history_quotes_inhibit_expansion
|
||||
If non-zero, double-quoted words are not scanned for the history expansion
|
||||
character or the history comment character. The default value is 0.
|
||||
If non-zero, single-quoted words are not scanned for the history expansion
|
||||
character. The default value is 0.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988--2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2011 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
|
@ -26,9 +26,10 @@ into another language, under the above conditions for modified versions.
|
|||
@node Using History Interactively
|
||||
@chapter Using History Interactively
|
||||
|
||||
@ifclear BashFeatures
|
||||
@defcodeindex bt
|
||||
@end ifclear
|
||||
@c GDB bundling modification:
|
||||
@c @ifclear BashFeatures
|
||||
@c @defcodeindex bt
|
||||
@c @end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
This chapter describes how to use the @sc{gnu} History Library
|
||||
|
@ -41,7 +42,8 @@ see the @sc{gnu} Readline Library Manual.
|
|||
This chapter describes how to use the @sc{gnu} History Library interactively,
|
||||
from a user's standpoint. It should be considered a user's guide. For
|
||||
information on using the @sc{gnu} History Library in your own programs,
|
||||
@pxref{Programming with GNU History}.
|
||||
@c GDB bundling modification:
|
||||
@pxref{Programming with GNU History, , , history, GNU History Library}.
|
||||
@end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
|
@ -84,18 +86,17 @@ file named by the @env{HISTFILE} variable (default @file{~/.bash_history}).
|
|||
The file named by the value of @env{HISTFILE} is truncated, if
|
||||
necessary, to contain no more than the number of lines specified by
|
||||
the value of the @env{HISTFILESIZE} variable.
|
||||
When a shell with history enabled exits, the last
|
||||
When an interactive shell exits, the last
|
||||
@env{$HISTSIZE} lines are copied from the history list to the file
|
||||
named by @env{$HISTFILE}.
|
||||
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
|
||||
the lines are appended to the history file,
|
||||
otherwise the history file is overwritten.
|
||||
If @env{HISTFILE}
|
||||
is unset, or if the history file is unwritable, the history is not saved.
|
||||
After saving the history, the history file is truncated
|
||||
to contain no more than @env{$HISTFILESIZE} lines.
|
||||
If @env{HISTFILESIZE} is unset, or set to null, a non-numeric value, or
|
||||
a numeric value less than zero, the history file is not truncated.
|
||||
is unset, or if the history file is unwritable, the history is
|
||||
not saved. After saving the history, the history file is truncated
|
||||
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,
|
||||
|
@ -142,10 +143,8 @@ history list and history file.
|
|||
@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
|
||||
@end example
|
||||
|
||||
The first form selects a range of commands from @var{first} to
|
||||
@var{last} from the history list and displays or edits and re-executes
|
||||
them.
|
||||
Both @var{first} and
|
||||
Fix Command. In the first form, a range of commands from @var{first} to
|
||||
@var{last} is selected from the history list. Both @var{first} and
|
||||
@var{last} may be specified as a string (to locate the most recent
|
||||
command beginning with that string) or as a number (an index into the
|
||||
history list, where a negative number is used as an offset from the
|
||||
|
@ -164,7 +163,6 @@ When editing is complete, the edited commands are echoed and executed.
|
|||
|
||||
In the second form, @var{command} is re-executed after each instance
|
||||
of @var{pat} in the selected command is replaced by @var{rep}.
|
||||
@var{command} is intepreted the same as @var{first} above.
|
||||
|
||||
A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so
|
||||
that typing @samp{r cc} runs the last command beginning with @code{cc}
|
||||
|
@ -202,9 +200,9 @@ Delete the history entry at position @var{offset}.
|
|||
displayed.
|
||||
|
||||
@item -a
|
||||
Append the new history lines to the history file.
|
||||
These are history lines entered since the beginning of the current
|
||||
Bash session, but not already appended to the history file.
|
||||
Append the new
|
||||
history lines (history lines entered since the beginning of the
|
||||
current Bash session) to the history file.
|
||||
|
||||
@item -n
|
||||
Append the history lines not already read from the history file
|
||||
|
@ -212,11 +210,11 @@ to the current history list. These are lines appended to the history
|
|||
file since the beginning of the current Bash session.
|
||||
|
||||
@item -r
|
||||
Read the history file and append its contents to
|
||||
Read the current history file and append its contents to
|
||||
the history list.
|
||||
|
||||
@item -w
|
||||
Write out the current history list to the history file.
|
||||
Write out the current history to the history file.
|
||||
|
||||
@item -p
|
||||
Perform history substitution on the @var{arg}s and display the result
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
.\" Chet Ramey
|
||||
.\" Information Network Services
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\" chet@ins.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Wed Nov 19 18:32:58 EST 2014
|
||||
.\" Last Change: Sat Aug 28 18:56:32 EDT 2010
|
||||
.\"
|
||||
.TH READLINE 3 "2014 November 19" "GNU Readline 6.3"
|
||||
.TH READLINE 3 "2010 August 28" "GNU Readline 6.2"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
|
@ -34,8 +34,8 @@ readline \- get a line from a user with editing
|
|||
\fBreadline\fP (\fIconst char *prompt\fP);
|
||||
.fi
|
||||
.SH COPYRIGHT
|
||||
.if n Readline is Copyright (C) 1989\-2014 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2014 Free Software Foundation, Inc.
|
||||
.if n Readline is Copyright (C) 1989\-2011 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2011 Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
.LP
|
||||
.B readline
|
||||
|
@ -78,10 +78,10 @@ treated as a newline.
|
|||
.LP
|
||||
An Emacs-style notation is used to denote
|
||||
keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
|
||||
means Control\-N. Similarly,
|
||||
means Control\-N. Similarly,
|
||||
.I meta
|
||||
keys are denoted by M\-\fIkey\fR, so M\-x means Meta\-X. (On keyboards
|
||||
without a
|
||||
without a
|
||||
.I meta
|
||||
key, M\-\fIx\fP means ESC \fIx\fP, i.e., press the Escape key
|
||||
then the
|
||||
|
@ -98,15 +98,14 @@ Readline commands may be given numeric
|
|||
which normally act as a repeat count. Sometimes, however, it is the
|
||||
sign of the argument that is significant. Passing a negative argument
|
||||
to a command that acts in the forward direction (e.g., \fBkill\-line\fP)
|
||||
causes that command to act in a backward direction.
|
||||
Commands whose behavior with arguments deviates from this are noted
|
||||
below.
|
||||
causes that command to act in a backward direction. Commands whose
|
||||
behavior with arguments deviates from this are noted.
|
||||
.PP
|
||||
When a command is described as \fIkilling\fP text, the text
|
||||
deleted is saved for possible future retrieval
|
||||
(\fIyanking\fP). The killed text is saved in a
|
||||
\fIkill ring\fP. Consecutive kills cause the text to be
|
||||
accumulated into one unit, which can be yanked all at once.
|
||||
accumulated into one unit, which can be yanked all at once.
|
||||
Commands which do not kill text separate the chunks of text
|
||||
on the kill ring.
|
||||
.SH INITIALIZATION FILE
|
||||
|
@ -139,7 +138,7 @@ or
|
|||
C\-Meta\-u: universal\-argument
|
||||
.RE
|
||||
.sp
|
||||
into the
|
||||
into the
|
||||
.I inputrc
|
||||
would make M\-C\-u execute the readline command
|
||||
.IR universal\-argument .
|
||||
|
@ -168,7 +167,7 @@ The syntax for controlling key bindings in the
|
|||
.I inputrc
|
||||
file is simple. All that is required is the name of the
|
||||
command or the text of a macro and a key sequence to which
|
||||
it should be bound. The name may be specified in one of two ways:
|
||||
it should be bound. The name may be specified in one of two ways:
|
||||
as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
|
||||
prefixes, or as a key sequence.
|
||||
The name and key sequence are separated by a colon. There can be no
|
||||
|
@ -226,7 +225,7 @@ is again bound to the function
|
|||
.I "C-x C-r"
|
||||
is bound to the function
|
||||
.BR re\-read\-init\-file ,
|
||||
and
|
||||
and
|
||||
.I "ESC [ 1 1 ~"
|
||||
is bound to insert the text
|
||||
.if t \f(CWFunction Key 1\fP.
|
||||
|
@ -348,25 +347,9 @@ If set to \fBnone\fP, readline never rings the bell. If set to
|
|||
If set to \fBaudible\fP, readline attempts to ring the terminal's bell.
|
||||
.TP
|
||||
.B bind\-tty\-special\-chars (On)
|
||||
If set to \fBOn\fP (the default), readline attempts to bind the control
|
||||
characters treated specially by the kernel's terminal driver to their
|
||||
readline equivalents.
|
||||
.TP
|
||||
.B blink\-matching\-paren (Off)
|
||||
If set to \fBOn\fP, readline attempts to briefly move the cursor to an
|
||||
opening parenthesis when a closing parenthesis is inserted.
|
||||
.TP
|
||||
.B colored\-completion\-prefix (Off)
|
||||
If set to \fBOn\fP, when listing completions, readline displays the
|
||||
common prefix of the set of possible completions using a different color.
|
||||
The color definitions are taken from the value of the \fBLS_COLORS\fP
|
||||
environment variable.
|
||||
.TP
|
||||
.B colored\-stats (Off)
|
||||
If set to \fBOn\fP, readline displays possible completions using different
|
||||
colors to indicate their file type.
|
||||
The color definitions are taken from the value of the \fBLS_COLORS\fP
|
||||
environment variable.
|
||||
If set to \fBOn\fP, readline attempts to bind the control characters
|
||||
treated specially by the kernel's terminal driver to their readline
|
||||
equivalents.
|
||||
.TP
|
||||
.B comment\-begin (``#'')
|
||||
The string that is inserted in \fBvi\fP mode when the
|
||||
|
@ -436,13 +419,6 @@ When set to \fBOn\fP, on operating systems that indicate they support it,
|
|||
readline echoes a character corresponding to a signal generated from the
|
||||
keyboard.
|
||||
.TP
|
||||
.B enable\-bracketed\-paste (Off)
|
||||
When set to \fBOn\fP, readline will configure the terminal in a way
|
||||
that will enable it to insert each paste into the editing buffer as a
|
||||
single string of characters, instead of treating each character as if
|
||||
it had been read from the keyboard. This can prevent pasted characters
|
||||
from being interpreted as editing commands.
|
||||
.TP
|
||||
.B enable\-keypad (Off)
|
||||
When set to \fBOn\fP, readline will try to enable the application
|
||||
keypad when it is called. Some systems need this to enable the
|
||||
|
@ -462,13 +438,9 @@ If set to \fBOn\fP, the history code attempts to place point at the
|
|||
same location on each history line retrieved with \fBprevious-history\fP
|
||||
or \fBnext-history\fP.
|
||||
.TP
|
||||
.B history\-size (unset)
|
||||
Set the maximum number of history entries saved in the history list.
|
||||
If set to zero, any existing history entries are deleted and no new entries
|
||||
are saved.
|
||||
If set to a value less than zero, the number of history entries is not
|
||||
limited.
|
||||
By default, the number of history entries is not limited.
|
||||
.B history\-size (0)
|
||||
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.
|
||||
.TP
|
||||
.B horizontal\-scroll\-mode (Off)
|
||||
When set to \fBOn\fP, makes readline use a single line for display,
|
||||
|
@ -500,28 +472,6 @@ The value of
|
|||
.B editing\-mode
|
||||
also affects the default keymap.
|
||||
.TP
|
||||
.B emacs\-mode\-string (@)
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when emacs editing mode is active. The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B keyseq\-timeout (500)
|
||||
Specifies the duration \fIreadline\fP will wait for a character when reading an
|
||||
ambiguous key sequence (one that can form a complete key sequence using
|
||||
the input read so far, or can take additional input to complete a longer
|
||||
key sequence).
|
||||
If no input is received within the timeout, \fIreadline\fP will use the shorter
|
||||
but complete key sequence.
|
||||
The value is specified in milliseconds, so a value of 1000 means that
|
||||
\fIreadline\fP will wait one second for additional input.
|
||||
If this variable is set to a value less than or equal to zero, or to a
|
||||
non-numeric value, \fIreadline\fP will wait until another key is pressed to
|
||||
decide which key sequence to complete.
|
||||
.TP
|
||||
.B mark\-directories (On)
|
||||
If set to \fBOn\fP, completed directory names have a slash
|
||||
appended.
|
||||
|
@ -537,7 +487,7 @@ have a slash appended (subject to the value of
|
|||
.TP
|
||||
.B match\-hidden\-files (On)
|
||||
This variable, when set to \fBOn\fP, causes readline to match files whose
|
||||
names begin with a `.' (hidden files) when performing filename
|
||||
names begin with a `.' (hidden files) when performing filename
|
||||
completion.
|
||||
If set to \fBOff\fP, the leading `.' must be
|
||||
supplied by the user in the filename to be completed.
|
||||
|
@ -583,11 +533,6 @@ possible partial completion (the possible completions don't share
|
|||
a common prefix) cause the matches to be listed immediately instead
|
||||
of ringing the bell.
|
||||
.TP
|
||||
.B show\-mode\-in\-prompt (Off)
|
||||
If set to \fBOn\fP, add a character to the beginning of the prompt
|
||||
indicating the editing mode: emacs, vi command, or vi insertion.
|
||||
The mode strings are user-settable.
|
||||
.TP
|
||||
.B skip\-completed\-text (Off)
|
||||
If set to \fBOn\fP, this alters the default completion behavior when
|
||||
inserting a single match into the line. It's only active when
|
||||
|
@ -596,26 +541,6 @@ does not insert characters from the completion that match characters
|
|||
after point in the word being completed, so portions of the word
|
||||
following the cursor are not duplicated.
|
||||
.TP
|
||||
.B vi\-cmd\-mode\-string ((cmd))
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in command mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B vi\-ins\-mode\-string ((ins))
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in insertion mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the \e1 and \e2 escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
.TP
|
||||
.B visible\-stats (Off)
|
||||
If set to \fBOn\fP, a character denoting a file's type as reported
|
||||
by \fIstat\fP(2) is appended to the filename when listing possible
|
||||
|
@ -628,7 +553,7 @@ compilation features of the C preprocessor which allows key
|
|||
bindings and variable settings to be performed as the result
|
||||
of tests. There are four parser directives used.
|
||||
.IP \fB$if\fP
|
||||
The
|
||||
The
|
||||
.B $if
|
||||
construct allows bindings to be made based on the
|
||||
editing mode, the terminal being used, or the application using
|
||||
|
@ -813,30 +738,15 @@ using a non-incremental search for a string supplied by the user.
|
|||
Search forward through the history using a non-incremental search
|
||||
for a string supplied by the user.
|
||||
.TP
|
||||
.B history\-search\-backward
|
||||
Search backward through the history for the string of characters
|
||||
between the start of the current line and the current cursor
|
||||
position (the \fIpoint\fP).
|
||||
The search string must match at the beginning of a history line.
|
||||
This is a non-incremental search.
|
||||
.TP
|
||||
.B history\-search\-forward
|
||||
Search forward through the history for the string of characters
|
||||
between the start of the current line and the point.
|
||||
The search string must match at the beginning of a history line.
|
||||
This is a non-incremental search.
|
||||
.TP
|
||||
.B history\-substring\-search\-backward
|
||||
Search backward through the history for the string of characters
|
||||
between the start of the current line and the current cursor
|
||||
position (the \fIpoint\fP).
|
||||
The search string may match anywhere in a history line.
|
||||
This is a non-incremental search.
|
||||
.TP
|
||||
.B history\-substring\-search\-forward
|
||||
Search forward through the history for the string of characters
|
||||
.B history\-search\-backward
|
||||
Search backward through the history for the string of characters
|
||||
between the start of the current line and the point.
|
||||
The search string may match anywhere in a history line.
|
||||
This is a non-incremental search.
|
||||
.TP
|
||||
.B yank\-nth\-arg (M\-C\-y)
|
||||
|
@ -868,22 +778,13 @@ as if the "!$" history expansion had been specified.
|
|||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B \fIend\-of\-file\fP (usually C\-d)
|
||||
The character indicating end-of-file as set, for example, by
|
||||
.if t \f(CWstty\fP.
|
||||
.if n ``stty''.
|
||||
If this character is read when there are no characters
|
||||
on the line, and point is at the beginning of the line, Readline
|
||||
interprets it as the end of input and returns
|
||||
.B delete\-char (C\-d)
|
||||
Delete the character at point. If point is at the
|
||||
beginning of the line, there are no characters in the line, and
|
||||
the last character typed was not bound to \fBdelete\-char\fP, then return
|
||||
.SM
|
||||
.BR EOF .
|
||||
.TP
|
||||
.B delete\-char (C\-d)
|
||||
Delete the character at point.
|
||||
If this function is bound to the
|
||||
same character as the tty \fBEOF\fP character, as \fBC\-d\fP
|
||||
commonly is, see above for the effects.
|
||||
.TP
|
||||
.B backward\-delete\-char (Rubout)
|
||||
Delete the character behind the cursor. When given a numeric argument,
|
||||
save the deleted text on the kill ring.
|
||||
|
@ -934,7 +835,7 @@ switches to overwrite mode. With an explicit non-positive numeric
|
|||
argument, switches to insert mode. This command affects only
|
||||
\fBemacs\fP mode; \fBvi\fP mode does overwrite differently.
|
||||
Each call to \fIreadline()\fP starts in insert mode.
|
||||
In overwrite mode, characters bound to \fBself\-insert\fP replace
|
||||
In overwrite mode, characters bound to \fBself\-insert\fP replace
|
||||
the text at point rather than pushing the text to the right.
|
||||
Characters bound to \fBbackward\-delete\-char\fP replace the character
|
||||
before point with a space. By default, this command is unbound.
|
||||
|
@ -957,7 +858,7 @@ The killed text is saved on the kill-ring.
|
|||
.B kill\-whole\-line
|
||||
Kill all characters on the current line, no matter where point is.
|
||||
.TP
|
||||
.B kill\-word (M\-d)
|
||||
.B kill\-word (M\-d)
|
||||
Kill from point the end of the current word, or if between
|
||||
words, to the end of the next word. Word boundaries are the same as
|
||||
those used by \fBforward\-word\fP.
|
||||
|
@ -1095,9 +996,6 @@ and store the definition.
|
|||
.B call\-last\-kbd\-macro (C\-x e)
|
||||
Re-execute the last keyboard macro defined, by making the characters
|
||||
in the macro appear as if typed at the keyboard.
|
||||
.B print\-last\-kbd\-macro ()
|
||||
Print the last keyboard macro defined in a format suitable for the
|
||||
\fIinputrc\fP file.
|
||||
.PD
|
||||
.SS Miscellaneous
|
||||
.PP
|
||||
|
@ -1164,7 +1062,7 @@ but usually bound to ESC\-[.
|
|||
Without a numeric argument, the value of the readline
|
||||
.B comment\-begin
|
||||
variable is inserted at the beginning of the current line.
|
||||
If a numeric argument is supplied, this command acts as a toggle: if
|
||||
If a numeric argument is supplied, this command acts as a toggle: if
|
||||
the characters at the beginning of the line do not match the value
|
||||
of \fBcomment\-begin\fP, the value is inserted, otherwise
|
||||
the characters in \fBcomment-begin\fP are deleted from the beginning of
|
||||
|
@ -1457,7 +1355,7 @@ bfox@gnu.org
|
|||
.PP
|
||||
Chet Ramey, Case Western Reserve University
|
||||
.br
|
||||
chet.ramey@case.edu
|
||||
chet@ins.CWRU.Edu
|
||||
.SH BUG REPORTS
|
||||
If you find a bug in
|
||||
.B readline,
|
||||
|
@ -1477,7 +1375,7 @@ newsgroup
|
|||
.PP
|
||||
Comments and bug reports concerning
|
||||
this manual page should be directed to
|
||||
.IR chet.ramey@case.edu .
|
||||
.IR chet@ins.CWRU.Edu .
|
||||
.SH BUGS
|
||||
.PP
|
||||
It's too big and too slow.
|
||||
|
|
|
@ -2,26 +2,34 @@
|
|||
@comment %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename readline.info
|
||||
@settitle GNU Readline Library
|
||||
@include version.texi
|
||||
|
||||
@comment %**end of header (This is for running Texinfo on a region.)
|
||||
@synindex vr fn
|
||||
|
||||
@include version.texi
|
||||
|
||||
@copying
|
||||
This manual describes the GNU Readline Library
|
||||
(version @value{VERSION}, @value{UPDATED}), a library which aids in the
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2011 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled
|
||||
``GNU Free Documentation License''.
|
||||
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''.
|
||||
|
||||
(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.''
|
||||
|
||||
@end quotation
|
||||
@end copying
|
||||
|
@ -42,6 +50,12 @@ A copy of the license is included in the section entitled
|
|||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
|
||||
@sp 1
|
||||
Published by the Free Software Foundation @*
|
||||
59 Temple Place, Suite 330, @*
|
||||
Boston, MA 02111-1307 @*
|
||||
USA @*
|
||||
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
@ -53,7 +67,6 @@ A copy of the license is included in the section entitled
|
|||
This document describes the GNU Readline Library, a utility which aids
|
||||
in the consistency of user interface across discrete programs which
|
||||
provide a command line interface.
|
||||
The Readline home page is @url{http://www.gnu.org/software/readline/}.
|
||||
|
||||
@menu
|
||||
* Command Line Editing:: GNU Readline User's Manual.
|
||||
|
|
|
@ -7,7 +7,7 @@ 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--2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2011 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
@ -195,7 +195,7 @@ For Readline 4.2, for example, the value of
|
|||
@node Readline Typedefs
|
||||
@subsection Readline Typedefs
|
||||
|
||||
For readability, we declare a number of new object types, all pointers
|
||||
For readabilty, we declare a number of new object types, all pointers
|
||||
to functions.
|
||||
|
||||
The reason for declaring these new types is to make it easier to write
|
||||
|
@ -282,7 +282,7 @@ At the very least, it should be aware that it can be passed a
|
|||
negative argument.
|
||||
|
||||
A command function should return 0 if its action completes successfully,
|
||||
and a value greater than zero if some error occurs.
|
||||
and a non-zero value if some error occurs.
|
||||
This is the convention obeyed by all of the builtin Readline bindable
|
||||
command functions.
|
||||
|
||||
|
@ -440,35 +440,6 @@ If non-zero, Readline will call indirectly through this pointer
|
|||
to get a character from the input stream. By default, it is set to
|
||||
@code{rl_getc}, the default Readline character input function
|
||||
(@pxref{Character Input}).
|
||||
In general, an application that sets @var{rl_getc_function} should consider
|
||||
setting @var{rl_input_available_hook} as well.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_hook_func_t *} rl_signal_event_hook
|
||||
If non-zero, this is the address of a function to call if a read system
|
||||
call is interrupted when Readline is reading terminal input.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_hook_func_t *} rl_input_available_hook
|
||||
If non-zero, Readline will use this function's return value when it needs
|
||||
to determine whether or not there is available input on the current input
|
||||
source.
|
||||
The default hook checks @code{rl_instream}; if an application is using a
|
||||
different input source, it should set the hook appropriately.
|
||||
Readline queries for available input when implementing intra-key-sequence
|
||||
timeouts during input and incremental searches.
|
||||
This may use an application-specific timeout before returning a value;
|
||||
Readline uses the value passed to @code{rl_set_keyboard_input_timeout()}
|
||||
or the value of the user-settable @var{keyseq-timeout} variable.
|
||||
This is designed for use by applications using Readline's callback interface
|
||||
(@pxref{Alternate Interface}), which may not use the traditional
|
||||
@code{read(2)} and file descriptor interface, or other applications using
|
||||
a different input mechanism.
|
||||
If an application uses an input mechanism or hook that can potentially exceed
|
||||
the value of @var{keyseq-timeout}, it should increase the timeout or set
|
||||
this hook appropriately even when not using the callback interface.
|
||||
In general, an application that sets @var{rl_getc_function} should consider
|
||||
setting @var{rl_input_available_hook} as well.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_voidfunc_t *} rl_redisplay_function
|
||||
|
@ -508,19 +479,6 @@ last key binding occurred.
|
|||
This variable is set to the text of any currently-executing macro.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int rl_executing_key
|
||||
The key that caused the dispatch to the currently-executing Readline function.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {char *} rl_executing_keyseq
|
||||
The full key sequence that caused the dispatch to the currently-executing
|
||||
Readline function.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int rl_key_sequence_length
|
||||
The number of characters in @var{rl_executing_keyseq}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {int} rl_readline_state
|
||||
A variable with bit values that encapsulate the current Readline state.
|
||||
A bit is set with the @code{RL_SETSTATE} macro, and unset with the
|
||||
|
@ -529,7 +487,7 @@ whether a particular state bit is set. Current state bits include:
|
|||
|
||||
@table @code
|
||||
@item RL_STATE_NONE
|
||||
Readline has not yet been called, nor has it begun to initialize.
|
||||
Readline has not yet been called, nor has it begun to intialize.
|
||||
@item RL_STATE_INITIALIZING
|
||||
Readline is initializing its internal data structures.
|
||||
@item RL_STATE_INITIALIZED
|
||||
|
@ -622,7 +580,6 @@ means that vi mode is active.
|
|||
* Miscellaneous Functions:: Functions that don't fall into any category.
|
||||
* Alternate Interface:: Using Readline in a `callback' fashion.
|
||||
* A Readline Example:: An example Readline function.
|
||||
* Alternate Interface Example:: An example program using the alternate interface.
|
||||
@end menu
|
||||
|
||||
@node Function Naming
|
||||
|
@ -951,7 +908,7 @@ Readline thinks the screen display is correct.
|
|||
|
||||
@deftypefun int rl_on_new_line (void)
|
||||
Tell the update functions that we have moved onto a new (empty) line,
|
||||
usually after outputting a newline.
|
||||
usually after ouputting a newline.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_on_new_line_with_prompt (void)
|
||||
|
@ -1020,7 +977,7 @@ It returns the number of visible characters on the last line of the
|
|||
Applications may indicate that the prompt contains characters that take
|
||||
up no physical screen space when displayed by bracketing a sequence of
|
||||
such characters with the special markers @code{RL_PROMPT_START_IGNORE}
|
||||
and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}). This may
|
||||
and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}. This may
|
||||
be used to embed terminal-specific escape sequences in prompts.
|
||||
@end deftypefun
|
||||
|
||||
|
@ -1284,31 +1241,21 @@ use all of a terminal's capabilities, and this function will return
|
|||
values for only those capabilities Readline uses.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {void} rl_clear_history (void)
|
||||
Clear the history list by deleting all of the entries, in the same manner
|
||||
as the History library's @code{clear_history()} function.
|
||||
This differs from @code{clear_history} because it frees private data
|
||||
Readline saves in the history list.
|
||||
@end deftypefun
|
||||
|
||||
@node Alternate Interface
|
||||
@subsection Alternate Interface
|
||||
|
||||
An alternate interface is available to plain @code{readline()}. Some
|
||||
applications need to interleave keyboard I/O with file, device, or
|
||||
window system I/O, typically by using a main loop to @code{select()}
|
||||
on various file descriptors. To accommodate this need, readline can
|
||||
on various file descriptors. To accomodate this need, readline can
|
||||
also be invoked as a `callback' function from an event loop. There
|
||||
are functions available to make this easy.
|
||||
|
||||
@deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler)
|
||||
Set up the terminal for readline I/O and display the initial
|
||||
expanded value of @var{prompt}. Save the value of @var{lhandler} to
|
||||
use as a handler function to call when a complete line of input has been
|
||||
entered.
|
||||
The handler function receives the text of the line as an argument.
|
||||
As with @code{readline()}, the handler function should @code{free} the
|
||||
line when it it finished with it.
|
||||
use as a function to call when a complete line of input has been entered.
|
||||
The function takes the text of the line as an argument.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void rl_callback_read_char (void)
|
||||
|
@ -1316,29 +1263,20 @@ Whenever an application determines that keyboard input is available, it
|
|||
should call @code{rl_callback_read_char()}, which will read the next
|
||||
character from the current input source.
|
||||
If that character completes the line, @code{rl_callback_read_char} will
|
||||
invoke the @var{lhandler} function installed by
|
||||
@code{rl_callback_handler_install} to process the line.
|
||||
invoke the @var{lhandler} function saved by @code{rl_callback_handler_install}
|
||||
to process the line.
|
||||
Before calling the @var{lhandler} function, the terminal settings are
|
||||
reset to the values they had before calling
|
||||
@code{rl_callback_handler_install}.
|
||||
If the @var{lhandler} function returns,
|
||||
and the line handler remains installed,
|
||||
the terminal settings are modified for Readline's use again.
|
||||
@code{EOF} is indicated by calling @var{lhandler} with a
|
||||
@code{EOF} is indicated by calling @var{lhandler} with a
|
||||
@code{NULL} line.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void rl_callback_sigcleanup (void)
|
||||
Clean up any internal state the callback interface uses to maintain state
|
||||
between calls to rl_callback_read_char (e.g., the state of any active
|
||||
incremental searches). This is intended to be used by applications that
|
||||
wish to perform their own signal handling; Readline's internal signal handler
|
||||
calls this when appropriate.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void rl_callback_handler_remove (void)
|
||||
Restore the terminal to its initial state and remove the line handler.
|
||||
You may call this function from within a callback as well as independently.
|
||||
This may be called from within a callback as well as independently.
|
||||
If the @var{lhandler} installed by @code{rl_callback_handler_install}
|
||||
does not exit the program, either this function or the function referred
|
||||
to by the value of @code{rl_deprep_term_function} should be called before
|
||||
|
@ -1412,98 +1350,6 @@ invert_case_line (count, key)
|
|||
@}
|
||||
@end example
|
||||
|
||||
@node Alternate Interface Example
|
||||
@subsection Alternate Interface Example
|
||||
|
||||
Here is a complete program that illustrates Readline's alternate interface.
|
||||
It reads lines from the terminal and displays them, providing the
|
||||
standard history and TAB completion functions.
|
||||
It understands the EOF character or "exit" to exit the program.
|
||||
|
||||
@example
|
||||
/* Standard include files. stdio.h is required. */
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Used for select(2) */
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Standard readline include files. */
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
static void cb_linehandler (char *);
|
||||
|
||||
int running;
|
||||
const char *prompt = "rltest$ ";
|
||||
|
||||
/* Callback function called for each line when accept-line executed, EOF
|
||||
seen, or EOF character read. This sets a flag and returns; it could
|
||||
also call exit(3). */
|
||||
static void
|
||||
cb_linehandler (char *line)
|
||||
@{
|
||||
/* Can use ^D (stty eof) or `exit' to exit. */
|
||||
if (line == NULL || strcmp (line, "exit") == 0)
|
||||
@{
|
||||
if (line == 0)
|
||||
printf ("\n");
|
||||
printf ("exit\n");
|
||||
/* This function needs to be called to reset the terminal settings,
|
||||
and calling it from the line handler keeps one extra prompt from
|
||||
being displayed. */
|
||||
rl_callback_handler_remove ();
|
||||
|
||||
running = 0;
|
||||
@}
|
||||
else
|
||||
@{
|
||||
if (*line)
|
||||
add_history (line);
|
||||
printf ("input line: %s\n", line);
|
||||
free (line);
|
||||
@}
|
||||
@}
|
||||
|
||||
int
|
||||
main (int c, char **v)
|
||||
@{
|
||||
fd_set fds;
|
||||
int r;
|
||||
|
||||
/* Install the line handler. */
|
||||
rl_callback_handler_install (prompt, cb_linehandler);
|
||||
|
||||
/* Enter a simple event loop. This waits until something is available
|
||||
to read on readline's input stream (defaults to standard input) and
|
||||
calls the builtin character read callback to read it. It does not
|
||||
have to modify the user's terminal settings. */
|
||||
running = 1;
|
||||
while (running)
|
||||
@{
|
||||
FD_ZERO (&fds);
|
||||
FD_SET (fileno (rl_instream), &fds);
|
||||
|
||||
r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
|
||||
if (r < 0)
|
||||
@{
|
||||
perror ("rltest: select");
|
||||
rl_callback_handler_remove ();
|
||||
break;
|
||||
@}
|
||||
|
||||
if (FD_ISSET (fileno (rl_instream), &fds))
|
||||
rl_callback_read_char ();
|
||||
@}
|
||||
|
||||
printf ("rltest: Event loop has exited\n");
|
||||
return 0;
|
||||
@}
|
||||
@end example
|
||||
|
||||
@node Readline Signal Handling
|
||||
@section Readline Signal Handling
|
||||
|
||||
|
@ -1519,7 +1365,6 @@ functions to do so manually.
|
|||
|
||||
Readline contains an internal signal handler that is installed for a
|
||||
number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM},
|
||||
@code{SIGHUP},
|
||||
@code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}).
|
||||
When one of these signals is received, the signal handler
|
||||
will reset the terminal attributes to those that were in effect before
|
||||
|
@ -1542,14 +1387,7 @@ resetting the terminal to its original state. If the application's signal
|
|||
handler does more than update its idea of the terminal size and return (for
|
||||
example, a @code{longjmp} back to a main processing loop), it @emph{must}
|
||||
call @code{rl_cleanup_after_signal()} (described below), to restore the
|
||||
terminal state.
|
||||
|
||||
When an application is using the callback interface
|
||||
(@pxref{Alternate Interface}), Readline installs signal handlers only for
|
||||
the duration of the call to @code{rl_callback_read_char}. Applications
|
||||
using the callback interface should be prepared to clean up Readline's
|
||||
state if they wish to handle the signal before the line handler completes
|
||||
and restores the terminal state.
|
||||
terminal state.
|
||||
|
||||
Readline provides two variables that allow application writers to
|
||||
control whether or not it will catch certain signals and act on them
|
||||
|
@ -1559,28 +1397,19 @@ a signal handler, so Readline's internal signal state is not corrupted.
|
|||
|
||||
@deftypevar int rl_catch_signals
|
||||
If this variable is non-zero, Readline will install signal handlers for
|
||||
@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGHUP}, @code{SIGALRM},
|
||||
@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGALRM},
|
||||
@code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}.
|
||||
|
||||
The default value of @code{rl_catch_signals} is 1.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int rl_catch_sigwinch
|
||||
If this variable is set to a non-zero value,
|
||||
Readline will install a signal handler for @code{SIGWINCH}.
|
||||
If this variable is non-zero, Readline will install a signal handler for
|
||||
@code{SIGWINCH}.
|
||||
|
||||
The default value of @code{rl_catch_sigwinch} is 1.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int rl_change_environment
|
||||
If this variable is set to a non-zero value,
|
||||
and Readline is handling @code{SIGWINCH}, Readline will modify the
|
||||
@var{LINES} and @var{COLUMNS} environment variables upon receipt of a
|
||||
@code{SIGWINCH}
|
||||
|
||||
The default value of @code{rl_change_environment} is 1.
|
||||
@end deftypevar
|
||||
|
||||
If an application does not wish to have Readline catch any signals, or
|
||||
to handle signals other than those Readline catches (@code{SIGHUP},
|
||||
for example),
|
||||
|
@ -1648,7 +1477,7 @@ The following functions install and remove Readline's signal handlers.
|
|||
|
||||
@deftypefun int rl_set_signals (void)
|
||||
Install Readline's signal handler for @code{SIGINT}, @code{SIGQUIT},
|
||||
@code{SIGTERM}, @code{SIGHUP}, @code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN},
|
||||
@code{SIGTERM}, @code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN},
|
||||
@code{SIGTTOU}, and @code{SIGWINCH}, depending on the values of
|
||||
@code{rl_catch_signals} and @code{rl_catch_sigwinch}.
|
||||
@end deftypefun
|
||||
|
@ -1782,7 +1611,7 @@ This calls @code{rl_complete_internal()} with an argument of @samp{*}.
|
|||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_completion_mode (rl_command_func_t *cfunc)
|
||||
Returns the appropriate value to pass to @code{rl_complete_internal()}
|
||||
Returns the apppriate value to pass to @code{rl_complete_internal()}
|
||||
depending on whether @var{cfunc} was called twice in succession and
|
||||
the values of the @code{show-all-if-ambiguous} and
|
||||
@code{show-all-if-unmodified} variables.
|
||||
|
@ -1899,45 +1728,29 @@ the directory portion of the pathname the user typed.
|
|||
At the least, even if no other expansion is performed, this function should
|
||||
remove any quote characters from the directory name, because its result will
|
||||
be passed directly to @code{opendir()}.
|
||||
|
||||
The directory completion hook returns an integer that should be non-zero if
|
||||
the function modifies its directory argument.
|
||||
The function should not modify the directory argument if it returns 0.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_icppfunc_t *} rl_directory_rewrite_hook;
|
||||
@ignore
|
||||
@deftypevar extern rl_icppfunc_t *rl_directory_rewrite_hook;
|
||||
If non-zero, this is the address of a function to call when completing
|
||||
a directory name. This function takes the address of the directory name
|
||||
to be modified as an argument. Unlike @code{rl_directory_completion_hook},
|
||||
it only modifies the directory name used in @code{opendir}, not what is
|
||||
displayed when the possible completions are printed or inserted. It is
|
||||
called before rl_directory_completion_hook.
|
||||
At the least, even if no other expansion is performed, this function should
|
||||
remove any quote characters from the directory name, because its result will
|
||||
be passed directly to @code{opendir()}.
|
||||
|
||||
The directory rewrite hook returns an integer that should be non-zero if
|
||||
the function modfies its directory argument.
|
||||
The function should not modify the directory argument if it returns 0.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {rl_icppfunc_t *} rl_filename_stat_hook
|
||||
If non-zero, this is the address of a function for the completer to
|
||||
call before deciding which character to append to a completed name.
|
||||
This function modifies its filename name argument, and the modified value
|
||||
is passed to @code{stat()} to determine the file's type and characteristics.
|
||||
This function does not need to remove quote characters from the filename.
|
||||
|
||||
The stat hook returns an integer that should be non-zero if
|
||||
the function modfies its directory argument.
|
||||
The function should not modify the directory argument if it returns 0.
|
||||
I'm not happy with how this works yet, so it's undocumented.
|
||||
@end deftypevar
|
||||
@end ignore
|
||||
|
||||
@deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook
|
||||
If non-zero, this is the address of a function called when reading
|
||||
directory entries from the filesystem for completion and comparing
|
||||
them to the partial word to be completed. The function should
|
||||
perform any necessary application or system-specific conversion on
|
||||
perform any necesary application or system-specific conversion on
|
||||
the filename, such as converting between character sets or converting
|
||||
from a filesystem format to a character input format.
|
||||
The function takes two arguments: @var{fname}, the filename to be converted,
|
||||
|
@ -1959,8 +1772,8 @@ where @var{matches} is the array of matching strings,
|
|||
@var{num_matches} is the number of strings in that array, and
|
||||
@var{max_length} is the length of the longest string in that array.
|
||||
Readline provides a convenience function, @code{rl_display_match_list},
|
||||
that takes care of doing the display to Readline's output stream.
|
||||
You may call that function from this hook.
|
||||
that takes care of doing the display to Readline's output stream. That
|
||||
function may be called from this hook.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {const char *} rl_basic_word_break_characters
|
||||
|
|
|
@ -9,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--2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2011 Free Software Foundation, Inc.
|
||||
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
|
@ -72,8 +72,6 @@ Line editing can be enabled at any time using the @option{-o emacs} or
|
|||
a specific command.
|
||||
* Programmable Completion Builtins:: Builtin commands to specify how to
|
||||
complete arguments for a particular command.
|
||||
* A Programmable Completion Example:: An example shell function for
|
||||
generating possible completions.
|
||||
@end ifset
|
||||
@end menu
|
||||
|
||||
|
@ -423,31 +421,9 @@ the terminal's bell.
|
|||
|
||||
@item bind-tty-special-chars
|
||||
@vindex bind-tty-special-chars
|
||||
If set to @samp{on} (the default), Readline attempts to bind the control
|
||||
characters treated specially by the kernel's terminal driver to their
|
||||
Readline equivalents.
|
||||
|
||||
@item blink-matching-paren
|
||||
@vindex blink-matching-paren
|
||||
If set to @samp{on}, Readline attempts to briefly move the cursor to an
|
||||
opening parenthesis when a closing parenthesis is inserted. The default
|
||||
is @samp{off}.
|
||||
|
||||
@item colored-completion-prefix
|
||||
@vindex colored-completion-prefix
|
||||
If set to @samp{on}, when listing completions, Readline displays the
|
||||
common prefix of the set of possible completions using a different color.
|
||||
The color definitions are taken from the value of the @env{LS_COLORS}
|
||||
environment variable.
|
||||
The default is @samp{off}.
|
||||
|
||||
@item colored-stats
|
||||
@vindex colored-stats
|
||||
If set to @samp{on}, Readline displays possible completions using different
|
||||
colors to indicate their file type.
|
||||
The color definitions are taken from the value of the @env{LS_COLORS}
|
||||
environment variable.
|
||||
The default is @samp{off}.
|
||||
If set to @samp{on}, Readline attempts to bind the control characters
|
||||
treated specially by the kernel's terminal driver to their Readline
|
||||
equivalents.
|
||||
|
||||
@item comment-begin
|
||||
@vindex comment-begin
|
||||
|
@ -514,31 +490,11 @@ key bindings is used. By default, Readline starts up in Emacs editing
|
|||
mode, where the keystrokes are most similar to Emacs. This variable can be
|
||||
set to either @samp{emacs} or @samp{vi}.
|
||||
|
||||
@item emacs-mode-string
|
||||
@vindex emacs-mode-string
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when emacs editing mode is active. The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
The default is @samp{@@}.
|
||||
|
||||
@item echo-control-characters
|
||||
@vindex echo-control-characters
|
||||
When set to @samp{on}, on operating systems that indicate they support it,
|
||||
readline echoes a character corresponding to a signal generated from the
|
||||
keyboard. The default is @samp{on}.
|
||||
|
||||
@item enable-bracketed-paste
|
||||
@vindex enable-bracketed-paste
|
||||
When set to @samp{On}, Readline will configure the terminal in a way
|
||||
that will enable it to insert each paste into the editing buffer as a
|
||||
single string of characters, instead of treating each character as if
|
||||
it had been read from the keyboard. This can prevent pasted characters
|
||||
from being interpreted as editing commands. The default is @samp{off}.
|
||||
|
||||
@item enable-keypad
|
||||
@vindex enable-keypad
|
||||
When set to @samp{on}, Readline will try to enable the application
|
||||
|
@ -565,12 +521,8 @@ 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, any existing history entries are deleted and no new entries
|
||||
are saved.
|
||||
If set to a value less than zero, the number of history entries is not
|
||||
limited.
|
||||
By default, the number of history entries is not limited.
|
||||
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
|
||||
|
@ -613,22 +565,6 @@ equivalent to @code{emacs-standard}. The default value is @code{emacs}.
|
|||
The value of the @code{editing-mode} variable also affects the
|
||||
default keymap.
|
||||
|
||||
@item keyseq-timeout
|
||||
Specifies the duration Readline will wait for a character when reading an
|
||||
ambiguous key sequence (one that can form a complete key sequence using
|
||||
the input read so far, or can take additional input to complete a longer
|
||||
key sequence).
|
||||
If no input is received within the timeout, Readline will use the shorter
|
||||
but complete key sequence.
|
||||
Readline uses this value to determine whether or not input is
|
||||
available on the current input source (@code{rl_instream} by default).
|
||||
The value is specified in milliseconds, so a value of 1000 means that
|
||||
Readline will wait one second for additional input.
|
||||
If this variable is set to a value less than or equal to zero, or to a
|
||||
non-numeric value, Readline will wait until another key is pressed to
|
||||
decide which key sequence to complete.
|
||||
The default value is @code{500}.
|
||||
|
||||
@item mark-directories
|
||||
If set to @samp{on}, completed directory names have a slash
|
||||
appended. The default is @samp{on}.
|
||||
|
@ -704,13 +640,6 @@ a common prefix) cause the matches to be listed immediately instead
|
|||
of ringing the bell.
|
||||
The default value is @samp{off}.
|
||||
|
||||
@item show-mode-in-prompt
|
||||
@vindex show-mode-in-prompt
|
||||
If set to @samp{on}, add a character to the beginning of the prompt
|
||||
indicating the editing mode: emacs, vi command, or vi insertion.
|
||||
The mode strings are user-settable.
|
||||
The default value is @samp{off}.
|
||||
|
||||
@item skip-completed-text
|
||||
@vindex skip-completed-text
|
||||
If set to @samp{on}, this alters the default completion behavior when
|
||||
|
@ -725,30 +654,6 @@ rather than @samp{Makefilefile}, assuming there is a single possible
|
|||
completion.
|
||||
The default value is @samp{off}.
|
||||
|
||||
@item vi-cmd-mode-string
|
||||
@vindex vi-cmd-mode-string
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in command mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
The default is @samp{(cmd)}.
|
||||
|
||||
@item vi-ins-mode-string
|
||||
@vindex vi-ins-mode-string
|
||||
This string is displayed immediately before the last line of the primary
|
||||
prompt when vi editing mode is active and in insertion mode.
|
||||
The value is expanded like a
|
||||
key binding, so the standard set of meta- and control prefixes and
|
||||
backslash escape sequences is available.
|
||||
Use the @samp{\1} and @samp{\2} escapes to begin and end sequences of
|
||||
non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
The default is @samp{(ins)}.
|
||||
|
||||
@item visible-stats
|
||||
@vindex visible-stats
|
||||
If set to @samp{on}, a character denoting a file's type
|
||||
|
@ -975,7 +880,7 @@ binding, variable assignment, and conditional syntax.
|
|||
# You can re-read the inputrc file with C-x C-r.
|
||||
# Lines beginning with '#' are comments.
|
||||
#
|
||||
# First, include any system-wide bindings and variable
|
||||
# First, include any systemwide bindings and variable
|
||||
# assignments from /etc/Inputrc
|
||||
$include /etc/Inputrc
|
||||
|
||||
|
@ -1180,47 +1085,28 @@ the history as necessary. This is an incremental search.
|
|||
|
||||
@item forward-search-history (C-s)
|
||||
Search forward starting at the current line and moving `down' through
|
||||
the history as necessary. This is an incremental search.
|
||||
the the history as necessary. This is an incremental search.
|
||||
|
||||
@item non-incremental-reverse-search-history (M-p)
|
||||
Search backward starting at the current line and moving `up'
|
||||
through the history as necessary using a non-incremental search
|
||||
for a string supplied by the user.
|
||||
The search string may match anywhere in a history line.
|
||||
|
||||
@item non-incremental-forward-search-history (M-n)
|
||||
Search forward starting at the current line and moving `down'
|
||||
through the history as necessary using a non-incremental search
|
||||
through the the history as necessary using a non-incremental search
|
||||
for a string supplied by the user.
|
||||
The search string may match anywhere in a history line.
|
||||
|
||||
@item history-search-forward ()
|
||||
Search forward through the history for the string of characters
|
||||
between the start of the current line and the point.
|
||||
The search string must match at the beginning of a history line.
|
||||
This is a non-incremental search.
|
||||
By default, this command is unbound.
|
||||
|
||||
@item history-search-backward ()
|
||||
Search backward through the history for the string of characters
|
||||
between the start of the current line and the point.
|
||||
The search string must match at the beginning of a history line.
|
||||
This is a non-incremental search.
|
||||
By default, this command is unbound.
|
||||
|
||||
@item history-substr-search-forward ()
|
||||
Search forward through the history for the string of characters
|
||||
between the start of the current line and the point.
|
||||
The search string may match anywhere in a history line.
|
||||
This is a non-incremental search.
|
||||
By default, this command is unbound.
|
||||
|
||||
@item history-substr-search-backward ()
|
||||
Search backward through the history for the string of characters
|
||||
between the start of the current line and the point.
|
||||
The search string may match anywhere in a history line.
|
||||
This is a non-incremental search.
|
||||
By default, this command is unbound.
|
||||
between the start of the current line and the point. This
|
||||
is a non-incremental search. By default, this command is unbound.
|
||||
|
||||
@item yank-nth-arg (M-C-y)
|
||||
Insert the first argument to the previous command (usually
|
||||
|
@ -1251,17 +1137,11 @@ as if the @samp{!$} history expansion had been specified.
|
|||
@subsection Commands For Changing Text
|
||||
|
||||
@ftable @code
|
||||
|
||||
@item @i{end-of-file} (usually C-d)
|
||||
The character indicating end-of-file as set, for example, by
|
||||
@code{stty}. If this character is read when there are no characters
|
||||
on the line, and point is at the beginning of the line, Readline
|
||||
interprets it as the end of input and returns @sc{eof}.
|
||||
|
||||
@item delete-char (C-d)
|
||||
Delete the character at point. If this function is bound to the
|
||||
same character as the tty @sc{eof} character, as @kbd{C-d}
|
||||
commonly is, see above for the effects.
|
||||
Delete the character at point. If point is at the
|
||||
beginning of the line, there are no characters in the line, and
|
||||
the last character typed was not bound to @code{delete-char}, then
|
||||
return @sc{eof}.
|
||||
|
||||
@item backward-delete-char (Rubout)
|
||||
Delete the character behind the cursor. A numeric argument means
|
||||
|
@ -1284,14 +1164,6 @@ Insert a tab character.
|
|||
@item self-insert (a, b, A, 1, !, @dots{})
|
||||
Insert yourself.
|
||||
|
||||
@item bracketed-paste-begin ()
|
||||
This function is intended to be bound to the "bracketed paste" escape
|
||||
sequence sent by some terminals, and such a binding is assigned by default.
|
||||
It allows Readline to insert the pasted text as a single unit without treating
|
||||
each character as if it had been read from the keyboard. The characters
|
||||
are inserted as if each one was bound to @code{self-insert}) instead of
|
||||
executing any editing commands.
|
||||
|
||||
@item transpose-chars (C-t)
|
||||
Drag the character before the cursor forward over
|
||||
the character at the cursor, moving the
|
||||
|
@ -1343,7 +1215,7 @@ By default, this command is unbound.
|
|||
Kill the text from point to the end of the line.
|
||||
|
||||
@item backward-kill-line (C-x Rubout)
|
||||
Kill backward from the cursor to the beginning of the current line.
|
||||
Kill backward to the beginning of the line.
|
||||
|
||||
@item unix-line-discard (C-u)
|
||||
Kill backward from the cursor to the beginning of the current line.
|
||||
|
@ -1425,7 +1297,7 @@ leading minus sign, those digits define the argument.
|
|||
If the command is followed by digits, executing @code{universal-argument}
|
||||
again ends the numeric argument, but is otherwise ignored.
|
||||
As a special case, if this command is immediately followed by a
|
||||
character that is neither a digit nor minus sign, the argument count
|
||||
character that is neither a digit or minus sign, the argument count
|
||||
for the next command is multiplied by four.
|
||||
The argument count is initially one, so executing this function the
|
||||
first time makes the argument count four, a second time makes the
|
||||
|
@ -1563,10 +1435,6 @@ and save the definition.
|
|||
Re-execute the last keyboard macro defined, by making the characters
|
||||
in the macro appear as if typed at the keyboard.
|
||||
|
||||
@item print-last-kbd-macro ()
|
||||
Print the last keboard macro defined in a format suitable for the
|
||||
@var{inputrc} file.
|
||||
|
||||
@end ftable
|
||||
|
||||
@node Miscellaneous Commands
|
||||
|
@ -1825,11 +1693,10 @@ When the command or function is invoked, the @env{COMP_LINE},
|
|||
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 ($1) is the
|
||||
When the function or command is invoked, the first argument is the
|
||||
name of the command whose arguments are being completed, the
|
||||
second argument ($2) is the word being completed, and the third argument
|
||||
($3) is the word preceding the word being completed on the current command
|
||||
line.
|
||||
second argument is the word being completed, and the third argument
|
||||
is the word preceding the word being completed on the current command line.
|
||||
No filtering of the generated completions against the word being completed
|
||||
is performed; the function or command has complete freedom in generating
|
||||
the matches.
|
||||
|
@ -1839,7 +1706,7 @@ The function may use any of the shell facilities, including the
|
|||
@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, one per array element.
|
||||
variable.
|
||||
|
||||
Next, any command specified with the @option{-C} option is invoked
|
||||
in an environment equivalent to command substitution.
|
||||
|
@ -1856,10 +1723,6 @@ is removed before attempting a match.
|
|||
Any completion that matches the pattern will be removed from the list.
|
||||
A leading @samp{!} negates the pattern; in this case any completion
|
||||
not matching the pattern will be removed.
|
||||
If the @code{nocasematch} shell option
|
||||
(see the description of @code{shopt} in @ref{The Shopt Builtin})
|
||||
is enabled, the match is performed without regard to the case
|
||||
of alphabetic characters.
|
||||
|
||||
Finally, any prefix and suffix specified with the @option{-P} and @option{-S}
|
||||
options are added to each member of the completion list, and the result is
|
||||
|
@ -1911,18 +1774,17 @@ completion function would load completions dynamically:
|
|||
@example
|
||||
_completion_loader()
|
||||
@{
|
||||
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
|
||||
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
|
||||
@}
|
||||
complete -D -F _completion_loader -o bashdefault -o default
|
||||
complete -D -F _completion_loader
|
||||
@end example
|
||||
|
||||
@node Programmable Completion Builtins
|
||||
@section Programmable Completion Builtins
|
||||
@cindex completion builtins
|
||||
|
||||
Three builtin commands are available to manipulate the programmable completion
|
||||
facilities: one to specify how the arguments to a particular command are to
|
||||
be completed, and two to modify the completion as it is happening.
|
||||
Two builtin commands are available to manipulate the programmable completion
|
||||
facilities.
|
||||
|
||||
@table @code
|
||||
@item compgen
|
||||
|
@ -2009,13 +1871,6 @@ quoting special characters, or suppressing trailing spaces).
|
|||
This option is intended to be used with shell functions specified
|
||||
with @option{-F}.
|
||||
|
||||
@item noquote
|
||||
Tell Readline not to quote the completed words if they are filenames
|
||||
(quoting filenames is the default).
|
||||
|
||||
@item nosort
|
||||
Tell Readline not to sort the list of possible completions alphabetically.
|
||||
|
||||
@item nospace
|
||||
Tell Readline not to append a space (the default) to words completed at
|
||||
the end of the line.
|
||||
|
@ -2115,10 +1970,6 @@ used as the possible completions.
|
|||
@item -F @var{function}
|
||||
The shell function @var{function} is executed in the current shell
|
||||
environment.
|
||||
When it is executed, $1 is the name of the command whose arguments are
|
||||
being completed, $2 is the word being completed, and $3 is the word
|
||||
preceding the word being completed, as described above
|
||||
(@pxref{Programmable Completion}).
|
||||
When it finishes, the possible completions are retrieved from the value
|
||||
of the @env{COMPREPLY} array variable.
|
||||
|
||||
|
@ -2183,122 +2034,4 @@ specification exists, or an output error occurs.
|
|||
|
||||
@end table
|
||||
|
||||
@node A Programmable Completion Example
|
||||
@section A Programmable Completion Example
|
||||
|
||||
The most common way to obtain additional completion functionality beyond
|
||||
the default actions @code{complete} and @code{compgen} provide is to use
|
||||
a shell function and bind it to a particular command using @code{complete -F}.
|
||||
|
||||
The following function provides completions for the @code{cd} builtin.
|
||||
It is a reasonably good example of what shell functions must do when
|
||||
used for completion. This function uses the word passsed as @code{$2}
|
||||
to determine the directory name to complete. You can also use the
|
||||
@code{COMP_WORDS} array variable; the current word is indexed by the
|
||||
@code{COMP_CWORD} variable.
|
||||
|
||||
The function relies on the @code{complete} and @code{compgen} builtins
|
||||
to do much of the work, adding only the things that the Bash @code{cd}
|
||||
does beyond accepting basic directory names:
|
||||
tilde expansion (@pxref{Tilde Expansion}),
|
||||
searching directories in @var{$CDPATH}, which is described above
|
||||
(@pxref{Bourne Shell Builtins}),
|
||||
and basic support for the @code{cdable_vars} shell option
|
||||
(@pxref{The Shopt Builtin}).
|
||||
@code{_comp_cd} modifies the value of @var{IFS} so that it contains only
|
||||
a newline to accommodate file names containing spaces and tabs --
|
||||
@code{compgen} prints the possible completions it generates one per line.
|
||||
|
||||
Possible completions go into the @var{COMPREPLY} array variable, one
|
||||
completion per array element. The programmable completion system retrieves
|
||||
the completions from there when the function returns.
|
||||
|
||||
@example
|
||||
# A completion function for the cd builtin
|
||||
# based on the cd completion function from the bash_completion package
|
||||
_comp_cd()
|
||||
@{
|
||||
local IFS=$' \t\n' # normalize IFS
|
||||
local cur _skipdot _cdpath
|
||||
local i j k
|
||||
|
||||
# Tilde expansion, with side effect of expanding tilde to full pathname
|
||||
case "$2" in
|
||||
\~*) eval cur="$2" ;;
|
||||
*) cur=$2 ;;
|
||||
esac
|
||||
|
||||
# no cdpath or absolute pathname -- straight directory completion
|
||||
if [[ -z "$@{CDPATH:-@}" ]] || [[ "$cur" == @@(./*|../*|/*) ]]; then
|
||||
# compgen prints paths one per line; could also use while loop
|
||||
IFS=$'\n'
|
||||
COMPREPLY=( $(compgen -d -- "$cur") )
|
||||
IFS=$' \t\n'
|
||||
# CDPATH+directories in the current directory if not in CDPATH
|
||||
else
|
||||
IFS=$'\n'
|
||||
_skipdot=false
|
||||
# preprocess CDPATH to convert null directory names to .
|
||||
_cdpath=$@{CDPATH/#:/.:@}
|
||||
_cdpath=$@{_cdpath//::/:.:@}
|
||||
_cdpath=$@{_cdpath/%:/:.@}
|
||||
for i in $@{_cdpath//:/$'\n'@}; do
|
||||
if [[ $i -ef . ]]; then _skipdot=true; fi
|
||||
k="$@{#COMPREPLY[@@]@}"
|
||||
for j in $( compgen -d -- "$i/$cur" ); do
|
||||
COMPREPLY[k++]=$@{j#$i/@} # cut off directory
|
||||
done
|
||||
done
|
||||
$_skipdot || COMPREPLY+=( $(compgen -d -- "$cur") )
|
||||
IFS=$' \t\n'
|
||||
fi
|
||||
|
||||
# variable names if appropriate shell option set and no completions
|
||||
if shopt -q cdable_vars && [[ $@{#COMPREPLY[@@]@} -eq 0 ]]; then
|
||||
COMPREPLY=( $(compgen -v -- "$cur") )
|
||||
fi
|
||||
|
||||
return 0
|
||||
@}
|
||||
@end example
|
||||
|
||||
We install the completion function using the @option{-F} option to
|
||||
@code{complete}:
|
||||
|
||||
@example
|
||||
# Tell readline to quote appropriate and append slashes to directories;
|
||||
# use the bash default completion for other arguments
|
||||
complete -o filenames -o nospace -o bashdefault -F _comp_cd cd
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Since we'd like Bash and Readline to take care of some
|
||||
of the other details for us, we use several other options to tell Bash
|
||||
and Readline what to do. The @option{-o filenames} option tells Readline
|
||||
that the possible completions should be treated as filenames, and quoted
|
||||
appropriately. That option will also cause Readline to append a slash to
|
||||
filenames it can determine are directories (which is why we might want to
|
||||
extend @code{_comp_cd} to append a slash if we're using directories found
|
||||
via @var{CDPATH}: Readline can't tell those completions are directories).
|
||||
The @option{-o nospace} option tells Readline to not append a space
|
||||
character to the directory name, in case we want to append to it.
|
||||
The @option{-o bashdefault} option brings in the rest of the "Bash default"
|
||||
completions -- possible completion that Bash adds to the default Readline
|
||||
set. These include things like command name completion, variable completion
|
||||
for words beginning with @samp{@{}, completions containing pathname
|
||||
expansion patterns (@pxref{Filename Expansion}), and so on.
|
||||
|
||||
Once installed using @code{complete}, @code{_comp_cd} will be called every
|
||||
time we attempt word completion for a @code{cd} command.
|
||||
|
||||
Many more examples -- an extensive collection of completions for most of
|
||||
the common GNU, Unix, and Linux commands -- are available as part of the
|
||||
bash_completion project. This is installed by default on many GNU/Linux
|
||||
distributions. Originally written by Ian Macdonald, the project now lives
|
||||
at @url{http://bash-completion.alioth.debian.org/}. There are ports for
|
||||
other systems such as Solaris and Mac OS X.
|
||||
|
||||
An older version of the bash_completion package is distributed with bash
|
||||
in the @file{examples/complete} subdirectory.
|
||||
|
||||
@end ifset
|
||||
|
|
|
@ -2,25 +2,33 @@
|
|||
@comment %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename rluserman.info
|
||||
@settitle GNU Readline Library
|
||||
@include version.texi
|
||||
|
||||
@comment %**end of header (This is for running Texinfo on a region.)
|
||||
|
||||
@include version.texi
|
||||
|
||||
@copying
|
||||
This manual describes the end user interface of the GNU Readline Library
|
||||
(version @value{VERSION}, @value{UPDATED}), a library which aids in the
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2011 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled
|
||||
``GNU Free Documentation License''.
|
||||
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''.
|
||||
|
||||
(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.''
|
||||
|
||||
@end quotation
|
||||
@end copying
|
||||
|
@ -41,6 +49,12 @@ A copy of the license is included in the section entitled
|
|||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
|
||||
@sp 1
|
||||
Published by the Free Software Foundation @*
|
||||
59 Temple Place, Suite 330, @*
|
||||
Boston, MA 02111-1307 @*
|
||||
USA @*
|
||||
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
@ -52,7 +66,6 @@ A copy of the license is included in the section entitled
|
|||
This document describes the end user interface of the GNU Readline Library,
|
||||
a utility which aids in the consistency of user interface across discrete
|
||||
programs which provide a command line interface.
|
||||
The Readline home page is @url{http://www.gnu.org/software/readline/}.
|
||||
|
||||
@menu
|
||||
* Command Line Editing:: GNU Readline User's Manual.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -35,7 +35,7 @@ require 5.0;
|
|||
#--##############################################################################
|
||||
|
||||
# CVS version:
|
||||
# $Id: texi2html.pl,v 1.55 2000/07/27 14:39:41 obachman Exp $
|
||||
# $Id$
|
||||
|
||||
# Homepage:
|
||||
$T2H_HOMEPAGE = <<EOT;
|
||||
|
@ -91,7 +91,7 @@ eval { ($T2H_USER = (getpwuid ($<))[6]) =~ s/,.*//;}; # Who am i
|
|||
# Copy this file and make changes to it, if you like.
|
||||
# Afterwards, either, load it with command-line option -init_file <your_init_file>
|
||||
#
|
||||
# $Id: texi2html.init,v 1.34 2000/07/27 14:09:02 obachman Exp $
|
||||
# $Id$
|
||||
|
||||
######################################################################
|
||||
# stuff which can also be set by command-line options
|
||||
|
@ -1509,7 +1509,7 @@ package Getopt::MySimple;
|
|||
|
||||
# --------------------------------------------------------------------------
|
||||
# Locally modified by obachman (Display type instead of env, order by cmp)
|
||||
# $Id: MySimple.pm,v 1.1 2000/07/03 08:44:13 obachman Exp $
|
||||
# $Id$
|
||||
|
||||
# use strict;
|
||||
# no strict 'refs';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
@ignore
|
||||
Copyright (C) 1988-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2011 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 6.4
|
||||
@set VERSION 6.4
|
||||
@set UPDATED 28 May 2015
|
||||
@set UPDATED-MONTH May 2015
|
||||
@set EDITION 6.2
|
||||
@set VERSION 6.2
|
||||
@set UPDATED September 6 2010
|
||||
@set UPDATED-MONTH September 2010
|
||||
|
||||
@set LASTCHANGE Thu May 28 16:58:07 EDT 2015
|
||||
@set LASTCHANGE Mon Sep 6 22:07:10 EDT 2010
|
||||
|
|
|
@ -277,7 +277,13 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
|
|||
{ ISFUNC, rl_insert }, /* Latin capital letter Y with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter thorn (Icelandic) */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter sharp s (German) */
|
||||
#ifndef __MINGW32__
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with grave */
|
||||
#else
|
||||
/* Temporary - this is a bug in readline 5.1 that should be fixed in
|
||||
readline 5.2. */
|
||||
{ ISFUNC, 0 }, /* Must leave this unbound for the arrow keys to work. */
|
||||
#endif
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with tilde */
|
||||
|
|
|
@ -53,7 +53,7 @@ CPPFLAGS = @CPPFLAGS@
|
|||
|
||||
INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
|
||||
|
||||
CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
|
||||
LDFLAGS = -g -L.. @LDFLAGS@
|
||||
|
||||
PURIFY = @PURIFY@
|
||||
|
@ -68,19 +68,11 @@ TERMCAP_LIB = @TERMCAP_LIB@
|
|||
$(CC) $(CCFLAGS) -c $<
|
||||
|
||||
SOURCES = excallback.c fileman.c histexamp.c manexamp.c rl-fgets.c rl.c \
|
||||
rlbasic.c rlcat.c rlevent.c rlptytest.c rltest.c rlversion.c \
|
||||
rl-callbacktest.c hist_erasedups.c hist_purgecmd.c
|
||||
rlcat.c rlevent.c rlptytest.c rltest.c rlversion.c
|
||||
|
||||
EXECUTABLES = fileman$(EXEEXT) rltest$(EXEEXT) rl$(EXEEXT) rlcat$(EXEEXT) \
|
||||
rlevent$(EXEEXT) rlversion$(EXEEXT) histexamp$(EXEEXT) \
|
||||
rl-callbacktest$(EXEEXT) rlbasic$(EXEEXT) \
|
||||
hist_erasedups$(EXEEXT) hist_purgecmd$(EXEEXT)
|
||||
|
||||
OBJECTS = fileman.o rltest.o rl.o rlevent.o rlcat.o rlversion.o histexamp.o \
|
||||
rl-callbacktest.o rlbasic.o hist_erasedups.o hist_purgecmd.o
|
||||
|
||||
OTHEREXE = rlptytest$(EXEEXT)
|
||||
OTHEROBJ = rlptytest.o
|
||||
rlevent$(EXEEXT) rlversion$(EXEEXT) histexamp$(EXEEXT)
|
||||
OBJECTS = fileman.o rltest.o rl.o rlevent.o rlcat.o rlversion.o histexamp.o
|
||||
|
||||
all: $(EXECUTABLES)
|
||||
everything: all
|
||||
|
@ -106,9 +98,6 @@ uninstall:
|
|||
rl$(EXEEXT): rl.o $(READLINE_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ rl.o $(READLINE_LIB) $(TERMCAP_LIB)
|
||||
|
||||
rlbasic$(EXEEXT): rlbasic.o $(READLINE_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ rlbasic.o $(READLINE_LIB) $(TERMCAP_LIB)
|
||||
|
||||
rlcat$(EXEEXT): rlcat.o $(READLINE_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ rlcat.o $(READLINE_LIB) $(TERMCAP_LIB)
|
||||
|
||||
|
@ -121,9 +110,6 @@ fileman$(EXEEXT): fileman.o $(READLINE_LIB)
|
|||
rltest$(EXEEXT): rltest.o $(READLINE_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ rltest.o $(READLINE_LIB) $(TERMCAP_LIB)
|
||||
|
||||
rl-callbacktest$(EXEEXT): rl-callbacktest.o $(READLINE_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ rl-callbacktest.o $(READLINE_LIB) $(TERMCAP_LIB)
|
||||
|
||||
rlptytest$(EXEEXT): rlptytest.o $(READLINE_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ rlptytest.o $(READLINE_LIB) $(TERMCAP_LIB)
|
||||
|
||||
|
@ -133,15 +119,9 @@ rlversion$(EXEEXT): rlversion.o $(READLINE_LIB)
|
|||
histexamp$(EXEEXT): histexamp.o $(HISTORY_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ histexamp.o -lhistory $(TERMCAP_LIB)
|
||||
|
||||
hist_erasedups$(EXEEXT): hist_erasedups.o $(HISTORY_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ hist_erasedups.o -lhistory $(TERMCAP_LIB)
|
||||
|
||||
hist_purgecmd$(EXEEXT): hist_purgecmd.o $(HISTORY_LIB)
|
||||
$(PURIFY) $(CC) $(LDFLAGS) -o $@ hist_purgecmd.o -lhistory $(TERMCAP_LIB)
|
||||
|
||||
clean mostlyclean:
|
||||
$(RM) $(OBJECTS) $(OTHEROBJ)
|
||||
$(RM) $(EXECUTABLES) $(OTHEREXE) *.exe
|
||||
$(RM) $(OBJECTS)
|
||||
$(RM) $(EXECUTABLES) *.exe
|
||||
|
||||
distclean maintainer-clean: clean
|
||||
$(RM) Makefile
|
||||
|
@ -151,21 +131,13 @@ rltest.o: rltest.c
|
|||
rl.o: rl.c
|
||||
rlversion.o: rlversion.c
|
||||
histexamp.o: histexamp.c
|
||||
hist_erasedups.o: hist_erasedups.c
|
||||
hist_purgecmd.o: hist_purgecmd.c
|
||||
rlbasic.o: rlbasic.c
|
||||
rlcat.o: rlcat.c
|
||||
rlptytest.o: rlptytest.c
|
||||
rl-callbacktest.o: rl-callbacktest.c
|
||||
|
||||
fileman.o: $(top_srcdir)/readline.h
|
||||
rltest.o: $(top_srcdir)/readline.h
|
||||
rl.o: $(top_srcdir)/readline.h
|
||||
rlversion.o: $(top_srcdir)/readline.h
|
||||
histexamp.o: $(top_srcdir)/history.h
|
||||
hist_erasedups.o: $(top_srcdir)/history.h
|
||||
hist_purgecmd.o: $(top_srcdir)/history.h
|
||||
rlbasic.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h
|
||||
rlcat.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h
|
||||
rlptytest.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h
|
||||
rl-callbacktest.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h
|
||||
|
|
|
@ -40,14 +40,13 @@ Copyright (C) 1999 Jeff Solomon
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <termios.h> /* xxx - should make this more general */
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
|
@ -56,10 +55,6 @@ Copyright (C) 1999 Jeff Solomon
|
|||
# include <readline/readline.h>
|
||||
#endif
|
||||
|
||||
#ifndef STDIN_FILENO
|
||||
# define STDIN_FILENO 0
|
||||
#endif
|
||||
|
||||
/* This little examples demonstrates the alternate interface to using readline.
|
||||
* In the alternate interface, the user maintains control over program flow and
|
||||
* only calls readline when STDIN is readable. Using the alternate interface,
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
/* hist_erasedups -- remove all duplicate entries from history file */
|
||||
|
||||
/* Copyright (C) 2011 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.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef READLINE_LIBRARY
|
||||
#define READLINE_LIBRARY 1
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
# include "history.h"
|
||||
#else
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
|
||||
#define STREQN(a, b, n) ((n == 0) ? (1) \
|
||||
: ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
|
||||
|
||||
extern int history_offset;
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf (stderr, "hist_erasedups: usage: hist_erasedups [-t] [filename]\n");
|
||||
exit (2);
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *fn;
|
||||
int r;
|
||||
|
||||
while ((r = getopt (argc, argv, "t")) != -1)
|
||||
{
|
||||
switch (r)
|
||||
{
|
||||
case 't':
|
||||
history_write_timestamps = 1;
|
||||
break;
|
||||
default:
|
||||
usage ();
|
||||
}
|
||||
}
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
fn = argc ? argv[0] : getenv ("HISTFILE");
|
||||
if (fn == 0)
|
||||
{
|
||||
fprintf (stderr, "hist_erasedups: no history file\n");
|
||||
usage ();
|
||||
}
|
||||
|
||||
if ((r = read_history (fn)) != 0)
|
||||
{
|
||||
fprintf (stderr, "hist_erasedups: read_history: %s: %s\n", fn, strerror (r));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
hist_erasedups ();
|
||||
|
||||
if ((r = write_history (fn)) != 0)
|
||||
{
|
||||
fprintf (stderr, "hist_erasedups: write_history: %s: %s\n", fn, strerror (r));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
int
|
||||
hist_erasedups ()
|
||||
{
|
||||
int r, n;
|
||||
HIST_ENTRY *h, *temp;
|
||||
|
||||
using_history ();
|
||||
while (h = previous_history ())
|
||||
{
|
||||
r = where_history ();
|
||||
for (n = 0; n < r; n++)
|
||||
{
|
||||
temp = history_get (n+history_base);
|
||||
if (STREQ (h->line, temp->line))
|
||||
{
|
||||
remove_history (n);
|
||||
r--; /* have to get one fewer now */
|
||||
n--; /* compensate for above increment */
|
||||
history_offset--; /* moving backwards in history list */
|
||||
}
|
||||
}
|
||||
}
|
||||
using_history ();
|
||||
|
||||
return r;
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
/* hist_purgecmd -- remove all instances of command or pattern from history
|
||||
file */
|
||||
|
||||
/* Copyright (C) 2011 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.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef READLINE_LIBRARY
|
||||
#define READLINE_LIBRARY 1
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
# include "history.h"
|
||||
#else
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
|
||||
#define STREQN(a, b, n) ((n == 0) ? (1) \
|
||||
: ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
|
||||
|
||||
extern int history_offset;
|
||||
|
||||
#define PURGE_REGEXP 0x01
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf (stderr, "hist_purgecmd: usage: hist_purgecmd [-r] [-t] [-f filename] command-spec\n");
|
||||
exit (2);
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *fn;
|
||||
int r, flags;
|
||||
|
||||
flags = 0;
|
||||
fn = 0;
|
||||
while ((r = getopt (argc, argv, "f:rt")) != -1)
|
||||
{
|
||||
switch (r)
|
||||
{
|
||||
case 'f':
|
||||
fn = optarg;
|
||||
break;
|
||||
case 'r':
|
||||
flags |= PURGE_REGEXP;
|
||||
break;
|
||||
case 't':
|
||||
history_write_timestamps = 1;
|
||||
break;
|
||||
default:
|
||||
usage ();
|
||||
}
|
||||
}
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (fn == 0)
|
||||
fn = getenv ("HISTFILE");
|
||||
if (fn == 0)
|
||||
{
|
||||
fprintf (stderr, "hist_purgecmd: no history file\n");
|
||||
usage ();
|
||||
}
|
||||
|
||||
if ((r = read_history (fn)) != 0)
|
||||
{
|
||||
fprintf (stderr, "hist_purgecmd: read_history: %s: %s\n", fn, strerror (r));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
for (r = 0; r < argc; r++)
|
||||
hist_purgecmd (argv[r], flags);
|
||||
|
||||
if ((r = write_history (fn)) != 0)
|
||||
{
|
||||
fprintf (stderr, "hist_purgecmd: write_history: %s: %s\n", fn, strerror (r));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
int
|
||||
hist_purgecmd (cmd, flags)
|
||||
char *cmd;
|
||||
int flags;
|
||||
{
|
||||
int r, n, rflags;
|
||||
HIST_ENTRY *temp;
|
||||
regex_t regex = { 0 };
|
||||
|
||||
if (flags & PURGE_REGEXP)
|
||||
{
|
||||
rflags = REG_EXTENDED|REG_NOSUB;
|
||||
if (regcomp (®ex, cmd, rflags))
|
||||
{
|
||||
fprintf (stderr, "hist_purgecmd: %s: invalid regular expression\n", cmd);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
r = 0;
|
||||
using_history ();
|
||||
r = where_history ();
|
||||
for (n = 0; n < r; n++)
|
||||
{
|
||||
temp = history_get (n+history_base);
|
||||
if (((flags & PURGE_REGEXP) && (regexec (®ex, temp->line, 0, 0, 0) == 0)) ||
|
||||
((flags & PURGE_REGEXP) == 0 && STREQ (temp->line, cmd)))
|
||||
{
|
||||
remove_history (n);
|
||||
r--; /* have to get one fewer now */
|
||||
n--; /* compensate for above increment */
|
||||
history_offset--; /* moving backwards in history list */
|
||||
}
|
||||
}
|
||||
using_history ();
|
||||
|
||||
if (flags & PURGE_REGEXP)
|
||||
regfree (®ex);
|
||||
|
||||
return r;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2001/09/11 06:19:36 $
|
||||
* $Author: vyzo $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*
|
||||
* Contents: A streambuf which uses the GNU readline library for line I/O
|
||||
* (c) 2001 by Dimitris Vyzovitis [vyzo@media.mit.edu]
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
/* Standard include files. stdio.h is required. */
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Used for select(2) */
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Standard readline include files. */
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "readline.h"
|
||||
# include "history.h"
|
||||
#else
|
||||
# include <readline/readline.h>
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
extern int errno;
|
||||
|
||||
static void cb_linehandler (char *);
|
||||
|
||||
int running;
|
||||
const char *prompt = "rltest$ ";
|
||||
|
||||
/* Callback function called for each line when accept-line executed, EOF
|
||||
seen, or EOF character read. This sets a flag and returns; it could
|
||||
also call exit(3). */
|
||||
static void
|
||||
cb_linehandler (char *line)
|
||||
{
|
||||
/* Can use ^D (stty eof) or `exit' to exit. */
|
||||
if (line == NULL || strcmp (line, "exit") == 0)
|
||||
{
|
||||
if (line == 0)
|
||||
printf ("\n");
|
||||
printf ("exit\n");
|
||||
/* This function needs to be called to reset the terminal settings,
|
||||
and calling it from the line handler keeps one extra prompt from
|
||||
being displayed. */
|
||||
rl_callback_handler_remove ();
|
||||
|
||||
running = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*line)
|
||||
add_history (line);
|
||||
printf ("input line: %s\n", line);
|
||||
free (line);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int c, char **v)
|
||||
{
|
||||
fd_set fds;
|
||||
int r;
|
||||
|
||||
/* Install the line handler. */
|
||||
rl_callback_handler_install (prompt, cb_linehandler);
|
||||
|
||||
/* Enter a simple event loop. This waits until something is available
|
||||
to read on readline's input stream (defaults to standard input) and
|
||||
calls the builtin character read callback to read it. It does not
|
||||
have to modify the user's terminal settings. */
|
||||
running = 1;
|
||||
while (running)
|
||||
{
|
||||
FD_ZERO (&fds);
|
||||
FD_SET (fileno (rl_instream), &fds);
|
||||
|
||||
r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
|
||||
if (r < 0 && errno != EINTR)
|
||||
{
|
||||
perror ("rltest: select");
|
||||
rl_callback_handler_remove ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (FD_ISSET (fileno (rl_instream), &fds))
|
||||
rl_callback_read_char ();
|
||||
}
|
||||
|
||||
printf ("rltest: Event loop has exited\n");
|
||||
return 0;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "readline.h"
|
||||
# include "history.h"
|
||||
#else
|
||||
# include <readline/readline.h>
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int c, char **v)
|
||||
{
|
||||
char *input;
|
||||
|
||||
for (;;) {
|
||||
input = readline ((char *)NULL);
|
||||
if (input == 0)
|
||||
break;
|
||||
printf ("%s\n", input);
|
||||
if (strcmp (input, "exit") == 0)
|
||||
break;
|
||||
free (input);
|
||||
}
|
||||
exit (0);
|
||||
}
|
|
@ -21,7 +21,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*
|
||||
****************************************************************
|
||||
* $Id: config.h.in,v 1.12 1994/05/31 12:31:36 mlschroe Exp $ FAU
|
||||
* $Id$ FAU
|
||||
*/
|
||||
|
||||
|
||||
|
@ -377,7 +377,3 @@
|
|||
#undef HAVE_SYS_STROPTS_H
|
||||
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
#undef HAVE_SGTTY_H
|
||||
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
|
3882
readline/examples/rlfe/configure
vendored
3882
readline/examples/rlfe/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,7 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
m4_include([../../../config/override.m4])
|
||||
|
||||
AC_INIT(rlfe.c)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
VERSION=0.4
|
||||
|
@ -223,7 +225,6 @@ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
|
|||
AC_MSG_ERROR(!!! no tgetent - no screen))))))
|
||||
|
||||
AC_TRY_RUN([
|
||||
extern char *tgoto();
|
||||
main()
|
||||
{
|
||||
exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
|
||||
|
@ -436,7 +437,6 @@ main()
|
|||
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(sys/stropts.h sys/wait.h sgtty.h sys/select.h)
|
||||
AC_CHECK_HEADERS(term.h)
|
||||
AC_CHECK_HEADERS(sys/stropts.h sys/wait.h)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*
|
||||
****************************************************************
|
||||
* $Id: extern.h,v 1.18 1994/05/31 12:31:57 mlschroe Exp $ FAU
|
||||
* $Id$ FAU
|
||||
*/
|
||||
|
||||
#if !defined(__GNUC__) || __GNUC__ < 2
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*
|
||||
****************************************************************
|
||||
* $Id: os.h,v 1.10 1994/05/31 12:32:22 mlschroe Exp $ FAU
|
||||
* $Id$ FAU
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -208,9 +208,7 @@ extern int errno;
|
|||
# include <cytermio.h>
|
||||
# endif
|
||||
# else /* TERMIO */
|
||||
# if defined (HAVE_SGTTY_H)
|
||||
# include <sgtty.h>
|
||||
# endif
|
||||
# include <sgtty.h>
|
||||
# endif /* TERMIO */
|
||||
#endif /* POSIX */
|
||||
|
||||
|
@ -492,7 +490,7 @@ extern int errno;
|
|||
* select stuff
|
||||
*/
|
||||
|
||||
#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_) || defined (__INTERIX)
|
||||
#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_)
|
||||
#include <sys/select.h> /* for timeval + FD... */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -547,14 +547,7 @@ main(int argc, char** argv)
|
|||
#endif
|
||||
|
||||
t.c_lflag &= ~(ICANON | ISIG | ECHO | ECHOCTL | ECHOE | \
|
||||
ECHOK | ECHONL
|
||||
#if defined (ECHOKE)
|
||||
| ECHOKE
|
||||
#endif
|
||||
#if defined (ECHOPRT)
|
||||
| ECHOPRT
|
||||
#endif
|
||||
);
|
||||
ECHOK | ECHOKE | ECHONL | ECHOPRT );
|
||||
t.c_iflag &= ~ICRNL;
|
||||
t.c_iflag |= IGNBRK;
|
||||
t.c_cc[VMIN] = 1;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <signal.h>
|
||||
|
||||
#if 1 /* LINUX */
|
||||
#if 0 /* LINUX */
|
||||
#include <pty.h>
|
||||
#else
|
||||
#include <util.h>
|
||||
|
@ -316,8 +316,6 @@ main()
|
|||
if (val == -1)
|
||||
return -1;
|
||||
|
||||
signal (SIGINT, sigint);
|
||||
|
||||
val = init_readline (slavefd, slavefd);
|
||||
if (val == -1)
|
||||
return -1;
|
||||
|
@ -326,6 +324,8 @@ main()
|
|||
if (val == -1)
|
||||
return -1;
|
||||
|
||||
signal (SIGINT, sigint);
|
||||
|
||||
val = main_loop ();
|
||||
|
||||
tty_reset (STDIN_FILENO);
|
||||
|
|
|
@ -68,7 +68,6 @@ static const FUNMAP default_funmap[] = {
|
|||
{ "backward-word", rl_backward_word },
|
||||
{ "beginning-of-history", rl_beginning_of_history },
|
||||
{ "beginning-of-line", rl_beg_of_line },
|
||||
{ "bracketed-paste-begin", rl_bracketed_paste_begin },
|
||||
{ "call-last-kbd-macro", rl_call_last_kbd_macro },
|
||||
{ "capitalize-word", rl_capitalize_word },
|
||||
{ "character-search", rl_char_search },
|
||||
|
@ -99,8 +98,6 @@ static const FUNMAP default_funmap[] = {
|
|||
{ "forward-word", rl_forward_word },
|
||||
{ "history-search-backward", rl_history_search_backward },
|
||||
{ "history-search-forward", rl_history_search_forward },
|
||||
{ "history-substring-search-backward", rl_history_substr_search_backward },
|
||||
{ "history-substring-search-forward", rl_history_substr_search_forward },
|
||||
{ "insert-comment", rl_insert_comment },
|
||||
{ "insert-completions", rl_insert_completions },
|
||||
{ "kill-whole-line", rl_kill_full_line },
|
||||
|
@ -116,12 +113,11 @@ static const FUNMAP default_funmap[] = {
|
|||
{ "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
|
||||
{ "old-menu-complete", rl_old_menu_complete },
|
||||
{ "overwrite-mode", rl_overwrite_mode },
|
||||
#if defined (_WIN32)
|
||||
#ifdef __CYGWIN__
|
||||
{ "paste-from-clipboard", rl_paste_from_clipboard },
|
||||
#endif
|
||||
{ "possible-completions", rl_possible_completions },
|
||||
{ "previous-history", rl_get_previous_history },
|
||||
{ "print-last-kbd-macro", rl_print_last_kbd_macro },
|
||||
{ "quoted-insert", rl_quoted_insert },
|
||||
{ "re-read-init-file", rl_re_read_init_file },
|
||||
{ "redraw-current-line", rl_refresh_line},
|
||||
|
@ -178,7 +174,7 @@ static const FUNMAP default_funmap[] = {
|
|||
{ "vi-fword", rl_vi_fword },
|
||||
{ "vi-goto-mark", rl_vi_goto_mark },
|
||||
{ "vi-insert-beg", rl_vi_insert_beg },
|
||||
{ "vi-insertion-mode", rl_vi_insert_mode },
|
||||
{ "vi-insertion-mode", rl_vi_insertion_mode },
|
||||
{ "vi-match", rl_vi_match },
|
||||
{ "vi-movement-mode", rl_vi_movement_mode },
|
||||
{ "vi-next-word", rl_vi_next_word },
|
||||
|
@ -195,7 +191,6 @@ static const FUNMAP default_funmap[] = {
|
|||
{ "vi-subst", rl_vi_subst },
|
||||
{ "vi-tilde-expand", rl_vi_tilde_expand },
|
||||
{ "vi-yank-arg", rl_vi_yank_arg },
|
||||
{ "vi-yank-pop", rl_vi_yank_pop },
|
||||
{ "vi-yank-to", rl_vi_yank_to },
|
||||
#endif /* VI_MODE */
|
||||
|
||||
|
@ -241,7 +236,7 @@ rl_initialize_funmap ()
|
|||
|
||||
/* Produce a NULL terminated array of known function names. The array
|
||||
is sorted. The array itself is allocated, but not the strings inside.
|
||||
You should free () the array when you done, but not the pointers. */
|
||||
You should free () the array when you done, but not the pointrs. */
|
||||
const char **
|
||||
rl_funmap_names ()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* histexpand.c -- history expansion. */
|
||||
|
||||
/* Copyright (C) 1989-2012 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1989-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (History), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
|
@ -50,7 +50,6 @@
|
|||
|
||||
#define HISTORY_WORD_DELIMITERS " \t\n;&()|<>"
|
||||
#define HISTORY_QUOTE_CHARACTERS "\"'`"
|
||||
#define HISTORY_EVENT_DELIMITERS "^$*%-"
|
||||
|
||||
#define slashify_in_quotes "\\`\"$"
|
||||
|
||||
|
@ -63,10 +62,6 @@ static char *subst_rhs;
|
|||
static int subst_lhs_len;
|
||||
static int subst_rhs_len;
|
||||
|
||||
/* Characters that delimit history event specifications and separate event
|
||||
specifications from word designators. Static for now */
|
||||
static char *history_event_delimiter_chars = HISTORY_EVENT_DELIMITERS;
|
||||
|
||||
static char *get_history_word_specifier PARAMS((char *, char *, int *));
|
||||
static int history_tokenize_word PARAMS((const char *, int));
|
||||
static char **history_tokenize_internal PARAMS((const char *, int, int *));
|
||||
|
@ -117,6 +112,7 @@ rl_linebuf_func_t *history_inhibit_expansion_function;
|
|||
|
||||
/* The last string searched for by a !?string? search. */
|
||||
static char *search_string;
|
||||
|
||||
/* The last string matched by a !?string? search. */
|
||||
static char *search_match;
|
||||
|
||||
|
@ -229,7 +225,6 @@ get_history_event (string, caller_index, delimiting_quote)
|
|||
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
if ((!substring_okay && (whitespace (c) || c == ':' ||
|
||||
(history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
|
||||
(history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
|
||||
string[i] == delimiting_quote)) ||
|
||||
string[i] == '\n' ||
|
||||
|
@ -277,8 +272,6 @@ get_history_event (string, caller_index, delimiting_quote)
|
|||
if (local_index == 0 || substring_okay)
|
||||
{
|
||||
entry = current_history ();
|
||||
if (entry == 0)
|
||||
FAIL_SEARCH ();
|
||||
history_offset = history_length;
|
||||
|
||||
/* If this was a substring search, then remember the
|
||||
|
@ -526,9 +519,9 @@ postproc_subst_rhs ()
|
|||
the returned string. Returns the new index into string in
|
||||
*END_INDEX_PTR, and the expanded specifier in *RET_STRING. */
|
||||
static int
|
||||
history_expand_internal (string, start, qc, end_index_ptr, ret_string, current_line)
|
||||
history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
|
||||
char *string;
|
||||
int start, qc, *end_index_ptr;
|
||||
int start, *end_index_ptr;
|
||||
char **ret_string;
|
||||
char *current_line; /* for !# */
|
||||
{
|
||||
|
@ -564,7 +557,30 @@ history_expand_internal (string, start, qc, end_index_ptr, ret_string, current_l
|
|||
event = current_line;
|
||||
}
|
||||
else
|
||||
event = get_history_event (string, &i, qc);
|
||||
{
|
||||
int quoted_search_delimiter = 0;
|
||||
|
||||
/* If the character before this `!' is a double or single
|
||||
quote, then this expansion takes place inside of the
|
||||
quoted string. If we have to search for some text ("!foo"),
|
||||
allow the delimiter to end the search string. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
int ch, l;
|
||||
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
|
||||
ch = string[l];
|
||||
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
|
||||
if (i && (ch == '\'' || ch == '"'))
|
||||
quoted_search_delimiter = ch;
|
||||
}
|
||||
else
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
if (i && (string[i - 1] == '\'' || string[i - 1] == '"'))
|
||||
quoted_search_delimiter = string[i - 1];
|
||||
|
||||
event = get_history_event (string, &i, quoted_search_delimiter);
|
||||
}
|
||||
|
||||
if (event == 0)
|
||||
{
|
||||
|
@ -838,7 +854,7 @@ history_expand_internal (string, start, qc, end_index_ptr, ret_string, current_l
|
|||
}
|
||||
i += 2;
|
||||
}
|
||||
/* Done with modifiers. */
|
||||
/* Done with modfiers. */
|
||||
/* Believe it or not, we have to back the pointer up by one. */
|
||||
--i;
|
||||
|
||||
|
@ -878,7 +894,7 @@ history_expand_internal (string, start, qc, end_index_ptr, ret_string, current_l
|
|||
1) If expansions did take place
|
||||
2) If the `p' modifier was given and the caller should print the result
|
||||
|
||||
If an error occurred in expansion, then OUTPUT contains a descriptive
|
||||
If an error ocurred in expansion, then OUTPUT contains a descriptive
|
||||
error message. */
|
||||
|
||||
#define ADD_STRING(s) \
|
||||
|
@ -912,7 +928,7 @@ history_expand (hstring, output)
|
|||
char **output;
|
||||
{
|
||||
register int j;
|
||||
int i, r, l, passc, cc, modified, eindex, only_printing, dquote, squote, flag;
|
||||
int i, r, l, passc, cc, modified, eindex, only_printing, dquote, flag;
|
||||
char *string;
|
||||
|
||||
/* The output string, and its length. */
|
||||
|
@ -975,7 +991,7 @@ history_expand (hstring, output)
|
|||
|
||||
/* `!' followed by one of the characters in history_no_expand_chars
|
||||
is NOT an expansion. */
|
||||
for (i = dquote = squote = 0; string[i]; i++)
|
||||
for (i = dquote = 0; string[i]; i++)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
|
@ -996,7 +1012,6 @@ history_expand (hstring, output)
|
|||
history expansion performed on it.
|
||||
Skip the rest of the line and break out of the loop. */
|
||||
if (history_comment_char && string[i] == history_comment_char &&
|
||||
dquote == 0 &&
|
||||
(i == 0 || member (string[i - 1], history_word_delimiters)))
|
||||
{
|
||||
while (string[i])
|
||||
|
@ -1007,13 +1022,6 @@ history_expand (hstring, output)
|
|||
{
|
||||
if (cc == 0 || member (cc, history_no_expand_chars))
|
||||
continue;
|
||||
/* DQUOTE won't be set unless history_quotes_inhibit_expansion
|
||||
is set. The idea here is to treat double-quoted strings the
|
||||
same as the word outside double quotes; in effect making the
|
||||
double quote part of history_no_expand_chars when DQUOTE is
|
||||
set. */
|
||||
else if (dquote && cc == '"')
|
||||
continue;
|
||||
/* If the calling application has set
|
||||
history_inhibit_expansion_function to a function that checks
|
||||
for special cases that should not be history expanded,
|
||||
|
@ -1063,9 +1071,9 @@ history_expand (hstring, output)
|
|||
}
|
||||
|
||||
/* Extract and perform the substitution. */
|
||||
for (passc = dquote = squote = i = j = 0; i < l; i++)
|
||||
for (passc = dquote = i = j = 0; i < l; i++)
|
||||
{
|
||||
int qc, tchar = string[i];
|
||||
int tchar = string[i];
|
||||
|
||||
if (passc)
|
||||
{
|
||||
|
@ -1122,14 +1130,8 @@ history_expand (hstring, output)
|
|||
case '\'':
|
||||
{
|
||||
/* If history_quotes_inhibit_expansion is set, single quotes
|
||||
inhibit history expansion, otherwise they are treated like
|
||||
double quotes. */
|
||||
if (squote)
|
||||
{
|
||||
squote = 0;
|
||||
ADD_CHAR (tchar);
|
||||
}
|
||||
else if (dquote == 0 && history_quotes_inhibit_expansion)
|
||||
inhibit history expansion. */
|
||||
if (dquote == 0 && history_quotes_inhibit_expansion)
|
||||
{
|
||||
int quote, slen;
|
||||
|
||||
|
@ -1144,19 +1146,13 @@ history_expand (hstring, output)
|
|||
ADD_STRING (temp);
|
||||
xfree (temp);
|
||||
}
|
||||
else if (dquote == 0 && squote == 0 && history_quotes_inhibit_expansion == 0)
|
||||
{
|
||||
squote = 1;
|
||||
ADD_CHAR (string[i]);
|
||||
}
|
||||
else
|
||||
ADD_CHAR (string[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
case -2: /* history_comment_char */
|
||||
if ((dquote == 0 || history_quotes_inhibit_expansion == 0) &&
|
||||
(i == 0 || member (string[i - 1], history_word_delimiters)))
|
||||
if (i == 0 || member (string[i - 1], history_word_delimiters))
|
||||
{
|
||||
temp = (char *)xmalloc (l - i + 1);
|
||||
strcpy (temp, string + i);
|
||||
|
@ -1175,7 +1171,6 @@ history_expand (hstring, output)
|
|||
characters in history_no_expand_chars, then it is not a
|
||||
candidate for expansion of any kind. */
|
||||
if (cc == 0 || member (cc, history_no_expand_chars) ||
|
||||
(dquote && cc == '"') ||
|
||||
(history_inhibit_expansion_function && (*history_inhibit_expansion_function) (string, i)))
|
||||
{
|
||||
ADD_CHAR (string[i]);
|
||||
|
@ -1201,8 +1196,8 @@ history_expand (hstring, output)
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
qc = squote ? '\'' : (dquote ? '"' : 0);
|
||||
r = history_expand_internal (string, i, qc, &eindex, &temp, result);
|
||||
|
||||
r = history_expand_internal (string, i, &eindex, &temp, result);
|
||||
if (r < 0)
|
||||
{
|
||||
*output = temp;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* histfile.c - functions to manipulate the history file. */
|
||||
|
||||
/* Copyright (C) 1989-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1989-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (History), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
|
@ -35,10 +35,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_LIMITS_H)
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if ! defined (_MINIX) && defined (HAVE_SYS_FILE_H)
|
||||
# include <sys/file.h>
|
||||
|
@ -103,31 +99,12 @@ extern int errno;
|
|||
#include "rlshell.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#if !defined (PATH_MAX)
|
||||
# define PATH_MAX 1024 /* default */
|
||||
#endif
|
||||
|
||||
/* If non-zero, we write timestamps to the history file in history_do_write() */
|
||||
int history_write_timestamps = 0;
|
||||
|
||||
/* Immediately after a call to read_history() or read_history_range(), this
|
||||
will return the number of lines just read from the history file in that
|
||||
call. */
|
||||
int history_lines_read_from_file = 0;
|
||||
|
||||
/* Immediately after a call to write_history() or history_do_write(), this
|
||||
will return the number of lines just written to the history file in that
|
||||
call. This also works with history_truncate_file. */
|
||||
int history_lines_written_to_file = 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 && isdigit ((unsigned char)(s)[1]) )
|
||||
|
||||
static char *history_backupfile PARAMS((const char *));
|
||||
static char *history_tempfile PARAMS((const char *));
|
||||
static int histfile_backup PARAMS((const char *, const char *));
|
||||
static int histfile_restore PARAMS((const char *, const 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
|
||||
|
@ -146,13 +123,16 @@ history_filename (filename)
|
|||
return (return_val);
|
||||
|
||||
home = sh_get_env_value ("HOME");
|
||||
#if defined (_WIN32)
|
||||
if (home == 0)
|
||||
home = sh_get_env_value ("APPDATA");
|
||||
#endif
|
||||
|
||||
if (home == 0)
|
||||
return (NULL);
|
||||
{
|
||||
#if 0
|
||||
home = ".";
|
||||
home_len = 1;
|
||||
#else
|
||||
return (NULL);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
home_len = strlen (home);
|
||||
|
||||
|
@ -168,75 +148,6 @@ history_filename (filename)
|
|||
return (return_val);
|
||||
}
|
||||
|
||||
static char *
|
||||
history_backupfile (filename)
|
||||
const char *filename;
|
||||
{
|
||||
const char *fn;
|
||||
char *ret, linkbuf[PATH_MAX+1];
|
||||
size_t len;
|
||||
ssize_t n;
|
||||
struct stat fs;
|
||||
|
||||
fn = filename;
|
||||
#if defined (HAVE_READLINK)
|
||||
/* Follow symlink to avoid backing up symlink itself; call will fail if
|
||||
not a symlink */
|
||||
if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0)
|
||||
{
|
||||
linkbuf[n] = '\0';
|
||||
fn = linkbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
len = strlen (fn);
|
||||
ret = xmalloc (len + 2);
|
||||
strcpy (ret, fn);
|
||||
ret[len] = '-';
|
||||
ret[len+1] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
history_tempfile (filename)
|
||||
const char *filename;
|
||||
{
|
||||
const char *fn;
|
||||
char *ret, linkbuf[PATH_MAX+1];
|
||||
size_t len;
|
||||
ssize_t n;
|
||||
struct stat fs;
|
||||
int pid;
|
||||
|
||||
fn = filename;
|
||||
#if defined (HAVE_READLINK)
|
||||
/* Follow symlink so tempfile created in the same directory as any symlinked
|
||||
history file; call will fail if not a symlink */
|
||||
if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0)
|
||||
{
|
||||
linkbuf[n] = '\0';
|
||||
fn = linkbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
len = strlen (fn);
|
||||
ret = xmalloc (len + 11);
|
||||
strcpy (ret, fn);
|
||||
|
||||
pid = (int)getpid ();
|
||||
|
||||
/* filename-PID.tmp */
|
||||
ret[len] = '-';
|
||||
ret[len+1] = (pid / 10000 % 10) + '0';
|
||||
ret[len+2] = (pid / 1000 % 10) + '0';
|
||||
ret[len+3] = (pid / 100 % 10) + '0';
|
||||
ret[len+4] = (pid / 10 % 10) + '0';
|
||||
ret[len+5] = (pid % 10) + '0';
|
||||
strcpy (ret + len + 6, ".tmp");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Add the contents of FILENAME to the history list, a line at a time.
|
||||
If FILENAME is NULL, then read from ~/.history. Returns 0 if
|
||||
successful, or errno if not. */
|
||||
|
@ -270,8 +181,6 @@ read_history_range (filename, from, to)
|
|||
int overflow_errno = EIO;
|
||||
#endif
|
||||
|
||||
history_lines_read_from_file = 0;
|
||||
|
||||
buffer = last_ts = (char *)NULL;
|
||||
input = history_filename (filename);
|
||||
file = input ? open (input, O_RDONLY|O_BINARY, 0666) : -1;
|
||||
|
@ -384,8 +293,6 @@ read_history_range (filename, from, to)
|
|||
line_start = line_end + 1;
|
||||
}
|
||||
|
||||
history_lines_read_from_file = current_line;
|
||||
|
||||
FREE (input);
|
||||
#ifndef HISTORY_USE_MMAP
|
||||
FREE (buffer);
|
||||
|
@ -396,68 +303,23 @@ read_history_range (filename, from, to)
|
|||
return (0);
|
||||
}
|
||||
|
||||
/* Save FILENAME to BACK, handling case where FILENAME is a symlink
|
||||
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
|
||||
static int
|
||||
histfile_backup (filename, back)
|
||||
const char *filename;
|
||||
const char *back;
|
||||
{
|
||||
#if defined (HAVE_READLINK)
|
||||
char linkbuf[PATH_MAX+1];
|
||||
ssize_t n;
|
||||
|
||||
/* Follow to target of symlink to avoid renaming symlink itself */
|
||||
if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0)
|
||||
{
|
||||
linkbuf[n] = '\0';
|
||||
return (rename (linkbuf, back));
|
||||
}
|
||||
#endif
|
||||
return (rename (filename, back));
|
||||
}
|
||||
|
||||
/* Restore ORIG from BACKUP handling case where ORIG is a symlink
|
||||
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
|
||||
static int
|
||||
histfile_restore (backup, orig)
|
||||
const char *backup;
|
||||
const char *orig;
|
||||
{
|
||||
#if defined (HAVE_READLINK)
|
||||
char linkbuf[PATH_MAX+1];
|
||||
ssize_t n;
|
||||
|
||||
/* Follow to target of symlink to avoid renaming symlink itself */
|
||||
if ((n = readlink (orig, linkbuf, sizeof (linkbuf) - 1)) > 0)
|
||||
{
|
||||
linkbuf[n] = '\0';
|
||||
return (rename (backup, linkbuf));
|
||||
}
|
||||
#endif
|
||||
return (rename (backup, orig));
|
||||
}
|
||||
|
||||
/* Truncate the history file FNAME, leaving only LINES trailing lines.
|
||||
If FNAME is NULL, then use ~/.history. Writes a new file and renames
|
||||
it to the original name. Returns 0 on success, errno on failure. */
|
||||
If FNAME is NULL, then use ~/.history. Returns 0 on success, errno
|
||||
on failure. */
|
||||
int
|
||||
history_truncate_file (fname, lines)
|
||||
const char *fname;
|
||||
int lines;
|
||||
{
|
||||
char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */
|
||||
int file, chars_read, rv, orig_lines, exists;
|
||||
char *buffer, *filename, *bp, *bp1; /* bp1 == bp+1 */
|
||||
int file, chars_read, rv;
|
||||
struct stat finfo;
|
||||
size_t file_size;
|
||||
|
||||
history_lines_written_to_file = 0;
|
||||
|
||||
buffer = (char *)NULL;
|
||||
filename = history_filename (fname);
|
||||
tempname = 0;
|
||||
file = filename ? open (filename, O_RDONLY|O_BINARY, 0666) : -1;
|
||||
rv = exists = 0;
|
||||
rv = 0;
|
||||
|
||||
/* Don't try to truncate non-regular files. */
|
||||
if (file == -1 || fstat (file, &finfo) == -1)
|
||||
|
@ -467,7 +329,6 @@ history_truncate_file (fname, lines)
|
|||
close (file);
|
||||
goto truncate_exit;
|
||||
}
|
||||
exists = 1;
|
||||
|
||||
if (S_ISREG (finfo.st_mode) == 0)
|
||||
{
|
||||
|
@ -499,7 +360,6 @@ history_truncate_file (fname, lines)
|
|||
buffer = (char *)malloc (file_size + 1);
|
||||
if (buffer == 0)
|
||||
{
|
||||
rv = errno;
|
||||
close (file);
|
||||
goto truncate_exit;
|
||||
}
|
||||
|
@ -513,7 +373,6 @@ history_truncate_file (fname, lines)
|
|||
goto truncate_exit;
|
||||
}
|
||||
|
||||
orig_lines = lines;
|
||||
/* Count backwards from the end of buffer until we have passed
|
||||
LINES lines. bp1 is set funny initially. But since bp[1] can't
|
||||
be a comment character (since it's off the end) and *bp can't be
|
||||
|
@ -542,56 +401,27 @@ history_truncate_file (fname, lines)
|
|||
|
||||
/* Write only if there are more lines in the file than we want to
|
||||
truncate to. */
|
||||
if (bp <= buffer)
|
||||
if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
|
||||
{
|
||||
rv = 0;
|
||||
/* No-op if LINES == 0 at this point */
|
||||
history_lines_written_to_file = orig_lines - lines;
|
||||
goto truncate_exit;
|
||||
write (file, bp, chars_read - (bp - buffer));
|
||||
|
||||
#if defined (__BEOS__)
|
||||
/* BeOS ignores O_TRUNC. */
|
||||
ftruncate (file, chars_read - (bp - buffer));
|
||||
#endif
|
||||
|
||||
close (file);
|
||||
}
|
||||
|
||||
tempname = history_tempfile (filename);
|
||||
|
||||
if ((file = open (tempname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600)) != -1)
|
||||
{
|
||||
if (write (file, bp, chars_read - (bp - buffer)) < 0)
|
||||
rv = errno;
|
||||
|
||||
if (close (file) < 0 && rv == 0)
|
||||
rv = errno;
|
||||
}
|
||||
else
|
||||
rv = errno;
|
||||
|
||||
truncate_exit:
|
||||
|
||||
FREE (buffer);
|
||||
|
||||
history_lines_written_to_file = orig_lines - lines;
|
||||
|
||||
if (rv == 0 && filename && tempname)
|
||||
rv = histfile_restore (tempname, filename);
|
||||
|
||||
if (rv != 0)
|
||||
{
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
history_lines_written_to_file = 0;
|
||||
}
|
||||
|
||||
/* Make sure the new filename is owned by the same user as the old. If one
|
||||
user is running this, it's a no-op. If the shell is running after sudo
|
||||
with a shared history file, we don't want to leave the history file
|
||||
owned by root. */
|
||||
if (rv == 0 && exists)
|
||||
chown (filename, finfo.st_uid, finfo.st_gid);
|
||||
|
||||
xfree (filename);
|
||||
FREE (tempname);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Workhorse function for writing history. Writes the last NELEMENT entries
|
||||
/* Workhorse function for writing history. Writes NELEMENT entries
|
||||
from the history list to FILENAME. OVERWRITE is non-zero if you
|
||||
wish to replace FILENAME with the entries. */
|
||||
static int
|
||||
|
@ -600,32 +430,23 @@ history_do_write (filename, nelements, overwrite)
|
|||
int nelements, overwrite;
|
||||
{
|
||||
register int i;
|
||||
char *output, *tempname, *histname;
|
||||
int file, mode, rv, exists;
|
||||
struct stat finfo;
|
||||
char *output;
|
||||
int file, mode, rv;
|
||||
#ifdef HISTORY_USE_MMAP
|
||||
size_t cursize;
|
||||
|
||||
history_lines_written_to_file = 0;
|
||||
|
||||
mode = overwrite ? O_RDWR|O_CREAT|O_TRUNC|O_BINARY : O_RDWR|O_APPEND|O_BINARY;
|
||||
#else
|
||||
mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
|
||||
#endif
|
||||
histname = history_filename (filename);
|
||||
tempname = (overwrite && histname) ? history_tempfile (histname) : 0;
|
||||
output = tempname ? tempname : histname;
|
||||
exists = histname ? (stat (histname, &finfo) == 0) : 0;
|
||||
|
||||
output = history_filename (filename);
|
||||
file = output ? open (output, mode, 0600) : -1;
|
||||
rv = 0;
|
||||
|
||||
if (file == -1)
|
||||
{
|
||||
rv = errno;
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
return (rv);
|
||||
FREE (output);
|
||||
return (errno);
|
||||
}
|
||||
|
||||
#ifdef HISTORY_USE_MMAP
|
||||
|
@ -665,11 +486,8 @@ history_do_write (filename, nelements, overwrite)
|
|||
{
|
||||
mmap_error:
|
||||
rv = errno;
|
||||
FREE (output);
|
||||
close (file);
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
return rv;
|
||||
}
|
||||
#else
|
||||
|
@ -677,11 +495,8 @@ mmap_error:
|
|||
if (buffer == 0)
|
||||
{
|
||||
rv = errno;
|
||||
FREE (output);
|
||||
close (file);
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
@ -700,7 +515,7 @@ mmap_error:
|
|||
}
|
||||
|
||||
#ifdef HISTORY_USE_MMAP
|
||||
if (msync (buffer, buffer_size, MS_ASYNC) != 0 || munmap (buffer, buffer_size) != 0)
|
||||
if (msync (buffer, buffer_size, 0) != 0 || munmap (buffer, buffer_size) != 0)
|
||||
rv = errno;
|
||||
#else
|
||||
if (write (file, buffer, buffer_size) < 0)
|
||||
|
@ -709,30 +524,9 @@ mmap_error:
|
|||
#endif
|
||||
}
|
||||
|
||||
history_lines_written_to_file = nelements;
|
||||
close (file);
|
||||
|
||||
if (close (file) < 0 && rv == 0)
|
||||
rv = errno;
|
||||
|
||||
if (rv == 0 && histname && tempname)
|
||||
rv = histfile_restore (tempname, histname);
|
||||
|
||||
if (rv != 0)
|
||||
{
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
history_lines_written_to_file = 0;
|
||||
}
|
||||
|
||||
/* Make sure the new filename is owned by the same user as the old. If one
|
||||
user is running this, it's a no-op. If the shell is running after sudo
|
||||
with a shared history file, we don't want to leave the history file
|
||||
owned by root. */
|
||||
if (rv == 0 && exists)
|
||||
chown (histname, finfo.st_uid, finfo.st_gid);
|
||||
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
FREE (output);
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* history.c -- standalone history library */
|
||||
|
||||
/* Copyright (C) 1989-2011 Free Software Foundation, Inc.
|
||||
/* 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.
|
||||
|
@ -48,9 +48,6 @@
|
|||
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* How big to make the_history when we first allocate it. */
|
||||
#define DEFAULT_HISTORY_INITIAL_SIZE 502
|
||||
|
||||
/* The number of slots to increase the_history by. */
|
||||
#define DEFAULT_HISTORY_GROW_SIZE 50
|
||||
|
||||
|
@ -239,7 +236,7 @@ history_get_time (hist)
|
|||
ts = hist->timestamp;
|
||||
if (ts[0] != history_comment_char)
|
||||
return 0;
|
||||
t = (time_t) strtol (ts + 1, (char **)NULL, 10); /* XXX - should use strtol() here */
|
||||
t = (time_t) atol (ts + 1); /* XXX - should use strtol() here */
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -282,14 +279,9 @@ add_history (string)
|
|||
if (the_history[0])
|
||||
(void) free_history_entry (the_history[0]);
|
||||
|
||||
/* Copy the rest of the entries, moving down one slot. Copy includes
|
||||
trailing NULL. */
|
||||
#if 0
|
||||
/* Copy the rest of the entries, moving down one slot. */
|
||||
for (i = 0; i < history_length; i++)
|
||||
the_history[i] = the_history[i + 1];
|
||||
#else
|
||||
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
|
||||
#endif
|
||||
|
||||
history_base++;
|
||||
}
|
||||
|
@ -297,10 +289,7 @@ add_history (string)
|
|||
{
|
||||
if (history_size == 0)
|
||||
{
|
||||
if (history_stifled && history_max_entries > 0)
|
||||
history_size = history_max_entries + 2;
|
||||
else
|
||||
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
|
||||
history_size = DEFAULT_HISTORY_GROW_SIZE;
|
||||
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
|
||||
history_length = 1;
|
||||
}
|
||||
|
@ -329,7 +318,7 @@ add_history_time (string)
|
|||
{
|
||||
HIST_ENTRY *hs;
|
||||
|
||||
if (string == 0 || history_length < 1)
|
||||
if (string == 0)
|
||||
return;
|
||||
hs = the_history[history_length - 1];
|
||||
FREE (hs->timestamp);
|
||||
|
@ -405,7 +394,7 @@ replace_history_entry (which, line, data)
|
|||
WHICH >= 0 means to replace that particular history entry's data, as
|
||||
long as it matches OLD. */
|
||||
void
|
||||
replace_history_data (which, old, new)
|
||||
replace_history_data (which,old, new)
|
||||
int which;
|
||||
histdata_t *old, *new;
|
||||
{
|
||||
|
|
|
@ -216,7 +216,7 @@ extern int history_truncate_file PARAMS((const char *, int));
|
|||
-1) If there was an error in expansion.
|
||||
2) If the returned line should just be printed.
|
||||
|
||||
If an error occurred in expansion, then OUTPUT contains a descriptive
|
||||
If an error ocurred in expansion, then OUTPUT contains a descriptive
|
||||
error message. */
|
||||
extern int history_expand PARAMS((char *, char **));
|
||||
|
||||
|
@ -241,10 +241,6 @@ extern char **history_tokenize PARAMS((const char *));
|
|||
extern int history_base;
|
||||
extern int history_length;
|
||||
extern int history_max_entries;
|
||||
|
||||
extern int history_lines_read_from_file;
|
||||
extern int history_lines_written_to_file;
|
||||
|
||||
extern char history_expansion_char;
|
||||
extern char history_subst_char;
|
||||
extern char *history_word_delimiters;
|
||||
|
|
110
readline/input.c
110
readline/input.c
|
@ -1,6 +1,6 @@
|
|||
/* input.c -- character input functions for readline. */
|
||||
|
||||
/* Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1994-2010 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.
|
||||
|
@ -45,8 +45,6 @@
|
|||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include "posixselect.h"
|
||||
|
||||
#if defined (FIONREAD_IN_SYS_IOCTL)
|
||||
|
@ -80,13 +78,6 @@ extern int errno;
|
|||
character input. */
|
||||
rl_hook_func_t *rl_event_hook = (rl_hook_func_t *)NULL;
|
||||
|
||||
/* A function to call if a read(2) is interrupted by a signal. */
|
||||
rl_hook_func_t *rl_signal_event_hook = (rl_hook_func_t *)NULL;
|
||||
|
||||
/* A function to replace _rl_input_available for applications using the
|
||||
callback interface. */
|
||||
rl_hook_func_t *rl_input_available_hook = (rl_hook_func_t *)NULL;
|
||||
|
||||
rl_getc_func_t *rl_getc_function = rl_getc;
|
||||
|
||||
static int _keyboard_input_timeout = 100000; /* 0.1 seconds; it's in usec */
|
||||
|
@ -95,22 +86,6 @@ static int ibuffer_space PARAMS((void));
|
|||
static int rl_get_char PARAMS((int *));
|
||||
static int rl_gather_tyi PARAMS((void));
|
||||
|
||||
/* Windows isatty returns true for every character device, including the null
|
||||
device, so we need to perform additional checks. */
|
||||
#if defined (_WIN32) && !defined (__CYGWIN__)
|
||||
#include <io.h>
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
|
||||
int
|
||||
win32_isatty (int fd)
|
||||
{
|
||||
return (_isatty (fd) ? ((((long) (HANDLE) _get_osfhandle (fd)) & 3) == 3) : 0);
|
||||
}
|
||||
|
||||
#define isatty(x) win32_isatty(x)
|
||||
#endif
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Character Input Buffering */
|
||||
|
@ -129,12 +104,6 @@ _rl_any_typein ()
|
|||
return any_typein;
|
||||
}
|
||||
|
||||
int
|
||||
_rl_pushed_input_available ()
|
||||
{
|
||||
return (push_index != pop_index);
|
||||
}
|
||||
|
||||
/* Return the amount of space available in the buffer for stuffing
|
||||
characters. */
|
||||
static int
|
||||
|
@ -148,7 +117,7 @@ ibuffer_space ()
|
|||
|
||||
/* Get a key from the buffer of characters to be read.
|
||||
Return the key in KEY.
|
||||
Result is non-zero if there was a key, or 0 if there wasn't. */
|
||||
Result is KEY if there was a key, or 0 if there wasn't. */
|
||||
static int
|
||||
rl_get_char (key)
|
||||
int *key;
|
||||
|
@ -185,6 +154,12 @@ _rl_unget_char (key)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
_rl_pushed_input_available ()
|
||||
{
|
||||
return (push_index != pop_index);
|
||||
}
|
||||
|
||||
/* If a character is available to be read, then read it and stuff it into
|
||||
IBUFFER. Otherwise, just return. Returns number of characters read
|
||||
(0 if none available) and -1 on error (EIO). */
|
||||
|
@ -201,7 +176,6 @@ rl_gather_tyi ()
|
|||
#endif
|
||||
|
||||
chars_avail = 0;
|
||||
input = 0;
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
#if defined (HAVE_SELECT)
|
||||
|
@ -221,8 +195,6 @@ rl_gather_tyi ()
|
|||
result = ioctl (tty, FIONREAD, &chars_avail);
|
||||
if (result == -1 && errno == EIO)
|
||||
return -1;
|
||||
if (result == -1)
|
||||
chars_avail = 0;
|
||||
#endif
|
||||
|
||||
#if defined (O_NDELAY)
|
||||
|
@ -319,9 +291,6 @@ _rl_input_available ()
|
|||
#endif
|
||||
int tty;
|
||||
|
||||
if (rl_input_available_hook)
|
||||
return (*rl_input_available_hook) ();
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
#if defined (HAVE_SELECT)
|
||||
|
@ -440,7 +409,9 @@ rl_clear_pending_input ()
|
|||
int
|
||||
rl_read_key ()
|
||||
{
|
||||
int c, r;
|
||||
int c;
|
||||
|
||||
rl_key_sequence_length++;
|
||||
|
||||
if (rl_pending_input)
|
||||
{
|
||||
|
@ -458,18 +429,14 @@ rl_read_key ()
|
|||
{
|
||||
while (rl_event_hook)
|
||||
{
|
||||
if (rl_get_char (&c) != 0)
|
||||
break;
|
||||
|
||||
if ((r = rl_gather_tyi ()) < 0) /* XXX - EIO */
|
||||
if (rl_gather_tyi () < 0) /* XXX - EIO */
|
||||
{
|
||||
rl_done = 1;
|
||||
return ('\n');
|
||||
}
|
||||
else if (r > 0) /* read something */
|
||||
continue;
|
||||
|
||||
RL_CHECK_SIGNALS ();
|
||||
if (rl_get_char (&c) != 0)
|
||||
break;
|
||||
if (rl_done) /* XXX - experimental */
|
||||
return ('\n');
|
||||
(*rl_event_hook) ();
|
||||
|
@ -479,7 +446,6 @@ rl_read_key ()
|
|||
{
|
||||
if (rl_get_char (&c) == 0)
|
||||
c = (*rl_getc_function) (rl_instream);
|
||||
/* fprintf(stderr, "rl_read_key: calling RL_CHECK_SIGNALS: _rl_caught_signal = %d", _rl_caught_signal); */
|
||||
RL_CHECK_SIGNALS ();
|
||||
}
|
||||
}
|
||||
|
@ -493,30 +459,16 @@ rl_getc (stream)
|
|||
{
|
||||
int result;
|
||||
unsigned char c;
|
||||
#if defined (HAVE_PSELECT)
|
||||
sigset_t empty_set;
|
||||
fd_set readfds;
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
RL_CHECK_SIGNALS ();
|
||||
|
||||
/* We know at this point that _rl_caught_signal == 0 */
|
||||
|
||||
#if defined (__MINGW32__)
|
||||
if (isatty (fileno (stream)))
|
||||
return (_getch ()); /* "There is no error return." */
|
||||
return (getch ());
|
||||
#endif
|
||||
result = 0;
|
||||
#if defined (HAVE_PSELECT)
|
||||
sigemptyset (&empty_set);
|
||||
FD_ZERO (&readfds);
|
||||
FD_SET (fileno (stream), &readfds);
|
||||
result = pselect (fileno (stream) + 1, &readfds, NULL, NULL, NULL, &empty_set);
|
||||
#endif
|
||||
if (result >= 0)
|
||||
result = read (fileno (stream), &c, sizeof (unsigned char));
|
||||
result = read (fileno (stream), &c, sizeof (unsigned char));
|
||||
|
||||
if (result == sizeof (unsigned char))
|
||||
return (c);
|
||||
|
@ -553,35 +505,11 @@ rl_getc (stream)
|
|||
#undef X_EWOULDBLOCK
|
||||
#undef X_EAGAIN
|
||||
|
||||
/* fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); */
|
||||
|
||||
handle_error:
|
||||
/* If the error that we received was EINTR, then try again,
|
||||
this is simply an interrupted system call to read (). We allow
|
||||
the read to be interrupted if we caught SIGHUP, SIGTERM, or any
|
||||
of the other signals readline treats specially. If the
|
||||
application sets an event hook, call it for other signals.
|
||||
Otherwise (not EINTR), some error occurred, also signifying EOF. */
|
||||
/* If the error that we received was SIGINT, then try again,
|
||||
this is simply an interrupted system call to read ().
|
||||
Otherwise, some error ocurred, also signifying EOF. */
|
||||
if (errno != EINTR)
|
||||
return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
|
||||
/* fatal signals of interest */
|
||||
else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM)
|
||||
return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
|
||||
/* keyboard-generated signals of interest */
|
||||
else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT)
|
||||
RL_CHECK_SIGNALS ();
|
||||
/* non-keyboard-generated signals of interest */
|
||||
else if (_rl_caught_signal == SIGWINCH)
|
||||
RL_CHECK_SIGNALS ();
|
||||
else if (_rl_caught_signal == SIGALRM
|
||||
#if defined (SIGVTALRM)
|
||||
|| _rl_caught_signal == SIGVTALRM
|
||||
#endif
|
||||
)
|
||||
RL_CHECK_SIGNALS ();
|
||||
|
||||
if (rl_signal_event_hook)
|
||||
(*rl_signal_event_hook) ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
/* 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.
|
||||
|
@ -66,6 +66,7 @@ static int rl_search_history PARAMS((int, int));
|
|||
|
||||
static _rl_search_cxt *_rl_isearch_init PARAMS((int));
|
||||
static void _rl_isearch_fini PARAMS((_rl_search_cxt *));
|
||||
static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
|
||||
|
||||
/* Last line found by the current incremental search, so we don't `find'
|
||||
identical lines many times in a row. Now part of isearch context. */
|
||||
|
@ -109,7 +110,7 @@ _rl_scxt_alloc (type, flags)
|
|||
cxt->history_pos = 0;
|
||||
cxt->direction = 0;
|
||||
|
||||
cxt->prevc = cxt->lastc = 0;
|
||||
cxt->lastc = 0;
|
||||
|
||||
cxt->sline = 0;
|
||||
cxt->sline_len = cxt->sline_index = 0;
|
||||
|
@ -155,16 +156,16 @@ rl_forward_search_history (sign, key)
|
|||
WHERE is the history list number of the current line. If it is
|
||||
-1, then this line is the starting one. */
|
||||
static void
|
||||
rl_display_search (search_string, flags, where)
|
||||
rl_display_search (search_string, reverse_p, where)
|
||||
char *search_string;
|
||||
int flags, where;
|
||||
int reverse_p, where;
|
||||
{
|
||||
char *message;
|
||||
int msglen, searchlen;
|
||||
|
||||
searchlen = (search_string && *search_string) ? strlen (search_string) : 0;
|
||||
|
||||
message = (char *)xmalloc (searchlen + 64);
|
||||
message = (char *)xmalloc (searchlen + 33);
|
||||
msglen = 0;
|
||||
|
||||
#if defined (NOTDEF)
|
||||
|
@ -177,13 +178,7 @@ rl_display_search (search_string, flags, where)
|
|||
|
||||
message[msglen++] = '(';
|
||||
|
||||
if (flags & SF_FAILED)
|
||||
{
|
||||
strcpy (message + msglen, "failed ");
|
||||
msglen += 7;
|
||||
}
|
||||
|
||||
if (flags & SF_REVERSE)
|
||||
if (reverse_p)
|
||||
{
|
||||
strcpy (message + msglen, "reverse-");
|
||||
msglen += 8;
|
||||
|
@ -220,7 +215,7 @@ _rl_isearch_init (direction)
|
|||
cxt->search_terminators = _rl_isearch_terminators ? _rl_isearch_terminators
|
||||
: default_isearch_terminators;
|
||||
|
||||
/* Create an array of pointers to the lines that we want to search. */
|
||||
/* Create an arrary of pointers to the lines that we want to search. */
|
||||
hlist = history_list ();
|
||||
rl_maybe_replace_line ();
|
||||
i = 0;
|
||||
|
@ -317,19 +312,13 @@ _rl_search_getchar (cxt)
|
|||
RL_UNSETSTATE(RL_STATE_MOREINPUT);
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* This ends up with C (and LASTC) being set to the last byte of the
|
||||
multibyte character. In most cases c == lastc == mb[0] */
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
c = cxt->lastc = _rl_read_mbstring (cxt->lastc, cxt->mb, MB_LEN_MAX);
|
||||
#endif
|
||||
|
||||
RL_CHECK_SIGNALS ();
|
||||
return c;
|
||||
}
|
||||
|
||||
#define ENDSRCH_CHAR(c) \
|
||||
((CTRL_CHAR (c) || META_CHAR (c) || (c) == RUBOUT) && ((c) != CTRL ('G')))
|
||||
|
||||
/* Process just-read character C according to isearch context CXT. Return
|
||||
-1 if the caller should just free the context and return, 0 if we should
|
||||
break out of the loop, and 1 if we should continue to read characters. */
|
||||
|
@ -355,43 +344,13 @@ _rl_isearch_dispatch (cxt, c)
|
|||
incremental search, so we check */
|
||||
if (c >= 0 && cxt->keymap[c].type == ISKMAP && strchr (cxt->search_terminators, cxt->lastc) == 0)
|
||||
{
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
|
||||
takes microseconds, so multiply by 1000. If we don't get any
|
||||
additional input and this keymap shadows another function, process
|
||||
that key as if it was all we read. */
|
||||
if (_rl_keyseq_timeout > 0 &&
|
||||
RL_ISSTATE (RL_STATE_CALLBACK) == 0 &&
|
||||
RL_ISSTATE (RL_STATE_INPUTPENDING) == 0 &&
|
||||
_rl_pushed_input_available () == 0 &&
|
||||
((Keymap)(cxt->keymap[c].function))[ANYOTHERKEY].function &&
|
||||
_rl_input_queued (_rl_keyseq_timeout*1000) == 0)
|
||||
goto add_character;
|
||||
|
||||
cxt->okeymap = cxt->keymap;
|
||||
cxt->keymap = FUNCTION_TO_KEYMAP (cxt->keymap, c);
|
||||
cxt->sflags |= SF_CHGKMAP;
|
||||
/* XXX - we should probably save this sequence, so we can do
|
||||
something useful if this doesn't end up mapping to a command we
|
||||
interpret here. Right now we just save the most recent character
|
||||
that caused the index into a new keymap. */
|
||||
cxt->prevc = c;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
if (cxt->mb[1] == 0)
|
||||
{
|
||||
cxt->pmb[0] = c; /* XXX should be == cxt->mb[0] */
|
||||
cxt->pmb[1] = '\0';
|
||||
}
|
||||
else
|
||||
memcpy (cxt->pmb, cxt->mb, sizeof (cxt->pmb));
|
||||
}
|
||||
#endif
|
||||
something useful if this doesn't end up mapping to a command. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
add_character:
|
||||
|
||||
/* Translate the keys we do something with to opcodes. */
|
||||
if (c >= 0 && cxt->keymap[c].type == ISFUNC)
|
||||
{
|
||||
|
@ -417,54 +376,6 @@ add_character:
|
|||
{
|
||||
cxt->keymap = cxt->okeymap;
|
||||
cxt->sflags &= ~SF_CHGKMAP;
|
||||
/* If we indexed into a new keymap, but didn't map to a command that
|
||||
affects the search (lastc > 0), and the character that mapped to a
|
||||
new keymap would have ended the search (ENDSRCH_CHAR(cxt->prevc)),
|
||||
handle that now as if the previous char would have ended the search
|
||||
and we would have read the current character. */
|
||||
/* XXX - should we check cxt->mb? */
|
||||
if (cxt->lastc > 0 && ENDSRCH_CHAR (cxt->prevc))
|
||||
{
|
||||
rl_stuff_char (cxt->lastc);
|
||||
rl_execute_next (cxt->prevc);
|
||||
/* XXX - do we insert everything in cxt->pmb? */
|
||||
return (0);
|
||||
}
|
||||
/* Otherwise, if the current character is mapped to self-insert or
|
||||
nothing (i.e., not an editing command), and the previous character
|
||||
was a keymap index, then we need to insert both the previous
|
||||
character and the current character into the search string. */
|
||||
else if (cxt->lastc > 0 && cxt->prevc > 0 &&
|
||||
cxt->keymap[cxt->prevc].type == ISKMAP &&
|
||||
(f == 0 || f == rl_insert))
|
||||
{
|
||||
/* Make lastc be the next character read */
|
||||
/* XXX - do we insert everything in cxt->mb? */
|
||||
rl_execute_next (cxt->lastc);
|
||||
/* Dispatch on the previous character (insert into search string) */
|
||||
cxt->lastc = cxt->prevc;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* Have to overwrite cxt->mb here because dispatch uses it below */
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
if (cxt->pmb[1] == 0)
|
||||
{
|
||||
cxt->mb[0] = cxt->lastc; /* == cxt->prevc */
|
||||
cxt->mb[1] = '\0';
|
||||
}
|
||||
else
|
||||
memcpy (cxt->mb, cxt->pmb, sizeof (cxt->mb));
|
||||
}
|
||||
#endif
|
||||
cxt->prevc = 0;
|
||||
}
|
||||
else if (cxt->lastc > 0 && cxt->prevc > 0 && f && f != rl_insert)
|
||||
{
|
||||
rl_stuff_char (cxt->lastc);
|
||||
rl_execute_next (cxt->prevc);
|
||||
/* XXX - do we insert everything in cxt->pmb? */
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
/* The characters in isearch_terminators (set from the user-settable
|
||||
|
@ -482,11 +393,14 @@ add_character:
|
|||
XXX - since _rl_input_available depends on the application-
|
||||
settable keyboard timeout value, this could alternatively
|
||||
use _rl_input_queued(100000) */
|
||||
if (cxt->lastc == ESC && (_rl_pushed_input_available () || _rl_input_available ()))
|
||||
if (cxt->lastc == ESC && _rl_input_available ())
|
||||
rl_execute_next (ESC);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define ENDSRCH_CHAR(c) \
|
||||
((CTRL_CHAR (c) || META_CHAR (c) || (c) == RUBOUT) && ((c) != CTRL ('G')))
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
|
@ -522,7 +436,7 @@ add_character:
|
|||
cxt->search_string = (char *)xrealloc (cxt->search_string, cxt->search_string_size);
|
||||
strcpy (cxt->search_string, last_isearch_string);
|
||||
cxt->search_string_index = last_isearch_string_len;
|
||||
rl_display_search (cxt->search_string, cxt->sflags, -1);
|
||||
rl_display_search (cxt->search_string, (cxt->sflags & SF_REVERSE), -1);
|
||||
break;
|
||||
}
|
||||
return (1);
|
||||
|
@ -552,16 +466,8 @@ add_character:
|
|||
do until we have a real isearch-undo. */
|
||||
if (cxt->search_string_index == 0)
|
||||
rl_ding ();
|
||||
else if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||
cxt->search_string[--cxt->search_string_index] = '\0';
|
||||
else
|
||||
{
|
||||
wstart = _rl_find_prev_mbchar (cxt->search_string, cxt->search_string_index, MB_FIND_NONZERO);
|
||||
if (wstart >= 0)
|
||||
cxt->search_string[cxt->search_string_index = wstart] = '\0';
|
||||
else
|
||||
rl_ding ();
|
||||
}
|
||||
cxt->search_string[--cxt->search_string_index] = '\0';
|
||||
break;
|
||||
|
||||
case -4: /* C-G, abort */
|
||||
|
@ -638,16 +544,12 @@ add_character:
|
|||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
int j, l;
|
||||
|
||||
if (cxt->mb[0] == 0 || cxt->mb[1] == 0)
|
||||
cxt->search_string[cxt->search_string_index++] = cxt->mb[0];
|
||||
else
|
||||
for (j = 0, l = RL_STRLEN (cxt->mb); j < l; )
|
||||
cxt->search_string[cxt->search_string_index++] = cxt->mb[j++];
|
||||
for (j = 0, l = strlen (cxt->mb); j < l; )
|
||||
cxt->search_string[cxt->search_string_index++] = cxt->mb[j++];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
cxt->search_string[cxt->search_string_index++] = cxt->lastc; /* XXX - was c instead of lastc */
|
||||
cxt->search_string[cxt->search_string_index++] = c;
|
||||
cxt->search_string[cxt->search_string_index] = '\0';
|
||||
break;
|
||||
}
|
||||
|
@ -704,7 +606,6 @@ add_character:
|
|||
/* We cannot find the search string. Ding the bell. */
|
||||
rl_ding ();
|
||||
cxt->history_pos = cxt->last_found_line;
|
||||
rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -717,13 +618,13 @@ add_character:
|
|||
rl_replace_line (cxt->lines[cxt->history_pos], 0);
|
||||
rl_point = cxt->sline_index;
|
||||
cxt->last_found_line = cxt->history_pos;
|
||||
rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos);
|
||||
rl_display_search (cxt->search_string, (cxt->sflags & SF_REVERSE), (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
_rl_isearch_cleanup (cxt, r)
|
||||
_rl_search_cxt *cxt;
|
||||
int r;
|
||||
|
@ -752,7 +653,7 @@ rl_search_history (direction, invoking_key)
|
|||
RL_SETSTATE(RL_STATE_ISEARCH);
|
||||
cxt = _rl_isearch_init (direction);
|
||||
|
||||
rl_display_search (cxt->search_string, cxt->sflags, -1);
|
||||
rl_display_search (cxt->search_string, (cxt->sflags & SF_REVERSE), -1);
|
||||
|
||||
/* If we are using the callback interface, all we do is set up here and
|
||||
return. The key is that we leave RL_STATE_ISEARCH set. */
|
||||
|
|
102
readline/kill.c
102
readline/kill.c
|
@ -278,7 +278,7 @@ rl_backward_kill_line (direction, ignore)
|
|||
return (rl_kill_line (1, ignore));
|
||||
else
|
||||
{
|
||||
if (rl_point == 0)
|
||||
if (!rl_point)
|
||||
rl_ding ();
|
||||
else
|
||||
{
|
||||
|
@ -506,7 +506,7 @@ rl_yank (count, ignore)
|
|||
if (rl_kill_ring == 0)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
_rl_set_mark_at_pos (rl_point);
|
||||
|
@ -528,7 +528,7 @@ rl_yank_pop (count, key)
|
|||
!rl_kill_ring)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
l = strlen (rl_kill_ring[rl_kill_index]);
|
||||
|
@ -546,44 +546,10 @@ rl_yank_pop (count, key)
|
|||
else
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (VI_MODE)
|
||||
int
|
||||
rl_vi_yank_pop (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int l, n;
|
||||
|
||||
if (((rl_last_func != rl_vi_yank_pop) && (rl_last_func != rl_vi_put)) ||
|
||||
!rl_kill_ring)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
l = strlen (rl_kill_ring[rl_kill_index]);
|
||||
n = rl_point - l;
|
||||
if (n >= 0 && STREQN (rl_line_buffer + n, rl_kill_ring[rl_kill_index], l))
|
||||
{
|
||||
rl_delete_text (n, rl_point);
|
||||
rl_point = n;
|
||||
rl_kill_index--;
|
||||
if (rl_kill_index < 0)
|
||||
rl_kill_index = rl_kill_ring_length - 1;
|
||||
rl_vi_put (1, 'p');
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif /* VI_MODE */
|
||||
|
||||
/* Yank the COUNTh argument from the previous history line, skipping
|
||||
HISTORY_SKIP lines before looking for the `previous line'. */
|
||||
static int
|
||||
|
@ -609,7 +575,7 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
|
|||
if (entry == 0)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
arg = history_arg_extract (count, count, entry->line);
|
||||
|
@ -617,7 +583,7 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
|
|||
{
|
||||
rl_ding ();
|
||||
FREE (arg);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rl_begin_undo_group ();
|
||||
|
@ -690,58 +656,8 @@ rl_yank_last_arg (count, key)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/* Having read the special escape sequence denoting the beginning of a
|
||||
`bracketed paste' sequence, read the rest of the pasted input until the
|
||||
closing sequence and insert the pasted text as a single unit without
|
||||
interpretation. */
|
||||
int
|
||||
rl_bracketed_paste_begin (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int retval, c;
|
||||
size_t len, cap;
|
||||
char *buf;
|
||||
|
||||
retval = 1;
|
||||
len = 0;
|
||||
buf = xmalloc (cap = 64);
|
||||
|
||||
RL_SETSTATE (RL_STATE_MOREINPUT);
|
||||
while ((c = rl_read_key ()) >= 0)
|
||||
{
|
||||
if (RL_ISSTATE (RL_STATE_MACRODEF))
|
||||
_rl_add_macro_char (c);
|
||||
|
||||
if (c == '\r') /* XXX */
|
||||
c = '\n';
|
||||
|
||||
if (len == cap)
|
||||
buf = xrealloc (buf, cap *= 2);
|
||||
|
||||
buf[len++] = c;
|
||||
if (len >= BRACK_PASTE_SLEN && c == BRACK_PASTE_LAST &&
|
||||
STREQN (buf + len - BRACK_PASTE_SLEN, BRACK_PASTE_SUFF, BRACK_PASTE_SLEN))
|
||||
{
|
||||
len -= BRACK_PASTE_SLEN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RL_UNSETSTATE (RL_STATE_MOREINPUT);
|
||||
|
||||
if (c >= 0)
|
||||
{
|
||||
if (len == cap)
|
||||
buf = xrealloc (buf, cap + 1);
|
||||
buf[len] = '\0';
|
||||
retval = rl_insert_text (buf);
|
||||
}
|
||||
|
||||
xfree (buf);
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/* A special paste command for Windows users.. */
|
||||
#if defined (_WIN32)
|
||||
/* A special paste command for users of Cygnus's cygwin32. */
|
||||
#if defined (__CYGWIN__)
|
||||
#include <windows.h>
|
||||
|
||||
int
|
||||
|
@ -775,4 +691,4 @@ rl_paste_from_clipboard (count, key)
|
|||
}
|
||||
return (0);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
#endif /* __CYGWIN__ */
|
||||
|
|
|
@ -121,19 +121,6 @@ _rl_next_macro_key ()
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
_rl_prev_macro_key ()
|
||||
{
|
||||
if (rl_executing_macro == 0)
|
||||
return (0);
|
||||
|
||||
if (executing_macro_index == 0)
|
||||
return (0);
|
||||
|
||||
executing_macro_index--;
|
||||
return (rl_executing_macro[executing_macro_index]);
|
||||
}
|
||||
|
||||
/* Save the currently executing macro on a stack of saved macros. */
|
||||
void
|
||||
_rl_push_executing_macro ()
|
||||
|
@ -219,7 +206,7 @@ rl_start_kbd_macro (ignore1, ignore2)
|
|||
if (RL_ISSTATE (RL_STATE_MACRODEF))
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rl_explicit_arg)
|
||||
|
@ -244,10 +231,10 @@ rl_end_kbd_macro (count, ignore)
|
|||
if (RL_ISSTATE (RL_STATE_MACRODEF) == 0)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
current_macro_index -= rl_key_sequence_length;
|
||||
current_macro_index -= rl_key_sequence_length - 1;
|
||||
current_macro[current_macro_index] = '\0';
|
||||
|
||||
RL_UNSETSTATE(RL_STATE_MACRODEF);
|
||||
|
@ -276,29 +263,6 @@ rl_call_last_kbd_macro (count, ignore)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_print_last_kbd_macro (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
char *m;
|
||||
|
||||
if (current_macro == 0)
|
||||
{
|
||||
rl_ding ();
|
||||
return 0;
|
||||
}
|
||||
m = _rl_untranslate_macro_value (current_macro, 1);
|
||||
rl_crlf ();
|
||||
printf ("%s", m);
|
||||
fflush (stdout);
|
||||
rl_crlf ();
|
||||
FREE (m);
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
rl_push_macro_input (macro)
|
||||
char *macro;
|
||||
|
|
|
@ -64,9 +64,6 @@ int rl_byte_oriented = 0;
|
|||
int rl_byte_oriented = 1;
|
||||
#endif
|
||||
|
||||
/* Ditto */
|
||||
int _rl_utf8locale = 0;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Multibyte Character Utility Functions */
|
||||
|
@ -122,7 +119,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
|
|||
point += tmp;
|
||||
if (find_non_zero)
|
||||
{
|
||||
if (WCWIDTH (wc) == 0)
|
||||
if (wcwidth (wc) == 0)
|
||||
continue;
|
||||
else
|
||||
count--;
|
||||
|
@ -135,7 +132,7 @@ _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 (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (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);
|
||||
|
@ -187,7 +184,7 @@ _rl_find_prev_mbchar_internal (string, seed, find_non_zero)
|
|||
{
|
||||
if (find_non_zero)
|
||||
{
|
||||
if (WCWIDTH (wc) != 0)
|
||||
if (wcwidth (wc) != 0)
|
||||
prev = point;
|
||||
}
|
||||
else
|
||||
|
@ -266,7 +263,7 @@ _rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
|
|||
if point is invalied (point < 0 || more than string length),
|
||||
it returns -1 */
|
||||
int
|
||||
_rl_adjust_point (string, point, ps)
|
||||
_rl_adjust_point(string, point, ps)
|
||||
char *string;
|
||||
int point;
|
||||
mbstate_t *ps;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* misc.c -- miscellaneous bindable readline functions. */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
/* 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.
|
||||
|
@ -56,8 +56,6 @@
|
|||
static int rl_digit_loop PARAMS((void));
|
||||
static void _rl_history_set_point PARAMS((void));
|
||||
|
||||
extern int history_offset;
|
||||
|
||||
/* Forward declarations used in this file */
|
||||
void _rl_free_history_entry PARAMS((HIST_ENTRY *));
|
||||
|
||||
|
@ -461,7 +459,6 @@ _rl_revert_all_lines ()
|
|||
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 */
|
||||
entry->data = 0; /* entry->data is now current undo list */
|
||||
/* Undo all changes to this history entry */
|
||||
while (rl_undo_list)
|
||||
rl_do_undo ();
|
||||
|
@ -469,6 +466,7 @@ _rl_revert_all_lines ()
|
|||
the timestamp. */
|
||||
FREE (entry->line);
|
||||
entry->line = savestring (rl_line_buffer);
|
||||
entry->data = 0;
|
||||
}
|
||||
entry = previous_history ();
|
||||
}
|
||||
|
@ -485,37 +483,6 @@ _rl_revert_all_lines ()
|
|||
xfree (lbuf);
|
||||
}
|
||||
|
||||
/* Free the history list, including private readline data and take care
|
||||
of pointer aliases to history data. Resets rl_undo_list if it points
|
||||
to an UNDO_LIST * saved as some history entry's data member. This
|
||||
should not be called while editing is active. */
|
||||
void
|
||||
rl_clear_history ()
|
||||
{
|
||||
HIST_ENTRY **hlist, *hent;
|
||||
register int i;
|
||||
UNDO_LIST *ul, *saved_undo_list;
|
||||
|
||||
saved_undo_list = rl_undo_list;
|
||||
hlist = history_list (); /* direct pointer, not copy */
|
||||
|
||||
for (i = 0; i < history_length; i++)
|
||||
{
|
||||
hent = hlist[i];
|
||||
if (ul = (UNDO_LIST *)hent->data)
|
||||
{
|
||||
if (ul == saved_undo_list)
|
||||
saved_undo_list = 0;
|
||||
_rl_free_undo_list (ul);
|
||||
hent->data = 0;
|
||||
}
|
||||
_rl_free_history_entry (hent);
|
||||
}
|
||||
|
||||
history_offset = history_length = 0;
|
||||
rl_undo_list = saved_undo_list; /* should be NULL */
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* History Commands */
|
||||
|
@ -656,10 +623,6 @@ rl_emacs_editing_mode (count, key)
|
|||
rl_editing_mode = emacs_mode;
|
||||
_rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */
|
||||
_rl_keymap = emacs_standard_keymap;
|
||||
|
||||
if (_rl_show_mode_in_prompt)
|
||||
_rl_reset_prompt ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,6 @@
|
|||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_LANGINFO_CODESET)
|
||||
# include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "rldefs.h"
|
||||
|
@ -54,8 +50,6 @@
|
|||
#include "rlshell.h"
|
||||
#include "rlprivate.h"
|
||||
|
||||
static int utf8locale PARAMS((char *));
|
||||
|
||||
#if !defined (HAVE_SETLOCALE)
|
||||
/* A list of legal values for the LANG or LC_CTYPE environment variables.
|
||||
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
|
||||
|
@ -78,9 +72,8 @@ static char *legal_lang_values[] =
|
|||
};
|
||||
|
||||
static char *normalize_codeset PARAMS((char *));
|
||||
#endif /* !HAVE_SETLOCALE */
|
||||
|
||||
static char *find_codeset PARAMS((char *, size_t *));
|
||||
#endif /* !HAVE_SETLOCALE */
|
||||
|
||||
static char *_rl_get_locale_var PARAMS((const char *));
|
||||
|
||||
|
@ -98,26 +91,7 @@ _rl_get_locale_var (v)
|
|||
|
||||
return lspec;
|
||||
}
|
||||
|
||||
static int
|
||||
utf8locale (lspec)
|
||||
char *lspec;
|
||||
{
|
||||
char *cp;
|
||||
size_t len;
|
||||
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
cp = nl_langinfo (CODESET);
|
||||
return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8"));
|
||||
#else
|
||||
cp = find_codeset (lspec, &len);
|
||||
|
||||
if (cp == 0 || len < 4 || len > 5)
|
||||
return 0;
|
||||
return ((len == 5) ? strncmp (cp, "UTF-8", len) == 0 : strncmp (cp, "utf8", 4) == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
|
||||
to decide the defaults for 8-bit character input and output. Returns
|
||||
1 if we set eight-bit mode. */
|
||||
|
@ -142,9 +116,6 @@ _rl_init_eightbit ()
|
|||
lspec = "";
|
||||
t = setlocale (LC_CTYPE, lspec);
|
||||
|
||||
if (t && *t)
|
||||
_rl_utf8locale = utf8locale (t);
|
||||
|
||||
if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0))
|
||||
{
|
||||
_rl_meta_flag = 1;
|
||||
|
@ -226,7 +197,6 @@ normalize_codeset (codeset)
|
|||
|
||||
return retval;
|
||||
}
|
||||
#endif /* !HAVE_SETLOCALE */
|
||||
|
||||
/* Isolate codeset portion of locale specification. */
|
||||
static char *
|
||||
|
@ -279,3 +249,4 @@ find_codeset (name, lenp)
|
|||
|
||||
return result;
|
||||
}
|
||||
#endif /* !HAVE_SETLOCALE */
|
||||
|
|
|
@ -57,7 +57,11 @@ static int find_matching_open PARAMS((char *, int, int));
|
|||
|
||||
/* Non-zero means try to blink the matching open parenthesis when the
|
||||
close parenthesis is inserted. */
|
||||
#if defined (HAVE_SELECT)
|
||||
int rl_blink_matching_paren = 1;
|
||||
#else /* !HAVE_SELECT */
|
||||
int rl_blink_matching_paren = 0;
|
||||
#endif /* !HAVE_SELECT */
|
||||
|
||||
static int _paren_blink_usec = 500000;
|
||||
|
||||
|
@ -68,32 +72,16 @@ _rl_enable_paren_matching (on_or_off)
|
|||
int on_or_off;
|
||||
{
|
||||
if (on_or_off)
|
||||
{
|
||||
/* ([{ */
|
||||
{ /* ([{ */
|
||||
rl_bind_key_in_map (')', rl_insert_close, emacs_standard_keymap);
|
||||
rl_bind_key_in_map (']', rl_insert_close, emacs_standard_keymap);
|
||||
rl_bind_key_in_map ('}', rl_insert_close, emacs_standard_keymap);
|
||||
|
||||
#if defined (VI_MODE)
|
||||
/* ([{ */
|
||||
rl_bind_key_in_map (')', rl_insert_close, vi_insertion_keymap);
|
||||
rl_bind_key_in_map (']', rl_insert_close, vi_insertion_keymap);
|
||||
rl_bind_key_in_map ('}', rl_insert_close, vi_insertion_keymap);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ([{ */
|
||||
{ /* ([{ */
|
||||
rl_bind_key_in_map (')', rl_insert, emacs_standard_keymap);
|
||||
rl_bind_key_in_map (']', rl_insert, emacs_standard_keymap);
|
||||
rl_bind_key_in_map ('}', rl_insert, emacs_standard_keymap);
|
||||
|
||||
#if defined (VI_MODE)
|
||||
/* ([{ */
|
||||
rl_bind_key_in_map (')', rl_insert, vi_insertion_keymap);
|
||||
rl_bind_key_in_map (']', rl_insert, vi_insertion_keymap);
|
||||
rl_bind_key_in_map ('}', rl_insert, vi_insertion_keymap);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +117,7 @@ rl_insert_close (count, invoking_key)
|
|||
|
||||
/* Emacs might message or ring the bell here, but I don't. */
|
||||
if (match_point < 0)
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
FD_ZERO (&readfds);
|
||||
FD_SET (fileno (rl_instream), &readfds);
|
||||
|
|
|
@ -1,440 +0,0 @@
|
|||
/* `dir', `vdir' and `ls' directory listing programs for GNU.
|
||||
|
||||
Modified by Chet Ramey for Readline.
|
||||
|
||||
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Richard Stallman and David MacKenzie. */
|
||||
|
||||
/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis
|
||||
Flaherty <dennisf@denix.elk.miles.com> based on original patches by
|
||||
Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */
|
||||
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// strdup() / strcpy()
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
// abort()
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include "rldefs.h" // STREQ, savestring
|
||||
#include "readline.h"
|
||||
#include "rlprivate.h"
|
||||
#include "rlshell.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#include "colors.h"
|
||||
#include "parse-colors.h"
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
|
||||
static bool get_funky_string (char **dest, const char **src, bool equals_end, size_t *output_count);
|
||||
|
||||
struct bin_str _rl_color_indicator[] =
|
||||
{
|
||||
{ LEN_STR_PAIR ("\033[") }, // lc: Left of color sequence
|
||||
{ LEN_STR_PAIR ("m") }, // rc: Right of color sequence
|
||||
{ 0, NULL }, // ec: End color (replaces lc+no+rc)
|
||||
{ LEN_STR_PAIR ("0") }, // rs: Reset to ordinary colors
|
||||
{ 0, NULL }, // no: Normal
|
||||
{ 0, NULL }, // fi: File: default
|
||||
{ LEN_STR_PAIR ("01;34") }, // di: Directory: bright blue
|
||||
{ LEN_STR_PAIR ("01;36") }, // ln: Symlink: bright cyan
|
||||
{ LEN_STR_PAIR ("33") }, // pi: Pipe: yellow/brown
|
||||
{ LEN_STR_PAIR ("01;35") }, // so: Socket: bright magenta
|
||||
{ LEN_STR_PAIR ("01;33") }, // bd: Block device: bright yellow
|
||||
{ LEN_STR_PAIR ("01;33") }, // cd: Char device: bright yellow
|
||||
{ 0, NULL }, // mi: Missing file: undefined
|
||||
{ 0, NULL }, // or: Orphaned symlink: undefined
|
||||
{ LEN_STR_PAIR ("01;32") }, // ex: Executable: bright green
|
||||
{ LEN_STR_PAIR ("01;35") }, // do: Door: bright magenta
|
||||
{ LEN_STR_PAIR ("37;41") }, // su: setuid: white on red
|
||||
{ LEN_STR_PAIR ("30;43") }, // sg: setgid: black on yellow
|
||||
{ LEN_STR_PAIR ("37;44") }, // st: sticky: black on blue
|
||||
{ LEN_STR_PAIR ("34;42") }, // ow: other-writable: blue on green
|
||||
{ LEN_STR_PAIR ("30;42") }, // tw: ow w/ sticky: black on green
|
||||
{ LEN_STR_PAIR ("30;41") }, // ca: black on red
|
||||
{ 0, NULL }, // mh: disabled by default
|
||||
{ LEN_STR_PAIR ("\033[K") }, // cl: clear to end of line
|
||||
};
|
||||
|
||||
/* Parse a string as part of the LS_COLORS variable; this may involve
|
||||
decoding all kinds of escape characters. If equals_end is set an
|
||||
unescaped equal sign ends the string, otherwise only a : or \0
|
||||
does. Set *OUTPUT_COUNT to the number of bytes output. Return
|
||||
true if successful.
|
||||
|
||||
The resulting string is *not* null-terminated, but may contain
|
||||
embedded nulls.
|
||||
|
||||
Note that both dest and src are char **; on return they point to
|
||||
the first free byte after the array and the character that ended
|
||||
the input string, respectively. */
|
||||
|
||||
static bool
|
||||
get_funky_string (char **dest, const char **src, bool equals_end, size_t *output_count) {
|
||||
char num; /* For numerical codes */
|
||||
size_t count; /* Something to count with */
|
||||
enum {
|
||||
ST_GND, ST_BACKSLASH, ST_OCTAL, ST_HEX, ST_CARET, ST_END, ST_ERROR
|
||||
} state;
|
||||
const char *p;
|
||||
char *q;
|
||||
|
||||
p = *src; /* We don't want to double-indirect */
|
||||
q = *dest; /* the whole darn time. */
|
||||
|
||||
count = 0; /* No characters counted in yet. */
|
||||
num = 0;
|
||||
|
||||
state = ST_GND; /* Start in ground state. */
|
||||
while (state < ST_END)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ST_GND: /* Ground state (no escapes) */
|
||||
switch (*p)
|
||||
{
|
||||
case ':':
|
||||
case '\0':
|
||||
state = ST_END; /* End of string */
|
||||
break;
|
||||
case '\\':
|
||||
state = ST_BACKSLASH; /* Backslash scape sequence */
|
||||
++p;
|
||||
break;
|
||||
case '^':
|
||||
state = ST_CARET; /* Caret escape */
|
||||
++p;
|
||||
break;
|
||||
case '=':
|
||||
if (equals_end)
|
||||
{
|
||||
state = ST_END; /* End */
|
||||
break;
|
||||
}
|
||||
/* else fall through */
|
||||
default:
|
||||
*(q++) = *(p++);
|
||||
++count;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_BACKSLASH: /* Backslash escaped character */
|
||||
switch (*p)
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
state = ST_OCTAL; /* Octal sequence */
|
||||
num = *p - '0';
|
||||
break;
|
||||
case 'x':
|
||||
case 'X':
|
||||
state = ST_HEX; /* Hex sequence */
|
||||
num = 0;
|
||||
break;
|
||||
case 'a': /* Bell */
|
||||
num = '\a';
|
||||
break;
|
||||
case 'b': /* Backspace */
|
||||
num = '\b';
|
||||
break;
|
||||
case 'e': /* Escape */
|
||||
num = 27;
|
||||
break;
|
||||
case 'f': /* Form feed */
|
||||
num = '\f';
|
||||
break;
|
||||
case 'n': /* Newline */
|
||||
num = '\n';
|
||||
break;
|
||||
case 'r': /* Carriage return */
|
||||
num = '\r';
|
||||
break;
|
||||
case 't': /* Tab */
|
||||
num = '\t';
|
||||
break;
|
||||
case 'v': /* Vtab */
|
||||
num = '\v';
|
||||
break;
|
||||
case '?': /* Delete */
|
||||
num = 127;
|
||||
break;
|
||||
case '_': /* Space */
|
||||
num = ' ';
|
||||
break;
|
||||
case '\0': /* End of string */
|
||||
state = ST_ERROR; /* Error! */
|
||||
break;
|
||||
default: /* Escaped character like \ ^ : = */
|
||||
num = *p;
|
||||
break;
|
||||
}
|
||||
if (state == ST_BACKSLASH)
|
||||
{
|
||||
*(q++) = num;
|
||||
++count;
|
||||
state = ST_GND;
|
||||
}
|
||||
++p;
|
||||
break;
|
||||
|
||||
case ST_OCTAL: /* Octal sequence */
|
||||
if (*p < '0' || *p > '7')
|
||||
{
|
||||
*(q++) = num;
|
||||
++count;
|
||||
state = ST_GND;
|
||||
}
|
||||
else
|
||||
num = (num << 3) + (*(p++) - '0');
|
||||
break;
|
||||
|
||||
case ST_HEX: /* Hex sequence */
|
||||
switch (*p)
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
num = (num << 4) + (*(p++) - '0');
|
||||
break;
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
num = (num << 4) + (*(p++) - 'a') + 10;
|
||||
break;
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
num = (num << 4) + (*(p++) - 'A') + 10;
|
||||
break;
|
||||
default:
|
||||
*(q++) = num;
|
||||
++count;
|
||||
state = ST_GND;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_CARET: /* Caret escape */
|
||||
state = ST_GND; /* Should be the next state... */
|
||||
if (*p >= '@' && *p <= '~')
|
||||
{
|
||||
*(q++) = *(p++) & 037;
|
||||
++count;
|
||||
}
|
||||
else if (*p == '?')
|
||||
{
|
||||
*(q++) = 127;
|
||||
++count;
|
||||
}
|
||||
else
|
||||
state = ST_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* should we ? */
|
||||
/* abort (); no, we should not */
|
||||
state = ST_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*dest = q;
|
||||
*src = p;
|
||||
*output_count = count;
|
||||
|
||||
return state != ST_ERROR;
|
||||
}
|
||||
#endif /* COLOR_SUPPORT */
|
||||
|
||||
void _rl_parse_colors()
|
||||
{
|
||||
#if defined (COLOR_SUPPORT)
|
||||
const char *p; /* Pointer to character being parsed */
|
||||
char *buf; /* color_buf buffer pointer */
|
||||
int state; /* State of parser */
|
||||
int ind_no; /* Indicator number */
|
||||
char label[3]; /* Indicator label */
|
||||
COLOR_EXT_TYPE *ext; /* Extension we are working on */
|
||||
|
||||
p = sh_get_env_value ("LS_COLORS");
|
||||
if (p == 0 || *p == '\0')
|
||||
{
|
||||
_rl_color_ext_list = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
ext = NULL;
|
||||
strcpy (label, "??");
|
||||
|
||||
/* This is an overly conservative estimate, but any possible
|
||||
LS_COLORS string will *not* generate a color_buf longer than
|
||||
itself, so it is a safe way of allocating a buffer in
|
||||
advance. */
|
||||
buf = color_buf = savestring (p);
|
||||
|
||||
state = 1;
|
||||
while (state > 0)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 1: /* First label character */
|
||||
switch (*p)
|
||||
{
|
||||
case ':':
|
||||
++p;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
/* Allocate new extension block and add to head of
|
||||
linked list (this way a later definition will
|
||||
override an earlier one, which can be useful for
|
||||
having terminal-specific defs override global). */
|
||||
|
||||
ext = (COLOR_EXT_TYPE *)xmalloc (sizeof *ext);
|
||||
ext->next = _rl_color_ext_list;
|
||||
_rl_color_ext_list = ext;
|
||||
|
||||
++p;
|
||||
ext->ext.string = buf;
|
||||
|
||||
state = (get_funky_string (&buf, &p, true, &ext->ext.len)
|
||||
? 4 : -1);
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
state = 0; /* Done! */
|
||||
break;
|
||||
|
||||
default: /* Assume it is file type label */
|
||||
label[0] = *(p++);
|
||||
state = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Second label character */
|
||||
if (*p)
|
||||
{
|
||||
label[1] = *(p++);
|
||||
state = 3;
|
||||
}
|
||||
else
|
||||
state = -1; /* Error */
|
||||
break;
|
||||
|
||||
case 3: /* Equal sign after indicator label */
|
||||
state = -1; /* Assume failure... */
|
||||
if (*(p++) == '=')/* It *should* be... */
|
||||
{
|
||||
for (ind_no = 0; indicator_name[ind_no] != NULL; ++ind_no)
|
||||
{
|
||||
if (STREQ (label, indicator_name[ind_no]))
|
||||
{
|
||||
_rl_color_indicator[ind_no].string = buf;
|
||||
state = (get_funky_string (&buf, &p, false,
|
||||
&_rl_color_indicator[ind_no].len)
|
||||
? 1 : -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state == -1)
|
||||
{
|
||||
_rl_errmsg ("LS_COLORS: unrecognized prefix: %s", label);
|
||||
/* recover from an unrecognized prefix */
|
||||
while (p && *p && *p != ':')
|
||||
p++;
|
||||
if (p && *p == ':')
|
||||
state = 1;
|
||||
else if (p && *p == 0)
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: /* Equal sign after *.ext */
|
||||
if (*(p++) == '=')
|
||||
{
|
||||
ext->seq.string = buf;
|
||||
state = (get_funky_string (&buf, &p, false, &ext->seq.len)
|
||||
? 1 : -1);
|
||||
}
|
||||
else
|
||||
state = -1;
|
||||
/* XXX - recover here as with an unrecognized prefix? */
|
||||
if (state == -1 && ext->ext.string)
|
||||
_rl_errmsg ("LS_COLORS: syntax error: %s", ext->ext.string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state < 0)
|
||||
{
|
||||
COLOR_EXT_TYPE *e;
|
||||
COLOR_EXT_TYPE *e2;
|
||||
|
||||
_rl_errmsg ("unparsable value for LS_COLORS environment variable");
|
||||
free (color_buf);
|
||||
for (e = _rl_color_ext_list; e != NULL; /* empty */)
|
||||
{
|
||||
e2 = e;
|
||||
e = e->next;
|
||||
free (e2);
|
||||
}
|
||||
_rl_color_ext_list = NULL;
|
||||
_rl_colored_stats = 0; /* can't have colored stats without colors */
|
||||
}
|
||||
#else /* !COLOR_SUPPORT */
|
||||
;
|
||||
#endif /* !COLOR_SUPPORT */
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/* `dir', `vdir' and `ls' directory listing programs for GNU.
|
||||
|
||||
Modified by Chet Ramey for Readline.
|
||||
|
||||
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Richard Stallman and David MacKenzie. */
|
||||
|
||||
/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis
|
||||
Flaherty <dennisf@denix.elk.miles.com> based on original patches by
|
||||
Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */
|
||||
|
||||
#ifndef _PARSE_COLORS_H_
|
||||
#define _PARSE_COLORS_H_
|
||||
|
||||
#include "readline.h"
|
||||
|
||||
#define LEN_STR_PAIR(s) sizeof (s) - 1, s
|
||||
|
||||
void _rl_parse_colors (void);
|
||||
|
||||
static const char *const indicator_name[]=
|
||||
{
|
||||
"lc", "rc", "ec", "rs", "no", "fi", "di", "ln", "pi", "so",
|
||||
"bd", "cd", "mi", "or", "ex", "do", "su", "sg", "st",
|
||||
"ow", "tw", "ca", "mh", "cl", NULL
|
||||
};
|
||||
|
||||
/* Buffer for color sequences */
|
||||
static char *color_buf;
|
||||
|
||||
#endif /* !_PARSE_COLORS_H_ */
|
|
@ -1,3 +1,3 @@
|
|||
# Do not edit -- exists only for use by patch
|
||||
|
||||
0
|
||||
1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* posixdir.h -- Posix directory reading includes and defines. */
|
||||
|
||||
/* Copyright (C) 1987,1991,2012 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
|
@ -46,26 +46,16 @@
|
|||
# define D_NAMLEN(d) ((d)->d_namlen)
|
||||
#endif /* !HAVE_DIRENT_H */
|
||||
|
||||
/* The bash code fairly consistenly uses d_fileno; make sure it's available */
|
||||
#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT_D_FILENO)
|
||||
# define d_fileno d_ino
|
||||
#endif
|
||||
|
||||
#if defined (_POSIX_SOURCE) && (!defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO))
|
||||
/* Posix does not require that the d_ino field be present, and some
|
||||
systems do not provide it. */
|
||||
#if !defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO)
|
||||
# define REAL_DIR_ENTRY(dp) 1
|
||||
#else
|
||||
# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
|
||||
#endif /* _POSIX_SOURCE */
|
||||
|
||||
#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (BROKEN_DIRENT_D_INO)
|
||||
# define D_INO_AVAILABLE
|
||||
#endif
|
||||
|
||||
/* Signal the rest of the code that it can safely use dirent.d_fileno */
|
||||
#if defined (D_INO_AVAILABLE) || defined (HAVE_STRUCT_DIRENT_D_FILENO)
|
||||
# define D_FILENO_AVAILABLE 1
|
||||
#endif
|
||||
|
||||
#endif /* !_POSIXDIR_H_ */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
|
||||
|
||||
/* Copyright (C) 1987,1991-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
|
@ -27,20 +27,14 @@
|
|||
|
||||
#if defined (HAVE_POSIX_SIGSETJMP)
|
||||
# define procenv_t sigjmp_buf
|
||||
|
||||
# define setjmp_nosigs(x) sigsetjmp((x), 0)
|
||||
# define setjmp_sigs(x) sigsetjmp((x), 1)
|
||||
|
||||
# define _rl_longjmp(x, n) siglongjmp((x), (n))
|
||||
# define sh_longjmp(x, n) siglongjmp((x), (n))
|
||||
# if !defined (__OPENNT)
|
||||
# undef setjmp
|
||||
# define setjmp(x) sigsetjmp((x), 1)
|
||||
# undef longjmp
|
||||
# define longjmp(x, n) siglongjmp((x), (n))
|
||||
# endif /* !__OPENNT */
|
||||
#else
|
||||
# define procenv_t jmp_buf
|
||||
|
||||
# define setjmp_nosigs setjmp
|
||||
# define setjmp_sigs setjmp
|
||||
|
||||
# define _rl_longjmp(x, n) longjmp((x), (n))
|
||||
# define sh_longjmp(x, n) longjmp((x), (n))
|
||||
#endif
|
||||
|
||||
#endif /* _POSIXJMP_H_ */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* readline.c -- a general facility for reading lines of input
|
||||
with emacs style editing and completion. */
|
||||
|
||||
/* Copyright (C) 1987-2013 Free Software Foundation, Inc.
|
||||
/* 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.
|
||||
|
@ -82,11 +82,6 @@ extern int errno;
|
|||
|
||||
extern void _rl_free_history_entry PARAMS((HIST_ENTRY *));
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
extern void _rl_parse_colors PARAMS((void)); /* XXX */
|
||||
#endif
|
||||
|
||||
|
||||
/* Forward declarations used in this file. */
|
||||
static char *readline_internal PARAMS((void));
|
||||
static void readline_initialize_everything PARAMS((void));
|
||||
|
@ -94,8 +89,6 @@ static void readline_initialize_everything PARAMS((void));
|
|||
static void bind_arrow_keys_internal PARAMS((Keymap));
|
||||
static void bind_arrow_keys PARAMS((void));
|
||||
|
||||
static void bind_bracketed_paste_prefix PARAMS((void));
|
||||
|
||||
static void readline_default_bindings PARAMS((void));
|
||||
static void reset_default_bindings PARAMS((void));
|
||||
|
||||
|
@ -119,6 +112,7 @@ int rl_gnu_readline_p = 1;
|
|||
By default, it is the standard emacs keymap. */
|
||||
Keymap _rl_keymap = emacs_standard_keymap;
|
||||
|
||||
|
||||
/* The current style of editing. */
|
||||
int rl_editing_mode = emacs_mode;
|
||||
|
||||
|
@ -244,32 +238,13 @@ int rl_erase_empty_line = 0;
|
|||
character bound to accept-line. */
|
||||
int rl_num_chars_to_read;
|
||||
|
||||
/* Line buffer and maintenance. */
|
||||
/* Line buffer and maintenence. */
|
||||
char *rl_line_buffer = (char *)NULL;
|
||||
int rl_line_buffer_len = 0;
|
||||
|
||||
/* Key sequence `contexts' */
|
||||
_rl_keyseq_cxt *_rl_kscxt = 0;
|
||||
|
||||
int rl_executing_key;
|
||||
char *rl_executing_keyseq = 0;
|
||||
int _rl_executing_keyseq_size = 0;
|
||||
|
||||
/* Timeout (specified in milliseconds) when reading characters making up an
|
||||
ambiguous multiple-key sequence */
|
||||
int _rl_keyseq_timeout = 500;
|
||||
|
||||
#define RESIZE_KEYSEQ_BUFFER() \
|
||||
do \
|
||||
{ \
|
||||
if (rl_key_sequence_length + 2 >= _rl_executing_keyseq_size) \
|
||||
{ \
|
||||
_rl_executing_keyseq_size += 16; \
|
||||
rl_executing_keyseq = xrealloc (rl_executing_keyseq, _rl_executing_keyseq_size); \
|
||||
} \
|
||||
} \
|
||||
while (0);
|
||||
|
||||
/* Forward declarations used by the display, termcap, and history code. */
|
||||
|
||||
/* **************************************************************** */
|
||||
|
@ -304,15 +279,6 @@ int _rl_revert_all_at_newline = 0;
|
|||
characters corresponding to keyboard-generated signals. */
|
||||
int _rl_echo_control_chars = 1;
|
||||
|
||||
/* Non-zero means to prefix the displayed prompt with a character indicating
|
||||
the editing mode: @ for emacs, : for vi-command, + for vi-insert. */
|
||||
int _rl_show_mode_in_prompt = 0;
|
||||
|
||||
/* Non-zero means to attempt to put the terminal in `bracketed paste mode',
|
||||
where it will prefix pasted text with an escape sequence and send
|
||||
another to mark the end of the paste. */
|
||||
int _rl_enable_bracketed_paste = 0;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Top Level Functions */
|
||||
|
@ -386,11 +352,6 @@ readline (prompt)
|
|||
RL_SETSTATE (RL_STATE_CALLBACK);
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_AUDIT_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT)
|
||||
if (value)
|
||||
_rl_audit_tty (value);
|
||||
#endif
|
||||
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
@ -408,19 +369,9 @@ readline_internal_setup ()
|
|||
_rl_in_stream = rl_instream;
|
||||
_rl_out_stream = rl_outstream;
|
||||
|
||||
/* Enable the meta key only for the duration of readline(), if this
|
||||
terminal has one and the terminal has been initialized */
|
||||
if (_rl_enable_meta & RL_ISSTATE (RL_STATE_TERMPREPPED))
|
||||
_rl_enable_meta_key ();
|
||||
|
||||
if (rl_startup_hook)
|
||||
(*rl_startup_hook) ();
|
||||
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode)
|
||||
rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
|
||||
#endif /* VI_MODE */
|
||||
|
||||
/* 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. */
|
||||
|
@ -443,6 +394,11 @@ readline_internal_setup ()
|
|||
(*rl_redisplay_function) ();
|
||||
}
|
||||
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode)
|
||||
rl_vi_insert_mode (1, 'i');
|
||||
#endif /* VI_MODE */
|
||||
|
||||
if (rl_pre_input_hook)
|
||||
(*rl_pre_input_hook) ();
|
||||
|
||||
|
@ -481,11 +437,6 @@ readline_internal_teardown (eof)
|
|||
if (rl_undo_list)
|
||||
rl_free_undo_list ();
|
||||
|
||||
/* Disable the meta key, if this terminal has one and we were told to use it.
|
||||
The check whether or not we sent the enable string is in
|
||||
_rl_disable_meta_key(); the flag is set in _rl_enable_meta_key */
|
||||
_rl_disable_meta_key ();
|
||||
|
||||
/* Restore normal cursor, if available. */
|
||||
_rl_set_insert_mode (RL_IM_INSERT, 0);
|
||||
|
||||
|
@ -532,20 +483,16 @@ readline_internal_charloop ()
|
|||
static int lastc, eof_found;
|
||||
int c, code, lk;
|
||||
|
||||
lastc = EOF;
|
||||
lastc = -1;
|
||||
eof_found = 0;
|
||||
|
||||
#if !defined (READLINE_CALLBACKS)
|
||||
eof_found = 0;
|
||||
while (rl_done == 0)
|
||||
{
|
||||
#endif
|
||||
lk = _rl_last_command_was_kill;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGSETJMP)
|
||||
code = sigsetjmp (_rl_top_level, 0);
|
||||
#else
|
||||
code = setjmp (_rl_top_level);
|
||||
#endif
|
||||
|
||||
if (code)
|
||||
{
|
||||
|
@ -564,7 +511,6 @@ readline_internal_charloop ()
|
|||
/* Then initialize the argument and number of keys read. */
|
||||
_rl_reset_argument ();
|
||||
rl_key_sequence_length = 0;
|
||||
rl_executing_keyseq[0] = 0;
|
||||
}
|
||||
|
||||
RL_SETSTATE(RL_STATE_READCMD);
|
||||
|
@ -573,8 +519,7 @@ readline_internal_charloop ()
|
|||
|
||||
/* look at input.c:rl_getc() for the circumstances under which this will
|
||||
be returned; punt immediately on read error without converting it to
|
||||
a newline; assume that rl_read_key has already called the signal
|
||||
handler. */
|
||||
a newline. */
|
||||
if (c == READERR)
|
||||
{
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
|
@ -586,36 +531,13 @@ readline_internal_charloop ()
|
|||
#endif
|
||||
}
|
||||
|
||||
/* EOF typed to a non-blank line is ^D the first time, EOF the second
|
||||
time in a row. This won't return any partial line read from the tty.
|
||||
If we want to change this, to force any existing line to be returned
|
||||
when read(2) reads EOF, for example, this is the place to change. */
|
||||
/* EOF typed to a non-blank line is a <NL>. */
|
||||
if (c == EOF && rl_end)
|
||||
{
|
||||
if (RL_SIG_RECEIVED ())
|
||||
{
|
||||
RL_CHECK_SIGNALS ();
|
||||
if (rl_signal_event_hook)
|
||||
(*rl_signal_event_hook) (); /* XXX */
|
||||
}
|
||||
|
||||
/* XXX - reading two consecutive EOFs returns EOF */
|
||||
if (RL_ISSTATE (RL_STATE_TERMPREPPED))
|
||||
{
|
||||
if (lastc == _rl_eof_char || lastc == EOF)
|
||||
rl_end = 0;
|
||||
else
|
||||
c = _rl_eof_char;
|
||||
}
|
||||
else
|
||||
c = NEWLINE;
|
||||
}
|
||||
c = NEWLINE;
|
||||
|
||||
/* The character _rl_eof_char typed to blank line, and not as the
|
||||
previous character is interpreted as EOF. This doesn't work when
|
||||
READLINE_CALLBACKS is defined, so hitting a series of ^Ds will
|
||||
erase all the chars on the line and then return EOF. */
|
||||
if (((c == _rl_eof_char && lastc != c) || c == EOF) && rl_end == 0)
|
||||
previous character is interpreted as EOF. */
|
||||
if (((c == _rl_eof_char && lastc != c) || c == EOF) && !rl_end)
|
||||
{
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
RL_SETSTATE(RL_STATE_DONE);
|
||||
|
@ -772,8 +694,7 @@ _rl_dispatch_callback (cxt)
|
|||
r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
|
||||
|
||||
RL_CHECK_SIGNALS ();
|
||||
/* We only treat values < 0 specially to simulate recursion. */
|
||||
if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
|
||||
if (r == 0) /* success! */
|
||||
{
|
||||
_rl_keyseq_chain_dispose ();
|
||||
RL_UNSETSTATE (RL_STATE_MULTIKEY);
|
||||
|
@ -822,10 +743,9 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
{
|
||||
if (RL_ISSTATE (RL_STATE_MACRODEF))
|
||||
_rl_add_macro_char (ESC);
|
||||
RESIZE_KEYSEQ_BUFFER ();
|
||||
rl_executing_keyseq[rl_key_sequence_length++] = ESC;
|
||||
map = FUNCTION_TO_KEYMAP (map, ESC);
|
||||
key = UNMETA (key);
|
||||
rl_key_sequence_length += 2;
|
||||
return (_rl_dispatch (key, map));
|
||||
}
|
||||
else
|
||||
|
@ -845,19 +765,13 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
{
|
||||
/* Special case rl_do_lowercase_version (). */
|
||||
if (func == rl_do_lowercase_version)
|
||||
/* Should we do anything special if key == ANYOTHERKEY? */
|
||||
return (_rl_dispatch (_rl_to_lower (key), map));
|
||||
|
||||
rl_executing_keymap = map;
|
||||
rl_executing_key = key;
|
||||
|
||||
RESIZE_KEYSEQ_BUFFER();
|
||||
rl_executing_keyseq[rl_key_sequence_length++] = key;
|
||||
rl_executing_keyseq[rl_key_sequence_length] = '\0';
|
||||
|
||||
rl_dispatching = 1;
|
||||
RL_SETSTATE(RL_STATE_DISPATCHING);
|
||||
r = (*func) (rl_numeric_arg * rl_arg_sign, key);
|
||||
(*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
|
||||
RL_UNSETSTATE(RL_STATE_DISPATCHING);
|
||||
rl_dispatching = 0;
|
||||
|
||||
|
@ -874,10 +788,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
/* OK, there's no function bound in this map, but there is a
|
||||
shadow function that was overridden when the current keymap
|
||||
was created. Return -2 to note that. */
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
_rl_unget_char (key);
|
||||
return -2;
|
||||
}
|
||||
else if (got_subseq)
|
||||
|
@ -886,10 +797,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
have a matching key, nor was one overridden. This means
|
||||
we need to back up the recursion chain and find the last
|
||||
subsequence that is bound to a function. */
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
_rl_unget_char (key);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
|
@ -912,17 +820,13 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
check whether there's input in the queue, which there generally
|
||||
will be if an arrow key has been pressed, and, if there's not,
|
||||
just dispatch to (what we assume is) rl_vi_movement_mode right
|
||||
away. This is essentially an input test with a zero timeout (by
|
||||
default) or a timeout determined by the value of `keyseq-timeout' */
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
|
||||
takes microseconds, so multiply by 1000 */
|
||||
away. This is essentially an input test with a zero timeout. */
|
||||
if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap
|
||||
&& _rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0)
|
||||
&& _rl_input_queued (0) == 0)
|
||||
return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)));
|
||||
#endif
|
||||
|
||||
RESIZE_KEYSEQ_BUFFER ();
|
||||
rl_executing_keyseq[rl_key_sequence_length++] = key;
|
||||
rl_key_sequence_length++;
|
||||
_rl_dispatching_keymap = FUNCTION_TO_KEYMAP (map, key);
|
||||
|
||||
/* Allocate new context here. Use linked contexts (linked through
|
||||
|
@ -951,18 +855,6 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Tentative inter-character timeout for potential multi-key
|
||||
sequences? If no input within timeout, abort sequence and
|
||||
act as if we got non-matching input. */
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
|
||||
takes microseconds, so multiply by 1000 */
|
||||
if (_rl_keyseq_timeout > 0 &&
|
||||
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
|
||||
_rl_pushed_input_available () == 0 &&
|
||||
_rl_dispatching_keymap[ANYOTHERKEY].function &&
|
||||
_rl_input_queued (_rl_keyseq_timeout*1000) == 0)
|
||||
return (_rl_subseq_result (-2, map, key, got_subseq));
|
||||
|
||||
newkey = _rl_subseq_getchar (key);
|
||||
if (newkey < 0)
|
||||
{
|
||||
|
@ -975,7 +867,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
}
|
||||
else
|
||||
{
|
||||
_rl_abort_internal (); /* XXX */
|
||||
_rl_abort_internal ();
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
@ -983,7 +875,6 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
case ISMACR:
|
||||
if (map[key].function != 0)
|
||||
{
|
||||
rl_executing_keyseq[rl_key_sequence_length] = '\0';
|
||||
macro = savestring ((char *)map[key].function);
|
||||
_rl_with_macro_input (macro);
|
||||
return 0;
|
||||
|
@ -993,7 +884,6 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
|||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
|
||||
key != ANYOTHERKEY &&
|
||||
_rl_dispatching_keymap == vi_movement_keymap &&
|
||||
_rl_vi_textmod_command (key))
|
||||
_rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
|
||||
#endif
|
||||
|
@ -1023,13 +913,11 @@ _rl_subseq_result (r, map, key, got_subseq)
|
|||
func = m[ANYOTHERKEY].function;
|
||||
if (type == ISFUNC && func == rl_do_lowercase_version)
|
||||
r = _rl_dispatch (_rl_to_lower (key), map);
|
||||
else if (type == ISFUNC)
|
||||
else if (type == ISFUNC && func == rl_insert)
|
||||
{
|
||||
/* If we shadowed a function, whatever it is, we somehow need a
|
||||
keymap with map[key].func == shadowed-function.
|
||||
Let's use this one. Then we can dispatch using the original
|
||||
key, since there are commands (e.g., in vi mode) for which it
|
||||
matters. */
|
||||
/* If the function that was shadowed was self-insert, we
|
||||
somehow need a keymap with map[key].func == self-insert.
|
||||
Let's use this one. */
|
||||
nt = m[key].type;
|
||||
nf = m[key].function;
|
||||
|
||||
|
@ -1040,7 +928,6 @@ _rl_subseq_result (r, map, key, got_subseq)
|
|||
m[key].function = nf;
|
||||
}
|
||||
else
|
||||
/* We probably shadowed a keymap, so keep going. */
|
||||
r = _rl_dispatch (ANYOTHERKEY, m);
|
||||
}
|
||||
else if (r && map[ANYOTHERKEY].function)
|
||||
|
@ -1048,20 +935,14 @@ _rl_subseq_result (r, map, key, got_subseq)
|
|||
/* We didn't match (r is probably -1), so return something to
|
||||
tell the caller that it should try ANYOTHERKEY for an
|
||||
overridden function. */
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
_rl_unget_char (key);
|
||||
_rl_dispatching_keymap = map;
|
||||
return -2;
|
||||
}
|
||||
else if (r && got_subseq)
|
||||
{
|
||||
/* OK, back up the chain. */
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
_rl_unget_char (key);
|
||||
_rl_dispatching_keymap = map;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1090,7 +971,7 @@ rl_initialize ()
|
|||
RL_SETSTATE(RL_STATE_INITIALIZED);
|
||||
}
|
||||
|
||||
/* Initialize the current line information. */
|
||||
/* Initalize the current line information. */
|
||||
_rl_init_line_state ();
|
||||
|
||||
/* We aren't done yet. We haven't even gotten started yet! */
|
||||
|
@ -1210,23 +1091,14 @@ readline_initialize_everything ()
|
|||
/* Try to bind a common arrow key prefix, if not already bound. */
|
||||
bind_arrow_keys ();
|
||||
|
||||
/* Bind the bracketed paste prefix assuming that the user will enable
|
||||
it on terminals that support it. */
|
||||
bind_bracketed_paste_prefix ();
|
||||
/* Enable the meta key, if this terminal has one. */
|
||||
if (_rl_enable_meta)
|
||||
_rl_enable_meta_key ();
|
||||
|
||||
/* If the completion parser's default word break characters haven't
|
||||
been set yet, then do so now. */
|
||||
if (rl_completer_word_break_characters == (char *)NULL)
|
||||
rl_completer_word_break_characters = (char *)rl_basic_word_break_characters;
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
if (_rl_colored_stats || _rl_colored_completion_prefix)
|
||||
_rl_parse_colors ();
|
||||
#endif
|
||||
|
||||
rl_executing_keyseq = malloc (_rl_executing_keyseq_size = 16);
|
||||
if (rl_executing_keyseq)
|
||||
rl_executing_keyseq[0] = '\0';
|
||||
}
|
||||
|
||||
/* If this system allows us to look at the values of the regular
|
||||
|
@ -1291,16 +1163,6 @@ bind_arrow_keys_internal (map)
|
|||
rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line);
|
||||
rl_bind_keyseq_if_unbound ("\340S", rl_delete);
|
||||
rl_bind_keyseq_if_unbound ("\340R", rl_overwrite_mode);
|
||||
|
||||
/* These may or may not work because of the embedded NUL. */
|
||||
rl_bind_keyseq_if_unbound ("\\000H", rl_get_previous_history);
|
||||
rl_bind_keyseq_if_unbound ("\\000P", rl_get_next_history);
|
||||
rl_bind_keyseq_if_unbound ("\\000M", rl_forward_char);
|
||||
rl_bind_keyseq_if_unbound ("\\000K", rl_backward_char);
|
||||
rl_bind_keyseq_if_unbound ("\\000G", rl_beg_of_line);
|
||||
rl_bind_keyseq_if_unbound ("\\000O", rl_end_of_line);
|
||||
rl_bind_keyseq_if_unbound ("\\000S", rl_delete);
|
||||
rl_bind_keyseq_if_unbound ("\\000R", rl_overwrite_mode);
|
||||
#endif
|
||||
|
||||
_rl_keymap = xkeymap;
|
||||
|
@ -1324,22 +1186,6 @@ bind_arrow_keys ()
|
|||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
bind_bracketed_paste_prefix ()
|
||||
{
|
||||
Keymap xkeymap;
|
||||
|
||||
xkeymap = _rl_keymap;
|
||||
|
||||
_rl_keymap = emacs_standard_keymap;
|
||||
rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);
|
||||
|
||||
_rl_keymap = vi_insertion_keymap;
|
||||
rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);
|
||||
|
||||
_rl_keymap = xkeymap;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Saving and Restoring Readline's state */
|
||||
|
@ -1368,7 +1214,6 @@ rl_save_state (sp)
|
|||
sp->lastfunc = rl_last_func;
|
||||
sp->insmode = rl_insert_mode;
|
||||
sp->edmode = rl_editing_mode;
|
||||
sp->kseq = rl_executing_keyseq;
|
||||
sp->kseqlen = rl_key_sequence_length;
|
||||
sp->inf = rl_instream;
|
||||
sp->outf = rl_outstream;
|
||||
|
@ -1378,12 +1223,6 @@ rl_save_state (sp)
|
|||
sp->catchsigs = rl_catch_signals;
|
||||
sp->catchsigwinch = rl_catch_sigwinch;
|
||||
|
||||
sp->entryfunc = rl_completion_entry_function;
|
||||
sp->menuentryfunc = rl_menu_completion_entry_function;
|
||||
sp->ignorefunc = rl_ignore_some_completions_function;
|
||||
sp->attemptfunc = rl_attempted_completion_function;
|
||||
sp->wordbreakchars = rl_completer_word_break_characters;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1248,6 @@ rl_restore_state (sp)
|
|||
rl_last_func = sp->lastfunc;
|
||||
rl_insert_mode = sp->insmode;
|
||||
rl_editing_mode = sp->edmode;
|
||||
rl_executing_keyseq = sp->kseq;
|
||||
rl_key_sequence_length = sp->kseqlen;
|
||||
rl_instream = sp->inf;
|
||||
rl_outstream = sp->outf;
|
||||
|
@ -1419,11 +1257,5 @@ rl_restore_state (sp)
|
|||
rl_catch_signals = sp->catchsigs;
|
||||
rl_catch_sigwinch = sp->catchsigwinch;
|
||||
|
||||
rl_completion_entry_function = sp->entryfunc;
|
||||
rl_menu_completion_entry_function = sp->menuentryfunc;
|
||||
rl_ignore_some_completions_function = sp->ignorefunc;
|
||||
rl_attempted_completion_function = sp->attemptfunc;
|
||||
rl_completer_word_break_characters = sp->wordbreakchars;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Readline.h -- the names of functions callable from within readline. */
|
||||
|
||||
/* Copyright (C) 1987-2013 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2011 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.
|
||||
|
@ -39,9 +39,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* Hex-encoded Readline version number. */
|
||||
#define RL_READLINE_VERSION 0x0700 /* Readline 7.0 */
|
||||
#define RL_VERSION_MAJOR 7
|
||||
#define RL_VERSION_MINOR 0
|
||||
#define RL_READLINE_VERSION 0x0602 /* Readline 6.2 */
|
||||
#define RL_VERSION_MAJOR 6
|
||||
#define RL_VERSION_MINOR 2
|
||||
|
||||
/* Readline data structures. */
|
||||
|
||||
|
@ -172,9 +172,8 @@ extern int rl_yank PARAMS((int, int));
|
|||
extern int rl_yank_pop PARAMS((int, int));
|
||||
extern int rl_yank_nth_arg PARAMS((int, int));
|
||||
extern int rl_yank_last_arg PARAMS((int, int));
|
||||
extern int rl_bracketed_paste_begin PARAMS((int, int));
|
||||
/* Not available unless _WIN32 is defined. */
|
||||
#if defined (_WIN32)
|
||||
/* Not available unless __CYGWIN__ is defined. */
|
||||
#ifdef __CYGWIN__
|
||||
extern int rl_paste_from_clipboard PARAMS((int, int));
|
||||
#endif
|
||||
|
||||
|
@ -186,7 +185,6 @@ extern int rl_forward_search_history PARAMS((int, int));
|
|||
extern int rl_start_kbd_macro PARAMS((int, int));
|
||||
extern int rl_end_kbd_macro PARAMS((int, int));
|
||||
extern int rl_call_last_kbd_macro PARAMS((int, int));
|
||||
extern int rl_print_last_kbd_macro PARAMS((int, int));
|
||||
|
||||
/* Bindable undo commands. */
|
||||
extern int rl_revert_line PARAMS((int, int));
|
||||
|
@ -206,8 +204,6 @@ extern int rl_tty_status PARAMS((int, int));
|
|||
/* Bindable commands for incremental and non-incremental history searching. */
|
||||
extern int rl_history_search_forward PARAMS((int, int));
|
||||
extern int rl_history_search_backward PARAMS((int, int));
|
||||
extern int rl_history_substr_search_forward PARAMS((int, int));
|
||||
extern int rl_history_substr_search_backward PARAMS((int, int));
|
||||
extern int rl_noninc_forward_search PARAMS((int, int));
|
||||
extern int rl_noninc_reverse_search PARAMS((int, int));
|
||||
extern int rl_noninc_forward_search_again PARAMS((int, int));
|
||||
|
@ -220,7 +216,6 @@ extern int rl_insert_close PARAMS((int, int));
|
|||
extern void rl_callback_handler_install PARAMS((const char *, rl_vcpfunc_t *));
|
||||
extern void rl_callback_read_char PARAMS((void));
|
||||
extern void rl_callback_handler_remove PARAMS((void));
|
||||
extern void rl_callback_sigcleanup PARAMS((void));
|
||||
|
||||
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
|
||||
/* VI-mode bindable commands. */
|
||||
|
@ -249,7 +244,6 @@ extern int rl_vi_column PARAMS((int, int));
|
|||
extern int rl_vi_delete_to PARAMS((int, int));
|
||||
extern int rl_vi_change_to PARAMS((int, int));
|
||||
extern int rl_vi_yank_to PARAMS((int, int));
|
||||
extern int rl_vi_yank_pop PARAMS((int, int));
|
||||
extern int rl_vi_rubout PARAMS((int, int));
|
||||
extern int rl_vi_delete PARAMS((int, int));
|
||||
extern int rl_vi_back_to_indent PARAMS((int, int));
|
||||
|
@ -345,7 +339,6 @@ extern Keymap rl_make_bare_keymap PARAMS((void));
|
|||
extern Keymap rl_copy_keymap PARAMS((Keymap));
|
||||
extern Keymap rl_make_keymap PARAMS((void));
|
||||
extern void rl_discard_keymap PARAMS((Keymap));
|
||||
extern void rl_free_keymap PARAMS((Keymap));
|
||||
|
||||
extern Keymap rl_get_keymap_by_name PARAMS((const char *));
|
||||
extern char *rl_get_keymap_name PARAMS((Keymap));
|
||||
|
@ -392,7 +385,6 @@ extern int rl_show_char PARAMS((int));
|
|||
|
||||
/* Undocumented in texinfo manual. */
|
||||
extern int rl_character_len PARAMS((int, int));
|
||||
extern void rl_redraw_prompt_last_line PARAMS((void));
|
||||
|
||||
/* Save and restore internal prompt redisplay information. */
|
||||
extern void rl_save_prompt PARAMS((void));
|
||||
|
@ -444,10 +436,6 @@ extern void rl_echo_signal_char PARAMS((int));
|
|||
|
||||
extern int rl_set_paren_blink_timeout PARAMS((int));
|
||||
|
||||
/* History management functions. */
|
||||
|
||||
extern void rl_clear_history PARAMS((void));
|
||||
|
||||
/* Undocumented. */
|
||||
extern int rl_maybe_save_line PARAMS((void));
|
||||
extern int rl_maybe_unsave_line PARAMS((void));
|
||||
|
@ -572,13 +560,6 @@ extern rl_hook_func_t *rl_pre_input_hook;
|
|||
awaiting character input, or NULL, for no event handling. */
|
||||
extern rl_hook_func_t *rl_event_hook;
|
||||
|
||||
/* The address of a function to call if a read is interrupted by a signal. */
|
||||
extern rl_hook_func_t *rl_signal_event_hook;
|
||||
|
||||
/* The address of a function to call if Readline needs to know whether or not
|
||||
there is data available from the current input source. */
|
||||
extern rl_hook_func_t *rl_input_available_hook;
|
||||
|
||||
/* The address of the function to call to fetch a character from the current
|
||||
Readline input stream */
|
||||
extern rl_getc_func_t *rl_getc_function;
|
||||
|
@ -592,10 +573,6 @@ extern rl_voidfunc_t *rl_deprep_term_function;
|
|||
extern Keymap rl_executing_keymap;
|
||||
extern Keymap rl_binding_keymap;
|
||||
|
||||
extern int rl_executing_key;
|
||||
extern char *rl_executing_keyseq;
|
||||
extern int rl_key_sequence_length;
|
||||
|
||||
/* Display variables. */
|
||||
/* If non-zero, readline will erase the entire line, including any prompt,
|
||||
if the only thing typed on an otherwise-blank line is something bound to
|
||||
|
@ -626,10 +603,6 @@ extern int rl_catch_signals;
|
|||
to do that. */
|
||||
extern int rl_catch_sigwinch;
|
||||
|
||||
/* If non-zero, the readline SIGWINCH handler will modify LINES and
|
||||
COLUMNS in the environment. */
|
||||
extern int rl_change_environment;
|
||||
|
||||
/* Completion variables. */
|
||||
/* Pointer to the generator function for completion_matches ().
|
||||
NULL means to use rl_filename_completion_function (), the default
|
||||
|
@ -713,13 +686,6 @@ extern rl_icppfunc_t *rl_directory_completion_hook;
|
|||
it in bash to see how well it goes. */
|
||||
extern rl_icppfunc_t *rl_directory_rewrite_hook;
|
||||
|
||||
/* If non-zero, this is the address of a function for the completer to call
|
||||
before deciding which character to append to a completed name. It should
|
||||
modify the directory name passed as an argument if appropriate, and return
|
||||
non-zero if it modifies the name. This should not worry about dequoting
|
||||
the filename; that has already happened by the time it gets here. */
|
||||
extern rl_icppfunc_t *rl_filename_stat_hook;
|
||||
|
||||
/* If non-zero, this is the address of a function to call when reading
|
||||
directory entries from the filesystem for completion and comparing
|
||||
them to the partial word to be completed. The function should
|
||||
|
@ -897,7 +863,6 @@ struct readline_state {
|
|||
rl_command_func_t *lastfunc;
|
||||
int insmode;
|
||||
int edmode;
|
||||
char *kseq;
|
||||
int kseqlen;
|
||||
FILE *inf;
|
||||
FILE *outf;
|
||||
|
@ -911,16 +876,9 @@ struct readline_state {
|
|||
/* search state */
|
||||
|
||||
/* completion state */
|
||||
rl_compentry_func_t *entryfunc;
|
||||
rl_compentry_func_t *menuentryfunc;
|
||||
rl_compignore_func_t *ignorefunc;
|
||||
rl_completion_func_t *attemptfunc;
|
||||
char *wordbreakchars;
|
||||
|
||||
/* options state */
|
||||
|
||||
/* hook state */
|
||||
|
||||
/* reserved for future expansion, so the struct size doesn't change */
|
||||
char reserved[64];
|
||||
};
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Readline
|
||||
Description: Gnu Readline library for command line editing
|
||||
URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
|
||||
Version: @LIBVERSION@
|
||||
Requires.private: tinfo
|
||||
Libs: -L${libdir} -lreadline
|
||||
Cflags: -I${includedir}/readline
|
|
@ -1,6 +1,6 @@
|
|||
/* rlconf.h -- readline configuration definitions */
|
||||
|
||||
/* Copyright (C) 1992-2012 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992-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.
|
||||
|
@ -28,12 +28,8 @@
|
|||
/* Define this to get an indication of file type when listing completions. */
|
||||
#define VISIBLE_STATS
|
||||
|
||||
/* Define this to get support for colors when listing completions and in
|
||||
other places. */
|
||||
#define COLOR_SUPPORT
|
||||
|
||||
/* This definition is needed by readline.c, rltty.c, and signals.c. */
|
||||
/* If on, then readline handles signals in a way that doesn't suck. */
|
||||
/* If on, then readline handles signals in a way that doesn't screw. */
|
||||
#define HANDLE_SIGNALS
|
||||
|
||||
/* Ugly but working hack for binding prefix meta. */
|
||||
|
@ -62,18 +58,4 @@
|
|||
/* Define this if you want the cursor to indicate insert or overwrite mode. */
|
||||
/* #define CURSOR_MODE */
|
||||
|
||||
/* Define this if you want to enable code that talks to the Linux kernel
|
||||
tty auditing system. */
|
||||
#define ENABLE_TTY_AUDIT_SUPPORT
|
||||
|
||||
/* Defaults for the various editing mode indicators, inserted at the beginning
|
||||
of the last (maybe only) line of the prompt if show-mode-in-prompt is on */
|
||||
#define RL_EMACS_MODESTR_DEFAULT "@"
|
||||
#define RL_EMACS_MODESTR_DEFLEN 1
|
||||
|
||||
#define RL_VI_INS_MODESTR_DEFAULT "(ins)"
|
||||
#define RL_VI_INS_MODESTR_DEFLEN 5
|
||||
#define RL_VI_CMD_MODESTR_DEFAULT "(cmd)"
|
||||
#define RL_VI_CMD_MODESTR_DEFLEN 5
|
||||
|
||||
#endif /* _RLCONF_H_ */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
for readline. This should be included after any files that define
|
||||
system-specific constants like _POSIX_VERSION or USG. */
|
||||
|
||||
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
|
||||
/* 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.
|
||||
|
@ -79,8 +79,8 @@ extern char *strchr (), *strrchr ();
|
|||
#define _rl_stricmp strcasecmp
|
||||
#define _rl_strnicmp strncasecmp
|
||||
#else
|
||||
extern int _rl_stricmp PARAMS((const char *, const char *));
|
||||
extern int _rl_strnicmp PARAMS((const char *, const char *, int));
|
||||
extern int _rl_stricmp PARAMS((char *, char *));
|
||||
extern int _rl_strnicmp PARAMS((char *, char *, int));
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE)
|
||||
|
@ -148,10 +148,6 @@ extern char *_rl_strpbrk PARAMS((const char *, const char *));
|
|||
: ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
|
||||
#endif
|
||||
|
||||
#if !defined (RL_STRLEN)
|
||||
# define RL_STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
|
||||
#endif
|
||||
|
||||
#if !defined (FREE)
|
||||
# define FREE(x) if (x) free (x)
|
||||
#endif
|
||||
|
|
|
@ -123,55 +123,6 @@ extern int _rl_walphabetic PARAMS((wchar_t));
|
|||
#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2)
|
||||
#define MB_NULLWCH(x) ((x) == 0)
|
||||
|
||||
/* Try and shortcut the printable ascii characters to cut down the number of
|
||||
calls to a libc wcwidth() */
|
||||
static inline int
|
||||
_rl_wcwidth (wc)
|
||||
wchar_t wc;
|
||||
{
|
||||
switch (wc)
|
||||
{
|
||||
case ' ': case '!': case '"': case '#': case '%':
|
||||
case '&': case '\'': case '(': case ')': case '*':
|
||||
case '+': case ',': case '-': case '.': case '/':
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case ':': case ';': case '<': case '=': case '>':
|
||||
case '?':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E':
|
||||
case 'F': case 'G': case 'H': case 'I': case 'J':
|
||||
case 'K': case 'L': case 'M': case 'N': case 'O':
|
||||
case 'P': case 'Q': case 'R': case 'S': case 'T':
|
||||
case 'U': case 'V': case 'W': case 'X': case 'Y':
|
||||
case 'Z':
|
||||
case '[': case '\\': case ']': case '^': case '_':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||
case 'p': case 'q': case 'r': case 's': case 't':
|
||||
case 'u': case 'v': case 'w': case 'x': case 'y':
|
||||
case 'z': case '{': case '|': case '}': case '~':
|
||||
return 1;
|
||||
default:
|
||||
return wcwidth (wc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Unicode combining characters range from U+0300 to U+036F */
|
||||
#define UNICODE_COMBINING_CHAR(x) ((x) >= 768 && (x) <= 879)
|
||||
|
||||
#if defined (WCWIDTH_BROKEN)
|
||||
# define WCWIDTH(wc) ((_rl_utf8locale && UNICODE_COMBINING_CHAR(wc)) ? 0 : _rl_wcwidth(wc))
|
||||
#else
|
||||
# define WCWIDTH(wc) _rl_wcwidth(wc)
|
||||
#endif
|
||||
|
||||
#if defined (WCWIDTH_BROKEN)
|
||||
# define IS_COMBINING_CHAR(x) (WCWIDTH(x) == 0 && iswcntrl(x) == 0)
|
||||
#else
|
||||
# define IS_COMBINING_CHAR(x) (WCWIDTH(x) == 0)
|
||||
#endif
|
||||
|
||||
#else /* !HANDLE_MULTIBYTE */
|
||||
|
||||
#undef MB_LEN_MAX
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* rlprivate.h -- functions and variables global to the readline library,
|
||||
but not intended for use by applications. */
|
||||
|
||||
/* Copyright (C) 1999-2012 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1999-2010 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.
|
||||
|
@ -42,13 +42,6 @@
|
|||
if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
|
||||
} while (0)
|
||||
|
||||
#define RL_SIG_RECEIVED() (_rl_caught_signal != 0)
|
||||
#define RL_SIGINT_RECEIVED() (_rl_caught_signal == SIGINT)
|
||||
#define RL_SIGWINCH_RECEIVED() (_rl_caught_signal == SIGWINCH)
|
||||
|
||||
#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
|
||||
#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
|
||||
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Global structs undocumented in texinfo manual and not in readline.h *
|
||||
|
@ -93,11 +86,9 @@ typedef struct __rl_search_context
|
|||
int history_pos;
|
||||
int direction;
|
||||
|
||||
int prevc;
|
||||
int lastc;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char mb[MB_LEN_MAX];
|
||||
char pmb[MB_LEN_MAX];
|
||||
#endif
|
||||
|
||||
char *sline;
|
||||
|
@ -165,8 +156,6 @@ typedef struct __rl_callback_generic_arg
|
|||
|
||||
typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
|
||||
|
||||
typedef void _rl_sigcleanup_func_t PARAMS((int, void *));
|
||||
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Global functions undocumented in texinfo manual and not in readline.h *
|
||||
|
@ -184,15 +173,12 @@ extern int rl_complete_with_tilde_expansion;
|
|||
#if defined (VISIBLE_STATS)
|
||||
extern int rl_visible_stats;
|
||||
#endif /* VISIBLE_STATS */
|
||||
#if defined (COLOR_SUPPORT)
|
||||
extern int _rl_colored_stats;
|
||||
extern int _rl_colored_completion_prefix;
|
||||
#endif
|
||||
|
||||
/* readline.c */
|
||||
extern int rl_line_buffer_len;
|
||||
extern int rl_arg_sign;
|
||||
extern int rl_visible_prompt_length;
|
||||
extern int rl_key_sequence_length;
|
||||
extern int rl_byte_oriented;
|
||||
|
||||
/* display.c */
|
||||
|
@ -203,7 +189,7 @@ extern int rl_blink_matching_paren;
|
|||
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Global functions and variables unused and undocumented *
|
||||
* Global functions and variables unsed and undocumented *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
|
@ -254,7 +240,6 @@ extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
|
|||
#endif /* READLINE_CALLBACKS */
|
||||
|
||||
/* bind.c */
|
||||
extern char *_rl_untranslate_macro_value PARAMS((char *, int));
|
||||
|
||||
/* complete.c */
|
||||
extern void _rl_reset_completion_state PARAMS((void));
|
||||
|
@ -263,7 +248,6 @@ extern void _rl_free_match_list PARAMS((char **));
|
|||
|
||||
/* display.c */
|
||||
extern char *_rl_strip_prompt PARAMS((char *));
|
||||
extern void _rl_reset_prompt PARAMS((void));
|
||||
extern void _rl_move_cursor_relative PARAMS((int, const char *));
|
||||
extern void _rl_move_vert PARAMS((int));
|
||||
extern void _rl_save_prompt PARAMS((void));
|
||||
|
@ -292,24 +276,12 @@ extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
|
|||
|
||||
extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
|
||||
extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
|
||||
extern int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
|
||||
|
||||
extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
|
||||
|
||||
/* kill.c */
|
||||
#define BRACK_PASTE_PREF "\033[200~"
|
||||
#define BRACK_PASTE_SUFF "\033[201~"
|
||||
|
||||
#define BRACK_PASTE_LAST '~'
|
||||
#define BRACK_PASTE_SLEN 6
|
||||
|
||||
#define BRACK_PASTE_INIT "\033[?2004h"
|
||||
#define BRACK_PASTE_FINI "\033[?2004l"
|
||||
|
||||
/* macro.c */
|
||||
extern void _rl_with_macro_input PARAMS((char *));
|
||||
extern int _rl_next_macro_key PARAMS((void));
|
||||
extern int _rl_prev_macro_key PARAMS((void));
|
||||
extern void _rl_push_executing_macro PARAMS((void));
|
||||
extern void _rl_pop_executing_macro PARAMS((void));
|
||||
extern void _rl_add_macro_char PARAMS((int));
|
||||
|
@ -347,7 +319,6 @@ extern int _rl_restore_tty_signals PARAMS((void));
|
|||
|
||||
/* search.c */
|
||||
extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
|
||||
extern int _rl_nsearch_cleanup PARAMS((_rl_search_cxt *, int));
|
||||
|
||||
/* signals.c */
|
||||
extern void _rl_signal_handler PARAMS((int));
|
||||
|
@ -359,7 +330,6 @@ extern void _rl_release_sigwinch PARAMS((void));
|
|||
|
||||
/* terminal.c */
|
||||
extern void _rl_get_screen_size PARAMS((int, int));
|
||||
extern void _rl_sigwinch_resize_terminal PARAMS((void));
|
||||
extern int _rl_init_terminal_io PARAMS((const char *));
|
||||
#ifdef _MINIX
|
||||
extern void _rl_output_character_function PARAMS((int));
|
||||
|
@ -369,7 +339,6 @@ extern int _rl_output_character_function PARAMS((int));
|
|||
extern void _rl_output_some_chars PARAMS((const char *, int));
|
||||
extern int _rl_backspace PARAMS((int));
|
||||
extern void _rl_enable_meta_key PARAMS((void));
|
||||
extern void _rl_disable_meta_key PARAMS((void));
|
||||
extern void _rl_control_keypad PARAMS((int));
|
||||
extern void _rl_set_cursor PARAMS((int, int));
|
||||
|
||||
|
@ -391,7 +360,6 @@ extern int _rl_set_mark_at_pos PARAMS((int));
|
|||
/* undo.c */
|
||||
extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
|
||||
extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
|
||||
extern void _rl_free_undo_list PARAMS((UNDO_LIST *));
|
||||
|
||||
/* util.c */
|
||||
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
|
||||
|
@ -403,7 +371,6 @@ extern void _rl_ttymsg ();
|
|||
extern void _rl_errmsg ();
|
||||
extern void _rl_trace ();
|
||||
#endif
|
||||
extern void _rl_audit_tty PARAMS((char *));
|
||||
|
||||
extern int _rl_tropen PARAMS((void));
|
||||
|
||||
|
@ -424,7 +391,6 @@ extern void _rl_vi_initialize_line PARAMS((void));
|
|||
extern void _rl_vi_reset_last PARAMS((void));
|
||||
extern void _rl_vi_set_last PARAMS((int, int, int));
|
||||
extern int _rl_vi_textmod_command PARAMS((int));
|
||||
extern int _rl_vi_motion_command PARAMS((int));
|
||||
extern void _rl_vi_done_inserting PARAMS((void));
|
||||
extern int _rl_vi_domove_callback PARAMS((_rl_vimotion_cxt *));
|
||||
|
||||
|
@ -461,13 +427,6 @@ extern int _rl_last_c_pos;
|
|||
extern int _rl_suppress_redisplay;
|
||||
extern int _rl_want_redisplay;
|
||||
|
||||
extern char *_rl_emacs_mode_str;
|
||||
extern int _rl_emacs_modestr_len;
|
||||
extern char *_rl_vi_ins_mode_str;
|
||||
extern int _rl_vi_ins_modestr_len;
|
||||
extern char *_rl_vi_cmd_mode_str;
|
||||
extern int _rl_vi_cmd_modestr_len;
|
||||
|
||||
/* isearch.c */
|
||||
extern char *_rl_isearch_terminators;
|
||||
|
||||
|
@ -482,9 +441,6 @@ extern int _rl_history_saved_point;
|
|||
|
||||
extern _rl_arg_cxt _rl_argcxt;
|
||||
|
||||
/* nls.c */
|
||||
extern int _rl_utf8locale;
|
||||
|
||||
/* readline.c */
|
||||
extern int _rl_echoing_p;
|
||||
extern int _rl_horizontal_scroll_mode;
|
||||
|
@ -496,8 +452,6 @@ extern int _rl_output_meta_chars;
|
|||
extern int _rl_bind_stty_chars;
|
||||
extern int _rl_revert_all_at_newline;
|
||||
extern int _rl_echo_control_chars;
|
||||
extern int _rl_show_mode_in_prompt;
|
||||
extern int _rl_enable_bracketed_paste;
|
||||
extern char *_rl_comment_begin;
|
||||
extern unsigned char _rl_parsing_conditionalized_out;
|
||||
extern Keymap _rl_keymap;
|
||||
|
@ -507,9 +461,6 @@ extern int _rl_last_command_was_kill;
|
|||
extern int _rl_eof_char;
|
||||
extern procenv_t _rl_top_level;
|
||||
extern _rl_keyseq_cxt *_rl_kscxt;
|
||||
extern int _rl_keyseq_timeout;
|
||||
|
||||
extern int _rl_executing_keyseq_size;
|
||||
|
||||
/* search.c */
|
||||
extern _rl_search_cxt *_rl_nscxt;
|
||||
|
@ -518,9 +469,6 @@ extern _rl_search_cxt *_rl_nscxt;
|
|||
extern int _rl_interrupt_immediately;
|
||||
extern int volatile _rl_caught_signal;
|
||||
|
||||
extern _rl_sigcleanup_func_t *_rl_sigcleanup;
|
||||
extern void *_rl_sigcleanarg;
|
||||
|
||||
extern int _rl_echoctl;
|
||||
|
||||
extern int _rl_intr_char;
|
||||
|
@ -547,9 +495,6 @@ extern int _rl_screenchars;
|
|||
extern int _rl_terminal_can_insert;
|
||||
extern int _rl_term_autowrap;
|
||||
|
||||
/* text.c */
|
||||
extern int _rl_optimize_typeahead;
|
||||
|
||||
/* undo.c */
|
||||
extern int _rl_doing_an_undo;
|
||||
extern int _rl_undo_group_level;
|
||||
|
|
|
@ -42,16 +42,4 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* Moved from config.h.in because readline.h:rl_message depends on these
|
||||
defines. */
|
||||
#if defined (__STDC__) && defined (HAVE_STDARG_H)
|
||||
# define PREFER_STDARG
|
||||
# define USE_VARARGS
|
||||
#else
|
||||
# if defined (HAVE_VARARGS_H)
|
||||
# define PREFER_VARARGS
|
||||
# define USE_VARARGS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* !_RL_STDC_H_ */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* Copyright (C) 1992-2005 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.
|
||||
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
|
||||
|
@ -37,11 +37,11 @@
|
|||
|
||||
#include "rldefs.h"
|
||||
|
||||
#include "rltty.h"
|
||||
#if defined (HAVE_SYS_IOCTL_H)
|
||||
# include <sys/ioctl.h> /* include for declaration of ioctl */
|
||||
#endif
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
#include "rltty.h"
|
||||
#include "readline.h"
|
||||
#include "rlprivate.h"
|
||||
|
||||
|
@ -60,13 +60,7 @@ static void set_winsize PARAMS((int));
|
|||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Non-zero means that the terminal is in a prepped state. There are several
|
||||
flags that are OR'd in to denote whether or not we have sent various
|
||||
init strings to the terminal. */
|
||||
#define TPX_PREPPED 0x01
|
||||
#define TPX_BRACKPASTE 0x02
|
||||
#define TPX_METAKEY 0x04
|
||||
|
||||
/* Non-zero means that the terminal is in a prepped state. */
|
||||
static int terminal_prepped;
|
||||
|
||||
static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
|
||||
|
@ -127,7 +121,7 @@ static int set_tty_settings PARAMS((int, TIOTYPE *));
|
|||
|
||||
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
|
||||
|
||||
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *));
|
||||
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t));
|
||||
|
||||
static void
|
||||
save_tty_chars (tiop)
|
||||
|
@ -347,7 +341,7 @@ static int set_tty_settings PARAMS((int, TIOTYPE *));
|
|||
|
||||
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
|
||||
|
||||
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *));
|
||||
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t));
|
||||
static void _rl_bind_tty_special_chars PARAMS((Keymap, TIOTYPE));
|
||||
|
||||
#if defined (FLUSHO)
|
||||
|
@ -534,10 +528,10 @@ prepare_terminal_settings (meta_flag, oldtio, tiop)
|
|||
|
||||
#if defined (USE_XON_XOFF)
|
||||
#if defined (IXANY)
|
||||
tiop->c_iflag &= ~(IXON | IXANY);
|
||||
tiop->c_iflag &= ~(IXON | IXOFF | IXANY);
|
||||
#else
|
||||
/* `strict' Posix systems do not define IXANY. */
|
||||
tiop->c_iflag &= ~IXON;
|
||||
tiop->c_iflag &= ~(IXON | IXOFF);
|
||||
#endif /* IXANY */
|
||||
#endif /* USE_XON_XOFF */
|
||||
|
||||
|
@ -601,7 +595,7 @@ void
|
|||
rl_prep_terminal (meta_flag)
|
||||
int meta_flag;
|
||||
{
|
||||
int tty, nprep;
|
||||
int tty;
|
||||
TIOTYPE tio;
|
||||
|
||||
if (terminal_prepped)
|
||||
|
@ -648,7 +642,7 @@ rl_prep_terminal (meta_flag)
|
|||
/* If editing in vi mode, make sure we set the bindings in the
|
||||
insertion keymap no matter what keymap we ended up in. */
|
||||
if (rl_editing_mode == vi_mode)
|
||||
_rl_bind_tty_special_chars (vi_insertion_keymap, tio);
|
||||
_rl_bind_tty_special_chars (vi_insertion_keymap, tio);
|
||||
else
|
||||
#endif
|
||||
_rl_bind_tty_special_chars (_rl_keymap, tio);
|
||||
|
@ -665,16 +659,8 @@ rl_prep_terminal (meta_flag)
|
|||
if (_rl_enable_keypad)
|
||||
_rl_control_keypad (1);
|
||||
|
||||
nprep = TPX_PREPPED;
|
||||
|
||||
if (_rl_enable_bracketed_paste)
|
||||
{
|
||||
fprintf (rl_outstream, BRACK_PASTE_INIT);
|
||||
nprep |= TPX_BRACKPASTE;
|
||||
}
|
||||
|
||||
fflush (rl_outstream);
|
||||
terminal_prepped = nprep;
|
||||
terminal_prepped = 1;
|
||||
RL_SETSTATE(RL_STATE_TERMPREPPED);
|
||||
|
||||
_rl_release_sigint ();
|
||||
|
@ -686,16 +672,13 @@ rl_deprep_terminal ()
|
|||
{
|
||||
int tty;
|
||||
|
||||
if (terminal_prepped == 0)
|
||||
if (!terminal_prepped)
|
||||
return;
|
||||
|
||||
/* Try to keep this function from being interrupted. */
|
||||
_rl_block_sigint ();
|
||||
|
||||
tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
|
||||
|
||||
if (terminal_prepped & TPX_BRACKPASTE)
|
||||
fprintf (rl_outstream, BRACK_PASTE_FINI);
|
||||
tty = rl_instream ? fileno (rl_instream) : fileno (stdout);
|
||||
|
||||
if (_rl_enable_keypad)
|
||||
_rl_control_keypad (0);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* rltypedefs.h -- Type declarations for readline functions. */
|
||||
|
||||
/* Copyright (C) 2000-2011 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000-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.
|
||||
|
@ -26,22 +26,15 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Old-style, attempt to mark as deprecated in some way people will notice. */
|
||||
/* Old-style */
|
||||
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
typedef int Function () __attribute__ ((deprecated));
|
||||
typedef void VFunction () __attribute__ ((deprecated));
|
||||
typedef char *CPFunction () __attribute__ ((deprecated));
|
||||
typedef char **CPPFunction () __attribute__ ((deprecated));
|
||||
#else
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction ();
|
||||
typedef char **CPPFunction ();
|
||||
#endif
|
||||
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* search.c - code for non-incremental searching in emacs and vi modes. */
|
||||
|
||||
/* Copyright (C) 1992-2013 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992-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.
|
||||
|
@ -43,7 +43,6 @@
|
|||
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
#include "histlib.h"
|
||||
|
||||
#include "rlprivate.h"
|
||||
#include "xmalloc.h"
|
||||
|
@ -67,8 +66,6 @@ static char *prev_line_found = (char *) NULL;
|
|||
|
||||
static int rl_history_search_len;
|
||||
static int rl_history_search_pos;
|
||||
static int rl_history_search_flags;
|
||||
|
||||
static char *history_search_string;
|
||||
static int history_string_size;
|
||||
|
||||
|
@ -77,9 +74,10 @@ static int noninc_search_from_pos PARAMS((char *, int, int));
|
|||
static int noninc_dosearch PARAMS((char *, int));
|
||||
static int noninc_search PARAMS((int, int));
|
||||
static int rl_history_search_internal PARAMS((int, int));
|
||||
static void rl_history_search_reinit PARAMS((int));
|
||||
static void rl_history_search_reinit PARAMS((void));
|
||||
|
||||
static _rl_search_cxt *_rl_nsearch_init PARAMS((int, int));
|
||||
static int _rl_nsearch_cleanup PARAMS((_rl_search_cxt *, int));
|
||||
static void _rl_nsearch_abort PARAMS((_rl_search_cxt *));
|
||||
static int _rl_nsearch_dispatch PARAMS((_rl_search_cxt *, int));
|
||||
|
||||
|
@ -171,8 +169,7 @@ noninc_dosearch (string, dir)
|
|||
|
||||
oldpos = where_history ();
|
||||
history_set_pos (noninc_history_pos);
|
||||
entry = current_history (); /* will never be NULL after successful search */
|
||||
|
||||
entry = current_history ();
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode != vi_mode)
|
||||
#endif
|
||||
|
@ -223,7 +220,7 @@ _rl_nsearch_init (dir, pchar)
|
|||
return cxt;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
_rl_nsearch_cleanup (cxt, r)
|
||||
_rl_search_cxt *cxt;
|
||||
int r;
|
||||
|
@ -410,7 +407,7 @@ rl_noninc_forward_search_again (count, key)
|
|||
if (!noninc_search_string)
|
||||
{
|
||||
rl_ding ();
|
||||
return (1);
|
||||
return (-1);
|
||||
}
|
||||
r = noninc_dosearch (noninc_search_string, 1);
|
||||
return (r != 1);
|
||||
|
@ -427,7 +424,7 @@ rl_noninc_reverse_search_again (count, key)
|
|||
if (!noninc_search_string)
|
||||
{
|
||||
rl_ding ();
|
||||
return (1);
|
||||
return (-1);
|
||||
}
|
||||
r = noninc_dosearch (noninc_search_string, -1);
|
||||
return (r != 1);
|
||||
|
@ -456,19 +453,15 @@ rl_history_search_internal (count, dir)
|
|||
{
|
||||
HIST_ENTRY *temp;
|
||||
int ret, oldpos;
|
||||
char *t;
|
||||
|
||||
rl_maybe_save_line ();
|
||||
temp = (HIST_ENTRY *)NULL;
|
||||
|
||||
/* Search COUNT times through the history for a line matching
|
||||
history_search_string. If history_search_string[0] == '^', the
|
||||
line must match from the start; otherwise any substring can match.
|
||||
When this loop finishes, TEMP, if non-null, is the history line to
|
||||
copy into the line buffer. */
|
||||
/* Search COUNT times through the history for a line whose prefix
|
||||
matches history_search_string. When this loop finishes, TEMP,
|
||||
if non-null, is the history line to copy into the line buffer. */
|
||||
while (count)
|
||||
{
|
||||
RL_CHECK_SIGNALS ();
|
||||
ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir);
|
||||
if (ret == -1)
|
||||
break;
|
||||
|
@ -477,7 +470,7 @@ rl_history_search_internal (count, dir)
|
|||
rl_history_search_pos = ret;
|
||||
oldpos = where_history ();
|
||||
history_set_pos (rl_history_search_pos);
|
||||
temp = current_history (); /* will never be NULL after successful search */
|
||||
temp = current_history ();
|
||||
history_set_pos (oldpos);
|
||||
|
||||
/* Don't find multiple instances of the same line. */
|
||||
|
@ -512,49 +505,35 @@ rl_history_search_internal (count, dir)
|
|||
/* Copy the line we found into the current line buffer. */
|
||||
make_history_line_current (temp);
|
||||
|
||||
if (rl_history_search_flags & ANCHORED_SEARCH)
|
||||
rl_point = rl_history_search_len; /* easy case */
|
||||
else
|
||||
{
|
||||
t = strstr (rl_line_buffer, history_search_string);
|
||||
rl_point = t ? (int)(t - rl_line_buffer) + rl_history_search_len : rl_end;
|
||||
}
|
||||
rl_point = rl_history_search_len;
|
||||
rl_mark = rl_end;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
rl_history_search_reinit (flags)
|
||||
int flags;
|
||||
rl_history_search_reinit ()
|
||||
{
|
||||
int sind;
|
||||
|
||||
rl_history_search_pos = where_history ();
|
||||
rl_history_search_len = rl_point;
|
||||
rl_history_search_flags = flags;
|
||||
|
||||
prev_line_found = (char *)NULL;
|
||||
if (rl_point)
|
||||
{
|
||||
/* Allocate enough space for anchored and non-anchored searches */
|
||||
if (rl_history_search_len >= history_string_size - 2)
|
||||
{
|
||||
history_string_size = rl_history_search_len + 2;
|
||||
history_search_string = (char *)xrealloc (history_search_string, history_string_size);
|
||||
}
|
||||
sind = 0;
|
||||
if (flags & ANCHORED_SEARCH)
|
||||
history_search_string[sind++] = '^';
|
||||
strncpy (history_search_string + sind, rl_line_buffer, rl_point);
|
||||
history_search_string[rl_point + sind] = '\0';
|
||||
history_search_string[0] = '^';
|
||||
strncpy (history_search_string + 1, rl_line_buffer, rl_point);
|
||||
history_search_string[rl_point + 1] = '\0';
|
||||
}
|
||||
_rl_free_saved_history_line ();
|
||||
}
|
||||
|
||||
/* Search forward in the history for the string of characters
|
||||
from the start of the line to rl_point. This is a non-incremental
|
||||
search. The search is anchored to the beginning of the history line. */
|
||||
search. */
|
||||
int
|
||||
rl_history_search_forward (count, ignore)
|
||||
int count, ignore;
|
||||
|
@ -564,7 +543,7 @@ rl_history_search_forward (count, ignore)
|
|||
|
||||
if (rl_last_func != rl_history_search_forward &&
|
||||
rl_last_func != rl_history_search_backward)
|
||||
rl_history_search_reinit (ANCHORED_SEARCH);
|
||||
rl_history_search_reinit ();
|
||||
|
||||
if (rl_history_search_len == 0)
|
||||
return (rl_get_next_history (count, ignore));
|
||||
|
@ -583,46 +562,7 @@ rl_history_search_backward (count, ignore)
|
|||
|
||||
if (rl_last_func != rl_history_search_forward &&
|
||||
rl_last_func != rl_history_search_backward)
|
||||
rl_history_search_reinit (ANCHORED_SEARCH);
|
||||
|
||||
if (rl_history_search_len == 0)
|
||||
return (rl_get_previous_history (count, ignore));
|
||||
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
|
||||
}
|
||||
|
||||
/* Search forward in the history for the string of characters
|
||||
from the start of the line to rl_point. This is a non-incremental
|
||||
search. The search succeeds if the search string is present anywhere
|
||||
in the history line. */
|
||||
int
|
||||
rl_history_substr_search_forward (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
if (count == 0)
|
||||
return (0);
|
||||
|
||||
if (rl_last_func != rl_history_substr_search_forward &&
|
||||
rl_last_func != rl_history_substr_search_backward)
|
||||
rl_history_search_reinit (NON_ANCHORED_SEARCH);
|
||||
|
||||
if (rl_history_search_len == 0)
|
||||
return (rl_get_next_history (count, ignore));
|
||||
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
|
||||
}
|
||||
|
||||
/* Search backward through the history for the string of characters
|
||||
from the start of the line to rl_point. This is a non-incremental
|
||||
search. */
|
||||
int
|
||||
rl_history_substr_search_backward (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
if (count == 0)
|
||||
return (0);
|
||||
|
||||
if (rl_last_func != rl_history_substr_search_forward &&
|
||||
rl_last_func != rl_history_substr_search_backward)
|
||||
rl_history_search_reinit (NON_ANCHORED_SEARCH);
|
||||
rl_history_search_reinit ();
|
||||
|
||||
if (rl_history_search_len == 0)
|
||||
return (rl_get_previous_history (count, ignore));
|
||||
|
|
|
@ -59,8 +59,6 @@
|
|||
|
||||
#include "rlstdc.h"
|
||||
#include "rlshell.h"
|
||||
#include "rldefs.h"
|
||||
|
||||
#include "xmalloc.h"
|
||||
|
||||
#if defined (HAVE_GETPWUID) && !defined (HAVE_GETPW_DECLS)
|
||||
|
@ -122,27 +120,31 @@ sh_single_quote (string)
|
|||
|
||||
/* Set the environment variables LINES and COLUMNS to lines and cols,
|
||||
respectively. */
|
||||
static char setenv_buf[INT_STRLEN_BOUND (int) + 1];
|
||||
static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */
|
||||
static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */
|
||||
|
||||
void
|
||||
sh_set_lines_and_columns (lines, cols)
|
||||
int lines, cols;
|
||||
{
|
||||
#if defined (HAVE_SETENV)
|
||||
sprintf (setenv_buf, "%d", lines);
|
||||
setenv ("LINES", setenv_buf, 1);
|
||||
char *b;
|
||||
|
||||
sprintf (setenv_buf, "%d", cols);
|
||||
setenv ("COLUMNS", setenv_buf, 1);
|
||||
#if defined (HAVE_SETENV)
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
|
||||
sprintf (b, "%d", lines);
|
||||
setenv ("LINES", b, 1);
|
||||
xfree (b);
|
||||
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
|
||||
sprintf (b, "%d", cols);
|
||||
setenv ("COLUMNS", b, 1);
|
||||
xfree (b);
|
||||
#else /* !HAVE_SETENV */
|
||||
# if defined (HAVE_PUTENV)
|
||||
sprintf (putenv_buf1, "LINES=%d", lines);
|
||||
putenv (putenv_buf1);
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
|
||||
sprintf (b, "LINES=%d", lines);
|
||||
putenv (b);
|
||||
|
||||
sprintf (putenv_buf2, "COLUMNS=%d", cols);
|
||||
putenv (putenv_buf2);
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
|
||||
sprintf (b, "COLUMNS=%d", cols);
|
||||
putenv (b);
|
||||
# endif /* HAVE_PUTENV */
|
||||
#endif /* !HAVE_SETENV */
|
||||
}
|
||||
|
@ -157,27 +159,15 @@ sh_get_env_value (varname)
|
|||
char *
|
||||
sh_get_home_dir ()
|
||||
{
|
||||
static char *home_dir = (char *)NULL;
|
||||
char *home_dir;
|
||||
struct passwd *entry;
|
||||
|
||||
if (home_dir)
|
||||
return (home_dir);
|
||||
|
||||
home_dir = (char *)NULL;
|
||||
#if defined (HAVE_GETPWUID)
|
||||
# if defined (__TANDEM)
|
||||
entry = getpwnam (getlogin ());
|
||||
# else
|
||||
entry = getpwuid (getuid ());
|
||||
# endif
|
||||
if (entry)
|
||||
home_dir = savestring (entry->pw_dir);
|
||||
home_dir = entry->pw_dir;
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_GETPWENT)
|
||||
endpwent (); /* some systems need this */
|
||||
#endif
|
||||
|
||||
return (home_dir);
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ SHLIB_MINOR= .@SHLIB_MINOR@
|
|||
# For libraries which include headers from other libraries.
|
||||
INCLUDES = -I. -I.. -I$(topdir)
|
||||
|
||||
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(INCLUDES) $(CPPFLAGS) $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
|
||||
.SUFFIXES: .so
|
||||
|
||||
|
@ -134,29 +134,21 @@ CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \
|
|||
$(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \
|
||||
$(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c \
|
||||
$(topdir)/text.c $(topdir)/misc.c $(topdir)/compat.c \
|
||||
$(topdir)/colors.c $(topdir)/parse-colors.c \
|
||||
$(topdir)/mbutil.c $(topdir)/xfree.c
|
||||
$(topdir)/mbutil.c
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = $(topdir)/readline.h $(topdir)/rldefs.h $(topdir)/chardefs.h \
|
||||
$(topdir)/keymaps.h $(topdir)/history.h $(topdir)/histlib.h \
|
||||
$(topdir)/posixstat.h $(topdir)/posixdir.h $(topdir)/posixjmp.h \
|
||||
$(topdir)/tilde.h $(topdir)/rlconf.h $(topdir)/rltty.h \
|
||||
$(topdir)/ansi_stdlib.h $(topdir)/tcap.h $(topdir)/rlstdc.h \
|
||||
$(topdir)/xmalloc.h $(topdir)/rlprivate.h $(topdir)/rlshell.h \
|
||||
$(topdir)/rltypedefs.h $(topdir)/rlmbutil.h \
|
||||
$(topdir)/colors.h $(topdir)/parse-colors.h
|
||||
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
|
||||
posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
|
||||
ansi_stdlib.h tcap.h xmalloc.h rlprivate.h rlshell.h rlmbutil.h
|
||||
|
||||
SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so \
|
||||
mbutil.so
|
||||
SHARED_TILDEOBJ = tilde.so
|
||||
SHARED_COLORSOBJ = colors.so parse-colors.so
|
||||
SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
|
||||
rltty.so complete.so bind.so isearch.so display.so signals.so \
|
||||
util.so kill.so undo.so macro.so input.so callback.so terminal.so \
|
||||
text.so nls.so misc.so \
|
||||
$(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) $(SHARED_COLORSOBJ) \
|
||||
xmalloc.so xfree.so compat.so
|
||||
text.so nls.so misc.so xmalloc.so xfree.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \
|
||||
compat.so
|
||||
|
||||
##########################################################################
|
||||
|
||||
|
@ -191,26 +183,16 @@ installdirs: $(topdir)/support/mkdirs
|
|||
-$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(libdir)
|
||||
-$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(bindir)
|
||||
|
||||
install-supported: installdirs $(SHLIB_STATUS)
|
||||
install: installdirs $(SHLIB_STATUS)
|
||||
$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
|
||||
$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
|
||||
@echo install: you may need to run ldconfig
|
||||
|
||||
install-unsupported:
|
||||
@echo install: shared libraries not supported
|
||||
|
||||
install: install-$(SHLIB_STATUS)
|
||||
|
||||
uninstall-supported:
|
||||
uninstall:
|
||||
$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_HISTORY)
|
||||
$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_READLINE)
|
||||
@echo uninstall: you may need to run ldconfig
|
||||
|
||||
uninstall-unsupported:
|
||||
@echo uninstall: shared libraries not supported
|
||||
|
||||
uninstall: uninstall-$(SHLIB_STATUS)
|
||||
|
||||
clean mostlyclean: force
|
||||
$(RM) $(SHARED_OBJ) $(SHARED_LIBS)
|
||||
|
||||
|
@ -229,14 +211,13 @@ bind.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
|
|||
bind.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
|
||||
bind.so: $(topdir)/rltypedefs.h
|
||||
bind.so: $(topdir)/tilde.h $(topdir)/history.h
|
||||
compat.so: ${BUILD_DIR}/config.h
|
||||
compat.so: $(topdir)/rlstdc.h $(topdir)/rltypedefs.h
|
||||
compat.so: $(topdir)/rlstdc.h
|
||||
callback.so: $(topdir)/rlconf.h
|
||||
callback.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h
|
||||
callback.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
|
||||
callback.so: $(topdir)/rltypedefs.h
|
||||
callback.so: $(topdir)/tilde.h
|
||||
complete.so: $(topdir)/ansi_stdlib.h $(topdir)/posixdir.h $(topdir)/posixstat.h
|
||||
complete.so: $(topdir)/ansi_stdlib.h posixdir.h $(topdir)/posixstat.h
|
||||
complete.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
|
||||
complete.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
|
||||
complete.so: $(topdir)/rltypedefs.h
|
||||
|
@ -272,6 +253,7 @@ isearch.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
|
|||
isearch.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
|
||||
isearch.so: $(topdir)/rltypedefs.h
|
||||
isearch.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h
|
||||
keymaps.so: emacs_keymap.c vi_keymap.c
|
||||
keymaps.so: $(topdir)/keymaps.h $(topdir)/chardefs.h $(topdir)/rlconf.h
|
||||
keymaps.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
|
||||
keymaps.so: $(topdir)/rltypedefs.h
|
||||
|
@ -304,7 +286,6 @@ rltty.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
|
|||
rltty.so: $(topdir)/rltty.h $(topdir)/tilde.h
|
||||
rltty.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
|
||||
rltty.so: $(topdir)/rltypedefs.h
|
||||
savestring.so: ${BUILD_DIR}/config.h
|
||||
search.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
|
||||
search.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
|
||||
search.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h
|
||||
|
@ -349,16 +330,6 @@ shell.so: $(topdir)/rlshell.h
|
|||
terminal.so: $(topdir)/rlshell.h
|
||||
histexpand.so: $(topdir)/rlshell.h
|
||||
|
||||
colors.so: $(BUILD_DIR)/config.h $(topdir)/colors.h
|
||||
colors.so: $(topdir)/rlconf.h
|
||||
colors.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/rltypedefs.h
|
||||
colors.so: $(topdir)/chardefs.h $(topdir)/tilde.h $(topdir)/rlstdc.h
|
||||
colors.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h
|
||||
parse-colors.so: $(BUILD_DIR)/config.h $(topdir)/colors.h $(topdir)/parse-colors.h
|
||||
parse-colors.so: $(topdir)/rldefs.h $(topdir)/rlconf.h
|
||||
parse-colors.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/rltypedefs.h
|
||||
parse-colors.so: $(topdir)/chardefs.h $(topdir)/tilde.h $(topdir)/rlstdc.h
|
||||
|
||||
bind.so: $(topdir)/rlprivate.h
|
||||
callback.so: $(topdir)/rlprivate.h
|
||||
complete.so: $(topdir)/rlprivate.h
|
||||
|
@ -380,11 +351,8 @@ text.so: $(topdir)/rlprivate.h
|
|||
undo.so: $(topdir)/rlprivate.h
|
||||
util.so: $(topdir)/rlprivate.h
|
||||
vi_mode.so: $(topdir)/rlprivate.h
|
||||
colors.so: $(topdir)/rlprivate.h
|
||||
parse-colors.so: $(topdir)/rlprivate.h
|
||||
|
||||
bind.so: $(topdir)/xmalloc.h
|
||||
callback.so: $(topdir)/xmalloc.h
|
||||
complete.so: $(topdir)/xmalloc.h
|
||||
display.so: $(topdir)/xmalloc.h
|
||||
funmap.so: $(topdir)/xmalloc.h
|
||||
|
@ -410,22 +378,18 @@ util.so: $(topdir)/xmalloc.h
|
|||
vi_mode.so: $(topdir)/xmalloc.h
|
||||
xfree.so: $(topdir)/xmalloc.h
|
||||
xmalloc.so: $(topdir)/xmalloc.h
|
||||
colors.so: $(topdir)/xmalloc.h
|
||||
parse-colors.so: $(topdir)/xmalloc.h
|
||||
|
||||
complete.so: $(topdir)/rlmbutil.h
|
||||
display.so: $(topdir)/rlmbutil.h
|
||||
histexpand.so: $(topdir)/rlmbutil.h
|
||||
input.so: $(topdir)/rlmbutil.h
|
||||
isearch.so: $(topdir)/rlmbutil.h
|
||||
mbutil.so: $(topdir)/rlmbutil.h
|
||||
misc.so: $(topdir)/rlmbutil.h
|
||||
readline.so: $(topdir)/rlmbutil.h
|
||||
search.so: $(topdir)/rlmbutil.h
|
||||
text.so: $(topdir)/rlmbutil.h
|
||||
vi_mode.so: $(topdir)/rlmbutil.h
|
||||
colors.so: $(topdir)/rlmbutil.h
|
||||
parse-colors.so: $(topdir)/rlmbutil.h
|
||||
complete.o: $(topdir)/rlmbutil.h
|
||||
display.o: $(topdir)/rlmbutil.h
|
||||
histexpand.o: $(topdir)/rlmbutil.h
|
||||
input.o: $(topdir)/rlmbutil.h
|
||||
isearch.o: $(topdir)/rlmbutil.h
|
||||
mbutil.o: $(topdir)/rlmbutil.h
|
||||
misc.o: $(topdir)/rlmbutil.h
|
||||
readline.o: $(topdir)/rlmbutil.h
|
||||
search.o: $(topdir)/rlmbutil.h
|
||||
text.o: $(topdir)/rlmbutil.h
|
||||
vi_mode.o: $(topdir)/rlmbutil.h
|
||||
|
||||
bind.so: $(topdir)/bind.c
|
||||
callback.so: $(topdir)/callback.c
|
||||
|
@ -492,9 +456,6 @@ vi_mode.so: vi_mode.c
|
|||
xfree.so: xfree.c
|
||||
xmalloc.so: xmalloc.c
|
||||
|
||||
colors.so: colors.c
|
||||
parse-colors.so: parse-colors.c
|
||||
|
||||
histexpand.so: histexpand.c
|
||||
histfile.so: histfile.c
|
||||
history.so: history.c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* signals.c -- signal handling support for readline. */
|
||||
|
||||
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
|
||||
/* 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.
|
||||
|
@ -80,7 +80,6 @@ typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt
|
|||
|
||||
static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
|
||||
static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
|
||||
static void rl_maybe_restore_sighandler PARAMS((int, sighandler_cxt *));
|
||||
|
||||
static RETSIGTYPE rl_signal_handler PARAMS((int));
|
||||
static RETSIGTYPE _rl_handle_signal PARAMS((int));
|
||||
|
@ -88,7 +87,7 @@ static RETSIGTYPE _rl_handle_signal PARAMS((int));
|
|||
/* Exported variables for use by applications. */
|
||||
|
||||
/* If non-zero, readline will install its own signal handlers for
|
||||
SIGINT, SIGTERM, SIGHUP, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
|
||||
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
|
||||
int rl_catch_signals = 1;
|
||||
|
||||
/* If non-zero, readline will install a signal handler for SIGWINCH. */
|
||||
|
@ -119,7 +118,7 @@ static int sigwinch_set_flag;
|
|||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static sighandler_cxt old_int, old_term, old_hup, old_alrm, old_quit;
|
||||
static sighandler_cxt old_int, old_term, old_alrm, old_quit;
|
||||
#if defined (SIGTSTP)
|
||||
static sighandler_cxt old_tstp, old_ttou, old_ttin;
|
||||
#endif
|
||||
|
@ -127,9 +126,6 @@ static sighandler_cxt old_tstp, old_ttou, old_ttin;
|
|||
static sighandler_cxt old_winch;
|
||||
#endif
|
||||
|
||||
_rl_sigcleanup_func_t *_rl_sigcleanup;
|
||||
void *_rl_sigcleanarg;
|
||||
|
||||
/* Readline signal handler functions. */
|
||||
|
||||
/* Called from RL_CHECK_SIGNALS() macro */
|
||||
|
@ -139,21 +135,7 @@ _rl_signal_handler (sig)
|
|||
{
|
||||
_rl_caught_signal = 0; /* XXX */
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
if (sig == SIGWINCH)
|
||||
{
|
||||
rl_resize_terminal ();
|
||||
/* XXX - experimental for now */
|
||||
/* Call a signal hook because though we called the original signal handler
|
||||
in rl_sigwinch_handler below, we will not resend the signal to
|
||||
ourselves. */
|
||||
if (rl_signal_event_hook)
|
||||
(*rl_signal_event_hook) ();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
_rl_handle_signal (sig);
|
||||
|
||||
_rl_handle_signal (sig);
|
||||
SIGHANDLER_RETURN;
|
||||
}
|
||||
|
||||
|
@ -161,7 +143,7 @@ static RETSIGTYPE
|
|||
rl_signal_handler (sig)
|
||||
int sig;
|
||||
{
|
||||
if (_rl_interrupt_immediately)
|
||||
if (_rl_interrupt_immediately || RL_ISSTATE(RL_STATE_CALLBACK))
|
||||
{
|
||||
_rl_interrupt_immediately = 0;
|
||||
_rl_handle_signal (sig);
|
||||
|
@ -199,43 +181,19 @@ _rl_handle_signal (sig)
|
|||
rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
|
||||
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
|
||||
|
||||
/* If there's a sig cleanup function registered, call it and `deregister'
|
||||
the cleanup function to avoid multiple calls */
|
||||
if (_rl_sigcleanup)
|
||||
{
|
||||
(*_rl_sigcleanup) (sig, _rl_sigcleanarg);
|
||||
_rl_sigcleanup = 0;
|
||||
_rl_sigcleanarg = 0;
|
||||
}
|
||||
|
||||
switch (sig)
|
||||
{
|
||||
case SIGINT:
|
||||
_rl_reset_completion_state ();
|
||||
rl_free_line_state ();
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
rl_callback_sigcleanup ();
|
||||
#endif
|
||||
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case SIGTERM:
|
||||
#if defined (SIGTSTP)
|
||||
case SIGTSTP:
|
||||
case SIGTTIN:
|
||||
# if defined (HAVE_POSIX_SIGNALS)
|
||||
/* Block SIGTTOU so we can restore the terminal settings to something
|
||||
sane without stopping on SIGTTOU if we have been placed into the
|
||||
background. Even trying to get the current terminal pgrp with
|
||||
tcgetpgrp() will generate SIGTTOU, so we don't bother. Don't bother
|
||||
doing this if we've been stopped on SIGTTOU; it's aready too late. */
|
||||
sigemptyset (&set);
|
||||
sigaddset (&set, SIGTTOU);
|
||||
sigprocmask (SIG_BLOCK, &set, (sigset_t *)NULL);
|
||||
# endif
|
||||
case SIGTTOU:
|
||||
case SIGTTIN:
|
||||
#endif /* SIGTSTP */
|
||||
case SIGTERM:
|
||||
case SIGHUP:
|
||||
#if defined (SIGALRM)
|
||||
case SIGALRM:
|
||||
#endif
|
||||
|
@ -246,10 +204,6 @@ _rl_handle_signal (sig)
|
|||
rl_cleanup_after_signal ();
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
/* Unblock SIGTTOU blocked above */
|
||||
if (sig == SIGTTIN || sig == SIGTSTP)
|
||||
sigprocmask (SIG_UNBLOCK, &set, (sigset_t *)NULL);
|
||||
|
||||
sigemptyset (&set);
|
||||
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
|
||||
sigdelset (&set, sig);
|
||||
|
@ -278,7 +232,7 @@ _rl_handle_signal (sig)
|
|||
# endif /* HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
rl_reset_after_signal ();
|
||||
rl_reset_after_signal ();
|
||||
}
|
||||
|
||||
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
|
||||
|
@ -303,7 +257,7 @@ rl_sigwinch_handler (sig)
|
|||
#endif
|
||||
|
||||
RL_SETSTATE(RL_STATE_SIGHANDLER);
|
||||
_rl_caught_signal = sig;
|
||||
rl_resize_terminal ();
|
||||
|
||||
/* If another sigwinch handler has been installed, call it. */
|
||||
oh = (SigHandler *)old_winch.sa_handler;
|
||||
|
@ -363,8 +317,6 @@ rl_set_sighandler (sig, handler, ohandler)
|
|||
return (ohandler->sa_handler);
|
||||
}
|
||||
|
||||
/* Set disposition of SIG to HANDLER, returning old state in OHANDLER. Don't
|
||||
change disposition if OHANDLER indicates the signal was ignored. */
|
||||
static void
|
||||
rl_maybe_set_sighandler (sig, handler, ohandler)
|
||||
int sig;
|
||||
|
@ -375,29 +327,11 @@ rl_maybe_set_sighandler (sig, handler, ohandler)
|
|||
SigHandler *oh;
|
||||
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
dummy.sa_flags = 0;
|
||||
oh = rl_set_sighandler (sig, handler, ohandler);
|
||||
if (oh == (SigHandler *)SIG_IGN)
|
||||
rl_sigaction (sig, ohandler, &dummy);
|
||||
}
|
||||
|
||||
/* Set the disposition of SIG to HANDLER, if HANDLER->sa_handler indicates the
|
||||
signal was not being ignored. MUST only be called for signals whose
|
||||
disposition was changed using rl_maybe_set_sighandler or for which the
|
||||
SIG_IGN check was performed inline (e.g., SIGALRM below). */
|
||||
static void
|
||||
rl_maybe_restore_sighandler (sig, handler)
|
||||
int sig;
|
||||
sighandler_cxt *handler;
|
||||
{
|
||||
sighandler_cxt dummy;
|
||||
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
dummy.sa_flags = 0;
|
||||
if (handler->sa_handler != SIG_IGN)
|
||||
rl_sigaction (sig, handler, &dummy);
|
||||
}
|
||||
|
||||
int
|
||||
rl_set_signals ()
|
||||
{
|
||||
|
@ -415,7 +349,6 @@ rl_set_signals ()
|
|||
|
||||
sigaddset (&bset, SIGINT);
|
||||
sigaddset (&bset, SIGTERM);
|
||||
sigaddset (&bset, SIGHUP);
|
||||
#if defined (SIGQUIT)
|
||||
sigaddset (&bset, SIGQUIT);
|
||||
#endif
|
||||
|
@ -444,7 +377,6 @@ rl_set_signals ()
|
|||
|
||||
rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
|
||||
rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
|
||||
rl_maybe_set_sighandler (SIGHUP, rl_signal_handler, &old_hup);
|
||||
#if defined (SIGQUIT)
|
||||
rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
|
||||
#endif
|
||||
|
@ -502,31 +434,25 @@ rl_clear_signals ()
|
|||
{
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
|
||||
/* Since rl_maybe_set_sighandler doesn't override a SIG_IGN handler,
|
||||
we should in theory not have to restore a handler where
|
||||
old_xxx.sa_handler == SIG_IGN. That's what rl_maybe_restore_sighandler
|
||||
does. Fewer system calls should reduce readline's per-line
|
||||
overhead */
|
||||
rl_maybe_restore_sighandler (SIGINT, &old_int);
|
||||
rl_maybe_restore_sighandler (SIGTERM, &old_term);
|
||||
rl_maybe_restore_sighandler (SIGHUP, &old_hup);
|
||||
rl_sigaction (SIGINT, &old_int, &dummy);
|
||||
rl_sigaction (SIGTERM, &old_term, &dummy);
|
||||
#if defined (SIGQUIT)
|
||||
rl_maybe_restore_sighandler (SIGQUIT, &old_quit);
|
||||
rl_sigaction (SIGQUIT, &old_quit, &dummy);
|
||||
#endif
|
||||
#if defined (SIGALRM)
|
||||
rl_maybe_restore_sighandler (SIGALRM, &old_alrm);
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
#endif
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
rl_maybe_restore_sighandler (SIGTSTP, &old_tstp);
|
||||
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
|
||||
#endif /* SIGTSTP */
|
||||
|
||||
#if defined (SIGTTOU)
|
||||
rl_maybe_restore_sighandler (SIGTTOU, &old_ttou);
|
||||
rl_sigaction (SIGTTOU, &old_ttou, &dummy);
|
||||
#endif /* SIGTTOU */
|
||||
|
||||
#if defined (SIGTTIN)
|
||||
rl_maybe_restore_sighandler (SIGTTIN, &old_ttin);
|
||||
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
|
||||
#endif /* SIGTTIN */
|
||||
|
||||
signals_set_flag = 0;
|
||||
|
@ -614,6 +540,21 @@ _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;
|
||||
}
|
||||
|
||||
|
@ -624,10 +565,22 @@ _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;
|
||||
RL_CHECK_SIGNALS ();
|
||||
}
|
||||
|
||||
#ifdef SIGWINCH
|
||||
/* Cause SIGWINCH to not be delivered until the corresponding call to
|
||||
release_sigwinch(). */
|
||||
void
|
||||
|
@ -636,8 +589,6 @@ _rl_block_sigwinch ()
|
|||
if (sigwinch_blocked)
|
||||
return;
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigemptyset (&sigwinch_set);
|
||||
sigemptyset (&sigwinch_oset);
|
||||
|
@ -653,8 +604,6 @@ _rl_block_sigwinch ()
|
|||
# endif /* !HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
sigwinch_blocked = 1;
|
||||
}
|
||||
|
||||
|
@ -665,8 +614,6 @@ _rl_release_sigwinch ()
|
|||
if (sigwinch_blocked == 0)
|
||||
return;
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigprocmask (SIG_SETMASK, &sigwinch_oset, (sigset_t *)NULL);
|
||||
#else
|
||||
|
@ -679,10 +626,9 @@ _rl_release_sigwinch ()
|
|||
# endif /* !HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
sigwinch_blocked = 0;
|
||||
}
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
|
|
641
readline/support/config.guess
vendored
641
readline/support/config.guess
vendored
|
@ -1,12 +1,14 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2013-11-29'
|
||||
timestamp='2008-03-12'
|
||||
|
||||
# This file is free software; you can 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
|
@ -15,23 +17,27 @@ timestamp='2013-11-29'
|
|||
# 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/>.
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
#
|
||||
# Originally written by Per Bothner.
|
||||
#
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
#
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Originally written by Per Bothner <per@bothner.com>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit build system type.
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
usage="\
|
||||
|
@ -50,7 +56,8 @@ version="\
|
|||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -132,33 +139,12 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
|||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
case "${UNAME_SYSTEM}" in
|
||||
Linux|GNU|GNU/*)
|
||||
# If the system lacks a compiler, then just pick glibc.
|
||||
# We could probably try harder.
|
||||
LIBC=gnu
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat <<-EOF > $dummy.c
|
||||
#include <features.h>
|
||||
#if defined(__UCLIBC__)
|
||||
LIBC=uclibc
|
||||
#elif defined(__dietlibc__)
|
||||
LIBC=dietlibc
|
||||
#else
|
||||
LIBC=gnu
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||
;;
|
||||
esac
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:NetBSD:*:*)
|
||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||
# switched to ELF, *-*-netbsd* would select the old
|
||||
# object file format. This provides both forward
|
||||
|
@ -184,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ELF__
|
||||
| grep __ELF__ >/dev/null
|
||||
then
|
||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||
# Return netbsd for either. FIX?
|
||||
|
@ -194,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
fi
|
||||
;;
|
||||
*)
|
||||
os=netbsd
|
||||
os=netbsd
|
||||
;;
|
||||
esac
|
||||
# The OS release
|
||||
|
@ -215,10 +201,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit ;;
|
||||
*:Bitrig:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:OpenBSD:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
||||
|
@ -241,7 +223,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
;;
|
||||
*5.*)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
;;
|
||||
esac
|
||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||
|
@ -287,10 +269,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||
exitcode=$?
|
||||
trap '' 0
|
||||
exit $exitcode ;;
|
||||
exit ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||
|
@ -316,12 +295,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
echo s390-ibm-zvmoe
|
||||
exit ;;
|
||||
*:OS400:*:*)
|
||||
echo powerpc-ibm-os400
|
||||
echo powerpc-ibm-os400
|
||||
exit ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
arm*:riscos:*:*|arm*:RISCOS:*:*)
|
||||
arm:riscos:*:*|arm:RISCOS:*:*)
|
||||
echo arm-unknown-riscos
|
||||
exit ;;
|
||||
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
|
||||
|
@ -345,33 +324,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
case `/usr/bin/uname -p` in
|
||||
sparc) echo sparc-icl-nx7; exit ;;
|
||||
esac ;;
|
||||
s390x:SunOS:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
sun4H:SunOS:5.*:*)
|
||||
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
||||
echo i386-pc-auroraux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||
eval $set_cc_for_build
|
||||
SUN_ARCH="i386"
|
||||
# If there is a compiler, see if it is configured for 64-bit objects.
|
||||
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
||||
# This test works for both compilers.
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
SUN_ARCH="x86_64"
|
||||
fi
|
||||
fi
|
||||
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
|
@ -415,23 +375,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||
# be no problem.
|
||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
exit ;;
|
||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||
echo m68k-milan-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-milan-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||
echo m68k-hades-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-hades-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
m68k:machten:*:*)
|
||||
echo m68k-apple-machten${UNAME_RELEASE}
|
||||
exit ;;
|
||||
|
@ -501,8 +461,8 @@ EOF
|
|||
echo m88k-motorola-sysv3
|
||||
exit ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
||||
then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||
|
@ -515,7 +475,7 @@ EOF
|
|||
else
|
||||
echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit ;;
|
||||
|
@ -572,7 +532,7 @@ EOF
|
|||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit ;;
|
||||
*:AIX:*:[4567])
|
||||
*:AIX:*:[456])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
|
@ -615,52 +575,52 @@ EOF
|
|||
9000/[678][0-9][0-9])
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||
|
@ -680,7 +640,7 @@ EOF
|
|||
# => hppa64-hp-hpux11.23
|
||||
|
||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
grep -q __LP64__
|
||||
grep __LP64__ >/dev/null
|
||||
then
|
||||
HP_ARCH="hppa2.0w"
|
||||
else
|
||||
|
@ -751,22 +711,22 @@ EOF
|
|||
exit ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit ;;
|
||||
|
@ -790,14 +750,14 @@ EOF
|
|||
exit ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
5000:UNIX_System_V:4.*:*)
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
|
@ -809,39 +769,34 @@ EOF
|
|||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:FreeBSD:*:*)
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
case ${UNAME_PROCESSOR} in
|
||||
case ${UNAME_MACHINE} in
|
||||
pc98)
|
||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
amd64)
|
||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
*)
|
||||
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
esac
|
||||
exit ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
*:MINGW64*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw64
|
||||
exit ;;
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
i*:MSYS*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msys
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
exit ;;
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit ;;
|
||||
*:Interix*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
*:Interix*:[3456]*)
|
||||
case ${UNAME_MACHINE} in
|
||||
x86)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
authenticamd | genuineintel | EM64T)
|
||||
EM64T | authenticamd)
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
IA64)
|
||||
|
@ -851,9 +806,6 @@ EOF
|
|||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
exit ;;
|
||||
8664:Windows_NT:*)
|
||||
echo x86_64-pc-mks
|
||||
exit ;;
|
||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||
|
@ -874,21 +826,100 @@ EOF
|
|||
exit ;;
|
||||
*:GNU:*:*)
|
||||
# the GNU system
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit ;;
|
||||
*:GNU/*:*:*)
|
||||
# other systems with GNU libc and userland
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
exit ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
aarch64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
fi
|
||||
exit ;;
|
||||
aarch64_be:Linux:*:*)
|
||||
UNAME_MACHINE=aarch64_be
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo cris-axis-linux-gnu
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo crisv32-axis-linux-gnu
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo frv-unknown-linux-gnu
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
mips:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips
|
||||
#undef mipsel
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mipsel
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips64
|
||||
#undef mips64el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mips64el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips64
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
or32:Linux:*:*)
|
||||
echo or32-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
|
@ -899,132 +930,106 @@ EOF
|
|||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arc:Linux:*:* | arceb:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
else
|
||||
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_PCS_VFP
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
|
||||
fi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
hexagon:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
mips:Linux:*:* | mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef ${UNAME_MACHINE}
|
||||
#undef ${UNAME_MACHINE}el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=${UNAME_MACHINE}el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=${UNAME_MACHINE}
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||
;;
|
||||
or1k:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
or32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-${LIBC}
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
# Look for CPU level
|
||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
|
||||
*) echo hppa-unknown-linux-${LIBC} ;;
|
||||
PA7*) echo hppa1.1-unknown-linux-gnu ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-gnu ;;
|
||||
*) echo hppa-unknown-linux-gnu ;;
|
||||
esac
|
||||
exit ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc64le:Linux:*:*)
|
||||
echo powerpc64le-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppcle:Linux:*:*)
|
||||
echo powerpcle-unknown-linux-${LIBC}
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-gnu
|
||||
exit ;;
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
exit ;;
|
||||
sh64*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
sh*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
tile*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
vax:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo x86_64-unknown-linux-gnu
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
# problems with other programs or directories called `ld' in the path.
|
||||
# Set LC_ALL=C to ensure ld outputs messages in English.
|
||||
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
||||
| sed -ne '/supported targets:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported targets: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_targets" in
|
||||
elf32-i386)
|
||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
||||
;;
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit ;;
|
||||
coff-i386)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||
exit ;;
|
||||
"")
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||
# one that does not give us useful --help.
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
||||
exit ;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <features.h>
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
LIBC=gnu
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
#else
|
||||
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
LIBC=gnu
|
||||
#else
|
||||
LIBC=gnuaout
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^LIBC/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${LIBC}" != x && {
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
exit
|
||||
}
|
||||
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
|
||||
;;
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
# earlier versions are messed up and put the nodename in both
|
||||
|
@ -1032,11 +1037,11 @@ EOF
|
|||
echo i386-sequent-sysv4
|
||||
exit ;;
|
||||
i*86:UNIX_SV:4.2MP:2.*)
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# I just have to hope. -- rms.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit ;;
|
||||
i*86:OS/2:*:*)
|
||||
|
@ -1053,7 +1058,7 @@ EOF
|
|||
i*86:syllable:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-syllable
|
||||
exit ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
i*86:*DOS:*:*)
|
||||
|
@ -1068,7 +1073,7 @@ EOF
|
|||
fi
|
||||
exit ;;
|
||||
i*86:*:5:[678]*)
|
||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||
case `/bin/uname -X | grep "^Machine"` in
|
||||
*486*) UNAME_MACHINE=i486 ;;
|
||||
*Pentium) UNAME_MACHINE=i586 ;;
|
||||
|
@ -1096,13 +1101,10 @@ EOF
|
|||
exit ;;
|
||||
pc:*:*:*)
|
||||
# Left here for compatibility:
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# Note: whatever this is, it MUST be the same as what config.sub
|
||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||
# this is a cross-build.
|
||||
echo i586-pc-msdosdjgpp
|
||||
exit ;;
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i386.
|
||||
echo i386-pc-msdosdjgpp
|
||||
exit ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit ;;
|
||||
|
@ -1137,18 +1139,8 @@ EOF
|
|||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
||||
OS_REL='.3'
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
|
||||
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
|
||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
|
@ -1161,7 +1153,7 @@ EOF
|
|||
rs6000:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
|
@ -1181,10 +1173,10 @@ EOF
|
|||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
|
@ -1210,11 +1202,11 @@ EOF
|
|||
exit ;;
|
||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||
echo powerpc-be-beos
|
||||
exit ;;
|
||||
|
@ -1227,9 +1219,6 @@ EOF
|
|||
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||
echo i586-pc-haiku
|
||||
exit ;;
|
||||
x86_64:Haiku:*:*)
|
||||
echo x86_64-unknown-haiku
|
||||
exit ;;
|
||||
SX-4:SUPER-UX:*:*)
|
||||
echo sx4-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
|
@ -1256,31 +1245,9 @@ EOF
|
|||
exit ;;
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
eval $set_cc_for_build
|
||||
if test "$UNAME_PROCESSOR" = unknown ; then
|
||||
UNAME_PROCESSOR=powerpc
|
||||
fi
|
||||
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc64 ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
elif test "$UNAME_PROCESSOR" = i386 ; then
|
||||
# Avoid executing cc on OS X 10.9, as it ships with a stub
|
||||
# that puts up a graphical alert prompting to install
|
||||
# developer tools. Any system running Mac OS X 10.7 or
|
||||
# later (Darwin 11 and later) is required to have a 64-bit
|
||||
# processor. This is not true of the ARM version of Darwin
|
||||
# that Apple uses in portable devices.
|
||||
UNAME_PROCESSOR=x86_64
|
||||
fi
|
||||
case $UNAME_PROCESSOR in
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
|
@ -1294,10 +1261,7 @@ EOF
|
|||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit ;;
|
||||
NEO-?:NONSTOP_KERNEL:*:*)
|
||||
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSE-*:NONSTOP_KERNEL:*:*)
|
||||
NSE-?:NONSTOP_KERNEL:*:*)
|
||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
|
@ -1342,13 +1306,13 @@ EOF
|
|||
echo pdp10-unknown-its
|
||||
exit ;;
|
||||
SEI:*:*:SEIUX)
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:DragonFly:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit ;;
|
||||
*:*VMS:*:*)
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
case "${UNAME_MACHINE}" in
|
||||
A*) echo alpha-dec-vms ; exit ;;
|
||||
I*) echo ia64-dec-vms ; exit ;;
|
||||
|
@ -1363,14 +1327,11 @@ EOF
|
|||
i*86:rdos:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-rdos
|
||||
exit ;;
|
||||
i*86:AROS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-aros
|
||||
exit ;;
|
||||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
|
@ -1388,11 +1349,11 @@ main ()
|
|||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
332
readline/support/config.sub
vendored
332
readline/support/config.sub
vendored
|
@ -1,40 +1,44 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20098
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2013-10-01'
|
||||
timestamp='2008-03-26'
|
||||
|
||||
# This file is free software; you can 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
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
# 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/>.
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
|
@ -68,7 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -115,18 +120,12 @@ esac
|
|||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
android-linux)
|
||||
os=-linux-android
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
|
@ -149,13 +148,10 @@ case $os in
|
|||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray | -microblaze*)
|
||||
-apple | -axis | -knuth | -cray)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
|
@ -170,10 +166,10 @@ case $os in
|
|||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
|
@ -218,12 +214,6 @@ case $os in
|
|||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*178)
|
||||
os=-lynxos178
|
||||
;;
|
||||
-lynx*5)
|
||||
os=-lynxos5
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
|
@ -248,28 +238,19 @@ case $basic_machine in
|
|||
# Some are omitted here because they have special meanings below.
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64_be \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arceb \
|
||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||
| avr | avr32 \
|
||||
| be32 | be64 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| bfin \
|
||||
| c4x | c8051 | clipper \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| epiphany \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
|
||||
| maxq | mb | microblaze | mcore | mep | metag \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
|
@ -287,45 +268,31 @@ case $basic_machine in
|
|||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
| nios | nios2 \
|
||||
| ns16k | ns32k \
|
||||
| open8 \
|
||||
| or1k | or32 \
|
||||
| or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu \
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
c54x)
|
||||
basic_machine=tic54x-unknown
|
||||
;;
|
||||
c55x)
|
||||
basic_machine=tic55x-unknown
|
||||
;;
|
||||
c6x)
|
||||
basic_machine=tic6x-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
|
@ -335,21 +302,6 @@ case $basic_machine in
|
|||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
strongarm | thumb | xscale)
|
||||
basic_machine=arm-unknown
|
||||
;;
|
||||
xgate)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
xscaleeb)
|
||||
basic_machine=armeb-unknown
|
||||
;;
|
||||
|
||||
xscaleel)
|
||||
basic_machine=armel-unknown
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
|
@ -364,31 +316,24 @@ case $basic_machine in
|
|||
# Recognize the basic CPU types with company name.
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| aarch64-* | aarch64_be-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| k1om-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||
| microblaze-* | microblazeel-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
|
@ -406,37 +351,31 @@ case $basic_machine in
|
|||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipsr5900-* | mipsr5900el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| nds32-* | nds32le-* | nds32be-* \
|
||||
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||
| nios-* | nios2-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-* | z80-*)
|
||||
| z8k-*)
|
||||
;;
|
||||
# Recognize the basic CPU types without company name, with glob match.
|
||||
xtensa*)
|
||||
|
@ -458,7 +397,7 @@ case $basic_machine in
|
|||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
|
@ -504,10 +443,6 @@ case $basic_machine in
|
|||
basic_machine=m68k-apollo
|
||||
os=-bsd
|
||||
;;
|
||||
aros)
|
||||
basic_machine=i386-pc
|
||||
os=-aros
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
|
@ -524,27 +459,10 @@ case $basic_machine in
|
|||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
bluegene*)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-cnk
|
||||
;;
|
||||
c54x-*)
|
||||
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c55x-*)
|
||||
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c6x-*)
|
||||
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cegcc)
|
||||
basic_machine=arm-unknown
|
||||
os=-cegcc
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
|
@ -573,7 +491,7 @@ case $basic_machine in
|
|||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16 | cr16-*)
|
||||
cr16)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
|
@ -612,10 +530,6 @@ case $basic_machine in
|
|||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dicos)
|
||||
basic_machine=i686-pc
|
||||
os=-dicos
|
||||
;;
|
||||
djgpp)
|
||||
basic_machine=i586-pc
|
||||
os=-msdosdjgpp
|
||||
|
@ -731,6 +645,7 @@ case $basic_machine in
|
|||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
|
@ -788,15 +703,8 @@ case $basic_machine in
|
|||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze*)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-mingw64
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i686-pc
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
|
@ -831,18 +739,10 @@ case $basic_machine in
|
|||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
msys)
|
||||
basic_machine=i686-pc
|
||||
os=-msys
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
nacl)
|
||||
basic_machine=le32-unknown
|
||||
os=-nacl
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
|
@ -907,9 +807,6 @@ case $basic_machine in
|
|||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
neo-tandem)
|
||||
basic_machine=neo-tandem
|
||||
;;
|
||||
nse-tandem)
|
||||
basic_machine=nse-tandem
|
||||
;;
|
||||
|
@ -995,10 +892,9 @@ case $basic_machine in
|
|||
;;
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
|
@ -1023,11 +919,7 @@ case $basic_machine in
|
|||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rdos | rdos64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-rdos
|
||||
;;
|
||||
rdos32)
|
||||
rdos)
|
||||
basic_machine=i386-pc
|
||||
os=-rdos
|
||||
;;
|
||||
|
@ -1096,9 +988,6 @@ case $basic_machine in
|
|||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
strongarm-* | thumb-*)
|
||||
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
|
@ -1155,8 +1044,20 @@ case $basic_machine in
|
|||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic55x | c55x*)
|
||||
basic_machine=tic55x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic6x | c6x*)
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=$basic_machine-unknown
|
||||
basic_machine=tile-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
|
@ -1226,9 +1127,6 @@ case $basic_machine in
|
|||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
xscale-* | xscalee[bl]-*)
|
||||
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
|
@ -1237,10 +1135,6 @@ case $basic_machine in
|
|||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
;;
|
||||
z80-*-coff)
|
||||
basic_machine=z80-unknown
|
||||
os=-sim
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
|
@ -1279,7 +1173,7 @@ case $basic_machine in
|
|||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||
|
@ -1326,12 +1220,9 @@ esac
|
|||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
;;
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
|
@ -1352,23 +1243,21 @@ case $os in
|
|||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
|
@ -1376,7 +1265,7 @@ case $os in
|
|||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
|
@ -1415,7 +1304,7 @@ case $os in
|
|||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
|
@ -1464,7 +1353,7 @@ case $os in
|
|||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
|
@ -1500,14 +1389,12 @@ case $os in
|
|||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-dicos*)
|
||||
os=-dicos
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
|
@ -1530,10 +1417,10 @@ else
|
|||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
score-*)
|
||||
score-*)
|
||||
os=-elf
|
||||
;;
|
||||
spu-*)
|
||||
spu-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-acorn)
|
||||
|
@ -1545,23 +1432,8 @@ case $basic_machine in
|
|||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=-elf
|
||||
;;
|
||||
hexagon-*)
|
||||
os=-elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic55x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic6x-*)
|
||||
os=-coff
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
|
@ -1581,11 +1453,14 @@ case $basic_machine in
|
|||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mep-*)
|
||||
mep-*)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
|
@ -1594,9 +1469,6 @@ case $basic_machine in
|
|||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
or1k-*)
|
||||
os=-elf
|
||||
;;
|
||||
or32-*)
|
||||
os=-coff
|
||||
;;
|
||||
|
@ -1615,7 +1487,7 @@ case $basic_machine in
|
|||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
|
@ -1720,7 +1592,7 @@ case $basic_machine in
|
|||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-cnk*|-aix*)
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# mkdist - make a distribution directory from a master manifest file
|
||||
#
|
||||
# usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-t] [-v] version
|
||||
# usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version
|
||||
#
|
||||
# SRCDIR defaults to src
|
||||
# MANIFEST defaults to $SRCDIR/MANIFEST
|
||||
|
@ -31,7 +31,7 @@ ROOTNAME=bash
|
|||
|
||||
usage()
|
||||
{
|
||||
echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-t] [-v] version 1>&2
|
||||
echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version 1>&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
|
@ -42,13 +42,12 @@ vmsg()
|
|||
fi
|
||||
}
|
||||
|
||||
while getopts m:s:r:tv name
|
||||
while getopts m:s:r:v name
|
||||
do
|
||||
case $name in
|
||||
m) MANIFEST=$OPTARG ;;
|
||||
s) SRCDIR=$OPTARG ;;
|
||||
r) ROOTNAME=$OPTARG ;;
|
||||
t) maketar=yes ;;
|
||||
v) verbose=yes ;;
|
||||
?) usage ;;
|
||||
esac
|
||||
|
@ -67,8 +66,6 @@ fi
|
|||
version=$1
|
||||
newdir=${ROOTNAME}-$version
|
||||
|
||||
tarfile=${newdir}.tar
|
||||
|
||||
vmsg creating distribution for $ROOTNAME version $version in $newdir
|
||||
|
||||
if [ ! -d $newdir ]; then
|
||||
|
@ -120,10 +117,4 @@ done < $MANIFEST
|
|||
|
||||
vmsg $newdir created
|
||||
|
||||
if [ -n "$maketar" ]; then
|
||||
tar cf ${tarfile} $newdir
|
||||
gzip $tarfile
|
||||
vmsg ${tarfile}.gz created
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -66,12 +66,11 @@ fi
|
|||
# post-install/uninstall
|
||||
|
||||
# HP-UX and Darwin/MacOS X require that a shared library have execute permission
|
||||
# Linux does, too, and ldd warns about it. Solaris doesn't seem to mind,
|
||||
# but ldd still warns about it.
|
||||
# Linux does, too, and ldd warns about it
|
||||
# Cygwin installs both a dll (which must go in $BINDIR) and an implicit
|
||||
# link library (in $libdir)
|
||||
case "$host_os" in
|
||||
hpux*|darwin*|macosx*|linux*|solaris2*)
|
||||
hpux*|darwin*|macosx*|linux*)
|
||||
if [ -z "$uninstall" ]; then
|
||||
chmod 555 ${INSTALLDIR}/${LIBNAME}
|
||||
fi ;;
|
||||
|
@ -132,7 +131,7 @@ case "$host_os-$host_vendor" in
|
|||
fi
|
||||
;;
|
||||
|
||||
bsdi4*|*gnu*|darwin*|macosx*|netbsd*|mirbsd*)
|
||||
bsdi4*|*gnu*|darwin*|macosx*|netbsd*)
|
||||
# libname.so.M -> libname.so.M.N
|
||||
${echo} ${RM} ${INSTALLDIR}/$LINK2
|
||||
if [ -z "$uninstall" ]; then
|
||||
|
@ -178,7 +177,7 @@ freebsd3*|freebsdaout*)
|
|||
fi
|
||||
;;
|
||||
|
||||
freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*)
|
||||
freebsd[4-9]*|freebsdelf*|dragonfly*)
|
||||
# libname.so -> libname.so.M
|
||||
${echo} ${RM} ${INSTALLDIR}/$LINK1
|
||||
if [ -z "$uninstall" ]; then
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# Chet Ramey
|
||||
# chet@po.cwru.edu
|
||||
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Bash, the Bourne Again SHell.
|
||||
#
|
||||
|
@ -65,20 +65,6 @@ while [ $# -gt 0 ]; do
|
|||
done
|
||||
|
||||
case "${host_os}-${SHOBJ_CC}-${host_vendor}" in
|
||||
nsk-cc-tandem)
|
||||
SHOBJ_CFLAGS=-Wglobalized
|
||||
case `uname -m` in
|
||||
NSR*)
|
||||
SHOBJ_CFLAGS="${SHOBJ_CFLAGS} -Wcall_shared" # default on TNS/E, needed on TNS/R
|
||||
SHOBJ_LD=/usr/bin/ld # for TNS/R
|
||||
;;
|
||||
NSE*|NEO*)
|
||||
SHOBJ_LD=/usr/bin/eld
|
||||
;;
|
||||
esac
|
||||
SHOBJ_LDFLAGS='-shared -bglobalized -unres_symbols ignore'
|
||||
;;
|
||||
|
||||
sunos4*-*gcc*)
|
||||
SHOBJ_CFLAGS=-fpic
|
||||
SHOBJ_LD=/usr/bin/ld
|
||||
|
@ -160,7 +146,7 @@ freebsd3*|freebsdaout*)
|
|||
;;
|
||||
|
||||
# FreeBSD-4.x and later have only ELF
|
||||
freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*)
|
||||
freebsd[4-9]*|freebsdelf*|dragonfly*)
|
||||
SHOBJ_CFLAGS=-fPIC
|
||||
SHOBJ_LD='${CC}'
|
||||
|
||||
|
@ -171,8 +157,27 @@ freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*)
|
|||
;;
|
||||
|
||||
# Darwin/MacOS X
|
||||
darwin*)
|
||||
# Common definitions for all darwin/mac os x versions
|
||||
darwin[89]*|darwin10*)
|
||||
SHOBJ_STATUS=supported
|
||||
SHLIB_STATUS=supported
|
||||
|
||||
SHOBJ_CFLAGS='-fno-common'
|
||||
|
||||
SHOBJ_LD='MACOSX_DEPLOYMENT_TARGET=10.3 ${CC}'
|
||||
|
||||
SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
|
||||
SHLIB_LIBSUFF='dylib'
|
||||
|
||||
SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
|
||||
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
|
||||
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
|
||||
;;
|
||||
|
||||
darwin*|macosx*)
|
||||
SHOBJ_STATUS=unsupported
|
||||
SHLIB_STATUS=supported
|
||||
|
||||
SHOBJ_CFLAGS='-fno-common'
|
||||
|
||||
SHOBJ_LD='${CC}'
|
||||
|
@ -180,39 +185,19 @@ darwin*)
|
|||
SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
|
||||
SHLIB_LIBSUFF='dylib'
|
||||
|
||||
# unused at this time
|
||||
SHLIB_SONAME='$(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF)'
|
||||
|
||||
case "${host_os}" in
|
||||
# Darwin versions 1, 5, 6, 7 correspond to Mac OS X 10.0, 10.1, 10.2,
|
||||
# and 10.3, respectively.
|
||||
darwin[1-7].*)
|
||||
SHOBJ_STATUS=unsupported
|
||||
SHOBJ_LDFLAGS='-dynamic'
|
||||
SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
;;
|
||||
# Darwin 8 == Mac OS X 10.4; Mac OS X 10.N == Darwin N+4
|
||||
*)
|
||||
case "${host_os}" in
|
||||
darwin[89]*|darwin1[012]*)
|
||||
SHOBJ_ARCHFLAGS='-arch_only `/usr/bin/arch`'
|
||||
darwin[789]*|darwin10*) SHOBJ_LDFLAGS=''
|
||||
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
;;
|
||||
*) # Mac OS X 10.9 (Mavericks) and later
|
||||
SHOBJ_ARCHFLAGS=
|
||||
# for 32 and 64bit universal library
|
||||
#SHOBJ_ARCHFLAGS='-arch i386 -arch x86_64'
|
||||
#SHOBJ_CFLAGS=${SHOBJ_CFLAGS}' -arch i386 -arch x86_64'
|
||||
*) SHOBJ_LDFLAGS='-dynamic'
|
||||
SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
;;
|
||||
esac
|
||||
SHOBJ_LDFLAGS="-dynamiclib -dynamic -undefined dynamic_lookup ${SHOBJ_ARCHFLAGS}"
|
||||
SHLIB_XLDFLAGS="-dynamiclib ${SHOBJ_ARCHFLAGS}"' -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
;;
|
||||
esac
|
||||
|
||||
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
|
||||
;;
|
||||
|
||||
openbsd*|netbsd*|mirbsd*)
|
||||
openbsd*|netbsd*)
|
||||
SHOBJ_CFLAGS=-fPIC
|
||||
SHOBJ_LD='${CC}'
|
||||
SHOBJ_LDFLAGS='-shared'
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
# include "rltty.h"
|
||||
# endif
|
||||
# include <termcap.h>
|
||||
#elif defined (HAVE_NCURSES_TERMCAP_H)
|
||||
# include <ncurses/termcap.h>
|
||||
#else
|
||||
|
||||
/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC.
|
||||
|
|
|
@ -51,14 +51,15 @@
|
|||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
|
||||
|
||||
#ifdef __MSDOS__
|
||||
# include <pc.h>
|
||||
# include <pc.h>
|
||||
#endif
|
||||
|
||||
#include "rltty.h"
|
||||
#if defined (HAVE_SYS_IOCTL_H)
|
||||
# include <sys/ioctl.h> /* include for declaration of ioctl */
|
||||
#endif
|
||||
#include "tcap.h"
|
||||
|
||||
/* Some standard library routines. */
|
||||
|
@ -80,14 +81,13 @@ static void _win_get_screensize PARAMS((int *, int *));
|
|||
static void _emx_get_screensize PARAMS((int *, int *));
|
||||
#endif
|
||||
|
||||
/* If the calling application sets this to a non-zero value, readline will
|
||||
use the $LINES and $COLUMNS environment variables to set its idea of the
|
||||
window size before interrogating the kernel. */
|
||||
int rl_prefer_env_winsize = 0;
|
||||
#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
|
||||
#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
|
||||
|
||||
/* If this is non-zero, readline will set LINES and COLUMNS in the
|
||||
environment when it handles SIGWINCH. */
|
||||
int rl_change_environment = 1;
|
||||
/* If the calling application sets this to a non-zero value, readline will
|
||||
use the $LINES and $COLUMNS environment variables to set its idea of the
|
||||
window size before interrogating the kernel. */
|
||||
int rl_prefer_env_winsize = 0;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
|
@ -98,7 +98,7 @@ int rl_change_environment = 1;
|
|||
#ifndef __MSDOS__
|
||||
static char *term_buffer = (char *)NULL;
|
||||
static char *term_string_buffer = (char *)NULL;
|
||||
#endif
|
||||
#endif /* !__MSDOS__ */
|
||||
|
||||
static int tcap_initialized;
|
||||
|
||||
|
@ -308,8 +308,7 @@ _rl_get_screen_size (tty, ignore_env)
|
|||
/* If we're being compiled as part of bash, set the environment
|
||||
variables $LINES and $COLUMNS to new values. Otherwise, just
|
||||
do a pair of putenv () or setenv () calls. */
|
||||
if (rl_change_environment)
|
||||
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
|
||||
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
|
||||
|
||||
if (_rl_term_autowrap == 0)
|
||||
_rl_screenwidth--;
|
||||
|
@ -359,13 +358,7 @@ rl_reset_screen_size ()
|
|||
{
|
||||
_rl_get_screen_size (fileno (rl_instream), 0);
|
||||
}
|
||||
|
||||
void
|
||||
_rl_sigwinch_resize_terminal ()
|
||||
{
|
||||
_rl_get_screen_size (fileno (rl_instream), 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rl_resize_terminal ()
|
||||
{
|
||||
|
@ -567,6 +560,7 @@ _rl_init_terminal_io (terminal_name)
|
|||
term_has_meta = tgetflag ("km") != 0;
|
||||
if (term_has_meta == 0)
|
||||
_rl_term_mm = _rl_term_mo = (char *)NULL;
|
||||
|
||||
#endif /* !__MSDOS__ */
|
||||
|
||||
/* Attempt to find and bind the arrow keys. Do not override already
|
||||
|
@ -700,16 +694,17 @@ rl_ding ()
|
|||
default:
|
||||
break;
|
||||
case VISIBLE_BELL:
|
||||
#ifdef __MSDOS__
|
||||
ScreenVisualBell ();
|
||||
break;
|
||||
#else
|
||||
if (_rl_visible_bell)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
ScreenVisualBell ();
|
||||
#else
|
||||
tputs (_rl_visible_bell, 1, _rl_output_character_function);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
case AUDIBLE_BELL:
|
||||
fprintf (stderr, "\007");
|
||||
fflush (stderr);
|
||||
|
@ -726,29 +721,12 @@ rl_ding ()
|
|||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static int enabled_meta = 0; /* flag indicating we enabled meta mode */
|
||||
|
||||
void
|
||||
_rl_enable_meta_key ()
|
||||
{
|
||||
#if !defined (__DJGPP__)
|
||||
if (term_has_meta && _rl_term_mm)
|
||||
{
|
||||
tputs (_rl_term_mm, 1, _rl_output_character_function);
|
||||
enabled_meta = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_rl_disable_meta_key ()
|
||||
{
|
||||
#if !defined (__DJGPP__)
|
||||
if (term_has_meta && _rl_term_mo && enabled_meta)
|
||||
{
|
||||
tputs (_rl_term_mo, 1, _rl_output_character_function);
|
||||
enabled_meta = 0;
|
||||
}
|
||||
tputs (_rl_term_mm, 1, _rl_output_character_function);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,6 @@ static int _rl_char_search_callback PARAMS((_rl_callback_generic_arg *));
|
|||
rl_insert_text. Text blocks larger than this are divided. */
|
||||
#define TEXT_COUNT_MAX 1024
|
||||
|
||||
int _rl_optimize_typeahead = 1; /* rl_insert tries to read typeahead */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Insert and Delete */
|
||||
|
@ -242,7 +240,7 @@ rl_replace_line (text, clear_undo)
|
|||
this is the same as rl_end.
|
||||
|
||||
Any command that is called interactively receives two arguments.
|
||||
The first is a count: the numeric arg passed to this command.
|
||||
The first is a count: the numeric arg pased to this command.
|
||||
The second is the key which invoked this command.
|
||||
*/
|
||||
|
||||
|
@ -828,7 +826,7 @@ _rl_insert_char (count, c)
|
|||
pending characters that are bound to rl_insert, and insert
|
||||
them all. Don't do this if we're current reading input from
|
||||
a macro. */
|
||||
if ((RL_ISSTATE (RL_STATE_MACROINPUT) == 0) && _rl_pushed_input_available ())
|
||||
if ((RL_ISSTATE (RL_STATE_MACROINPUT) == 0) && _rl_any_typein ())
|
||||
_rl_insert_typein (c);
|
||||
else
|
||||
{
|
||||
|
@ -892,42 +890,8 @@ int
|
|||
rl_insert (count, c)
|
||||
int count, c;
|
||||
{
|
||||
int r, n, x;
|
||||
|
||||
r = (rl_insert_mode == RL_IM_INSERT) ? _rl_insert_char (count, c) : _rl_overwrite_char (count, c);
|
||||
|
||||
/* XXX -- attempt to batch-insert pending input that maps to self-insert */
|
||||
x = 0;
|
||||
n = (unsigned short)-2;
|
||||
while (_rl_optimize_typeahead &&
|
||||
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
|
||||
_rl_pushed_input_available () == 0 &&
|
||||
_rl_input_queued (0) &&
|
||||
(n = rl_read_key ()) > 0 &&
|
||||
_rl_keymap[(unsigned char)n].type == ISFUNC &&
|
||||
_rl_keymap[(unsigned char)n].function == rl_insert)
|
||||
{
|
||||
r = (rl_insert_mode == RL_IM_INSERT) ? _rl_insert_char (1, n) : _rl_overwrite_char (1, n);
|
||||
/* _rl_insert_char keeps its own set of pending characters to compose a
|
||||
complete multibyte character, and only returns 1 if it sees a character
|
||||
that's part of a multibyte character but too short to complete one. We
|
||||
can try to read another character in the hopes that we will get the
|
||||
next one or just punt. Right now we try to read another character.
|
||||
We don't want to call rl_insert_next if _rl_insert_char has already
|
||||
stored the character in the pending_bytes array because that will
|
||||
result in doubled input. */
|
||||
n = (unsigned short)-2;
|
||||
x++; /* count of bytes of typeahead read, currently unused */
|
||||
if (r == 1) /* read partial multibyte character */
|
||||
continue;
|
||||
if (rl_done || r != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (n != (unsigned short)-2) /* -2 = sentinel value for having inserted N */
|
||||
r = rl_execute_next (n);
|
||||
|
||||
return r;
|
||||
return (rl_insert_mode == RL_IM_INSERT ? _rl_insert_char (count, c)
|
||||
: _rl_overwrite_char (count, c));
|
||||
}
|
||||
|
||||
/* Insert the next typed character verbatim. */
|
||||
|
@ -942,10 +906,7 @@ _rl_insert_next (count)
|
|||
RL_UNSETSTATE(RL_STATE_MOREINPUT);
|
||||
|
||||
if (c < 0)
|
||||
return 1;
|
||||
|
||||
if (RL_ISSTATE (RL_STATE_MACRODEF))
|
||||
_rl_add_macro_char (c);
|
||||
return -1;
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
|
||||
|
@ -1102,7 +1063,7 @@ rl_rubout (count, key)
|
|||
if (!rl_point)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rl_insert_mode == RL_IM_OVERWRITE)
|
||||
|
@ -1125,7 +1086,7 @@ _rl_rubout_char (count, key)
|
|||
if (rl_point == 0)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
orig_point = rl_point;
|
||||
|
@ -1139,7 +1100,7 @@ _rl_rubout_char (count, key)
|
|||
c = rl_line_buffer[--rl_point];
|
||||
rl_delete_text (rl_point, orig_point);
|
||||
/* The erase-at-end-of-line hack is of questionable merit now. */
|
||||
if (rl_point == rl_end && ISPRINT ((unsigned char)c) && _rl_last_c_pos)
|
||||
if (rl_point == rl_end && ISPRINT (c) && _rl_last_c_pos)
|
||||
{
|
||||
int l;
|
||||
l = rl_character_len (c, rl_point);
|
||||
|
@ -1169,7 +1130,7 @@ rl_delete (count, key)
|
|||
if (rl_point == rl_end)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (count > 1 || rl_explicit_arg)
|
||||
|
@ -1339,7 +1300,7 @@ rl_change_case (count, op)
|
|||
if (op != UpCase && op != DownCase && op != CapCase)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (count < 0)
|
||||
|
@ -1373,7 +1334,7 @@ rl_change_case (count, op)
|
|||
}
|
||||
else
|
||||
nop = op;
|
||||
if (MB_CUR_MAX == 1 || rl_byte_oriented || isascii ((unsigned char)c))
|
||||
if (MB_CUR_MAX == 1 || rl_byte_oriented || isascii (c))
|
||||
{
|
||||
nc = (nop == UpCase) ? _rl_to_upper (c) : _rl_to_lower (c);
|
||||
rl_line_buffer[start] = nc;
|
||||
|
@ -1439,7 +1400,7 @@ rl_transpose_words (count, key)
|
|||
{
|
||||
rl_ding ();
|
||||
rl_point = orig_point;
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the text of the words. */
|
||||
|
@ -1492,7 +1453,7 @@ rl_transpose_chars (count, key)
|
|||
if (!rl_point || rl_end < 2)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rl_begin_undo_group ();
|
||||
|
@ -1555,7 +1516,7 @@ _rl_char_search_internal (count, dir, schar)
|
|||
#endif
|
||||
|
||||
if (dir == 0)
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
pos = rl_point;
|
||||
inc = (dir < 0) ? -1 : 1;
|
||||
|
@ -1564,7 +1525,7 @@ _rl_char_search_internal (count, dir, schar)
|
|||
if ((dir < 0 && pos <= 0) || (dir > 0 && pos >= rl_end))
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
|
@ -1619,7 +1580,7 @@ _rl_char_search (count, fdir, bdir)
|
|||
mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
|
||||
|
||||
if (mb_len <= 0)
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
if (count < 0)
|
||||
return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
|
||||
|
@ -1638,7 +1599,7 @@ _rl_char_search (count, fdir, bdir)
|
|||
RL_UNSETSTATE(RL_STATE_MOREINPUT);
|
||||
|
||||
if (c < 0)
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
if (count < 0)
|
||||
return (_rl_char_search_internal (-count, bdir, c));
|
||||
|
@ -1707,7 +1668,7 @@ _rl_set_mark_at_pos (position)
|
|||
int position;
|
||||
{
|
||||
if (position > rl_end)
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
rl_mark = position;
|
||||
return 0;
|
||||
|
@ -1732,7 +1693,7 @@ rl_exchange_point_and_mark (count, key)
|
|||
if (rl_mark == -1)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
SWAP (rl_point, rl_mark);
|
||||
|
|
|
@ -360,10 +360,6 @@ tilde_expand_word (filename)
|
|||
{
|
||||
/* Prefix $HOME to the rest of the string. */
|
||||
expansion = sh_get_env_value ("HOME");
|
||||
#if defined (_WIN32)
|
||||
if (expansion == 0)
|
||||
expansion = sh_get_env_value ("APPDATA");
|
||||
#endif
|
||||
|
||||
/* If there is no HOME variable, look up the directory in
|
||||
the password database. */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* readline.c -- a general facility for reading lines of input
|
||||
with emacs style editing and completion. */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
/* 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.
|
||||
|
@ -101,25 +101,6 @@ rl_add_undo (what, start, end, text)
|
|||
rl_undo_list = temp;
|
||||
}
|
||||
|
||||
/* Free an UNDO_LIST */
|
||||
void
|
||||
_rl_free_undo_list (ul)
|
||||
UNDO_LIST *ul;
|
||||
{
|
||||
UNDO_LIST *release;
|
||||
|
||||
while (ul)
|
||||
{
|
||||
release = ul;
|
||||
ul = ul->next;
|
||||
|
||||
if (release->what == UNDO_DELETE)
|
||||
xfree (release->text);
|
||||
|
||||
xfree (release);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the existing undo list. */
|
||||
void
|
||||
rl_free_undo_list ()
|
||||
|
@ -127,7 +108,16 @@ rl_free_undo_list ()
|
|||
UNDO_LIST *release, *orig_list;
|
||||
|
||||
orig_list = rl_undo_list;
|
||||
_rl_free_undo_list (rl_undo_list);
|
||||
while (rl_undo_list)
|
||||
{
|
||||
release = rl_undo_list;
|
||||
rl_undo_list = rl_undo_list->next;
|
||||
|
||||
if (release->what == UNDO_DELETE)
|
||||
xfree (release->text);
|
||||
|
||||
xfree (release);
|
||||
}
|
||||
rl_undo_list = (UNDO_LIST *)NULL;
|
||||
replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
|
||||
}
|
||||
|
@ -178,7 +168,6 @@ rl_do_undo ()
|
|||
{
|
||||
UNDO_LIST *release;
|
||||
int waiting_for_begin, start, end;
|
||||
HIST_ENTRY *cur, *temp;
|
||||
|
||||
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
|
||||
|
||||
|
@ -233,18 +222,6 @@ rl_do_undo ()
|
|||
|
||||
release = rl_undo_list;
|
||||
rl_undo_list = rl_undo_list->next;
|
||||
|
||||
/* If we are editing a history entry, make sure the change is replicated
|
||||
in the history entry's line */
|
||||
cur = current_history ();
|
||||
if (cur && cur->data && (UNDO_LIST *)cur->data == release)
|
||||
{
|
||||
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
|
||||
xfree (temp->line);
|
||||
FREE (temp->timestamp);
|
||||
xfree (temp);
|
||||
}
|
||||
|
||||
replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
|
||||
|
||||
xfree (release);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* util.c -- readline utility functions */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2010 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.
|
||||
|
@ -55,7 +55,6 @@
|
|||
|
||||
#include "rlprivate.h"
|
||||
#include "xmalloc.h"
|
||||
#include "rlshell.h"
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
|
@ -108,11 +107,8 @@ _rl_abort_internal ()
|
|||
while (rl_executing_macro)
|
||||
_rl_pop_executing_macro ();
|
||||
|
||||
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
|
||||
|
||||
rl_last_func = (rl_command_func_t *)NULL;
|
||||
|
||||
_rl_longjmp (_rl_top_level, 1);
|
||||
longjmp (_rl_top_level, 1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -373,13 +369,11 @@ _rl_strpbrk (string1, string2)
|
|||
doesn't matter (strncasecmp). */
|
||||
int
|
||||
_rl_strnicmp (string1, string2, count)
|
||||
const char *string1;
|
||||
const char *string2;
|
||||
char *string1, *string2;
|
||||
int count;
|
||||
{
|
||||
register const char *s1;
|
||||
register const char *s2;
|
||||
register int d;
|
||||
register char *s1, *s2;
|
||||
int d;
|
||||
|
||||
if (count <= 0 || (string1 == string2))
|
||||
return 0;
|
||||
|
@ -403,12 +397,10 @@ _rl_strnicmp (string1, string2, count)
|
|||
/* strcmp (), but caseless (strcasecmp). */
|
||||
int
|
||||
_rl_stricmp (string1, string2)
|
||||
const char *string1;
|
||||
const char *string2;
|
||||
char *string1, *string2;
|
||||
{
|
||||
register const char *s1;
|
||||
register const char *s2;
|
||||
register int d;
|
||||
register char *s1, *s2;
|
||||
int d;
|
||||
|
||||
s1 = string1;
|
||||
s2 = string2;
|
||||
|
@ -476,7 +468,6 @@ _rl_savestring (s)
|
|||
return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s)));
|
||||
}
|
||||
|
||||
#if defined (DEBUG)
|
||||
#if defined (USE_VARARGS)
|
||||
static FILE *_rl_tracefp;
|
||||
|
||||
|
@ -512,18 +503,11 @@ _rl_trace (va_alist)
|
|||
int
|
||||
_rl_tropen ()
|
||||
{
|
||||
char fnbuf[128], *x;
|
||||
char fnbuf[128];
|
||||
|
||||
if (_rl_tracefp)
|
||||
fclose (_rl_tracefp);
|
||||
#if defined (_WIN32) && !defined (__CYGWIN__)
|
||||
x = sh_get_env_value ("TEMP");
|
||||
if (x == 0)
|
||||
x = ".";
|
||||
#else
|
||||
x = "/var/tmp";
|
||||
#endif
|
||||
sprintf (fnbuf, "%s/rltrace.%ld", x, (long)getpid());
|
||||
sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid());
|
||||
unlink(fnbuf);
|
||||
_rl_tracefp = fopen (fnbuf, "w+");
|
||||
return _rl_tracefp != 0;
|
||||
|
@ -539,62 +523,4 @@ _rl_trclose ()
|
|||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_settracefp (fp)
|
||||
FILE *fp;
|
||||
{
|
||||
_rl_tracefp = fp;
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
#if HAVE_DECL_AUDIT_USER_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT)
|
||||
#include <sys/socket.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/netlink.h>
|
||||
|
||||
/* Report STRING to the audit system. */
|
||||
void
|
||||
_rl_audit_tty (string)
|
||||
char *string;
|
||||
{
|
||||
struct sockaddr_nl addr;
|
||||
struct msghdr msg;
|
||||
struct nlmsghdr nlm;
|
||||
struct iovec iov[2];
|
||||
size_t size;
|
||||
int fd;
|
||||
|
||||
fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
|
||||
if (fd < 0)
|
||||
return;
|
||||
size = strlen (string) + 1;
|
||||
|
||||
nlm.nlmsg_len = NLMSG_LENGTH (size);
|
||||
nlm.nlmsg_type = AUDIT_USER_TTY;
|
||||
nlm.nlmsg_flags = NLM_F_REQUEST;
|
||||
nlm.nlmsg_seq = 0;
|
||||
nlm.nlmsg_pid = 0;
|
||||
|
||||
iov[0].iov_base = &nlm;
|
||||
iov[0].iov_len = sizeof (nlm);
|
||||
iov[1].iov_base = string;
|
||||
iov[1].iov_len = size;
|
||||
|
||||
addr.nl_family = AF_NETLINK;
|
||||
addr.nl_pid = 0;
|
||||
addr.nl_groups = 0;
|
||||
|
||||
msg.msg_name = &addr;
|
||||
msg.msg_namelen = sizeof (addr);
|
||||
msg.msg_iov = iov;
|
||||
msg.msg_iovlen = 2;
|
||||
msg.msg_control = NULL;
|
||||
msg.msg_controllen = 0;
|
||||
msg.msg_flags = 0;
|
||||
|
||||
(void)sendmsg (fd, &msg, 0);
|
||||
close (fd);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -309,6 +309,7 @@ KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
|
|||
#endif /* KEYMAP_SIZE > 128 */
|
||||
};
|
||||
|
||||
|
||||
KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
|
||||
/* The regular control keys come first. */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* vi_mode.c -- A vi emulation mode for Bash.
|
||||
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2010 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.
|
||||
|
@ -108,13 +108,9 @@ static const char * const vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
|
|||
/* Arrays for the saved marks. */
|
||||
static int vi_mark_chars['z' - 'a' + 1];
|
||||
|
||||
static void _rl_vi_replace_insert PARAMS((int));
|
||||
static void _rl_vi_save_replace PARAMS((void));
|
||||
static void _rl_vi_stuff_insert PARAMS((int));
|
||||
static void _rl_vi_save_insert PARAMS((UNDO_LIST *));
|
||||
|
||||
static void vi_save_insert_buffer PARAMS ((int, int));
|
||||
|
||||
static void _rl_vi_backup PARAMS((void));
|
||||
|
||||
static int _rl_vi_arg_dispatch PARAMS((int));
|
||||
|
@ -192,29 +188,6 @@ _rl_vi_textmod_command (c)
|
|||
return (member (c, vi_textmod));
|
||||
}
|
||||
|
||||
int
|
||||
_rl_vi_motion_command (c)
|
||||
int c;
|
||||
{
|
||||
return (member (c, vi_motion));
|
||||
}
|
||||
|
||||
static void
|
||||
_rl_vi_replace_insert (count)
|
||||
int count;
|
||||
{
|
||||
int nchars;
|
||||
|
||||
nchars = strlen (vi_insert_buffer);
|
||||
|
||||
rl_begin_undo_group ();
|
||||
while (count--)
|
||||
/* nchars-1 to compensate for _rl_replace_text using `end+1' in call
|
||||
to rl_delete_text */
|
||||
_rl_replace_text (vi_insert_buffer, rl_point, rl_point+nchars-1);
|
||||
rl_end_undo_group ();
|
||||
}
|
||||
|
||||
static void
|
||||
_rl_vi_stuff_insert (count)
|
||||
int count;
|
||||
|
@ -234,7 +207,7 @@ rl_vi_redo (count, c)
|
|||
{
|
||||
int r;
|
||||
|
||||
if (rl_explicit_arg == 0)
|
||||
if (!rl_explicit_arg)
|
||||
{
|
||||
rl_numeric_arg = _rl_vi_last_repeat;
|
||||
rl_arg_sign = _rl_vi_last_arg_sign;
|
||||
|
@ -251,13 +224,6 @@ rl_vi_redo (count, c)
|
|||
if (rl_point > 0)
|
||||
_rl_vi_backup ();
|
||||
}
|
||||
else if (_rl_vi_last_command == 'R' && vi_insert_buffer && *vi_insert_buffer)
|
||||
{
|
||||
_rl_vi_replace_insert (count);
|
||||
/* And back up point over the last character inserted. */
|
||||
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)
|
||||
|
@ -471,7 +437,7 @@ rl_vi_end_word (count, key)
|
|||
if (count < 0)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_rl_uppercase_p (key))
|
||||
|
@ -713,8 +679,6 @@ rl_vi_insertion_mode (count, key)
|
|||
{
|
||||
_rl_keymap = vi_insertion_keymap;
|
||||
_rl_vi_last_key_before_insert = key;
|
||||
if (_rl_show_mode_in_prompt)
|
||||
_rl_reset_prompt ();
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -726,43 +690,6 @@ rl_vi_insert_mode (count, key)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
vi_save_insert_buffer (start, len)
|
||||
int start, len;
|
||||
{
|
||||
/* Same code as _rl_vi_save_insert below */
|
||||
if (len >= vi_insert_buffer_size)
|
||||
{
|
||||
vi_insert_buffer_size += (len + 32) - (len % 32);
|
||||
vi_insert_buffer = (char *)xrealloc (vi_insert_buffer, vi_insert_buffer_size);
|
||||
}
|
||||
strncpy (vi_insert_buffer, rl_line_buffer + start, len - 1);
|
||||
vi_insert_buffer[len-1] = '\0';
|
||||
}
|
||||
|
||||
static void
|
||||
_rl_vi_save_replace ()
|
||||
{
|
||||
int len, start, end;
|
||||
UNDO_LIST *up;
|
||||
|
||||
up = rl_undo_list;
|
||||
if (up == 0 || up->what != UNDO_END || vi_replace_count <= 0)
|
||||
{
|
||||
if (vi_insert_buffer_size >= 1)
|
||||
vi_insert_buffer[0] = '\0';
|
||||
return;
|
||||
}
|
||||
/* Let's try it the quick and easy way for now. This should essentially
|
||||
accommodate every UNDO_INSERT and save the inserted text to
|
||||
vi_insert_buffer */
|
||||
end = rl_point;
|
||||
start = end - vi_replace_count + 1;
|
||||
len = vi_replace_count + 1;
|
||||
|
||||
vi_save_insert_buffer (start, len);
|
||||
}
|
||||
|
||||
static void
|
||||
_rl_vi_save_insert (up)
|
||||
UNDO_LIST *up;
|
||||
|
@ -779,8 +706,13 @@ _rl_vi_save_insert (up)
|
|||
start = up->start;
|
||||
end = up->end;
|
||||
len = end - start + 1;
|
||||
|
||||
vi_save_insert_buffer (start, len);
|
||||
if (len >= vi_insert_buffer_size)
|
||||
{
|
||||
vi_insert_buffer_size += (len + 32) - (len % 32);
|
||||
vi_insert_buffer = (char *)xrealloc (vi_insert_buffer, vi_insert_buffer_size);
|
||||
}
|
||||
strncpy (vi_insert_buffer, rl_line_buffer + start, len - 1);
|
||||
vi_insert_buffer[len-1] = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -796,10 +728,7 @@ _rl_vi_done_inserting ()
|
|||
on absolute indices into the line which may change (though they
|
||||
probably will not). */
|
||||
_rl_vi_doing_insert = 0;
|
||||
if (_rl_vi_last_key_before_insert == 'R')
|
||||
_rl_vi_save_replace (); /* Half the battle */
|
||||
else
|
||||
_rl_vi_save_insert (rl_undo_list->next);
|
||||
_rl_vi_save_insert (rl_undo_list->next);
|
||||
vi_continued_command = 1;
|
||||
}
|
||||
else
|
||||
|
@ -833,9 +762,6 @@ rl_vi_movement_mode (count, key)
|
|||
if (RL_ISSTATE (RL_STATE_VICMDONCE) == 0)
|
||||
rl_free_undo_list ();
|
||||
|
||||
if (_rl_show_mode_in_prompt)
|
||||
_rl_reset_prompt ();
|
||||
|
||||
RL_SETSTATE (RL_STATE_VICMDONCE);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1308,19 +1234,11 @@ rl_vi_delete_to (count, key)
|
|||
_rl_vimvcxt->motion = '$';
|
||||
r = rl_domove_motion_callback (_rl_vimvcxt);
|
||||
}
|
||||
else if (vi_redoing && _rl_vi_last_motion != 'd') /* `dd' is special */
|
||||
else if (vi_redoing)
|
||||
{
|
||||
_rl_vimvcxt->motion = _rl_vi_last_motion;
|
||||
r = rl_domove_motion_callback (_rl_vimvcxt);
|
||||
}
|
||||
else if (vi_redoing) /* handle redoing `dd' here */
|
||||
{
|
||||
_rl_vimvcxt->motion = _rl_vi_last_motion;
|
||||
rl_mark = rl_end;
|
||||
rl_beg_of_line (1, key);
|
||||
RL_UNSETSTATE (RL_STATE_VIMOTION);
|
||||
r = vidomove_dispatch (_rl_vimvcxt);
|
||||
}
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
else if (RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
{
|
||||
|
@ -1398,19 +1316,11 @@ rl_vi_change_to (count, key)
|
|||
_rl_vimvcxt->motion = '$';
|
||||
r = rl_domove_motion_callback (_rl_vimvcxt);
|
||||
}
|
||||
else if (vi_redoing && _rl_vi_last_motion != 'c') /* `cc' is special */
|
||||
else if (vi_redoing)
|
||||
{
|
||||
_rl_vimvcxt->motion = _rl_vi_last_motion;
|
||||
r = rl_domove_motion_callback (_rl_vimvcxt);
|
||||
}
|
||||
else if (vi_redoing) /* handle redoing `cc' here */
|
||||
{
|
||||
_rl_vimvcxt->motion = _rl_vi_last_motion;
|
||||
rl_mark = rl_end;
|
||||
rl_beg_of_line (1, key);
|
||||
RL_UNSETSTATE (RL_STATE_VIMOTION);
|
||||
r = vidomove_dispatch (_rl_vimvcxt);
|
||||
}
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
else if (RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
{
|
||||
|
@ -1467,19 +1377,6 @@ rl_vi_yank_to (count, key)
|
|||
_rl_vimvcxt->motion = '$';
|
||||
r = rl_domove_motion_callback (_rl_vimvcxt);
|
||||
}
|
||||
else if (vi_redoing && _rl_vi_last_motion != 'y') /* `yy' is special */
|
||||
{
|
||||
_rl_vimvcxt->motion = _rl_vi_last_motion;
|
||||
r = rl_domove_motion_callback (_rl_vimvcxt);
|
||||
}
|
||||
else if (vi_redoing) /* handle redoing `yy' here */
|
||||
{
|
||||
_rl_vimvcxt->motion = _rl_vi_last_motion;
|
||||
rl_mark = rl_end;
|
||||
rl_beg_of_line (1, key);
|
||||
RL_UNSETSTATE (RL_STATE_VIMOTION);
|
||||
r = vidomove_dispatch (_rl_vimvcxt);
|
||||
}
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
else if (RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
{
|
||||
|
@ -1541,7 +1438,7 @@ rl_vi_rubout (count, key)
|
|||
if (rl_point == 0)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
opoint = rl_point;
|
||||
|
@ -1572,7 +1469,7 @@ rl_vi_delete (count, key)
|
|||
if (rl_end == 0)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
|
@ -1657,13 +1554,13 @@ rl_vi_char_search (count, key)
|
|||
if (key == ';' || key == ',')
|
||||
{
|
||||
if (_rl_cs_orig_dir == 0)
|
||||
return 1;
|
||||
return -1;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (_rl_vi_last_search_mblen == 0)
|
||||
return 1;
|
||||
return -1;
|
||||
#else
|
||||
if (_rl_vi_last_search_char == 0)
|
||||
return 1;
|
||||
return -1;
|
||||
#endif
|
||||
_rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir;
|
||||
}
|
||||
|
@ -1762,7 +1659,7 @@ rl_vi_match (ignore, key)
|
|||
{
|
||||
rl_point = pos;
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1792,7 +1689,7 @@ rl_vi_match (ignore, key)
|
|||
else
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1816,7 +1713,7 @@ rl_vi_match (ignore, key)
|
|||
else
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2014,20 +1911,14 @@ rl_vi_replace (count, key)
|
|||
|
||||
vi_replace_count = 0;
|
||||
|
||||
if (vi_replace_map == 0)
|
||||
if (!vi_replace_map)
|
||||
{
|
||||
vi_replace_map = rl_make_bare_keymap ();
|
||||
|
||||
for (i = 0; i < ' '; i++)
|
||||
if (vi_insertion_keymap[i].type == ISFUNC)
|
||||
vi_replace_map[i].function = vi_insertion_keymap[i].function;
|
||||
|
||||
for (i = ' '; i < KEYMAP_SIZE; i++)
|
||||
vi_replace_map[i].function = rl_vi_overstrike;
|
||||
|
||||
vi_replace_map[RUBOUT].function = rl_vi_overstrike_delete;
|
||||
|
||||
/* Make sure these are what we want. */
|
||||
vi_replace_map[ESC].function = rl_vi_movement_mode;
|
||||
vi_replace_map[RETURN].function = rl_newline;
|
||||
vi_replace_map[NEWLINE].function = rl_newline;
|
||||
|
@ -2040,12 +1931,7 @@ rl_vi_replace (count, key)
|
|||
vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
|
||||
|
||||
}
|
||||
|
||||
rl_vi_start_inserting (key, 1, rl_arg_sign);
|
||||
|
||||
_rl_vi_last_key_before_insert = key;
|
||||
_rl_keymap = vi_replace_map;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -2090,7 +1976,7 @@ _rl_vi_set_mark ()
|
|||
if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
ch -= 'a';
|
||||
vi_mark_chars[ch] = rl_point;
|
||||
|
@ -2142,14 +2028,14 @@ _rl_vi_goto_mark ()
|
|||
else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ch -= 'a';
|
||||
if (vi_mark_chars[ch] == -1)
|
||||
{
|
||||
rl_ding ();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
rl_point = vi_mark_chars[ch];
|
||||
return 0;
|
||||
|
|
|
@ -31,7 +31,10 @@
|
|||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "readline.h"
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
|
@ -45,6 +48,10 @@ void
|
|||
xfree (string)
|
||||
PTR_T string;
|
||||
{
|
||||
/* Leak a bit. */
|
||||
if (RL_ISSTATE(RL_STATE_SIGHANDLER))
|
||||
return;
|
||||
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
#endif /* !PTR_T */
|
||||
|
||||
/* xmalloc and xrealloc should be also protected from RL_STATE_SIGHANDLER. */
|
||||
#define xfree xfree_readline
|
||||
|
||||
extern PTR_T xmalloc PARAMS((size_t));
|
||||
extern PTR_T xrealloc PARAMS((void *, size_t));
|
||||
extern void xfree PARAMS((void *));
|
||||
|
|
Loading…
Reference in a new issue