readline-8.3/ 000775 000436 000024 00000000000 15030514137 013231 5 ustar 00chet staff 000000 000000 readline-8.3/nls.c 000644 000436 000024 00000021025 14637567462 014214 0 ustar 00chet staff 000000 000000 /* nls.c -- skeletal internationalization code. */
/* Copyright (C) 1996-2022 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#include
#if defined (HAVE_UNISTD_H)
# include
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include
#endif
#if defined (HAVE_LANGINFO_CODESET)
# include
#endif
#include
#include "rldefs.h"
#include "readline.h"
#include "rlshell.h"
#include "rlprivate.h"
#include "xmalloc.h"
static int utf8locale (char *);
#define RL_DEFAULT_LOCALE "C"
static char *_rl_current_locale = 0;
#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,
or LANG environment variable (using the first of those with a value),
readline eight-bit mode is enabled. */
static char *legal_lang_values[] =
{
"iso88591",
"iso88592",
"iso88593",
"iso88594",
"iso88595",
"iso88596",
"iso88597",
"iso88598",
"iso88599",
"iso885910",
"koi8r",
"utf8",
0
};
static char *normalize_codeset (char *);
#endif /* !HAVE_SETLOCALE */
static char *find_codeset (char *, size_t *);
static char *_rl_get_locale_var (const char *);
static char *
_rl_get_locale_var (const char *v)
{
char *lspec;
lspec = sh_get_env_value ("LC_ALL");
if (lspec == 0 || *lspec == 0)
lspec = sh_get_env_value (v);
if (lspec == 0 || *lspec == 0)
lspec = sh_get_env_value ("LANG");
return lspec;
}
static int
utf8locale (char *lspec)
{
char *cp;
#if HAVE_LANGINFO_CODESET
cp = nl_langinfo (CODESET);
return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8"));
#else
size_t len;
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
}
/* Query the right environment variables and call setlocale() to initialize
the C library locale settings. */
char *
_rl_init_locale (void)
{
char *ret, *lspec;
/* Set the LC_CTYPE locale category from environment variables. */
lspec = _rl_get_locale_var ("LC_CTYPE");
/* Since _rl_get_locale_var queries the right environment variables,
we query the current locale settings with setlocale(), and, if
that doesn't return anything, we set lspec to the empty string to
force the subsequent call to setlocale() to define the `native'
environment. */
#if defined (HAVE_SETLOCALE)
if (lspec == 0 || *lspec == 0)
lspec = setlocale (LC_CTYPE, (char *)NULL);
if (lspec == 0)
lspec = "";
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
if (ret == 0 || *ret == 0)
ret = setlocale (LC_CTYPE, (char *)NULL);
if (ret == 0 || *ret == 0)
ret = RL_DEFAULT_LOCALE;
#else
ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
#endif
_rl_utf8locale = (ret && *ret) ? utf8locale (ret) : 0;
_rl_current_locale = savestring (ret);
return ret;
}
/* If we have setlocale(3), just check the current LC_CTYPE category
value (passed as LOCALESTR), and go into eight-bit mode if it's not "C"
or "POSIX". If FORCE is non-zero, we reset the locale variables to values
appropriate for the C locale if the locale is "C" or "POSIX". FORCE is 0
when this is called from _rl_init_eightbit, since we're modifying the
default initial values and don't need to change anything else. If we
don't have setlocale(3), we check the codeset portion of LOCALESTR against
a set of known values and go into eight-bit mode if it matches one of those.
Returns 1 if we set eight-bit (multibyte) mode. */
static int
_rl_set_localevars (char *localestr, int force)
{
#if defined (HAVE_SETLOCALE)
if (localestr && *localestr && (localestr[0] != 'C' || localestr[1]) && (STREQ (localestr, "POSIX") == 0))
{
_rl_meta_flag = 1;
_rl_convert_meta_chars_to_ascii = 0;
_rl_output_meta_chars = 1;
return (1);
}
else if (force)
{
/* Default "C" locale settings. */
_rl_meta_flag = 0;
_rl_convert_meta_chars_to_ascii = 1;
_rl_output_meta_chars = 0;
return (0);
}
else
return (0);
#else /* !HAVE_SETLOCALE */
char *t;
int i;
/* We don't have setlocale. Finesse it. Check the environment for the
appropriate variables and set eight-bit mode if they have the right
values. */
if (localestr == 0 || (t = normalize_codeset (localestr)) == 0)
return (0);
for (i = 0; t && legal_lang_values[i]; i++)
if (STREQ (t, legal_lang_values[i]))
{
_rl_meta_flag = 1;
_rl_convert_meta_chars_to_ascii = 0;
_rl_output_meta_chars = 1;
break;
}
if (force && legal_lang_values[i] == 0) /* didn't find it */
{
/* Default "C" locale settings. */
_rl_meta_flag = 0;
_rl_convert_meta_chars_to_ascii = 1;
_rl_output_meta_chars = 0;
}
_rl_utf8locale = *t ? STREQ (t, "utf8") : 0;
xfree (t);
return (legal_lang_values[i] ? 1 : 0);
#endif /* !HAVE_SETLOCALE */
}
/* 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. */
int
_rl_init_eightbit (void)
{
char *t, *ol;
ol = _rl_current_locale;
t = _rl_init_locale (); /* resets _rl_current_locale, returns static pointer */
xfree (ol);
return (_rl_set_localevars (t, 0));
}
#if !defined (HAVE_SETLOCALE)
static char *
normalize_codeset (char *codeset)
{
size_t namelen, i;
int len, all_digits;
char *wp, *retval;
codeset = find_codeset (codeset, &namelen);
if (codeset == 0)
return (codeset);
all_digits = 1;
for (len = 0, i = 0; i < namelen; i++)
{
if (ISALNUM ((unsigned char)codeset[i]))
{
len++;
all_digits &= _rl_digit_p (codeset[i]);
}
}
retval = (char *)malloc ((all_digits ? 3 : 0) + len + 1);
if (retval == 0)
return ((char *)0);
wp = retval;
/* Add `iso' to beginning of an all-digit codeset */
if (all_digits)
{
*wp++ = 'i';
*wp++ = 's';
*wp++ = 'o';
}
for (i = 0; i < namelen; i++)
if (ISALPHA ((unsigned char)codeset[i]))
*wp++ = _rl_to_lower (codeset[i]);
else if (_rl_digit_p (codeset[i]))
*wp++ = codeset[i];
*wp = '\0';
return retval;
}
#endif /* !HAVE_SETLOCALE */
/* Isolate codeset portion of locale specification. */
static char *
find_codeset (char *name, size_t *lenp)
{
char *cp, *language, *result;
cp = language = name;
result = (char *)0;
while (*cp && *cp != '_' && *cp != '@' && *cp != '+' && *cp != ',')
cp++;
/* This does not make sense: language has to be specified. As
an exception we allow the variable to contain only the codeset
name. Perhaps there are funny codeset names. */
if (language == cp)
{
*lenp = strlen (language);
result = language;
}
else
{
/* Next is the territory. */
if (*cp == '_')
do
++cp;
while (*cp && *cp != '.' && *cp != '@' && *cp != '+' && *cp != ',' && *cp != '_');
/* Now, finally, is the codeset. */
result = cp;
if (*cp == '.')
do
++cp;
while (*cp && *cp != '@');
if (cp - result > 2)
{
result++;
*lenp = cp - result;
}
else
{
*lenp = strlen (language);
result = language;
}
}
return result;
}
void
_rl_reset_locale (void)
{
char *ol, *nl;
/* This should not be NULL; _rl_init_eightbit sets it on the first call to
readline() or rl_initialize(). */
ol = _rl_current_locale;
nl = _rl_init_locale (); /* resets _rl_current_locale */
if ((ol == 0 && nl) || (ol && nl && (STREQ (ol, nl) == 0)))
(void)_rl_set_localevars (nl, 1);
xfree (ol);
}
readline-8.3/CHANGES 000644 000436 000024 00000254116 15013112710 014223 0 ustar 00chet staff 000000 000000 This document details the changes between this version, readline-8.3, and
the previous version, readline-8.2.
1. Changes to Readline
a. Fixed a bug in clearing the visible line structure before redisplay.
b. Fix a bug where setlocale(3) returning NULL caused a crash.
c. Fixed signal checking in callback mode to handle signals that arrive before
readline restore's the application's signal handlers.
d. Fixed a bug with word completion where the directory name needs to be
dequoted and tilde-expanded.
e. Fixed a bug that caused compilation to fail on systems with select but not
pselect.
f. System-specific changes for: WIN32, z/OS, Cygwin, MSYS
g. Fixed a bug that caused word completion mismatches if the quoted text the
user typed was longer than the unquoted match.
h. Fixes for freeing undo lists that might appear in history list entries
after non-incremental searches.
i. Fixes for some errors revealed by address sanitizer.
j. In vi mode, if an `f' or `F' move command associated with a `c' or `C'
command fails, don't enter insert mode.
k. Fixed bug with truncating a history file containing timestamps that caused
the timestamp associated with the first history entry not to be written.
l. Fix vi-mode so that a motion command attached to d/D, y/Y, or t/T must
consume or delete at least one character.
m. Fix a redisplay error when displaying meta characters as octal sequences
and other C locale issues.
n. Fix error that caused characters composing an incomplete multibyte
character not to be inserted into the line.
o. In callback mode, let the application echo the signal characters (e.g., ^C)
when the application's signal handlers are installed.
p. Added some support for lines that consume more than the physical number of
screen lines.
q. Make sure dump-variables returns the string values for active-region-start-color
and active-region-end-color if they're set.
r. Fixes to how characters between 128 and 159 are printed when displaying
macro values (use symbolic notation instead of directly printing the
character).
s. Don't convert meta characters that contain NULL (\M-\C-@) to actual NULs,
which prematurely terminates the macro value.
t. Fix typo in the readline color prefix extension that it uses for coloring
filename prefixes when displaying possible completions.
u. Call the filename rewrite hook on the word being completed before comparing
it against possible completions from the file system to get consistent
strings.
v. Fix infinite recursion that can happen if someone binds a key that doesn't
have a different upper and lower case represenation to do-lowercase-version.
w. Check for non-ANSI (dumb) terminals a little more thoroughly.
x. Don't attempt to history-expand the `quick substitution' character at the
beginning of a line if the application has set the quoting state to single
quotes.
y. Fix small memory leak if non-incremental or incremental search is
interrupted by a signal.
z. Loading very large history files should be much faster.
aa. Retry opening startup files if the open is interrupted by a signal
and is not automatically restarted.
bb. Make sure the bracketed-paste input buffer is null-terminated when read
returns an error.
cc. Fixed a small memory leak in execute-named-command if the command doesn't
exist or the function doesn't return.
dd. Fix for attempting to change case of invalid multibyte characters.
ee. Fix for possible completions that compare identically when using case-
insensitive completion but have different byte lengths.
ff. Fix to make non-incremental searches use undo lists and set the history
position the same way as incremental searches.
gg. Don't check for signals when handling a received signal.
hh. Fix off-by-one error when tokenizing words like $((expr)) while performing
history expansion.
ii. Fixes for incremental searches and redisplay in the C locale.
jj. Fixes for some use-after-free of the undo list errors when stacking multiple
commands that use rl_maybe_replace_line to save changes to a history entry.
kk. Fixes to ensure that completion-prefix-display-length and
colored-completion-prefix are mutually exclusive.
ll. Fixed a bug that allowed a history search to change the current history
list position.
mm. Fixed a bug that allowed ^G to retain a saved command to execute.
nn. Updates to new export-completions command to allow filename suffixes.
oo. Fixed a redisplay bug with prompts containing multiple sequences of
invisible characters that are longer than the screen width.
pp. The history library no longer skips blank lines while it is reading a
multiline history entry from a history file.
2. New Features in Readline
a. Output a newline if there is no prompt and readline reads an empty line.
b. The history library falls back to stdio when writing the history list if
mmap fails.
c. New bindable variable `search-ignore-case', causes readline to perform
case-insensitive incremental and non-incremental history searches.
d. rl_full_quoting_desired: new application-settable variable, causes all
completions to be quoted as if they were filenames.
e. rl_macro_display_hook: new application-settable function pointer, used if
the application wants to print macro values itself instead of letting
readline do it
f. rl_reparse_colors: new application-callable function, reparses $LS_COLORS
(presumably after the user changes it)
g. rl_completion_rewrite_hook: new application-settable function pointer,
called to modify the word being completed before comparing it against
pathnames from the file system.
h. execute-named-command: a new bindable command that reads the name of a
readline command from the standard input and executes it. Bound to M-x
in emacs mode by default.
i. Incremental and non-incremental searches now allow ^V/^Q (or, in the former
case, anything bound to quoted-insert) to quote characters in the search
string.
j. Documentation has been significantly updated.
k. New `force-meta-prefix' bindable variable, which forces the use of ESC as
the meta prefix when using "\M-" in key bindings instead of overloading
convert-meta.
l. The default value for `readline-colored-completion-prefix' no longer has a
leading `.'; the original report was based on a misunderstanding.
m. There is a new bindable command, `export-completions', which writes the
possible completions for a word to the standard output in a defined format.
n. Readline can reset its idea of the screen dimensions when executing after
a SIGCONT.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-8.2, and
the previous version, readline-8.1.
1. Changes to Readline
a. Fixed a problem with cleaning up active marks when using callback mode.
b. Fixed a problem with arithmetic comparison operators checking the version.
c. Fixed a problem that could cause readline not to build on systems without
POSIX signal functions.
d. Fixed a bug that could cause readline to crash if the application removed
the callback line handler before readline read all typeahead.
e. Added additional checks for read errors in the middle of readline commands.
f. Fixed a redisplay problem that occurred when switching from the digit-
argument prompt `(arg: N)' back to the regular prompt and the regular
prompt contained invisible characters.
g. Fixed a problem with restoring the prompt when aborting an incremental
search.
h. Fix a problem with characters > 128 not being displayed correctly in certain
single-byte encodings.
i. Fixed a problem with unix-filename-rubout that caused it to delete too much
when applied to a pathname consisting only of one or more slashes.
j. Fixed a display problem that caused the prompt to be wrapped incorrectly if
the screen changed dimensions during a call to readline() and the prompt
became longer than the screen width.
k. Fixed a problem that caused the \r output by turning off bracketed paste
to overwrite the line if terminal echo was disabled.
l. Fixed a bug that could cause colored-completion-prefix to not display if
completion-prefix-display-length was set.
m. Fixed a problem with line wrapping prompts when a group of invisible
characters runs to the right edge of the screen and the prompt extends
longer then the screen width.
n. Fixed a couple problems that could cause rl_end to be set incorrectly by
transpose-words.
o. Prevent some display problems when running a command as the result of a
trap or one bound using `bind -x' and the command generates output.
p. Fixed an issue with multi-line prompt strings that have one or more
invisible characters at the end of a physical line.
q. Fixed an issue that caused a history line's undo list to be cleared when
it should not have been.
r. When replacing a history entry, make sure the existing entry has a non-NULL
timestamp before copying it; it may have been added by the application, not
the history library.
2. New Features in Readline
a. There is now an HS_HISTORY_VERSION containing the version number of the
history library for applications to use.
b. History expansion better understands multiple history expansions that may
contain strings that would ordinarily inhibit history expansion (e.g.,
`abc!$!$').
c. There is a new framework for readline timeouts, including new public
functions to set timeouts and query how much time is remaining before a
timeout hits, and a hook function that can trigger when readline times
out. There is a new state value to indicate a timeout.
d. Automatically bind termcap key sequences for page-up and page-down to
history-search-backward and history-search-forward, respectively.
e. There is a new `fetch-history' bindable command that retrieves the history
entry corresponding to its numeric argument. Negative arguments count back
from the end of the history.
f. `vi-undo' is now a bindable command.
g. There is a new option: `enable-active-region'. This separates control of
the active region and bracketed-paste. It has the same default value as
bracketed-paste, and enabling bracketed paste enables the active region.
Users can now turn off the active region while leaving bracketed paste
enabled.
h. rl_completer_word_break_characters is now `const char *' like
rl_basic_word_break_characters.
i. Readline looks in $LS_COLORS for a custom filename extension
(*.readline-colored-completion-prefix) and uses that as the default color
for the common prefix displayed when `colored-completion-prefix' is set.
j. Two new bindable string variables: active-region-start-color and
active-region-end-color. The first sets the color used to display the
active region; the second turns it off. If set, these are used in place
of terminal standout mode.
k. New readline state (RL_STATE_EOF) and application-visible variable
(rl_eof_found) to allow applications to detect when readline reads EOF
before calling the deprep-terminal hook.
l. There is a new configuration option: --with-shared-termcap-library, which
forces linking the shared readline library with the shared termcap (or
curses/ncurses/termlib) library so applications don't have to do it.
m. Readline now checks for changes to locale settings (LC_ALL/LC_CTYPE/LANG)
each time it is called, and modifies the appropriate locale-specific display
and key binding variables when the locale changes.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-8.1, and
the previous version, readline-8.0.
1. Changes to Readline
a. There are a number of fixes that were found as the result of fuzzing with
random input.
b. Changed the revert-all-at-newline behavior to make sure to start at the end
of the history list when doing it, instead of the line where the user hit
return.
c. When parsing `set' commands from the inputrc file or an application, readline
now allows trailing whitespace.
d. Fixed a bug that left a file descriptor open to the history file if the
file size was 0.
e. Fixed a problem with binding key sequences containing meta characters.
f. Fixed a bug that caused the wrong line to be displayed if the user tried to
move back beyond the beginning of the history list, or forward past the end
of the history list.
g. If readline catches SIGTSTP, it now sets a hook that allows the calling
application to handle it if it desires.
h. Fixed a redisplay problem with a prompt string containing embedded newlines.
i. Fixed a problem with completing filenames containing invalid multibyte
sequences when case-insensitive comparisons are enabled.
j. Fixed a redisplay problem with prompt strings containing invisible multibyte
characters.
k. Fixed a problem with multibyte characters mapped to editing commands that
modify the search string in incremental search.
l. Fixed a bug with maintaining the key sequence while resolving a bound
command in the presence of ambiguous sequences (sequences with a common
prefix), in most cases while attempting to unbind it.
m. Fixed several buffer overflows found as the result of fuzzing.
n. Reworked backslash handling when translating key sequences for key binding
to be more uniform and consistent, which introduces a slight backwards
incompatibility.
o. Fixed a bug with saving the history that resulted in errors not being
propagated to the calling application when the history file is not writable.
p. Readline only calls chown(2) on a newly-written history file if it really
needs to, instead of having it be a no-op.
q. Readline now behaves better when operate-and-get-next is used when the
history list is `full': when there are already $HISTSIZE entries.
r. Fixed a bug that could cause vi redo (`.') of a replace command not to work
correctly in the C or POSIX locale.
s. Fixed a bug with vi-mode digit arguments that caused the last command to be
set incorrectly. This prevents yank-last-arg from working as intended, for
example.
t. Make sure that all undo groups are closed when leaving vi insertion mode.
u. Make sure that the vi-mode `C' and `c' commands enter insert mode even if
the motion command doesn't have any effect.
v. Fixed several potential memory leaks in the callback mode context handling.
w. If readline is handling a SIGTTOU, make sure SIGTTOU is blocked while
executing the terminal cleanup code, since it's no longer run in a signal
handling context.
x. Fixed a bug that could cause an application with an application-specific
redisplay function to crash if the line data structures had not been
initialized.
y. Terminals that are named "dumb" or unknown do not enable bracketed paste
by default.
z. Ensure that disabling bracketed paste turns off highlighting the incremental
search string when the search is successful.
2. New Features in Readline
a. If a second consecutive completion attempt produces matches where the first
did not, treat it as a new completion attempt and insert a match as
appropriate.
b. Bracketed paste mode works in more places: incremental search strings, vi
overstrike mode, character search, and reading numeric arguments.
c. Readline automatically switches to horizontal scrolling if the terminal has
only one line.
d. Unbinding all key sequences bound to a particular readline function now
descends into keymaps for multi-key sequences.
e. rl-clear-display: new bindable command that clears the screen and, if
possible, the scrollback buffer (bound to emacs mode M-C-l by default).
f. New active mark and face feature: when enabled, it will highlight the text
inserted by a bracketed paste (the `active region') and the text found by
incremental and non-incremental history searches. This is tied to bracketed
paste and can be disabled by turning off bracketed paste.
g. Readline sets the mark in several additional commands.
h. Bracketed paste mode is enabled by default. There is a configure-time
option (--enable-bracketed-paste-default) to set the default to on or off.
i. Readline tries to take advantage of the more regular structure of UTF-8
characters to identify the beginning and end of characters when moving
through the line buffer.
j. The bindable operate-and-get-next command (and its default bindings) are
now part of readline instead of a bash-specific addition.
k. The signal cleanup code now blocks SIGINT while processing after a SIGINT.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-8.0, and the
previous version, readline-7.0.
1. Changes to Readline
a. Added a guard to prevent nested macros from causing an infinite expansion
loop.
b. Instead of allocating enough history list entries to hold the maximum list
size, cap the number allocated initially.
c. Added a strategy to avoid allocating huge amounts of memory if a block of
history entries without timestamps occurs after a block with timestamps.
d. Added support for keyboard timeouts when an ESC character is the last
character in a macro.
e. There are several performance improvements when in a UTF-8 locale.
f. Readline does a better job of preserving the original set of blocked
signals when using pselect() to wait for input.
g. Fixed a bug that caused multibyte characters in macros to be mishandled.
h. Fixed several bugs in the code that calculates line breaks when expanding
prompts that span several lines, contain multibyte characters, and contain
invisible character seqeuences.
i. Fixed several bugs in cursor positioning when displaying lines with prompts
containing invisible characters and multibyte characters.
j. When performing case-insensitive completion, Readline no longer sorts the
list of matches unless directed to do so.
k. Fixed a problem with key sequences ending with a backslash.
l. Fixed out-of-bounds and free memory read errors found via fuzzing.
m. Fixed several cases where the mark was set to an invalid value.
n. Fixed a problem with the case-changing operators in the case where the
lower and upper case versions of a character do not have the same number
of bytes.
o. Handle incremental and non-incremental search character reads returning EOF.
p. Handle the case where a failing readline command at the end of a multi-key
sequence could be misinterpreted.
q. The history library now prints a meaningful error message if the history
file isn't a regular file.
r. Fixed a problem with vi-mode redo (`.') on a command when trying to replace
a multibyte character.
s. The key binding code now attempts to remove a keymap if a key unbinding
leaves it empty.
t. Fixed a line-wrapping issue that caused problems for some terminal
emulators.
u. If there is a key bound to the tty's VDISCARD special character, readline
disables VDISCARD while it is active.
v. Fixed a problem with exiting bracketed paste mode on terminals that assume
the bracketed paste mode character sequence contains visible characters.
w. Fixed a bug that could cause a key binding command to refer to an
uninitialized variable.
x. Added more UTF-8-specific versions of multibyte functions, and optimized
existing functions if the current locale uses UTF-8 encoding.
y. Fixed a problem with bracketed-paste inserting more than one character and
interacting with other readline functions.
z. Fixed a bug that caused the history library to attempt to append a history
line to a non-existent history entry.
aa. If using bracketed paste mode, output a newline after the \r that is the
last character of the mode disable string to avoid overwriting output.
bb. Fixes to the vi-mode `b', `B', `w', `W', `e', and `E' commands to better
handle multibyte characters.
cc. Fixed a redisplay problem that caused an extra newline to be generated on
accept-line when the line length is exactly the screenwidth.
dd. Fixed a bug with adding multibyte characters to an incremental search
string.
ee. Fixed a bug with redoing text insertions in vi mode.
ff. Fixed a bug with pasting text into an incremental search string if bracketed
paste mode is enabled. ESC cannot be one of the incremental search
terminator characters for this to work.
gg. Fixed a bug with anchored search patterns when performing searches in vi
mode.
2. New Features in Readline
a. Non-incremental vi-mode search (`N', `n') can search for a shell pattern, as
Posix specifies (uses fnmatch(3) if available).
b. There are new `next-screen-line' and `previous-screen-line' bindable
commands, which move the cursor to the same column in the next, or previous,
physical line, respectively.
c. There are default key bindings for control-arrow-key key combinations.
d. A negative argument (-N) to `quoted-insert' means to insert the next N
characters using quoted-insert.
e. New public function: rl_check_signals(), which allows applications to
respond to signals that readline catches while waiting for input using
a custom read function.
f. There is new support for conditionally testing the readline version in an
inputrc file, with a full set of arithmetic comparison operators available.
g. There is a simple variable comparison facility available for use within an
inputrc file. Allowable operators are equality and inequality; string
variables may be compared to a value; boolean variables must be compared to
either `on' or `off'; variable names are separated from the operator by
whitespace.
h. The history expansion library now understands command and process
substitution and extended globbing and allows them to appear anywhere in a
word.
i. The history library has a new variable that allows applications to set the
initial quoting state, so quoting state can be inherited from a previous
line.
j. Readline now allows application-defined keymap names; there is a new public
function, rl_set_keymap_name(), to do that.
k. The "Insert" keypad key, if available, now puts readline into overwrite
mode.
-------------------------------------------------------------------------------
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.
s. Colored completion prefixes are now displayed using a different color, less
likely to collide with files.
t. Fixed a bug that caused vi-mode character search to misbehave when
running in callback mode.
u. Fixed a bug that caused output to be delayed when input is coming from a
macro in vi-mode.
v. Fixed a bug that caused the vi-mode `.' command to misbehave when redoing
a multi-key key sequence via a macro.
w. Fixed a bug that caused problems with applications that supply their own
input function when performing completion.
x. When read returns -1/EIO when attempting to read a key, return an error
instead of line termination back to the caller.
y. Updated tty auditing feature based on patch from Red Hat.
z. Fixed a bug that could cause the history library to crash on overflows
introduced by malicious editing of timestamps in the history file.
aa. The history file writing functions only attempt to create and use a backup
history file if the history file exists and is a regular file.
bb. Fixed an out-of-bounds read in readline's internal tilde expansion interface.
cc. Fixed several redisplay bugs with prompt strings containing multibyte
and non-visible characters whose physical length is longer than the screen
width.
dd. Fixed a redisplay bug with prompt strings containing invisible characters
whose physical length exceeds the screen width and using incremental search.
ee. Readline prints more descriptive error messages when it encounters errors
while reading an inputrc file.
ff. Fixed a bug in the character insertion code that attempts to optimize
typeahead when it reads a character that is not bound to self-insert and
resets the key sequence state.
gg. When refreshing the line as the result of a key sequence, Readline attempts
to redraw only the last line of a multiline prompt.
hh. Fixed an issue that caused completion of git commands to display
incorrectly when using colored-completion-prefix.
ii. Fixed several redisplay bugs having to do with multibyte characters and
invisible characters in prompt strings.
jj. Fixed a bug that caused mode strings to be displayed incorrectly if the
prompt was shorter than the mode string.
2. New Features in Readline
a. The history truncation code now uses the same error recovery mechanism 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.
j. If an incremental search string has its last character removed with DEL, the
resulting empty search string no longer matches the previous line.
k. If readline reads a history file that begins with `#' (or the value of
the history comment character) and has enabled history timestamps, the history
entries are assumed to be delimited by timestamps. This allows multi-line
history entries.
l. Readline now throws an error if it parses a key binding without a terminating
`:' or whitespace.
m. The default binding for ^W in vi mode now uses word boundaries specified
by Posix (vi-unix-word-rubout is bindable command name).
n. rl_clear_visible_line: new application-callable function; clears all
screen lines occupied by the current visible readline line.
o. rl_tty_set_echoing: application-callable function that controls whether
or not readline thinks it is echoing terminal output.
p. Handle >| and strings of digits preceding and following redirection
specifications as single tokens when tokenizing the line for history
expansion.
q. Fixed a bug with displaying completions when the prefix display length
is greater than the length of the completions to be displayed.
r. The :p history modifier now applies to the entire line, so any expansion
specifying :p causes the line to be printed instead of expanded.
s. New application-callable function: rl_pending_signal(): returns the signal
number of any signal readline has caught but not yet handled.
t. New application-settable variable: rl_persistent_signal_handlers: if set
to a non-zero value, readline will enable the readline-6.2 signal handler
behavior in callback mode: handlers are installed when
rl_callback_handler_install is called and removed removed when a complete
line has been read.
-------------------------------------------------------------------------------
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. Changes to Readline
a. Fixed a bug that caused the unconverted filename to be added to the list of
completions when the application specified filename conversion functions.
b. Fixed a bug that caused the wrong filename to be passed to opendir when the
application has specified a filename dequoting function.
c. Fixed a bug when repeating a character search in vi mode in the case where
there was no search to repeat.
d. When show-all-if-ambiguous is set, the completion routines no longer insert
a common match prefix that is shorter than the text being completed.
e. The full set of vi editing commands may now be used in callback mode.
f. Fixed a bug that caused readline to not update its idea of the terminal
dimensions while running in `no-echo' mode.
h. Fixed a bug that caused readline to dump core if an application called
rl_prep_terminal without setting rl_instream.
i. Fixed a bug that caused meta-prefixed characters bound to incremental
search forward or backward to not be recognized if they were typed
subsequently.
j. The incremental search code treats key sequences that map to the same
functions as (default) ^G, ^W, and ^Y as equivalent to those characters.
k. Fixed a bug in menu-complete that caused it to misbehave with large
negative argument.
l. Fixed a bug that caused vi-mode yank-last-arg to ring the bell when invoked
at the end of the line.
m. Fixed a bug that made an explicit argument of 0 to yank-last-arg behave
as if it were a negative argument.
n. Fixed a bug that caused directory names in words to be completed to not
be dequoted correctly.
2. 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.
b. New bindable variable `completion-display-width' to set the number of
columns used when displaying completions.
c. New bindable variable `completion-case-map' to cause case-insensitive
completion to treat `-' and `_' as identical.
d. There are new bindable vi-mode command names to avoid readline's case-
insensitive matching not allowing them to be bound separately.
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.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-6.1,
and the previous version, readline-6.0.
1. Changes to Readline
a. The SIGWINCH signal handler now avoids calling the redisplay code if
one arrives while in the middle of redisplay.
b. Changes to the timeout code to make sure that timeout values greater
than one second are handled better.
c. Fixed a bug in the redisplay code that was triggered by a prompt
containing invisible characters exactly the width of the screen.
d. Fixed a bug in the redisplay code encountered when running in horizontal
scroll mode.
e. Fixed a bug that prevented menu completion from properly completing
filenames.
f. Fixed a redisplay bug caused by a multibyte character causing a line to
wrap.
g. Fixed a bug that caused key sequences of two characters to not be
recognized when a longer sequence identical in the first two characters
was bound.
h. Fixed a bug that caused history expansion to be attempted on $'...'
single-quoted strings.
i. Fixed a bug that caused incorrect redisplay when the prompt contained
multibyte characters in an `invisible' sequence bracketed by \[ and
\].
j. Fixed a bug that caused history expansion to short-circuit after
encountering a multibyte character.
k. Fixed a bug that caused applications using the callback interface to not
react to SIGINT (or other signals) until another character arrived.
2. 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 rewrite 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 document details the changes between this version, readline-6.0,
and the previous version, readline-5.2.
1. Changes to Readline
a. Fixed a number of redisplay errors in environments supporting multibyte
characters.
b. Fixed bugs in vi command mode that caused motion commands to inappropriately
set the mark.
c. When using the arrow keys in vi insertion mode, readline allows movement
beyond the current end of the line (unlike command mode).
d. Fixed bugs that caused readline to loop when the terminal has been taken
away and reads return -1/EIO.
e. Fixed bugs in redisplay occurring when displaying prompts containing
invisible characters.
f. Fixed a bug that caused the completion append character to not be reset to
the default after an application-specified completion function changed it.
g. Fixed a problem that caused incorrect positioning of the cursor while in
emacs editing mode when moving forward at the end of a line while using
a locale supporting multibyte characters.
h. Fixed an off-by-one error that caused readline to drop every 511th
character of buffered input.
i. Fixed a bug that resulted in SIGTERM not being caught or cleaned up.
j. Fixed redisplay bugs caused by multiline prompts with invisible characters
or no characters following the final newline.
k. Fixed redisplay bug caused by prompts consisting solely of invisible
characters.
l. Fixed a bug in the code that buffers characters received very quickly in
succession which caused characters to be dropped.
m. Fixed a bug that caused readline to reference uninitialized data structures
if it received a SIGWINCH before completing initialization.
n. Fixed a bug that caused the vi-mode `last command' to be set incorrectly
and therefore unrepeatable.
o. Fixed a bug that caused readline to disable echoing when it was being used
with an output file descriptor that was not a terminal.
p. Readline now blocks SIGINT while manipulating internal data structures
during redisplay.
q. Fixed a bug in redisplay that caused readline to segfault when pasting a
very long line (over 130,000 characters).
r. Fixed bugs in redisplay when using prompts with no visible printing
characters.
s. Fixed a bug that caused redisplay errors when using prompts with invisible
characters and numeric arguments to a command in a multibyte locale.
t. Fixed a bug that caused redisplay errors when using prompts with invisible
characters spanning more than two physical screen lines.
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 document details the changes between this version, readline-5.2,
and the previous version, readline-5.1.
1. Changes to Readline
a. Fixed a problem that caused segmentation faults when using readline in
callback mode and typing consecutive DEL characters on an empty line.
b. Fixed several redisplay problems with multibyte characters, all having to
do with the different code paths and variable meanings between single-byte
and multibyte character redisplay.
c. Fixed a problem with key sequence translation when presented with the
sequence \M-\C-x.
d. Fixed a problem that prevented the `a' command in vi mode from being
undone and redone properly.
e. Fixed a problem that prevented empty inserts in vi mode from being undone
properly.
f. Fixed a problem that caused readline to initialize with an incorrect idea
of whether or not the terminal can autowrap.
g. Fixed output of key bindings (like bash `bind -p') to honor the setting of
convert-meta and use \e where appropriate.
h. Changed the default filename completion function to call the filename
dequoting function if the directory completion hook isn't set. This means
that any directory completion hooks need to dequote the directory name,
since application-specific hooks need to know how the word was quoted,
even if no other changes are made.
i. Fixed a bug with creating the prompt for a non-interactive search string
when there are non-printing characters in the primary prompt.
j. Fixed a bug that caused prompts with invisible characters to be redrawn
multiple times in a multibyte locale.
k. Fixed a bug that could cause the key sequence scanning code to return the
wrong function.
l. Fixed a problem with the callback interface that caused it to fail when
using multi-character keyboard macros.
m. Fixed a bug that could cause a core dump when an edited history entry was
re-executed under certain conditions.
n. Fixed a bug that caused readline to reference freed memory when attmpting
to display a portion of the prompt.
o. Fixed a bug with prompt redisplay in a multi-byte locale to avoid redrawing
the prompt and input line multiple times.
p. Fixed history expansion to not be confused by here-string redirection.
q. Readline no longer treats read errors by converting them to newlines, as
it does with EOF. This caused partial lines to be returned from readline().
r. Fixed a redisplay bug that occurred in multibyte-capable locales when the
prompt was one character longer than the screen width.
2. 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 document details the changes between this version, readline-5.1,
and the previous version, readline-5.0.
1. Changes to Readline
a. Fixed a bug that caused multiliine prompts to be wrapped and displayed
incorrectly.
b. Fixed a bug that caused ^P/^N in emacs mode to fail to display the current
line correctly.
c. Fixed a problem in computing the number of invisible characters on the first
line of a prompt whose length exceeds the screen width.
d. Fixed vi-mode searching so that failure preserves the current line rather
than the last line in the history list.
e. Fixed the vi-mode `~' command (change-case) to have the correct behavior at
end-of-line when manipulating multibyte characters.
f. Fixed the vi-mode `r' command (change-char) to have the correct behavior at
end-of-line when manipulating multibyte characters.
g. Fixed multiple bugs in the redisplay of multibyte characters: displaying
prompts longer than the screen width containing multibyte characters,
h. Fix the calculation of the number of physical characters in the prompt
string when it contains multibyte characters.
i. A non-zero value for the `rl_complete_suppress_append' variable now causes
no `/' to be appended to a directory name.
j. Fixed forward-word and backward-word to work when words contained
multibyte characters.
k. Fixed a bug in finding the delimiter of a `?' substring when performing
history expansion in a locale that supports multibyte characters.
l. Fixed a memory leak caused by not freeing the timestamp in a history entry.
m. Fixed a bug that caused "\M-x" style key bindings to not obey the setting
of the `convert-meta' variable.
n. Fixed saving and restoring primary prompt when prompting for incremental
and non-incremental searches; search prompts now display multibyte
characters correctly.
o. Fixed a bug that caused keys originally bound to self-insert but shadowed
by a multi-character key sequence to not be inserted.
p. Fixed code so rl_prep_term_function and rl_deprep_term_function aren't
dereferenced if NULL (matching the documentation).
q. Extensive changes to readline to add enough state so that commands
requiring additional characters (searches, multi-key sequences, numeric
arguments, commands requiring an additional specifier character like
vi-mode change-char, etc.) work without synchronously waiting for
additional input.
r. Lots of changes so readline builds and runs on MinGW.
s. Readline no longer tries to modify the terminal settings when running in
callback mode.
t. The Readline display code no longer sets the location of the last invisible
character in the prompt if the \[\] sequence is empty.
u. The `change-case' command now correctly changes the case of multibyte
characters.
v. Changes to the shared library construction scripts to deal with Windows
DLL naming conventions for Cygwin.
w. Fixed the redisplay code to avoid core dumps resulting from a poorly-timed
SIGWINCH.
x. Fixed the non-incremental search code in vi mode to dispose of any current
undo list when copying a line from the history into the current editing
buffer.
y. Fixed a bug that caused reversing the incremental search direction to
not work correctly.
z. Fixed the vi-mode `U' command to only undo up to the first time insert mode
was entered, as Posix specifies.
aa. Fixed a bug in the vi-mode `r' command that left the cursor in the wrong
place.
bb. Fixed a redisplay bug caused by moving the cursor vertically to a line
with invisible characters in the prompt in a multibyte locale.
cc. Fixed a bug that could cause the terminal special chars to be bound in the
wrong keymap in vi mode.
2. 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. The `C-w' binding in incremental search now understands multibyte
characters.
g. New application-callable auxiliary function, rl_variable_value, returns
a string corresponding to a readline variable's value.
h. When parsing inputrc files and variable binding commands, the parser
strips trailing whitespace from values assigned to boolean variables
before checking them.
i. 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 document details the changes between this version, readline-5.0,
and the previous version, readline-4.3.
1. Changes to Readline
a. Fixes to avoid core dumps because of null pointer references in the
multibyte character code.
b. Fix to avoid infinite recursion caused by certain key combinations.
c. Fixed a bug that caused the vi-mode `last command' to be set incorrectly.
d. Readline no longer tries to read ahead more than one line of input, even
when more is available.
e. Fixed the code that adjusts the point to not mishandle null wide
characters.
f. Fixed a bug in the history expansion `g' modifier that caused it to skip
every other match.
g. Fixed a bug that caused the prompt to overwrite previous output when the
output doesn't contain a newline and the locale supports multibyte
characters. This same change fixes the problem of readline redisplay
slowing down dramatically as the line gets longer in multibyte locales.
h. History traversal with arrow keys in vi insertion mode causes the cursor
to be placed at the end of the new line, like in emacs mode.
i. The locale initialization code does a better job of using the right
precedence and defaulting when checking the appropriate environment
variables.
j. Fixed the history word tokenizer to handle <( and >( better when used as
part of bash.
k. The overwrite mode code received several bug fixes to improve undo.
l. Many speedups to the multibyte character redisplay code.
m. The callback character reading interface should not hang waiting to read
keyboard input.
n. Fixed a bug with redoing vi-mode `s' command.
o. The code that initializes the terminal tracks changes made to the terminal
special characters with stty(1) (or equivalent), so that these changes
are reflected in the readline bindings. New application-callable function
to make it work: rl_tty_unset_default_bindings().
p. Fixed a bug that could cause garbage to be inserted in the buffer when
changing character case in vi mode when using a multibyte locale.
q. Fixed a bug in the redisplay code that caused problems on systems
supporting multibyte characters when moving between history lines when the
new line has more glyphs but fewer bytes.
r. Undo and redo now work better after exiting vi insertion mode.
s. Make sure system calls are restarted after a SIGWINCH is received using
SA_RESTART.
t. Improvements to the code that displays possible completions when using
multibyte characters.
u. Fixed a problem when parsing nested if statements in inputrc files.
v. The completer now takes multibyte characters into account when looking for
quoted substrings on which to perform completion.
w. The history search functions now perform better bounds checking on the
history list.
x. Change to history expansion functions to treat `^' as equivalent to word
one, as the documentation states.
y. Some changes to the display code to improve display and redisplay of
multibyte characters.
z. Changes to speed up the multibyte character redisplay code.
aa. Fixed a bug in the vi-mode `E' command that caused it to skip over the
last character of a word if invoked while point was on the word's
next-to-last character.
bb. Fixed a bug that could cause incorrect filename quoting when
case-insensitive completion was enabled and the word being completed
contained backslashes quoting word break characters.
cc. Fixed a bug in redisplay triggered when the prompt string contains
invisible characters.
dd. Fixed some display (and other) bugs encountered in multibyte locales
when a non-ascii character was the last character on a line.
ee. Fixed some display bugs caused by multibyte characters in prompt strings.
ff. Fixed a problem with history expansion caused by non-whitespace characters
used as history word delimiters.
gg. Fixed a problem that could cause readline to refer to freed memory when
moving between history lines while doing searches.
hh. Improvements to the code that expands and displays prompt strings
containing multibyte characters.
ii. Fixed a problem with vi-mode not correctly remembering the numeric argument
to the last `c'hange command for later use with `.'.
jj. Fixed a bug in vi-mode that caused multi-digit count arguments to work
incorrectly.
kk. Fixed a problem in vi-mode that caused the last text modification command
to not be remembered across different command lines.
ll. Fixed problems with changing characters and changing case at the end of
the line.
mm. Fixed a problem with readline saving the contents of the current line
before beginning a non-interactive search.
nn. Fixed a problem with EOF detection when using rl_event_hook.
oo. Fixed a problem with the vi mode `p' and `P' commands ignoring numeric
arguments.
2. 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.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-4.3,
and the previous version, readline-4.2a.
1. Changes to Readline
a. Fixed output of comment-begin character when listing variable values.
b. Added some default key bindings for common escape sequences produced by
HOME and END keys.
c. Fixed the mark handling code to be more emacs-compatible.
d. A bug was fixed in the code that prints possible completions to keep it
from printing empty strings in certain circumstances.
e. Change the key sequence printing code to print ESC as M\- if ESC is a
meta-prefix character -- it's easier for users to understand than \e.
f. Fixed unstifle_history() to return values that match the documentation.
g. Fixed the event loop (rl_event_hook) to handle the case where the input
file descriptor is invalidated.
h. Fixed the prompt display code to work better when the application has a
custom redisplay function.
i. Changes to make reading and writing the history file a little faster, and
to cope with huge history files without calling abort(3) from xmalloc.
j. The vi-mode `S' and `s' commands are now undone correctly.
k. Fixed a problem which caused the display to be messed up when the last
line of a multi-line prompt (possibly containing invisible characters)
was longer than the screen width.
2. New Features in Readline
a. Support for key `subsequences': allows, e.g., ESC and ESC-a to both
be bound to readline functions. Now the arrow keys may be used in vi
insert mode.
b. When listing completions, and the number of lines displayed is more than
the screen length, readline uses an internal pager to display the results.
This is controlled by the `page-completions' variable (default on).
c. New code to handle editing and displaying multibyte characters.
d. The behavior introduced in bash-2.05a of deciding whether or not to
append a slash to a completed name that is a symlink to a directory has
been made optional, controlled by the `mark-symlinked-directories'
variable (default is the 2.05a behavior).
e. The `insert-comment' command now acts as a toggle if given a numeric
argument: if the first characters on the line don't specify a
comment, insert one; if they do, delete the comment text
f. New application-settable completion variable:
rl_completion_mark_symlink_dirs, allows an application's completion
function to temporarily override the user's preference for appending
slashes to names which are symlinks to directories.
g. New function available to application completion functions:
rl_completion_mode, to tell how the completion function was invoked
and decide which argument to supply to rl_complete_internal (to list
completions, etc.).
h. Readline now has an overwrite mode, toggled by the `overwrite-mode'
bindable command, which could be bound to `Insert'.
i. New application-settable completion variable:
rl_completion_suppress_append, inhibits appending of
rl_completion_append_character to completed words.
j. New key bindings when reading an incremental search string: ^W yanks
the currently-matched word out of the current line into the search
string; ^Y yanks the rest of the current line into the search string,
DEL or ^H deletes characters from the search string.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-4.2a,
and the previous version, readline-4.2.
1. Changes to Readline
a. More `const' and type casting fixes.
b. Changed rl_message() to use vsnprintf(3) (if available) to fix buffer
overflow problems.
c. The completion code no longer appends a `/' or ` ' to a match when
completing a symbolic link that resolves to a directory name, unless
the match does not add anything to the word being completed. This
means that a tab will complete the word up to the full name, but not
add anything, and a subsequent tab will add a slash.
d. Fixed a trivial typo that made the vi-mode `dT' command not work.
e. Fixed the tty code so that ^S and ^Q can be inserted with rl_quoted_insert.
f. Fixed the tty code so that ^V works more than once.
g. Changed the use of __P((...)) for function prototypes to PARAMS((...))
because the use of __P in typedefs conflicted g++ and glibc.
h. The completion code now attempts to do a better job of preserving the
case of the word the user typed if ignoring case in completions.
i. Readline defaults to not echoing the input and lets the terminal
initialization code enable echoing if there is a controlling terminal.
j. The key binding code now processes only two hex digits after a `\x'
escape sequence, and the documentation was changed to note that the
octal and hex escape sequences result in an eight-bit value rather
than strict ASCII.
k. Fixed a few places where negative array subscripts could have occurred.
l. Fixed the vi-mode code to use a better method to determine the bounds of
the array used to hold the marks, and to avoid out-of-bounds references.
m. Fixed the defines in chardefs.h to work better when chars are signed.
n. Fixed configure.in to use the new names for bash autoconf macros.
o. Readline no longer attempts to define its own versions of some ctype
macros if they are implemented as functions in libc but not as macros in
.
p. Fixed a problem where rl_backward could possibly set point to before
the beginning of the line.
q. Fixed Makefile to not put -I/usr/include into CFLAGS, since it can cause
include file problems.
2. New Features in Readline
a. Added extern declaration for rl_get_termcap to readline.h, making it a
public function (it was always there, just not in readline.h).
b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.
c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.
d. New bindable boolean readline variable: match-hidden-files. Controls
completion of files beginning with a `.' (on Unix). Enabled by default.
e. The history expansion code now allows any character to terminate a
`:first-' modifier, like csh.
f. The incremental search code remembers the last search string and uses
it if ^R^R is typed without a search string.
h. New bindable variable `history-preserve-point'. If set, the history
code attempts to place the user at the same location on each history
line retrieved with previous-history or next-history.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-4.2,
and the previous version, readline-4.1.
1. Changes to Readline
a. When setting the terminal attributes on systems using `struct termio',
readline waits for output to drain before changing the attributes.
b. A fix was made to the history word tokenization code to avoid attempts to
dereference a null pointer.
c. Readline now defaults rl_terminal_name to $TERM if the calling application
has left it unset, and tries to initialize with the resultant value.
d. Instead of calling (*rl_getc_function)() directly to get input in certain
places, readline now calls rl_read_key() consistently.
e. Fixed a bug in the completion code that allowed a backslash to quote a
single quote inside a single-quoted string.
f. rl_prompt is no longer assigned directly from the argument to readline(),
but uses memory allocated by readline. This allows constant strings to
be passed to readline without problems arising when the prompt processing
code wants to modify the string.
g. Fixed a bug that caused non-interactive history searches to return the
wrong line when performing multiple searches backward for the same string.
h. Many variables, function arguments, and function return values are now
declared `const' where appropriate, to improve behavior when linking with
C++ code.
i. The control character detection code now works better on systems where
`char' is unsigned by default.
j. The vi-mode numeric argument is now capped at 999999, just like emacs mode.
k. The Function, CPFunction, CPPFunction, and VFunction typedefs have been
replaced with a set of specific prototyped typedefs, though they are
still in the readline header files for backwards compatibility.
m. Nearly all of the (undocumented) internal global variables in the library
now have an _rl_ prefix -- there were a number that did not, like
screenheight, screenwidth, alphabetic, etc.
n. The ding() convenience function has been renamed to rl_ding(), though the
old function is still defined for backwards compatibility.
o. The completion convenience functions filename_completion_function,
username_completion_function, and completion_matches now have an rl_
prefix, though the old names are still defined for backwards compatibility.
p. The functions shared by readline and bash (linkage is satisfied from bash
when compiling with bash, and internally otherwise) now have an sh_ prefix.
q. Changed the shared library creation procedure on Linux and BSD/OS 4.x so
that the `soname' contains only the major version number rather than the
major and minor numbers.
r. Fixed a redisplay bug that occurred when the prompt spanned more than one
physical line and contained invisible characters.
s. Added a missing `includedir' variable to the Makefile.
t. When installing the shared libraries, make sure symbolic links are relative.
u. Added configure test so that it can set `${MAKE}' appropriately.
v. Fixed a bug in rl_forward that could cause the point to be set to before
the beginning of the line in vi mode.
w. Fixed a bug in the callback read-char interface to make it work when a
readline function pushes some input onto the input stream with
rl_execute_next (like the incremental search functions).
x. Fixed a file descriptor leak in the history file manipulation code that
was tripped when attempting to truncate a non-regular file (like
/dev/null).
y. Changes to make all of the exported readline functions declared in
readline.h have an rl_ prefix (rltty_set_default_bindings is now
rl_tty_set_default_bindings, crlf is now rl_crlf, etc.)
z. The formatted documentation included in the base readline distribution
is no longer removed on a `make distclean'.
aa. Some changes were made to avoid gcc warnings with -Wall.
bb. rl_get_keymap_by_name now finds keymaps case-insensitively, so
`set keymap EMACS' works.
cc. The history file writing and truncation functions now return a useful
status on error.
dd. Fixed a bug that could cause applications to dereference a NULL pointer
if a NULL second argument was passed to history_expand().
ee. If a hook function assigned to rl_event_hook sets rl_done to a non-zero
value, rl_read_key() now immediately returns '\n' (which is assumed to
be bound to accept-line).
2. New Features in Readline
a. The blink timeout for paren matching is now settable by applications,
via the rl_set_paren_blink_timeout() function.
b. _rl_executing_macro has been renamed to rl_executing_macro, which means
it's now part of the public interface.
c. Readline has a new variable, rl_readline_state, which is a bitmap that
encapsulates the current state of the library; intended for use by
callbacks and hook functions.
d. rlfe has a new -l option to log input and output (-a appends to logfile),
a new -n option to set the readline application name, and -v and -h
options for version and help information.
e. rlfe can now perform filename completion for the inferior process if the
OS has a /proc//cwd that can be read with readlink(2) to get the
inferior's current working directory.
f. A new file, rltypedefs.h, contains the new typedefs for function pointers
and is installed by `make install'.
g. New application-callable function rl_set_prompt(const char *prompt):
expands its prompt string argument and sets rl_prompt to the result.
h. New application-callable function rl_set_screen_size(int rows, int cols):
public method for applications to set readline's idea of the screen
dimensions.
i. The history example program (examples/histexamp.c) is now built as one
of the examples.
j. The documentation has been updated to cover nearly all of the public
functions and variables declared in readline.h.
k. New function, rl_get_screen_size (int *rows, int *columns), returns
readline's idea of the screen dimensions.
l. The timeout in rl_gather_tyi (readline keyboard input polling function)
is now settable via a function (rl_set_keyboard_input_timeout()).
m. Renamed the max_input_history variable to history_max_entries; the old
variable is maintained for backwards compatibility.
n. The list of characters that separate words for the history tokenizer is
now settable with a variable: history_word_delimiters. The default
value is as before.
o. There is a new history.3 manual page documenting the history library.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-4.1,
and the previous version, readline-4.0.
1. Changes to Readline
a. Changed the HTML documents so that the table-of-contents is no longer
a separate file.
b. Changes to the shared object configuration for: Irix 5.x, Irix 6.x,
OSF/1.
c. The shared library major and minor versions are now constructed
automatically by configure and substituted into the makefiles.
d. It's now possible to install the shared libraries separately from the
static libraries.
e. The history library tries to truncate the history file only if it is a
regular file.
f. A bug that caused _rl_dispatch to address negative array indices on
systems with signed chars was fixed.
g. rl-yank-nth-arg now leaves the history position the same as when it was
called.
h. Changes to the completion code to handle MS-DOS drive-letter:pathname
filenames.
i. Completion is now case-insensitive by default on MS-DOS.
j. Fixes to the history file manipulation code for MS-DOS.
k. Readline attempts to bind the arrow keys to appropriate defaults on MS-DOS.
l. Some fixes were made to the redisplay code for better operation on MS-DOS.
m. The quoted-insert code will now insert tty special chars like ^C.
n. A bug was fixed that caused the display code to reference memory before
the start of the prompt string.
o. More support for __EMX__ (OS/2).
p. A bug was fixed in readline's signal handling that could cause infinite
recursion in signal handlers.
q. A bug was fixed that caused the point to be less than zero when rl_forward
was given a very large numeric argument.
r. The vi-mode code now gets characters via the application-settable value
of rl_getc_function rather than calling rl_getc directly.
s. The history file code now uses O_BINARY mode when reading and writing
the history file on cygwin32.
t. Fixed a bug in the redisplay code for lines with more than 256 line
breaks.
u. A bug was fixed which caused invisible character markers to not be
stripped from the prompt string if the terminal was in no-echo mode.
v. Readline no longer tries to get the variables it needs for redisplay
from the termcap entry if the calling application has specified its
own redisplay function. Readline treats the terminal as `dumb' in
this case.
w. Fixes to the SIGWINCH code so that a multiple-line prompt with escape
sequences is redrawn correctly.
x. Changes to the install and install-shared targets so that the libraries
and header files are installed separately.
2. New Features in Readline
a. A new Readline `user manual' is in doc/rluserman.texinfo.
b. Parentheses matching is now always compiled into readline, and enabled
or disabled when the value of the `blink-matching-paren' variable is
changed.
c. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
d. MS-DOS systems now use ~/_history as the default history file.
e. history-search-{forward,backward} now leave the point at the end of the
line when the string to search for is empty, like
{reverse,forward}-search-history.
f. history-search-{forward,backward} now leave the last history line found
in the readline buffer if the second or subsequent search fails.
g. New function for use by applications: rl_on_new_line_with_prompt, used
when an application displays the prompt itself before calling readline().
h. New variable for use by applications: rl_already_prompted. An application
that displays the prompt itself before calling readline() must set this to
a non-zero value.
i. A new variable, rl_gnu_readline_p, always 1. The intent is that an
application can verify whether or not it is linked with the `real'
readline library or some substitute.
j. Per Bothner's `rlfe' (pronounced `Ralphie') readline front-end program
is included in the examples subdirectory, though it is not built
by default.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-4.0,
and the previous version, readline-2.2.
1. Changes to Readline
a. The version number is now 4.0, to match the major and minor version
numbers on the shared readline and history libraries. Future
releases will maintain the identical numbering.
b. Fixed a typo in the `make install' recipe that copied libreadline.a
to libhistory.old right after installing it.
c. The readline and history info files are now installed out of the source
directory if they are not found in the build directory.
d. The library no longer exports a function named `savestring' -- backwards
compatibility be damned.
e. There is no longer any #ifdef SHELL code in the source files.
f. Some changes were made to the key binding code to fix memory leaks and
better support Win32 systems.
g. Fixed a silly typo in the paren matching code -- it's microseconds, not
milliseconds.
h. The readline library should be compilable by C++ compilers.
i. The readline.h public header file now includes function prototypes for
all readline functions, and some changes were made to fix errors in the
source files uncovered by the use of prototypes.
j. The maximum numeric argument is now clamped at 1000000.
k. Fixes to rl_yank_last_arg to make it behave better.
l. Fixed a bug in the display code that caused core dumps if the prompt
string length exceeded 1024 characters.
m. The menu completion code was fixed to properly insert a single completion
if there is only one match.
n. A bug was fixed that caused the display code to improperly display tabs
after newlines.
o. A fix was made to the completion code in which a typo caused the wrong
value to be passed to the function that computed the longest common
prefix of the list of matches.
p. The completion code now checks the value of rl_filename_completion_desired,
which is set by application-supplied completion functions to indicate
that filename completion is being performed, to decide whether or not to
call an application-supplied `ignore completions' function.
q. Code was added to the history library to catch history substitutions
using `&' without a previous history substitution or search having been
performed.
2. New Features in Readline
a. There is a new script, support/shobj-conf, to do system-specific shared
object and library configuration. It generates variables for configure
to substitute into makefiles. The README file provides a detailed
explanation of the shared library creation process.
b. Shared libraries and objects are now built in the `shlib' subdirectory.
There is a shlib/Makefile.in to control the build process. `make shared'
from the top-level directory is still the right way to build shared
versions of the libraries.
c. rlconf.h is now installed, so applications can find out which features
have been compiled into the installed readline and history libraries.
d. rlstdc.h is now an installed header file.
e. Many changes to the signal handling:
o Readline now catches SIGQUIT and cleans up the tty before returning;
o A new variable, rl_catch_signals, is available to application writers
to indicate to readline whether or not it should install its own
signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
SIGTTIN, and SIGTTOU;
o A new variable, rl_catch_sigwinch, is available to application
writers to indicate to readline whether or not it should install its
own signal handler for SIGWINCH, which will chain to the calling
applications's SIGWINCH handler, if one is installed;
o There is a new function, rl_free_line_state, for application signal
handlers to call to free up the state associated with the current
line after receiving a signal;
o There is a new function, rl_cleanup_after_signal, to clean up the
display and terminal state after receiving a signal;
o There is a new function, rl_reset_after_signal, to reinitialize the
terminal and display state after an application signal handler
returns and readline continues
f. There is a new function, rl_resize_terminal, to reset readline's idea of
the screen size after a SIGWINCH.
g. New public functions: rl_save_prompt and rl_restore_prompt. These were
previously private functions with a `_' prefix. These functions are
used when an application wants to write a message to the `message area'
with rl_message and have the prompt restored correctly when the message
is erased.
h. New function hook: rl_pre_input_hook, called just before readline starts
reading input, after initialization.
i. New function hook: rl_display_matches_hook, called when readline would
display the list of completion matches. The new function
rl_display_match_list is what readline uses internally, and is available
for use by application functions called via this hook.
j. New bindable function, delete-char-or-list, like tcsh.
k. A new variable, rl_erase_empty_line, which, if set by an application using
readline, will cause readline to erase, prompt and all, lines on which the
only thing typed was a newline.
l. There is a new script, support/shlib-install, to install and uninstall
the shared readline and history libraries.
m. A new bindable variable, `isearch-terminators', which is a string
containing the set of characters that should terminate an incremental
search without being executed as a command.
n. A new bindable function, forward-backward-delete-char.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-2.2,
and the previous version, readline-2.1.
1. Changes to Readline
a. Added a missing `extern' to a declaration in readline.h that kept
readline from compiling cleanly on some systems.
b. The history file is now opened with mode 0600 when it is written for
better security.
c. Changes were made to the SIGWINCH handling code so that prompt redisplay
is done better.
d. ^G now interrupts incremental searches correctly.
e. A bug that caused a core dump when the set of characters to be quoted
when completing words was empty was fixed.
f. Fixed a problem in the readline test program rltest.c that caused a core
dump.
g. The code that handles parser directives in inputrc files now displays
more error messages.
h. The history expansion code was fixed so that the appearance of the
history comment character at the beginning of a word inhibits history
expansion for that word and the rest of the input line.
i. The code that prints completion listings now behaves better if one or
more of the filenames contains non-printable characters.
j. The time delay when showing matching parentheses is now 0.5 seconds.
2. New Features in Readline
a. There is now an option for `iterative' yank-last-arg handline, so a user
can keep entering `M-.', yanking the last argument of successive history
lines.
b. New variable, `print-completions-horizontally', which causes completion
matches to be displayed across the screen (like `ls -x') rather than up
and down the screen (like `ls').
c. New variable, `completion-ignore-case', which causes filename completion
and matching to be performed case-insensitively.
d. There is a new bindable command, `magic-space', which causes history
expansion to be performed on the current readline buffer and a space to
be inserted into the result.
e. There is a new bindable command, `menu-complete', which enables tcsh-like
menu completion (successive executions of menu-complete insert a single
completion match, cycling through the list of possible completions).
f. There is a new bindable command, `paste-from-clipboard', for use on Win32
systems, to insert the text from the Win32 clipboard into the editing
buffer.
g. The key sequence translation code now understands printf-style backslash
escape sequences, including \NNN octal escapes. These escape sequences
may be used in key sequence definitions or macro values.
h. An `$include' inputrc file parser directive has been added.
readline-8.3/histsearch.c 000644 000436 000024 00000021635 14656457115 015556 0 ustar 00chet staff 000000 000000 /* histsearch.c -- searching the history list. */
/* Copyright (C) 1989, 1992-2009,2017,2021-2024 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
History is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
History is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with History. If not, see .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include
# endif
# include
#endif
#if defined (HAVE_FNMATCH)
# include
#endif
#include "history.h"
#include "histlib.h"
#include "xmalloc.h"
#include "rlmbutil.h"
/* The list of alternate characters that can delimit a history search
string. */
char *history_search_delimiter_chars = (char *)NULL;
static int history_search_internal (const char *, int, int, int);
/* Search the history for STRING, starting at history_offset.
If LISTDIR < 0, then the search is through previous entries, else
through subsequent. If ANCHORED is non-zero, the string must
appear at the beginning of a history line, otherwise, the string
may appear anywhere in the line. If the search is not anchored, LINEDIR
determines how the line is searched: if it is < 0, the search proceeds
from the end of the line to the beginning, otherwise the substring search
starts at the beginning of each history entry. If PATSEARCH is non-zero,
and fnmatch(3) is available, fnmatch is used to match the string instead
of a simple string comparison. If IGNORECASE is set, the string comparison
is performed case-insensitively. If the string is found, then
current_history () is the history entry, and the value of this
function is the offset in the line of that history entry in which the
string was found. Otherwise, nothing is changed, and a -1 is returned. */
static int
history_search_internal (const char *string, int listdir, int linedir, int flags)
{
int i, reverse;
char *line;
size_t string_len, line_len;
int line_index; /* can't be unsigned */
int anchored, patsearch, igncase;
int found, mb_cur_max;
HIST_ENTRY **the_history; /* local */
i = history_offset;
reverse = (listdir < 0);
anchored = (flags & ANCHORED_SEARCH);
#if defined (HAVE_FNMATCH)
patsearch = (flags & PATTERN_SEARCH);
#else
patsearch = 0;
#endif
igncase = (flags & CASEFOLD_SEARCH);
/* Take care of trivial cases first. */
if (string == 0 || *string == '\0')
return (-1);
if (!history_length || ((i >= history_length) && !reverse))
return (-1);
if (reverse && (i >= history_length))
i = history_length - 1;
mb_cur_max = MB_CUR_MAX;
#define NEXT_LINE() do { if (reverse) i--; else i++; } while (0)
the_history = history_list ();
string_len = strlen (string);
while (1)
{
/* Search each line in the history list for STRING. */
/* At limit for direction? */
if ((reverse && i < 0) || (!reverse && i == history_length))
return (-1);
line = the_history[i]->line;
line_len = line_index = strlen (line);
/* If STRING is longer than line, no match. */
if (patsearch == 0 && (string_len > line_index))
{
NEXT_LINE ();
continue;
}
/* Handle anchored searches first. */
if (anchored == ANCHORED_SEARCH)
{
found = 0;
#if defined (HAVE_FNMATCH)
if (patsearch)
found = fnmatch (string, line, 0) == 0;
else
#endif
if (igncase)
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1) /* no rl_byte_oriented equivalent */
found = _rl_mb_strcaseeqn (string, string_len,
line, line_len,
string_len, 0);
else
#endif
found = strncasecmp (string, line, string_len) == 0;
}
else
found = STREQN (string, line, string_len);
if (found)
{
history_offset = i;
return (0);
}
NEXT_LINE ();
continue;
}
/* Do substring search. */
if (linedir < 0) /* search backwards from end */
{
size_t ll;
ll = (patsearch == 0) ? string_len : 1;
line_index -= ll;
found = 0;
while (line_index >= 0)
{
#if defined (HAVE_FNMATCH)
if (patsearch)
found = fnmatch (string, line + line_index, 0) == 0;
else
#endif
if (igncase)
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1) /* no rl_byte_oriented equivalent */
found = _rl_mb_strcaseeqn (string, string_len,
line + line_index, ll,
string_len, 0);
else
#endif
found = strncasecmp (string, line + line_index, string_len) == 0;
}
else
found = STREQN (string, line + line_index, string_len);
if (found)
{
history_offset = i;
return (line_index);
}
line_index--;
ll++;
}
}
else
{
register int limit;
size_t ll;
ll = line_len;
limit = line_index - string_len + 1;
line_index = 0;
found = 0;
while (line_index < limit)
{
#if defined (HAVE_FNMATCH)
if (patsearch)
found = fnmatch (string, line + line_index, 0) == 0;
else
#endif
if (igncase)
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1) /* no rl_byte_oriented equivalent */
found = _rl_mb_strcaseeqn (string, string_len,
line + line_index, ll,
string_len, 0);
else
#endif
found = strncasecmp (string, line + line_index, string_len) == 0;
}
else
found = STREQN (string, line + line_index, string_len);
if (found)
{
history_offset = i;
return (line_index);
}
line_index++;
ll--;
}
}
NEXT_LINE ();
}
}
int
_hs_history_patsearch (const char *string, int listdir, int linedir, int flags)
{
char *pat;
size_t len, start;
int ret, unescaped_backslash;
#if defined (HAVE_FNMATCH)
/* Assume that the string passed does not have a leading `^' and any
anchored search request is captured in FLAGS */
len = strlen (string);
ret = len - 1;
/* fnmatch is required to reject a pattern that ends with an unescaped
backslash */
if (unescaped_backslash = (string[ret] == '\\'))
{
while (ret > 0 && string[--ret] == '\\')
unescaped_backslash = 1 - unescaped_backslash;
}
if (unescaped_backslash)
return -1;
pat = (char *)xmalloc (len + 3);
/* If the search string is not anchored, we'll be calling fnmatch (assuming
we have it). Prefix a `*' to the front of the search string so we search
anywhere in the line. */
if ((flags & ANCHORED_SEARCH) == 0 && string[0] != '*')
{
pat[0] = '*';
start = 1;
len++;
}
else
{
start = 0;
}
/* Attempt to reduce the number of searches by tacking a `*' onto the end
of a pattern that doesn't have one. Assume a pattern that ends in a
backslash contains an even number of trailing backslashes; we check
above */
strcpy (pat + start, string);
if (pat[len - 1] != '*')
{
pat[len] = '*'; /* XXX */
pat[len+1] = '\0';
}
#else
pat = string;
#endif
ret = history_search_internal (pat, listdir, linedir, flags|PATTERN_SEARCH);
if (pat != string)
xfree (pat);
return ret;
}
/* Do a non-anchored search for STRING through the history list in direction
LISTDIR. */
int
history_search (const char *string, int listdir)
{
return (history_search_internal (string, listdir, listdir, NON_ANCHORED_SEARCH));
}
/* Do an anchored search for string through the history list in direction
LISTDIR. */
int
history_search_prefix (const char *string, int listdir)
{
return (history_search_internal (string, listdir, listdir, ANCHORED_SEARCH));
}
/* Perform a history search for STRING, letting the caller specify the flags.
At some point, make this public for users of the history library. */
int
_hs_history_search (const char *string, int listdir, int linedir, int flags)
{
return (history_search_internal (string, listdir, linedir, flags));
}
/* Search for STRING in the history list. LISTDIR is < 0 for searching
backwards through the list. POS is an absolute index into the history
list where the search should begin. */
int
history_search_pos (const char *string, int listdir, int pos)
{
int ret, old;
old = where_history ();
history_set_pos (pos);
if (history_search (string, listdir) == -1)
{
history_set_pos (old);
return (-1);
}
ret = where_history ();
history_set_pos (old);
return ret;
}
readline-8.3/readline.pc.in 000644 000436 000024 00000000514 13452710567 015756 0 ustar 00chet staff 000000 000000 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: @TERMCAP_PKG_CONFIG_LIB@
Libs: -L${libdir} -lreadline
Cflags: -I${includedir}
readline-8.3/text.c 000644 000436 000024 00000153273 14635366400 014402 0 ustar 00chet staff 000000 000000 /* text.c -- text handling commands for readline. */
/* Copyright (C) 1987-2021,2023-2024 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#if defined (HAVE_UNISTD_H)
# include
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include
#endif
#include
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "rlmbutil.h"
#if defined (__EMX__)
# define INCL_DOSPROCESS
# include
#endif /* __EMX__ */
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
/* Forward declarations. */
static int rl_change_case (int, int);
static int _rl_char_search (int, int, int);
#if defined (READLINE_CALLBACKS)
static int _rl_insert_next_callback (_rl_callback_generic_arg *);
static int _rl_char_search_callback (_rl_callback_generic_arg *);
#endif
/* The largest chunk of text that can be inserted in one call to
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 */
/* */
/* **************************************************************** */
/* Insert a string of text into the line at point. This is the only
way that you should do insertion. _rl_insert_char () calls this
function. Returns the number of characters inserted. */
int
rl_insert_text (const char *string)
{
register int i;
size_t l;
l = (string && *string) ? strlen (string) : 0;
if (l == 0)
return 0;
if (rl_end + l >= rl_line_buffer_len)
rl_extend_line_buffer (rl_end + l);
for (i = rl_end; i >= rl_point; i--)
rl_line_buffer[i + l] = rl_line_buffer[i];
strncpy (rl_line_buffer + rl_point, string, l);
/* Remember how to undo this if we aren't undoing something. */
if (_rl_doing_an_undo == 0)
{
/* If possible and desirable, concatenate the undos. */
if ((l == 1) &&
rl_undo_list &&
(rl_undo_list->what == UNDO_INSERT) &&
(rl_undo_list->end == rl_point) &&
(rl_undo_list->end - rl_undo_list->start < 20))
rl_undo_list->end++;
else
rl_add_undo (UNDO_INSERT, rl_point, rl_point + l, (char *)NULL);
}
rl_point += l;
rl_end += l;
rl_line_buffer[rl_end] = '\0';
return l;
}
/* Delete the string between FROM and TO. FROM is inclusive, TO is not.
Returns the number of characters deleted. */
int
rl_delete_text (int from, int to)
{
register char *text;
register int diff, i;
/* Fix it if the caller is confused. */
if (from > to)
SWAP (from, to);
/* fix boundaries */
if (to > rl_end)
{
to = rl_end;
if (from > to)
from = to;
}
if (from < 0)
from = 0;
text = rl_copy_text (from, to);
/* Some versions of strncpy() can't handle overlapping arguments. */
diff = to - from;
for (i = from; i < rl_end - diff; i++)
rl_line_buffer[i] = rl_line_buffer[i + diff];
/* Remember how to undo this delete. */
if (_rl_doing_an_undo == 0)
rl_add_undo (UNDO_DELETE, from, to, text);
else
xfree (text);
rl_end -= diff;
rl_line_buffer[rl_end] = '\0';
_rl_fix_mark ();
return (diff);
}
/* Fix up point so that it is within the line boundaries after killing
text. If FIX_MARK_TOO is non-zero, the mark is forced within line
boundaries also. */
#define _RL_FIX_POINT(x) \
do { \
if (x > rl_end) \
x = rl_end; \
else if (x < 0) \
x = 0; \
} while (0)
void
_rl_fix_point (int fix_mark_too)
{
_RL_FIX_POINT (rl_point);
if (fix_mark_too)
_RL_FIX_POINT (rl_mark);
}
void
_rl_fix_mark (void)
{
_RL_FIX_POINT (rl_mark);
}
#undef _RL_FIX_POINT
/* Replace the contents of the line buffer between START and END with
TEXT. The operation is undoable. To replace the entire line in an
undoable mode, use _rl_replace_text(text, 0, rl_end); */
int
_rl_replace_text (const char *text, int start, int end)
{
int n;
n = 0;
rl_begin_undo_group ();
if (start <= end)
rl_delete_text (start, end + 1);
rl_point = start;
if (*text)
n = rl_insert_text (text);
rl_end_undo_group ();
return n;
}
/* Replace the current line buffer contents with TEXT. If CLEAR_UNDO is
non-zero, we free the current undo list. */
void
rl_replace_line (const char *text, int clear_undo)
{
int len;
len = strlen (text);
if (len >= rl_line_buffer_len)
rl_extend_line_buffer (len);
strcpy (rl_line_buffer, text);
rl_end = len;
if (clear_undo)
rl_free_undo_list ();
_rl_fix_point (1);
}
/* **************************************************************** */
/* */
/* Readline character functions */
/* */
/* **************************************************************** */
/* This is not a gap editor, just a stupid line input routine. No hair
is involved in writing any of the functions, and none should be. */
/* Note that:
rl_end is the place in the string that we would place '\0';
i.e., it is always safe to place '\0' there.
rl_point is the place in the string where the cursor is. Sometimes
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 second is the key which invoked this command.
*/
/* **************************************************************** */
/* */
/* Movement Commands */
/* */
/* **************************************************************** */
/* Note that if you `optimize' the display for these functions, you cannot
use said functions in other functions which do not do optimizing display.
I.e., you will have to update the data base for rl_redisplay, and you
might as well let rl_redisplay do that job. */
/* Move forward COUNT bytes. */
int
rl_forward_byte (int count, int key)
{
if (count < 0)
return (rl_backward_byte (-count, key));
if (count > 0)
{
int end, lend;
end = rl_point + count;
#if defined (VI_MODE)
lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
#else
lend = rl_end;
#endif
if (end > lend)
{
rl_point = lend;
rl_ding ();
}
else
rl_point = end;
}
if (rl_end < 0)
rl_end = 0;
return 0;
}
int
_rl_forward_char_internal (int count)
{
int point;
#if defined (HANDLE_MULTIBYTE)
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
#if defined (VI_MODE)
if (point >= rl_end && VI_COMMAND_MODE())
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
#endif
if (rl_end < 0)
rl_end = 0;
#else
point = rl_point + count;
#endif
if (point > rl_end)
point = rl_end;
return (point);
}
int
_rl_backward_char_internal (int count)
{
int point;
point = rl_point;
#if defined (HANDLE_MULTIBYTE)
if (count > 0)
{
while (count > 0 && point > 0)
{
point = _rl_find_prev_mbchar (rl_line_buffer, point, MB_FIND_NONZERO);
count--;
}
if (count > 0)
return 0; /* XXX - rl_ding() here? */
}
#else
if (count > 0)
point -= count;
#endif
if (point < 0)
point = 0;
return (point);
}
#if defined (HANDLE_MULTIBYTE)
/* Move forward COUNT characters. */
int
rl_forward_char (int count, int key)
{
int point;
if (MB_CUR_MAX == 1 || rl_byte_oriented)
return (rl_forward_byte (count, key));
if (count < 0)
return (rl_backward_char (-count, key));
if (count > 0)
{
if (rl_point == rl_end && EMACS_MODE())
{
rl_ding ();
return 0;
}
point = _rl_forward_char_internal (count);
if (rl_point == point)
rl_ding ();
rl_point = point;
}
return 0;
}
#else /* !HANDLE_MULTIBYTE */
int
rl_forward_char (int count, int key)
{
return (rl_forward_byte (count, key));
}
#endif /* !HANDLE_MULTIBYTE */
/* Backwards compatibility. */
int
rl_forward (int count, int key)
{
return (rl_forward_char (count, key));
}
/* Move backward COUNT bytes. */
int
rl_backward_byte (int count, int key)
{
if (count < 0)
return (rl_forward_byte (-count, key));
if (count > 0)
{
if (rl_point < count)
{
rl_point = 0;
rl_ding ();
}
else
rl_point -= count;
}
if (rl_point < 0)
rl_point = 0;
return 0;
}
#if defined (HANDLE_MULTIBYTE)
/* Move backward COUNT characters. */
int
rl_backward_char (int count, int key)
{
int point;
if (MB_CUR_MAX == 1 || rl_byte_oriented)
return (rl_backward_byte (count, key));
if (count < 0)
return (rl_forward_char (-count, key));
if (count > 0)
{
point = rl_point;
while (count > 0 && point > 0)
{
point = _rl_find_prev_mbchar (rl_line_buffer, point, MB_FIND_NONZERO);
count--;
}
if (count > 0)
{
rl_point = 0;
rl_ding ();
}
else
rl_point = point;
}
return 0;
}
#else
int
rl_backward_char (int count, int key)
{
return (rl_backward_byte (count, key));
}
#endif
/* Backwards compatibility. */
int
rl_backward (int count, int key)
{
return (rl_backward_char (count, key));
}
/* Move to the beginning of the line. */
int
rl_beg_of_line (int count, int key)
{
rl_point = 0;
return 0;
}
/* Move to the end of the line. */
int
rl_end_of_line (int count, int key)
{
rl_point = rl_end;
return 0;
}
/* Move forward a word. We do what Emacs does. Handles multibyte chars. */
int
rl_forward_word (int count, int key)
{
int c;
if (count < 0)
return (rl_backward_word (-count, key));
while (count)
{
if (rl_point > rl_end)
rl_point = rl_end;
if (rl_point == rl_end)
return 0;
/* If we are not in a word, move forward until we are in one.
Then, move forward until we hit a non-alphabetic character. */
c = _rl_char_value (rl_line_buffer, rl_point);
if (_rl_walphabetic (c) == 0)
{
rl_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
while (rl_point < rl_end)
{
c = _rl_char_value (rl_line_buffer, rl_point);
if (_rl_walphabetic (c))
break;
rl_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
}
}
if (rl_point > rl_end)
rl_point = rl_end;
if (rl_point == rl_end)
return 0;
rl_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
while (rl_point < rl_end)
{
c = _rl_char_value (rl_line_buffer, rl_point);
if (_rl_walphabetic (c) == 0)
break;
rl_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
}
--count;
}
return 0;
}
/* Move backward a word. We do what Emacs does. Handles multibyte chars. */
int
rl_backward_word (int count, int key)
{
int c, p;
if (count < 0)
return (rl_forward_word (-count, key));
while (count)
{
if (rl_point == 0)
return 0;
/* Like rl_forward_word (), except that we look at the characters
just before point. */
p = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
c = _rl_char_value (rl_line_buffer, p);
if (_rl_walphabetic (c) == 0)
{
rl_point = p;
while (rl_point > 0)
{
p = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
c = _rl_char_value (rl_line_buffer, p);
if (_rl_walphabetic (c))
break;
rl_point = p;
}
}
while (rl_point)
{
p = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
c = _rl_char_value (rl_line_buffer, p);
if (_rl_walphabetic (c) == 0)
break;
else
rl_point = p;
}
--count;
}
return 0;
}
/* Clear the current line. Numeric argument to C-l does this. */
int
rl_refresh_line (int ignore1, int ignore2)
{
_rl_refresh_line ();
rl_display_fixed = 1;
return 0;
}
/* C-l typed to a line without quoting clears the screen, and then reprints
the prompt and the current input line. Given a numeric arg, redraw only
the current line. */
int
rl_clear_screen (int count, int key)
{
if (rl_explicit_arg)
{
rl_refresh_line (count, key);
return 0;
}
_rl_clear_screen (0); /* calls termcap function to clear screen */
rl_keep_mark_active ();
rl_forced_update_display ();
rl_display_fixed = 1;
return 0;
}
int
rl_clear_display (int count, int key)
{
_rl_clear_screen (1); /* calls termcap function to clear screen and scrollback buffer */
rl_forced_update_display ();
rl_display_fixed = 1;
return 0;
}
int
rl_previous_screen_line (int count, int key)
{
int c;
c = _rl_term_autowrap ? _rl_screenwidth : (_rl_screenwidth + 1);
return (rl_backward_char (c, key));
}
int
rl_next_screen_line (int count, int key)
{
int c;
c = _rl_term_autowrap ? _rl_screenwidth : (_rl_screenwidth + 1);
return (rl_forward_char (c, key));
}
int
rl_skip_csi_sequence (int count, int key)
{
int ch;
RL_SETSTATE (RL_STATE_MOREINPUT);
do
ch = rl_read_key ();
while (ch >= 0x20 && ch < 0x40);
RL_UNSETSTATE (RL_STATE_MOREINPUT);
return (ch < 0);
}
int
rl_arrow_keys (int count, int key)
{
int ch;
RL_SETSTATE(RL_STATE_MOREINPUT);
ch = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (ch < 0)
return (1);
switch (_rl_to_upper (ch))
{
case 'A':
rl_get_previous_history (count, ch);
break;
case 'B':
rl_get_next_history (count, ch);
break;
case 'C':
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_forward_char (count, ch);
else
rl_forward_byte (count, ch);
break;
case 'D':
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_backward_char (count, ch);
else
rl_backward_byte (count, ch);
break;
default:
rl_ding ();
}
return 0;
}
/* **************************************************************** */
/* */
/* Text commands */
/* */
/* **************************************************************** */
#ifdef HANDLE_MULTIBYTE
static char pending_bytes[MB_LEN_MAX];
static int pending_bytes_length = 0;
static mbstate_t ps = {0};
#endif
/* Insert the character C at the current location, moving point forward.
If C introduces a multibyte sequence, we read the whole sequence and
then insert the multibyte char into the line buffer.
If C == 0, we immediately insert any pending partial multibyte character,
assuming that we have read a character that doesn't map to self-insert.
This doesn't completely handle characters that are part of a multibyte
character but map to editing functions. */
int
_rl_insert_char (int count, int c)
{
register int i;
char *string;
#ifdef HANDLE_MULTIBYTE
int string_size;
char incoming[MB_LEN_MAX + 1];
int incoming_length = 0;
mbstate_t ps_back;
static int stored_count = 0;
#endif
#if !defined (HANDLE_MULTIBYTE)
if (count <= 0)
return 0;
#else
if (count < 0)
return 0;
if (count == 0)
{
if (pending_bytes_length == 0)
return 0;
if (stored_count <= 0)
stored_count = count;
else
count = stored_count;
memcpy (incoming, pending_bytes, pending_bytes_length);
incoming[pending_bytes_length] = '\0';
incoming_length = pending_bytes_length;
pending_bytes_length = 0;
memset (&ps, 0, sizeof (mbstate_t));
}
else if (MB_CUR_MAX == 1 || rl_byte_oriented)
{
incoming[0] = c;
incoming[1] = '\0';
incoming_length = 1;
}
else if (_rl_utf8locale && (c & 0x80) == 0)
{
if (pending_bytes_length)
_rl_insert_char (0, 0);
incoming[0] = c;
incoming[1] = '\0';
incoming_length = 1;
}
else
{
WCHAR_T wc;
size_t ret;
if (stored_count <= 0)
stored_count = count;
else
count = stored_count;
ps_back = ps;
pending_bytes[pending_bytes_length++] = c;
ret = MBRTOWC (&wc, pending_bytes, pending_bytes_length, &ps);
if (ret == (size_t)-2)
{
/* Bytes too short to compose character, try to wait for next byte.
Restore the state of the byte sequence, because in this case the
effect of mbstate is undefined. */
ps = ps_back;
return 1;
}
else if (ret == (size_t)-1)
{
/* Invalid byte sequence for the current locale. Treat first byte
as a single character. */
incoming[0] = pending_bytes[0];
incoming[1] = '\0';
incoming_length = 1;
pending_bytes_length--;
if (pending_bytes_length)
memmove (pending_bytes, pending_bytes + 1, pending_bytes_length);
/* Clear the state of the byte sequence, because in this case the
effect of mbstate is undefined. */
memset (&ps, 0, sizeof (mbstate_t));
}
else if (ret == (size_t)0)
{
incoming[0] = '\0';
incoming_length = 0;
pending_bytes_length--;
/* Clear the state of the byte sequence, because in this case the
effect of mbstate is undefined. */
memset (&ps, 0, sizeof (mbstate_t));
}
else if (ret == 1)
{
incoming[0] = pending_bytes[0];
incoming[incoming_length = 1] = '\0';
pending_bytes_length = 0;
}
else
{
/* We successfully read a single multibyte character. */
memcpy (incoming, pending_bytes, pending_bytes_length);
incoming[pending_bytes_length] = '\0';
incoming_length = pending_bytes_length;
pending_bytes_length = 0;
}
}
#endif /* HANDLE_MULTIBYTE */
/* If we can optimize, then do it. But don't let people crash
readline because of extra large arguments. */
if (count > 1 && count <= TEXT_COUNT_MAX)
{
#if defined (HANDLE_MULTIBYTE)
string_size = count * incoming_length;
string = (char *)xmalloc (1 + string_size);
i = 0;
while (i < string_size)
{
if (incoming_length == 1)
string[i++] = *incoming;
else
{
strncpy (string + i, incoming, incoming_length);
i += incoming_length;
}
}
incoming_length = 0;
stored_count = 0;
#else /* !HANDLE_MULTIBYTE */
string = (char *)xmalloc (1 + count);
for (i = 0; i < count; i++)
string[i] = c;
#endif /* !HANDLE_MULTIBYTE */
string[i] = '\0';
rl_insert_text (string);
xfree (string);
#if defined (HANDLE_MULTIBYTE)
return (pending_bytes_length != 0);
#else
return 0;
#endif
}
if (count > TEXT_COUNT_MAX)
{
int decreaser;
#if defined (HANDLE_MULTIBYTE)
string_size = incoming_length * TEXT_COUNT_MAX;
string = (char *)xmalloc (1 + string_size);
i = 0;
while (i < string_size)
{
if (incoming_length == 1)
string[i++] = *incoming;
else
{
strncpy (string + i, incoming, incoming_length);
i += incoming_length;
}
}
while (count)
{
decreaser = (count > TEXT_COUNT_MAX) ? TEXT_COUNT_MAX : count;
string[decreaser*incoming_length] = '\0';
rl_insert_text (string);
count -= decreaser;
}
xfree (string);
incoming_length = 0;
stored_count = 0;
return (pending_bytes_length != 0);
#else /* !HANDLE_MULTIBYTE */
char str[TEXT_COUNT_MAX+1];
for (i = 0; i < TEXT_COUNT_MAX; i++)
str[i] = c;
while (count)
{
decreaser = (count > TEXT_COUNT_MAX ? TEXT_COUNT_MAX : count);
str[decreaser] = '\0';
rl_insert_text (str);
count -= decreaser;
}
return 0;
#endif /* !HANDLE_MULTIBYTE */
}
if (MB_CUR_MAX == 1 || rl_byte_oriented)
{
/* We are inserting a single character.
If there is pending input, then make a string of all of the
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 ())
_rl_insert_typein (c);
else
{
/* Inserting a single character. */
char str[2];
str[1] = '\0';
str[0] = c;
rl_insert_text (str);
}
}
#if defined (HANDLE_MULTIBYTE)
else
{
rl_insert_text (incoming);
stored_count = 0;
}
return (pending_bytes_length != 0);
#else
return 0;
#endif
}
/* Overwrite the character at point (or next COUNT characters) with C.
If C introduces a multibyte character sequence, read the entire sequence
before starting the overwrite loop. */
int
_rl_overwrite_char (int count, int c)
{
int i;
#if defined (HANDLE_MULTIBYTE)
char mbkey[MB_LEN_MAX];
int k;
/* Read an entire multibyte character sequence to insert COUNT times. */
k = 1;
if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
if (k < 0)
return 1;
#endif
rl_begin_undo_group ();
for (i = 0; i < count; i++)
{
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_insert_text (mbkey);
else
#endif
_rl_insert_char (1, c);
if (rl_point < rl_end)
rl_delete (1, c);
}
rl_end_undo_group ();
return 0;
}
int
rl_insert (int count, int 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_num_chars_to_read == 0 &&
(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 we didn't insert n and there are pending bytes, we need to insert
them if _rl_insert_char didn't do that on its own. */
if (r == 1 && rl_insert_mode == RL_IM_INSERT)
r = _rl_insert_char (0, 0); /* flush partial multibyte char */
if (n != (unsigned short)-2) /* -2 = sentinel value for having inserted N */
{
/* setting rl_pending_input inhibits setting rl_last_func so we do it
ourselves here */
rl_last_func = rl_insert;
_rl_reset_argument ();
rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';
r = rl_execute_next (n);
}
return r;
}
/* Insert the next typed character verbatim. */
static int
_rl_insert_next (int count)
{
int c;
RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
return 1;
if (RL_ISSTATE (RL_STATE_MACRODEF))
_rl_add_macro_char (c);
#if defined (HANDLE_SIGNALS)
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
_rl_restore_tty_signals ();
#endif
return (_rl_insert_char (count, c));
}
#if defined (READLINE_CALLBACKS)
static int
_rl_insert_next_callback (_rl_callback_generic_arg *data)
{
int count, r;
count = data->count;
r = 0;
if (count < 0)
{
data->count++;
r = _rl_insert_next (1);
_rl_want_redisplay = 1;
/* If we should keep going, leave the callback function installed */
if (data->count < 0 && r == 0)
return r;
count = 0; /* data->count == 0 || r != 0; force break below */
}
/* Deregister function, let rl_callback_read_char deallocate data */
_rl_callback_func = 0;
_rl_want_redisplay = 1;
if (count == 0)
return r;
return _rl_insert_next (count);
}
#endif
int
rl_quoted_insert (int count, int key)
{
int r;
/* Let's see...should the callback interface futz with signal handling? */
#if defined (HANDLE_SIGNALS)
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
_rl_disable_tty_signals ();
#endif
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_callback_data = _rl_callback_data_alloc (count);
_rl_callback_func = _rl_insert_next_callback;
return (0);
}
#endif
/* A negative count means to quote the next -COUNT characters. */
if (count < 0)
{
do
r = _rl_insert_next (1);
while (r == 0 && ++count < 0);
}
else
r = _rl_insert_next (count);
if (r == 1)
_rl_insert_char (0, 0); /* insert partial multibyte character */
return r;
}
/* Insert a tab character. */
int
rl_tab_insert (int count, int key)
{
return (_rl_insert_char (count, '\t'));
}
/* What to do when a NEWLINE is pressed. We accept the whole line.
KEY is the key that invoked this command. I guess it could have
meaning in the future. */
int
rl_newline (int count, int key)
{
if (rl_mark_active_p ())
{
rl_deactivate_mark ();
(*rl_redisplay_function) ();
_rl_want_redisplay = 0;
}
rl_done = 1;
if (_rl_history_preserve_point)
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
RL_SETSTATE(RL_STATE_DONE);
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
{
_rl_vi_done_inserting ();
if (_rl_vi_textmod_command (_rl_vi_last_command) == 0) /* XXX */
_rl_vi_reset_last ();
}
#endif /* VI_MODE */
/* If we've been asked to erase empty lines, suppress the final update,
since _rl_update_final calls rl_crlf(). */
if (rl_erase_empty_line && rl_point == 0 && rl_end == 0)
return 0;
if (_rl_echoing_p)
_rl_update_final ();
return 0;
}
/* What to do for some uppercase characters, like meta characters,
and some characters appearing in emacs_ctlx_keymap. This function
is just a stub, you bind keys to it and the code in _rl_dispatch ()
is special cased. */
int
rl_do_lowercase_version (int ignore1, int ignore2)
{
return 99999; /* prevent from being combined with _rl_null_function */
}
/* This is different from what vi does, so the code's not shared. Emacs
rubout in overwrite mode has one oddity: it replaces a control
character that's displayed as two characters (^X) with two spaces. */
int
_rl_overwrite_rubout (int count, int key)
{
int opoint;
int i, l;
if (rl_point == 0)
{
rl_ding ();
return 1;
}
opoint = rl_point;
/* L == number of spaces to insert */
for (i = l = 0; i < count; i++)
{
rl_backward_char (1, key);
l += rl_character_len (rl_line_buffer[rl_point], rl_point); /* not exactly right */
}
rl_begin_undo_group ();
if (count > 1 || rl_explicit_arg)
rl_kill_text (opoint, rl_point);
else
rl_delete_text (opoint, rl_point);
/* Emacs puts point at the beginning of the sequence of spaces. */
if (rl_point < rl_end)
{
opoint = rl_point;
_rl_insert_char (l, ' ');
rl_point = opoint;
}
rl_end_undo_group ();
return 0;
}
/* Rubout the character behind point. */
int
rl_rubout (int count, int key)
{
if (count < 0)
return (rl_delete (-count, key));
if (!rl_point)
{
rl_ding ();
return 1;
}
if (rl_insert_mode == RL_IM_OVERWRITE)
return (_rl_overwrite_rubout (count, key));
return (_rl_rubout_char (count, key));
}
int
_rl_rubout_char (int count, int key)
{
int orig_point;
unsigned char c;
/* Duplicated code because this is called from other parts of the library. */
if (count < 0)
return (rl_delete (-count, key));
if (rl_point == 0)
{
rl_ding ();
return 1;
}
orig_point = rl_point;
if (count > 1 || rl_explicit_arg)
{
rl_backward_char (count, key);
rl_kill_text (orig_point, rl_point);
}
else if (MB_CUR_MAX == 1 || rl_byte_oriented)
{
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 && _rl_last_v_pos == 0)
{
int l;
l = rl_character_len (c, rl_point);
if (_rl_last_c_pos >= l)
_rl_erase_at_end_of_line (l);
}
}
else
{
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
rl_delete_text (rl_point, orig_point);
}
return 0;
}
/* Delete the character under the cursor. Given a numeric argument,
kill that many characters instead. */
int
rl_delete (int count, int key)
{
int xpoint;
if (count < 0)
return (_rl_rubout_char (-count, key));
if (rl_point == rl_end)
{
rl_ding ();
return 1;
}
if (count > 1 || rl_explicit_arg)
{
xpoint = rl_point;
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_forward_char (count, key);
else
rl_forward_byte (count, key);
rl_kill_text (xpoint, rl_point);
rl_point = xpoint;
}
else
{
xpoint = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
rl_delete_text (rl_point, xpoint);
}
return 0;
}
/* Delete the character under the cursor, unless the insertion
point is at the end of the line, in which case the character
behind the cursor is deleted. COUNT is obeyed and may be used
to delete forward or backward that many characters. */
int
rl_rubout_or_delete (int count, int key)
{
if (rl_end != 0 && rl_point == rl_end)
return (_rl_rubout_char (count, key));
else
return (rl_delete (count, key));
}
/* Delete all spaces and tabs around point. */
int
rl_delete_horizontal_space (int count, int ignore)
{
int start;
while (rl_point && whitespace (rl_line_buffer[rl_point - 1]))
rl_point--;
start = rl_point;
while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
rl_point++;
if (start != rl_point)
{
rl_delete_text (start, rl_point);
rl_point = start;
}
if (rl_point < 0)
rl_point = 0;
return 0;
}
/* Like the tcsh editing function delete-char-or-list. The eof character
is caught before this is invoked, so this really does the same thing as
delete-char-or-list-or-eof, as long as it's bound to the eof character. */
int
rl_delete_or_show_completions (int count, int key)
{
if (rl_end != 0 && rl_point == rl_end)
return (rl_possible_completions (count, key));
else
return (rl_delete (count, key));
}
#ifndef RL_COMMENT_BEGIN_DEFAULT
#define RL_COMMENT_BEGIN_DEFAULT "#"
#endif
/* Turn the current line into a comment in shell history.
A K*rn shell style function. */
int
rl_insert_comment (int count, int key)
{
char *rl_comment_text;
int rl_comment_len;
rl_beg_of_line (1, key);
rl_comment_text = _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT;
if (rl_explicit_arg == 0)
rl_insert_text (rl_comment_text);
else
{
rl_comment_len = strlen (rl_comment_text);
if (STREQN (rl_comment_text, rl_line_buffer, rl_comment_len))
rl_delete_text (rl_point, rl_point + rl_comment_len);
else
rl_insert_text (rl_comment_text);
}
(*rl_redisplay_function) ();
rl_newline (1, '\n');
return (0);
}
/* **************************************************************** */
/* */
/* Changing Case */
/* */
/* **************************************************************** */
/* The three kinds of things that we know how to do. */
#define UpCase 1
#define DownCase 2
#define CapCase 3
/* Uppercase the word at point. */
int
rl_upcase_word (int count, int key)
{
return (rl_change_case (count, UpCase));
}
/* Lowercase the word at point. */
int
rl_downcase_word (int count, int key)
{
return (rl_change_case (count, DownCase));
}
/* Upcase the first letter, downcase the rest. */
int
rl_capitalize_word (int count, int key)
{
return (rl_change_case (count, CapCase));
}
/* The meaty function.
Change the case of COUNT words, performing OP on them.
OP is one of UpCase, DownCase, or CapCase.
If a negative argument is given, leave point where it started,
otherwise, leave it where it moves to. */
static int
rl_change_case (int count, int op)
{
int start, next, end;
int inword, nc, nop;
WCHAR_T c;
unsigned char uc;
#if defined (HANDLE_MULTIBYTE)
WCHAR_T wc, nwc;
char mb[MB_LEN_MAX+1];
size_t m, mlen;
mbstate_t mps;
#endif
start = rl_point;
rl_forward_word (count, 0);
end = rl_point;
if (op != UpCase && op != DownCase && op != CapCase)
{
rl_ding ();
return 1;
}
if (count < 0)
SWAP (start, end);
#if defined (HANDLE_MULTIBYTE)
memset (&mps, 0, sizeof (mbstate_t));
#endif
/* We are going to modify some text, so let's prepare to undo it. */
rl_modifying (start, end);
inword = 0;
while (start < end)
{
c = _rl_char_value (rl_line_buffer, start);
/* This assumes that the upper and lower case versions are the same width. */
next = MB_NEXTCHAR (rl_line_buffer, start, 1, MB_FIND_NONZERO);
if (_rl_walphabetic (c) == 0)
{
inword = 0;
start = next;
continue;
}
if (op == CapCase)
{
nop = inword ? DownCase : UpCase;
inword = 1;
}
else
nop = op;
/* Can't check isascii here; some languages (e.g, Turkish) have
multibyte upper and lower case equivalents of single-byte ascii
characters */
if (MB_CUR_MAX == 1 || rl_byte_oriented)
{
change_singlebyte:
uc = c;
nc = (nop == UpCase) ? _rl_to_upper (uc) : _rl_to_lower (uc);
rl_line_buffer[start] = nc;
}
#if defined (HANDLE_MULTIBYTE)
else
{
m = MBRTOWC (&wc, rl_line_buffer + start, end - start, &mps);
if (MB_INVALIDCH (m))
{
c = rl_line_buffer[start];
next = start + 1; /* potentially redundant */
goto change_singlebyte;
}
else if (MB_NULLWCH (m))
{
start = next; /* don't bother with null wide characters */
continue;
}
nwc = (nop == UpCase) ? _rl_to_wupper (wc) : _rl_to_wlower (wc);
if (nwc != wc) /* just skip unchanged characters */
{
char *s, *e;
mbstate_t ts;
memset (&ts, 0, sizeof (mbstate_t));
mlen = WCRTOMB (mb, nwc, &ts);
if (MB_INVALIDCH (mlen))
{
nwc = wc;
memset (&ts, 0, sizeof (mbstate_t));
mlen = WCRTOMB (mb, nwc, &ts);
if (MB_INVALIDCH (mlen)) /* should not happen */
strncpy (mb, rl_line_buffer + start, mlen = m);
}
if (mlen > 0)
mb[mlen] = '\0';
/* what to do if m != mlen? adjust below */
/* m == length of old char, mlen == length of new char */
s = rl_line_buffer + start;
e = rl_line_buffer + rl_end;
if (m == mlen)
memcpy (s, mb, mlen);
else if (m > mlen)
{
memcpy (s, mb, mlen);
memmove (s + mlen, s + m, (e - s) - m);
next -= m - mlen; /* next char changes */
end -= m - mlen; /* end of word changes */
rl_end -= m - mlen; /* end of line changes */
rl_line_buffer[rl_end] = 0;
}
else if (m < mlen)
{
rl_extend_line_buffer (rl_end + mlen + (e - s) - m + 2);
s = rl_line_buffer + start; /* have to redo this */
e = rl_line_buffer + rl_end;
memmove (s + mlen, s + m, (e - s) - m);
memcpy (s, mb, mlen);
next += mlen - m; /* next char changes */
end += mlen - m; /* end of word changes */
rl_end += mlen - m; /* end of line changes */
rl_line_buffer[rl_end] = 0;
}
}
}
#endif
start = next;
}
rl_point = end;
return 0;
}
/* **************************************************************** */
/* */
/* Transposition */
/* */
/* **************************************************************** */
/* Transpose the words at point. If point is at the end of the line,
transpose the two words before point. */
int
rl_transpose_words (int count, int key)
{
char *word1, *word2;
int w1_beg, w1_end, w2_beg, w2_end;
int orig_point, orig_end;
orig_point = rl_point;
orig_end = rl_end;
if (!count)
return 0;
/* Find the two words. */
rl_forward_word (count, key);
w2_end = rl_point;
rl_backward_word (1, key);
w2_beg = rl_point;
rl_backward_word (count, key);
w1_beg = rl_point;
rl_forward_word (1, key);
w1_end = rl_point;
/* Do some check to make sure that there really are two words. */
if ((w1_beg == w2_beg) || (w2_beg < w1_end))
{
rl_ding ();
rl_point = orig_point;
return 1;
}
/* Get the text of the words. */
word1 = rl_copy_text (w1_beg, w1_end);
word2 = rl_copy_text (w2_beg, w2_end);
/* We are about to do many insertions and deletions. Remember them
as one operation. */
rl_begin_undo_group ();
/* Do the stuff at word2 first, so that we don't have to worry
about word1 moving. */
rl_point = w2_beg;
rl_delete_text (w2_beg, w2_end);
rl_insert_text (word1);
rl_point = w1_beg;
rl_delete_text (w1_beg, w1_end);
rl_insert_text (word2);
/* This is exactly correct since the text before this point has not
changed in length. */
rl_point = w2_end;
rl_end = orig_end; /* just make sure */
/* I think that does it. */
rl_end_undo_group ();
xfree (word1);
xfree (word2);
return 0;
}
/* Transpose the characters at point. If point is at the end of the line,
then transpose the characters before point. */
int
rl_transpose_chars (int count, int key)
{
#if defined (HANDLE_MULTIBYTE)
char *dummy;
int i;
#else
char dummy[2];
#endif
int char_length, prev_point;
if (count == 0)
return 0;
if (!rl_point || rl_end < 2)
{
rl_ding ();
return 1;
}
rl_begin_undo_group ();
if (rl_point == rl_end)
{
rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
count = 1;
}
prev_point = rl_point;
rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
#if defined (HANDLE_MULTIBYTE)
char_length = prev_point - rl_point;
dummy = (char *)xmalloc (char_length + 1);
for (i = 0; i < char_length; i++)
dummy[i] = rl_line_buffer[rl_point + i];
dummy[i] = '\0';
#else
dummy[0] = rl_line_buffer[rl_point];
dummy[char_length = 1] = '\0';
#endif
rl_delete_text (rl_point, rl_point + char_length);
rl_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
_rl_fix_point (0);
rl_insert_text (dummy);
rl_end_undo_group ();
#if defined (HANDLE_MULTIBYTE)
xfree (dummy);
#endif
return 0;
}
/* **************************************************************** */
/* */
/* Character Searching */
/* */
/* **************************************************************** */
int
#if defined (HANDLE_MULTIBYTE)
_rl_char_search_internal (int count, int dir, char *smbchar, int len)
#else
_rl_char_search_internal (int count, int dir, int schar)
#endif
{
int pos, inc;
#if defined (HANDLE_MULTIBYTE)
int prepos;
#endif
if (dir == 0)
return 1;
pos = rl_point;
inc = (dir < 0) ? -1 : 1;
while (count)
{
if ((dir < 0 && pos <= 0) || (dir > 0 && pos >= rl_end))
{
rl_ding ();
return 1;
}
#if defined (HANDLE_MULTIBYTE)
pos = (inc > 0) ? _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)
: _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
#else
pos += inc;
#endif
do
{
#if defined (HANDLE_MULTIBYTE)
if (_rl_is_mbchar_matched (rl_line_buffer, pos, rl_end, smbchar, len))
#else
if (rl_line_buffer[pos] == schar)
#endif
{
count--;
if (dir < 0)
rl_point = (dir == BTO) ? _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)
: pos;
else
rl_point = (dir == FTO) ? _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY)
: pos;
break;
}
#if defined (HANDLE_MULTIBYTE)
prepos = pos;
#endif
}
#if defined (HANDLE_MULTIBYTE)
while ((dir < 0) ? (pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY)) != prepos
: (pos = _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)) != prepos);
#else
while ((dir < 0) ? pos-- : ++pos < rl_end);
#endif
}
return (0);
}
/* Search COUNT times for a character read from the current input stream.
FDIR is the direction to search if COUNT is non-negative; otherwise
the search goes in BDIR. So much is dependent on HANDLE_MULTIBYTE
that there are two separate versions of this function. */
#if defined (HANDLE_MULTIBYTE)
static int
_rl_char_search (int count, int fdir, int bdir)
{
char mbchar[MB_LEN_MAX];
int mb_len;
mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
if (mb_len <= 0)
return 1;
if (count < 0)
return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
else
return (_rl_char_search_internal (count, fdir, mbchar, mb_len));
}
#else /* !HANDLE_MULTIBYTE */
static int
_rl_char_search (int count, int fdir, int bdir)
{
int c;
c = _rl_bracketed_read_key ();
if (c < 0)
return 1;
if (count < 0)
return (_rl_char_search_internal (-count, bdir, c));
else
return (_rl_char_search_internal (count, fdir, c));
}
#endif /* !HANDLE_MULTIBYTE */
#if defined (READLINE_CALLBACKS)
static int
_rl_char_search_callback (_rl_callback_generic_arg *data)
{
_rl_callback_func = 0;
_rl_want_redisplay = 1;
return (_rl_char_search (data->count, data->i1, data->i2));
}
#endif
int
rl_char_search (int count, int key)
{
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_callback_data = _rl_callback_data_alloc (count);
_rl_callback_data->i1 = FFIND;
_rl_callback_data->i2 = BFIND;
_rl_callback_func = _rl_char_search_callback;
return (0);
}
#endif
return (_rl_char_search (count, FFIND, BFIND));
}
int
rl_backward_char_search (int count, int key)
{
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_callback_data = _rl_callback_data_alloc (count);
_rl_callback_data->i1 = BFIND;
_rl_callback_data->i2 = FFIND;
_rl_callback_func = _rl_char_search_callback;
return (0);
}
#endif
return (_rl_char_search (count, BFIND, FFIND));
}
/* **************************************************************** */
/* */
/* The Mark and the Region. */
/* */
/* **************************************************************** */
/* Set the mark at POSITION. */
int
_rl_set_mark_at_pos (int position)
{
if (position < 0 || position > rl_end)
return 1;
rl_mark = position;
return 0;
}
/* A bindable command to set the mark. */
int
rl_set_mark (int count, int key)
{
return (_rl_set_mark_at_pos (rl_explicit_arg ? count : rl_point));
}
/* Exchange the position of mark and point. */
int
rl_exchange_point_and_mark (int count, int key)
{
if (rl_mark > rl_end)
rl_mark = -1;
if (rl_mark < 0)
{
rl_ding ();
rl_mark = 0; /* like _RL_FIX_POINT */
return 1;
}
else
{
SWAP (rl_point, rl_mark);
rl_activate_mark ();
}
return 0;
}
/* Active mark support */
/* Is the region active? */
static int mark_active = 0;
/* Does the current command want the mark to remain active when it completes? */
int _rl_keep_mark_active;
void
rl_keep_mark_active (void)
{
_rl_keep_mark_active++;
}
void
rl_activate_mark (void)
{
mark_active = 1;
rl_keep_mark_active ();
}
void
rl_deactivate_mark (void)
{
mark_active = 0;
}
int
rl_mark_active_p (void)
{
return (mark_active);
}
/* **************************************************************** */
/* */
/* Reading a string entered from the keyboard */
/* */
/* **************************************************************** */
/* A very simple set of functions to read a string from the keyboard using
the line buffer as temporary storage. The caller can set a completion
function to perform completion on TAB and SPACE. */
/* XXX - this is all very similar to the search stuff but with a different
CXT. */
static HIST_ENTRY *_rl_saved_line_for_readstr;
_rl_readstr_cxt *_rl_rscxt;
_rl_readstr_cxt *
_rl_rscxt_alloc (int flags)
{
_rl_readstr_cxt *cxt;
cxt = (_rl_readstr_cxt *)xmalloc (sizeof (_rl_readstr_cxt));
cxt->flags = flags;
cxt->save_point = rl_point;
cxt->save_mark = rl_mark;
cxt->save_line = where_history ();
cxt->prevc = cxt->lastc = 0;
cxt->compfunc = NULL;
return cxt;
}
void
_rl_rscxt_dispose (_rl_readstr_cxt *cxt, int flags)
{
xfree (cxt);
}
/* This isn't used yet */
void
_rl_free_saved_readstr_line ()
{
if (_rl_saved_line_for_readstr)
/* This doesn't free any saved undo list, if it needs to,
rl_clear_history shows how to do it. */
_rl_free_saved_line (_rl_saved_line_for_readstr);
_rl_saved_line_for_readstr = (HIST_ENTRY *)NULL;
}
void
_rl_unsave_saved_readstr_line ()
{
if (_rl_saved_line_for_readstr)
{
_rl_free_undo_list (rl_undo_list);
_rl_unsave_line (_rl_saved_line_for_readstr); /* restores rl_undo_list */
}
_rl_saved_line_for_readstr = (HIST_ENTRY *)NULL;
}
_rl_readstr_cxt *
_rl_readstr_init (int pchar, int flags)
{
_rl_readstr_cxt *cxt;
char *p;
cxt = _rl_rscxt_alloc (flags);
_rl_saved_line_for_readstr = _rl_alloc_saved_line ();
rl_undo_list = 0;
rl_line_buffer[0] = 0;
rl_end = rl_point = 0;
p = _rl_make_prompt_for_search (pchar ? pchar : '@');
cxt->flags |= READSTR_FREEPMT;
rl_message ("%s", p);
xfree (p);
RL_SETSTATE (RL_STATE_READSTR);
_rl_rscxt = cxt;
return cxt;
}
int
_rl_readstr_cleanup (_rl_readstr_cxt *cxt, int r)
{
_rl_rscxt_dispose (cxt, 0);
_rl_rscxt = 0;
RL_UNSETSTATE (RL_STATE_READSTR);
return (r != 1);
}
void
_rl_readstr_restore (_rl_readstr_cxt *cxt)
{
_rl_unsave_saved_readstr_line (); /* restores rl_undo_list */
rl_point = cxt->save_point;
rl_mark = cxt->save_mark;
if (cxt->flags & READSTR_FREEPMT)
rl_restore_prompt (); /* _rl_make_prompt_for_search saved it */
cxt->flags &= ~READSTR_FREEPMT;
rl_clear_message ();
_rl_fix_point (1);
}
int
_rl_readstr_sigcleanup (_rl_readstr_cxt *cxt, int r)
{
if (cxt->flags & READSTR_FREEPMT)
rl_restore_prompt (); /* _rl_make_prompt_for_search saved it */
cxt->flags &= ~READSTR_FREEPMT;
return (_rl_readstr_cleanup (cxt, r));
}
int
_rl_readstr_getchar (_rl_readstr_cxt *cxt)
{
int c;
cxt->prevc = cxt->lastc;
/* Read a key and decide how to proceed. */
RL_SETSTATE(RL_STATE_MOREINPUT);
c = cxt->lastc = rl_read_key ();
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 (c >= 0 && 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;
}
/* Process just-read character C according to readstr context CXT. Return -1
if the caller should abort the read, 0 if we should break out of the
loop, and 1 if we should continue to read characters. This can perform
completion on the string read so far (stored in rl_line_buffer) if the
caller has set up a completion function. The completion function can
return -1 to indicate that we should abort the read. If we return -1
we will call _rl_readstr_restore to clean up the state, leaving the caller
to free the context. */
int
_rl_readstr_dispatch (_rl_readstr_cxt *cxt, int c)
{
int n;
if (c < 0)
c = CTRL ('C');
/* could consider looking up the function bound to they key and dispatching
off that, but you want most characters inserted by default without having
to quote. */
switch (c)
{
case CTRL('W'):
rl_unix_word_rubout (1, c);
break;
case CTRL('U'):
rl_unix_line_discard (1, c);
break;
case CTRL('Q'):
case CTRL('V'):
n = rl_quoted_insert (1, c);
if (n < 0)
{
_rl_readstr_restore (cxt);
return -1;
}
cxt->lastc = (rl_point > 0) ? rl_line_buffer[rl_point - 1] : rl_line_buffer[0]; /* preserve prevc */
break;
case RETURN:
case NEWLINE:
return 0;
case CTRL('H'):
case RUBOUT:
if (rl_point == 0)
{
_rl_readstr_restore (cxt);
return -1;
}
_rl_rubout_char (1, c);
break;
case CTRL('C'):
case CTRL('G'):
rl_ding ();
_rl_readstr_restore (cxt);
return -1;
case ESC:
/* Allow users to bracketed-paste text into the string.
Similar code is in search.c:_rl_nsearch_dispatch(). */
if (_rl_enable_bracketed_paste && ((n = _rl_nchars_available ()) >= (BRACK_PASTE_SLEN-1)))
{
if (_rl_read_bracketed_paste_prefix (c) == 1)
rl_bracketed_paste_begin (1, c);
else
{
c = rl_read_key (); /* get the ESC that got pushed back */
_rl_insert_char (1, c);
}
}
else
_rl_insert_char (1, c);
break;
case ' ':
if ((cxt->flags & READSTR_NOSPACE) == 0)
{
_rl_insert_char (1, c);
break;
}
/* FALLTHROUGH */
case TAB:
/* Perform completion if the caller has set a completion function. */
n = (cxt->compfunc) ? (*cxt->compfunc) (cxt, c) : _rl_insert_char (1, c);
if (n < 0)
{
_rl_readstr_restore (cxt);
return -1;
}
break;
#if 0
case CTRL('_'):
rl_do_undo ();
break;
#endif
default:
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_insert_text (cxt->mb);
else
#endif
_rl_insert_char (1, c);
break;
}
(*rl_redisplay_function) ();
rl_deactivate_mark ();
return 1;
}
/* **************************************************************** */
/* */
/* Reading and Executing named commands */
/* */
/* **************************************************************** */
/* A completion generator for bindable readline command names. */
static char *
readcmd_completion_function (const char *text, int state)
{
static const char **cmdlist = NULL;
static size_t lind, nlen;
const char *cmdname;
if (state == 0)
{
if (cmdlist)
free (cmdlist);
cmdlist = rl_funmap_names ();
lind = 0;
nlen = RL_STRLEN (text);
}
if (cmdlist == 0 || cmdlist[lind] == 0)
return (char *)NULL;
while (cmdlist[lind])
{
cmdname = cmdlist[lind++];
if (STREQN (text, cmdname, nlen))
return (savestring (cmdname));
}
return ((char *)NULL);
}
static void
_rl_display_cmdname_matches (char **matches)
{
size_t len, max, i;
int old;
old = rl_filename_completion_desired;
rl_filename_completion_desired = 0;
/* There is more than one match. Find out how many there are,
and find the maximum printed length of a single entry. */
for (max = 0, i = 1; matches[i]; i++)
{
len = strlen (matches[i]);
if (len > max)
max = len;
}
len = i - 1;
rl_display_match_list (matches, len, max);
rl_filename_completion_desired = old;
rl_forced_update_display ();
rl_display_fixed = 1;
}
static int
_rl_readcmd_complete (_rl_readstr_cxt *cxt, int c)
{
char **matches;
char *prefix;
size_t plen;
matches = rl_completion_matches (rl_line_buffer, readcmd_completion_function);
if (RL_SIG_RECEIVED())
{
_rl_free_match_list (matches);
matches = 0;
RL_CHECK_SIGNALS ();
return -1;
}
else if (matches == 0)
rl_ding ();
/* Whether or not there are multiple matches, we just want to append the
new characters in matches[0]. We display possible matches if we didn't
append anything. */
if (matches)
{
prefix = matches[0];
plen = strlen (prefix);
if (plen > rl_end)
{
size_t n;
for (n = rl_end; n < plen && prefix[n]; n++)
_rl_insert_char (1, prefix[n]);
}
else if (matches[1])
_rl_display_cmdname_matches (matches);
_rl_free_match_list (matches);
}
return 0;
}
/* Use the readstr functions to read a bindable command name using the
line buffer, with completion. */
static char *
_rl_read_command_name ()
{
_rl_readstr_cxt *cxt;
char *ret;
int c, r;
cxt = _rl_readstr_init ('!', READSTR_NOSPACE);
cxt->compfunc = _rl_readcmd_complete;
/* skip callback stuff for now */
r = 0;
while (1)
{
c = _rl_readstr_getchar (cxt);
if (c < 0)
{
_rl_readstr_restore (cxt);
_rl_readstr_cleanup (cxt, r);
return NULL;
}
if (c == 0)
break;
r = _rl_readstr_dispatch (cxt, c);
if (r < 0)
{
_rl_readstr_cleanup (cxt, r);
return NULL; /* dispatch function cleans up */
}
else if (r == 0)
break;
}
ret = savestring (rl_line_buffer);
/* Now restore the original line and perform one final redisplay. */
_rl_readstr_restore (cxt);
(*rl_redisplay_function) ();
/* And free up the context. */
_rl_readstr_cleanup (cxt, r);
return ret;
}
/* Read a command name from the keyboard and execute it as if the bound key
sequence had been entered. */
int
rl_execute_named_command (int count, int key)
{
char *command;
rl_command_func_t *func;
int r;
command = _rl_read_command_name ();
if (command == 0 || *command == '\0')
{
free (command);
return 1;
}
func = rl_named_function (command);
free (command);
if (func)
{
int prev, ostate;
prev = rl_dispatching;
ostate = RL_ISSTATE (RL_STATE_DISPATCHING);
rl_dispatching = 1;
RL_SETSTATE (RL_STATE_DISPATCHING); /* make sure it's set */
r = (*func) (count, key);
if (ostate == 0)
RL_UNSETSTATE (RL_STATE_DISPATCHING); /* unset it if it wasn't set */
rl_dispatching = prev;
}
else
{
rl_ding ();
r = 1;
}
return r;
}
readline-8.3/chardefs.h 000644 000436 000024 00000011164 14463251723 015172 0 ustar 00chet staff 000000 000000 /* chardefs.h -- Character definitions for readline. */
/* Copyright (C) 1994-2021 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 .
*/
#ifndef _CHARDEFS_H_
#define _CHARDEFS_H_
#include
#if defined (HAVE_CONFIG_H)
# if defined (HAVE_STRING_H)
# include
# endif /* HAVE_STRING_H */
# if defined (HAVE_STRINGS_H)
# include
# endif /* HAVE_STRINGS_H */
#else
# include
#endif /* !HAVE_CONFIG_H */
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
#ifdef CTRL
# undef CTRL
#endif
#ifdef UNCTRL
# undef UNCTRL
#endif
/* Some character stuff. */
#define control_character_threshold 0x020 /* Smaller than this is control. */
#define control_character_mask 0x1f /* 0x20 - 1 */
#define meta_character_threshold 0x07f /* Larger than this is Meta. */
#define control_character_bit 0x40 /* 0x000000, must be off. */
#define meta_character_bit 0x080 /* x0000000, must be on. */
#define largest_char 255 /* Largest character value. */
#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))
#define META_CHAR(c) ((unsigned char)(c) > meta_character_threshold && (unsigned char)(c) <= largest_char)
#define CTRL(c) ((c) & control_character_mask)
#define META(c) ((c) | meta_character_bit)
#define UNMETA(c) ((c) & (~meta_character_bit))
#define UNCTRL(c) _rl_to_upper(((c)|control_character_bit))
#ifndef UCHAR_MAX
# define UCHAR_MAX 255
#endif
#ifndef CHAR_MAX
# define CHAR_MAX 127
#endif
/* use this as a proxy for C89 */
#if defined (HAVE_STDLIB_H) && defined (HAVE_STRING_H)
# define IN_CTYPE_DOMAIN(c) 1
# define NON_NEGATIVE(c) 1
#else
# define IN_CTYPE_DOMAIN(c) ((c) >= 0 && (c) <= CHAR_MAX)
# define NON_NEGATIVE(c) ((unsigned char)(c) == (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'))
#endif
/* Some systems define these; we want our definitions. */
#undef ISPRINT
/* 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 _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c))
#define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c))
#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
#define _rl_alphabetic_p(c) (NON_NEGATIVE(c) && ISALNUM(c))
#define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c))
#ifndef _rl_to_upper
# define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)(c)) : (c))
# define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)(c)) : (c))
#endif
#ifndef _rl_digit_value
# define _rl_digit_value(x) ((x) - '0')
#endif
#ifndef _rl_isident
# define _rl_isident(c) (ISALNUM(c) || (c) == '_')
#endif
#ifndef ISOCTAL
# define ISOCTAL(c) ((c) >= '0' && (c) <= '7')
#endif
#define OCTVALUE(c) ((c) - '0')
#define HEXVALUE(c) \
(((c) >= 'a' && (c) <= 'f') \
? (c)-'a'+10 \
: (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0')
#ifndef NEWLINE
#define NEWLINE '\n'
#endif
#ifndef RETURN
#define RETURN CTRL('M')
#endif
#ifndef RUBOUT
#define RUBOUT 0x7f
#endif
#ifndef TAB
#define TAB '\t'
#endif
#ifdef ABORT_CHAR
#undef ABORT_CHAR
#endif
#define ABORT_CHAR CTRL('G')
#ifdef PAGE
#undef PAGE
#endif
#define PAGE CTRL('L')
#ifdef SPACE
#undef SPACE
#endif
#define SPACE ' ' /* XXX - was 0x20 */
#ifdef ESC
#undef ESC
#endif
#define ESC CTRL('[')
#endif /* _CHARDEFS_H_ */
readline-8.3/histlib.h 000644 000436 000024 00000005462 14656457041 015062 0 ustar 00chet staff 000000 000000 /* histlib.h -- internal definitions for the history library. */
/* Copyright (C) 1989-2009,2021-2023 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
History is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
History is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with History. If not, see .
*/
#if !defined (_HISTLIB_H_)
#define _HISTLIB_H_
#if defined (HAVE_STRING_H)
# include
#else
# include
#endif /* !HAVE_STRING_H */
#if !defined (STREQ)
#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))
#endif
#if !defined (HAVE_STRCASECMP)
#define strcasecmp(a,b) strcmp ((a), (b))
#define strncasecmp(a, b, n) strncmp ((a), (b), (n))
#endif
#ifndef savestring
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
#endif
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
#ifndef _rl_digit_p
#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
#endif
#ifndef _rl_digit_value
#define _rl_digit_value(c) ((c) - '0')
#endif
#ifndef member
#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
#endif
#ifndef FREE
# define FREE(x) if (x) free (x)
#endif
/* Possible history errors passed to hist_error. */
#define EVENT_NOT_FOUND 0
#define BAD_WORD_SPEC 1
#define SUBST_FAILED 2
#define BAD_MODIFIER 3
#define NO_PREV_SUBST 4
/* Possible definitions for history starting point specification. */
#define NON_ANCHORED_SEARCH 0
#define ANCHORED_SEARCH 0x01
#define PATTERN_SEARCH 0x02
#define CASEFOLD_SEARCH 0x04
/* Possible definitions for what style of writing the history file we want. */
#define HISTORY_APPEND 0
#define HISTORY_OVERWRITE 1
/* internal extern function declarations used by other parts of the library */
/* histsearch.c */
extern int _hs_history_patsearch (const char *, int, int, int);
extern int _hs_history_search (const char *, int, int, int);
/* history.c */
extern void _hs_replace_history_data (int, histdata_t *, histdata_t *);
extern int _hs_search_history_data (histdata_t *);
extern int _hs_at_end_of_history (void);
/* histfile.c */
extern void _hs_append_history_line (int, const char *);
#endif /* !_HISTLIB_H_ */
readline-8.3/rlmbutil.h 000644 000436 000024 00000027354 15020315055 015242 0 ustar 00chet staff 000000 000000 /* rlmbutil.h -- utility functions for multibyte characters. */
/* Copyright (C) 2001-2025 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 .
*/
#if !defined (_RL_MBUTIL_H_)
#define _RL_MBUTIL_H_
#include "rlstdc.h"
/************************************************/
/* check multibyte capability for I18N code */
/************************************************/
/* For platforms which support the ISO C amendment 1 functionality we
support user defined character classes. */
/* Solaris 2.5 has a bug: must be included before . */
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) && defined (HAVE_LOCALE_H)
# include
# include
# if defined (HAVE_ISWCTYPE) && \
defined (HAVE_ISWLOWER) && \
defined (HAVE_ISWUPPER) && \
defined (HAVE_MBSRTOWCS) && \
defined (HAVE_MBRTOWC) && \
defined (HAVE_MBRLEN) && \
defined (HAVE_TOWLOWER) && \
defined (HAVE_TOWUPPER) && \
defined (HAVE_WCHAR_T) && \
defined (HAVE_WCWIDTH)
/* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
/* If we don't want multibyte chars even on a system that supports them, let
the configuring user turn multibyte support off. */
#if defined (NO_MULTIBYTE_SUPPORT)
# undef HANDLE_MULTIBYTE
#endif
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
#if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T)
# define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0)
# define mbsrtowcs(dest, src, len, ps) (mbsrtowcs) (dest, src, len, 0)
# define wcrtomb(s, wc, ps) (wcrtomb) (s, wc, 0)
# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
# define mbrlen(s, n, ps) (mbrlen) (s, n, 0)
# define mbstate_t int
#endif
/* Make sure MB_LEN_MAX is at least 16 on systems that claim to be able to
handle multibyte chars (some systems define MB_LEN_MAX as 1) */
#ifdef HANDLE_MULTIBYTE
# include
# if defined(MB_LEN_MAX) && (MB_LEN_MAX < 16)
# undef MB_LEN_MAX
# endif
# if !defined (MB_LEN_MAX)
# define MB_LEN_MAX 16
# endif
#endif
/************************************************/
/* end of multibyte capability checks for I18N */
/************************************************/
/*
* wchar_t doesn't work for 32-bit values on Windows using MSVC
*/
#ifdef WCHAR_T_BROKEN
# define WCHAR_T char32_t
# define MBRTOWC mbrtoc32
# define WCRTOMB c32rtomb
#else /* normal systems */
# define WCHAR_T wchar_t
# define MBRTOWC mbrtowc
# define WCRTOMB wcrtomb
#endif
/*
* Flags for _rl_find_prev_mbchar and _rl_find_next_mbchar:
*
* MB_FIND_ANY find any multibyte character
* MB_FIND_NONZERO find a non-zero-width multibyte character
*/
#define MB_FIND_ANY 0x00
#define MB_FIND_NONZERO 0x01
extern int _rl_find_prev_mbchar (const char *, int, int);
extern int _rl_find_next_mbchar (const char *, int, int, int);
#ifdef HANDLE_MULTIBYTE
extern size_t _rl_mbstrlen (const char *);
extern int _rl_compare_chars (const char *, int, mbstate_t *, const char *, int, mbstate_t *);
extern int _rl_get_char_len (const char *, mbstate_t *);
extern int _rl_adjust_point (const char *, int, mbstate_t *);
extern int _rl_read_mbchar (char *, int);
extern int _rl_read_mbstring (int, char *, int);
extern int _rl_is_mbchar_matched (const char *, int, int, char *, int);
extern WCHAR_T _rl_char_value (const char *, int);
extern int _rl_walphabetic (WCHAR_T);
extern int _rl_mb_strcaseeqn (const char *, size_t, const char *, size_t, size_t, int);
extern int _rl_mb_charcasecmp (const char *, mbstate_t *, const char *, mbstate_t *, int);
#define _rl_to_wupper(wc) (iswlower (wc) ? towupper (wc) : (wc))
#define _rl_to_wlower(wc) (iswupper (wc) ? towlower (wc) : (wc))
#define MB_NEXTCHAR(b,s,c,f) \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) \
? _rl_find_next_mbchar ((b), (s), (c), (f)) \
: ((s) + (c)))
#define MB_PREVCHAR(b,s,f) \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) \
? _rl_find_prev_mbchar ((b), (s), (f)) \
: ((s) - 1))
#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 (WCHAR_T wc)
{
switch (wc)
{
case L' ': case L'!': case L'"': case L'#': case L'%':
case L'&': case L'\'': case L'(': case L')': case L'*':
case L'+': case L',': case L'-': case L'.': case L'/':
case L'0': case L'1': case L'2': case L'3': case L'4':
case L'5': case L'6': case L'7': case L'8': case L'9':
case L':': case L';': case L'<': case L'=': case L'>':
case L'?':
case L'A': case L'B': case L'C': case L'D': case L'E':
case L'F': case L'G': case L'H': case L'I': case L'J':
case L'K': case L'L': case L'M': case L'N': case L'O':
case L'P': case L'Q': case L'R': case L'S': case L'T':
case L'U': case L'V': case L'W': case L'X': case L'Y':
case L'Z':
case L'[': case L'\\': case L']': case L'^': case L'_':
case L'a': case L'b': case L'c': case L'd': case L'e':
case L'f': case L'g': case L'h': case L'i': case L'j':
case L'k': case L'l': case L'm': case L'n': case L'o':
case L'p': case L'q': case L'r': case L's': case L't':
case L'u': case L'v': case L'w': case L'x': case L'y':
case L'z': case L'{': case L'|': case L'}': case L'~':
return 1;
default:
return wcwidth (wc);
}
}
/* Unicode combining characters as of version 15.1 */
#define UNICODE_COMBINING_CHAR(x) \
(((x) >= 0x0300 && (x) <= 0x036F) || \
((x) >= 0x1AB0 && (x) <= 0x1AFF) || \
((x) >= 0x1DC0 && (x) <= 0x1DFF) || \
((x) >= 0x20D0 && (x) <= 0x20FF) || \
((x) >= 0xFE20 && (x) <= 0xFE2F))
#if defined (WCWIDTH_BROKEN)
# define WCWIDTH(wc) ((_rl_utf8locale && UNICODE_COMBINING_CHAR((int)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
#define IS_BASE_CHAR(x) (iswgraph(x) && WCWIDTH(x) > 0)
#define UTF8_SINGLEBYTE(c) (((c) & 0x80) == 0)
#define UTF8_MBFIRSTCHAR(c) (((c) & 0xc0) == 0xc0)
#define UTF8_MBCHAR(c) (((c) & 0xc0) == 0x80)
#else /* !HANDLE_MULTIBYTE */
#undef MB_LEN_MAX
#undef MB_CUR_MAX
#define MB_LEN_MAX 1
#define MB_CUR_MAX 1
#define _rl_find_prev_mbchar(b, i, f) (((i) == 0) ? (i) : ((i) - 1))
#define _rl_find_next_mbchar(b, i1, i2, f) ((i1) + (i2))
#define _rl_char_value(buf,ind) ((buf)[(ind)])
#define _rl_walphabetic(c) (rl_alphabetic (c))
#define _rl_to_wupper(c) (_rl_to_upper (c))
#define _rl_to_wlower(c) (_rl_to_lower (c))
#define MB_NEXTCHAR(b,s,c,f) ((s) + (c))
#define MB_PREVCHAR(b,s,f) ((s) - 1)
#define MB_INVALIDCH(x) (0)
#define MB_NULLWCH(x) (0)
#define UTF8_SINGLEBYTE(c) (1)
#if !defined (HAVE_WCHAR_T) && !defined (wchar_t)
# define wchar_t int
#endif
#endif /* !HANDLE_MULTIBYTE */
extern int rl_byte_oriented;
/* Snagged from gnulib */
#ifdef HANDLE_MULTIBYTE
#ifdef __cplusplus
extern "C" {
#endif
/* is_basic(c) tests whether the single-byte character c is
- in the ISO C "basic character set" or is one of '@', '$', and '`'
which ISO C 23 § 5.2.1.1.(1) guarantees to be single-byte and in
practice are safe to treat as basic in the execution character set,
or
- in the POSIX "portable character set", which
equally guarantees to be single-byte. */
#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('$' == 36) && ('%' == 37) && ('&' == 38) && ('\'' == 39) \
&& ('(' == 40) && (')' == 41) && ('*' == 42) && ('+' == 43) \
&& (',' == 44) && ('-' == 45) && ('.' == 46) && ('/' == 47) \
&& ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) \
&& ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) \
&& ('8' == 56) && ('9' == 57) && (':' == 58) && (';' == 59) \
&& ('<' == 60) && ('=' == 61) && ('>' == 62) && ('?' == 63) \
&& ('@' == 64) && ('A' == 65) && ('B' == 66) && ('C' == 67) \
&& ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) \
&& ('H' == 72) && ('I' == 73) && ('J' == 74) && ('K' == 75) \
&& ('L' == 76) && ('M' == 77) && ('N' == 78) && ('O' == 79) \
&& ('P' == 80) && ('Q' == 81) && ('R' == 82) && ('S' == 83) \
&& ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) \
&& ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) \
&& ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) \
&& ('`' == 96) && ('a' == 97) && ('b' == 98) && ('c' == 99) \
&& ('d' == 100) && ('e' == 101) && ('f' == 102) && ('g' == 103) \
&& ('h' == 104) && ('i' == 105) && ('j' == 106) && ('k' == 107) \
&& ('l' == 108) && ('m' == 109) && ('n' == 110) && ('o' == 111) \
&& ('p' == 112) && ('q' == 113) && ('r' == 114) && ('s' == 115) \
&& ('t' == 116) && ('u' == 117) && ('v' == 118) && ('w' == 119) \
&& ('x' == 120) && ('y' == 121) && ('z' == 122) && ('{' == 123) \
&& ('|' == 124) && ('}' == 125) && ('~' == 126)
/* The character set is ISO-646, not EBCDIC. */
# define IS_BASIC_ASCII 1
/* All locale encodings (see localcharset.h) map the characters 0x00..0x7F
to U+0000..U+007F, like ASCII, except for
CP864 different mapping of '%'
SHIFT_JIS different mappings of 0x5C, 0x7E
JOHAB different mapping of 0x5C
However, these characters in the range 0x20..0x7E are in the ISO C
"basic character set" and in the POSIX "portable character set", which
ISO C and POSIX guarantee to be single-byte. Thus, locales with these
encodings are not POSIX compliant. And they are most likely not in use
any more (as of 2023). */
# define _rl_is_basic(c) ((unsigned char) (c) < 0x80)
#else
static inline int
_rl_is_basic (char c)
{
switch (c)
{
case '\0':
case '\007': case '\010':
case '\t': case '\n': case '\v': case '\f': case '\r':
case ' ': 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 '@':
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 '`':
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 0;
}
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* HANDLE_MULTIBYTE */
#endif /* _RL_MBUTIL_H_ */
readline-8.3/tilde.c 000644 000436 000024 00000031200 14643255245 014503 0 ustar 00chet staff 000000 000000 /* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
/* Copyright (C) 1988-2020,2023-2024 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 .
*/
#if defined (HAVE_CONFIG_H)
# include
#endif
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include
# endif
# include
#endif
#if defined (HAVE_STRING_H)
# include
#else /* !HAVE_STRING_H */
# include
#endif /* !HAVE_STRING_H */
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include
#if defined (HAVE_PWD_H)
#include
#endif
#include "tilde.h"
#if defined (TEST) || defined (STATIC_MALLOC)
static void *xmalloc (), *xrealloc ();
#else
# include "xmalloc.h"
#endif /* TEST || STATIC_MALLOC */
#if !defined (HAVE_GETPW_DECLS)
# if defined (HAVE_GETPWUID)
extern struct passwd *getpwuid (uid_t);
# endif
# if defined (HAVE_GETPWNAM)
extern struct passwd *getpwnam (const char *);
# endif
#endif /* !HAVE_GETPW_DECLS */
#if !defined (savestring)
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
#endif /* !savestring */
/* If being compiled as part of bash, these will be satisfied from
variables.o. If being compiled as part of readline, they will
be satisfied from shell.o. */
extern char *sh_get_home_dir (void);
extern char *sh_get_env_value (const char *);
/* The default value of tilde_additional_prefixes. This is set to
whitespace preceding a tilde so that simple programs which do not
perform any word separation get desired behaviour. */
static const char *default_prefixes[] =
{ " ~", "\t~", (const char *)NULL };
/* The default value of tilde_additional_suffixes. This is set to
whitespace or newline so that simple programs which do not
perform any word separation get desired behaviour. */
static const char *default_suffixes[] =
{ " ", "\n", (const char *)NULL };
/* If non-null, this contains the address of a function that the application
wants called before trying the standard tilde expansions. The function
is called with the text sans tilde, and returns a malloc()'ed string
which is the expansion, or a NULL pointer if the expansion fails. */
tilde_hook_func_t *tilde_expansion_preexpansion_hook = (tilde_hook_func_t *)NULL;
/* If non-null, this contains the address of a function to call if the
standard meaning for expanding a tilde fails. The function is called
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
which is the expansion, or a NULL pointer if there is no expansion. */
tilde_hook_func_t *tilde_expansion_failure_hook = (tilde_hook_func_t *)NULL;
/* When non-null, this is a NULL terminated array of strings which
are duplicates for a tilde prefix. Bash uses this to expand
`=~' and `:~'. */
char **tilde_additional_prefixes = (char **)default_prefixes;
/* When non-null, this is a NULL terminated array of strings which match
the end of a username, instead of just "/". Bash sets this to
`:' and `=~'. */
char **tilde_additional_suffixes = (char **)default_suffixes;
static int tilde_find_prefix (const char *, int *);
static int tilde_find_suffix (const char *);
static char *isolate_tilde_prefix (const char *, int *);
static char *glue_prefix_and_suffix (char *, const char *, int);
/* Find the start of a tilde expansion in STRING, and return the index of
the tilde which starts the expansion. Place the length of the text
which identified this tilde starter in LEN, excluding the tilde itself. */
static int
tilde_find_prefix (const char *string, int *len)
{
register int i, j, string_len;
register char **prefixes;
prefixes = tilde_additional_prefixes;
string_len = strlen (string);
*len = 0;
if (*string == '\0' || *string == '~')
return (0);
if (prefixes)
{
for (i = 0; i < string_len; i++)
{
for (j = 0; prefixes[j]; j++)
{
if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
{
*len = strlen (prefixes[j]) - 1;
return (i + *len);
}
}
}
}
return (string_len);
}
/* Find the end of a tilde expansion in STRING, and return the index of
the character which ends the tilde definition. */
static int
tilde_find_suffix (const char *string)
{
int i, j;
size_t string_len;
char **suffixes;
suffixes = tilde_additional_suffixes;
string_len = strlen (string);
for (i = 0; i < string_len; i++)
{
#if defined (__MSDOS__)
if (string[i] == '/' || string[i] == '\\' /* || !string[i] */)
#else
if (string[i] == '/' /* || !string[i] */)
#endif
break;
for (j = 0; suffixes && suffixes[j]; j++)
{
if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
return (i);
}
}
return (i);
}
/* Return a new string which is the result of tilde expanding STRING. */
char *
tilde_expand (const char *string)
{
char *result;
size_t result_size, result_index;
result_index = result_size = 0;
if (result = strchr (string, '~'))
result = (char *)xmalloc (result_size = (strlen (string) + 16));
else
result = (char *)xmalloc (result_size = (strlen (string) + 1));
/* Scan through STRING expanding tildes as we come to them. */
while (1)
{
int start, end;
char *tilde_word, *expansion;
int len;
/* Make START point to the tilde which starts the expansion. */
start = tilde_find_prefix (string, &len);
/* Copy the skipped text into the result. */
if ((result_index + start + 1) > result_size)
result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
strncpy (result + result_index, string, start);
result_index += start;
/* Advance STRING to the starting tilde. */
string += start;
/* Make END be the index of one after the last character of the
username. */
end = tilde_find_suffix (string);
/* If both START and END are zero, we are all done. */
if (!start && !end)
break;
/* Expand the entire tilde word, and copy it into RESULT. */
tilde_word = (char *)xmalloc (1 + end);
strncpy (tilde_word, string, end);
tilde_word[end] = '\0';
string += end;
expansion = tilde_expand_word (tilde_word);
if (expansion == 0)
expansion = tilde_word;
else
xfree (tilde_word);
len = strlen (expansion);
#ifdef __CYGWIN__
/* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when
$HOME for `user' is /. On cygwin, // denotes a network drive. */
if (len > 1 || *expansion != '/' || *string != '/')
#endif
{
if ((result_index + len + 1) > result_size)
result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
strcpy (result + result_index, expansion);
result_index += len;
}
xfree (expansion);
}
result[result_index] = '\0';
return (result);
}
/* Take FNAME and return the tilde prefix we want expanded. If LENP is
non-null, the index of the end of the prefix into FNAME is returned in
the location it points to. */
static char *
isolate_tilde_prefix (const char *fname, int *lenp)
{
char *ret;
int i;
ret = (char *)xmalloc (strlen (fname));
#if defined (__MSDOS__)
for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
#else
for (i = 1; fname[i] && fname[i] != '/'; i++)
#endif
ret[i - 1] = fname[i];
ret[i - 1] = '\0';
if (lenp)
*lenp = i;
return ret;
}
#if 0
/* Public function to scan a string (FNAME) beginning with a tilde and find
the portion of the string that should be passed to the tilde expansion
function. Right now, it just calls tilde_find_suffix and allocates new
memory, but it can be expanded to do different things later. */
char *
tilde_find_word (const char *fname, int flags, int *lenp)
{
int x;
char *r;
x = tilde_find_suffix (fname);
if (x == 0)
{
r = savestring (fname);
if (lenp)
*lenp = 0;
}
else
{
r = (char *)xmalloc (1 + x);
strncpy (r, fname, x);
r[x] = '\0';
if (lenp)
*lenp = x;
}
return r;
}
#endif
/* Return a string that is PREFIX concatenated with SUFFIX starting at
SUFFIND. */
static char *
glue_prefix_and_suffix (char *prefix, const char *suffix, int suffind)
{
char *ret;
size_t plen, slen;
plen = (prefix && *prefix) ? strlen (prefix) : 0;
slen = strlen (suffix + suffind);
ret = (char *)xmalloc (plen + slen + 1);
if (plen)
strcpy (ret, prefix);
strcpy (ret + plen, suffix + suffind);
return ret;
}
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
tilde. If there is no expansion, call tilde_expansion_failure_hook.
This always returns a newly-allocated string, never static storage. */
char *
tilde_expand_word (const char *filename)
{
char *dirname, *expansion, *username;
int user_len;
struct passwd *user_entry;
if (filename == 0)
return ((char *)NULL);
if (*filename != '~')
return (savestring (filename));
/* A leading `~/' or a bare `~' is *always* translated to the value of
$HOME or the home directory of the current user, regardless of any
preexpansion hook. */
if (filename[1] == '\0' || filename[1] == '/')
{
/* 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. */
if (expansion == 0)
expansion = sh_get_home_dir ();
return (glue_prefix_and_suffix (expansion, filename, 1));
}
username = isolate_tilde_prefix (filename, &user_len);
if (tilde_expansion_preexpansion_hook)
{
expansion = (*tilde_expansion_preexpansion_hook) (username);
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
xfree (username);
xfree (expansion);
return (dirname);
}
}
/* No preexpansion hook, or the preexpansion hook failed. Look in the
password database. */
dirname = (char *)NULL;
#if defined (HAVE_GETPWNAM)
user_entry = getpwnam (username);
#else
user_entry = 0;
#endif
if (user_entry == 0)
{
/* If the calling program has a special syntax for expanding tildes,
and we couldn't find a standard expansion, then let them try. */
if (tilde_expansion_failure_hook)
{
expansion = (*tilde_expansion_failure_hook) (username);
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
xfree (expansion);
}
}
/* If we don't have a failure hook, or if the failure hook did not
expand the tilde, return a copy of what we were passed. */
if (dirname == 0)
dirname = savestring (filename);
}
#if defined (HAVE_GETPWENT)
else
dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
#endif
xfree (username);
#if defined (HAVE_GETPWENT)
endpwent ();
#endif
return (dirname);
}
#if defined (TEST)
#undef NULL
#include
main (int argc, char **argv)
{
char *result, line[512];
int done = 0;
while (!done)
{
printf ("~expand: ");
fflush (stdout);
if (!gets (line))
strcpy (line, "done");
if ((strcmp (line, "done") == 0) ||
(strcmp (line, "quit") == 0) ||
(strcmp (line, "exit") == 0))
{
done = 1;
break;
}
result = tilde_expand (line);
printf (" --> %s\n", result);
free (result);
}
exit (0);
}
static void memory_error_and_abort (void);
static void *
xmalloc (size_t bytes)
{
void *temp = (char *)malloc (bytes);
if (!temp)
memory_error_and_abort ();
return (temp);
}
static void *
xrealloc (void *pointer, int bytes)
{
void *temp;
if (!pointer)
temp = malloc (bytes);
else
temp = realloc (pointer, bytes);
if (!temp)
memory_error_and_abort ();
return (temp);
}
static void
memory_error_and_abort (void)
{
fprintf (stderr, "readline: out of virtual memory\n");
abort ();
}
/*
* Local variables:
* compile-command: "gcc -g -DTEST -o tilde tilde.c"
* end:
*/
#endif /* TEST */
readline-8.3/colors.h 000644 000436 000024 00000007017 12651440543 014713 0 ustar 00chet staff 000000 000000 /* `dir', `vdir' and `ls' directory listing programs for GNU.
Modified by Chet Ramey for Readline.
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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 . */
/* Written by Richard Stallman and David MacKenzie. */
/* Color support by Peter Anvin and Dennis
Flaherty based on original patches by
Greg Lee . */
#ifndef _COLORS_H_
#define _COLORS_H_
#include // size_t
#if defined(__TANDEM) && defined(HAVE_STDBOOL_H) && (__STDC_VERSION__ < 199901L)
typedef int _Bool;
#endif
#if defined (HAVE_STDBOOL_H)
# include // 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 socket */
#define C_PREFIX C_SOCK
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 (const char *f);
extern void _rl_prep_non_filename_text (void);
#endif /* !_COLORS_H_ */
readline-8.3/vi_keymap.c 000644 000436 000024 00000107261 13060556765 015404 0 ustar 00chet staff 000000 000000 /* vi_keymap.c -- the keymap for vi_mode in readline (). */
/* Copyright (C) 1987-2017 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 .
*/
#if !defined (BUFSIZ)
#include
#endif /* !BUFSIZ */
#include "readline.h"
#if 0
extern KEYMAP_ENTRY_ARRAY vi_escape_keymap;
#endif
/* The keymap arrays for handling vi mode. */
KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
/* The regular control keys come first. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */
{ ISFUNC, rl_vi_eof_maybe }, /* Control-d */
{ ISFUNC, rl_emacs_editing_mode }, /* Control-e */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */
{ ISFUNC, rl_abort }, /* Control-g */
{ ISFUNC, rl_backward_char }, /* Control-h */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-i */
{ ISFUNC, rl_newline }, /* Control-j */
{ ISFUNC, rl_kill_line }, /* Control-k */
{ ISFUNC, rl_clear_screen }, /* Control-l */
{ ISFUNC, rl_newline }, /* Control-m */
{ ISFUNC, rl_get_next_history }, /* Control-n */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
{ ISFUNC, rl_get_previous_history }, /* Control-p */
{ ISFUNC, rl_quoted_insert }, /* Control-q */
{ ISFUNC, rl_reverse_search_history }, /* Control-r */
{ ISFUNC, rl_forward_search_history }, /* Control-s */
{ ISFUNC, rl_transpose_chars }, /* Control-t */
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
{ ISFUNC, rl_quoted_insert }, /* Control-v */
{ ISFUNC, rl_vi_unix_word_rubout }, /* Control-w */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */
{ ISFUNC, rl_yank }, /* Control-y */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-[ */ /* vi_escape_keymap */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */
{ ISFUNC, rl_vi_undo }, /* Control-_ */
/* The start of printing characters. */
{ ISFUNC, rl_forward_char }, /* SPACE */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ! */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* " */
{ ISFUNC, rl_insert_comment }, /* # */
{ ISFUNC, rl_end_of_line }, /* $ */
{ ISFUNC, rl_vi_match }, /* % */
{ ISFUNC, rl_vi_tilde_expand }, /* & */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ' */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ( */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ) */
{ ISFUNC, rl_vi_complete }, /* * */
{ ISFUNC, rl_get_next_history}, /* + */
{ ISFUNC, rl_vi_char_search }, /* , */
{ ISFUNC, rl_get_previous_history }, /* - */
{ ISFUNC, rl_vi_redo }, /* . */
{ ISFUNC, rl_vi_search }, /* / */
/* Regular digits. */
{ ISFUNC, rl_beg_of_line }, /* 0 */
{ ISFUNC, rl_vi_arg_digit }, /* 1 */
{ ISFUNC, rl_vi_arg_digit }, /* 2 */
{ ISFUNC, rl_vi_arg_digit }, /* 3 */
{ ISFUNC, rl_vi_arg_digit }, /* 4 */
{ ISFUNC, rl_vi_arg_digit }, /* 5 */
{ ISFUNC, rl_vi_arg_digit }, /* 6 */
{ ISFUNC, rl_vi_arg_digit }, /* 7 */
{ ISFUNC, rl_vi_arg_digit }, /* 8 */
{ ISFUNC, rl_vi_arg_digit }, /* 9 */
/* A little more punctuation. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* : */
{ ISFUNC, rl_vi_char_search }, /* ; */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* < */
{ ISFUNC, rl_vi_complete }, /* = */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* > */
{ ISFUNC, rl_vi_search }, /* ? */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* @ */
/* Uppercase alphabet. */
{ ISFUNC, rl_vi_append_eol }, /* A */
{ ISFUNC, rl_vi_prev_word}, /* B */
{ ISFUNC, rl_vi_change_to }, /* C */
{ ISFUNC, rl_vi_delete_to }, /* D */
{ ISFUNC, rl_vi_end_word }, /* E */
{ ISFUNC, rl_vi_char_search }, /* F */
{ ISFUNC, rl_vi_fetch_history }, /* G */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* H */
{ ISFUNC, rl_vi_insert_beg }, /* I */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* J */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* K */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* L */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* M */
{ ISFUNC, rl_vi_search_again }, /* N */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* O */
{ ISFUNC, rl_vi_put }, /* P */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Q */
{ ISFUNC, rl_vi_replace }, /* R */
{ ISFUNC, rl_vi_subst }, /* S */
{ ISFUNC, rl_vi_char_search }, /* T */
{ ISFUNC, rl_revert_line }, /* U */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* V */
{ ISFUNC, rl_vi_next_word }, /* W */
{ ISFUNC, rl_vi_rubout }, /* X */
{ ISFUNC, rl_vi_yank_to }, /* Y */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Z */
/* Some more punctuation. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* [ */
{ ISFUNC, rl_vi_complete }, /* \ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ] */
{ ISFUNC, rl_vi_first_print }, /* ^ */
{ ISFUNC, rl_vi_yank_arg }, /* _ */
{ ISFUNC, rl_vi_goto_mark }, /* ` */
/* Lowercase alphabet. */
{ ISFUNC, rl_vi_append_mode }, /* a */
{ ISFUNC, rl_vi_prev_word }, /* b */
{ ISFUNC, rl_vi_change_to }, /* c */
{ ISFUNC, rl_vi_delete_to }, /* d */
{ ISFUNC, rl_vi_end_word }, /* e */
{ ISFUNC, rl_vi_char_search }, /* f */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* g */
{ ISFUNC, rl_backward_char }, /* h */
{ ISFUNC, rl_vi_insert_mode }, /* i */
{ ISFUNC, rl_get_next_history }, /* j */
{ ISFUNC, rl_get_previous_history }, /* k */
{ ISFUNC, rl_forward_char }, /* l */
{ ISFUNC, rl_vi_set_mark }, /* m */
{ ISFUNC, rl_vi_search_again }, /* n */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* o */
{ ISFUNC, rl_vi_put }, /* p */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* q */
{ ISFUNC, rl_vi_change_char }, /* r */
{ ISFUNC, rl_vi_subst }, /* s */
{ ISFUNC, rl_vi_char_search }, /* t */
{ ISFUNC, rl_vi_undo }, /* u */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* v */
{ ISFUNC, rl_vi_next_word }, /* w */
{ ISFUNC, rl_vi_delete }, /* x */
{ ISFUNC, rl_vi_yank_to }, /* y */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* z */
/* Final punctuation. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* { */
{ ISFUNC, rl_vi_column }, /* | */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* } */
{ ISFUNC, rl_vi_change_case }, /* ~ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Undefined keys. */
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 }
#endif /* KEYMAP_SIZE > 128 */
};
KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
/* The regular control keys come first. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
{ ISFUNC, rl_insert }, /* Control-a */
{ ISFUNC, rl_insert }, /* Control-b */
{ ISFUNC, rl_insert }, /* Control-c */
{ ISFUNC, rl_vi_eof_maybe }, /* Control-d */
{ ISFUNC, rl_insert }, /* Control-e */
{ ISFUNC, rl_insert }, /* Control-f */
{ ISFUNC, rl_insert }, /* Control-g */
{ ISFUNC, rl_rubout }, /* Control-h */
{ ISFUNC, rl_complete }, /* Control-i */
{ ISFUNC, rl_newline }, /* Control-j */
{ ISFUNC, rl_insert }, /* Control-k */
{ ISFUNC, rl_insert }, /* Control-l */
{ ISFUNC, rl_newline }, /* Control-m */
{ ISFUNC, rl_menu_complete}, /* Control-n */
{ ISFUNC, rl_insert }, /* Control-o */
{ ISFUNC, rl_backward_menu_complete }, /* Control-p */
{ ISFUNC, rl_insert }, /* Control-q */
{ ISFUNC, rl_reverse_search_history }, /* Control-r */
{ ISFUNC, rl_forward_search_history }, /* Control-s */
{ ISFUNC, rl_transpose_chars }, /* Control-t */
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
{ ISFUNC, rl_quoted_insert }, /* Control-v */
{ ISFUNC, rl_vi_unix_word_rubout }, /* Control-w */
{ ISFUNC, rl_insert }, /* Control-x */
{ ISFUNC, rl_yank }, /* Control-y */
{ ISFUNC, rl_insert }, /* Control-z */
{ ISFUNC, rl_vi_movement_mode }, /* Control-[ */
{ ISFUNC, rl_insert }, /* Control-\ */
{ ISFUNC, rl_insert }, /* Control-] */
{ ISFUNC, rl_insert }, /* Control-^ */
{ ISFUNC, rl_vi_undo }, /* Control-_ */
/* The start of printing characters. */
{ ISFUNC, rl_insert }, /* SPACE */
{ ISFUNC, rl_insert }, /* ! */
{ ISFUNC, rl_insert }, /* " */
{ ISFUNC, rl_insert }, /* # */
{ ISFUNC, rl_insert }, /* $ */
{ ISFUNC, rl_insert }, /* % */
{ ISFUNC, rl_insert }, /* & */
{ ISFUNC, rl_insert }, /* ' */
{ ISFUNC, rl_insert }, /* ( */
{ ISFUNC, rl_insert }, /* ) */
{ ISFUNC, rl_insert }, /* * */
{ ISFUNC, rl_insert }, /* + */
{ ISFUNC, rl_insert }, /* , */
{ ISFUNC, rl_insert }, /* - */
{ ISFUNC, rl_insert }, /* . */
{ ISFUNC, rl_insert }, /* / */
/* Regular digits. */
{ ISFUNC, rl_insert }, /* 0 */
{ ISFUNC, rl_insert }, /* 1 */
{ ISFUNC, rl_insert }, /* 2 */
{ ISFUNC, rl_insert }, /* 3 */
{ ISFUNC, rl_insert }, /* 4 */
{ ISFUNC, rl_insert }, /* 5 */
{ ISFUNC, rl_insert }, /* 6 */
{ ISFUNC, rl_insert }, /* 7 */
{ ISFUNC, rl_insert }, /* 8 */
{ ISFUNC, rl_insert }, /* 9 */
/* A little more punctuation. */
{ ISFUNC, rl_insert }, /* : */
{ ISFUNC, rl_insert }, /* ; */
{ ISFUNC, rl_insert }, /* < */
{ ISFUNC, rl_insert }, /* = */
{ ISFUNC, rl_insert }, /* > */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* @ */
/* Uppercase alphabet. */
{ ISFUNC, rl_insert }, /* A */
{ ISFUNC, rl_insert }, /* B */
{ ISFUNC, rl_insert }, /* C */
{ ISFUNC, rl_insert }, /* D */
{ ISFUNC, rl_insert }, /* E */
{ ISFUNC, rl_insert }, /* F */
{ ISFUNC, rl_insert }, /* G */
{ ISFUNC, rl_insert }, /* H */
{ ISFUNC, rl_insert }, /* I */
{ ISFUNC, rl_insert }, /* J */
{ ISFUNC, rl_insert }, /* K */
{ ISFUNC, rl_insert }, /* L */
{ ISFUNC, rl_insert }, /* M */
{ ISFUNC, rl_insert }, /* N */
{ ISFUNC, rl_insert }, /* O */
{ ISFUNC, rl_insert }, /* P */
{ ISFUNC, rl_insert }, /* Q */
{ ISFUNC, rl_insert }, /* R */
{ ISFUNC, rl_insert }, /* S */
{ ISFUNC, rl_insert }, /* T */
{ ISFUNC, rl_insert }, /* U */
{ ISFUNC, rl_insert }, /* V */
{ ISFUNC, rl_insert }, /* W */
{ ISFUNC, rl_insert }, /* X */
{ ISFUNC, rl_insert }, /* Y */
{ ISFUNC, rl_insert }, /* Z */
/* Some more punctuation. */
{ ISFUNC, rl_insert }, /* [ */
{ ISFUNC, rl_insert }, /* \ */
{ ISFUNC, rl_insert }, /* ] */
{ ISFUNC, rl_insert }, /* ^ */
{ ISFUNC, rl_insert }, /* _ */
{ ISFUNC, rl_insert }, /* ` */
/* Lowercase alphabet. */
{ ISFUNC, rl_insert }, /* a */
{ ISFUNC, rl_insert }, /* b */
{ ISFUNC, rl_insert }, /* c */
{ ISFUNC, rl_insert }, /* d */
{ ISFUNC, rl_insert }, /* e */
{ ISFUNC, rl_insert }, /* f */
{ ISFUNC, rl_insert }, /* g */
{ ISFUNC, rl_insert }, /* h */
{ ISFUNC, rl_insert }, /* i */
{ ISFUNC, rl_insert }, /* j */
{ ISFUNC, rl_insert }, /* k */
{ ISFUNC, rl_insert }, /* l */
{ ISFUNC, rl_insert }, /* m */
{ ISFUNC, rl_insert }, /* n */
{ ISFUNC, rl_insert }, /* o */
{ ISFUNC, rl_insert }, /* p */
{ ISFUNC, rl_insert }, /* q */
{ ISFUNC, rl_insert }, /* r */
{ ISFUNC, rl_insert }, /* s */
{ ISFUNC, rl_insert }, /* t */
{ ISFUNC, rl_insert }, /* u */
{ ISFUNC, rl_insert }, /* v */
{ ISFUNC, rl_insert }, /* w */
{ ISFUNC, rl_insert }, /* x */
{ ISFUNC, rl_insert }, /* y */
{ ISFUNC, rl_insert }, /* z */
/* Final punctuation. */
{ ISFUNC, rl_insert }, /* { */
{ ISFUNC, rl_insert }, /* | */
{ ISFUNC, rl_insert }, /* } */
{ ISFUNC, rl_insert }, /* ~ */
{ ISFUNC, rl_rubout }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Pure 8-bit characters (128 - 159).
These might be used in some
character sets. */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
{ ISFUNC, rl_insert }, /* ? */
/* ISO Latin-1 characters (160 - 255) */
{ ISFUNC, rl_insert }, /* No-break space */
{ ISFUNC, rl_insert }, /* Inverted exclamation mark */
{ ISFUNC, rl_insert }, /* Cent sign */
{ ISFUNC, rl_insert }, /* Pound sign */
{ ISFUNC, rl_insert }, /* Currency sign */
{ ISFUNC, rl_insert }, /* Yen sign */
{ ISFUNC, rl_insert }, /* Broken bar */
{ ISFUNC, rl_insert }, /* Section sign */
{ ISFUNC, rl_insert }, /* Diaeresis */
{ ISFUNC, rl_insert }, /* Copyright sign */
{ ISFUNC, rl_insert }, /* Feminine ordinal indicator */
{ ISFUNC, rl_insert }, /* Left pointing double angle quotation mark */
{ ISFUNC, rl_insert }, /* Not sign */
{ ISFUNC, rl_insert }, /* Soft hyphen */
{ ISFUNC, rl_insert }, /* Registered sign */
{ ISFUNC, rl_insert }, /* Macron */
{ ISFUNC, rl_insert }, /* Degree sign */
{ ISFUNC, rl_insert }, /* Plus-minus sign */
{ ISFUNC, rl_insert }, /* Superscript two */
{ ISFUNC, rl_insert }, /* Superscript three */
{ ISFUNC, rl_insert }, /* Acute accent */
{ ISFUNC, rl_insert }, /* Micro sign */
{ ISFUNC, rl_insert }, /* Pilcrow sign */
{ ISFUNC, rl_insert }, /* Middle dot */
{ ISFUNC, rl_insert }, /* Cedilla */
{ ISFUNC, rl_insert }, /* Superscript one */
{ ISFUNC, rl_insert }, /* Masculine ordinal indicator */
{ ISFUNC, rl_insert }, /* Right pointing double angle quotation mark */
{ ISFUNC, rl_insert }, /* Vulgar fraction one quarter */
{ ISFUNC, rl_insert }, /* Vulgar fraction one half */
{ ISFUNC, rl_insert }, /* Vulgar fraction three quarters */
{ ISFUNC, rl_insert }, /* Inverted questionk mark */
{ ISFUNC, rl_insert }, /* Latin capital letter a with grave */
{ ISFUNC, rl_insert }, /* Latin capital letter a with acute */
{ ISFUNC, rl_insert }, /* Latin capital letter a with circumflex */
{ ISFUNC, rl_insert }, /* Latin capital letter a with tilde */
{ ISFUNC, rl_insert }, /* Latin capital letter a with diaeresis */
{ ISFUNC, rl_insert }, /* Latin capital letter a with ring above */
{ ISFUNC, rl_insert }, /* Latin capital letter ae */
{ ISFUNC, rl_insert }, /* Latin capital letter c with cedilla */
{ ISFUNC, rl_insert }, /* Latin capital letter e with grave */
{ ISFUNC, rl_insert }, /* Latin capital letter e with acute */
{ ISFUNC, rl_insert }, /* Latin capital letter e with circumflex */
{ ISFUNC, rl_insert }, /* Latin capital letter e with diaeresis */
{ ISFUNC, rl_insert }, /* Latin capital letter i with grave */
{ ISFUNC, rl_insert }, /* Latin capital letter i with acute */
{ ISFUNC, rl_insert }, /* Latin capital letter i with circumflex */
{ ISFUNC, rl_insert }, /* Latin capital letter i with diaeresis */
{ ISFUNC, rl_insert }, /* Latin capital letter eth (Icelandic) */
{ ISFUNC, rl_insert }, /* Latin capital letter n with tilde */
{ ISFUNC, rl_insert }, /* Latin capital letter o with grave */
{ ISFUNC, rl_insert }, /* Latin capital letter o with acute */
{ ISFUNC, rl_insert }, /* Latin capital letter o with circumflex */
{ ISFUNC, rl_insert }, /* Latin capital letter o with tilde */
{ ISFUNC, rl_insert }, /* Latin capital letter o with diaeresis */
{ ISFUNC, rl_insert }, /* Multiplication sign */
{ ISFUNC, rl_insert }, /* Latin capital letter o with stroke */
{ ISFUNC, rl_insert }, /* Latin capital letter u with grave */
{ ISFUNC, rl_insert }, /* Latin capital letter u with acute */
{ ISFUNC, rl_insert }, /* Latin capital letter u with circumflex */
{ ISFUNC, rl_insert }, /* Latin capital letter u with diaeresis */
{ 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) */
{ ISFUNC, rl_insert }, /* Latin small letter a with grave */
{ 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 */
{ ISFUNC, rl_insert }, /* Latin small letter a with diaeresis */
{ ISFUNC, rl_insert }, /* Latin small letter a with ring above */
{ ISFUNC, rl_insert }, /* Latin small letter ae */
{ ISFUNC, rl_insert }, /* Latin small letter c with cedilla */
{ ISFUNC, rl_insert }, /* Latin small letter e with grave */
{ ISFUNC, rl_insert }, /* Latin small letter e with acute */
{ ISFUNC, rl_insert }, /* Latin small letter e with circumflex */
{ ISFUNC, rl_insert }, /* Latin small letter e with diaeresis */
{ ISFUNC, rl_insert }, /* Latin small letter i with grave */
{ ISFUNC, rl_insert }, /* Latin small letter i with acute */
{ ISFUNC, rl_insert }, /* Latin small letter i with circumflex */
{ ISFUNC, rl_insert }, /* Latin small letter i with diaeresis */
{ ISFUNC, rl_insert }, /* Latin small letter eth (Icelandic) */
{ ISFUNC, rl_insert }, /* Latin small letter n with tilde */
{ ISFUNC, rl_insert }, /* Latin small letter o with grave */
{ ISFUNC, rl_insert }, /* Latin small letter o with acute */
{ ISFUNC, rl_insert }, /* Latin small letter o with circumflex */
{ ISFUNC, rl_insert }, /* Latin small letter o with tilde */
{ ISFUNC, rl_insert }, /* Latin small letter o with diaeresis */
{ ISFUNC, rl_insert }, /* Division sign */
{ ISFUNC, rl_insert }, /* Latin small letter o with stroke */
{ ISFUNC, rl_insert }, /* Latin small letter u with grave */
{ ISFUNC, rl_insert }, /* Latin small letter u with acute */
{ ISFUNC, rl_insert }, /* Latin small letter u with circumflex */
{ ISFUNC, rl_insert }, /* Latin small letter u with diaeresis */
{ ISFUNC, rl_insert }, /* Latin small letter y with acute */
{ ISFUNC, rl_insert }, /* Latin small letter thorn (Icelandic) */
{ ISFUNC, rl_insert } /* Latin small letter y with diaeresis */
#endif /* KEYMAP_SIZE > 128 */
};
/* Unused for the time being. */
#if 0
KEYMAP_ENTRY_ARRAY vi_escape_keymap = {
/* The regular control keys come first. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-d */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-e */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-g */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-h */
{ ISFUNC, rl_tab_insert}, /* Control-i */
{ ISFUNC, rl_emacs_editing_mode}, /* Control-j */
{ ISFUNC, rl_kill_line }, /* Control-k */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-l */
{ ISFUNC, rl_emacs_editing_mode}, /* Control-m */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-n */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-p */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-q */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-r */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-s */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-t */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-u */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-v */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-w */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-y */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
{ ISFUNC, rl_vi_movement_mode }, /* Control-[ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */
{ ISFUNC, rl_vi_undo }, /* Control-_ */
/* The start of printing characters. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* SPACE */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ! */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* " */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* # */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* $ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* % */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* & */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ' */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ( */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ) */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* * */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* + */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* , */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* - */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* . */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* / */
/* Regular digits. */
{ ISFUNC, rl_vi_arg_digit }, /* 0 */
{ ISFUNC, rl_vi_arg_digit }, /* 1 */
{ ISFUNC, rl_vi_arg_digit }, /* 2 */
{ ISFUNC, rl_vi_arg_digit }, /* 3 */
{ ISFUNC, rl_vi_arg_digit }, /* 4 */
{ ISFUNC, rl_vi_arg_digit }, /* 5 */
{ ISFUNC, rl_vi_arg_digit }, /* 6 */
{ ISFUNC, rl_vi_arg_digit }, /* 7 */
{ ISFUNC, rl_vi_arg_digit }, /* 8 */
{ ISFUNC, rl_vi_arg_digit }, /* 9 */
/* A little more punctuation. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* : */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ; */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* < */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* = */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* > */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ? */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* @ */
/* Uppercase alphabet. */
{ ISFUNC, rl_do_lowercase_version }, /* A */
{ ISFUNC, rl_do_lowercase_version }, /* B */
{ ISFUNC, rl_do_lowercase_version }, /* C */
{ ISFUNC, rl_do_lowercase_version }, /* D */
{ ISFUNC, rl_do_lowercase_version }, /* E */
{ ISFUNC, rl_do_lowercase_version }, /* F */
{ ISFUNC, rl_do_lowercase_version }, /* G */
{ ISFUNC, rl_do_lowercase_version }, /* H */
{ ISFUNC, rl_do_lowercase_version }, /* I */
{ ISFUNC, rl_do_lowercase_version }, /* J */
{ ISFUNC, rl_do_lowercase_version }, /* K */
{ ISFUNC, rl_do_lowercase_version }, /* L */
{ ISFUNC, rl_do_lowercase_version }, /* M */
{ ISFUNC, rl_do_lowercase_version }, /* N */
{ ISFUNC, rl_do_lowercase_version }, /* O */
{ ISFUNC, rl_do_lowercase_version }, /* P */
{ ISFUNC, rl_do_lowercase_version }, /* Q */
{ ISFUNC, rl_do_lowercase_version }, /* R */
{ ISFUNC, rl_do_lowercase_version }, /* S */
{ ISFUNC, rl_do_lowercase_version }, /* T */
{ ISFUNC, rl_do_lowercase_version }, /* U */
{ ISFUNC, rl_do_lowercase_version }, /* V */
{ ISFUNC, rl_do_lowercase_version }, /* W */
{ ISFUNC, rl_do_lowercase_version }, /* X */
{ ISFUNC, rl_do_lowercase_version }, /* Y */
{ ISFUNC, rl_do_lowercase_version }, /* Z */
/* Some more punctuation. */
{ ISFUNC, rl_arrow_keys }, /* [ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* \ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ] */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ^ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* _ */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ` */
/* Lowercase alphabet. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* a */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* b */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* c */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* d */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* e */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* f */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* g */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* h */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* i */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* j */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* k */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* l */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* m */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* n */
{ ISFUNC, rl_arrow_keys }, /* o */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* p */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* q */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* r */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* s */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* t */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* u */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* v */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* w */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* x */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* y */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* z */
/* Final punctuation. */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* { */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* | */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* } */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* ~ */
{ ISFUNC, rl_backward_kill_word }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Undefined keys. */
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 },
{ ISFUNC, (rl_command_func_t *)0x0 }
#endif /* KEYMAP_SIZE > 128 */
};
#endif
readline-8.3/keymaps.h 000644 000436 000024 00000006201 14002565352 015053 0 ustar 00chet staff 000000 000000 /* keymaps.h -- Manipulation of readline keymaps. */
/* Copyright (C) 1987, 1989, 1992-2021 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 .
*/
#ifndef _KEYMAPS_H_
#define _KEYMAPS_H_
#ifdef __cplusplus
extern "C" {
#endif
#if defined (READLINE_LIBRARY)
# include "rlstdc.h"
# include "chardefs.h"
# include "rltypedefs.h"
#else
# include
# include
# include
#endif
/* A keymap contains one entry for each key in the ASCII set.
Each entry consists of a type and a pointer.
FUNCTION is the address of a function to run, or the
address of a keymap to indirect through.
TYPE says which kind of thing FUNCTION is. */
typedef struct _keymap_entry {
char type;
rl_command_func_t *function;
} KEYMAP_ENTRY;
/* This must be large enough to hold bindings for all of the characters
in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
and so on) plus one for subsequence matching. */
#define KEYMAP_SIZE 257
#define ANYOTHERKEY KEYMAP_SIZE-1
typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
typedef KEYMAP_ENTRY *Keymap;
/* The values that TYPE can have in a keymap entry. */
#define ISFUNC 0
#define ISKMAP 1
#define ISMACR 2
extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
/* Return a new, empty keymap.
Free it with free() when you are done. */
extern Keymap rl_make_bare_keymap (void);
/* Return a new keymap which is a copy of MAP. */
extern Keymap rl_copy_keymap (Keymap);
/* Return a new keymap with the printing characters bound to rl_insert,
the lowercase Meta characters bound to run their equivalents, and
the Meta digits bound to produce numeric arguments. */
extern Keymap rl_make_keymap (void);
/* Free the storage associated with a keymap. */
extern void rl_discard_keymap (Keymap);
/* These functions actually appear in bind.c */
/* Return the keymap corresponding to a given name. Names look like
`emacs' or `emacs-meta' or `vi-insert'. */
extern Keymap rl_get_keymap_by_name (const char *);
/* Return the current keymap. */
extern Keymap rl_get_keymap (void);
/* Set the current keymap to MAP. */
extern void rl_set_keymap (Keymap);
/* Set the name of MAP to NAME */
extern int rl_set_keymap_name (const char *, Keymap);
#ifdef __cplusplus
}
#endif
#endif /* _KEYMAPS_H_ */
readline-8.3/histfile.c 000644 000436 000024 00000060607 15005146470 015216 0 ustar 00chet staff 000000 000000 /* histfile.c - functions to manipulate the history file. */
/* Copyright (C) 1989-2019,2023-2025 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
History is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
History is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with History. If not, see .
*/
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
you can call. I think I have done that. */
#define READLINE_LIBRARY
#if defined (__TANDEM)
# define _XOPEN_SOURCE_EXTENDED 1
# include
# include
#endif
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#if defined (HAVE_LIMITS_H)
# include
#endif
#include
#if ! defined (_MINIX) && defined (HAVE_SYS_FILE_H)
# include
#endif
#include "posixstat.h"
#include
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_UNISTD_H)
# include
#endif
#include
#if defined (__EMX__)
# undef HAVE_MMAP
#endif
#ifdef HISTORY_USE_MMAP
# include
# ifdef MAP_FILE
# define MAP_RFLAGS (MAP_FILE|MAP_PRIVATE)
# define MAP_WFLAGS (MAP_FILE|MAP_SHARED)
# else
# define MAP_RFLAGS MAP_PRIVATE
# define MAP_WFLAGS MAP_SHARED
# endif
# ifndef MAP_FAILED
# define MAP_FAILED ((void *)-1)
# endif
#endif /* HISTORY_USE_MMAP */
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# include
#endif
/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
on win 95/98/nt), we want to open files with O_BINARY mode so that there
is no \n -> \r\n conversion performed. On other systems, we don't want to
mess around with O_BINARY at all, so we ensure that it's defined to 0. */
#if defined (__EMX__) || defined (__CYGWIN__)
# ifndef O_BINARY
# define O_BINARY 0
# endif
#else /* !__EMX__ && !__CYGWIN__ */
# undef O_BINARY
# define O_BINARY 0
#endif /* !__EMX__ && !__CYGWIN__ */
#include
#if !defined (errno)
extern int errno;
#endif /* !errno */
#include "history.h"
#include "histlib.h"
#include "rlshell.h"
#include "xmalloc.h"
#if !defined (PATH_MAX)
# define PATH_MAX 1024 /* default */
#endif
/* history file version; currently unused */
int history_file_version = 1;
/* If non-zero, we write timestamps to the history file in history_do_write() */
int history_write_timestamps = 0;
/* If non-zero, we assume that a history file that starts with a timestamp
uses timestamp-delimited entries and can include multi-line history
entries. Used by read_history_range */
int history_multiline_entries = 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 (const char *);
static char *history_tempfile (const char *);
static int histfile_backup (const char *, const char *);
static int histfile_restore (const char *, const char *);
static int history_rename (const char *, const char *);
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the
filename to read_history (), or write_history (). */
static char *
history_filename (const char *filename)
{
char *return_val;
const char *home;
size_t home_len;
return_val = filename ? savestring (filename) : (char *)NULL;
if (return_val)
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);
home_len = strlen (home);
return_val = (char *)xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
strcpy (return_val, home);
return_val[home_len] = '/';
#if defined (__MSDOS__)
strcpy (return_val + home_len + 1, "_history");
#else
strcpy (return_val + home_len + 1, ".history");
#endif
return (return_val);
}
#if defined (DEBUG)
static char *
history_backupfile (const char *filename)
{
const char *fn;
char *ret, linkbuf[PATH_MAX+1];
size_t len;
ssize_t n;
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;
}
#endif
static char *
history_tempfile (const char *filename)
{
const char *fn;
char *ret, linkbuf[PATH_MAX+1];
size_t len;
ssize_t n;
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. */
int
read_history (const char *filename)
{
return (read_history_range (filename, 0, -1));
}
/* Read a range of lines from FILENAME, adding them to the history list.
Start reading at the FROM'th line and end at the TO'th. If FROM
is zero, start at the beginning. If TO is less than FROM, read
until the end of the file. If FILENAME is NULL, then read from
~/.history. Returns 0 if successful, or errno if not. */
int
read_history_range (const char *filename, int from, int to)
{
register char *line_start, *line_end, *p;
char *input, *buffer, *bufend, *last_ts;
int file, current_line, chars_read, has_timestamps, reset_comment_char;
int skipblanks, default_skipblanks;
struct stat finfo;
size_t file_size;
#if defined (EFBIG)
int overflow_errno = EFBIG;
#elif defined (EOVERFLOW)
int overflow_errno = EOVERFLOW;
#else
int overflow_errno = EIO;
#endif
history_lines_read_from_file = 0;
buffer = last_ts = (char *)NULL;
input = history_filename (filename);
if (input == 0)
return 0;
errno = 0;
file = open (input, O_RDONLY|O_BINARY, 0666);
if ((file < 0) || (fstat (file, &finfo) == -1))
goto error_and_exit;
if (S_ISREG (finfo.st_mode) == 0)
{
#ifdef EFTYPE
errno = EFTYPE;
#else
errno = EINVAL;
#endif
goto error_and_exit;
}
else
{
/* regular file */
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size)
{
errno = overflow_errno;
goto error_and_exit;
}
if (file_size == 0)
{
xfree (input);
close (file);
return 0; /* don't waste time if we don't have to */
}
}
#ifdef HISTORY_USE_MMAP
/* We map read/write and private so we can change newlines to NULs without
affecting the underlying object. */
buffer = (char *)mmap (0, file_size, PROT_READ|PROT_WRITE, MAP_RFLAGS, file, 0);
if ((void *)buffer == MAP_FAILED)
{
errno = overflow_errno;
goto error_and_exit;
}
chars_read = file_size;
#else
buffer = (char *)malloc (file_size + 1);
if (buffer == 0)
{
errno = overflow_errno;
goto error_and_exit;
}
chars_read = read (file, buffer, file_size);
#endif
if (chars_read < 0)
{
error_and_exit:
if (errno != 0)
chars_read = errno;
else
chars_read = EIO;
if (file >= 0)
close (file);
FREE (input);
#ifndef HISTORY_USE_MMAP
FREE (buffer);
#endif
return (chars_read);
}
close (file);
/* Set TO to larger than end of file if negative. */
if (to < 0)
to = chars_read;
/* Start at beginning of file, work to end. */
bufend = buffer + chars_read;
*bufend = '\0'; /* null-terminate buffer for timestamp checks */
current_line = 0;
/* Heuristic: the history comment character rarely changes, so assume we
have timestamps if the buffer starts with `#[:digit:]' and temporarily
set history_comment_char so timestamp parsing works right */
reset_comment_char = 0;
if (history_comment_char == '\0' && buffer[0] == '#' && isdigit ((unsigned char)buffer[1]))
{
history_comment_char = '#';
reset_comment_char = 1;
}
has_timestamps = HIST_TIMESTAMP_START (buffer);
history_multiline_entries += has_timestamps && history_write_timestamps;
/* default is to skip blank lines unless history entries are multiline */
default_skipblanks = history_multiline_entries == 0;
/* Skip lines until we are at FROM. */
if (has_timestamps)
last_ts = buffer;
for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
if (*line_end == '\n')
{
p = line_end + 1;
/* If we see something we think is a timestamp, continue with this
line. We should check more extensively here... */
if (HIST_TIMESTAMP_START(p) == 0)
current_line++;
else
last_ts = p;
line_start = p;
/* If we are at the last line (current_line == from) but we have
timestamps (has_timestamps), then line_start points to the
text of the last command, and we need to skip to its end. */
if (current_line >= from && has_timestamps)
{
for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
;
line_start = (*line_end == '\n') ? line_end + 1 : line_end;
}
}
skipblanks = default_skipblanks;
/* If there are lines left to gobble, then gobble them now. */
for (line_end = line_start; line_end < bufend; line_end++)
if (*line_end == '\n')
{
/* Change to allow Windows-like \r\n end of line delimiter. */
if (line_end > line_start && line_end[-1] == '\r')
line_end[-1] = '\0';
else
*line_end = '\0';
if (*line_start || skipblanks == 0)
{
if (HIST_TIMESTAMP_START(line_start) == 0)
{
/* If we have multiline entries (default_skipblanks == 0), we
don't want to skip blanks here, since we turned that on at
the last timestamp line. Consider doing this even if
default_skipblanks == 1 in order not to lose blank lines in
commands. */
skipblanks = default_skipblanks;
if (last_ts == NULL && history_length > 0 && history_multiline_entries)
_hs_append_history_line (history_length - 1, line_start);
else
add_history (line_start);
if (last_ts)
{
add_history_time (last_ts);
last_ts = NULL;
}
}
else
{
last_ts = line_start;
current_line--;
/* Even if we're not skipping blank lines by default, we want
to skip leading blank lines after a timestamp. */
skipblanks = 1;
}
}
current_line++;
if (current_line >= to)
break;
line_start = line_end + 1;
}
history_lines_read_from_file = current_line;
if (reset_comment_char)
history_comment_char = '\0';
FREE (input);
#ifndef HISTORY_USE_MMAP
FREE (buffer);
#else
munmap (buffer, file_size);
#endif
return (0);
}
/* We need a special version for WIN32 because Windows rename() refuses to
overwrite an existing file. */
static int
history_rename (const char *old, const char *new)
{
#if defined (_WIN32)
return (MoveFileEx (old, new, MOVEFILE_REPLACE_EXISTING) == 0 ? -1 : 0);
#else
return (rename (old, new));
#endif
}
#if defined (DEBUG)
/* Save FILENAME to BACK, handling case where FILENAME is a symlink
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
static int
histfile_backup (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 (history_rename (linkbuf, back));
}
#endif
return (history_rename (filename, back));
}
#endif
/* Restore ORIG from BACKUP handling case where ORIG is a symlink
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
static int
histfile_restore (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 (history_rename (backup, linkbuf));
}
#endif
return (history_rename (backup, orig));
}
/* Should we call chown, based on whether finfo and nfinfo describe different
files with different owners? */
#define SHOULD_CHOWN(finfo, nfinfo) \
(finfo.st_uid != nfinfo.st_uid || finfo.st_gid != nfinfo.st_gid)
/* 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. */
int
history_truncate_file (const char *fname, int lines)
{
char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */
int file, chars_read, rv, orig_lines, exists, r;
struct stat finfo, nfinfo;
size_t file_size;
history_lines_written_to_file = 0;
buffer = (char *)NULL;
filename = history_filename (fname);
if (filename == 0)
return 0;
tempname = 0;
file = open (filename, O_RDONLY|O_BINARY, 0666);
rv = exists = 0;
orig_lines = lines;
/* Don't try to truncate non-regular files. */
if (file == -1 || fstat (file, &finfo) == -1)
{
rv = errno;
if (file != -1)
close (file);
goto truncate_exit;
}
exists = 1;
nfinfo.st_uid = finfo.st_uid;
nfinfo.st_gid = finfo.st_gid;
if (S_ISREG (finfo.st_mode) == 0)
{
close (file);
#ifdef EFTYPE
rv = EFTYPE;
#else
rv = EINVAL;
#endif
goto truncate_exit;
}
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size)
{
close (file);
#if defined (EFBIG)
rv = errno = EFBIG;
#elif defined (EOVERFLOW)
rv = errno = EOVERFLOW;
#else
rv = errno = EINVAL;
#endif
goto truncate_exit;
}
buffer = (char *)malloc (file_size + 1);
if (buffer == 0)
{
rv = errno;
close (file);
goto truncate_exit;
}
/* Don't bother with any of this if we're truncating to zero length. */
if (lines == 0)
{
close (file);
buffer[chars_read = 0] = '\0';
bp = buffer;
goto truncate_write;
}
chars_read = read (file, buffer, file_size);
close (file);
if (chars_read <= 0)
{
rv = (chars_read < 0) ? errno : 0;
goto truncate_exit;
}
buffer[chars_read] = '\0'; /* for the initial check of bp1[1] */
/* 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
both a newline and the history comment character, it should be OK.
If we are writing history timestamps, we need to add one to LINES
because we decrement it one extra time the first time through the loop
and we need the final timestamp line. */
lines += history_write_timestamps;
for (bp1 = bp = buffer + chars_read - 1; lines > 0 && bp > buffer; bp--)
{
if (*bp == '\n' && HIST_TIMESTAMP_START(bp1) == 0)
lines--;
bp1 = bp;
}
/* This is the right line, so move to its start. If we're writing history
timestamps, we want to go back until *bp == '\n' and bp1 starts a
history timestamp. If we're not, just move back to *bp == '\n'.
If this is the first line, then the file contains exactly the
number of lines we want to truncate to, so we don't need to do
anything, and we'll end up with bp == buffer.
Otherwise, write from the start of this line until the end of the
buffer. */
for ( ; bp > buffer; bp--)
{
if (*bp == '\n' && (history_write_timestamps == 0 || HIST_TIMESTAMP_START(bp1)))
{
bp++;
break;
}
bp1 = bp;
}
/* Write only if there are more lines in the file than we want to
truncate to. */
if (bp <= buffer)
{
rv = 0;
/* No-op if LINES == 0 at this point */
history_lines_written_to_file = orig_lines - lines;
goto truncate_exit;
}
truncate_write:
tempname = history_tempfile (filename);
rv = 0;
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;
close (file);
}
if (rv == 0 && fstat (file, &nfinfo) < 0)
{
rv = errno;
close (file);
}
if (rv == 0 && close (file) < 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)
{
rv = errno;
if (tempname)
unlink (tempname);
history_lines_written_to_file = 0;
}
#if defined (HAVE_CHOWN)
/* 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 && SHOULD_CHOWN (finfo, nfinfo))
r = chown (filename, finfo.st_uid, finfo.st_gid);
#endif
xfree (filename);
FREE (tempname);
return rv;
}
/* Use stdio to write the history file after mmap or malloc fails, on the
assumption that the stdio library can allocate the smaller buffers it uses. */
static int
history_write_slow (int fd, HIST_ENTRY **the_history, int nelements, int overwrite)
{
FILE *fp;
int i, e;
fp = fdopen (fd, overwrite ? "w" : "a");
if (fp == 0)
return -1;
for (i = history_length - nelements; i < history_length; i++)
{
if (history_write_timestamps && the_history[i]->timestamp && the_history[i]->timestamp[0])
fprintf (fp, "%s\n", the_history[i]->timestamp);
if (fprintf (fp, "%s\n", the_history[i]->line) < 0)
goto slow_write_error;
}
if (fflush (fp) < 0)
{
slow_write_error:
e = errno;
fclose (fp);
errno = e;
return -1;
}
if (fclose (fp) < 0)
return -1;
return 0;
}
/* Workhorse function for writing history. Writes the last NELEMENT entries
from the history list to FILENAME. OVERWRITE is non-zero if you
wish to replace FILENAME with the entries. */
static int
history_do_write (const char *filename, int nelements, int overwrite)
{
register int i;
char *output, *tempname, *histname;
int file, mode, rv, exists;
struct stat finfo;
#ifdef HISTORY_USE_MMAP
size_t cursize, newsize;
off_t offset;
history_lines_written_to_file = 0;
if (nelements < 0)
return (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);
exists = histname ? (stat (histname, &finfo) == 0) : 0;
tempname = (overwrite && exists && S_ISREG (finfo.st_mode)) ? history_tempfile (histname) : 0;
output = tempname ? tempname : histname;
file = output ? open (output, mode, 0600) : -1;
rv = 0;
if (file == -1)
{
rv = errno;
FREE (histname);
FREE (tempname);
return (rv);
}
#ifdef HISTORY_USE_MMAP
cursize = overwrite ? 0 : lseek (file, 0, SEEK_END);
#endif
if (nelements > history_length)
nelements = history_length;
/* Build a buffer of all the lines to write, and write them in one syscall.
Suggested by Peter Ho (peter@robosts.oxford.ac.uk). */
{
HIST_ENTRY **the_history; /* local */
size_t j;
size_t buffer_size;
char *buffer;
the_history = history_list ();
/* Calculate the total number of bytes to write. */
for (buffer_size = 0, i = history_length - nelements; i < history_length; i++)
{
if (history_write_timestamps && the_history[i]->timestamp && the_history[i]->timestamp[0])
buffer_size += strlen (the_history[i]->timestamp) + 1;
buffer_size += strlen (the_history[i]->line) + 1;
}
/* Allocate the buffer, and fill it. */
#ifdef HISTORY_USE_MMAP
if (ftruncate (file, buffer_size+cursize) == -1)
goto mmap_error;
/* for portability, ensure that we round cursize to a multiple of the
page size. */
offset = cursize & ~(getpagesize () - 1);
newsize = buffer_size + cursize - offset;
buffer = (char *)mmap (0, newsize, PROT_READ|PROT_WRITE, MAP_WFLAGS, file, offset);
if ((void *)buffer == MAP_FAILED)
{
mmap_error:
if ((rv = history_write_slow (file, the_history, nelements, overwrite)) == 0)
goto write_success;
rv = errno;
close (file);
if (tempname)
unlink (tempname);
FREE (histname);
FREE (tempname);
return rv;
}
j = cursize - offset;
#else
buffer = (char *)malloc (buffer_size);
if (buffer == 0)
{
if ((rv = history_write_slow (file, the_history, nelements, overwrite)) == 0)
goto write_success;
rv = errno;
close (file);
if (tempname)
unlink (tempname);
FREE (histname);
FREE (tempname);
return rv;
}
j = 0;
#endif
for (i = history_length - nelements; i < history_length; i++)
{
if (history_write_timestamps && the_history[i]->timestamp && the_history[i]->timestamp[0])
{
strcpy (buffer + j, the_history[i]->timestamp);
j += strlen (the_history[i]->timestamp);
buffer[j++] = '\n';
}
strcpy (buffer + j, the_history[i]->line);
j += strlen (the_history[i]->line);
buffer[j++] = '\n';
}
#ifdef HISTORY_USE_MMAP
/* make sure we unmap the pages even if the sync fails */
if (msync (buffer, newsize, MS_ASYNC) != 0)
rv = errno;
if (munmap (buffer, newsize) != 0 && rv == 0)
rv = errno;
#else
if (write (file, buffer, buffer_size) < 0)
rv = errno;
xfree (buffer);
#endif
}
history_lines_written_to_file = nelements;
if (close (file) < 0 && rv == 0)
rv = errno;
write_success:
if (rv == 0 && histname && tempname)
rv = histfile_restore (tempname, histname);
if (rv != 0)
{
rv = errno;
if (tempname)
unlink (tempname);
history_lines_written_to_file = 0;
}
#if defined (HAVE_CHOWN)
/* 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)
mode = chown (histname, finfo.st_uid, finfo.st_gid);
#endif
FREE (histname);
FREE (tempname);
return (rv);
}
/* Append NELEMENT entries to FILENAME. The entries appended are from
the end of the list minus NELEMENTs up to the end of the list. */
int
append_history (int nelements, const char *filename)
{
return (history_do_write (filename, nelements, HISTORY_APPEND));
}
/* Overwrite FILENAME with the current history. If FILENAME is NULL,
then write the history list to ~/.history. Values returned
are as in read_history ().*/
int
write_history (const char *filename)
{
return (history_do_write (filename, history_length, HISTORY_OVERWRITE));
}
readline-8.3/posixtime.h 000644 000436 000024 00000005344 15027051241 015425 0 ustar 00chet staff 000000 000000 /* posixtime.h -- wrapper for time.h, sys/times.h mess. */
/* Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see .
*/
#ifndef _POSIXTIME_H_
#define _POSIXTIME_H_
/* include this after config.h */
/* Some systems require this, mostly for the definition of `struct timezone'.
For example, Dynix/ptx has that definition in rather than
sys/time.h */
#if defined (HAVE_SYS_TIME_H)
# include
#endif
#include
#if !defined (HAVE_SYSCONF) || !defined (_SC_CLK_TCK)
# if !defined (CLK_TCK)
# if defined (HZ)
# define CLK_TCK HZ
# else
# define CLK_TCK 60 /* 60HZ */
# endif
# endif /* !CLK_TCK */
#endif /* !HAVE_SYSCONF && !_SC_CLK_TCK */
#if !HAVE_TIMEVAL
struct timeval
{
time_t tv_sec;
long int tv_usec;
};
#endif
#if !HAVE_GETTIMEOFDAY
extern int gettimeofday (struct timeval * restrict, void * restrict);
#endif
/* consistently use gettimeofday for time information */
static inline time_t
getnow(void)
{
struct timeval now;
gettimeofday (&now, 0);
return now.tv_sec;
}
/* These exist on BSD systems, at least. */
#if !defined (timerclear)
# define timerclear(tvp) do { (tvp)->tv_sec = 0; (tvp)->tv_usec = 0; } while (0)
#endif
#if !defined (timerisset)
# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#endif
#if !defined (timercmp)
# define timercmp(a, b, CMP) \
(((a)->tv_sec == (b)->tv_sec) ? ((a)->tv_usec CMP (b)->tv_usec) \
: ((a)->tv_sec CMP (b)->tv_sec))
#endif
/* These are non-standard. */
#if !defined (timerisunset)
# define timerisunset(tvp) ((tvp)->tv_sec == 0 && (tvp)->tv_usec == 0)
#endif
#if !defined (timerset)
# define timerset(tvp, s, u) do { tvp->tv_sec = s; tvp->tv_usec = u; } while (0)
#endif
#ifndef TIMEVAL_TO_TIMESPEC
# define TIMEVAL_TO_TIMESPEC(tv, ts) \
do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
} while (0)
#endif
#ifndef TIMESPEC_TO_TIMEVAL
# define TIMESPEC_TO_TIMEVAL(tv, ts) \
do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (tv)->tv_nsec / 1000; \
} while (0)
#endif
#endif /* _POSIXTIME_H_ */
readline-8.3/support/ 000755 000436 000024 00000000000 15030514137 014743 5 ustar 00chet staff 000000 000000 readline-8.3/config.h.in 000644 000436 000024 00000020335 14773761620 015273 0 ustar 00chet staff 000000 000000 /* config.h.in for the GNU readline library. */
/* Copyright (C) 1994-2024 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 .
*/
/* config.h.in. Maintained by hand. */
/* Template definitions for autoconf */
/* These are set by AC_USE_SYSTEM_EXTENSIONS */
#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
/* Characteristics of the compiler. */
#undef inline
#undef sig_atomic_t
#undef size_t
#undef ssize_t
#undef mode_t
#undef const
#undef volatile
#undef PROTOTYPES
#undef __PROTOTYPES
#undef __CHAR_UNSIGNED__
/* Define if the `S_IS*' macros in 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
/* Define if you have the fnmatch function. */
#undef HAVE_FNMATCH
/* Define if you have the getpwent function. */
#undef HAVE_GETPWENT
/* Define if you have the getpwnam function. */
#undef HAVE_GETPWNAM
/* Define if you have the getpwuid function. */
#undef HAVE_GETPWUID
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the isascii function. */
#undef HAVE_ISASCII
/* Define if you have the iswctype function. */
#undef HAVE_ISWCTYPE
/* Define if you have the iswlower function. */
#undef HAVE_ISWLOWER
/* Define if you have the iswupper function. */
#undef HAVE_ISWUPPER
/* Define if you have the isxdigit function. */
#undef HAVE_ISXDIGIT
/* Define if you have the kill function. */
#undef HAVE_KILL
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
/* Define if you have the mbrlen function. */
#undef HAVE_MBRLEN
/* Define if you have the mbrtowc function. */
#undef HAVE_MBRTOWC
/* Define if you have the mbscasecmp function. */
#undef HAVE_MBSCASECMP
/* Define if you have the mbscmp function. */
#undef HAVE_MBSCMP
/* Define if you have the mbsncmp function. */
#undef HAVE_MBSNCMP
/* Define if you have the mbsrtowcs function. */
#undef HAVE_MBSRTOWCS
/* 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
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setitimer function. */
#undef HAVE_SETITIMER
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strcoll function. */
#undef HAVE_STRCOLL
#undef STRCOLL_BROKEN
/* Define if you have the strpbrk function. */
#undef HAVE_STRPBRK
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the tcgetwinsize function. */
#undef HAVE_TCGETWINSIZE
/* Define if you have the tcsetwinsize function. */
#undef HAVE_TCSETWINSIZE
/* Define if you have the towlower function. */
#undef HAVE_TOWLOWER
/* Define if you have the towupper function. */
#undef HAVE_TOWUPPER
/* Define if you have the vsnprintf function. */
#undef HAVE_VSNPRINTF
/* Define if you have the wcrtomb function. */
#undef HAVE_WCRTOMB
/* Define if you have the wcscoll function. */
#undef HAVE_WCSCOLL
#undef HAVE_WCSLEN
#undef HAVE_WCSNLEN
/* Define if you have the wcsnrtombs function. */
#undef HAVE_WCSNRTOMBS
/* Define if you have the wctype function. */
#undef HAVE_WCTYPE
/* Define if you have the wcwidth function. */
#undef HAVE_WCWIDTH
/* and whether it works */
#undef WCWIDTH_BROKEN
/* Define if you have the header file. */
#undef HAVE_DIRENT_H
/* Define if you have the header file. */
#undef HAVE_FCNTL_H
/* Define if you have the header file. */
#undef HAVE_LANGINFO_H
/* Define if you have the header file. */
#undef HAVE_LIBAUDIT_H
/* Define if you have the header file. */
#undef HAVE_LIMITS_H
/* Define if you have the header file. */
#undef HAVE_LOCALE_H
/* Define if you have the header file. */
#undef HAVE_MEMORY_H
/* Define if you have the header file. */
#undef HAVE_NDIR_H
/* Define if you have the header file. */
#undef HAVE_NCURSES_TERMCAP_H
/* Define if you have the header file. */
#undef HAVE_PWD_H
/* Define if you have the header file. */
#undef HAVE_STDARG_H
/* Define if you have the header file. */
#undef HAVE_STDBOOL_H
/* Define if you have the header file. */
#undef HAVE_STDLIB_H
/* Define if you have the header file. */
#undef HAVE_STRING_H
/* Define if you have the header file. */
#undef HAVE_STRINGS_H
/* Define if you have the header file. */
#undef HAVE_SYS_DIR_H
/* Define if you have the header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the header file. */
#undef HAVE_SYS_NDIR_H
/* Define if you have the header file. */
#undef HAVE_SYS_PTE_H
/* Define if you have the header file. */
#undef HAVE_SYS_PTEM_H
/* Define if you have the header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the header file. */
#undef HAVE_SYS_STREAM_H
/* Define if you have the header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the header file. */
#undef HAVE_TERMCAP_H
/* Define if you have the header file. */
#undef HAVE_TERMIO_H
/* Define if you have the header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the header file. */
#undef HAVE_UNISTD_H
/* Define if you have the header file. */
#undef HAVE_VARARGS_H
/* Define if you have the header file. */
#undef HAVE_WCHAR_H
/* Define if you have the header file. */
#undef HAVE_WCTYPE_H
#undef HAVE_MBSTATE_T
/* Define if you have wchar_t in . */
#undef HAVE_WCHAR_T
/* Define if you have wctype_t in . */
#undef HAVE_WCTYPE_T
/* Define if you have wint_t in . */
#undef HAVE_WINT_T
/* Define if you have and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
/* Define if you have and it defines AUDIT_USER_TTY */
#undef HAVE_DECL_AUDIT_USER_TTY
/* Definitions pulled in from aclocal.m4. */
#undef GWINSZ_IN_SYS_IOCTL
#undef STRUCT_WINSIZE_IN_SYS_IOCTL
#undef STRUCT_WINSIZE_IN_TERMIOS
#undef TIOCSTAT_IN_SYS_IOCTL
#undef FIONREAD_IN_SYS_IOCTL
#undef SPEED_T_IN_SYS_TYPES
#undef HAVE_GETPW_DECLS
#undef HAVE_STRUCT_DIRENT_D_INO
#undef HAVE_STRUCT_DIRENT_D_FILENO
#undef HAVE_STRUCT_DIRENT_D_NAMLEN
#undef HAVE_TIMEVAL
#undef HAVE_BSD_SIGNALS
#undef HAVE_POSIX_SIGNALS
#undef HAVE_USG_SIGHOLD
#undef MUST_REINSTALL_SIGHANDLERS
#undef HAVE_POSIX_SIGSETJMP
#undef CTYPE_NON_ASCII
/* modify settings or make new ones based on what autoconf tells us. */
/* Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3 */
#if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix)
# define TERMIOS_MISSING
#endif
/* VARARGS defines moved to rlstdc.h */
readline-8.3/util.c 000644 000436 000024 00000027717 15020315172 014363 0 ustar 00chet staff 000000 000000 /* util.c -- readline utility functions */
/* Copyright (C) 1987-2025 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#include
#include "posixjmp.h"
#if defined (HAVE_UNISTD_H)
# include /* for _POSIX_VERSION */
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include
#include
/* System-specific feature definitions and include files. */
#include "rlmbutil.h"
#include "rldefs.h"
#if defined (TIOCSTAT_IN_SYS_IOCTL)
# include
#endif /* TIOCSTAT_IN_SYS_IOCTL */
/* Some standard library routines. */
#include "readline.h"
#include "rlprivate.h"
#include "xmalloc.h"
#include "rlshell.h"
/* **************************************************************** */
/* */
/* Utility Functions */
/* */
/* **************************************************************** */
/* Return 0 if C is not a member of the class of characters that belong
in words, or 1 if it is. */
int _rl_allow_pathname_alphabetic_chars = 0;
static const char * const pathname_alphabetic_chars = "/-_=~.#$";
int
rl_alphabetic (int c)
{
if (_rl_alphabetic_p (c))
return (1);
return (_rl_allow_pathname_alphabetic_chars &&
strchr (pathname_alphabetic_chars, c) != NULL);
}
#if defined (HANDLE_MULTIBYTE)
int
_rl_walphabetic (WCHAR_T wc)
{
int c;
if (iswalnum (wc))
return (1);
c = wc & 0177;
return (_rl_allow_pathname_alphabetic_chars &&
strchr (pathname_alphabetic_chars, c) != NULL);
}
#endif
/* How to abort things. */
int
_rl_abort_internal (void)
{
if (RL_ISSTATE (RL_STATE_TIMEOUT) == 0)
rl_ding (); /* Don't ring the bell on a timeout */
rl_clear_message ();
_rl_reset_argument ();
rl_clear_pending_input ();
rl_deactivate_mark ();
while (rl_executing_macro)
_rl_pop_executing_macro ();
_rl_kill_kbd_macro ();
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
rl_last_func = (rl_command_func_t *)NULL;
_rl_command_to_execute = 0;
_rl_longjmp (_rl_top_level, 1);
return (0);
}
int
rl_abort (int count, int key)
{
return (_rl_abort_internal ());
}
int
_rl_null_function (int count, int key)
{
return 0;
}
int
rl_tty_status (int count, int key)
{
#if defined (TIOCSTAT)
ioctl (1, TIOCSTAT, (char *)0);
rl_refresh_line (count, key);
#else
rl_ding ();
#endif
return 0;
}
/* Return a copy of the string between FROM and TO.
FROM is inclusive, TO is not. */
char *
rl_copy_text (int from, int to)
{
register int length;
char *copy;
/* Fix it if the caller is confused. */
if (from > to)
SWAP (from, to);
length = to - from;
copy = (char *)xmalloc (1 + length);
strncpy (copy, rl_line_buffer + from, length);
copy[length] = '\0';
return (copy);
}
/* Increase the size of RL_LINE_BUFFER until it has enough space to hold
LEN characters. */
void
rl_extend_line_buffer (int len)
{
while (len >= rl_line_buffer_len)
{
rl_line_buffer_len += DEFAULT_BUFFER_SIZE;
rl_line_buffer = (char *)xrealloc (rl_line_buffer, rl_line_buffer_len);
}
_rl_set_the_line ();
}
/* A function for simple tilde expansion. */
int
rl_tilde_expand (int ignore, int key)
{
register int start, end;
char *homedir, *temp;
int len;
end = rl_point;
start = end - 1;
if (rl_point == rl_end && rl_line_buffer[rl_point] == '~')
{
homedir = tilde_expand ("~");
_rl_replace_text (homedir, start, end);
xfree (homedir);
return (0);
}
else if (start >= 0 && rl_line_buffer[start] != '~')
{
for (; start >= 0 && !whitespace (rl_line_buffer[start]); start--)
;
start++;
}
else if (start < 0)
start = 0;
end = start;
do
end++;
while (end < rl_end && whitespace (rl_line_buffer[end]) == 0);
if (end >= rl_end || whitespace (rl_line_buffer[end]))
end--;
/* If the first character of the current word is a tilde, perform
tilde expansion and insert the result. If not a tilde, do
nothing. */
if (rl_line_buffer[start] == '~')
{
len = end - start + 1;
temp = (char *)xmalloc (len + 1);
strncpy (temp, rl_line_buffer + start, len);
temp[len] = '\0';
homedir = tilde_expand (temp);
xfree (temp);
_rl_replace_text (homedir, start, end);
xfree (homedir);
}
return (0);
}
void
_rl_ttymsg (const char *format, ...)
{
va_list args;
va_start (args, format);
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
rl_forced_update_display ();
}
void
_rl_errmsg (const char *format, ...)
{
va_list args;
va_start (args, format);
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
}
/* **************************************************************** */
/* */
/* String Utility Functions */
/* */
/* **************************************************************** */
/* Determine if s2 occurs in s1. If so, return a pointer to the
match in s1. The compare is case insensitive. */
char *
_rl_strindex (const char *s1, const char *s2)
{
int i;
size_t l, len;
for (i = 0, l = strlen (s2), len = strlen (s1); (len - i) >= l; i++)
if (_rl_strnicmp (s1 + i, s2, l) == 0)
return ((char *) (s1 + i));
return ((char *)NULL);
}
#if !defined (HAVE_STRPBRK) || defined (HANDLE_MULTIBYTE)
/* Find the first occurrence in STRING1 of any character from STRING2.
Return a pointer to the character in STRING1. Understands multibyte
characters. */
char *
_rl_strpbrk (const char *string1, const char *string2)
{
register const char *scan;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps;
int v;
memset (&ps, 0, sizeof (mbstate_t));
#endif
for (; *string1; string1++)
{
for (scan = string2; *scan; scan++)
{
if (*string1 == *scan)
return ((char *)string1);
}
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
v = _rl_get_char_len (string1, &ps);
if (v > 1)
string1 += v - 1; /* -1 to account for auto-increment in loop */
}
#endif
}
return ((char *)NULL);
}
#endif
#if !defined (HAVE_STRCASECMP)
/* Compare at most COUNT characters from string1 to string2. Case
doesn't matter (strncasecmp). */
int
_rl_strnicmp (const char *string1, const char *string2, int count)
{
register const char *s1;
register const char *s2;
register int d;
if (count <= 0 || (string1 == string2))
return 0;
s1 = string1;
s2 = string2;
do
{
d = _rl_to_lower (*s1) - _rl_to_lower (*s2); /* XXX - cast to unsigned char? */
if (d != 0)
return d;
if (*s1++ == '\0')
break;
s2++;
}
while (--count != 0);
return (0);
}
/* strcmp (), but caseless (strcasecmp). */
int
_rl_stricmp (const char *string1, const char *string2)
{
register const char *s1;
register const char *s2;
register int d;
s1 = string1;
s2 = string2;
if (s1 == s2)
return 0;
while ((d = _rl_to_lower (*s1) - _rl_to_lower (*s2)) == 0)
{
if (*s1++ == '\0')
return 0;
s2++;
}
return (d);
}
#endif /* !HAVE_STRCASECMP */
/* Compare the first N characters of S1 and S2 without regard to case. If
FLAGS&1, apply the mapping specified by completion-map-case and make
`-' and `_' equivalent. Returns 1 if the strings are equal. */
int
_rl_strcaseeqn(const char *s1, const char *s2, size_t n, int flags)
{
int c1, c2;
int d;
if ((flags & 1) == 0)
return (_rl_strnicmp (s1, s2, n) == 0);
do
{
c1 = _rl_to_lower (*s1);
c2 = _rl_to_lower (*s2);
d = c1 - c2;
if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_'))
d = 0; /* case insensitive character mapping */
if (d != 0)
return 0;
s1++;
s2++;
n--;
}
while (n != 0);
return 1;
}
/* Return 1 if the characters C1 and C2 are equal without regard to case.
If FLAGS&1, apply the mapping specified by completion-map-case and make
`-' and `_' equivalent. */
int
_rl_charcasecmp (int c1, int c2, int flags)
{
if ((flags & 1) && (c1 == '-' || c1 == '_') && (c2 == '-' || c2 == '_'))
return 1;
return ( _rl_to_lower (c1) == _rl_to_lower (c2));
}
/* Stupid comparison routine for qsort () ing strings. */
int
_rl_qsort_string_compare (char **s1, char **s2)
{
#if defined (HAVE_STRCOLL)
return (strcoll (*s1, *s2));
#else
int result;
result = **s1 - **s2;
if (result == 0)
result = strcmp (*s1, *s2);
return result;
#endif
}
/* Function equivalents for the macros defined in chardefs.h. */
#define FUNCTION_FOR_MACRO(f) int (f) (int c) { return f (c); }
FUNCTION_FOR_MACRO (_rl_digit_p)
FUNCTION_FOR_MACRO (_rl_digit_value)
FUNCTION_FOR_MACRO (_rl_lowercase_p)
FUNCTION_FOR_MACRO (_rl_pure_alphabetic)
FUNCTION_FOR_MACRO (_rl_to_lower)
FUNCTION_FOR_MACRO (_rl_to_upper)
FUNCTION_FOR_MACRO (_rl_uppercase_p)
/* A convenience function, to force memory deallocation to be performed
by readline. DLLs on Windows apparently require this. */
void
rl_free (void *mem)
{
if (mem)
free (mem);
}
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
#undef _rl_savestring
char *
_rl_savestring (const char *s)
{
return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s)));
}
#if defined (DEBUG)
static FILE *_rl_tracefp;
void
_rl_trace (const char *format, ...)
{
va_list args;
va_start (args, format);
if (_rl_tracefp == 0)
_rl_tropen ();
vfprintf (_rl_tracefp, format, args);
fprintf (_rl_tracefp, "\n");
fflush (_rl_tracefp);
va_end (args);
}
int
_rl_tropen (void)
{
char fnbuf[128], *x;
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
snprintf (fnbuf, sizeof (fnbuf), "%s/rltrace.%ld", x, (long)getpid());
unlink(fnbuf);
_rl_tracefp = fopen (fnbuf, "w+");
return _rl_tracefp != 0;
}
int
_rl_trclose (void)
{
int r;
r = fclose (_rl_tracefp);
_rl_tracefp = 0;
return r;
}
void
_rl_settracefp (FILE *fp)
{
_rl_tracefp = fp;
}
#endif /* DEBUG */
#if HAVE_DECL_AUDIT_USER_TTY && defined (HAVE_LIBAUDIT_H) && defined (ENABLE_TTY_AUDIT_SUPPORT)
#include
#include
#include
#include
/* Report STRING to the audit system. */
void
_rl_audit_tty (char *string)
{
struct audit_message req;
struct sockaddr_nl addr;
size_t size;
int fd;
fd = socket (PF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
if (fd < 0)
return;
size = strlen (string) + 1;
if (NLMSG_SPACE (size) > MAX_AUDIT_MESSAGE_LENGTH)
{
close (fd);
return;
}
memset (&req, 0, sizeof(req));
req.nlh.nlmsg_len = NLMSG_SPACE (size);
req.nlh.nlmsg_type = AUDIT_USER_TTY;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.nlh.nlmsg_seq = 0;
if (size && string)
memcpy (NLMSG_DATA(&req.nlh), string, size);
memset (&addr, 0, sizeof(addr));
addr.nl_family = AF_NETLINK;
addr.nl_pid = 0;
addr.nl_groups = 0;
sendto (fd, &req, req.nlh.nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr));
close (fd);
}
#endif
readline-8.3/colors.c 000644 000436 000024 00000020561 14705520654 014711 0 ustar 00chet staff 000000 000000 /* `dir', `vdir' and `ls' directory listing programs for GNU.
Modified by Chet Ramey for Readline.
Copyright (C) 1985, 1988, 1990-1991, 1995-2021, 2023
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 . */
/* Written by Richard Stallman and David MacKenzie. */
/* Color support by Peter Anvin and Dennis
Flaherty based on original patches by
Greg Lee . */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include "rlconf.h"
#if defined __TANDEM
# define _XOPEN_SOURCE_EXTENDED 1
# define _TANDEM_SOURCE 1
# include
# include
#endif
#include
#include "posixstat.h" // stat related macros (S_ISREG, ...)
#include // S_ISUID
#ifndef S_ISDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
// strlen()
#if defined (HAVE_STRING_H)
# include
#else /* !HAVE_STRING_H */
# include
#endif /* !HAVE_STRING_H */
// abort()
#if defined (HAVE_STDLIB_H)
# include
#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);
#define RL_COLOR_PREFIX_EXTENSION "readline-colored-completion-prefix"
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]);
}
}
static struct bin_str *
_rl_custom_readline_prefix (void)
{
size_t len;
COLOR_EXT_TYPE *ext;
len = strlen (RL_COLOR_PREFIX_EXTENSION);
for (ext = _rl_color_ext_list; ext; ext = ext->next)
if (ext->ext.len == len && STREQN (ext->ext.string, RL_COLOR_PREFIX_EXTENSION, len))
return (&ext->seq);
return (NULL);
}
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_custom_readline_prefix ();
if (s == 0)
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 (const 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 && _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 defined (S_ISUID)
if ((mode & S_ISUID) != 0 && is_colored (C_SETUID))
colored_filetype = C_SETUID;
else
#endif
#if defined (S_ISGID)
if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
colored_filetype = C_SETGID;
else
#endif
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
}
#if defined (S_ISLNK)
else if (S_ISLNK (mode))
colored_filetype = C_LINK;
#endif
else if (S_ISFIFO (mode))
colored_filetype = C_FIFO;
#if defined (S_ISSOCK)
else if (S_ISSOCK (mode))
colored_filetype = C_SOCK;
#endif
#if defined (S_ISBLK)
else if (S_ISBLK (mode))
colored_filetype = C_BLK;
#endif
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 */
readline-8.3/gettimeofday.c 000644 000436 000024 00000010620 14773522320 016061 0 ustar 00chet staff 000000 000000 /* Provide gettimeofday for systems that don't have it or for which it's broken.
Copyright (C) 2001-2003, 2005-2007, 2009-2025 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see . */
/* written by Jim Meyering */
/* A version of gettimeofday that just sets tv_sec from time(3) on Unix-like
systems that don't have it, or a version for Win32 systems. From gnulib */
#include
#if !defined (HAVE_GETTIMEOFDAY)
#include "posixtime.h"
#if defined _WIN32 && ! defined __CYGWIN__
# define WINDOWS_NATIVE
# include
#endif
#ifdef WINDOWS_NATIVE
# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
/* Avoid warnings from gcc -Wcast-function-type. */
# define GetProcAddress \
(void *) GetProcAddress
/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */
typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime);
static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL;
static BOOL initialized = FALSE;
static void
initialize (void)
{
HMODULE kernel32 = LoadLibrary ("kernel32.dll");
if (kernel32 != NULL)
{
GetSystemTimePreciseAsFileTimeFunc =
(GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
}
initialized = TRUE;
}
# else /* !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) */
# define GetSystemTimePreciseAsFileTimeFunc GetSystemTimePreciseAsFileTime
# endif /* !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) */
#endif /* WINDOWS_NATIVE */
/* This is a wrapper for gettimeofday. It is used only on systems
that lack this function, or whose implementation of this function
causes problems.
Work around the bug in some systems whereby gettimeofday clobbers
the static buffer that localtime uses for its return value. The
gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
this problem. */
int
gettimeofday (struct timeval *restrict tv, void *restrict tz)
{
#undef gettimeofday
#ifdef WINDOWS_NATIVE
/* On native Windows, there are two ways to get the current time:
GetSystemTimeAsFileTime
or
GetSystemTimePreciseAsFileTime
.
GetSystemTimeAsFileTime produces values that jump by increments of
15.627 milliseconds (!) on average.
Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2
microseconds.
More discussion on this topic:
. */
FILETIME current_time;
# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
if (!initialized)
initialize ();
# endif
if (GetSystemTimePreciseAsFileTimeFunc != NULL)
GetSystemTimePreciseAsFileTimeFunc (¤t_time);
else
GetSystemTimeAsFileTime (¤t_time);
/* Convert from FILETIME to 'struct timeval'. */
/* FILETIME: */
ULONGLONG since_1601 =
((ULONGLONG) current_time.dwHighDateTime << 32)
| (ULONGLONG) current_time.dwLowDateTime;
/* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap
years, in total 134774 days. */
ULONGLONG since_1970 =
since_1601 - (ULONGLONG) 134774 * (ULONGLONG) 86400 * (ULONGLONG) 10000000;
ULONGLONG microseconds_since_1970 = since_1970 / (ULONGLONG) 10;
*tv = (struct timeval) {
.tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000,
.tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000
};
return 0;
#else /* !WINDOWS_NATIVE */
tv->tv_sec = (time_t) time ((time_t *)0);
tv->tv_usec = 0;
return 0;
#endif /* !WINDOWS_NATIVE */
}
#endif /* !HAVE_GETTIMEOFDAY */
readline-8.3/rltty.c 000644 000436 000024 00000057431 15020315031 014552 0 ustar 00chet staff 000000 000000 /* rltty.c -- functions to prepare and restore the terminal for readline's
use. */
/* Copyright (C) 1992-2025 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#include
#include
#include
#if defined (HAVE_UNISTD_H)
# include
#endif /* HAVE_UNISTD_H */
#include "rldefs.h"
#include "rltty.h"
#if defined (HAVE_SYS_IOCTL_H)
# include /* include for declaration of ioctl */
#endif
#include "readline.h"
#include "rlprivate.h"
#if !defined (errno)
extern int errno;
#endif /* !errno */
int _rl_use_tty_xon_xoff = 1;
rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
static void set_winsize (int);
/* **************************************************************** */
/* */
/* Saving and Restoring the TTY */
/* */
/* **************************************************************** */
/* 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
static int terminal_prepped;
static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
/* If non-zero, means that this process has called tcflow(fd, TCOOFF)
and output is suspended. */
#if defined (__ksr1__)
static int ksrflow;
#endif
/* Dummy call to force a backgrounded readline to stop before it tries
to get the tty settings. But we use the information to set our idea
of the screen size if we're in a signal handling context, since it
doesn't make sense to waste it. */
static void
set_winsize (int tty)
{
#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
struct winsize w;
if (_rl_tcgetwinsize (tty, &w) == 0)
{
(void) _rl_tcsetwinsize (tty, &w);
/* We restrict this to the case where we're running a signal handler
and executing after a SIGTSTP. We can relax it later. */
#if defined (SIGTSTP)
if (RL_ISSTATE (RL_STATE_SIGHANDLER) && _rl_handling_signal == SIGTSTP && rl_prefer_env_winsize == 0)
_rl_set_screen_size (w.ws_row, w.ws_col); /* don't waste the info */
#endif
}
#endif /* TIOCGWINSZ */
}
#if defined (NO_TTY_DRIVER)
/* Nothing */
#elif defined (NEW_TTY_DRIVER)
/* Values for the `flags' field of a struct bsdtty. This tells which
elements of the struct bsdtty have been fetched from the system and
are valid. */
#define SGTTY_SET 0x01
#define LFLAG_SET 0x02
#define TCHARS_SET 0x04
#define LTCHARS_SET 0x08
struct bsdtty {
struct sgttyb sgttyb; /* Basic BSD tty driver information. */
int lflag; /* Local mode flags, like LPASS8. */
#if defined (TIOCGETC)
struct tchars tchars; /* Terminal special characters, including ^S and ^Q. */
#endif
#if defined (TIOCGLTC)
struct ltchars ltchars; /* 4.2 BSD editing characters */
#endif
int flags; /* Bitmap saying which parts of the struct are valid. */
};
#define TIOTYPE struct bsdtty
static TIOTYPE otio;
static void save_tty_chars (TIOTYPE *);
static int _get_tty_settings (int, TIOTYPE *);
static int get_tty_settings (int, TIOTYPE *);
static int _set_tty_settings (int, TIOTYPE *);
static int set_tty_settings (int, TIOTYPE *);
static void prepare_terminal_settings (int, TIOTYPE, TIOTYPE *);
static void set_special_char (Keymap, TIOTYPE *, int, rl_command_func_t *);
static void
save_tty_chars (TIOTYPE *tiop)
{
_rl_last_tty_chars = _rl_tty_chars;
if (tiop->flags & SGTTY_SET)
{
_rl_tty_chars.t_erase = tiop->sgttyb.sg_erase;
_rl_tty_chars.t_kill = tiop->sgttyb.sg_kill;
}
if (tiop->flags & TCHARS_SET)
{
_rl_intr_char = _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
_rl_quit_char = _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
_rl_tty_chars.t_start = tiop->tchars.t_startc;
_rl_tty_chars.t_stop = tiop->tchars.t_stopc;
_rl_tty_chars.t_eof = tiop->tchars.t_eofc;
_rl_tty_chars.t_eol = '\n';
_rl_tty_chars.t_eol2 = tiop->tchars.t_brkc;
}
if (tiop->flags & LTCHARS_SET)
{
_rl_susp_char = _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
_rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
_rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
_rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
_rl_tty_chars.t_werase = tiop->ltchars.t_werasc;
_rl_tty_chars.t_lnext = tiop->ltchars.t_lnextc;
}
_rl_tty_chars.t_status = -1;
}
static int
get_tty_settings (int tty, TIOTYPE *tiop)
{
set_winsize (tty);
tiop->flags = tiop->lflag = 0;
errno = 0;
if (ioctl (tty, TIOCGETP, &(tiop->sgttyb)) < 0)
return -1;
tiop->flags |= SGTTY_SET;
#if defined (TIOCLGET)
if (ioctl (tty, TIOCLGET, &(tiop->lflag)) == 0)
tiop->flags |= LFLAG_SET;
#endif
#if defined (TIOCGETC)
if (ioctl (tty, TIOCGETC, &(tiop->tchars)) == 0)
tiop->flags |= TCHARS_SET;
#endif
#if defined (TIOCGLTC)
if (ioctl (tty, TIOCGLTC, &(tiop->ltchars)) == 0)
tiop->flags |= LTCHARS_SET;
#endif
return 0;
}
static int
set_tty_settings (int tty, TIOTYPE *tiop)
{
if (tiop->flags & SGTTY_SET)
{
ioctl (tty, TIOCSETN, &(tiop->sgttyb));
tiop->flags &= ~SGTTY_SET;
}
_rl_echoing_p = 1;
#if defined (TIOCLSET)
if (tiop->flags & LFLAG_SET)
{
ioctl (tty, TIOCLSET, &(tiop->lflag));
tiop->flags &= ~LFLAG_SET;
}
#endif
#if defined (TIOCSETC)
if (tiop->flags & TCHARS_SET)
{
ioctl (tty, TIOCSETC, &(tiop->tchars));
tiop->flags &= ~TCHARS_SET;
}
#endif
#if defined (TIOCSLTC)
if (tiop->flags & LTCHARS_SET)
{
ioctl (tty, TIOCSLTC, &(tiop->ltchars));
tiop->flags &= ~LTCHARS_SET;
}
#endif
return 0;
}
static void
prepare_terminal_settings (int meta_flag, TIOTYPE oldtio, TIOTYPE *tiop)
{
_rl_echoing_p = (oldtio.sgttyb.sg_flags & ECHO);
_rl_echoctl = (oldtio.sgttyb.sg_flags & ECHOCTL);
/* Copy the original settings to the structure we're going to use for
our settings. */
tiop->sgttyb = oldtio.sgttyb;
tiop->lflag = oldtio.lflag;
#if defined (TIOCGETC)
tiop->tchars = oldtio.tchars;
#endif
#if defined (TIOCGLTC)
tiop->ltchars = oldtio.ltchars;
#endif
tiop->flags = oldtio.flags;
/* First, the basic settings to put us into character-at-a-time, no-echo
input mode. */
tiop->sgttyb.sg_flags &= ~(ECHO | CRMOD);
tiop->sgttyb.sg_flags |= CBREAK;
/* If this terminal doesn't care how the 8th bit is used, then we can
use it for the meta-key. If only one of even or odd parity is
specified, then the terminal is using parity, and we cannot. */
#if !defined (ANYP)
# define ANYP (EVENP | ODDP)
#endif
if (((oldtio.sgttyb.sg_flags & ANYP) == ANYP) ||
((oldtio.sgttyb.sg_flags & ANYP) == 0))
{
tiop->sgttyb.sg_flags |= ANYP;
/* Hack on local mode flags if we can. */
#if defined (TIOCLGET)
# if defined (LPASS8)
tiop->lflag |= LPASS8;
# endif /* LPASS8 */
#endif /* TIOCLGET */
}
#if defined (TIOCGETC)
if (_rl_use_tty_xon_xoff == 0)
{
/* Get rid of terminal output start and stop characters. */
tiop->tchars.t_stopc = -1; /* C-s */
tiop->tchars.t_startc = -1; /* C-q */
/* If there is an XON character, bind it to restart the output. */
if (oldtio.tchars.t_startc != -1)
rl_bind_key (oldtio.tchars.t_startc, rl_restart_output);
}
/* If there is an EOF char, bind _rl_eof_char to it. */
if (oldtio.tchars.t_eofc != -1)
_rl_eof_char = oldtio.tchars.t_eofc;
# if defined (NO_KILL_INTR)
/* Get rid of terminal-generated SIGQUIT and SIGINT. */
tiop->tchars.t_quitc = -1; /* C-\ */
tiop->tchars.t_intrc = -1; /* C-c */
# endif /* NO_KILL_INTR */
#endif /* TIOCGETC */
#if defined (TIOCGLTC)
/* Make the interrupt keys go away. Just enough to make people happy. */
tiop->ltchars.t_dsuspc = -1; /* C-y */
tiop->ltchars.t_lnextc = -1; /* C-v */
#endif /* TIOCGLTC */
}
#else /* !defined (NEW_TTY_DRIVER) */
#if !defined (VMIN)
# define VMIN VEOF
#endif
#if !defined (VTIME)
# define VTIME VEOL
#endif
#if defined (TERMIOS_TTY_DRIVER)
# define TIOTYPE struct termios
# define DRAIN_OUTPUT(fd) tcdrain (fd)
# define GETATTR(tty, tiop) (tcgetattr (tty, tiop))
# ifdef M_UNIX
# define SETATTR(tty, tiop) (tcsetattr (tty, TCSANOW, tiop))
# else
# define SETATTR(tty, tiop) (tcsetattr (tty, TCSADRAIN, tiop))
# endif /* !M_UNIX */
#else
# define TIOTYPE struct termio
# define DRAIN_OUTPUT(fd)
# define GETATTR(tty, tiop) (ioctl (tty, TCGETA, tiop))
# define SETATTR(tty, tiop) (ioctl (tty, TCSETAW, tiop))
#endif /* !TERMIOS_TTY_DRIVER */
static TIOTYPE otio;
static void save_tty_chars (TIOTYPE *);
static int _get_tty_settings (int, TIOTYPE *);
static int get_tty_settings (int, TIOTYPE *);
static int _set_tty_settings (int, TIOTYPE *);
static int set_tty_settings (int, TIOTYPE *);
static void prepare_terminal_settings (int, TIOTYPE, TIOTYPE *);
static void set_special_char (Keymap, TIOTYPE *, int, rl_command_func_t *);
static void _rl_bind_tty_special_chars (Keymap, TIOTYPE);
#if defined (FLUSHO)
# define OUTPUT_BEING_FLUSHED(tp) (tp->c_lflag & FLUSHO)
#else
# define OUTPUT_BEING_FLUSHED(tp) 0
#endif
static void
save_tty_chars (TIOTYPE *tiop)
{
_rl_last_tty_chars = _rl_tty_chars;
_rl_tty_chars.t_eof = tiop->c_cc[VEOF];
_rl_tty_chars.t_eol = tiop->c_cc[VEOL];
#ifdef VEOL2
_rl_tty_chars.t_eol2 = tiop->c_cc[VEOL2];
#endif
_rl_tty_chars.t_erase = tiop->c_cc[VERASE];
#ifdef VWERASE
_rl_tty_chars.t_werase = tiop->c_cc[VWERASE];
#endif
_rl_tty_chars.t_kill = tiop->c_cc[VKILL];
#ifdef VREPRINT
_rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
#endif
_rl_intr_char = _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
_rl_quit_char = _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
#ifdef VSUSP
_rl_susp_char = _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
#endif
#ifdef VDSUSP
_rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
#endif
#ifdef VSTART
_rl_tty_chars.t_start = tiop->c_cc[VSTART];
#endif
#ifdef VSTOP
_rl_tty_chars.t_stop = tiop->c_cc[VSTOP];
#endif
#ifdef VLNEXT
_rl_tty_chars.t_lnext = tiop->c_cc[VLNEXT];
#endif
#ifdef VDISCARD
_rl_tty_chars.t_flush = tiop->c_cc[VDISCARD];
#endif
#ifdef VSTATUS
_rl_tty_chars.t_status = tiop->c_cc[VSTATUS];
#endif
}
#if defined (_AIX) || defined (_AIX41)
/* Currently this is only used on AIX */
static void
rltty_warning (char *msg)
{
_rl_errmsg ("warning: %s", msg);
}
#endif
#if defined (_AIX)
void
setopost (TIOTYPE *tp)
{
if ((tp->c_oflag & OPOST) == 0)
{
_rl_errmsg ("warning: turning on OPOST for terminal\r");
tp->c_oflag |= OPOST|ONLCR;
}
}
#endif
static int
_get_tty_settings (int tty, TIOTYPE *tiop)
{
int ioctl_ret;
while (1)
{
ioctl_ret = GETATTR (tty, tiop);
if (ioctl_ret < 0)
{
if (errno != EINTR)
return -1;
else
continue;
}
if (OUTPUT_BEING_FLUSHED (tiop))
{
#if defined (FLUSHO)
_rl_errmsg ("warning: turning off output flushing");
tiop->c_lflag &= ~FLUSHO;
break;
#else
continue;
#endif
}
break;
}
return 0;
}
static int
get_tty_settings (int tty, TIOTYPE *tiop)
{
set_winsize (tty);
errno = 0;
if (_get_tty_settings (tty, tiop) < 0)
return -1;
#if defined (_AIX)
setopost(tiop);
#endif
return 0;
}
static int
_set_tty_settings (int tty, TIOTYPE *tiop)
{
while (SETATTR (tty, tiop) < 0)
{
if (errno != EINTR)
return -1;
errno = 0;
}
return 0;
}
static int
set_tty_settings (int tty, TIOTYPE *tiop)
{
if (_set_tty_settings (tty, tiop) < 0)
return -1;
#if 0
#if defined (TERMIOS_TTY_DRIVER)
# if defined (__ksr1__)
if (ksrflow)
{
ksrflow = 0;
tcflow (tty, TCOON);
}
# else /* !ksr1 */
tcflow (tty, TCOON); /* Simulate a ^Q. */
# endif /* !ksr1 */
#else
ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */
#endif /* !TERMIOS_TTY_DRIVER */
#endif /* 0 */
return 0;
}
static void
prepare_terminal_settings (int meta_flag, TIOTYPE oldtio, TIOTYPE *tiop)
{
int sc;
Keymap kmap;
_rl_echoing_p = (oldtio.c_lflag & ECHO);
#if defined (ECHOCTL)
_rl_echoctl = (oldtio.c_lflag & ECHOCTL);
#endif
tiop->c_lflag &= ~(ICANON | ECHO);
if ((unsigned char) oldtio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE)
_rl_eof_char = oldtio.c_cc[VEOF];
if (_rl_use_tty_xon_xoff == 0)
#if defined (IXANY)
tiop->c_iflag &= ~(IXON | IXANY);
#else
/* `strict' Posix systems do not define IXANY. */
tiop->c_iflag &= ~IXON;
#endif /* IXANY */
/* Only turn this off if we are using all 8 bits. */
if (((tiop->c_cflag & CSIZE) == CS8) || meta_flag)
tiop->c_iflag &= ~(ISTRIP | INPCK);
/* Make sure we differentiate between CR and NL on input. */
tiop->c_iflag &= ~(ICRNL | INLCR);
#if !defined (HANDLE_SIGNALS)
tiop->c_lflag &= ~ISIG;
#else
tiop->c_lflag |= ISIG;
#endif
tiop->c_cc[VMIN] = 1;
tiop->c_cc[VTIME] = 0;
#if defined (FLUSHO)
if (OUTPUT_BEING_FLUSHED (tiop))
{
tiop->c_lflag &= ~FLUSHO;
oldtio.c_lflag &= ~FLUSHO;
}
#endif
/* Turn off characters that we need on Posix systems with job control,
just to be sure. This includes ^Y and ^V. This should not really
be necessary. */
#if defined (TERMIOS_TTY_DRIVER) && defined (_POSIX_VDISABLE)
#if defined (VLNEXT)
tiop->c_cc[VLNEXT] = _POSIX_VDISABLE;
#endif
#if defined (VDSUSP)
tiop->c_cc[VDSUSP] = _POSIX_VDISABLE;
#endif
/* Conditionally disable some other tty special characters if there is a
key binding for them in the current keymap. Readline ordinarily doesn't
bind these characters, but an application or user might. */
#if defined (VI_MODE)
kmap = (rl_editing_mode == vi_mode) ? vi_insertion_keymap : _rl_keymap;
#else
kmap = _rl_keymap;
#endif
#if defined (VDISCARD)
sc = tiop->c_cc[VDISCARD];
if (sc != _POSIX_VDISABLE && kmap[(unsigned char)sc].type == ISFUNC)
tiop->c_cc[VDISCARD] = _POSIX_VDISABLE;
#endif /* VDISCARD */
#endif /* TERMIOS_TTY_DRIVER && _POSIX_VDISABLE */
}
#endif /* !NEW_TTY_DRIVER */
/* Put the terminal in CBREAK mode so that we can detect key presses. */
#if defined (NO_TTY_DRIVER)
void
rl_prep_terminal (int meta_flag)
{
_rl_echoing_p = 1;
}
void
rl_deprep_terminal (void)
{
}
#else /* ! NO_TTY_DRIVER */
void
rl_prep_terminal (int meta_flag)
{
int tty, nprep;
TIOTYPE tio;
if (terminal_prepped)
return;
/* Try to keep this function from being INTerrupted. */
_rl_block_sigint ();
tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
if (get_tty_settings (tty, &tio) < 0)
{
#if defined (ENOTSUP)
/* MacOS X and Linux, at least, lie about the value of errno if
tcgetattr fails. */
if (errno == ENOTTY || errno == EINVAL || errno == ENOTSUP)
#else
if (errno == ENOTTY || errno == EINVAL)
#endif
_rl_echoing_p = 1; /* XXX */
_rl_release_sigint ();
return;
}
otio = tio;
if (_rl_bind_stty_chars)
{
#if defined (VI_MODE)
/* If editing in vi mode, make sure we restore the bindings in the
insertion keymap no matter what keymap we ended up in. */
if (rl_editing_mode == vi_mode)
rl_tty_unset_default_bindings (vi_insertion_keymap);
else
#endif
rl_tty_unset_default_bindings (_rl_keymap);
}
save_tty_chars (&otio);
RL_SETSTATE(RL_STATE_TTYCSAVED);
if (_rl_bind_stty_chars)
{
#if defined (VI_MODE)
/* 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);
else
#endif
_rl_bind_tty_special_chars (_rl_keymap, tio);
}
prepare_terminal_settings (meta_flag, otio, &tio);
if (set_tty_settings (tty, &tio) < 0)
{
_rl_release_sigint ();
return;
}
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;
RL_SETSTATE(RL_STATE_TERMPREPPED);
_rl_release_sigint ();
}
/* Restore the terminal's normal settings and modes. */
void
rl_deprep_terminal (void)
{
int tty;
if (terminal_prepped == 0)
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);
/* Since the last character in BRACK_PASTE_FINI is \r */
_rl_last_c_pos = 0;
if (rl_eof_found && (RL_ISSTATE (RL_STATE_TIMEOUT) == 0))
fprintf (rl_outstream, "\n");
else if (_rl_echoing_p == 0)
fprintf (rl_outstream, "\n");
}
if (_rl_enable_keypad)
_rl_control_keypad (0);
fflush (rl_outstream);
if (set_tty_settings (tty, &otio) < 0)
{
_rl_release_sigint ();
return;
}
terminal_prepped = 0;
RL_UNSETSTATE(RL_STATE_TERMPREPPED);
_rl_release_sigint ();
}
#endif /* !NO_TTY_DRIVER */
/* Set readline's idea of whether or not it is echoing output to the terminal,
returning the old value. */
int
rl_tty_set_echoing (int u)
{
int o;
o = _rl_echoing_p;
_rl_echoing_p = u;
return o;
}
/* **************************************************************** */
/* */
/* Bogus Flow Control */
/* */
/* **************************************************************** */
int
rl_restart_output (int count, int key)
{
#if defined (__MINGW32__)
return 0;
#else /* !__MING32__ */
int fildes = fileno (rl_outstream);
#if defined (TIOCSTART)
#if defined (apollo)
ioctl (&fildes, TIOCSTART, 0);
#else
ioctl (fildes, TIOCSTART, 0);
#endif /* apollo */
#else /* !TIOCSTART */
# if defined (TERMIOS_TTY_DRIVER)
# if defined (__ksr1__)
if (ksrflow)
{
ksrflow = 0;
tcflow (fildes, TCOON);
}
# else /* !ksr1 */
tcflow (fildes, TCOON); /* Simulate a ^Q. */
# endif /* !ksr1 */
# else /* !TERMIOS_TTY_DRIVER */
# if defined (TCXONC)
ioctl (fildes, TCXONC, TCOON);
# endif /* TCXONC */
# endif /* !TERMIOS_TTY_DRIVER */
#endif /* !TIOCSTART */
return 0;
#endif /* !__MINGW32__ */
}
int
rl_stop_output (int count, int key)
{
#if defined (__MINGW32__)
return 0;
#else
int fildes = fileno (rl_instream);
#if defined (TIOCSTOP)
# if defined (apollo)
ioctl (&fildes, TIOCSTOP, 0);
# else
ioctl (fildes, TIOCSTOP, 0);
# endif /* apollo */
#else /* !TIOCSTOP */
# if defined (TERMIOS_TTY_DRIVER)
# if defined (__ksr1__)
ksrflow = 1;
# endif /* ksr1 */
tcflow (fildes, TCOOFF);
# else
# if defined (TCXONC)
ioctl (fildes, TCXONC, TCOON);
# endif /* TCXONC */
# endif /* !TERMIOS_TTY_DRIVER */
#endif /* !TIOCSTOP */
return 0;
#endif /* !__MINGW32__ */
}
/* **************************************************************** */
/* */
/* Default Key Bindings */
/* */
/* **************************************************************** */
#if !defined (NO_TTY_DRIVER)
#define SET_SPECIAL(sc, func) set_special_char(kmap, &ttybuff, sc, func)
#endif
#if defined (NO_TTY_DRIVER)
#define SET_SPECIAL(sc, func)
#define RESET_SPECIAL(c)
#elif defined (NEW_TTY_DRIVER)
static void
set_special_char (Keymap kmap, TIOTYPE *tiop, int sc, rl_command_func_t *func)
{
if (sc != -1 && kmap[(unsigned char)sc].type == ISFUNC)
kmap[(unsigned char)sc].function = func;
}
#define RESET_SPECIAL(c) \
if (c != -1 && kmap[(unsigned char)c].type == ISFUNC) \
kmap[(unsigned char)c].function = rl_insert;
static void
_rl_bind_tty_special_chars (Keymap kmap, TIOTYPE ttybuff)
{
if (ttybuff.flags & SGTTY_SET)
{
SET_SPECIAL (ttybuff.sgttyb.sg_erase, rl_rubout);
SET_SPECIAL (ttybuff.sgttyb.sg_kill, rl_unix_line_discard);
}
# if defined (TIOCGLTC)
if (ttybuff.flags & LTCHARS_SET)
{
SET_SPECIAL (ttybuff.ltchars.t_werasc, rl_unix_word_rubout);
SET_SPECIAL (ttybuff.ltchars.t_lnextc, rl_quoted_insert);
}
# endif /* TIOCGLTC */
}
#else /* !NEW_TTY_DRIVER */
static void
set_special_char (Keymap kmap, TIOTYPE *tiop, int sc, rl_command_func_t *func)
{
unsigned char uc;
uc = tiop->c_cc[sc];
if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC)
kmap[uc].function = func;
}
/* used later */
#define RESET_SPECIAL(uc) \
if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) \
kmap[uc].function = rl_insert;
static void
_rl_bind_tty_special_chars (Keymap kmap, TIOTYPE ttybuff)
{
SET_SPECIAL (VERASE, rl_rubout);
SET_SPECIAL (VKILL, rl_unix_line_discard);
# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
SET_SPECIAL (VLNEXT, rl_quoted_insert);
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
# if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
SET_SPECIAL (VWERASE, rl_vi_unix_word_rubout);
else
# endif
SET_SPECIAL (VWERASE, rl_unix_word_rubout);
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
}
#endif /* !NEW_TTY_DRIVER */
/* Set the system's default editing characters to their readline equivalents
in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */
void
rltty_set_default_bindings (Keymap kmap)
{
#if !defined (NO_TTY_DRIVER)
TIOTYPE ttybuff;
int tty;
tty = fileno (rl_instream);
if (get_tty_settings (tty, &ttybuff) == 0)
_rl_bind_tty_special_chars (kmap, ttybuff);
#endif
}
/* New public way to set the system default editing chars to their readline
equivalents. */
void
rl_tty_set_default_bindings (Keymap kmap)
{
rltty_set_default_bindings (kmap);
}
/* Rebind all of the tty special chars that readline worries about back
to self-insert. Call this before saving the current terminal special
chars with save_tty_chars(). This only works on POSIX termios or termio
systems. */
void
rl_tty_unset_default_bindings (Keymap kmap)
{
/* Don't bother before we've saved the tty special chars at least once. */
if (RL_ISSTATE(RL_STATE_TTYCSAVED) == 0)
return;
RESET_SPECIAL (_rl_tty_chars.t_erase);
RESET_SPECIAL (_rl_tty_chars.t_kill);
# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
RESET_SPECIAL (_rl_tty_chars.t_lnext);
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
RESET_SPECIAL (_rl_tty_chars.t_werase);
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
}
#if defined (HANDLE_SIGNALS)
#if defined (NEW_TTY_DRIVER) || defined (NO_TTY_DRIVER)
int
_rl_disable_tty_signals (void)
{
return 0;
}
int
_rl_restore_tty_signals (void)
{
return 0;
}
#else
static TIOTYPE sigstty, nosigstty;
static int tty_sigs_disabled = 0;
int
_rl_disable_tty_signals (void)
{
if (tty_sigs_disabled)
return 0;
if (_get_tty_settings (fileno (rl_instream), &sigstty) < 0)
return -1;
nosigstty = sigstty;
nosigstty.c_lflag &= ~ISIG;
nosigstty.c_iflag &= ~IXON;
if (_set_tty_settings (fileno (rl_instream), &nosigstty) < 0)
return (_set_tty_settings (fileno (rl_instream), &sigstty));
tty_sigs_disabled = 1;
return 0;
}
int
_rl_restore_tty_signals (void)
{
int r;
if (tty_sigs_disabled == 0)
return 0;
r = _set_tty_settings (fileno (rl_instream), &sigstty);
if (r == 0)
tty_sigs_disabled = 0;
return r;
}
#endif /* !NEW_TTY_DRIVER */
#endif /* HANDLE_SIGNALS */
readline-8.3/posixjmp.h 000644 000436 000024 00000002577 12465654057 015303 0 ustar 00chet staff 000000 000000 /* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
/* Copyright (C) 1987,1991-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see .
*/
#ifndef _POSIXJMP_H_
#define _POSIXJMP_H_
#include
/* This *must* be included *after* config.h */
#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))
#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_ */
readline-8.3/patchlevel 000644 000436 000024 00000000061 13661543360 015306 0 ustar 00chet staff 000000 000000 # Do not edit -- exists only for use by patch
0
readline-8.3/rlwinsize.h 000644 000436 000024 00000004411 15020315024 015417 0 ustar 00chet staff 000000 000000 /* rlwinsize.h -- an attempt to isolate some of the system-specific defines
for `struct winsize' and TIOCGWINSZ. */
/* Copyright (C) 1997-2025 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 .
*/
#if !defined (_RLWINSIZE_H_)
#define _RLWINSIZE_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
/* Try to find the definitions of `struct winsize' and TIOGCWINSZ */
#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
# include
#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
#if defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
# include
#endif /* STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
/* Not in either of the standard places, look around. */
#if !defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
# if defined (HAVE_SYS_STREAM_H)
# include
# endif /* HAVE_SYS_STREAM_H */
# if defined (HAVE_SYS_PTEM_H) /* SVR4.2, at least, has it here */
# include
# define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
# endif /* HAVE_SYS_PTEM_H */
# if defined (HAVE_SYS_PTE_H) /* ??? */
# include
# endif /* HAVE_SYS_PTE_H */
#endif /* !STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
#if defined (M_UNIX) && !defined (_SCO_DS) && !defined (tcflow)
# define tcflow(fd, action) ioctl(fd, TCXONC, action)
#endif
extern int _rl_tcgetwinsize (int, struct winsize *);
extern void _rl_tcsetwinsize (int, struct winsize *);
#endif /* _RL_WINSIZE_H */
readline-8.3/misc.c 000644 000436 000024 00000050773 14723375775 014367 0 ustar 00chet staff 000000 000000 /* misc.c -- miscellaneous bindable readline functions. */
/* Copyright (C) 1987-2024 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#if defined (HAVE_UNISTD_H)
# include
#endif /* HAVE_UNISTD_H */
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_LOCALE_H)
# include
#endif
#include
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "rlmbutil.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "histlib.h"
#include "rlshell.h"
#include "xmalloc.h"
static int rl_digit_loop (void);
static void _rl_history_set_point (void);
/* If non-zero, rl_get_previous_history and rl_get_next_history attempt
to preserve the value of rl_point from line to line. */
int _rl_history_preserve_point = 0;
_rl_arg_cxt _rl_argcxt;
/* Saved target point for when _rl_history_preserve_point is set. Special
value of -1 means that point is at the end of the line. */
int _rl_history_saved_point = -1;
/* **************************************************************** */
/* */
/* Numeric Arguments */
/* */
/* **************************************************************** */
int
_rl_arg_overflow (void)
{
if (rl_numeric_arg > 1000000)
{
_rl_argcxt = 0;
rl_explicit_arg = rl_numeric_arg = 0;
rl_ding ();
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
return 1;
}
return 0;
}
void
_rl_arg_init (void)
{
rl_save_prompt ();
_rl_argcxt = 0;
RL_SETSTATE(RL_STATE_NUMERICARG);
}
int
_rl_arg_getchar (void)
{
int c;
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
return c;
}
/* Process C as part of the current numeric argument. Return -1 if the
argument should be aborted, 0 if we should not read any more chars, and
1 if we should continue to read chars. */
int
_rl_arg_dispatch (_rl_arg_cxt cxt, int c)
{
int key, r;
key = c;
/* If we see a key bound to `universal-argument' after seeing digits,
it ends the argument but is otherwise ignored. */
if (c >= 0 && _rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
{
if ((cxt & NUM_SAWDIGITS) == 0)
{
rl_numeric_arg *= 4;
return 1;
}
else if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_argcxt |= NUM_READONE;
return 0; /* XXX */
}
else
{
key = _rl_bracketed_read_key ();
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
if (key < 0)
return -1;
return (_rl_dispatch (key, _rl_keymap));
}
}
c = UNMETA (c);
if (_rl_digit_p (c))
{
_rl_add_executing_keyseq (key);
r = _rl_digit_value (c);
rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + r : r;
rl_explicit_arg = 1;
_rl_argcxt |= NUM_SAWDIGITS;
}
else if (c == '-' && rl_explicit_arg == 0)
{
_rl_add_executing_keyseq (key);
rl_numeric_arg = 1;
_rl_argcxt |= NUM_SAWMINUS;
rl_arg_sign = -1;
}
else
{
/* Make M-- command equivalent to M--1 command. */
if ((_rl_argcxt & NUM_SAWMINUS) && rl_numeric_arg == 1 && rl_explicit_arg == 0)
rl_explicit_arg = 1;
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
r = _rl_dispatch (key, _rl_keymap);
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
/* At worst, this will cause an extra redisplay. Otherwise,
we have to wait until the next character comes in. */
if (rl_done == 0)
(*rl_redisplay_function) ();
r = 0;
}
return r;
}
return 1;
}
/* Handle C-u style numeric args, as well as M--, and M-digits. */
static int
rl_digit_loop (void)
{
int c, r;
while (1)
{
if (_rl_arg_overflow ())
return 1;
c = _rl_arg_getchar ();
if (c < 0)
{
_rl_abort_internal ();
return -1;
}
r = _rl_arg_dispatch (_rl_argcxt, c);
if (r <= 0 || (RL_ISSTATE (RL_STATE_NUMERICARG) == 0))
break;
}
return r;
}
/* Create a default argument. */
void
_rl_reset_argument (void)
{
rl_numeric_arg = rl_arg_sign = 1;
rl_explicit_arg = 0;
_rl_argcxt = 0;
}
/* Start a numeric argument with initial value KEY */
int
rl_digit_argument (int ignore, int key)
{
_rl_arg_init ();
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_arg_dispatch (_rl_argcxt, key);
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
return 0;
}
else
{
rl_execute_next (key);
_rl_del_executing_keyseq ();
return (rl_digit_loop ());
}
}
/* C-u, universal argument. Multiply the current argument by 4.
Read a key. If the key has nothing to do with arguments, then
dispatch on it. If the key is the abort character then abort. */
int
rl_universal_argument (int count, int key)
{
_rl_arg_init ();
rl_numeric_arg *= 4;
return (RL_ISSTATE (RL_STATE_CALLBACK) ? 0 : rl_digit_loop ());
}
int
_rl_arg_callback (_rl_arg_cxt cxt)
{
int c, r;
c = _rl_arg_getchar ();
if (c < 0)
return (1); /* EOF */
if (_rl_argcxt & NUM_READONE)
{
_rl_argcxt &= ~NUM_READONE;
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
rl_execute_next (c);
return 0;
}
r = _rl_arg_dispatch (cxt, c);
if (r > 0)
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
return (r != 1);
}
/* What to do when you abort reading an argument. */
int
rl_discard_argument (void)
{
rl_ding ();
rl_clear_message ();
_rl_reset_argument ();
return 0;
}
/* **************************************************************** */
/* */
/* History Utilities */
/* */
/* **************************************************************** */
/* We already have a history library, and that is what we use to control
the history features of readline. This is our local interface to
the history mechanism. */
/* While we are editing the history, this is the saved
version of the original line. */
HIST_ENTRY *_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
/* Set the history pointer back to the last entry in the history. */
void
_rl_start_using_history (void)
{
using_history ();
#if 1
if (_rl_saved_line_for_history && _rl_saved_line_for_history->data)
_rl_free_undo_list ((UNDO_LIST *)_rl_saved_line_for_history->data);
#endif
_rl_free_saved_history_line ();
_rl_history_search_pos = -99; /* some random invalid history position */
}
/* Free the contents (and containing structure) of a HIST_ENTRY. */
void
_rl_free_history_entry (HIST_ENTRY *entry)
{
if (entry == 0)
return;
FREE (entry->line);
FREE (entry->timestamp);
xfree (entry);
}
/* Perhaps put back the current line if it has changed. */
int
_rl_maybe_replace_line (int clear_undo)
{
HIST_ENTRY *temp;
temp = current_history ();
/* If the current line has changed, save the changes. */
if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
{
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
xfree (temp->line);
FREE (temp->timestamp);
xfree (temp);
/* What about _rl_saved_line_for_history? if the saved undo list is
rl_undo_list, and we just put that into a history entry, should
we set the saved undo list to NULL? */
if (_rl_saved_line_for_history && (UNDO_LIST *)_rl_saved_line_for_history->data == rl_undo_list)
_rl_saved_line_for_history->data = 0;
/* Do we want to set rl_undo_list = 0 here since we just saved it into
a history entry? We let the caller decide. */
if (clear_undo)
rl_undo_list = 0;
}
return 0;
}
int
rl_maybe_replace_line (void)
{
return (_rl_maybe_replace_line (0));
}
void
_rl_unsave_line (HIST_ENTRY *entry)
{
/* Can't call with `1' because rl_undo_list might point to an undo
list from a history entry, as in rl_replace_from_history() below. */
rl_replace_line (entry->line, 0);
rl_undo_list = (UNDO_LIST *)entry->data;
/* Doesn't free `data'. */
_rl_free_history_entry (entry);
rl_point = rl_end; /* rl_replace_line sets rl_end */
}
/* Restore the _rl_saved_line_for_history if there is one. */
int
rl_maybe_unsave_line (void)
{
if (_rl_saved_line_for_history)
{
_rl_unsave_line (_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
}
else
rl_ding ();
return 0;
}
HIST_ENTRY *
_rl_alloc_saved_line (void)
{
HIST_ENTRY *ret;
ret = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
ret->line = savestring (rl_line_buffer);
ret->timestamp = (char *)NULL;
ret->data = (char *)rl_undo_list;
return ret;
}
/* Save the current line in _rl_saved_line_for_history. */
int
rl_maybe_save_line (void)
{
if (_rl_saved_line_for_history == 0)
_rl_saved_line_for_history = _rl_alloc_saved_line ();
return 0;
}
/* Just a wrapper, any self-respecting compiler will inline it. */
void
_rl_free_saved_line (HIST_ENTRY *entry)
{
_rl_free_history_entry (entry);
}
int
_rl_free_saved_history_line (void)
{
_rl_free_saved_line (_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
return 0;
}
static void
_rl_history_set_point (void)
{
rl_point = (_rl_history_preserve_point && _rl_history_saved_point != -1)
? _rl_history_saved_point
: rl_end;
if (rl_point > rl_end)
rl_point = rl_end;
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode && _rl_keymap != vi_insertion_keymap)
rl_point = 0;
#endif /* VI_MODE */
if (rl_editing_mode == emacs_mode)
rl_mark = (rl_point == rl_end ? 0 : rl_end);
}
void
rl_replace_from_history (HIST_ENTRY *entry, int flags)
{
/* Can't call with `1' because rl_undo_list might point to an undo list
from a history entry, just like we're setting up here. */
rl_replace_line (entry->line, 0);
rl_undo_list = (UNDO_LIST *)entry->data;
rl_point = rl_end;
rl_mark = 0;
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
{
rl_point = 0;
rl_mark = rl_end;
}
#endif
}
/* Process and free undo lists attached to each history entry prior to the
current entry, inclusive, reverting each line to its saved state. This
is destructive, and state about the current line is lost. This is not
intended to be called while actively editing, and the current line is
not assumed to have been added to the history list. */
void
_rl_revert_previous_lines (void)
{
int hpos;
HIST_ENTRY *entry;
UNDO_LIST *ul, *saved_undo_list;
char *lbuf;
lbuf = savestring (rl_line_buffer);
saved_undo_list = rl_undo_list;
hpos = where_history ();
entry = (hpos == history_length) ? previous_history () : current_history ();
while (entry)
{
if (ul = (UNDO_LIST *)entry->data)
{
if (ul == saved_undo_list)
saved_undo_list = 0;
/* Set up rl_line_buffer and other variables from history entry */
rl_replace_from_history (entry, 0); /* entry->line is now current */
entry->data = 0; /* entry->data is now current undo list */
/* Undo all changes to this history entry */
while (rl_undo_list)
rl_do_undo ();
/* And copy the reverted line back to the history entry, preserving
the timestamp. */
FREE (entry->line);
entry->line = savestring (rl_line_buffer);
}
entry = previous_history ();
}
/* Restore history state */
rl_undo_list = saved_undo_list; /* may have been set to null */
history_set_pos (hpos);
/* reset the line buffer */
rl_replace_line (lbuf, 0);
_rl_set_the_line ();
/* and clean up */
xfree (lbuf);
}
/* Revert all lines in the history by making sure we are at the end of the
history before calling _rl_revert_previous_lines() */
void
_rl_revert_all_lines (void)
{
int pos;
pos = where_history ();
using_history ();
_rl_revert_previous_lines ();
history_set_pos (pos);
}
/* 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 (void)
{
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 */
/* */
/* **************************************************************** */
/* Meta-< goes to the start of the history. */
int
rl_beginning_of_history (int count, int key)
{
return (rl_get_previous_history (1 + where_history (), key));
}
/* Meta-> goes to the end of the history. (The current line). */
int
rl_end_of_history (int count, int key)
{
rl_maybe_replace_line ();
using_history ();
rl_maybe_unsave_line ();
return 0;
}
int
_rl_next_history_internal (int count)
{
HIST_ENTRY *temp;
/* either not saved by rl_newline or at end of line, so set appropriately. */
if (_rl_history_saved_point == -1 && (rl_point || rl_end))
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
temp = (HIST_ENTRY *)NULL;
while (count)
{
temp = next_history ();
if (!temp)
break;
--count;
}
if (temp == 0)
return 0;
else
{
rl_replace_from_history (temp, 0);
_rl_history_set_point ();
return 1;
}
}
/* Move down to the next history line. */
int
rl_get_next_history (int count, int key)
{
int r;
if (count < 0)
return (rl_get_previous_history (-count, key));
if (count == 0)
return 0;
/* If the current line has changed, save the changes. */
#if 0 /* XXX old code can leak or corrupt rl_undo_list */
rl_maybe_replace_line ();
#else
_rl_maybe_replace_line (1);
#endif
r = _rl_next_history_internal (count);
if (r == 0)
rl_maybe_unsave_line ();
return 0;
}
int
_rl_previous_history_internal (int count)
{
HIST_ENTRY *old_temp, *temp;
temp = old_temp = (HIST_ENTRY *)NULL;
/* either not saved by rl_newline or at end of line, so set appropriately. */
if (_rl_history_saved_point == -1 && (rl_point || rl_end))
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
while (count)
{
temp = previous_history ();
if (temp == 0)
break;
old_temp = temp;
--count;
}
/* If there was a large argument, and we moved back to the start of the
history, that is not an error. So use the last value found. */
if (!temp && old_temp)
temp = old_temp;
if (temp == 0)
{
rl_ding ();
return 0;
}
else
{
rl_replace_from_history (temp, 0);
_rl_history_set_point ();
return 1;
}
}
/* Get the previous item out of our interactive history, making it the current
line. If there is no previous history, just ding. */
int
rl_get_previous_history (int count, int key)
{
int had_saved_line, r;
if (count < 0)
return (rl_get_next_history (-count, key));
if (count == 0 || history_list () == 0)
return 0;
/* If we don't have a line saved, then save this one. */
had_saved_line = _rl_saved_line_for_history != 0;
/* XXX - if we are not editing a history line and we already had a saved
line, we're going to lose this undo list. Not sure what the right thing
is here - replace the saved line? */
rl_maybe_save_line ();
/* If the current line has changed, save the changes. */
#if 0 /* XXX old code can leak or corrupt rl_undo_list */
rl_maybe_replace_line ();
#else
_rl_maybe_replace_line (1);
#endif
r = _rl_previous_history_internal (count);
if (r == 0 && had_saved_line == 0) /* failed to find previous history */
_rl_free_saved_history_line ();
return 0;
}
/* With an argument, move back that many history lines, else move to the
beginning of history. */
int
rl_fetch_history (int count, int c)
{
int wanted, nhist;
/* Giving an argument of n means we want the nth command in the history
file. The command number is interpreted the same way that the bash
`history' command does it -- that is, giving an argument count of 450
to this command would get the command listed as number 450 in the
output of `history'. */
if (rl_explicit_arg)
{
nhist = history_base + where_history ();
/* Negative arguments count back from the end of the history list. */
wanted = (count >= 0) ? nhist - count : -count;
if (wanted <= 0 || wanted >= nhist)
{
/* In vi mode, we don't change the line with an out-of-range
argument, as for the `G' command. */
if (rl_editing_mode == vi_mode)
rl_ding ();
else
rl_beginning_of_history (0, 0);
}
else
rl_get_previous_history (wanted, c);
}
else
rl_beginning_of_history (count, 0);
return (0);
}
/* The equivalent of the Korn shell C-o operate-and-get-next-history-line
editing command. */
/* This could stand to be global to the readline library */
static rl_hook_func_t *_rl_saved_internal_startup_hook = 0;
static int saved_history_logical_offset = -1;
#define HISTORY_FULL() (history_is_stifled () && history_length >= history_max_entries)
static int
set_saved_history (void)
{
int absolute_offset, count;
if (saved_history_logical_offset >= 0)
{
absolute_offset = saved_history_logical_offset - history_base;
count = where_history () - absolute_offset;
rl_get_previous_history (count, 0);
}
saved_history_logical_offset = -1;
_rl_internal_startup_hook = _rl_saved_internal_startup_hook;
return (0);
}
int
rl_operate_and_get_next (int count, int c)
{
/* Accept the current line. */
rl_newline (1, c);
saved_history_logical_offset = rl_explicit_arg ? count : where_history () + history_base + 1;
_rl_saved_internal_startup_hook = _rl_internal_startup_hook;
_rl_internal_startup_hook = set_saved_history;
return 0;
}
/* **************************************************************** */
/* */
/* Editing Modes */
/* */
/* **************************************************************** */
/* How to toggle back and forth between editing modes. */
int
rl_vi_editing_mode (int count, int key)
{
#if defined (VI_MODE)
_rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */
rl_editing_mode = vi_mode;
rl_vi_insert_mode (1, key);
#endif /* VI_MODE */
return 0;
}
int
rl_emacs_editing_mode (int count, int 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;
}
/* Function for the rest of the library to use to set insert/overwrite mode. */
void
_rl_set_insert_mode (int im, int force)
{
#ifdef CURSOR_MODE
_rl_set_cursor (im, force);
#endif
RL_UNSETSTATE (RL_STATE_OVERWRITE);
rl_insert_mode = im;
if (rl_insert_mode == RL_IM_OVERWRITE)
RL_SETSTATE (RL_STATE_OVERWRITE);
}
/* Toggle overwrite mode. A positive explicit argument selects overwrite
mode. A negative or zero explicit argument selects insert mode. */
int
rl_overwrite_mode (int count, int key)
{
if (rl_explicit_arg == 0)
_rl_set_insert_mode (rl_insert_mode ^ 1, 0);
else if (count > 0)
_rl_set_insert_mode (RL_IM_OVERWRITE, 0);
else
_rl_set_insert_mode (RL_IM_INSERT, 0);
return 0;
}
readline-8.3/funmap.c 000644 000436 000024 00000023365 14715702127 014701 0 ustar 00chet staff 000000 000000 /* funmap.c -- attach names to functions. */
/* Copyright (C) 1987-2024 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#if !defined (BUFSIZ)
#include
#endif /* BUFSIZ */
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include "rlconf.h"
#include "readline.h"
#include "xmalloc.h"
typedef int QSFUNC (const void *, const void *);
extern int _rl_qsort_string_compare (char **, char **);
FUNMAP **funmap;
static size_t funmap_size;
static int funmap_entry;
/* After initializing the function map, this is the index of the first
program specific function. */
int funmap_program_specific_entry_start;
static const FUNMAP default_funmap[] = {
{ "abort", rl_abort },
{ "accept-line", rl_newline },
{ "arrow-key-prefix", rl_arrow_keys },
{ "backward-byte", rl_backward_byte },
{ "backward-char", rl_backward_char },
{ "backward-delete-char", rl_rubout },
{ "backward-kill-line", rl_backward_kill_line },
{ "backward-kill-word", rl_backward_kill_word },
{ "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 },
{ "character-search-backward", rl_backward_char_search },
{ "clear-display", rl_clear_display },
{ "clear-screen", rl_clear_screen },
{ "complete", rl_complete },
{ "copy-backward-word", rl_copy_backward_word },
{ "copy-forward-word", rl_copy_forward_word },
{ "copy-region-as-kill", rl_copy_region_to_kill },
{ "delete-char", rl_delete },
{ "delete-char-or-list", rl_delete_or_show_completions },
{ "delete-horizontal-space", rl_delete_horizontal_space },
{ "digit-argument", rl_digit_argument },
{ "do-lowercase-version", rl_do_lowercase_version },
{ "downcase-word", rl_downcase_word },
{ "dump-functions", rl_dump_functions },
{ "dump-macros", rl_dump_macros },
{ "dump-variables", rl_dump_variables },
{ "emacs-editing-mode", rl_emacs_editing_mode },
{ "end-kbd-macro", rl_end_kbd_macro },
{ "end-of-history", rl_end_of_history },
{ "end-of-line", rl_end_of_line },
{ "exchange-point-and-mark", rl_exchange_point_and_mark },
{ "execute-named-command", rl_execute_named_command },
{ "export-completions", rl_export_completions },
{ "fetch-history", rl_fetch_history },
{ "forward-backward-delete-char", rl_rubout_or_delete },
{ "forward-byte", rl_forward_byte },
{ "forward-char", rl_forward_char },
{ "forward-search-history", rl_forward_search_history },
{ "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 },
{ "kill-line", rl_kill_line },
{ "kill-region", rl_kill_region },
{ "kill-word", rl_kill_word },
{ "menu-complete", rl_menu_complete },
{ "menu-complete-backward", rl_backward_menu_complete },
{ "next-history", rl_get_next_history },
{ "next-screen-line", rl_next_screen_line },
{ "non-incremental-forward-search-history", rl_noninc_forward_search },
{ "non-incremental-reverse-search-history", rl_noninc_reverse_search },
{ "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
{ "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
{ "old-menu-complete", rl_old_menu_complete },
{ "operate-and-get-next", rl_operate_and_get_next },
{ "overwrite-mode", rl_overwrite_mode },
#if defined (_WIN32)
{ "paste-from-clipboard", rl_paste_from_clipboard },
#endif
{ "possible-completions", rl_possible_completions },
{ "previous-history", rl_get_previous_history },
{ "previous-screen-line", rl_previous_screen_line },
{ "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},
{ "reverse-search-history", rl_reverse_search_history },
{ "revert-line", rl_revert_line },
{ "self-insert", rl_insert },
{ "set-mark", rl_set_mark },
{ "skip-csi-sequence", rl_skip_csi_sequence },
{ "start-kbd-macro", rl_start_kbd_macro },
{ "tab-insert", rl_tab_insert },
{ "tilde-expand", rl_tilde_expand },
{ "transpose-chars", rl_transpose_chars },
{ "transpose-words", rl_transpose_words },
{ "tty-status", rl_tty_status },
{ "undo", rl_undo_command },
{ "universal-argument", rl_universal_argument },
{ "unix-filename-rubout", rl_unix_filename_rubout },
{ "unix-line-discard", rl_unix_line_discard },
{ "unix-word-rubout", rl_unix_word_rubout },
{ "upcase-word", rl_upcase_word },
{ "yank", rl_yank },
{ "yank-last-arg", rl_yank_last_arg },
{ "yank-nth-arg", rl_yank_nth_arg },
{ "yank-pop", rl_yank_pop },
#if defined (VI_MODE)
{ "vi-append-eol", rl_vi_append_eol },
{ "vi-append-mode", rl_vi_append_mode },
{ "vi-arg-digit", rl_vi_arg_digit },
{ "vi-back-to-indent", rl_vi_back_to_indent },
{ "vi-backward-bigword", rl_vi_bWord },
{ "vi-backward-word", rl_vi_bword },
{ "vi-bWord", rl_vi_bWord },
{ "vi-bword", rl_vi_bword }, /* BEWARE: name matching is case insensitive */
{ "vi-change-case", rl_vi_change_case },
{ "vi-change-char", rl_vi_change_char },
{ "vi-change-to", rl_vi_change_to },
{ "vi-char-search", rl_vi_char_search },
{ "vi-column", rl_vi_column },
{ "vi-complete", rl_vi_complete },
{ "vi-delete", rl_vi_delete },
{ "vi-delete-to", rl_vi_delete_to },
{ "vi-eWord", rl_vi_eWord },
{ "vi-editing-mode", rl_vi_editing_mode },
{ "vi-end-bigword", rl_vi_eWord },
{ "vi-end-word", rl_vi_end_word },
{ "vi-eof-maybe", rl_vi_eof_maybe },
{ "vi-eword", rl_vi_eword }, /* BEWARE: name matching is case insensitive */
{ "vi-fWord", rl_vi_fWord },
{ "vi-fetch-history", rl_vi_fetch_history },
{ "vi-first-print", rl_vi_first_print },
{ "vi-forward-bigword", rl_vi_fWord },
{ "vi-forward-word", rl_vi_fword },
{ "vi-fword", rl_vi_fword }, /* BEWARE: name matching is case insensitive */
{ "vi-goto-mark", rl_vi_goto_mark },
{ "vi-insert-beg", rl_vi_insert_beg },
{ "vi-insertion-mode", rl_vi_insert_mode },
{ "vi-match", rl_vi_match },
{ "vi-movement-mode", rl_vi_movement_mode },
{ "vi-next-word", rl_vi_next_word },
{ "vi-overstrike", rl_vi_overstrike },
{ "vi-overstrike-delete", rl_vi_overstrike_delete },
{ "vi-prev-word", rl_vi_prev_word },
{ "vi-put", rl_vi_put },
{ "vi-redo", rl_vi_redo },
{ "vi-replace", rl_vi_replace },
{ "vi-rubout", rl_vi_rubout },
{ "vi-search", rl_vi_search },
{ "vi-search-again", rl_vi_search_again },
{ "vi-set-mark", rl_vi_set_mark },
{ "vi-subst", rl_vi_subst },
{ "vi-tilde-expand", rl_vi_tilde_expand },
{ "vi-undo", rl_vi_undo },
{ "vi-unix-word-rubout", rl_vi_unix_word_rubout },
{ "vi-yank-arg", rl_vi_yank_arg },
{ "vi-yank-pop", rl_vi_yank_pop },
{ "vi-yank-to", rl_vi_yank_to },
#endif /* VI_MODE */
{(char *)NULL, (rl_command_func_t *)NULL }
};
int
rl_add_funmap_entry (const char *name, rl_command_func_t *function)
{
if (funmap_entry + 2 >= funmap_size)
{
funmap_size += 64;
funmap = (FUNMAP **)xrealloc (funmap, funmap_size * sizeof (FUNMAP *));
}
funmap[funmap_entry] = (FUNMAP *)xmalloc (sizeof (FUNMAP));
funmap[funmap_entry]->name = name;
funmap[funmap_entry]->function = function;
funmap[++funmap_entry] = (FUNMAP *)NULL;
return funmap_entry;
}
static int funmap_initialized;
/* Make the funmap contain all of the default entries. */
void
rl_initialize_funmap (void)
{
register int i;
if (funmap_initialized)
return;
for (i = 0; default_funmap[i].name; i++)
rl_add_funmap_entry (default_funmap[i].name, default_funmap[i].function);
funmap_initialized = 1;
funmap_program_specific_entry_start = i;
}
/* 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. */
const char **
rl_funmap_names (void)
{
const char **result;
size_t result_size, result_index;
/* Make sure that the function map has been initialized. */
rl_initialize_funmap ();
for (result_index = result_size = 0, result = (const char **)NULL; funmap[result_index]; result_index++)
{
if (result_index + 2 > result_size)
{
result_size += 20;
result = (const char **)xrealloc (result, result_size * sizeof (char *));
}
result[result_index] = funmap[result_index]->name;
result[result_index + 1] = (char *)NULL;
}
if (result)
qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
return (result);
}
readline-8.3/parse-colors.c 000644 000436 000024 00000032276 14473206554 016031 0 ustar 00chet staff 000000 000000 /* `dir', `vdir' and `ls' directory listing programs for GNU.
Modified by Chet Ramey for Readline.
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2017
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
/* Written by Richard Stallman and David MacKenzie. */
/* Color support by Peter Anvin and Dennis
Flaherty based on original patches by
Greg Lee . */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
// strdup() / strcpy()
#if defined (HAVE_STRING_H)
# include
#else /* !HAVE_STRING_H */
# include
#endif /* !HAVE_STRING_H */
// abort()
#if defined (HAVE_STDLIB_H)
# include
#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 */
static void
free_color_ext_list (void)
{
COLOR_EXT_TYPE *e;
COLOR_EXT_TYPE *e2;
for (e = _rl_color_ext_list; e != NULL; /* empty */)
{
e2 = e;
e = e->next;
free (e2);
}
_rl_color_ext_list = 0;
}
void _rl_parse_colors(void)
{
#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)
{
_rl_errmsg ("unparsable value for LS_COLORS environment variable");
free (color_buf);
free_color_ext_list ();
_rl_colored_stats = 0; /* can't have colored stats without colors */
_rl_colored_completion_prefix = 0; /* or colored prefixes */
}
#else /* !COLOR_SUPPORT */
;
#endif /* !COLOR_SUPPORT */
}
void
rl_reparse_colors (void)
{
char *v;
v = sh_get_env_value ("LS_COLORS");
if (v == 0 && color_buf == 0)
return; /* no change */
if (v && color_buf && STREQ (v, color_buf))
return; /* no change */
free (color_buf);
free_color_ext_list ();
_rl_parse_colors ();
}
readline-8.3/signals.c 000644 000436 000024 00000051207 14762703153 015051 0 ustar 00chet staff 000000 000000 /* signals.c -- signal handling support for readline. */
/* Copyright (C) 1987-2025 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include /* Just for NULL. Yuck. */
#include
#include
#if defined (HAVE_UNISTD_H)
# include
#endif /* HAVE_UNISTD_H */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#if defined (GWINSZ_IN_SYS_IOCTL)
# include
#endif /* GWINSZ_IN_SYS_IOCTL */
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#if defined (HANDLE_SIGNALS)
#define SIGHANDLER_RETURN return
/* This typedef is equivalent to the one for Function; it allows us
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
typedef void SigHandler (int);
#if defined (HAVE_POSIX_SIGNALS)
typedef struct sigaction sighandler_cxt;
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
#else
typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
# define sigemptyset(m)
#endif /* !HAVE_POSIX_SIGNALS */
#ifndef SA_RESTART
# define SA_RESTART 0
#endif
static SigHandler *rl_set_sighandler (int, SigHandler *, sighandler_cxt *);
static void rl_maybe_set_sighandler (int, SigHandler *, sighandler_cxt *);
static void rl_maybe_restore_sighandler (int, sighandler_cxt *);
static void rl_signal_handler (int);
static void _rl_handle_signal (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. */
int rl_catch_signals = 1;
/* If non-zero, readline will install a signal handler for SIGWINCH. */
#ifdef SIGWINCH
int rl_catch_sigwinch = 1;
#else
int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
#endif
/* Private variables. */
int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including everywhere */
int volatile _rl_handling_signal = 0;
/* If non-zero, print characters corresponding to received signals as long as
the user has indicated his desire to do so (_rl_echo_control_chars). */
int _rl_echoctl = 0;
int _rl_intr_char = 0;
int _rl_quit_char = 0;
int _rl_susp_char = 0;
static int signals_set_flag;
static int sigwinch_set_flag;
#if defined (HAVE_POSIX_SIGNALS)
sigset_t _rl_orig_sigset;
#endif /* !HAVE_POSIX_SIGNALS */
/* **************************************************************** */
/* */
/* Signal Handling */
/* */
/* **************************************************************** */
static sighandler_cxt old_int, old_term, old_hup, old_alrm, old_quit;
#if defined (SIGTSTP)
static sighandler_cxt old_tstp, old_ttou, old_ttin;
#endif
#if defined (SIGWINCH)
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 to run signal handling code. */
void
_rl_signal_handler (int sig)
{
_rl_caught_signal = 0; /* XXX */
#if defined (SIGWINCH)
if (sig == SIGWINCH)
{
RL_SETSTATE(RL_STATE_SIGHANDLER);
_rl_handling_signal = 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) ();
_rl_handling_signal = 0;
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
}
else
#endif
_rl_handle_signal (sig);
SIGHANDLER_RETURN;
}
static void
rl_signal_handler (int sig)
{
_rl_caught_signal = sig;
SIGHANDLER_RETURN;
}
/* This is called to handle a signal when it is safe to do so (out of the
signal handler execution path). Called by _rl_signal_handler for all the
signals readline catches except SIGWINCH. */
static void
_rl_handle_signal (int sig)
{
int block_sig;
#if defined (HAVE_POSIX_SIGNALS)
sigset_t set, oset;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
long omask;
# else /* !HAVE_BSD_SIGNALS */
sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
RL_SETSTATE(RL_STATE_SIGHANDLER);
_rl_handling_signal = sig;
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
/* Since the signal will not be blocked while we are in the signal
handler, ignore it until rl_clear_signals resets the catcher. */
# if defined (SIGALRM)
if (sig == SIGINT || sig == SIGALRM)
# else
if (sig == SIGINT)
# endif
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;
}
#if defined (HAVE_POSIX_SIGNALS)
/* Get the current set of blocked signals. If we want to block a signal for
the duration of the cleanup functions, make sure to add it to SET and
set block_sig = 1 (see the SIGHUP case below). */
block_sig = 0; /* sentinel to block signals with sigprocmask */
sigemptyset (&set);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
#endif
switch (sig)
{
case SIGINT:
/* We will end up blocking SIGTTOU while we are resetting the tty, so
watch out for this if it causes problems. We could prevent this by
setting block_sig to 1 without modifying SET. */
_rl_reset_completion_state ();
rl_free_line_state ();
#if defined (READLINE_CALLBACKS)
rl_callback_sigcleanup ();
#endif
/* FALLTHROUGH */
#if defined (SIGTSTP)
case SIGTSTP:
case SIGTTIN:
case SIGTTOU:
# 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. We still do
this even if we've been stopped on SIGTTOU, since we handle signals
when we have returned from the signal handler and the signal is no
longer blocked. */
if (block_sig == 0)
{
sigaddset (&set, SIGTTOU);
block_sig = 1;
}
# endif
#endif /* SIGTSTP */
/* Any signals that should be blocked during cleanup should go here. */
#if defined (SIGHUP)
case SIGHUP:
# if defined (_AIX)
if (block_sig == 0)
{
sigaddset (&set, sig);
block_sig = 1;
}
# endif // _AIX
#endif
/* Signals that don't require blocking during cleanup should go here. */
case SIGTERM:
#if defined (SIGALRM)
case SIGALRM:
if (sig == SIGALRM)
_rl_timeout_handle_sigalrm ();
#endif
#if defined (SIGQUIT)
case SIGQUIT:
#endif
#if defined (HAVE_POSIX_SIGNALS)
if (block_sig)
sigprocmask (SIG_BLOCK, &set, &oset);
#endif
#if defined (READLINE_CALLBACKS)
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0 || rl_persistent_signal_handlers)
#endif
rl_echo_signal_char (sig);
rl_cleanup_after_signal ();
/* At this point, the application's signal handler, if any, is the
current handler. */
#if defined (HAVE_POSIX_SIGNALS)
/* Unblock any signal(s) blocked above */
if (block_sig)
sigprocmask (SIG_UNBLOCK, &set, &oset);
#endif
/* We don't have to bother unblocking the signal because we are not
running in a signal handler context. */
#if defined (__EMX__)
signal (sig, SIG_ACK);
#endif
#if defined (HAVE_KILL)
kill (getpid (), sig);
#else
raise (sig); /* assume we have raise */
#endif
/* We don't need to modify the signal mask now that this is not run in
a signal handler context. */
rl_reset_after_signal ();
}
_rl_handling_signal = 0;
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
#if defined (SIGWINCH)
static void
rl_sigwinch_handler (int sig)
{
SigHandler *oh;
#if defined (MUST_REINSTALL_SIGHANDLERS)
sighandler_cxt dummy_winch;
/* We don't want to change old_winch -- it holds the state of SIGWINCH
disposition set by the calling application. We need this state
because we call the application's SIGWINCH handler after updating
our own idea of the screen size. */
rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch);
#endif
RL_SETSTATE(RL_STATE_SIGHANDLER);
_rl_caught_signal = sig;
/* If another sigwinch handler has been installed, call it. */
oh = (SigHandler *)old_winch.sa_handler;
if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
(*oh) (sig);
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
#endif /* SIGWINCH */
/* Functions to manage signal handling. */
#if !defined (HAVE_POSIX_SIGNALS)
static int
rl_sigaction (int sig, sighandler_cxt *nh, sighandler_cxt *oh)
{
oh->sa_handler = signal (sig, nh->sa_handler);
return 0;
}
#endif /* !HAVE_POSIX_SIGNALS */
/* Set up a readline-specific signal handler, saving the old signal
information in OHANDLER. Return the old signal handler, like
signal(). */
static SigHandler *
rl_set_sighandler (int sig, SigHandler *handler, sighandler_cxt *ohandler)
{
sighandler_cxt old_handler;
#if defined (HAVE_POSIX_SIGNALS)
struct sigaction act;
act.sa_handler = handler;
# if defined (SIGWINCH)
act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
# else
act.sa_flags = 0;
# endif /* SIGWINCH */
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
sigaction (sig, &act, &old_handler);
#else
old_handler.sa_handler = (SigHandler *)signal (sig, handler);
#endif /* !HAVE_POSIX_SIGNALS */
/* XXX -- assume we have memcpy */
/* If rl_set_signals is called twice in a row, don't set the old handler to
rl_signal_handler, because that would cause infinite recursion. */
if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
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 (int sig, SigHandler *handler, sighandler_cxt *ohandler)
{
sighandler_cxt dummy;
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 (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 (void)
{
sighandler_cxt dummy;
SigHandler *oh;
#if defined (HAVE_POSIX_SIGNALS)
static int sigmask_set = 0;
static sigset_t bset, oset;
#endif
#if defined (HAVE_POSIX_SIGNALS)
if (rl_catch_signals && sigmask_set == 0)
{
sigemptyset (&bset);
sigaddset (&bset, SIGINT);
sigaddset (&bset, SIGTERM);
#if defined (SIGHUP)
sigaddset (&bset, SIGHUP);
#endif
#if defined (SIGQUIT)
sigaddset (&bset, SIGQUIT);
#endif
#if defined (SIGALRM)
sigaddset (&bset, SIGALRM);
#endif
#if defined (SIGTSTP)
sigaddset (&bset, SIGTSTP);
#endif
#if defined (SIGTTIN)
sigaddset (&bset, SIGTTIN);
#endif
#if defined (SIGTTOU)
sigaddset (&bset, SIGTTOU);
#endif
sigmask_set = 1;
}
#endif /* HAVE_POSIX_SIGNALS */
if (rl_catch_signals && signals_set_flag == 0)
{
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&_rl_orig_sigset);
sigprocmask (SIG_BLOCK, &bset, &_rl_orig_sigset);
#endif
rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
#if defined (SIGHUP)
rl_maybe_set_sighandler (SIGHUP, rl_signal_handler, &old_hup);
#endif
#if defined (SIGQUIT)
rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
#endif
#if defined (SIGALRM)
oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
if (oh == (SigHandler *)SIG_IGN)
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
/* If the application using readline has already installed a signal
handler with SA_RESTART, SIGALRM will cause reads to be restarted
automatically, so readline should just get out of the way. Since
we tested for SIG_IGN above, we can just test for SIG_DFL here. */
if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#endif /* HAVE_POSIX_SIGNALS */
#endif /* SIGALRM */
#if defined (SIGTSTP)
rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
#endif /* SIGTSTP */
#if defined (SIGTTOU)
rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
#endif /* SIGTTOU */
#if defined (SIGTTIN)
rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
#endif /* SIGTTIN */
signals_set_flag = 1;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &_rl_orig_sigset, (sigset_t *)NULL);
#endif
}
else if (rl_catch_signals == 0)
{
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&_rl_orig_sigset);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &_rl_orig_sigset);
#endif
}
#if defined (SIGWINCH)
if (rl_catch_sigwinch && sigwinch_set_flag == 0)
{
rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
sigwinch_set_flag = 1;
}
#endif /* SIGWINCH */
return 0;
}
int
rl_clear_signals (void)
{
sighandler_cxt dummy;
if (rl_catch_signals && signals_set_flag == 1)
{
/* 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);
#if defined (SIGHUP)
rl_maybe_restore_sighandler (SIGHUP, &old_hup);
#endif
#if defined (SIGQUIT)
rl_maybe_restore_sighandler (SIGQUIT, &old_quit);
#endif
#if defined (SIGALRM)
rl_maybe_restore_sighandler (SIGALRM, &old_alrm);
#endif
#if defined (SIGTSTP)
rl_maybe_restore_sighandler (SIGTSTP, &old_tstp);
#endif /* SIGTSTP */
#if defined (SIGTTOU)
rl_maybe_restore_sighandler (SIGTTOU, &old_ttou);
#endif /* SIGTTOU */
#if defined (SIGTTIN)
rl_maybe_restore_sighandler (SIGTTIN, &old_ttin);
#endif /* SIGTTIN */
signals_set_flag = 0;
}
#if defined (SIGWINCH)
if (rl_catch_sigwinch && sigwinch_set_flag == 1)
{
sigemptyset (&dummy.sa_mask);
rl_sigaction (SIGWINCH, &old_winch, &dummy);
sigwinch_set_flag = 0;
}
#endif
return 0;
}
/* Clean up the terminal and readline state after catching a signal, before
resending it to the calling application. */
void
rl_cleanup_after_signal (void)
{
_rl_clean_up_for_exit ();
if (rl_deprep_term_function)
(*rl_deprep_term_function) ();
rl_clear_pending_input ();
rl_clear_signals ();
}
/* Reset the terminal and readline state after a signal handler returns. */
void
rl_reset_after_signal (void)
{
if (rl_prep_term_function)
(*rl_prep_term_function) (_rl_meta_flag);
rl_set_signals ();
}
/* Similar to rl_callback_sigcleanup, but cleans up operations that allocate
state even when not in callback mode. */
void
_rl_state_sigcleanup (void)
{
if (RL_ISSTATE (RL_STATE_ISEARCH)) /* incremental search */
_rl_isearch_cleanup (_rl_iscxt, 0);
else if (RL_ISSTATE (RL_STATE_NSEARCH)) /* non-incremental search */
_rl_nsearch_sigcleanup (_rl_nscxt, 0);
else if (RL_ISSTATE (RL_STATE_READSTR)) /* reading a string */
_rl_readstr_sigcleanup (_rl_rscxt, 0);
}
/* Free up the readline variable line state for the current line (undo list,
any partial history entry, any keyboard macros in progress, and any
numeric arguments in process) after catching a signal, before calling
rl_cleanup_after_signal(). */
void
rl_free_line_state (void)
{
register HIST_ENTRY *entry;
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
_rl_state_sigcleanup ();
rl_free_undo_list ();
entry = current_history ();
if (entry)
entry->data = (char *)NULL;
_rl_kill_kbd_macro ();
rl_clear_message ();
_rl_reset_argument ();
}
int
rl_pending_signal (void)
{
return (_rl_caught_signal);
}
void
rl_check_signals (void)
{
RL_CHECK_SIGNALS ();
}
#endif /* HANDLE_SIGNALS */
/* **************************************************************** */
/* */
/* SIGINT Management */
/* */
/* **************************************************************** */
#if defined (HAVE_POSIX_SIGNALS)
static sigset_t sigwinch_set, sigwinch_oset;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
static int sigint_oldmask;
static int sigwinch_oldmask;
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
static int sigint_blocked;
static int sigwinch_blocked;
/* Cause SIGINT to not be delivered until the corresponding call to
release_sigint(). */
void
_rl_block_sigint (void)
{
if (sigint_blocked)
return;
sigint_blocked = 1;
}
/* Allow SIGINT to be delivered. */
void
_rl_release_sigint (void)
{
if (sigint_blocked == 0)
return;
sigint_blocked = 0;
if (RL_ISSTATE (RL_STATE_SIGHANDLER) == 0)
RL_CHECK_SIGNALS ();
}
/* Cause SIGWINCH to not be delivered until the corresponding call to
release_sigwinch(). */
void
_rl_block_sigwinch (void)
{
if (sigwinch_blocked)
return;
#if defined (SIGWINCH)
#if defined (HAVE_POSIX_SIGNALS)
sigemptyset (&sigwinch_set);
sigemptyset (&sigwinch_oset);
sigaddset (&sigwinch_set, SIGWINCH);
sigprocmask (SIG_BLOCK, &sigwinch_set, &sigwinch_oset);
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
sigwinch_oldmask = sigblock (sigmask (SIGWINCH));
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sighold (SIGWINCH);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
#endif /* SIGWINCH */
sigwinch_blocked = 1;
}
/* Allow SIGWINCH to be delivered. */
void
_rl_release_sigwinch (void)
{
if (sigwinch_blocked == 0)
return;
#if defined (SIGWINCH)
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &sigwinch_oset, (sigset_t *)NULL);
#else
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (sigwinch_oldmask);
# else /* !HAVE_BSD_SIGNALS */
# if defined (HAVE_USG_SIGHOLD)
sigrelse (SIGWINCH);
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
#endif /* SIGWINCH */
sigwinch_blocked = 0;
}
/* **************************************************************** */
/* */
/* Echoing special control characters */
/* */
/* **************************************************************** */
void
rl_echo_signal_char (int sig)
{
char cstr[3];
int cslen, c;
if (_rl_echoctl == 0 || _rl_echo_control_chars == 0)
return;
switch (sig)
{
case SIGINT: c = _rl_intr_char; break;
#if defined (SIGQUIT)
case SIGQUIT: c = _rl_quit_char; break;
#endif
#if defined (SIGTSTP)
case SIGTSTP: c = _rl_susp_char; break;
#endif
default: return;
}
if (CTRL_CHAR (c) || c == RUBOUT)
{
cstr[0] = '^';
cstr[1] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
cstr[cslen = 2] = '\0';
}
else
{
cstr[0] = c;
cstr[cslen = 1] = '\0';
}
_rl_output_some_chars (cstr, cslen);
}
readline-8.3/configure 000755 000436 000024 00000760134 15017402567 015161 0 ustar 00chet staff 000000 000000 #! /bin/sh
# From configure.ac for Readline 8.3, version 2.103.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for readline 8.3.
#
# Report bugs to .
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation,
# Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else case e in #(
e) case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac ;;
esac
fi
# Reset variables that may have inherited troublesome values from
# the environment.
# IFS needs to be set, to space, tab, and newline, in precisely that order.
# (If _AS_PATH_WALK were called with IFS unset, it would have the
# side effect of setting IFS to empty, thus disabling word splitting.)
# Quoting is to prevent editors from complaining about space-tab.
as_nl='
'
export as_nl
IFS=" "" $as_nl"
PS1='$ '
PS2='> '
PS4='+ '
# Ensure predictable behavior from utilities with locale-dependent output.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# We cannot yet rely on "unset" to work, but we need these variables
# to be unset--not just set to an empty or harmless value--now, to
# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
# also avoids known problems related to "unset" and subshell syntax
# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
do eval test \${$as_var+y} \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
# Ensure that fds 0, 1, and 2 are open.
if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
# The user is always right.
if ${PATH_SEPARATOR+false} :; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
test -r "$as_dir$0" && as_myself=$as_dir$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as 'sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed 'exec'.
printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else case e in #(
e) case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac ;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" )
then :
else case e in #(
e) exitcode=1; echo positional parameters were not saved. ;;
esac
fi
test x\$exitcode = x0 || exit 1
blah=\$(echo \$(echo blah))
test x\"\$blah\" = xblah || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
if (eval "$as_required") 2>/dev/null
then :
as_have_required=yes
else case e in #(
e) as_have_required=no ;;
esac
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
then :
else case e in #(
e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null
then :
CONFIG_SHELL=$as_shell as_have_required=yes
if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
then :
break 2
fi
fi
done;;
esac
as_found=false
done
IFS=$as_save_IFS
if $as_found
then :
else case e in #(
e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null
then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi ;;
esac
fi
if test "x$CONFIG_SHELL" != x
then :
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed 'exec'.
printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno
then :
printf "%s\n" "$0: This script requires a shell more modern than all"
printf "%s\n" "$0: the shells that I found on your system."
if test ${ZSH_VERSION+y} ; then
printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"
printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."
else
printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and
$0: bug-readline@gnu.org about your system, including any
$0: error possibly output before this message. Then install
$0: a modern shell, or manually run the script under such a
$0: shell if you do have one."
fi
exit 1
fi ;;
esac
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else case e in #(
e) as_fn_append ()
{
eval $1=\$$1\$2
} ;;
esac
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else case e in #(
e) as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
} ;;
esac
fi # as_fn_arith
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
printf "%s\n" "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
t clear
:clear
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
# Determine whether it's possible to make 'echo' print without a newline.
# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
# for compatibility with existing Makefiles.
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
# For backward compatibility with old third-party macros, we provide
# the shell variables $as_echo and $as_echo_n. New code should use
# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
as_echo='printf %s\n'
as_echo_n='printf %s'
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable.
# In both cases, we have to default to 'cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated
# Sed expression to map a string onto a valid variable name.
as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
as_tr_sh="eval sed '$as_sed_sh'" # deprecated
test -n "$DJDIR" || exec 7<&0 &1
# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='readline'
PACKAGE_TARNAME='readline'
PACKAGE_VERSION='8.3'
PACKAGE_STRING='readline 8.3'
PACKAGE_BUGREPORT='bug-readline@gnu.org'
PACKAGE_URL=''
ac_unique_file="readline.h"
# Factoring default headers for most tests.
ac_includes_default="\
#include
#ifdef HAVE_STDIO_H
# include
#endif
#ifdef HAVE_STDLIB_H
# include
#endif
#ifdef HAVE_STRING_H
# include
#endif
#ifdef HAVE_INTTYPES_H
# include
#endif
#ifdef HAVE_STDINT_H
# include
#endif
#ifdef HAVE_STRINGS_H
# include
#endif
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_SYS_STAT_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif"
ac_header_c_list=
enable_year2038=no
ac_subst_vars='LTLIBOBJS
TERMCAP_PKG_CONFIG_LIB
TERMCAP_LIB
LIBVERSION
ARFLAGS
STYLE_CFLAGS
LOCAL_DEFS
LOCAL_LDFLAGS
LOCAL_CFLAGS
BUILD_DIR
EXAMPLES_INSTALL_TARGET
SHARED_INSTALL_TARGET
STATIC_INSTALL_TARGET
SHARED_TARGET
STATIC_TARGET
SHLIB_MINOR
SHLIB_MAJOR
SHLIB_LIBS
SHLIB_DLLVERSION
SHLIB_LIBVERSION
SHLIB_LIBSUFF
SHLIB_LIBPREF
SHLIB_DOT
SHLIB_XLDFLAGS
SHLIB_STATUS
SHOBJ_STATUS
SHOBJ_LIBS
SHOBJ_XLDFLAGS
SHOBJ_LDFLAGS
SHOBJ_LD
SHOBJ_CFLAGS
SHOBJ_CC
LIBOBJS
CPP
MAKE_SHELL
install_sh
RANLIB
AR
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
SET_MAKE
CROSS_COMPILE
BRACKETED_PASTE
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
with_curses
with_shared_termcap_library
enable_multibyte
enable_shared
enable_static
enable_install_examples
enable_bracketed_paste_default
enable_largefile
enable_year2038
'
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
esac
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: '$ac_useropt'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: '$ac_useropt'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: '$ac_useropt'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: '$ac_useropt'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) as_fn_error $? "unrecognized option: '$ac_option'
Try '$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: '$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: '$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_myself" : 'X\(//\)[^/]' \| \
X"$as_myself" : 'X\(//\)$' \| \
X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
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 8.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print 'checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for '--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or '..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, 'make install' will install all the files in
'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify
an installation prefix other than '$ac_default_prefix' using '--prefix',
for instance '--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/readline]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of readline 8.3:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--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-install-examples
don't install examples [[default=install]]
--disable-bracketed-paste-default
disable bracketed paste by default
[[default=enable]]
--disable-largefile omit support for large files
--enable-year2038 support timestamps after 2038
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-curses use the curses library instead of the termcap
library
--with-shared-termcap-library
link the readline shared library against the
termcap/curses shared library [[default=NO]]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by 'configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to .
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" ||
{ cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for configure.gnu first; this name is used for a wrapper for
# Metaconfig's "Configure" on case-insensitive file systems.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
readline configure 8.3
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##
# ac_fn_c_try_compile LINENO
# --------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest.beam
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext
then :
ac_retval=0
else case e in #(
e) printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1 ;;
esac
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
printf %s "checking for $2... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else case e in #(
e) eval "$3=no" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_c_check_type ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
printf %s "checking for $2... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
if (sizeof ($2))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
if (sizeof (($2)))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
else case e in #(
e) eval "$3=yes" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}
then :
ac_retval=0
else case e in #(
e) printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1 ;;
esac
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
printf %s "checking for $2... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case declares $2.
For example, HP-UX 11i declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (void); below. */
#include
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 (void);
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main (void)
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
eval "$3=yes"
else case e in #(
e) eval "$3=no" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
# ac_fn_c_try_run LINENO
# ----------------------
# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
# executables *can* be run.
ac_fn_c_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
then :
ac_retval=0
else case e in #(
e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5
printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status ;;
esac
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_cpp ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}
then :
ac_retval=0
else case e in #(
e) printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1 ;;
esac
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
# INCLUDES, setting cache variable VAR accordingly.
ac_fn_c_check_member ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
printf %s "checking for $2.$3... " >&6; }
if eval test \${$4+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$5
int
main (void)
{
static $2 ac_aggr;
if (ac_aggr.$3)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$4=yes"
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$5
int
main (void)
{
static $2 ac_aggr;
if (sizeof ac_aggr.$3)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$4=yes"
else case e in #(
e) eval "$4=no" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
eval ac_res=\$$4
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_member
# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR
# ------------------------------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR.
ac_fn_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
as_decl_name=`echo $2|sed 's/ *(.*//'`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
printf %s "checking whether $as_decl_name is declared... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
eval ac_save_FLAGS=\$$6
as_fn_append $6 " $5"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
#ifndef $as_decl_name
#ifdef __cplusplus
(void) $as_decl_use;
#else
(void) $as_decl_name;
#endif
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else case e in #(
e) eval "$3=no" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
eval $6=\$ac_save_FLAGS
;;
esac
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_check_decl
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
# INCLUDES, setting VAR accordingly. Returns whether the value could be
# computed
ac_fn_c_compute_int ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_lo=0 ac_mid=0
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_hi=$ac_mid; break
else case e in #(
e) as_fn_arith $ac_mid + 1 && ac_lo=$as_val
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
done
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_hi=-1 ac_mid=-1
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_lo=$ac_mid; break
else case e in #(
e) as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
done
else case e in #(
e) ac_lo= ac_hi= ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_hi=$ac_mid
else case e in #(
e) as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
done
case $ac_lo in #((
?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
'') ac_retval=1 ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
static long int longval (void) { return $2; }
static unsigned long int ulongval (void) { return $2; }
#include
#include
int
main (void)
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (($2) < 0)
{
long int i = longval ();
if (i != ($2))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ($2))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"
then :
echo >>conftest.val; read $3 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 8.3, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
printf "%s\n" "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Sanitize IFS.
IFS=" "" $as_nl"
# Save into config.log some information that might help in debugging.
{
echo
printf "%s\n" "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
printf "%s\n" "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
printf "%s\n" "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
printf "%s\n" "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
printf "%s\n" "$as_me: caught signal $ac_signal"
printf "%s\n" "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
printf "%s\n" "/* confdefs.h */" > confdefs.h
# Predefined preprocessor variables.
printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
if test -n "$CONFIG_SITE"; then
ac_site_files="$CONFIG_SITE"
elif test "x$prefix" != xNONE; then
ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
else
ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
for ac_site_file in $ac_site_files
do
case $ac_site_file in #(
*/*) :
;; #(
*) :
ac_site_file=./$ac_site_file ;;
esac
if test -f "$ac_site_file" && test -r "$ac_site_file"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" \
|| { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See 'config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special files
# actually), so we avoid doing that. DJGPP emulates it as a regular file.
if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
printf "%s\n" "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
printf "%s\n" "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Test code for whether the C compiler supports C89 (global declarations)
ac_c_conftest_c89_globals='
/* Does the compiler advertise C89 conformance?
Do not test the value of __STDC__, because some compilers set it to 0
while being otherwise adequately conformant. */
#if !defined __STDC__
# error "Compiler does not advertise C89 conformance"
#endif
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */
struct buf { int x; };
struct buf * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (char **p, int i)
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* C89 style stringification. */
#define noexpand_stringify(a) #a
const char *stringified = noexpand_stringify(arbitrary+token=sequence);
/* C89 style token pasting. Exercises some of the corner cases that
e.g. old MSVC gets wrong, but not very hard. */
#define noexpand_concat(a,b) a##b
#define expand_concat(a,b) noexpand_concat(a,b)
extern int vA;
extern int vbee;
#define aye A
#define bee B
int *pvA = &expand_concat(v,aye);
int *pvbee = &noexpand_concat(v,bee);
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not \xHH hex character constants.
These do not provoke an error unfortunately, instead are silently treated
as an "x". The following induces an error, until -std is added to get
proper ANSI mode. Curiously \x00 != x always comes out true, for an
array size at least. It is necessary to write \x00 == 0 to get something
that is true only with -std. */
int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) '\''x'\''
int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
int, int);'
# Test code for whether the C compiler supports C89 (body of main).
ac_c_conftest_c89_main='
ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
'
# Test code for whether the C compiler supports C99 (global declarations)
ac_c_conftest_c99_globals='
/* Does the compiler advertise C99 conformance? */
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
# error "Compiler does not advertise C99 conformance"
#endif
// See if C++-style comments work.
#include
extern int puts (const char *);
extern int printf (const char *, ...);
extern int dprintf (int, const char *, ...);
extern void *malloc (size_t);
extern void free (void *);
// Check varargs macros. These examples are taken from C99 6.10.3.5.
// dprintf is used instead of fprintf to avoid needing to declare
// FILE and stderr.
#define debug(...) dprintf (2, __VA_ARGS__)
#define showlist(...) puts (#__VA_ARGS__)
#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
static void
test_varargs_macros (void)
{
int x = 1234;
int y = 5678;
debug ("Flag");
debug ("X = %d\n", x);
showlist (The first, second, and third items.);
report (x>y, "x is %d but y is %d", x, y);
}
// Check long long types.
#define BIG64 18446744073709551615ull
#define BIG32 4294967295ul
#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
#if !BIG_OK
#error "your preprocessor is broken"
#endif
#if BIG_OK
#else
#error "your preprocessor is broken"
#endif
static long long int bignum = -9223372036854775807LL;
static unsigned long long int ubignum = BIG64;
struct incomplete_array
{
int datasize;
double data[];
};
struct named_init {
int number;
const wchar_t *name;
double average;
};
typedef const char *ccp;
static inline int
test_restrict (ccp restrict text)
{
// Iterate through items via the restricted pointer.
// Also check for declarations in for loops.
for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)
continue;
return 0;
}
// Check varargs and va_copy.
static bool
test_varargs (const char *format, ...)
{
va_list args;
va_start (args, format);
va_list args_copy;
va_copy (args_copy, args);
const char *str = "";
int number = 0;
float fnumber = 0;
while (*format)
{
switch (*format++)
{
case '\''s'\'': // string
str = va_arg (args_copy, const char *);
break;
case '\''d'\'': // int
number = va_arg (args_copy, int);
break;
case '\''f'\'': // float
fnumber = va_arg (args_copy, double);
break;
default:
break;
}
}
va_end (args_copy);
va_end (args);
return *str && number && fnumber;
}
'
# Test code for whether the C compiler supports C99 (body of main).
ac_c_conftest_c99_main='
// Check bool.
_Bool success = false;
success |= (argc != 0);
// Check restrict.
if (test_restrict ("String literal") == 0)
success = true;
char *restrict newvar = "Another string";
// Check varargs.
success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);
test_varargs_macros ();
// Check flexible array members.
struct incomplete_array *ia =
malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
ia->datasize = 10;
for (int i = 0; i < ia->datasize; ++i)
ia->data[i] = i * 1.234;
// Work around memory leak warnings.
free (ia);
// Check named initializers.
struct named_init ni = {
.number = 34,
.name = L"Test wide string",
.average = 543.34343,
};
ni.number = 58;
int dynamic_array[ni.number];
dynamic_array[0] = argv[0][0];
dynamic_array[ni.number - 1] = 543;
// work around unused variable warnings
ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
|| dynamic_array[ni.number - 1] != 543);
'
# Test code for whether the C compiler supports C11 (global declarations)
ac_c_conftest_c11_globals='
/* Does the compiler advertise C11 conformance? */
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
# error "Compiler does not advertise C11 conformance"
#endif
// Check _Alignas.
char _Alignas (double) aligned_as_double;
char _Alignas (0) no_special_alignment;
extern char aligned_as_int;
char _Alignas (0) _Alignas (int) aligned_as_int;
// Check _Alignof.
enum
{
int_alignment = _Alignof (int),
int_array_alignment = _Alignof (int[100]),
char_alignment = _Alignof (char)
};
_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
// Check _Noreturn.
int _Noreturn does_not_return (void) { for (;;) continue; }
// Check _Static_assert.
struct test_static_assert
{
int x;
_Static_assert (sizeof (int) <= sizeof (long int),
"_Static_assert does not work in struct");
long int y;
};
// Check UTF-8 literals.
#define u8 syntax error!
char const utf8_literal[] = u8"happens to be ASCII" "another string";
// Check duplicate typedefs.
typedef long *long_ptr;
typedef long int *long_ptr;
typedef long_ptr long_ptr;
// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
struct anonymous
{
union {
struct { int i; int j; };
struct { int k; long int l; } w;
};
int m;
} v1;
'
# Test code for whether the C compiler supports C11 (body of main).
ac_c_conftest_c11_main='
_Static_assert ((offsetof (struct anonymous, i)
== offsetof (struct anonymous, w.k)),
"Anonymous union alignment botch");
v1.i = 2;
v1.w.k = 5;
ok |= v1.i != 5;
'
# Test code for whether the C compiler supports C11 (complete).
ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}
${ac_c_conftest_c99_globals}
${ac_c_conftest_c11_globals}
int
main (int argc, char **argv)
{
int ok = 0;
${ac_c_conftest_c89_main}
${ac_c_conftest_c99_main}
${ac_c_conftest_c11_main}
return ok;
}
"
# Test code for whether the C compiler supports C99 (complete).
ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}
${ac_c_conftest_c99_globals}
int
main (int argc, char **argv)
{
int ok = 0;
${ac_c_conftest_c89_main}
${ac_c_conftest_c99_main}
return ok;
}
"
# Test code for whether the C compiler supports C89 (complete).
ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}
int
main (int argc, char **argv)
{
int ok = 0;
${ac_c_conftest_c89_main}
return ok;
}
"
as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"
as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"
as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"
as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"
as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H"
as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H"
# Auxiliary files required by this configure script.
ac_aux_files="install-sh config.guess config.sub"
# Locations in which to look for auxiliary files.
ac_aux_dir_candidates="${srcdir}/./support"
# Search for a directory containing all of the required auxiliary files,
# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates.
# If we don't find one directory that contains all the files we need,
# we report the set of missing files from the *first* directory in
# $ac_aux_dir_candidates and give up.
ac_missing_aux_files=""
ac_first_candidate=:
printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in $ac_aux_dir_candidates
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
as_found=:
printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5
ac_aux_dir_found=yes
ac_install_sh=
for ac_aux in $ac_aux_files
do
# As a special case, if "install-sh" is required, that requirement
# can be satisfied by any of "install-sh", "install.sh", or "shtool",
# and $ac_install_sh is set appropriately for whichever one is found.
if test x"$ac_aux" = x"install-sh"
then
if test -f "${as_dir}install-sh"; then
printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5
ac_install_sh="${as_dir}install-sh -c"
elif test -f "${as_dir}install.sh"; then
printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5
ac_install_sh="${as_dir}install.sh -c"
elif test -f "${as_dir}shtool"; then
printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5
ac_install_sh="${as_dir}shtool install -c"
else
ac_aux_dir_found=no
if $ac_first_candidate; then
ac_missing_aux_files="${ac_missing_aux_files} install-sh"
else
break
fi
fi
else
if test -f "${as_dir}${ac_aux}"; then
printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5
else
ac_aux_dir_found=no
if $ac_first_candidate; then
ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}"
else
break
fi
fi
fi
done
if test "$ac_aux_dir_found" = yes; then
ac_aux_dir="$as_dir"
break
fi
ac_first_candidate=false
as_found=false
done
IFS=$as_save_IFS
if $as_found
then :
else case e in #(
e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;;
esac
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
if test -f "${ac_aux_dir}config.guess"; then
ac_config_guess="$SHELL ${ac_aux_dir}config.guess"
fi
if test -f "${ac_aux_dir}config.sub"; then
ac_config_sub="$SHELL ${ac_aux_dir}config.sub"
fi
if test -f "$ac_aux_dir/configure"; then
ac_configure="$SHELL ${ac_aux_dir}configure"
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5
printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5
printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
# differences in whitespace do not lead to failure.
ac_old_val_w=`echo x $ac_old_val`
ac_new_val_w=`echo x $ac_new_val`
if test "$ac_old_val_w" != "$ac_new_val_w"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5
printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5
printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5
printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5
printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file'
and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
LIBVERSION=8.3
# Make sure we can run config.sub.
$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
printf %s "checking build system type... " >&6; }
if test ${ac_cv_build+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"`
test "x$ac_build_alias" = x &&
as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` ||
as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
printf "%s\n" "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
printf %s "checking host system type... " >&6; }
if test ${ac_cv_host+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` ||
as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
printf "%s\n" "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
opt_curses=no
opt_shared_termcap_lib=no
# Check whether --with-curses was given.
if test ${with_curses+y}
then :
withval=$with_curses; opt_curses=$withval
fi
# Check whether --with-shared-termcap-library was given.
if test ${with_shared_termcap_library+y}
then :
withval=$with_shared_termcap_library; opt_shared_termcap_lib=$withval
fi
if test "$opt_curses" = "yes"; then
prefer_curses=yes
fi
opt_multibyte=yes
opt_static_libs=yes
opt_shared_libs=yes
opt_install_examples=yes
opt_bracketed_paste_default=yes
# Check whether --enable-multibyte was given.
if test ${enable_multibyte+y}
then :
enableval=$enable_multibyte; opt_multibyte=$enableval
fi
# Check whether --enable-shared was given.
if test ${enable_shared+y}
then :
enableval=$enable_shared; opt_shared_libs=$enableval
fi
# Check whether --enable-static was given.
if test ${enable_static+y}
then :
enableval=$enable_static; opt_static_libs=$enableval
fi
# Check whether --enable-install-examples was given.
if test ${enable_install_examples+y}
then :
enableval=$enable_install_examples; opt_install_examples=$enableval
fi
# Check whether --enable-bracketed-paste-default was given.
if test ${enable_bracketed_paste_default+y}
then :
enableval=$enable_bracketed_paste_default; opt_bracketed_paste_default=$enableval
fi
if test $opt_multibyte = no; then
printf "%s\n" "#define NO_MULTIBYTE_SUPPORT 1" >>confdefs.h
fi
if test $opt_bracketed_paste_default = yes; then
BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=1'
else
BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=0'
fi
CROSS_COMPILE=
if test "x$cross_compiling" = "xyes"; then
case "${host}" in
*-cygwin*)
cross_cache=${srcdir}/cross-build/cygwin.cache
;;
*-mingw*)
cross_cache=${srcdir}/cross-build/mingw.cache
;;
i[3456]86-*-beos*)
cross_cache=${srcdir}/cross-build/x86-beos.cache
;;
*) echo "configure: cross-compiling for $host is not supported" >&2
;;
esac
if test -n "${cross_cache}" && test -r "${cross_cache}"; then
echo "loading cross-build cache file ${cross_cache}"
. ${cross_cache}
fi
unset cross_cache
CROSS_COMPILE='-DCROSS_COMPILING'
fi
echo ""
echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
echo ""
# We want these before the checks, so the checks can modify their values.
test -z "$CFLAGS" && want_auto_cflags=1
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
if eval test \${ac_cv_prog_make_${ac_make}_set+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
*)
eval ac_cv_prog_make_${ac_make}_set=no;;
esac
rm -f conftest.make ;;
esac
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
SET_MAKE=
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
printf "%s\n" "$CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_ac_ct_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
printf "%s\n" "$ac_ct_CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
printf "%s\n" "$CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"
fi
fi
fi ;;
esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
printf "%s\n" "$CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
printf "%s\n" "$CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_ac_ct_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
printf "%s\n" "$ac_ct_CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
set dummy ${ac_tool_prefix}clang; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}clang"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
printf "%s\n" "$CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "clang", so it can be a program name with args.
set dummy clang; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_ac_ct_CC+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="clang"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
printf "%s\n" "$ac_ct_CC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
fi
test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See 'config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion -version; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
printf %s "checking whether the C compiler works... " >&6; }
ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
if { { ac_try="$ac_link_default"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
then :
# Autoconf-2.13 could set the ac_cv_exeext variable to 'no'.
# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
# We set ac_cv_exeext here because the later test for it is not
# safe: cross compilers may not add the suffix if given an '-o'
# argument, so we may need to know it at that point already.
# Even if this section looks crufty: it has the advantage of
# actually working.
break;;
* )
break;;
esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=
else case e in #(
e) ac_file='' ;;
esac
fi
if test -z "$ac_file"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
See 'config.log' for more details" "$LINENO" 5; }
else case e in #(
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; } ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
printf %s "checking for C compiler default output file name... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
printf "%s\n" "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
printf %s "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
then :
# If both 'conftest.exe' and 'conftest' are 'present' (well, observable)
# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will
# work properly (i.e., refer to 'conftest.exe'), while it won't with
# 'rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
else case e in #(
e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See 'config.log' for more details" "$LINENO" 5; } ;;
esac
fi
rm -f conftest conftest$ac_cv_exeext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
printf "%s\n" "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
FILE *f = fopen ("conftest.out", "w");
if (!f)
return 1;
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files="$ac_clean_files conftest.out"
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
printf %s "checking whether we are cross compiling... " >&6; }
if test "$cross_compiling" != yes; then
{ { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if { ac_try='./conftest$ac_cv_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error 77 "cannot run C compiled programs.
If you meant to cross compile, use '--host'.
See 'config.log' for more details" "$LINENO" 5; }
fi
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
printf "%s\n" "$cross_compiling" >&6; }
rm -f conftest.$ac_ext conftest$ac_cv_exeext \
conftest.o conftest.obj conftest.out
ac_clean_files=$ac_clean_files_save
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
printf %s "checking for suffix of object files... " >&6; }
if test ${ac_cv_objext+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else case e in #(
e) printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
See 'config.log' for more details" "$LINENO" 5; } ;;
esac
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
printf "%s\n" "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5
printf %s "checking whether the compiler supports GNU C... " >&6; }
if test ${ac_cv_c_compiler_gnu+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_compiler_gnu=yes
else case e in #(
e) ac_compiler_gnu=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+y}
ac_save_CFLAGS=$CFLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
printf %s "checking whether $CC accepts -g... " >&6; }
if test ${ac_cv_prog_cc_g+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_prog_cc_g=yes
else case e in #(
e) CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
else case e in #(
e) ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
if test $ac_test_CFLAGS; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
ac_prog_cc_stdc=no
if test x$ac_prog_cc_stdc = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
printf %s "checking for $CC option to enable C11 features... " >&6; }
if test ${ac_cv_prog_cc_c11+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_cv_prog_cc_c11=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_c_conftest_c11_program
_ACEOF
for ac_arg in '' -std=gnu11
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_prog_cc_c11=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
test "x$ac_cv_prog_cc_c11" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC ;;
esac
fi
if test "x$ac_cv_prog_cc_c11" = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
printf "%s\n" "unsupported" >&6; }
else case e in #(
e) if test "x$ac_cv_prog_cc_c11" = x
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
printf "%s\n" "none needed" >&6; }
else case e in #(
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }
CC="$CC $ac_cv_prog_cc_c11" ;;
esac
fi
ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
ac_prog_cc_stdc=c11 ;;
esac
fi
fi
if test x$ac_prog_cc_stdc = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
printf %s "checking for $CC option to enable C99 features... " >&6; }
if test ${ac_cv_prog_cc_c99+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_cv_prog_cc_c99=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_c_conftest_c99_program
_ACEOF
for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_prog_cc_c99=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
test "x$ac_cv_prog_cc_c99" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC ;;
esac
fi
if test "x$ac_cv_prog_cc_c99" = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
printf "%s\n" "unsupported" >&6; }
else case e in #(
e) if test "x$ac_cv_prog_cc_c99" = x
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
printf "%s\n" "none needed" >&6; }
else case e in #(
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }
CC="$CC $ac_cv_prog_cc_c99" ;;
esac
fi
ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
ac_prog_cc_stdc=c99 ;;
esac
fi
fi
if test x$ac_prog_cc_stdc = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
printf %s "checking for $CC option to enable C89 features... " >&6; }
if test ${ac_cv_prog_cc_c89+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_c_conftest_c89_program
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC ;;
esac
fi
if test "x$ac_cv_prog_cc_c89" = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
printf "%s\n" "unsupported" >&6; }
else case e in #(
e) if test "x$ac_cv_prog_cc_c89" = x
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
printf "%s\n" "none needed" >&6; }
else case e in #(
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }
CC="$CC $ac_cv_prog_cc_c89" ;;
esac
fi
ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
ac_prog_cc_stdc=c89 ;;
esac
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_header= ac_cache=
for ac_item in $ac_header_c_list
do
if test $ac_cache; then
ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
printf "%s\n" "#define $ac_item 1" >> confdefs.h
fi
ac_header= ac_cache=
elif test $ac_header; then
ac_cache=$ac_item
else
ac_header=$ac_item
fi
done
if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
then :
printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; }
if test ${ac_cv_safe_to_define___extensions__+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# define __EXTENSIONS__ 1
$ac_includes_default
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_safe_to_define___extensions__=yes
else case e in #(
e) ac_cv_safe_to_define___extensions__=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5
printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; }
if test ${ac_cv_should_define__xopen_source+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_cv_should_define__xopen_source=no
if test $ac_cv_header_wchar_h = yes
then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
mbstate_t x;
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _XOPEN_SOURCE 500
#include
mbstate_t x;
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_should_define__xopen_source=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5
printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; }
printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h
printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h
printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h
printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h
printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h
printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h
printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_IEC_60559_EXT__ 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h
printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h
printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h
if test $ac_cv_header_minix_config_h = yes
then :
MINIX=yes
printf "%s\n" "#define _MINIX 1" >>confdefs.h
printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h
printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h
else case e in #(
e) MINIX= ;;
esac
fi
if test $ac_cv_safe_to_define___extensions__ = yes
then :
printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h
fi
if test $ac_cv_should_define__xopen_source = yes
then :
printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h
fi
# If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS
if test -n "$want_auto_cflags" ; then
AUTO_CFLAGS="-g ${GCC:+-O2}"
# STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security} ${GCC:+-Wno-tautological-constant-out-of-range-compare}"
STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security}"
fi
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
# Reject install programs that cannot install multiple files.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
printf %s "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
if test ${ac_cv_path_install+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
# Account for fact that we put trailing slashes in our PATH walk.
case $as_dir in #((
./ | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
rm -rf conftest.one conftest.two conftest.dir
echo one > conftest.one
echo two > conftest.two
mkdir conftest.dir
if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" &&
test -s conftest.one && test -s conftest.two &&
test -s conftest.dir/conftest.one &&
test -s conftest.dir/conftest.two
then
ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c"
break 3
fi
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
rm -rf conftest.one conftest.two conftest.dir
;;
esac
fi
if test ${ac_cv_path_install+y}; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
printf "%s\n" "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_AR+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$AR"; then
ac_cv_prog_AR="$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
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
printf "%s\n" "$AR" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_ac_ct_AR+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) 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
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
printf "%s\n" "$ac_ct_AR" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_ct_AR" = x; then
AR=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$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.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_RANLIB+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
printf "%s\n" "$RANLIB" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_ac_ct_RANLIB+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -n "$ac_ct_RANLIB"; then
ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi ;;
esac
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
printf "%s\n" "$ac_ct_RANLIB" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_ct_RANLIB" = x; then
RANLIB=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
RANLIB=$ac_ct_RANLIB
fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
MAKE_SHELL=/bin/sh
# codeset.m4 serial 5 (gettext-0.18.2)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
printf %s "checking for an ANSI C-conforming const... " >&6; }
if test ${ac_cv_c_const+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
#ifndef __cplusplus
/* Ultrix mips cc rejects this sort of thing. */
typedef int charset[2];
const charset cs = { 0, 0 };
/* SunOS 4.1.1 cc rejects this. */
char const *const *pcpcc;
char **ppc;
/* NEC SVR4.0.2 mips cc rejects this. */
struct point {int x, y;};
static struct point const zero = {0,0};
/* IBM XL C 1.02.0.0 rejects this.
It does not let you subtract one const X* pointer from another in
an arm of an if-expression whose if-part is not a constant
expression */
const char *g = "string";
pcpcc = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++pcpcc;
ppc = (char**) pcpcc;
pcpcc = (char const *const *) ppc;
{ /* SCO 3.2v4 cc rejects this sort of thing. */
char tx;
char *t = &tx;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
if (s) return 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
const int *foo = &x[0];
++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
typedef const int *iptr;
iptr p = 0;
++p;
}
{ /* IBM XL C 1.02.0.0 rejects this sort of thing, saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; } bx;
struct s *b = &bx; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
if (!foo) return 0;
}
return !cs[0] && !zero.x;
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_c_const=yes
else case e in #(
e) ac_cv_c_const=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
printf "%s\n" "$ac_cv_c_const" >&6; }
if test $ac_cv_c_const = no; then
printf "%s\n" "#define const /**/" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
printf %s "checking for inline... " >&6; }
if test ${ac_cv_c_inline+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
static $ac_kw foo_t static_foo (void) {return 0; }
$ac_kw foo_t foo (void) {return 0; }
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_c_inline=$ac_kw
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test "$ac_cv_c_inline" != no && break
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
printf "%s\n" "$ac_cv_c_inline" >&6; }
case $ac_cv_c_inline in
inline | yes) ;;
*)
case $ac_cv_c_inline in
no) ac_val=;;
*) ac_val=$ac_cv_c_inline;;
esac
cat >>confdefs.h <<_ACEOF
#ifndef __cplusplus
#define inline $ac_val
#endif
_ACEOF
;;
esac
if test "$ac_prog_cc_stdc" != no; then
printf "%s\n" "#define PROTOTYPES 1" >>confdefs.h
printf "%s\n" "#define __PROTOTYPES 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
printf %s "checking whether char is unsigned... " >&6; }
if test ${ac_cv_c_char_unsigned+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main (void)
{
static int test_array [1 - 2 * !(((char) -1) < 0)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_c_char_unsigned=no
else case e in #(
e) ac_cv_c_char_unsigned=yes ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5
printf "%s\n" "$ac_cv_c_char_unsigned" >&6; }
if test $ac_cv_c_char_unsigned = yes; then
printf "%s\n" "#define __CHAR_UNSIGNED__ 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
printf %s "checking for working volatile... " >&6; }
if test ${ac_cv_c_volatile+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
volatile int x;
int * volatile y = (int *) 0;
return !x && !y;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_c_volatile=yes
else case e in #(
e) ac_cv_c_volatile=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
printf "%s\n" "$ac_cv_c_volatile" >&6; }
if test $ac_cv_c_volatile = no; then
printf "%s\n" "#define volatile /**/" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
if test "x$ac_cv_type_size_t" = xyes
then :
else case e in #(
e)
printf "%s\n" "#define size_t unsigned int" >>confdefs.h
;;
esac
fi
ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
if test "x$ac_cv_type_ssize_t" = xyes
then :
else case e in #(
e)
printf "%s\n" "#define ssize_t int" >>confdefs.h
;;
esac
fi
ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
if test "x$ac_cv_type_mode_t" = xyes
then :
else case e in #(
e)
printf "%s\n" "#define mode_t int" >>confdefs.h
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
printf %s "checking whether stat file-mode macros are broken... " >&6; }
if test ${ac_cv_header_stat_broken+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if defined S_ISBLK && defined S_IFDIR
extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1];
#endif
#if defined S_ISBLK && defined S_IFCHR
extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1];
#endif
#if defined S_ISLNK && defined S_IFREG
extern char c3[S_ISLNK (S_IFREG) ? -1 : 1];
#endif
#if defined S_ISSOCK && defined S_IFREG
extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1];
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_header_stat_broken=no
else case e in #(
e) ac_cv_header_stat_broken=yes ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5
printf "%s\n" "$ac_cv_header_stat_broken" >&6; }
if test $ac_cv_header_stat_broken = yes; then
printf "%s\n" "#define STAT_MACROS_BROKEN 1" >>confdefs.h
fi
ac_header_dirent=no
for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | sed "$as_sed_sh"`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
printf %s "checking for $ac_hdr that defines DIR... " >&6; }
if eval test \${$as_ac_Header+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include <$ac_hdr>
int
main (void)
{
if ((DIR *) 0)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$as_ac_Header=yes"
else case e in #(
e) eval "$as_ac_Header=no" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
eval ac_res=\$$as_ac_Header
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Header"\" = x"yes"
then :
cat >>confdefs.h <<_ACEOF
#define `printf "%s\n" "HAVE_$ac_hdr" | sed "$as_sed_cpp"` 1
_ACEOF
ac_header_dirent=$ac_hdr; break
fi
done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
printf %s "checking for library containing opendir... " >&6; }
if test ${ac_cv_search_opendir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply.
The 'extern "C"' is for builds by C++ compilers;
although this is not generally supported in C code supporting it here
has little cost and some practical benefit (sr 110532). */
#ifdef __cplusplus
extern "C"
#endif
char opendir (void);
int
main (void)
{
return opendir ();
;
return 0;
}
_ACEOF
for ac_lib in '' dir
do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_search_opendir=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_opendir+y}
then :
break
fi
done
if test ${ac_cv_search_opendir+y}
then :
else case e in #(
e) ac_cv_search_opendir=no ;;
esac
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
printf "%s\n" "$ac_cv_search_opendir" >&6; }
ac_res=$ac_cv_search_opendir
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
printf %s "checking for library containing opendir... " >&6; }
if test ${ac_cv_search_opendir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply.
The 'extern "C"' is for builds by C++ compilers;
although this is not generally supported in C code supporting it here
has little cost and some practical benefit (sr 110532). */
#ifdef __cplusplus
extern "C"
#endif
char opendir (void);
int
main (void)
{
return opendir ();
;
return 0;
}
_ACEOF
for ac_lib in '' x
do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_search_opendir=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_opendir+y}
then :
break
fi
done
if test ${ac_cv_search_opendir+y}
then :
else case e in #(
e) ac_cv_search_opendir=no ;;
esac
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
printf "%s\n" "$ac_cv_search_opendir" >&6; }
ac_res=$ac_cv_search_opendir
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
fi
ac_fn_c_check_func "$LINENO" "fcntl" "ac_cv_func_fcntl"
if test "x$ac_cv_func_fcntl" = xyes
then :
printf "%s\n" "#define HAVE_FCNTL 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday"
if test "x$ac_cv_func_gettimeofday" = xyes
then :
printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "kill" "ac_cv_func_kill"
if test "x$ac_cv_func_kill" = xyes
then :
printf "%s\n" "#define HAVE_KILL 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "lstat" "ac_cv_func_lstat"
if test "x$ac_cv_func_lstat" = xyes
then :
printf "%s\n" "#define HAVE_LSTAT 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "pselect" "ac_cv_func_pselect"
if test "x$ac_cv_func_pselect" = xyes
then :
printf "%s\n" "#define HAVE_PSELECT 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "readlink" "ac_cv_func_readlink"
if test "x$ac_cv_func_readlink" = xyes
then :
printf "%s\n" "#define HAVE_READLINK 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select"
if test "x$ac_cv_func_select" = xyes
then :
printf "%s\n" "#define HAVE_SELECT 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "setitimer" "ac_cv_func_setitimer"
if test "x$ac_cv_func_setitimer" = xyes
then :
printf "%s\n" "#define HAVE_SETITIMER 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "fnmatch" "ac_cv_func_fnmatch"
if test "x$ac_cv_func_fnmatch" = xyes
then :
printf "%s\n" "#define HAVE_FNMATCH 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove"
if test "x$ac_cv_func_memmove" = xyes
then :
printf "%s\n" "#define HAVE_MEMMOVE 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv"
if test "x$ac_cv_func_putenv" = xyes
then :
printf "%s\n" "#define HAVE_PUTENV 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv"
if test "x$ac_cv_func_setenv" = xyes
then :
printf "%s\n" "#define HAVE_SETENV 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale"
if test "x$ac_cv_func_setlocale" = xyes
then :
printf "%s\n" "#define HAVE_SETLOCALE 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp"
if test "x$ac_cv_func_strcasecmp" = xyes
then :
printf "%s\n" "#define HAVE_STRCASECMP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "strpbrk" "ac_cv_func_strpbrk"
if test "x$ac_cv_func_strpbrk" = xyes
then :
printf "%s\n" "#define HAVE_STRPBRK 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf"
if test "x$ac_cv_func_sysconf" = xyes
then :
printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "tcgetattr" "ac_cv_func_tcgetattr"
if test "x$ac_cv_func_tcgetattr" = xyes
then :
printf "%s\n" "#define HAVE_TCGETATTR 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "tcgetwinsize" "ac_cv_func_tcgetwinsize"
if test "x$ac_cv_func_tcgetwinsize" = xyes
then :
printf "%s\n" "#define HAVE_TCGETWINSIZE 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "tcsetwinsize" "ac_cv_func_tcsetwinsize"
if test "x$ac_cv_func_tcsetwinsize" = xyes
then :
printf "%s\n" "#define HAVE_TCSETWINSIZE 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
if test "x$ac_cv_func_vsnprintf" = xyes
then :
printf "%s\n" "#define HAVE_VSNPRINTF 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "isascii" "ac_cv_func_isascii"
if test "x$ac_cv_func_isascii" = xyes
then :
printf "%s\n" "#define HAVE_ISASCII 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "isxdigit" "ac_cv_func_isxdigit"
if test "x$ac_cv_func_isxdigit" = xyes
then :
printf "%s\n" "#define HAVE_ISXDIGIT 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "getpwent" "ac_cv_func_getpwent"
if test "x$ac_cv_func_getpwent" = xyes
then :
printf "%s\n" "#define HAVE_GETPWENT 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "getpwnam" "ac_cv_func_getpwnam"
if test "x$ac_cv_func_getpwnam" = xyes
then :
printf "%s\n" "#define HAVE_GETPWNAM 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "getpwuid" "ac_cv_func_getpwuid"
if test "x$ac_cv_func_getpwuid" = xyes
then :
printf "%s\n" "#define HAVE_GETPWUID 1" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "uid_t" "ac_cv_type_uid_t" "$ac_includes_default"
if test "x$ac_cv_type_uid_t" = xyes
then :
else case e in #(
e)
printf "%s\n" "#define uid_t int" >>confdefs.h
;;
esac
fi
ac_fn_c_check_type "$LINENO" "gid_t" "ac_cv_type_gid_t" "$ac_includes_default"
if test "x$ac_cv_type_gid_t" = xyes
then :
else case e in #(
e)
printf "%s\n" "#define gid_t int" >>confdefs.h
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
printf %s "checking for working chown... " >&6; }
if test ${ac_cv_func_chown_works+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test "$cross_compiling" = yes
then :
case "$host_os" in # ((
# Guess yes on glibc systems.
*-gnu*) ac_cv_func_chown_works=yes ;;
# If we don't know, assume the worst.
*) ac_cv_func_chown_works=no ;;
esac
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#include
int
main (void)
{
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 case e in #(
e) ac_cv_func_chown_works=no ;;
esac
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
rm -f conftest.chown
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5
printf "%s\n" "$ac_cv_func_chown_works" >&6; }
if test $ac_cv_func_chown_works = yes; then
printf "%s\n" "#define HAVE_CHOWN 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5
printf %s "checking for working strcoll... " >&6; }
if test ${ac_cv_func_strcoll_works+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test "$cross_compiling" = yes
then :
case "$host_os" in # ((
# Guess yes on glibc systems.
*-gnu*) ac_cv_func_strcoll_works=yes ;;
# If we don't know, assume the worst.
*) ac_cv_func_strcoll_works=no ;;
esac
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main (void)
{
return (strcoll ("abc", "def") >= 0 ||
strcoll ("ABC", "DEF") >= 0 ||
strcoll ("123", "456") >= 0)
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"
then :
ac_cv_func_strcoll_works=yes
else case e in #(
e) ac_cv_func_strcoll_works=no ;;
esac
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcoll_works" >&5
printf "%s\n" "$ac_cv_func_strcoll_works" >&6; }
if test $ac_cv_func_strcoll_works = yes; then
printf "%s\n" "#define HAVE_STRCOLL 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default"
if test "x$ac_cv_header_fcntl_h" = xyes
then :
printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
if test "x$ac_cv_header_unistd_h" = xyes
then :
printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
if test "x$ac_cv_header_stdlib_h" = xyes
then :
printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default"
if test "x$ac_cv_header_varargs_h" = xyes
then :
printf "%s\n" "#define HAVE_VARARGS_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default"
if test "x$ac_cv_header_stdarg_h" = xyes
then :
printf "%s\n" "#define HAVE_STDARG_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default"
if test "x$ac_cv_header_stdbool_h" = xyes
then :
printf "%s\n" "#define HAVE_STDBOOL_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default"
if test "x$ac_cv_header_string_h" = xyes
then :
printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default"
if test "x$ac_cv_header_strings_h" = xyes
then :
printf "%s\n" "#define HAVE_STRINGS_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default"
if test "x$ac_cv_header_limits_h" = xyes
then :
printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default"
if test "x$ac_cv_header_locale_h" = xyes
then :
printf "%s\n" "#define HAVE_LOCALE_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default"
if test "x$ac_cv_header_pwd_h" = xyes
then :
printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "memory.h" "ac_cv_header_memory_h" "$ac_includes_default"
if test "x$ac_cv_header_memory_h" = xyes
then :
printf "%s\n" "#define HAVE_MEMORY_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "termcap.h" "ac_cv_header_termcap_h" "$ac_includes_default"
if test "x$ac_cv_header_termcap_h" = xyes
then :
printf "%s\n" "#define HAVE_TERMCAP_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default"
if test "x$ac_cv_header_termios_h" = xyes
then :
printf "%s\n" "#define HAVE_TERMIOS_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "termio.h" "ac_cv_header_termio_h" "$ac_includes_default"
if test "x$ac_cv_header_termio_h" = xyes
then :
printf "%s\n" "#define HAVE_TERMIO_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_ioctl_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "sys/pte.h" "ac_cv_header_sys_pte_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_pte_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_PTE_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "sys/stream.h" "ac_cv_header_sys_stream_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_stream_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_STREAM_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_select_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_time_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "sys/file.h" "ac_cv_header_sys_file_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_file_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_FILE_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "sys/ptem.h" "ac_cv_header_sys_ptem_h" "
#if HAVE_SYS_STREAM_H
# include
#endif
"
if test "x$ac_cv_header_sys_ptem_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_PTEM_H 1" >>confdefs.h
fi
# Check whether --enable-largefile was given.
if test ${enable_largefile+y}
then :
enableval=$enable_largefile;
fi
if test "$enable_largefile,$enable_year2038" != no,no
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable large file support" >&5
printf %s "checking for $CC option to enable large file support... " >&6; }
if test ${ac_cv_sys_largefile_opts+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_save_CC="$CC"
ac_opt_found=no
for ac_opt in "none needed" "-D_FILE_OFFSET_BITS=64" "-D_LARGE_FILES=1" "-n32"; do
if test x"$ac_opt" != x"none needed"
then :
CC="$ac_save_CC $ac_opt"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#ifndef FTYPE
# define FTYPE off_t
#endif
/* Check that FTYPE can represent 2**63 - 1 correctly.
We can't simply define LARGE_FTYPE to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31))
int FTYPE_is_large[(LARGE_FTYPE % 2147483629 == 721
&& LARGE_FTYPE % 2147483647 == 1)
? 1 : -1];
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
if test x"$ac_opt" = x"none needed"
then :
# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t.
CC="$CC -DFTYPE=ino_t"
if ac_fn_c_try_compile "$LINENO"
then :
else case e in #(
e) CC="$CC -D_FILE_OFFSET_BITS=64"
if ac_fn_c_try_compile "$LINENO"
then :
ac_opt='-D_FILE_OFFSET_BITS=64'
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
fi
ac_cv_sys_largefile_opts=$ac_opt
ac_opt_found=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test $ac_opt_found = no || break
done
CC="$ac_save_CC"
test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected" ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_opts" >&5
printf "%s\n" "$ac_cv_sys_largefile_opts" >&6; }
ac_have_largefile=yes
case $ac_cv_sys_largefile_opts in #(
"none needed") :
;; #(
"supported through gnulib") :
;; #(
"support not detected") :
ac_have_largefile=no ;; #(
"-D_FILE_OFFSET_BITS=64") :
printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h
;; #(
"-D_LARGE_FILES=1") :
printf "%s\n" "#define _LARGE_FILES 1" >>confdefs.h
;; #(
"-n32") :
CC="$CC -n32" ;; #(
*) :
as_fn_error $? "internal error: bad value for \$ac_cv_sys_largefile_opts" "$LINENO" 5 ;;
esac
if test "$enable_year2038" != no
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option for timestamps after 2038" >&5
printf %s "checking for $CC option for timestamps after 2038... " >&6; }
if test ${ac_cv_sys_year2038_opts+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_save_CPPFLAGS="$CPPFLAGS"
ac_opt_found=no
for ac_opt in "none needed" "-D_TIME_BITS=64" "-D__MINGW_USE_VC2005_COMPAT" "-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"; do
if test x"$ac_opt" != x"none needed"
then :
CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
/* Check that time_t can represent 2**32 - 1 correctly. */
#define LARGE_TIME_T \\
((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))
int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535
&& LARGE_TIME_T % 65537 == 0)
? 1 : -1];
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_year2038_opts="$ac_opt"
ac_opt_found=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test $ac_opt_found = no || break
done
CPPFLAGS="$ac_save_CPPFLAGS"
test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected" ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_year2038_opts" >&5
printf "%s\n" "$ac_cv_sys_year2038_opts" >&6; }
ac_have_year2038=yes
case $ac_cv_sys_year2038_opts in #(
"none needed") :
;; #(
"support not detected") :
ac_have_year2038=no ;; #(
"-D_TIME_BITS=64") :
printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h
;; #(
"-D__MINGW_USE_VC2005_COMPAT") :
printf "%s\n" "#define __MINGW_USE_VC2005_COMPAT 1" >>confdefs.h
;; #(
"-U_USE_32_BIT_TIME_T"*) :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error $? "the 'time_t' type is currently forced to be 32-bit. It
will stop working after mid-January 2038. Remove
_USE_32BIT_TIME_T from the compiler flags.
See 'config.log' for more details" "$LINENO" 5; } ;; #(
*) :
as_fn_error $? "internal error: bad value for \$ac_cv_sys_year2038_opts" "$LINENO" 5 ;;
esac
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for type of signal functions" >&5
printf %s "checking for type of signal functions... " >&6; }
if test ${bash_cv_signal_vintage+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
if test ${bash_cv_posix_signals+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
sigset_t ss;
struct sigaction sa;
sigemptyset(&ss); sigsuspend(&ss);
sigaction(SIGINT, &sa, (struct sigaction *) 0);
sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
bash_cv_posix_signals=yes
else case e in #(
e) bash_cv_posix_signals=no
;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
if test $bash_cv_posix_signals = yes; then
bash_cv_signal_vintage=posix
else
if test ${bash_cv_bsd_signals+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
int mask = sigmask(SIGINT);
sigsetmask(mask); sigblock(mask); sigpause(mask);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
bash_cv_bsd_signals=yes
else case e in #(
e) bash_cv_bsd_signals=no
;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
if test $bash_cv_bsd_signals = yes; then
bash_cv_signal_vintage=4.2bsd
else
if test ${bash_cv_sysv_signals+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
void foo() { }
int
main (void)
{
int mask = sigmask(SIGINT);
sigset(SIGINT, foo); sigrelse(SIGINT);
sighold(SIGINT); sigpause(SIGINT);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
bash_cv_sysv_signals=yes
else case e in #(
e) bash_cv_sysv_signals=no
;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
if test $bash_cv_sysv_signals = yes; then
bash_cv_signal_vintage=svr3
else
bash_cv_signal_vintage=v7
fi
fi
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_signal_vintage" >&5
printf "%s\n" "$bash_cv_signal_vintage" >&6; }
if test "$bash_cv_signal_vintage" = posix; then
printf "%s\n" "#define HAVE_POSIX_SIGNALS 1" >>confdefs.h
elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
printf "%s\n" "#define HAVE_BSD_SIGNALS 1" >>confdefs.h
elif test "$bash_cv_signal_vintage" = svr3; then
printf "%s\n" "#define HAVE_USG_SIGHOLD 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if signal handlers must be reinstalled when invoked" >&5
printf %s "checking if signal handlers must be reinstalled when invoked... " >&6; }
if test ${bash_cv_must_reinstall_sighandlers+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test "$cross_compiling" = yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5
printf "%s\n" "$as_me: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&2;}
bash_cv_must_reinstall_sighandlers=no
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#ifdef HAVE_UNISTD_H
#include
#endif
#include
typedef void sigfunc(int);
volatile int nsigint;
#ifdef HAVE_POSIX_SIGNALS
sigfunc *
set_signal_handler(int sig, sigfunc *handler)
{
struct sigaction act, oact;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset (&act.sa_mask);
sigemptyset (&oact.sa_mask);
sigaction (sig, &act, &oact);
return (oact.sa_handler);
}
#else
#define set_signal_handler(s, h) signal(s, h)
#endif
void
sigint(int s)
{
nsigint++;
}
int
main()
{
nsigint = 0;
set_signal_handler(SIGINT, sigint);
kill((int)getpid(), SIGINT);
kill((int)getpid(), SIGINT);
exit(nsigint != 2);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"
then :
bash_cv_must_reinstall_sighandlers=no
else case e in #(
e) bash_cv_must_reinstall_sighandlers=yes ;;
esac
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_must_reinstall_sighandlers" >&5
printf "%s\n" "$bash_cv_must_reinstall_sighandlers" >&6; }
if test $bash_cv_must_reinstall_sighandlers = yes; then
printf "%s\n" "#define MUST_REINSTALL_SIGHANDLERS 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
printf %s "checking for presence of POSIX-style sigsetjmp/siglongjmp... " >&6; }
if test ${bash_cv_func_sigsetjmp+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test "$cross_compiling" = yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to $bash_cv_posix_signals" >&5
printf "%s\n" "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to $bash_cv_posix_signals" >&2;}
if test "$bash_cv_posix_signals" = "yes" ; then
bash_cv_func_sigsetjmp=present
else
bash_cv_func_sigsetjmp=missing
fi
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef HAVE_UNISTD_H
#include
#endif
#include
#include
#include
#include
int
main()
{
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
exit (1);
#else
int code;
sigset_t set, oset, nset;
sigjmp_buf xx;
/* get the mask */
sigemptyset(&set);
sigemptyset(&oset);
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
/* paranoia -- make sure SIGINT is not blocked */
sigdelset (&oset, SIGINT);
sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
/* save it */
code = sigsetjmp(xx, 1);
if (code)
{
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &nset);
/* could compare nset to oset here, but we just look for SIGINT */
if (sigismember (&nset, SIGINT))
exit(1);
exit(0);
}
/* change it so that SIGINT is blocked */
sigaddset(&set, SIGINT);
sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
/* and siglongjmp */
siglongjmp(xx, 10);
exit(1);
#endif
}
_ACEOF
if ac_fn_c_try_run "$LINENO"
then :
bash_cv_func_sigsetjmp=present
else case e in #(
e) bash_cv_func_sigsetjmp=missing ;;
esac
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_sigsetjmp" >&5
printf "%s\n" "$bash_cv_func_sigsetjmp" >&6; }
if test $bash_cv_func_sigsetjmp = present; then
printf "%s\n" "#define HAVE_POSIX_SIGSETJMP 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lstat" >&5
printf %s "checking for lstat... " >&6; }
if test ${bash_cv_func_lstat+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main (void)
{
lstat(".",(struct stat *)0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
bash_cv_func_lstat=yes
else case e in #(
e) bash_cv_func_lstat=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_lstat" >&5
printf "%s\n" "$bash_cv_func_lstat" >&6; }
if test $bash_cv_func_lstat = yes; then
printf "%s\n" "#define HAVE_LSTAT 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether or not strcoll and strcmp differ" >&5
printf %s "checking whether or not strcoll and strcmp differ... " >&6; }
if test ${bash_cv_func_strcoll_broken+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test "$cross_compiling" = yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5
printf "%s\n" "$as_me: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&2;}
bash_cv_func_strcoll_broken=no
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#if defined (HAVE_LOCALE_H)
#include
#endif
#include
#include
int
main(int c, char **v)
{
int r1, r2;
char *deflocale, *defcoll;
#ifdef HAVE_SETLOCALE
deflocale = setlocale(LC_ALL, "");
defcoll = setlocale(LC_COLLATE, "");
#endif
#ifdef HAVE_STRCOLL
/* These two values are taken from tests/glob-test. */
r1 = strcoll("abd", "aXd");
#else
r1 = 0;
#endif
r2 = strcmp("abd", "aXd");
/* These two should both be greater than 0. It is permissible for
a system to return different values, as long as the sign is the
same. */
/* Exit with 1 (failure) if these two values are both > 0, since
this tests whether strcoll(3) is broken with respect to strcmp(3)
in the default locale. */
exit (r1 > 0 && r2 > 0);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"
then :
bash_cv_func_strcoll_broken=yes
else case e in #(
e) bash_cv_func_strcoll_broken=no ;;
esac
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strcoll_broken" >&5
printf "%s\n" "$bash_cv_func_strcoll_broken" >&6; }
if test $bash_cv_func_strcoll_broken = yes; then
printf "%s\n" "#define STRCOLL_BROKEN 1" >>confdefs.h
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
printf %s "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if test ${ac_cv_prog_CPP+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) # Double quotes because $CC needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"
then :
else case e in #(
e) # Broken: fails on valid input.
continue ;;
esac
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"
then :
# Broken: success on invalid input.
continue
else case e in #(
e) # Passes both tests.
ac_preproc_ok=:
break ;;
esac
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok
then :
break
fi
done
ac_cv_prog_CPP=$CPP
;;
esac
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
printf "%s\n" "$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"
then :
else case e in #(
e) # Broken: fails on valid input.
continue ;;
esac
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"
then :
# Broken: success on invalid input.
continue
else case e in #(
e) # Passes both tests.
ac_preproc_ok=:
break ;;
esac
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok
then :
else case e in #(
e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See 'config.log' for more details" "$LINENO" 5; } ;;
esac
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep -e" >&5
printf %s "checking for egrep -e... " >&6; }
if test ${ac_cv_path_EGREP_TRADITIONAL+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if test -z "$EGREP_TRADITIONAL"; then
ac_path_EGREP_TRADITIONAL_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_prog in grep ggrep
do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue
# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found.
# Check for GNU $ac_path_EGREP_TRADITIONAL
case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #(
*GNU*)
ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;;
#(
*)
ac_count=0
printf %s 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl"
"$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL"
ac_path_EGREP_TRADITIONAL_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_EGREP_TRADITIONAL_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then
:
fi
else
ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL
fi
if test "$ac_cv_path_EGREP_TRADITIONAL"
then :
ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E"
else case e in #(
e) if test -z "$EGREP_TRADITIONAL"; then
ac_path_EGREP_TRADITIONAL_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_prog in egrep
do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue
# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found.
# Check for GNU $ac_path_EGREP_TRADITIONAL
case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #(
*GNU*)
ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;;
#(
*)
ac_count=0
printf %s 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl"
"$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL"
ac_path_EGREP_TRADITIONAL_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_EGREP_TRADITIONAL_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then
as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL
fi
;;
esac
fi ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5
printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; }
EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getpw functions are declared in pwd.h" >&5
printf %s "checking whether getpw functions are declared in pwd.h... " >&6; }
if test ${bash_cv_getpw_declared+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#ifdef HAVE_UNISTD_H
# include
#endif
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP_TRADITIONAL "getpwuid" >/dev/null 2>&1
then :
bash_cv_getpw_declared=yes
else case e in #(
e) bash_cv_getpw_declared=no ;;
esac
fi
rm -rf conftest*
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_getpw_declared" >&5
printf "%s\n" "$bash_cv_getpw_declared" >&6; }
if test $bash_cv_getpw_declared = yes; then
printf "%s\n" "#define HAVE_GETPW_DECLS 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether termios.h defines TIOCGWINSZ" >&5
printf %s "checking whether termios.h defines TIOCGWINSZ... " >&6; }
if test ${ac_cv_sys_tiocgwinsz_in_termios_h+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#include
const int tiocgwinsz = TIOCGWINSZ;
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_tiocgwinsz_in_termios_h=yes
else case e in #(
e) ac_cv_sys_tiocgwinsz_in_termios_h=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5
printf "%s\n" "$ac_cv_sys_tiocgwinsz_in_termios_h" >&6; }
if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5
printf %s "checking whether sys/ioctl.h defines TIOCGWINSZ... " >&6; }
if test ${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#include
const int tiocgwinsz = TIOCGWINSZ;
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes
else case e in #(
e) ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5
printf "%s\n" "$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6; }
if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
printf "%s\n" "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h
fi
fi
ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default"
if test "x$ac_cv_header_inttypes_h" = xyes
then :
printf "%s\n" "#define HAVE_INTTYPES_H 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sig_atomic_t in signal.h" >&5
printf %s "checking for sig_atomic_t in signal.h... " >&6; }
if test ${ac_cv_have_sig_atomic_t+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
sig_atomic_t x;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_have_sig_atomic_t=yes
else case e in #(
e) ac_cv_have_sig_atomic_t=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_sig_atomic_t" >&5
printf "%s\n" "$ac_cv_have_sig_atomic_t" >&6; }
if test "$ac_cv_have_sig_atomic_t" = "no"
then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sig_atomic_t" >&5
printf %s "checking for sig_atomic_t... " >&6; }
if test ${bash_cv_type_sig_atomic_t+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#if HAVE_STDLIB_H
#include
#endif
#if HAVE_STDDEF_H
#include
#endif
#if HAVE_INTTYPES_H
#include
#endif
#if HAVE_STDINT_H
#include
#endif
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP_TRADITIONAL "sig_atomic_t" >/dev/null 2>&1
then :
bash_cv_type_sig_atomic_t=yes
else case e in #(
e) bash_cv_type_sig_atomic_t=no ;;
esac
fi
rm -rf conftest*
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_sig_atomic_t" >&5
printf "%s\n" "$bash_cv_type_sig_atomic_t" >&6; }
if test $bash_cv_type_sig_atomic_t = no; then
printf "%s\n" "#define sig_atomic_t int" >>confdefs.h
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TIOCSTAT in sys/ioctl.h" >&5
printf %s "checking for TIOCSTAT in sys/ioctl.h... " >&6; }
if test ${bash_cv_tiocstat_in_ioctl+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main (void)
{
int x = TIOCSTAT;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
bash_cv_tiocstat_in_ioctl=yes
else case e in #(
e) bash_cv_tiocstat_in_ioctl=no
;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_tiocstat_in_ioctl" >&5
printf "%s\n" "$bash_cv_tiocstat_in_ioctl" >&6; }
if test $bash_cv_tiocstat_in_ioctl = yes; then
printf "%s\n" "#define TIOCSTAT_IN_SYS_IOCTL 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FIONREAD in sys/ioctl.h" >&5
printf %s "checking for FIONREAD in sys/ioctl.h... " >&6; }
if test ${bash_cv_fionread_in_ioctl+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main (void)
{
int x = FIONREAD;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
bash_cv_fionread_in_ioctl=yes
else case e in #(
e) bash_cv_fionread_in_ioctl=no
;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_fionread_in_ioctl" >&5
printf "%s\n" "$bash_cv_fionread_in_ioctl" >&6; }
if test $bash_cv_fionread_in_ioctl = yes; then
printf "%s\n" "#define FIONREAD_IN_SYS_IOCTL 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for speed_t in sys/types.h" >&5
printf %s "checking for speed_t in sys/types.h... " >&6; }
if test ${bash_cv_speed_t_in_sys_types+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
speed_t x;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
bash_cv_speed_t_in_sys_types=yes
else case e in #(
e) bash_cv_speed_t_in_sys_types=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_speed_t_in_sys_types" >&5
printf "%s\n" "$bash_cv_speed_t_in_sys_types" >&6; }
if test $bash_cv_speed_t_in_sys_types = yes; then
printf "%s\n" "#define SPEED_T_IN_SYS_TYPES 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct winsize in sys/ioctl.h and termios.h" >&5
printf %s "checking for struct winsize in sys/ioctl.h and termios.h... " >&6; }
if test ${bash_cv_struct_winsize_header+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
if test ${bash_cv_struct_winsize_ioctl+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main (void)
{
struct winsize x;
if (sizeof (x) > 0) return (0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
bash_cv_struct_winsize_ioctl=yes
else case e in #(
e) bash_cv_struct_winsize_ioctl=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
;;
esac
fi
if test ${bash_cv_struct_winsize_termios+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main (void)
{
struct winsize x;
if (sizeof (x) > 0) return (0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
bash_cv_struct_winsize_termios=yes
else case e in #(
e) bash_cv_struct_winsize_termios=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
;;
esac
fi
if test $bash_cv_struct_winsize_ioctl = yes; then
bash_cv_struct_winsize_header=ioctl_h
elif test $bash_cv_struct_winsize_termios = yes; then
bash_cv_struct_winsize_header=termios_h
else
bash_cv_struct_winsize_header=other
fi
;;
esac
fi
if test $bash_cv_struct_winsize_header = ioctl_h; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: sys/ioctl.h" >&5
printf "%s\n" "sys/ioctl.h" >&6; }
printf "%s\n" "#define STRUCT_WINSIZE_IN_SYS_IOCTL 1" >>confdefs.h
elif test $bash_cv_struct_winsize_header = termios_h; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: termios.h" >&5
printf "%s\n" "termios.h" >&6; }
printf "%s\n" "#define STRUCT_WINSIZE_IN_TERMIOS 1" >>confdefs.h
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
printf "%s\n" "not found" >&6; }
fi
ac_fn_c_check_member "$LINENO" "struct dirent" "d_ino" "ac_cv_member_struct_dirent_d_ino" "
#include
#include
#ifdef HAVE_UNISTD_H
# include
#endif /* HAVE_UNISTD_H */
#if defined(HAVE_DIRENT_H)
# include
#else
# define dirent direct
# ifdef HAVE_SYS_NDIR_H
# include
# endif /* SYSNDIR */
# ifdef HAVE_SYS_DIR_H
# include