readline-8.1.2/ 000755 000436 000120 00000000000 14165333754 013363 5 ustar 00chet admin 000000 000000 readline-8.1.2/rlshell.h 000664 000436 000120 00000002352 11130207321 015160 0 ustar 00chet admin 000000 000000 /* rlshell.h -- utility functions normally provided by bash. */
/* Copyright (C) 1999-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
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_SHELL_H_)
#define _RL_SHELL_H_
#include "rlstdc.h"
extern char *sh_single_quote PARAMS((char *));
extern void sh_set_lines_and_columns PARAMS((int, int));
extern char *sh_get_env_value PARAMS((const char *));
extern char *sh_get_home_dir PARAMS((void));
extern int sh_unset_nodelay_mode PARAMS((int));
#endif /* _RL_SHELL_H_ */
readline-8.1.2/rldefs.h 000664 000436 000120 00000011404 12211146044 014775 0 ustar 00chet admin 000000 000000 /* rldefs.h -- an attempt to isolate some of the system-specific defines
for readline. This should be included after any files that define
system-specific constants like _POSIX_VERSION or USG. */
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
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 (_RLDEFS_H_)
#define _RLDEFS_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#include "rlstdc.h"
#if defined (STRCOLL_BROKEN)
# undef HAVE_STRCOLL
#endif
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
# define TERMIOS_TTY_DRIVER
#else
# if defined (HAVE_TERMIO_H)
# define TERMIO_TTY_DRIVER
# else
# if !defined (__MINGW32__)
# define NEW_TTY_DRIVER
# else
# define NO_TTY_DRIVER
# endif
# endif
#endif
/* Posix macro to check file in statbuf for directory-ness.
This requires that be included before this test. */
#if defined (S_IFDIR) && !defined (S_ISDIR)
# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#endif
/* Decide which flavor of the header file describing the C library
string functions to include and include it. */
#if defined (HAVE_STRING_H)
# include
#else /* !HAVE_STRING_H */
# include
#endif /* !HAVE_STRING_H */
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
#if defined (PREFER_STDARG)
# include
#else
# if defined (PREFER_VARARGS)
# include
# endif
#endif
#if defined (HAVE_STRCASECMP)
#define _rl_stricmp strcasecmp
#define _rl_strnicmp strncasecmp
#else
extern int _rl_stricmp PARAMS((const char *, const char *));
extern int _rl_strnicmp PARAMS((const char *, const char *, int));
#endif
#if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE)
# define _rl_strpbrk(a,b) strpbrk((a),(b))
#else
extern char *_rl_strpbrk PARAMS((const char *, const char *));
#endif
#if !defined (emacs_mode)
# define no_mode -1
# define vi_mode 0
# define emacs_mode 1
#endif
#if !defined (RL_IM_INSERT)
# define RL_IM_INSERT 1
# define RL_IM_OVERWRITE 0
#
# define RL_IM_DEFAULT RL_IM_INSERT
#endif
/* If you cast map[key].function to type (Keymap) on a Cray,
the compiler takes the value of map[key].function and
divides it by 4 to convert between pointer types (pointers
to functions and pointers to structs are different sizes).
This is not what is wanted. */
#if defined (CRAY)
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data))
#else
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data)
#endif
#ifndef savestring
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
#endif
/* Possible values for _rl_bell_preference. */
#define NO_BELL 0
#define AUDIBLE_BELL 1
#define VISIBLE_BELL 2
/* Definitions used when searching the line for characters. */
/* NOTE: it is necessary that opposite directions are inverses */
#define FTO 1 /* forward to */
#define BTO -1 /* backward to */
#define FFIND 2 /* forward find */
#define BFIND -2 /* backward find */
/* Possible values for the found_quote flags word used by the completion
functions. It says what kind of (shell-like) quoting we found anywhere
in the line. */
#define RL_QF_SINGLE_QUOTE 0x01
#define RL_QF_DOUBLE_QUOTE 0x02
#define RL_QF_BACKSLASH 0x04
#define RL_QF_OTHER_QUOTE 0x08
/* Default readline line buffer length. */
#define DEFAULT_BUFFER_SIZE 256
#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 (RL_STRLEN)
# define RL_STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
#endif
#if !defined (FREE)
# define FREE(x) if (x) free (x)
#endif
#if !defined (SWAP)
# define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
#endif
/* CONFIGURATION SECTION */
#include "rlconf.h"
#endif /* !_RLDEFS_H_ */
readline-8.1.2/history.c 000644 000436 000120 00000036501 13055107175 015226 0 ustar 00chet admin 000000 000000 /* history.c -- standalone history library */
/* Copyright (C) 1989-2017 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 (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
#include
#include "history.h"
#include "histlib.h"
#include "xmalloc.h"
#if !defined (errno)
extern int errno;
#endif
/* How big to make the_history when we first allocate it. */
#define DEFAULT_HISTORY_INITIAL_SIZE 502
#define MAX_HISTORY_INITIAL_SIZE 8192
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
static char *hist_inittime PARAMS((void));
/* **************************************************************** */
/* */
/* History Functions */
/* */
/* **************************************************************** */
/* An array of HIST_ENTRY. This is where we store the history. */
static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;
/* Non-zero means that we have enforced a limit on the amount of
history that we save. */
static int history_stifled;
/* The current number of slots allocated to the input_history. */
static int history_size;
/* If HISTORY_STIFLED is non-zero, then this is the maximum number of
entries to remember. */
int history_max_entries;
int max_input_history; /* backwards compatibility */
/* The current location of the interactive history pointer. Just makes
life easier for outside callers. */
int history_offset;
/* The number of strings currently stored in the history list. */
int history_length;
/* The logical `base' of the history array. It defaults to 1. */
int history_base = 1;
/* Return the current HISTORY_STATE of the history. */
HISTORY_STATE *
history_get_history_state (void)
{
HISTORY_STATE *state;
state = (HISTORY_STATE *)xmalloc (sizeof (HISTORY_STATE));
state->entries = the_history;
state->offset = history_offset;
state->length = history_length;
state->size = history_size;
state->flags = 0;
if (history_stifled)
state->flags |= HS_STIFLED;
return (state);
}
/* Set the state of the current history array to STATE. */
void
history_set_history_state (HISTORY_STATE *state)
{
the_history = state->entries;
history_offset = state->offset;
history_length = state->length;
history_size = state->size;
if (state->flags & HS_STIFLED)
history_stifled = 1;
}
/* Begin a session in which the history functions might be used. This
initializes interactive variables. */
void
using_history (void)
{
history_offset = history_length;
}
/* Return the number of bytes that the primary history entries are using.
This just adds up the lengths of the_history->lines and the associated
timestamps. */
int
history_total_bytes (void)
{
register int i, result;
for (i = result = 0; the_history && the_history[i]; i++)
result += HISTENT_BYTES (the_history[i]);
return (result);
}
/* Returns the magic number which says what history element we are
looking at now. In this implementation, it returns history_offset. */
int
where_history (void)
{
return (history_offset);
}
/* Make the current history item be the one at POS, an absolute index.
Returns zero if POS is out of range, else non-zero. */
int
history_set_pos (int pos)
{
if (pos > history_length || pos < 0 || !the_history)
return (0);
history_offset = pos;
return (1);
}
/* Return the current history array. The caller has to be careful, since this
is the actual array of data, and could be bashed or made corrupt easily.
The array is terminated with a NULL pointer. */
HIST_ENTRY **
history_list (void)
{
return (the_history);
}
/* Return the history entry at the current position, as determined by
history_offset. If there is no entry there, return a NULL pointer. */
HIST_ENTRY *
current_history (void)
{
return ((history_offset == history_length) || the_history == 0)
? (HIST_ENTRY *)NULL
: the_history[history_offset];
}
/* Back up history_offset to the previous history entry, and return
a pointer to that entry. If there is no previous entry then return
a NULL pointer. */
HIST_ENTRY *
previous_history (void)
{
return history_offset ? the_history[--history_offset] : (HIST_ENTRY *)NULL;
}
/* Move history_offset forward to the next history entry, and return
a pointer to that entry. If there is no next entry then return a
NULL pointer. */
HIST_ENTRY *
next_history (void)
{
return (history_offset == history_length) ? (HIST_ENTRY *)NULL : the_history[++history_offset];
}
/* Return the history entry which is logically at OFFSET in the history array.
OFFSET is relative to history_base. */
HIST_ENTRY *
history_get (int offset)
{
int local_index;
local_index = offset - history_base;
return (local_index >= history_length || local_index < 0 || the_history == 0)
? (HIST_ENTRY *)NULL
: the_history[local_index];
}
HIST_ENTRY *
alloc_history_entry (char *string, char *ts)
{
HIST_ENTRY *temp;
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
temp->line = string ? savestring (string) : string;
temp->data = (char *)NULL;
temp->timestamp = ts;
return temp;
}
time_t
history_get_time (HIST_ENTRY *hist)
{
char *ts;
time_t t;
if (hist == 0 || hist->timestamp == 0)
return 0;
ts = hist->timestamp;
if (ts[0] != history_comment_char)
return 0;
errno = 0;
t = (time_t) strtol (ts + 1, (char **)NULL, 10); /* XXX - should use strtol() here */
if (errno == ERANGE)
return (time_t)0;
return t;
}
static char *
hist_inittime (void)
{
time_t t;
char ts[64], *ret;
t = (time_t) time ((time_t *)0);
#if defined (HAVE_VSNPRINTF) /* assume snprintf if vsnprintf exists */
snprintf (ts, sizeof (ts) - 1, "X%lu", (unsigned long) t);
#else
sprintf (ts, "X%lu", (unsigned long) t);
#endif
ret = savestring (ts);
ret[0] = history_comment_char;
return ret;
}
/* Place STRING at the end of the history list. The data field
is set to NULL. */
void
add_history (const char *string)
{
HIST_ENTRY *temp;
int new_length;
if (history_stifled && (history_length == history_max_entries))
{
register int i;
/* If the history is stifled, and history_length is zero,
and it equals history_max_entries, we don't save items. */
if (history_length == 0)
return;
/* If there is something in the slot, then remove it. */
if (the_history[0])
(void) free_history_entry (the_history[0]);
/* Copy the rest of the entries, moving down one slot. Copy includes
trailing NULL. */
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
new_length = history_length;
history_base++;
}
else
{
if (history_size == 0)
{
if (history_stifled && history_max_entries > 0)
history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
? MAX_HISTORY_INITIAL_SIZE
: history_max_entries + 2;
else
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
new_length = 1;
}
else
{
if (history_length == (history_size - 1))
{
history_size += DEFAULT_HISTORY_GROW_SIZE;
the_history = (HIST_ENTRY **)
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
}
new_length = history_length + 1;
}
}
temp = alloc_history_entry ((char *)string, hist_inittime ());
the_history[new_length] = (HIST_ENTRY *)NULL;
the_history[new_length - 1] = temp;
history_length = new_length;
}
/* Change the time stamp of the most recent history entry to STRING. */
void
add_history_time (const char *string)
{
HIST_ENTRY *hs;
if (string == 0 || history_length < 1)
return;
hs = the_history[history_length - 1];
FREE (hs->timestamp);
hs->timestamp = savestring (string);
}
/* Free HIST and return the data so the calling application can free it
if necessary and desired. */
histdata_t
free_history_entry (HIST_ENTRY *hist)
{
histdata_t x;
if (hist == 0)
return ((histdata_t) 0);
FREE (hist->line);
FREE (hist->timestamp);
x = hist->data;
xfree (hist);
return (x);
}
HIST_ENTRY *
copy_history_entry (HIST_ENTRY *hist)
{
HIST_ENTRY *ret;
char *ts;
if (hist == 0)
return hist;
ret = alloc_history_entry (hist->line, (char *)NULL);
ts = hist->timestamp ? savestring (hist->timestamp) : hist->timestamp;
ret->timestamp = ts;
ret->data = hist->data;
return ret;
}
/* Make the history entry at WHICH have LINE and DATA. This returns
the old entry so you can dispose of the data. In the case of an
invalid WHICH, a NULL pointer is returned. */
HIST_ENTRY *
replace_history_entry (int which, const char *line, histdata_t data)
{
HIST_ENTRY *temp, *old_value;
if (which < 0 || which >= history_length)
return ((HIST_ENTRY *)NULL);
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
old_value = the_history[which];
temp->line = savestring (line);
temp->data = data;
temp->timestamp = savestring (old_value->timestamp);
the_history[which] = temp;
return (old_value);
}
/* Append LINE to the history line at offset WHICH, adding a newline to the
end of the current line first. This can be used to construct multi-line
history entries while reading lines from the history file. */
void
_hs_append_history_line (int which, const char *line)
{
HIST_ENTRY *hent;
size_t newlen, curlen, minlen;
char *newline;
hent = the_history[which];
curlen = strlen (hent->line);
minlen = curlen + strlen (line) + 2; /* min space needed */
if (curlen > 256) /* XXX - for now */
{
newlen = 512; /* now realloc in powers of 2 */
/* we recalcluate every time; the operations are cheap */
while (newlen < minlen)
newlen <<= 1;
}
else
newlen = minlen;
/* Assume that realloc returns the same pointer and doesn't try a new
alloc/copy if the new size is the same as the one last passed. */
newline = realloc (hent->line, newlen);
if (newline)
{
hent->line = newline;
hent->line[curlen++] = '\n';
strcpy (hent->line + curlen, line);
}
}
/* Replace the DATA in the specified history entries, replacing OLD with
NEW. WHICH says which one(s) to replace: WHICH == -1 means to replace
all of the history entries where entry->data == OLD; WHICH == -2 means
to replace the `newest' history entry where entry->data == OLD; and
WHICH >= 0 means to replace that particular history entry's data, as
long as it matches OLD. */
void
_hs_replace_history_data (int which, histdata_t *old, histdata_t *new)
{
HIST_ENTRY *entry;
register int i, last;
if (which < -2 || which >= history_length || history_length == 0 || the_history == 0)
return;
if (which >= 0)
{
entry = the_history[which];
if (entry && entry->data == old)
entry->data = new;
return;
}
last = -1;
for (i = 0; i < history_length; i++)
{
entry = the_history[i];
if (entry == 0)
continue;
if (entry->data == old)
{
last = i;
if (which == -1)
entry->data = new;
}
}
if (which == -2 && last >= 0)
{
entry = the_history[last];
entry->data = new; /* XXX - we don't check entry->old */
}
}
/* Remove history element WHICH from the history. The removed
element is returned to you so you can free the line, data,
and containing structure. */
HIST_ENTRY *
remove_history (int which)
{
HIST_ENTRY *return_value;
register int i;
#if 1
int nentries;
HIST_ENTRY **start, **end;
#endif
if (which < 0 || which >= history_length || history_length == 0 || the_history == 0)
return ((HIST_ENTRY *)NULL);
return_value = the_history[which];
#if 1
/* Copy the rest of the entries, moving down one slot. Copy includes
trailing NULL. */
nentries = history_length - which;
start = the_history + which;
end = start + 1;
memmove (start, end, nentries * sizeof (HIST_ENTRY *));
#else
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
#endif
history_length--;
return (return_value);
}
HIST_ENTRY **
remove_history_range (int first, int last)
{
HIST_ENTRY **return_value;
register int i;
int nentries;
HIST_ENTRY **start, **end;
if (the_history == 0 || history_length == 0)
return ((HIST_ENTRY **)NULL);
if (first < 0 || first >= history_length || last < 0 || last >= history_length)
return ((HIST_ENTRY **)NULL);
if (first > last)
return (HIST_ENTRY **)NULL;
nentries = last - first + 1;
return_value = (HIST_ENTRY **)malloc ((nentries + 1) * sizeof (HIST_ENTRY *));
if (return_value == 0)
return return_value;
/* Return all the deleted entries in a list */
for (i = first ; i <= last; i++)
return_value[i - first] = the_history[i];
return_value[i - first] = (HIST_ENTRY *)NULL;
/* Copy the rest of the entries, moving down NENTRIES slots. Copy includes
trailing NULL. */
start = the_history + first;
end = the_history + last + 1;
memmove (start, end, (history_length - last) * sizeof (HIST_ENTRY *));
history_length -= nentries;
return (return_value);
}
/* Stifle the history list, remembering only MAX number of lines. */
void
stifle_history (int max)
{
register int i, j;
if (max < 0)
max = 0;
if (history_length > max)
{
/* This loses because we cannot free the data. */
for (i = 0, j = history_length - max; i < j; i++)
free_history_entry (the_history[i]);
history_base = i;
for (j = 0, i = history_length - max; j < max; i++, j++)
the_history[j] = the_history[i];
the_history[j] = (HIST_ENTRY *)NULL;
history_length = j;
}
history_stifled = 1;
max_input_history = history_max_entries = max;
}
/* Stop stifling the history. This returns the previous maximum
number of history entries. The value is positive if the history
was stifled, negative if it wasn't. */
int
unstifle_history (void)
{
if (history_stifled)
{
history_stifled = 0;
return (history_max_entries);
}
else
return (-history_max_entries);
}
int
history_is_stifled (void)
{
return (history_stifled);
}
void
clear_history (void)
{
register int i;
/* This loses because we cannot free the data. */
for (i = 0; i < history_length; i++)
{
free_history_entry (the_history[i]);
the_history[i] = (HIST_ENTRY *)NULL;
}
history_offset = history_length = 0;
history_base = 1; /* reset history base to default */
}
readline-8.1.2/histlib.h 000664 000436 000120 00000004665 13116054674 015203 0 ustar 00chet admin 000000 000000 /* histlib.h -- internal definitions for the history library. */
/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
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
#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
# if !defined (strchr) && !defined (__STDC__)
extern char *strchr ();
# endif /* !strchr && !__STDC__ */
#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
/* 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 PARAMS((const char *, int, int));
#endif /* !_HISTLIB_H_ */
readline-8.1.2/display.c 000644 000436 000024 00000342424 14165333754 015223 0 ustar 00chet staff 000000 000000 /* display.c -- readline redisplay facility. */
/* Copyright (C) 1987-2020 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
#if defined (HAVE_UNISTD_H)
# include
#endif /* HAVE_UNISTD_H */
#include "posixstat.h"
#if defined (HAVE_STDLIB_H)
# include
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
#include
#ifdef __MSDOS__
# include
#endif
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "rlmbutil.h"
/* Termcap library stuff. */
#include "tcap.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
static void putc_face PARAMS((int, int, char *));
static void puts_face PARAMS((const char *, const char *, int));
static void norm_face PARAMS((char *, int));
static void update_line PARAMS((char *, char *, char *, char *, int, int, int, int));
static void space_to_eol PARAMS((int));
static void delete_chars PARAMS((int));
static void insert_some_chars PARAMS((char *, int, int));
static void open_some_spaces PARAMS((int));
static void cr PARAMS((void));
static void redraw_prompt PARAMS((char *));
static void _rl_move_cursor_relative PARAMS((int, const char *, const char *));
/* Values for FLAGS */
#define PMT_MULTILINE 0x01
static char *expand_prompt PARAMS((char *, int, int *, int *, int *, int *));
#define DEFAULT_LINE_BUFFER_SIZE 1024
/* State of visible and invisible lines. */
struct line_state
{
char *line;
char *lface;
int *lbreaks;
int lbsize;
#if defined (HANDLE_MULTIBYTE)
int wbsize;
int *wrapped_line;
#endif
};
/* The line display buffers. One is the line currently displayed on
the screen. The other is the line about to be displayed. */
static struct line_state line_state_array[2];
static struct line_state *line_state_visible = &line_state_array[0];
static struct line_state *line_state_invisible = &line_state_array[1];
static int line_structures_initialized = 0;
/* Backwards-compatible names. */
#define inv_lbreaks (line_state_invisible->lbreaks)
#define inv_lbsize (line_state_invisible->lbsize)
#define vis_lbreaks (line_state_visible->lbreaks)
#define vis_lbsize (line_state_visible->lbsize)
#define visible_line (line_state_visible->line)
#define vis_face (line_state_visible->lface)
#define invisible_line (line_state_invisible->line)
#define inv_face (line_state_invisible->lface)
#if defined (HANDLE_MULTIBYTE)
static int _rl_col_width PARAMS((const char *, int, int, int));
#else
# define _rl_col_width(l, s, e, f) (((e) <= (s)) ? 0 : (e) - (s))
#endif
/* Heuristic used to decide whether it is faster to move from CUR to NEW
by backing up or outputting a carriage return and moving forward. CUR
and NEW are either both buffer positions or absolute screen positions. */
#define CR_FASTER(new, cur) (((new) + 1) < ((cur) - (new)))
/* _rl_last_c_pos is an absolute cursor position in multibyte locales and a
buffer index in others. This macro is used when deciding whether the
current cursor position is in the middle of a prompt string containing
invisible characters. XXX - might need to take `modmark' into account. */
/* XXX - only valid when tested against _rl_last_c_pos; buffer indices need
to use prompt_last_invisible directly. */
#define PROMPT_ENDING_INDEX \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
#define FACE_NORMAL '0'
#define FACE_STANDOUT '1'
#define FACE_INVALID ((char)1)
/* **************************************************************** */
/* */
/* Display stuff */
/* */
/* **************************************************************** */
/* This is the stuff that is hard for me. I never seem to write good
display routines in C. Let's see how I do this time. */
/* (PWP) Well... Good for a simple line updater, but totally ignores
the problems of input lines longer than the screen width.
update_line and the code that calls it makes a multiple line,
automatically wrapping line update. Careful attention needs
to be paid to the vertical position variables. */
/* Keep two buffers; one which reflects the current contents of the
screen, and the other to draw what we think the new contents should
be. Then compare the buffers, and make whatever changes to the
screen itself that we should. Finally, make the buffer that we
just drew into be the one which reflects the current contents of the
screen, and place the cursor where it belongs.
Commands that want to can fix the display themselves, and then let
this function know that the display has been fixed by setting the
RL_DISPLAY_FIXED variable. This is good for efficiency. */
/* Application-specific redisplay function. */
rl_voidfunc_t *rl_redisplay_function = rl_redisplay;
/* Global variables declared here. */
/* What YOU turn on when you have handled all redisplay yourself. */
int rl_display_fixed = 0;
/* The stuff that gets printed out before the actual text of the line.
This is usually pointing to rl_prompt. */
char *rl_display_prompt = (char *)NULL;
/* Variables used to include the editing mode in the prompt. */
char *_rl_emacs_mode_str;
int _rl_emacs_modestr_len;
char *_rl_vi_ins_mode_str;
int _rl_vi_ins_modestr_len;
char *_rl_vi_cmd_mode_str;
int _rl_vi_cmd_modestr_len;
/* Pseudo-global variables declared here. */
/* Hints for other parts of readline to give to the display engine. */
int _rl_suppress_redisplay = 0;
int _rl_want_redisplay = 0;
/* The visible cursor position. If you print some text, adjust this. */
/* NOTE: _rl_last_c_pos is used as a buffer index when not in a locale
supporting multibyte characters, and an absolute cursor position when
in such a locale. This is an artifact of the donated multibyte support.
Care must be taken when modifying its value. */
int _rl_last_c_pos = 0;
int _rl_last_v_pos = 0;
/* Number of physical lines consumed by the current line buffer currently
on screen minus 1. */
int _rl_vis_botlin = 0;
static int _rl_quick_redisplay = 0;
/* This is a hint update_line gives to rl_redisplay that it has adjusted the
value of _rl_last_c_pos *and* taken the presence of any invisible chars in
the prompt into account. rl_redisplay notes this and does not do the
adjustment itself. */
static int cpos_adjusted;
/* The index into the line buffer corresponding to the cursor position */
static int cpos_buffer_position;
/* A flag to note when we're displaying the first line of the prompt */
static int displaying_prompt_first_line;
/* The number of multibyte characters in the prompt, if any */
static int prompt_multibyte_chars;
static int _rl_inv_botlin = 0;
/* Variables used only in this file. */
/* The last left edge of text that was displayed. This is used when
doing horizontal scrolling. It shifts in thirds of a screenwidth. */
static int last_lmargin;
/* A buffer for `modeline' messages. */
static char *msg_buf = 0;
static int msg_bufsiz = 0;
/* Non-zero forces the redisplay even if we thought it was unnecessary. */
static int forced_display;
/* Default and initial buffer size. Can grow. */
static int line_size = 0;
/* Set to a non-zero value if horizontal scrolling has been enabled
automatically because the terminal was resized to height 1. */
static int horizontal_scrolling_autoset = 0; /* explicit initialization */
/* Variables to keep track of the expanded prompt string, which may
include invisible characters. */
static char *local_prompt, *local_prompt_prefix;
static int local_prompt_len;
static int prompt_prefix_length;
/* Number of chars in the buffer that contribute to visible chars on the screen.
This might be different from the number of physical chars in the presence
of multibyte characters */
static int prompt_visible_length;
/* The number of invisible characters in the line currently being
displayed on the screen. */
static int visible_wrap_offset;
/* The number of invisible characters in the prompt string. Static so it
can be shared between rl_redisplay and update_line */
static int wrap_offset;
/* The index of the last invisible character in the prompt string. */
static int prompt_last_invisible;
/* The length (buffer offset) of the first line of the last (possibly
multi-line) buffer displayed on the screen. */
static int visible_first_line_len;
/* Number of invisible characters on the first physical line of the prompt.
Only valid when the number of physical characters in the prompt exceeds
(or is equal to) _rl_screenwidth. */
static int prompt_invis_chars_first_line;
static int prompt_last_screen_line;
static int prompt_physical_chars;
/* An array of indexes into the prompt string where we will break physical
screen lines. It's easier to compute in expand_prompt and use later in
rl_redisplay instead of having rl_redisplay try to guess about invisible
characters in the prompt or use heuristics about where they are. */
static int *local_prompt_newlines;
/* set to a non-zero value by rl_redisplay if we are marking modified history
lines and the current line is so marked. */
static int modmark;
static int line_totbytes;
/* Variables to save and restore prompt and display information. */
/* These are getting numerous enough that it's time to create a struct. */
static char *saved_local_prompt;
static char *saved_local_prefix;
static int *saved_local_prompt_newlines;
static int saved_last_invisible;
static int saved_visible_length;
static int saved_prefix_length;
static int saved_local_length;
static int saved_invis_chars_first_line;
static int saved_physical_chars;
/* Return a string indicating the editing mode, for use in the prompt. */
static char *
prompt_modestr (int *lenp)
{
if (rl_editing_mode == emacs_mode)
{
if (lenp)
*lenp = _rl_emacs_mode_str ? _rl_emacs_modestr_len : RL_EMACS_MODESTR_DEFLEN;
return _rl_emacs_mode_str ? _rl_emacs_mode_str : RL_EMACS_MODESTR_DEFAULT;
}
else if (_rl_keymap == vi_insertion_keymap)
{
if (lenp)
*lenp = _rl_vi_ins_mode_str ? _rl_vi_ins_modestr_len : RL_VI_INS_MODESTR_DEFLEN;
return _rl_vi_ins_mode_str ? _rl_vi_ins_mode_str : RL_VI_INS_MODESTR_DEFAULT; /* vi insert mode */
}
else
{
if (lenp)
*lenp = _rl_vi_cmd_mode_str ? _rl_vi_cmd_modestr_len : RL_VI_CMD_MODESTR_DEFLEN;
return _rl_vi_cmd_mode_str ? _rl_vi_cmd_mode_str : RL_VI_CMD_MODESTR_DEFAULT; /* vi command mode */
}
}
/* Expand the prompt string S and return the number of visible
characters in *LP, if LP is not null. This is currently more-or-less
a placeholder for expansion. LIP, if non-null is a place to store the
index of the last invisible character in the returned string. NIFLP,
if non-zero, is a place to store the number of invisible characters in
the first prompt line. The previous are used as byte counts -- indexes
into a character buffer. *VLP gets the number of physical characters in
the expanded prompt (visible length) */
/* Current implementation:
\001 (^A) start non-visible characters
\002 (^B) end non-visible characters
all characters except \001 and \002 (following a \001) are copied to
the returned string; all characters except those between \001 and
\002 are assumed to be `visible'. */
/* Possible values for FLAGS:
PMT_MULTILINE caller indicates that this is part of a multiline prompt
*/
/* This approximates the number of lines the prompt will take when displayed */
#define APPROX_DIV(n, d) (((n) < (d)) ? 1 : ((n) / (d)) + 1)
static char *
expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp)
{
char *r, *ret, *p, *igstart, *nprompt, *ms;
int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
int mlen, newlines, newlines_guess, bound;
int mb_cur_max;
/* We only expand the mode string for the last line of a multiline prompt
(a prompt with embedded newlines). */
ms = (((pmt == rl_prompt) ^ (flags & PMT_MULTILINE)) && _rl_show_mode_in_prompt) ? prompt_modestr (&mlen) : 0;
if (ms)
{
l = strlen (pmt);
nprompt = (char *)xmalloc (l + mlen + 1);
memcpy (nprompt, ms, mlen);
strcpy (nprompt + mlen, pmt);
}
else
nprompt = pmt;
mb_cur_max = MB_CUR_MAX;
if (_rl_screenwidth == 0)
_rl_get_screen_size (0, 0); /* avoid division by zero */
/* Short-circuit if we can. We can do this if we are treating the prompt as
a sequence of bytes and there are no invisible characters in the prompt
to deal with. Since we populate local_prompt_newlines, we have to run
through the rest of the function if this prompt looks like it's going to
be longer than one screen line. */
if ((mb_cur_max <= 1 || rl_byte_oriented) && strchr (nprompt, RL_PROMPT_START_IGNORE) == 0)
{
l = strlen (nprompt);
if (l < (_rl_screenwidth > 0 ? _rl_screenwidth : 80))
{
r = (nprompt == pmt) ? savestring (pmt) : nprompt;
if (lp)
*lp = l;
if (lip)
*lip = 0;
if (niflp)
*niflp = 0;
if (vlp)
*vlp = l;
local_prompt_newlines = (int *) xrealloc (local_prompt_newlines, sizeof (int) * 2);
local_prompt_newlines[0] = 0;
local_prompt_newlines[1] = -1;
return r;
}
}
l = strlen (nprompt); /* XXX */
r = ret = (char *)xmalloc (l + 1);
/* Guess at how many screen lines the prompt will take to size the array that
keeps track of where the line wraps happen */
newlines_guess = (_rl_screenwidth > 0) ? APPROX_DIV(l, _rl_screenwidth) : APPROX_DIV(l, 80);
local_prompt_newlines = (int *) xrealloc (local_prompt_newlines, sizeof (int) * (newlines_guess + 1));
local_prompt_newlines[newlines = 0] = 0;
for (rl = 1; rl <= newlines_guess; rl++)
local_prompt_newlines[rl] = -1;
rl = physchars = 0; /* mode string now part of nprompt */
invfl = 0; /* invisible chars in first line of prompt */
invflset = 0; /* we only want to set invfl once */
igstart = 0; /* we're not ignoring any characters yet */
for (ignoring = last = ninvis = 0, p = nprompt; p && *p; p++)
{
/* This code strips the invisible character string markers
RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */
if (ignoring == 0 && *p == RL_PROMPT_START_IGNORE) /* XXX - check ignoring? */
{
ignoring = 1;
igstart = p;
continue;
}
else if (ignoring && *p == RL_PROMPT_END_IGNORE)
{
ignoring = 0;
if (p != (igstart + 1))
last = r - ret - 1;
continue;
}
else
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
pind = p - nprompt;
ind = _rl_find_next_mbchar (nprompt, pind, 1, MB_FIND_NONZERO);
l = ind - pind;
while (l--)
*r++ = *p++;
if (!ignoring)
{
/* rl ends up being assigned to prompt_visible_length,
which is the number of characters in the buffer that
contribute to characters on the screen, which might
not be the same as the number of physical characters
on the screen in the presence of multibyte characters */
rl += ind - pind;
physchars += _rl_col_width (nprompt, pind, ind, 0);
}
else
ninvis += ind - pind;
p--; /* compensate for later increment */
}
else
#endif
{
*r++ = *p;
if (!ignoring)
{
rl++; /* visible length byte counter */
physchars++;
}
else
ninvis++; /* invisible chars byte counter */
}
if (invflset == 0 && physchars >= _rl_screenwidth)
{
invfl = ninvis;
invflset = 1;
}
if (physchars >= (bound = (newlines + 1) * _rl_screenwidth) && local_prompt_newlines[newlines+1] == -1)
{
int new;
if (physchars > bound) /* should rarely happen */
{
#if defined (HANDLE_MULTIBYTE)
*r = '\0'; /* need null-termination for strlen */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
new = _rl_find_prev_mbchar (ret, r - ret, MB_FIND_ANY);
else
#endif
new = r - ret - (physchars - bound); /* XXX */
}
else
new = r - ret;
local_prompt_newlines[++newlines] = new;
}
}
}
if (rl < _rl_screenwidth)
invfl = ninvis;
*r = '\0';
if (lp)
*lp = rl;
if (lip)
*lip = last;
if (niflp)
*niflp = invfl;
if (vlp)
*vlp = physchars;
if (nprompt != pmt)
free (nprompt);
return ret;
}
/* Just strip out RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE from
PMT and return the rest of PMT. */
char *
_rl_strip_prompt (char *pmt)
{
char *ret;
ret = expand_prompt (pmt, 0, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL);
return ret;
}
void
_rl_reset_prompt (void)
{
rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
}
/*
* Expand the prompt string into the various display components, if
* necessary.
*
* local_prompt = expanded last line of string in rl_display_prompt
* (portion after the final newline)
* local_prompt_prefix = portion before last newline of rl_display_prompt,
* expanded via expand_prompt
* prompt_visible_length = number of visible characters in local_prompt
* prompt_prefix_length = number of visible characters in local_prompt_prefix
*
* It also tries to keep track of the number of invisible characters in the
* prompt string, and where they are.
*
* This function is called once per call to readline(). It may also be
* called arbitrarily to expand the primary prompt.
*
* The return value is the number of visible characters on the last line
* of the (possibly multi-line) prompt. In this case, multi-line means
* there are embedded newlines in the prompt string itself, not that the
* number of physical characters exceeds the screen width and the prompt
* wraps.
*/
int
rl_expand_prompt (char *prompt)
{
char *p, *t;
int c;
/* Clear out any saved values. */
FREE (local_prompt);
FREE (local_prompt_prefix);
local_prompt = local_prompt_prefix = (char *)0;
local_prompt_len = 0;
prompt_last_invisible = prompt_invis_chars_first_line = 0;
prompt_visible_length = prompt_physical_chars = 0;
if (prompt == 0 || *prompt == 0)
return (0);
p = strrchr (prompt, '\n');
if (p == 0)
{
/* The prompt is only one logical line, though it might wrap. */
local_prompt = expand_prompt (prompt, 0, &prompt_visible_length,
&prompt_last_invisible,
&prompt_invis_chars_first_line,
&prompt_physical_chars);
local_prompt_prefix = (char *)0;
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
return (prompt_visible_length);
}
else
{
/* The prompt spans multiple lines. */
t = ++p;
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
final newline is now null-terminated. */
local_prompt_prefix = expand_prompt (prompt, PMT_MULTILINE,
&prompt_prefix_length,
(int *)NULL,
(int *)NULL,
(int *)NULL);
*t = c;
local_prompt = expand_prompt (p, PMT_MULTILINE,
&prompt_visible_length,
&prompt_last_invisible,
&prompt_invis_chars_first_line,
&prompt_physical_chars);
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
return (prompt_prefix_length);
}
}
/* Allocate the various line structures, making sure they can hold MINSIZE
bytes. If the existing line size can accommodate MINSIZE bytes, don't do
anything. */
static void
realloc_line (int minsize)
{
int minimum_size;
int newsize, delta;
minimum_size = DEFAULT_LINE_BUFFER_SIZE;
if (minsize < minimum_size)
minsize = minimum_size;
if (minsize <= _rl_screenwidth) /* XXX - for gdb */
minsize = _rl_screenwidth + 1;
if (line_size >= minsize)
return;
newsize = minimum_size;
while (newsize < minsize)
newsize *= 2;
visible_line = (char *)xrealloc (visible_line, newsize);
vis_face = (char *)xrealloc (vis_face, newsize);
invisible_line = (char *)xrealloc (invisible_line, newsize);
inv_face = (char *)xrealloc (inv_face, newsize);
delta = newsize - line_size;
memset (visible_line + line_size, 0, delta);
memset (vis_face + line_size, FACE_NORMAL, delta);
memset (invisible_line + line_size, 1, delta);
memset (inv_face + line_size, FACE_INVALID, delta);
line_size = newsize;
}
/* Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated
arrays of line break markers. MINSIZE is the minimum size of VISIBLE_LINE
and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
increased. If the lines have already been allocated, this ensures that
they can hold at least MINSIZE characters. */
static void
init_line_structures (int minsize)
{
if (invisible_line == 0) /* initialize it */
{
if (line_size > minsize)
minsize = line_size;
}
realloc_line (minsize);
if (vis_lbreaks == 0)
{
/* should be enough. */
inv_lbsize = vis_lbsize = 256;
#if defined (HANDLE_MULTIBYTE)
line_state_visible->wbsize = vis_lbsize;
line_state_visible->wrapped_line = (int *)xmalloc (line_state_visible->wbsize * sizeof (int));
line_state_invisible->wbsize = inv_lbsize;
line_state_invisible->wrapped_line = (int *)xmalloc (line_state_invisible->wbsize * sizeof (int));
#endif
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
inv_lbreaks[0] = vis_lbreaks[0] = 0;
}
line_structures_initialized = 1;
}
/* Convenience functions to add chars to the invisible line that update the
face information at the same time. */
static void /* XXX - change this */
invis_addc (int *outp, char c, char face)
{
realloc_line (*outp + 1);
invisible_line[*outp] = c;
inv_face[*outp] = face;
*outp += 1;
}
static void
invis_adds (int *outp, const char *str, int n, char face)
{
int i;
for (i = 0; i < n; i++)
invis_addc (outp, str[i], face);
}
static void
invis_nul (int *outp)
{
invis_addc (outp, '\0', 0);
*outp -= 1;
}
static void
set_active_region (int *beg, int *end)
{
if (rl_point >= 0 && rl_point <= rl_end && rl_mark >= 0 && rl_mark <= rl_end)
{
*beg = (rl_mark < rl_point) ? rl_mark : rl_point;
*end = (rl_mark < rl_point) ? rl_point : rl_mark;
}
}
/* Do whatever tests are necessary and tell update_line that it can do a
quick, dumb redisplay on the assumption that there are so many
differences between the old and new lines that it would be a waste to
compute all the differences.
Right now, it just sets _rl_quick_redisplay if the current visible line
is a single line (so we don't have to move vertically or mess with line
wrapping). */
void
_rl_optimize_redisplay (void)
{
if (_rl_vis_botlin == 0)
_rl_quick_redisplay = 1;
}
/* Basic redisplay algorithm. See comments inline. */
void
rl_redisplay (void)
{
int in, out, c, linenum, cursor_linenum;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, n0, num, prompt_lines_estimate;
char *prompt_this_line;
char cur_face;
int hl_begin, hl_end;
int mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
size_t wc_bytes;
int wc_width;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
#endif
if (_rl_echoing_p == 0)
return;
/* Block keyboard interrupts because this function manipulates global
data structures. */
_rl_block_sigint ();
RL_SETSTATE (RL_STATE_REDISPLAYING);
cur_face = FACE_NORMAL;
/* Can turn this into an array for multiple highlighted objects in addition
to the region */
hl_begin = hl_end = -1;
if (rl_mark_active_p ())
set_active_region (&hl_begin, &hl_end);
if (!rl_display_prompt)
rl_display_prompt = "";
if (line_structures_initialized == 0)
{
init_line_structures (0);
rl_on_new_line ();
}
else if (line_size <= _rl_screenwidth)
init_line_structures (_rl_screenwidth + 1);
/* Enable horizontal scrolling automatically for terminals of height 1
where wrapping lines doesn't work. Disable it as soon as the terminal
height is increased again if it was automatically enabled. */
if (_rl_screenheight <= 1)
{
if (_rl_horizontal_scroll_mode == 0)
horizontal_scrolling_autoset = 1;
_rl_horizontal_scroll_mode = 1;
}
else if (horizontal_scrolling_autoset)
_rl_horizontal_scroll_mode = 0;
/* Draw the line into the buffer. */
cpos_buffer_position = -1;
prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars;
out = inv_botlin = 0;
/* Mark the line as modified or not. We only do this for history
lines. */
modmark = 0;
if (_rl_mark_modified_lines && current_history () && rl_undo_list)
{
invis_addc (&out, '*', cur_face);
invis_nul (&out);
modmark = 1;
}
/* If someone thought that the redisplay was handled, but the currently
visible line has a different modification state than the one about
to become visible, then correct the caller's misconception. */
if (visible_line[0] != invisible_line[0])
rl_display_fixed = 0;
/* If the prompt to be displayed is the `primary' readline prompt (the
one passed to readline()), use the values we have already expanded.
If not, use what's already in rl_display_prompt. WRAP_OFFSET is the
number of non-visible characters (bytes) in the prompt string. */
/* This is where we output the characters in the prompt before the last
newline, if any. If there aren't any embedded newlines, we don't
write anything. Copy the last line of the prompt string into the line in
any case */
if (rl_display_prompt == rl_prompt || local_prompt)
{
if (local_prompt_prefix && forced_display)
_rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix));
if (local_prompt_len > 0)
invis_adds (&out, local_prompt, local_prompt_len, cur_face);
invis_nul (&out);
wrap_offset = local_prompt_len - prompt_visible_length;
}
else
{
int pmtlen;
prompt_this_line = strrchr (rl_display_prompt, '\n');
if (!prompt_this_line)
prompt_this_line = rl_display_prompt;
else
{
prompt_this_line++;
pmtlen = prompt_this_line - rl_display_prompt; /* temp var */
if (forced_display)
{
_rl_output_some_chars (rl_display_prompt, pmtlen);
/* Make sure we are at column zero even after a newline,
regardless of the state of terminal output processing. */
if (pmtlen < 2 || prompt_this_line[-2] != '\r')
cr ();
}
}
prompt_physical_chars = pmtlen = strlen (prompt_this_line); /* XXX */
invis_adds (&out, prompt_this_line, pmtlen, cur_face);
invis_nul (&out);
wrap_offset = prompt_invis_chars_first_line = 0;
}
#if defined (HANDLE_MULTIBYTE)
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \
if (newlines >= (line_state_invisible->wbsize - 2)) \
{ \
line_state_invisible->wbsize *= 2; \
line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); \
} \
} while (0)
#else
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \
} while (0)
#endif /* !HANDLE_MULTIBYTE */
#if defined (HANDLE_MULTIBYTE)
#define CHECK_LPOS() \
do { \
lpos++; \
if (lpos >= _rl_screenwidth) \
{ \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \
inv_lbreaks[++newlines] = out; \
if (newlines >= (line_state_invisible->wbsize - 2)) \
{ \
line_state_invisible->wbsize *= 2; \
line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); \
} \
line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; \
lpos = 0; \
} \
} while (0)
#else
#define CHECK_LPOS() \
do { \
lpos++; \
if (lpos >= _rl_screenwidth) \
{ \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \
inv_lbreaks[++newlines] = out; \
lpos = 0; \
} \
} while (0)
#endif
/* inv_lbreaks[i] is where line i starts in the buffer. */
inv_lbreaks[newlines = 0] = 0;
/* lpos is a physical cursor position, so it needs to be adjusted by the
number of invisible characters in the prompt, per line. We compute
the line breaks in the prompt string in expand_prompt, taking invisible
characters into account, and if lpos exceeds the screen width, we copy
the data in the loop below. */
lpos = prompt_physical_chars + modmark;
#if defined (HANDLE_MULTIBYTE)
memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int));
num = 0;
#endif
/* prompt_invis_chars_first_line is the number of invisible characters (bytes)
in the first physical line of the prompt.
wrap_offset - prompt_invis_chars_first_line is usually the number of
invis chars on the second (or, more generally, last) line. */
/* This is zero-based, used to set the newlines */
prompt_lines_estimate = lpos / _rl_screenwidth;
/* what if lpos is already >= _rl_screenwidth before we start drawing the
contents of the command line? */
if (lpos >= _rl_screenwidth)
{
temp = 0;
/* first copy the linebreaks array we computed in expand_prompt */
while (local_prompt_newlines[newlines+1] != -1)
{
temp = local_prompt_newlines[newlines+1];
inv_lbreaks[++newlines] = temp;
}
/* Now set lpos from the last newline */
if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
lpos = _rl_col_width (local_prompt, temp, local_prompt_len, 1) - (wrap_offset - prompt_invis_chars_first_line);
else
lpos -= (_rl_screenwidth * newlines);
}
prompt_last_screen_line = newlines;
/* Draw the rest of the line (after the prompt) into invisible_line, keeping
track of where the cursor is (cpos_buffer_position), the number of the
line containing the cursor (lb_linenum), the last line number (lb_botlin
and inv_botlin).
It maintains an array of line breaks for display (inv_lbreaks).
This handles expanding tabs for display and displaying meta characters. */
lb_linenum = 0;
#if defined (HANDLE_MULTIBYTE)
in = 0;
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
memset (&ps, 0, sizeof (mbstate_t));
if (_rl_utf8locale && UTF8_SINGLEBYTE(rl_line_buffer[0]))
{
wc = (wchar_t)rl_line_buffer[0];
wc_bytes = 1;
}
else
wc_bytes = mbrtowc (&wc, rl_line_buffer, rl_end, &ps);
}
else
wc_bytes = 1;
while (in < rl_end)
#else
for (in = 0; in < rl_end; in++)
#endif
{
if (in == hl_begin)
cur_face = FACE_STANDOUT;
else if (in == hl_end)
cur_face = FACE_NORMAL;
c = (unsigned char)rl_line_buffer[in];
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
if (MB_INVALIDCH (wc_bytes))
{
/* Byte sequence is invalid or shortened. Assume that the
first byte represents a character. */
wc_bytes = 1;
/* Assume that a character occupies a single column. */
wc_width = 1;
memset (&ps, 0, sizeof (mbstate_t));
}
else if (MB_NULLWCH (wc_bytes))
break; /* Found '\0' */
else
{
temp = WCWIDTH (wc);
wc_width = (temp >= 0) ? temp : 1;
}
}
#endif
if (in == rl_point)
{
cpos_buffer_position = out;
lb_linenum = newlines;
}
#if defined (HANDLE_MULTIBYTE)
if (META_CHAR (c) && _rl_output_meta_chars == 0) /* XXX - clean up */
#else
if (META_CHAR (c))
#endif
{
if (_rl_output_meta_chars == 0)
{
char obuf[5];
int olen;
olen = sprintf (obuf, "\\%o", c);
if (lpos + olen >= _rl_screenwidth)
{
temp = _rl_screenwidth - lpos;
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp;
#if defined (HANDLE_MULTIBYTE)
line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn;
#endif
lpos = olen - temp;
}
else
lpos += olen;
for (temp = 0; temp < olen; temp++)
{
invis_addc (&out, obuf[temp], cur_face);
CHECK_LPOS ();
}
}
else
{
invis_addc (&out, c, cur_face);
CHECK_LPOS();
}
}
#if defined (DISPLAY_TABS)
else if (c == '\t')
{
register int newout;
newout = out + 8 - lpos % 8;
temp = newout - out;
if (lpos + temp >= _rl_screenwidth)
{
register int temp2;
temp2 = _rl_screenwidth - lpos;
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp2;
#if defined (HANDLE_MULTIBYTE)
line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn;
#endif
lpos = temp - temp2;
while (out < newout)
invis_addc (&out, ' ', cur_face);
}
else
{
while (out < newout)
invis_addc (&out, ' ', cur_face);
lpos += temp;
}
}
#endif
else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
invis_addc (&out, '\0', cur_face);
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out;
#if defined (HANDLE_MULTIBYTE)
line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn;
#endif
lpos = 0;
}
else if (CTRL_CHAR (c) || c == RUBOUT)
{
invis_addc (&out, '^', cur_face);
CHECK_LPOS();
invis_addc (&out, CTRL_CHAR (c) ? UNCTRL (c) : '?', cur_face);
CHECK_LPOS();
}
else
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
register int i;
_rl_wrapped_multicolumn = 0;
if (_rl_screenwidth < lpos + wc_width)
for (i = lpos; i < _rl_screenwidth; i++)
{
/* The space will be removed in update_line() */
invis_addc (&out, ' ', cur_face);
_rl_wrapped_multicolumn++;
CHECK_LPOS();
}
if (in == rl_point)
{
cpos_buffer_position = out;
lb_linenum = newlines;
}
for (i = in; i < in+wc_bytes; i++)
invis_addc (&out, rl_line_buffer[i], cur_face);
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
}
else
{
invis_addc (&out, c, cur_face);
CHECK_LPOS();
}
#else
invis_addc (&out, c, cur_face);
CHECK_LPOS();
#endif
}
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
in += wc_bytes;
if (_rl_utf8locale && UTF8_SINGLEBYTE(rl_line_buffer[in]))
{
wc = (wchar_t)rl_line_buffer[in];
wc_bytes = 1;
memset (&ps, 0, sizeof (mbstate_t)); /* re-init state */
}
else
wc_bytes = mbrtowc (&wc, rl_line_buffer + in, rl_end - in, &ps);
}
else
in++;
#endif
}
invis_nul (&out);
line_totbytes = out;
if (cpos_buffer_position < 0)
{
cpos_buffer_position = out;
lb_linenum = newlines;
}
/* If we are switching from one line to multiple wrapped lines, we don't
want to do a dumb update (or we want to make it smarter). */
if (_rl_quick_redisplay && newlines > 0)
_rl_quick_redisplay = 0;
inv_botlin = lb_botlin = _rl_inv_botlin = newlines;
CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
#if defined (HANDLE_MULTIBYTE)
/* This should be 0 anyway */
line_state_invisible->wrapped_line[newlines+1] = _rl_wrapped_multicolumn;
#endif
cursor_linenum = lb_linenum;
/* CPOS_BUFFER_POSITION == position in buffer where cursor should be placed.
CURSOR_LINENUM == line number where the cursor should be placed. */
/* PWP: now is when things get a bit hairy. The visible and invisible
line buffers are really multiple lines, which would wrap every
(screenwidth - 1) characters. Go through each in turn, finding
the changed region and updating it. The line order is top to bottom. */
/* If we can move the cursor up and down, then use multiple lines,
otherwise, let long lines display in a single terminal line, and
horizontally scroll it. */
displaying_prompt_first_line = 1;
if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
int nleft, pos, changed_screen_line, tx;
if (!rl_display_fixed || forced_display)
{
forced_display = 0;
/* If we have more than a screenful of material to display, then
only display a screenful. We should display the last screen,
not the first. */
if (out >= _rl_screenchars)
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
out = _rl_find_prev_mbchar (invisible_line, _rl_screenchars, MB_FIND_ANY);
else
#endif
out = _rl_screenchars - 1;
}
/* The first line is at character position 0 in the buffer. The
second and subsequent lines start at inv_lbreaks[N], offset by
OFFSET (which has already been calculated above). */
#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
#define WRAP_OFFSET(line, offset) ((line == 0) \
? (offset ? INVIS_FIRST() : 0) \
: ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
#define VIS_CHARS(line) (visible_line + vis_lbreaks[line])
#define VIS_FACE(line) (vis_face + vis_lbreaks[line])
#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
#define VIS_LINE_FACE(line) ((line) > _rl_vis_botlin) ? "" : VIS_FACE(line)
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
#define INV_LINE_FACE(line) (inv_face + inv_lbreaks[line])
#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \
_rl_last_c_pos != o_cpos && \
_rl_last_c_pos > wrap_offset && \
o_cpos < prompt_last_invisible)
/* We don't want to highlight anything that's going to be off the top
of the display; if the current line takes up more than an entire
screen, just mark the lines that won't be displayed as having a
`normal' face.
It's imperfect, but better than display corruption. */
if (rl_mark_active_p () && inv_botlin > _rl_screenheight)
{
int extra;
extra = inv_botlin - _rl_screenheight;
for (linenum = 0; linenum <= extra; linenum++)
norm_face (INV_LINE_FACE(linenum), INV_LLEN (linenum));
}
/* For each line in the buffer, do the updating display. */
for (linenum = 0; linenum <= inv_botlin; linenum++)
{
/* This can lead us astray if we execute a program that changes
the locale from a non-multibyte to a multibyte one. */
o_cpos = _rl_last_c_pos;
cpos_adjusted = 0;
update_line (VIS_LINE(linenum), VIS_LINE_FACE(linenum),
INV_LINE(linenum), INV_LINE_FACE(linenum),
linenum,
VIS_LLEN(linenum), INV_LLEN(linenum), inv_botlin);
/* update_line potentially changes _rl_last_c_pos, but doesn't
take invisible characters into account, since _rl_last_c_pos
is an absolute cursor position in a multibyte locale. We
choose to (mostly) compensate for that here, rather than
change update_line itself. There are several cases in which
update_line adjusts _rl_last_c_pos itself (so it can pass
_rl_move_cursor_relative accurate values); it communicates
this back by setting cpos_adjusted. If we assume that
_rl_last_c_pos is correct (an absolute cursor position) each
time update_line is called, then we can assume in our
calculations that o_cpos does not need to be adjusted by
wrap_offset. */
if (linenum == 0 && (mb_cur_max > 1 && rl_byte_oriented == 0) && OLD_CPOS_IN_PROMPT())
_rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
else if (cpos_adjusted == 0 &&
linenum == prompt_last_screen_line &&
prompt_physical_chars > _rl_screenwidth &&
(mb_cur_max > 1 && rl_byte_oriented == 0) &&
_rl_last_c_pos != o_cpos &&
_rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line)) /* XXX - rethink this last one */
/* This assumes that all the invisible characters are split
between the first and last lines of the prompt, if the
prompt consumes more than two lines. It's usually right */
/* XXX - not sure this is ever executed */
_rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
/* If this is the line with the prompt, we might need to
compensate for invisible characters in the new line. Do
this only if there is not more than one new line (which
implies that we completely overwrite the old visible line)
and the new line is shorter than the old. Make sure we are
at the end of the new line before clearing. */
if (linenum == 0 &&
inv_botlin == 0 && _rl_last_c_pos == out &&
(wrap_offset > visible_wrap_offset) &&
(_rl_last_c_pos < visible_first_line_len))
{
if (mb_cur_max > 1 && rl_byte_oriented == 0)
nleft = _rl_screenwidth - _rl_last_c_pos;
else
nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos;
if (nleft)
_rl_clear_to_eol (nleft);
}
#if 0
/* This segment is intended to handle the case where the old
visible prompt has invisible characters and the new line
to be displayed needs to clear the rest of the old characters
out (e.g., when printing the i-search prompt): in general,
the case of the new line being shorter than the old. We need
to be at the end of the new line and the old line needs to be
longer than the current cursor position. It's not perfect,
since it uses the byte length of the first line, but this will
at worst result in some extra clear-to-end-of-lines. We can't
use the prompt length variables because they may not
correspond to the visible line (see printing the i-search
prompt above). The tests for differing numbers of invisible
characters may not matter and can probably be removed. */
else if (linenum == 0 &&
linenum == prompt_last_screen_line &&
_rl_last_c_pos == out &&
_rl_last_c_pos < visible_first_line_len &&
visible_wrap_offset &&
visible_wrap_offset != wrap_offset)
{
if (mb_cur_max > 1 && rl_byte_oriented == 0)
nleft = _rl_screenwidth - _rl_last_c_pos;
else
nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos;
if (nleft)
_rl_clear_to_eol (nleft);
}
#endif
/* Since the new first line is now visible, save its length. */
if (linenum == 0)
visible_first_line_len = (inv_botlin > 0) ? inv_lbreaks[1] : out - wrap_offset;
}
/* We may have deleted some lines. If so, clear the left over
blank ones at the bottom out. */
if (_rl_vis_botlin > inv_botlin)
{
char *tt;
for (; linenum <= _rl_vis_botlin; linenum++)
{
tt = VIS_CHARS (linenum);
_rl_move_vert (linenum);
_rl_move_cursor_relative (0, tt, VIS_FACE(linenum));
_rl_clear_to_eol
((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth);
}
}
_rl_vis_botlin = inv_botlin;
/* CHANGED_SCREEN_LINE is set to 1 if we have moved to a
different screen line during this redisplay. */
changed_screen_line = _rl_last_v_pos != cursor_linenum;
if (changed_screen_line)
{
_rl_move_vert (cursor_linenum);
/* If we moved up to the line with the prompt using _rl_term_up,
the physical cursor position on the screen stays the same,
but the buffer position needs to be adjusted to account
for invisible characters. */
if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == 0 && wrap_offset)
_rl_last_c_pos += wrap_offset;
}
/* Now we move the cursor to where it needs to be. First, make
sure we are on the correct line (cursor_linenum). */
/* We have to reprint the prompt if it contains invisible
characters, since it's not generally OK to just reprint
the characters from the current cursor position. But we
only need to reprint it if the cursor is before the last
invisible character in the prompt string. */
/* XXX - why not use local_prompt_len? */
nleft = prompt_visible_length + wrap_offset;
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
_rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt)
{
_rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, nleft);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark;
else
_rl_last_c_pos = nleft + modmark;
}
/* Where on that line? And where does that line start
in the buffer? */
pos = inv_lbreaks[cursor_linenum];
/* nleft == number of characters (bytes) in the line buffer between
the start of the line and the desired cursor position. */
nleft = cpos_buffer_position - pos;
/* NLEFT is now a number of characters in a buffer. When in a
multibyte locale, however, _rl_last_c_pos is an absolute cursor
position that doesn't take invisible characters in the prompt
into account. We use a fudge factor to compensate. */
/* Since _rl_backspace() doesn't know about invisible characters in
the prompt, and there's no good way to tell it, we compensate for
those characters here and call _rl_backspace() directly if
necessary */
if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos)
{
/* TX == new physical cursor position in multibyte locale. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
tx = _rl_col_width (&visible_line[pos], 0, nleft, 1) - visible_wrap_offset;
else
tx = nleft;
if (tx >= 0 && _rl_last_c_pos > tx)
{
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
_rl_last_c_pos = tx;
}
}
/* We need to note that in a multibyte locale we are dealing with
_rl_last_c_pos as an absolute cursor position, but moving to a
point specified by a buffer position (NLEFT) that doesn't take
invisible characters into account. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_move_cursor_relative (nleft, &invisible_line[pos], &inv_face[pos]);
else if (nleft != _rl_last_c_pos)
_rl_move_cursor_relative (nleft, &invisible_line[pos], &inv_face[pos]);
}
}
else /* Do horizontal scrolling. Much simpler */
{
#define M_OFFSET(margin, offset) ((margin) == 0 ? offset : 0)
int lmargin, ndisp, nleft, phys_c_pos, t;
/* Always at top line. */
_rl_last_v_pos = 0;
/* Compute where in the buffer the displayed line should start. This
will be LMARGIN. */
/* The number of characters that will be displayed before the cursor. */
ndisp = cpos_buffer_position - wrap_offset;
nleft = prompt_visible_length + wrap_offset;
/* Where the new cursor position will be on the screen. This can be
longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
phys_c_pos = cpos_buffer_position - (last_lmargin ? last_lmargin : wrap_offset);
t = _rl_screenwidth / 3;
/* If the number of characters had already exceeded the screenwidth,
last_lmargin will be > 0. */
/* If the number of characters to be displayed is more than the screen
width, compute the starting offset so that the cursor is about
two-thirds of the way across the screen. */
if (phys_c_pos > _rl_screenwidth - 2)
{
lmargin = cpos_buffer_position - (2 * t);
if (lmargin < 0)
lmargin = 0;
/* If the left margin would be in the middle of a prompt with
invisible characters, don't display the prompt at all. */
if (wrap_offset && lmargin > 0 && lmargin < nleft)
lmargin = nleft;
}
else if (ndisp < _rl_screenwidth - 2) /* XXX - was -1 */
lmargin = 0;
else if (phys_c_pos < 1)
{
/* If we are moving back towards the beginning of the line and
the last margin is no longer correct, compute a new one. */
lmargin = ((cpos_buffer_position - 1) / t) * t; /* XXX */
if (wrap_offset && lmargin > 0 && lmargin < nleft)
lmargin = nleft;
}
else
lmargin = last_lmargin;
displaying_prompt_first_line = lmargin < nleft;
/* If the first character on the screen isn't the first character
in the display line, indicate this with a special character. */
if (lmargin > 0)
invisible_line[lmargin] = '<';
/* If SCREENWIDTH characters starting at LMARGIN do not encompass
the whole line, indicate that with a special character at the
right edge of the screen. If LMARGIN is 0, we need to take the
wrap offset into account. */
t = lmargin + M_OFFSET (lmargin, wrap_offset) + _rl_screenwidth;
if (t > 0 && t < out)
invisible_line[t - 1] = '>';
if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin)
{
forced_display = 0;
o_cpos = _rl_last_c_pos;
cpos_adjusted = 0;
update_line (&visible_line[last_lmargin], &vis_face[last_lmargin],
&invisible_line[lmargin], &inv_face[lmargin],
0,
_rl_screenwidth + visible_wrap_offset,
_rl_screenwidth + (lmargin ? 0 : wrap_offset),
0);
if ((mb_cur_max > 1 && rl_byte_oriented == 0) &&
displaying_prompt_first_line && OLD_CPOS_IN_PROMPT())
_rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
/* If the visible new line is shorter than the old, but the number
of invisible characters is greater, and we are at the end of
the new line, we need to clear to eol. */
t = _rl_last_c_pos - M_OFFSET (lmargin, wrap_offset);
if ((M_OFFSET (lmargin, wrap_offset) > visible_wrap_offset) &&
(_rl_last_c_pos == out) && displaying_prompt_first_line &&
t < visible_first_line_len)
{
nleft = _rl_screenwidth - t;
_rl_clear_to_eol (nleft);
}
visible_first_line_len = out - lmargin - M_OFFSET (lmargin, wrap_offset);
if (visible_first_line_len > _rl_screenwidth)
visible_first_line_len = _rl_screenwidth;
_rl_move_cursor_relative (cpos_buffer_position - lmargin, &invisible_line[lmargin], &inv_face[lmargin]);
last_lmargin = lmargin;
}
}
fflush (rl_outstream);
/* Swap visible and non-visible lines. */
{
struct line_state *vtemp = line_state_visible;
line_state_visible = line_state_invisible;
line_state_invisible = vtemp;
rl_display_fixed = 0;
/* If we are displaying on a single line, and last_lmargin is > 0, we
are not displaying any invisible characters, so set visible_wrap_offset
to 0. */
if (_rl_horizontal_scroll_mode && last_lmargin)
visible_wrap_offset = 0;
else
visible_wrap_offset = wrap_offset;
_rl_quick_redisplay = 0;
}
RL_UNSETSTATE (RL_STATE_REDISPLAYING);
_rl_release_sigint ();
}
static void
putc_face (int c, int face, char *cur_face)
{
char cf;
cf = *cur_face;
if (cf != face)
{
if (cf != FACE_NORMAL && cf != FACE_STANDOUT)
return;
if (face != FACE_NORMAL && face != FACE_STANDOUT)
return;
if (face == FACE_STANDOUT && cf == FACE_NORMAL)
_rl_standout_on ();
if (face == FACE_NORMAL && cf == FACE_STANDOUT)
_rl_standout_off ();
*cur_face = face;
}
if (c != EOF)
putc (c, rl_outstream);
}
static void
puts_face (const char *str, const char *face, int n)
{
int i;
char cur_face;
for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
putc_face ((unsigned char) str[i], face[i], &cur_face);
putc_face (EOF, FACE_NORMAL, &cur_face);
}
static void
norm_face (char *face, int n)
{
memset (face, FACE_NORMAL, n);
}
#define ADJUST_CPOS(x) do { _rl_last_c_pos -= (x) ; cpos_adjusted = 1; } while (0)
/* PWP: update_line() is based on finding the middle difference of each
line on the screen; vis:
/old first difference
/beginning of line | /old last same /old EOL
v v v v
old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as
new: eddie> Oh, my little buggy says to me, as lurgid as
^ ^ ^ ^
\beginning of line | \new last same \new end of line
\new first difference
All are character pointers for the sake of speed. Special cases for
no differences, as well as for end of line additions must be handled.
Could be made even smarter, but this works well enough */
static void
update_line (char *old, char *old_face, char *new, char *new_face, int current_line, int omax, int nmax, int inv_botlin)
{
char *ofd, *ols, *oe, *nfd, *nls, *ne;
char *ofdf, *nfdf, *olsf, *nlsf;
int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
int bytes_to_insert;
int mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps_new, ps_old;
int new_offset, old_offset;
#endif
/* If we're at the right edge of a terminal that supports xn, we're
ready to wrap around, so do so. This fixes problems with knowing
the exact cursor position and cut-and-paste with certain terminal
emulators. In this calculation, TEMP is the physical screen
position of the cursor. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
temp = _rl_last_c_pos;
else
temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
&& _rl_last_v_pos == current_line - 1)
{
/* We're going to wrap around by writing the first character of NEW to
the screen and dealing with changes to what's visible by modifying
OLD to match it. Complicated by the presence of multi-width
characters at the end of the line or beginning of the new one. */
/* old is always somewhere in visible_line; new is always somewhere in
invisible_line. These should always be null-terminated. */
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
wchar_t wc;
mbstate_t ps;
int oldwidth, newwidth;
int oldbytes, newbytes;
size_t ret;
/* This fixes only double-column characters, but if the wrapped
character consumes more than three columns, spaces will be
inserted in the string buffer. */
/* XXX remember that we are working on the invisible line right now;
we don't swap visible and invisible until just before rl_redisplay
returns */
/* This will remove the extra placeholder space we added with
_rl_wrapped_multicolumn */
if (current_line < line_state_invisible->wbsize && line_state_invisible->wrapped_line[current_line] > 0)
_rl_clear_to_eol (line_state_invisible->wrapped_line[current_line]);
/* 1. how many screen positions does first char in old consume? */
memset (&ps, 0, sizeof (mbstate_t));
ret = mbrtowc (&wc, old, mb_cur_max, &ps);
oldbytes = ret;
if (MB_INVALIDCH (ret))
{
oldwidth = 1;
oldbytes = 1;
}
else if (MB_NULLWCH (ret))
oldwidth = 0;
else
oldwidth = WCWIDTH (wc);
if (oldwidth < 0)
oldwidth = 1;
/* 2. how many screen positions does the first char in new consume? */
memset (&ps, 0, sizeof (mbstate_t));
ret = mbrtowc (&wc, new, mb_cur_max, &ps);
newbytes = ret;
if (MB_INVALIDCH (ret))
{
newwidth = 1;
newbytes = 1;
}
else if (MB_NULLWCH (ret))
newwidth = 0;
else
newwidth = WCWIDTH (wc);
if (newwidth < 0)
newwidth = 1;
/* 3. if the new width is less than the old width, we need to keep
going in new until we have consumed at least that many screen
positions, and figure out how many bytes that will take */
while (newbytes < nmax && newwidth < oldwidth)
{
int t;
ret = mbrtowc (&wc, new+newbytes, mb_cur_max, &ps);
if (MB_INVALIDCH (ret))
{
newwidth += 1;
newbytes += 1;
}
else if (MB_NULLWCH (ret))
break;
else
{
t = WCWIDTH (wc);
newwidth += (t >= 0) ? t : 1;
newbytes += ret;
}
}
/* 4. If the new width is more than the old width, keep going in old
until we have consumed exactly that many screen positions, and
figure out how many bytes that will take. This is an optimization */
while (oldbytes < omax && oldwidth < newwidth)
{
int t;
ret = mbrtowc (&wc, old+oldbytes, mb_cur_max, &ps);
if (MB_INVALIDCH (ret))
{
oldwidth += 1;
oldbytes += 1;
}
else if (MB_NULLWCH (ret))
break;
else
{
t = WCWIDTH (wc);
oldwidth += (t >= 0) ? t : 1;
oldbytes += ret;
}
}
/* 5. write the first newbytes of new, which takes newwidth. This is
where the screen wrapping takes place, and we are now writing
characters onto the new line. We need to fix up old so it
accurately reflects what is on the screen after the
_rl_output_some_chars below. */
if (newwidth > 0)
{
int count, i, j;
char *optr;
puts_face (new, new_face, newbytes);
_rl_last_c_pos = newwidth;
_rl_last_v_pos++;
/* 5a. If the number of screen positions doesn't match, punt
and do a dumb update.
5b. If the number of bytes is greater in the new line than
the old, do a dumb update, because there is no guarantee we
can extend the old line enough to fit the new bytes. */
if (newwidth != oldwidth || newbytes > oldbytes)
{
oe = old + omax;
ne = new + nmax;
nd = newbytes;
nfd = new + nd;
ofdf = old_face + oldbytes;
nfdf = new_face + newbytes;
goto dumb_update;
}
if (oldbytes != 0 && newbytes != 0)
{
/* We have written as many bytes from new as we need to
consume the first character of old. Fix up `old' so it
reflects the new screen contents. We use +1 in the
memmove call to copy the trailing NUL. */
/* (strlen(old+oldbytes) == (omax - oldbytes - 1)) */
/* Don't bother trying to fit the bytes if the number of bytes
doesn't change. */
if (oldbytes != newbytes)
{
memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
memmove (old_face+newbytes, old_face+oldbytes, strlen (old+oldbytes) + 1);
}
memcpy (old, new, newbytes);
memcpy (old_face, new_face, newbytes);
j = newbytes - oldbytes;
omax += j;
/* Fix up indices if we copy data from one line to another */
for (i = current_line+1; j != 0 && i <= inv_botlin+1 && i <=_rl_vis_botlin+1; i++)
vis_lbreaks[i] += j;
}
}
else
{
putc (' ', rl_outstream);
_rl_last_c_pos = 1;
_rl_last_v_pos++;
if (old[0] && new[0])
{
old[0] = new[0];
old_face[0] = new_face[0];
}
}
}
else
#endif
{
if (new[0])
puts_face (new, new_face, 1);
else
putc (' ', rl_outstream);
_rl_last_c_pos = 1;
_rl_last_v_pos++;
if (old[0] && new[0])
{
old[0] = new[0];
old_face[0] = new_face[0];
}
}
}
/* We know that we are dealing with a single screen line here */
if (_rl_quick_redisplay)
{
nfd = new;
nfdf = new_face;
ofd = old;
ofdf = old_face;
for (od = 0, oe = ofd; od < omax && *oe; oe++, od++);
for (nd = 0, ne = nfd; nd < nmax && *ne; ne++, nd++);
od = nd = 0;
_rl_move_cursor_relative (0, old, old_face);
bytes_to_insert = ne - nfd;
if (bytes_to_insert < local_prompt_len) /* ??? */
goto dumb_update;
/* output the prompt, output the line contents, clear the rest */
_rl_output_some_chars (nfd, local_prompt_len);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = prompt_physical_chars;
else
_rl_last_c_pos = local_prompt_len;
bytes_to_insert -= local_prompt_len;
if (bytes_to_insert > 0)
{
puts_face (new+local_prompt_len, nfdf+local_prompt_len, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented)
_rl_last_c_pos += _rl_col_width (new, local_prompt_len, ne-new, 1);
else
_rl_last_c_pos += bytes_to_insert;
}
/* See comments at dumb_update: for an explanation of this heuristic */
if (nmax < omax)
goto clear_rest_of_line;
else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset)))
goto clear_rest_of_line;
else
return;
}
/* Find first difference. */
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
/* See if the old line is a subset of the new line, so that the
only change is adding characters. */
temp = (omax < nmax) ? omax : nmax;
if (memcmp (old, new, temp) == 0 && memcmp (old_face, new_face, temp) == 0)
{
new_offset = old_offset = temp; /* adding at the end */
ofd = old + temp;
ofdf = old_face + temp;
nfd = new + temp;
nfdf = new_face + temp;
}
else
{
memset (&ps_new, 0, sizeof(mbstate_t));
memset (&ps_old, 0, sizeof(mbstate_t));
/* Are the old and new lines the same? */
if (omax == nmax && memcmp (new, old, omax) == 0 && memcmp (new_face, old_face, omax) == 0)
{
old_offset = omax;
new_offset = nmax;
ofd = old + omax;
ofdf = old_face + omax;
nfd = new + nmax;
nfdf = new_face + nmax;
}
else
{
/* Go through the line from the beginning and find the first
difference. We assume that faces change at (possibly multi-
byte) character boundaries. */
new_offset = old_offset = 0;
for (ofd = old, ofdf = old_face, nfd = new, nfdf = new_face;
(ofd - old < omax) && *ofd &&
_rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new) &&
*ofdf == *nfdf; )
{
old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY);
new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY);
ofd = old + old_offset;
ofdf = old_face + old_offset;
nfd = new + new_offset;
nfdf = new_face + new_offset;
}
}
}
}
else
#endif
for (ofd = old, ofdf = old_face, nfd = new, nfdf = new_face;
(ofd - old < omax) && *ofd && (*ofd == *nfd) && (*ofdf == *nfdf);
ofd++, nfd++, ofdf++, nfdf++)
;
/* Move to the end of the screen line. ND and OD are used to keep track
of the distance between ne and new and oe and old, respectively, to
move a subtraction out of each loop. */
for (od = ofd - old, oe = ofd; od < omax && *oe; oe++, od++);
for (nd = nfd - new, ne = nfd; nd < nmax && *ne; ne++, nd++);
/* If no difference, continue to next line. */
if (ofd == oe && nfd == ne)
return;
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0 && _rl_utf8locale)
{
wchar_t wc;
mbstate_t ps = { 0 };
int t;
/* If the first character in the difference is a zero-width character,
assume it's a combining character and back one up so the two base
characters no longer compare equivalently. */
t = mbrtowc (&wc, ofd, mb_cur_max, &ps);
if (t > 0 && UNICODE_COMBINING_CHAR (wc) && WCWIDTH (wc) == 0)
{
old_offset = _rl_find_prev_mbchar (old, ofd - old, MB_FIND_ANY);
new_offset = _rl_find_prev_mbchar (new, nfd - new, MB_FIND_ANY);
ofd = old + old_offset; /* equal by definition */
ofdf = old_face + old_offset;
nfd = new + new_offset;
nfdf = new_face + new_offset;
}
}
#endif
wsatend = 1; /* flag for trailing whitespace */
#if defined (HANDLE_MULTIBYTE)
/* Find the last character that is the same between the two lines. This
bounds the region that needs to change. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
ols = old + _rl_find_prev_mbchar (old, oe - old, MB_FIND_ANY);
olsf = old_face + (ols - old);
nls = new + _rl_find_prev_mbchar (new, ne - new, MB_FIND_ANY);
nlsf = new_face + (nls - new);
while ((ols > ofd) && (nls > nfd))
{
memset (&ps_old, 0, sizeof (mbstate_t));
memset (&ps_new, 0, sizeof (mbstate_t));
if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0 ||
*olsf != *nlsf)
break;
if (*ols == ' ')
wsatend = 0;
ols = old + _rl_find_prev_mbchar (old, ols - old, MB_FIND_ANY);
olsf = old_face + (ols - old);
nls = new + _rl_find_prev_mbchar (new, nls - new, MB_FIND_ANY);
nlsf = new_face + (nls - new);
}
}
else
{
#endif /* HANDLE_MULTIBYTE */
ols = oe - 1; /* find last same */
olsf = old_face + (ols - old);
nls = ne - 1;
nlsf = new_face + (nls - new);
while ((ols > ofd) && (nls > nfd) && (*ols == *nls) && (*olsf == *nlsf))
{
if (*ols != ' ')
wsatend = 0;
ols--; olsf--;
nls--; nlsf--;
}
#if defined (HANDLE_MULTIBYTE)
}
#endif
if (wsatend)
{
ols = oe;
olsf = old_face + (ols - old);
nls = ne;
nlsf = new_face + (nls - new);
}
#if defined (HANDLE_MULTIBYTE)
/* This may not work for stateful encoding, but who cares? To handle
stateful encoding properly, we have to scan each string from the
beginning and compare. */
else if (_rl_compare_chars (ols, 0, NULL, nls, 0, NULL) == 0 || *olsf != *nlsf)
#else
else if (*ols != *nls || *olsf != *nlsf)
#endif
{
if (*ols) /* don't step past the NUL */
{
if (mb_cur_max > 1 && rl_byte_oriented == 0)
ols = old + _rl_find_next_mbchar (old, ols - old, 1, MB_FIND_ANY);
else
ols++;
}
if (*nls)
{
if (mb_cur_max > 1 && rl_byte_oriented == 0)
nls = new + _rl_find_next_mbchar (new, nls - new, 1, MB_FIND_ANY);
else
nls++;
}
olsf = old_face + (ols - old);
nlsf = new_face + (nls - new);
}
/* count of invisible characters in the current invisible line. */
current_invis_chars = W_OFFSET (current_line, wrap_offset);
if (_rl_last_v_pos != current_line)
{
_rl_move_vert (current_line);
/* We have moved up to a new screen line. This line may or may not have
invisible characters on it, but we do our best to recalculate
visible_wrap_offset based on what we know. */
if (current_line == 0)
visible_wrap_offset = prompt_invis_chars_first_line; /* XXX */
#if 0 /* XXX - not yet */
else if (current_line == prompt_last_screen_line && wrap_offset > prompt_invis_chars_first_line)
visible_wrap_offset = wrap_offset - prompt_invis_chars_first_line
#endif
if ((mb_cur_max == 1 || rl_byte_oriented) && current_line == 0 && visible_wrap_offset)
_rl_last_c_pos += visible_wrap_offset;
}
/* If this is the first line and there are invisible characters in the
prompt string, and the prompt string has not changed, and the current
cursor position is before the last invisible character in the prompt,
and the index of the character to move to is past the end of the prompt
string, then redraw the entire prompt string. We can only do this
reliably if the terminal supports a `cr' capability.
This can also happen if the prompt string has changed, and the first
difference in the line is in the middle of the prompt string, after a
sequence of invisible characters (worst case) and before the end of
the prompt. In this case, we have to redraw the entire prompt string
so that the entire sequence of invisible characters is drawn. We need
to handle the worst case, when the difference is after (or in the middle
of) a sequence of invisible characters that changes the text color and
before the sequence that restores the text color to normal. Then we have
to make sure that the lines still differ -- if they don't, we can
return immediately.
This is not an efficiency hack -- there is a problem with redrawing
portions of the prompt string if they contain terminal escape
sequences (like drawing the `unbold' sequence without a corresponding
`bold') that manifests itself on certain terminals. */
lendiff = local_prompt_len;
if (lendiff > nmax)
lendiff = nmax;
od = ofd - old; /* index of first difference in visible line */
nd = nfd - new; /* nd, od are buffer indexes */
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
(((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
{
_rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, lendiff);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
/* If we just output the entire prompt string we can take advantage
of knowing the number of physical characters in the prompt. If
the prompt wraps lines (lendiff clamped at nmax), we can't. */
if (lendiff == local_prompt_len)
_rl_last_c_pos = prompt_physical_chars + modmark;
else
/* We take wrap_offset into account here so we can pass correct
information to _rl_move_cursor_relative. */
_rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff, 1) - wrap_offset + modmark;
cpos_adjusted = 1;
}
else
_rl_last_c_pos = lendiff + modmark;
/* Now if we have printed the prompt string because the first difference
was within the prompt, see if we need to recompute where the lines
differ. Check whether where we are now is past the last place where
the old and new lines are the same and short-circuit now if we are. */
if ((od <= prompt_last_invisible || nd <= prompt_last_invisible) &&
omax == nmax &&
lendiff > (ols-old) && lendiff > (nls-new))
return;
/* XXX - we need to fix up our calculations if we are now past the
old ofd/nfd and the prompt length (or line length) has changed.
We punt on the problem and do a dumb update. We'd like to be able
to just output the prompt from the beginning of the line up to the
first difference, but you don't know the number of invisible
characters in that case.
This needs a lot of work to be efficient, but it usually doesn't matter. */
if ((od <= prompt_last_invisible || nd <= prompt_last_invisible))
{
nfd = new + lendiff; /* number of characters we output above */
nfdf = new_face + lendiff;
nd = lendiff;
/* Do a dumb update and return */
dumb_update:
temp = ne - nfd;
if (temp > 0)
{
puts_face (nfd, nfdf, temp);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
_rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
/* Need to adjust here based on wrap_offset. Guess that if
this is the line containing the last line of the prompt
we need to adjust by
wrap_offset-prompt_invis_chars_first_line
on the assumption that this is the number of invisible
characters in the last line of the prompt. */
if (wrap_offset > prompt_invis_chars_first_line &&
current_line == prompt_last_screen_line &&
prompt_physical_chars > _rl_screenwidth &&
_rl_horizontal_scroll_mode == 0)
ADJUST_CPOS (wrap_offset - prompt_invis_chars_first_line);
/* If we just output a new line including the prompt, and
the prompt includes invisible characters, we need to
account for them in the _rl_last_c_pos calculation, since
_rl_col_width does not. This happens when other code does
a goto dumb_update; */
else if (current_line == 0 &&
nfd == new &&
prompt_invis_chars_first_line &&
local_prompt_len <= temp &&
wrap_offset >= prompt_invis_chars_first_line &&
_rl_horizontal_scroll_mode == 0)
ADJUST_CPOS (prompt_invis_chars_first_line);
}
else
_rl_last_c_pos += temp;
}
/* This is a useful heuristic, but what we really want is to clear
if the new number of visible screen characters is less than the
old number of visible screen characters. If the prompt has changed,
we don't really have enough information about the visible line to
know for sure, so we use another heuristic calclulation below. */
if (nmax < omax)
goto clear_rest_of_line; /* XXX */
else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset)))
goto clear_rest_of_line;
else
return;
}
}
o_cpos = _rl_last_c_pos;
/* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor position in multibyte mode, but a buffer index when not in a
multibyte locale. */
_rl_move_cursor_relative (od, old, old_face);
#if defined (HANDLE_MULTIBYTE)
/* We need to indicate that the cursor position is correct in the presence of
invisible characters in the prompt string. Let's see if setting this when
we make sure we're at the end of the drawn prompt string works. */
if (current_line == 0 && mb_cur_max > 1 && rl_byte_oriented == 0 &&
(_rl_last_c_pos > 0 || o_cpos > 0) &&
_rl_last_c_pos == prompt_physical_chars)
cpos_adjusted = 1;
#endif
/* if (len (new) > len (old))
lendiff == difference in buffer (bytes)
col_lendiff == difference on screen (columns)
When not using multibyte characters, these are equal */
lendiff = (nls - nfd) - (ols - ofd);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
int newchars, newwidth, newind;
int oldchars, oldwidth, oldind;
newchars = nls - new;
oldchars = ols - old;
/* If we can do it, try to adjust nls and ols so that nls-new will
contain the entire new prompt string. That way we can use
prompt_physical_chars and not have to recompute column widths.
_rl_col_width adds wrap_offset and expects the caller to compensate,
which we do below, so we do the same thing if we don't call
_rl_col_width.
We don't have to compare, since we know the characters are the same.
The check of differing numbers of invisible chars may be extraneous.
XXX - experimental */
if (current_line == 0 && nfd == new && newchars > prompt_last_invisible &&
newchars <= local_prompt_len &&
local_prompt_len <= nmax &&
current_invis_chars != visible_wrap_offset)
{
while (newchars < nmax && oldchars < omax && newchars < local_prompt_len)
{
#if defined (HANDLE_MULTIBYTE)
newind = _rl_find_next_mbchar (new, newchars, 1, MB_FIND_NONZERO);
oldind = _rl_find_next_mbchar (old, oldchars, 1, MB_FIND_NONZERO);
nls += newind - newchars;
ols += oldind - oldchars;
newchars = newind;
oldchars = oldind;
#else
nls++; ols++;
newchars++; oldchars++;
#endif
}
newwidth = (newchars == local_prompt_len) ? prompt_physical_chars + wrap_offset
: _rl_col_width (new, 0, nls - new, 1);
/* if we changed nls and ols, we need to recompute lendiff */
lendiff = (nls - nfd) - (ols - ofd);
nlsf = new_face + (nls - new);
olsf = old_face + (ols - old);
}
else
newwidth = _rl_col_width (new, nfd - new, nls - new, 1);
oldwidth = _rl_col_width (old, ofd - old, ols - old, 1);
col_lendiff = newwidth - oldwidth;
}
else
col_lendiff = lendiff;
/* col_lendiff uses _rl_col_width(), which doesn't know about whether or not
the multibyte characters it counts are invisible, so unless we're printing
the entire prompt string (in which case we can use prompt_physical_chars)
the count is short by the number of bytes in the invisible multibyte
characters - the number of multibyte characters.
We don't have a good way to solve this without moving to something like
a bitmap that indicates which characters are visible and which are
invisible. We fix it up (imperfectly) in the caller and by trying to use
the entire prompt string wherever we can. */
/* If we are changing the number of invisible characters in a line, and
the spot of first difference is before the end of the invisible chars,
lendiff needs to be adjusted. */
if (current_line == 0 && current_invis_chars != visible_wrap_offset)
{
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
lendiff += visible_wrap_offset - current_invis_chars;
col_lendiff += visible_wrap_offset - current_invis_chars;
}
else
{
lendiff += visible_wrap_offset - current_invis_chars;
col_lendiff = lendiff;
}
}
/* We use temp as a count of the number of bytes from the first difference
to the end of the new line. col_temp is the corresponding number of
screen columns. A `dumb' update moves to the spot of first difference
and writes TEMP bytes. */
/* Insert (diff (len (old), len (new)) ch. */
temp = ne - nfd;
if (mb_cur_max > 1 && rl_byte_oriented == 0)
col_temp = _rl_col_width (new, nfd - new, ne - new, 1);
else
col_temp = temp;
/* how many bytes from the new line buffer to write to the display */
bytes_to_insert = nls - nfd;
/* col_lendiff > 0 if we are adding characters to the line */
if (col_lendiff > 0) /* XXX - was lendiff */
{
/* Non-zero if we're increasing the number of lines. */
int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
/* If col_lendiff is > 0, implying that the new string takes up more
screen real estate than the old, but lendiff is < 0, meaning that it
takes fewer bytes, we need to just output the characters starting
from the first difference. These will overwrite what is on the
display, so there's no reason to do a smart update. This can really
only happen in a multibyte environment. */
if (lendiff < 0)
{
puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If nfd begins before any invisible characters in the prompt,
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
if (current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
return;
}
/* Sometimes it is cheaper to print the characters rather than
use the terminal's capabilities. If we're growing the number
of lines, make sure we actually cause the new line to wrap
around on auto-wrapping terminals. */
else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
{
/* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
_rl_horizontal_scroll_mode == 1, inserting the characters with
_rl_term_IC or _rl_term_ic will screw up the screen because of the
invisible characters. We need to just draw them. */
/* The same thing happens if we're trying to draw before the last
invisible character in the prompt string or we're increasing the
number of invisible characters in the line and we're not drawing
the entire prompt string. */
if (*ols && ((_rl_horizontal_scroll_mode &&
_rl_last_c_pos == 0 &&
lendiff > prompt_visible_length &&
current_invis_chars > 0) == 0) &&
(((mb_cur_max > 1 && rl_byte_oriented == 0) &&
current_line == 0 && wrap_offset &&
((nfd - new) <= prompt_last_invisible) &&
(col_lendiff < prompt_visible_length)) == 0) &&
(visible_wrap_offset >= current_invis_chars))
{
open_some_spaces (col_lendiff);
puts_face (nfd, nfdf, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1);
else
_rl_last_c_pos += bytes_to_insert;
}
else if ((mb_cur_max == 1 || rl_byte_oriented != 0) && *ols == 0 && lendiff > 0)
{
/* At the end of a line the characters do not have to
be "inserted". They can just be placed on the screen. */
puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
return;
}
else /* just write from first difference to end of new line */
{
puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If nfd begins before the last invisible character in the
prompt, adjust _rl_last_c_pos to account for wrap_offset
and set cpos_adjusted to let the caller know. */
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
return;
}
if (bytes_to_insert > lendiff)
{
/* If nfd begins before the last invisible character in the
prompt, adjust _rl_last_c_pos to account for wrap_offset
and set cpos_adjusted to let the caller know. */
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
}
}
else
{
/* cannot insert chars, write to EOL */
puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If we're in a multibyte locale and were before the last invisible
char in the current line (which implies we just output some invisible
characters) we need to adjust _rl_last_c_pos, since it represents
a physical character position. */
/* The current_line*rl_screenwidth+prompt_invis_chars_first_line is a
crude attempt to compute how far into the new line buffer we are.
It doesn't work well in the face of multibyte characters and needs
to be rethought. XXX */
if ((mb_cur_max > 1 && rl_byte_oriented == 0) &&
current_line == prompt_last_screen_line && wrap_offset &&
displaying_prompt_first_line &&
wrap_offset != prompt_invis_chars_first_line &&
((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth+prompt_invis_chars_first_line))))
ADJUST_CPOS (wrap_offset - prompt_invis_chars_first_line);
/* XXX - what happens if wrap_offset == prompt_invis_chars_first_line
and we are drawing the first line (current_line == 0)? We should
adjust by _rl_last_c_pos -= prompt_invis_chars_first_line */
}
}
else /* Delete characters from line. */
{
/* If possible and inexpensive to use terminal deletion, then do so. */
if (_rl_term_dc && (2 * col_temp) >= -col_lendiff)
{
/* If all we're doing is erasing the invisible characters in the
prompt string, don't bother. It screws up the assumptions
about what's on the screen. */
if (_rl_horizontal_scroll_mode && _rl_last_c_pos == 0 &&
displaying_prompt_first_line &&
-lendiff == visible_wrap_offset)
col_lendiff = 0;
/* If we have moved lmargin and we're shrinking the line, we've
already moved the cursor to the first character of the new line,
so deleting -col_lendiff characters will mess up the cursor
position calculation */
if (_rl_horizontal_scroll_mode && displaying_prompt_first_line == 0 &&
col_lendiff && _rl_last_c_pos < -col_lendiff)
col_lendiff = 0;
if (col_lendiff)
delete_chars (-col_lendiff); /* delete (diff) characters */
/* Copy (new) chars to screen from first diff to last match,
overwriting what is there. */
if (bytes_to_insert > 0)
{
/* If nfd begins at the prompt, or before the invisible
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
puts_face (nfd, nfdf, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
/* This still doesn't take into account whether or not the
characters that this counts are invisible. */
_rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1);
if (current_line == 0 && wrap_offset &&
displaying_prompt_first_line &&
prompt_invis_chars_first_line &&
_rl_last_c_pos >= prompt_invis_chars_first_line &&
((nfd - new) <= prompt_last_invisible))
ADJUST_CPOS (prompt_invis_chars_first_line);
#if 1
#ifdef HANDLE_MULTIBYTE
/* If we write a non-space into the last screen column,
remove the note that we added a space to compensate for
a multibyte double-width character that didn't fit, since
it's only valid for what was previously there. */
/* XXX - watch this */
if (_rl_last_c_pos == _rl_screenwidth &&
line_state_invisible->wrapped_line[current_line+1] &&
nfd[bytes_to_insert-1] != ' ')
line_state_invisible->wrapped_line[current_line+1] = 0;
#endif
#endif
}
else
_rl_last_c_pos += bytes_to_insert;
/* XXX - we only want to do this if we are at the end of the line
so we move there with _rl_move_cursor_relative */
if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new)))
{
_rl_move_cursor_relative (ne-new, new, new_face);
goto clear_rest_of_line;
}
}
}
/* Otherwise, print over the existing material. */
else
{
if (temp > 0)
{
/* If nfd begins at the prompt, or before the invisible
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp; /* XXX */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
if (current_line == 0 && wrap_offset &&
displaying_prompt_first_line &&
_rl_last_c_pos > wrap_offset &&
((nfd - new) <= prompt_last_invisible))
ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
}
}
clear_rest_of_line:
lendiff = (oe - old) - (ne - new);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
col_lendiff = _rl_col_width (old, 0, oe - old, 1) - _rl_col_width (new, 0, ne - new, 1);
else
col_lendiff = lendiff;
/* If we've already printed over the entire width of the screen,
including the old material, then col_lendiff doesn't matter and
space_to_eol will insert too many spaces. XXX - maybe we should
adjust col_lendiff based on the difference between _rl_last_c_pos
and _rl_screenwidth */
if (col_lendiff && ((mb_cur_max == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
{
if (_rl_term_autowrap && current_line < inv_botlin)
space_to_eol (col_lendiff);
else
_rl_clear_to_eol (col_lendiff);
}
}
}
}
/* Tell the update routines that we have moved onto a new (empty) line. */
int
rl_on_new_line (void)
{
if (visible_line)
visible_line[0] = '\0';
_rl_last_c_pos = _rl_last_v_pos = 0;
_rl_vis_botlin = last_lmargin = 0;
if (vis_lbreaks)
vis_lbreaks[0] = vis_lbreaks[1] = 0;
visible_wrap_offset = 0;
return 0;
}
/* Clear all screen lines occupied by the current readline line buffer
(visible line) */
int
rl_clear_visible_line (void)
{
int curr_line;
/* Make sure we move to column 0 so we clear the entire line */
_rl_cr ();
_rl_last_c_pos = 0;
/* Move to the last screen line of the current visible line */
_rl_move_vert (_rl_vis_botlin);
/* And erase screen lines going up to line 0 (first visible line) */
for (curr_line = _rl_last_v_pos; curr_line >= 0; curr_line--)
{
_rl_move_vert (curr_line);
_rl_clear_to_eol (0);
}
return 0;
}
/* Tell the update routines that we have moved onto a new line with the
prompt already displayed. Code originally from the version of readline
distributed with CLISP. rl_expand_prompt must have already been called
(explicitly or implicitly). This still doesn't work exactly right; it
should use expand_prompt() */
int
rl_on_new_line_with_prompt (void)
{
int prompt_size, i, l, real_screenwidth, newlines;
char *prompt_last_line, *lprompt;
/* Initialize visible_line and invisible_line to ensure that they can hold
the already-displayed prompt. */
prompt_size = strlen (rl_prompt) + 1;
init_line_structures (prompt_size);
/* Make sure the line structures hold the already-displayed prompt for
redisplay. */
lprompt = local_prompt ? local_prompt : rl_prompt;
strcpy (visible_line, lprompt);
strcpy (invisible_line, lprompt);
/* If the prompt contains newlines, take the last tail. */
prompt_last_line = strrchr (rl_prompt, '\n');
if (!prompt_last_line)
prompt_last_line = rl_prompt;
l = strlen (prompt_last_line);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = _rl_col_width (prompt_last_line, 0, l, 1); /* XXX */
else
_rl_last_c_pos = l;
/* Dissect prompt_last_line into screen lines. Note that here we have
to use the real screenwidth. Readline's notion of screenwidth might be
one less, see terminal.c. */
real_screenwidth = _rl_screenwidth + (_rl_term_autowrap ? 0 : 1);
_rl_last_v_pos = l / real_screenwidth;
/* If the prompt length is a multiple of real_screenwidth, we don't know
whether the cursor is at the end of the last line, or already at the
beginning of the next line. Output a newline just to be safe. */
if (l > 0 && (l % real_screenwidth) == 0)
_rl_output_some_chars ("\n", 1);
last_lmargin = 0;
newlines = 0; i = 0;
while (i <= l)
{
_rl_vis_botlin = newlines;
vis_lbreaks[newlines++] = i;
i += real_screenwidth;
}
vis_lbreaks[newlines] = l;
visible_wrap_offset = 0;
rl_display_prompt = rl_prompt; /* XXX - make sure it's set */
return 0;
}
/* Actually update the display, period. */
int
rl_forced_update_display (void)
{
register char *temp;
if (visible_line)
{
temp = visible_line;
while (*temp)
*temp++ = '\0';
}
rl_on_new_line ();
forced_display++;
(*rl_redisplay_function) ();
return 0;
}
/* Redraw only the last line of a multi-line prompt. */
void
rl_redraw_prompt_last_line (void)
{
char *t;
t = strrchr (rl_display_prompt, '\n');
if (t)
redraw_prompt (++t);
else
rl_forced_update_display ();
}
/* Move the cursor from _rl_last_c_pos to NEW, which are buffer indices.
(Well, when we don't have multibyte characters, _rl_last_c_pos is a
buffer index.)
DATA is the contents of the screen line of interest; i.e., where
the movement is being done.
DATA is always the visible line or the invisible line */
static void
_rl_move_cursor_relative (int new, const char *data, const char *dataf)
{
register int i;
int woff; /* number of invisible chars on current line */
int cpos, dpos; /* current and desired cursor positions */
int adjust;
int in_invisline;
int mb_cur_max = MB_CUR_MAX;
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos;
if (cpos == 0 && cpos == new)
return;
#if defined (HANDLE_MULTIBYTE)
/* If we have multibyte characters, NEW is indexed by the buffer point in
a multibyte string, but _rl_last_c_pos is the display position. In
this case, NEW's display position is not obvious and must be
calculated. We need to account for invisible characters in this line,
as long as we are past them and they are counted by _rl_col_width. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
adjust = 1;
/* Try to short-circuit common cases and eliminate a bunch of multibyte
character function calls. */
/* 1. prompt string */
if (new == local_prompt_len && memcmp (data, local_prompt, new) == 0)
{
dpos = prompt_physical_chars;
cpos_adjusted = 1;
adjust = 0;
}
/* 2. prompt_string + line contents */
else if (new > local_prompt_len && local_prompt && memcmp (data, local_prompt, local_prompt_len) == 0)
{
dpos = prompt_physical_chars + _rl_col_width (data, local_prompt_len, new, 1);
cpos_adjusted = 1;
adjust = 0;
}
else
dpos = _rl_col_width (data, 0, new, 1);
if (displaying_prompt_first_line == 0)
adjust = 0;
/* yet another special case: printing the last line of a prompt with
multibyte characters and invisible characters whose printable length
exceeds the screen width with the last invisible character
(prompt_last_invisible) in the last line. IN_INVISLINE is the
offset of DATA in invisible_line */
in_invisline = 0;
if (data > invisible_line && data < invisible_line+inv_lbreaks[_rl_inv_botlin+1])
in_invisline = data - invisible_line;
/* Use NEW when comparing against the last invisible character in the
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
/* NEW is relative to the current displayed line, while
PROMPT_LAST_INVISIBLE is relative to the entire (wrapped) line.
Need a way to reconcile these two variables by turning NEW into a
buffer position relative to the start of the line */
if (adjust && ((new > prompt_last_invisible) || /* XXX - don't use woff here */
(new+in_invisline > prompt_last_invisible) || /* invisible line */
(prompt_physical_chars >= _rl_screenwidth && /* visible line */
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset >= woff && dpos >= woff &&
new > (prompt_last_invisible-(vis_lbreaks[_rl_last_v_pos])-wrap_offset))))
/* XXX last comparison might need to be >= */
{
dpos -= woff;
/* Since this will be assigned to _rl_last_c_pos at the end (more
precisely, _rl_last_c_pos == dpos when this function returns),
let the caller know. */
cpos_adjusted = 1;
}
}
else
#endif
dpos = new;
/* If we don't have to do anything, then return. */
if (cpos == dpos)
return;
/* It may be faster to output a CR, and then move forwards instead
of moving backwards. */
/* i == current physical cursor position. */
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
i = _rl_last_c_pos;
else
#endif
i = _rl_last_c_pos - woff;
if (dpos == 0 || CR_FASTER (dpos, _rl_last_c_pos) ||
(_rl_term_autowrap && i == _rl_screenwidth))
{
_rl_cr ();
cpos = _rl_last_c_pos = 0;
}
if (cpos < dpos)
{
/* Move the cursor forward. We do it by printing the command
to move the cursor forward if there is one, else print that
portion of the output buffer again. Which is cheaper? */
/* The above comment is left here for posterity. It is faster
to print one character (non-control) than to print a control
sequence telling the terminal to move forward one character.
That kind of control is for people who don't know what the
data is underneath the cursor. */
/* However, we need a handle on where the current display position is
in the buffer for the immediately preceding comment to be true.
In multibyte locales, we don't currently have that info available.
Without it, we don't know where the data we have to display begins
in the buffer and we have to go back to the beginning of the screen
line. In this case, we can use the terminal sequence to move forward
if it's available. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
if (_rl_term_forward_char)
{
for (i = cpos; i < dpos; i++)
tputs (_rl_term_forward_char, 1, _rl_output_character_function);
}
else
{
_rl_cr ();
puts_face (data, dataf, new);
}
}
else
puts_face (data + cpos, dataf + cpos, new - cpos);
}
#if defined (HANDLE_MULTIBYTE)
/* NEW points to the buffer point, but _rl_last_c_pos is the display point.
The byte length of the string is probably bigger than the column width
of the string, which means that if NEW == _rl_last_c_pos, then NEW's
display point is less than _rl_last_c_pos. */
#endif
else if (cpos > dpos)
_rl_backspace (cpos - dpos);
_rl_last_c_pos = dpos;
}
/* PWP: move the cursor up or down. */
void
_rl_move_vert (int to)
{
register int delta, i;
if (_rl_last_v_pos == to || to > _rl_screenheight)
return;
if ((delta = to - _rl_last_v_pos) > 0)
{
for (i = 0; i < delta; i++)
putc ('\n', rl_outstream);
_rl_cr ();
_rl_last_c_pos = 0;
}
else
{ /* delta < 0 */
#ifdef __DJGPP__
int row, col;
fflush (rl_outstream);
ScreenGetCursor (&row, &col);
ScreenSetCursor (row + delta, col);
i = -delta;
#else
if (_rl_term_up && *_rl_term_up)
for (i = 0; i < -delta; i++)
tputs (_rl_term_up, 1, _rl_output_character_function);
#endif /* !__DJGPP__ */
}
_rl_last_v_pos = to; /* Now TO is here */
}
/* Physically print C on rl_outstream. This is for functions which know
how to optimize the display. Return the number of characters output. */
int
rl_show_char (int c)
{
int n = 1;
if (META_CHAR (c) && (_rl_output_meta_chars == 0))
{
fprintf (rl_outstream, "M-");
n += 2;
c = UNMETA (c);
}
#if defined (DISPLAY_TABS)
if ((CTRL_CHAR (c) && c != '\t') || c == RUBOUT)
#else
if (CTRL_CHAR (c) || c == RUBOUT)
#endif /* !DISPLAY_TABS */
{
fprintf (rl_outstream, "C-");
n += 2;
c = CTRL_CHAR (c) ? UNCTRL (c) : '?';
}
putc (c, rl_outstream);
fflush (rl_outstream);
return n;
}
int
rl_character_len (int c, int pos)
{
unsigned char uc;
uc = (unsigned char)c;
if (META_CHAR (uc))
return ((_rl_output_meta_chars == 0) ? 4 : 1);
if (uc == '\t')
{
#if defined (DISPLAY_TABS)
return (((pos | 7) + 1) - pos);
#else
return (2);
#endif /* !DISPLAY_TABS */
}
if (CTRL_CHAR (c) || c == RUBOUT)
return (2);
return ((ISPRINT (uc)) ? 1 : 2);
}
/* How to print things in the "echo-area". The prompt is treated as a
mini-modeline. */
static int msg_saved_prompt = 0;
#if defined (USE_VARARGS)
int
#if defined (PREFER_STDARG)
rl_message (const char *format, ...)
#else
rl_message (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (HAVE_VSNPRINTF)
int bneed;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
if (msg_buf == 0)
msg_buf = xmalloc (msg_bufsiz = 128);
#if defined (HAVE_VSNPRINTF)
bneed = vsnprintf (msg_buf, msg_bufsiz, format, args);
if (bneed >= msg_bufsiz - 1)
{
msg_bufsiz = bneed + 1;
msg_buf = xrealloc (msg_buf, msg_bufsiz);
va_end (args);
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
}
#else
vsprintf (msg_buf, format, args);
msg_buf[msg_bufsiz - 1] = '\0'; /* overflow? */
#endif
va_end (args);
if (saved_local_prompt == 0)
{
rl_save_prompt ();
msg_saved_prompt = 1;
}
else if (local_prompt != saved_local_prompt)
{
FREE (local_prompt);
FREE (local_prompt_prefix);
local_prompt = (char *)NULL;
}
rl_display_prompt = msg_buf;
local_prompt = expand_prompt (msg_buf, 0, &prompt_visible_length,
&prompt_last_invisible,
&prompt_invis_chars_first_line,
&prompt_physical_chars);
local_prompt_prefix = (char *)NULL;
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
(*rl_redisplay_function) ();
return 0;
}
#else /* !USE_VARARGS */
int
rl_message (format, arg1, arg2)
char *format;
{
if (msg_buf == 0)
msg_buf = xmalloc (msg_bufsiz = 128);
sprintf (msg_buf, format, arg1, arg2);
msg_buf[msg_bufsiz - 1] = '\0'; /* overflow? */
rl_display_prompt = msg_buf;
if (saved_local_prompt == 0)
{
rl_save_prompt ();
msg_saved_prompt = 1;
}
else if (local_prompt != saved_local_prompt)
{
FREE (local_prompt);
FREE (local_prompt_prefix);
local_prompt = (char *)NULL;
}
local_prompt = expand_prompt (msg_buf, 0, &prompt_visible_length,
&prompt_last_invisible,
&prompt_invis_chars_first_line,
&prompt_physical_chars);
local_prompt_prefix = (char *)NULL;
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
(*rl_redisplay_function) ();
return 0;
}
#endif /* !USE_VARARGS */
/* How to clear things from the "echo-area". */
int
rl_clear_message (void)
{
rl_display_prompt = rl_prompt;
if (msg_saved_prompt)
{
rl_restore_prompt ();
msg_saved_prompt = 0;
}
(*rl_redisplay_function) ();
return 0;
}
int
rl_reset_line_state (void)
{
rl_on_new_line ();
rl_display_prompt = rl_prompt ? rl_prompt : "";
forced_display = 1;
return 0;
}
/* Save all of the variables associated with the prompt and its display. Most
of the complexity is dealing with the invisible characters in the prompt
string and where they are. There are enough of these that I should consider
a struct. */
void
rl_save_prompt (void)
{
saved_local_prompt = local_prompt;
saved_local_prefix = local_prompt_prefix;
saved_prefix_length = prompt_prefix_length;
saved_local_length = local_prompt_len;
saved_last_invisible = prompt_last_invisible;
saved_visible_length = prompt_visible_length;
saved_invis_chars_first_line = prompt_invis_chars_first_line;
saved_physical_chars = prompt_physical_chars;
saved_local_prompt_newlines = local_prompt_newlines;
local_prompt = local_prompt_prefix = (char *)0;
local_prompt_len = 0;
local_prompt_newlines = (int *)0;
prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0;
prompt_invis_chars_first_line = prompt_physical_chars = 0;
}
void
rl_restore_prompt (void)
{
FREE (local_prompt);
FREE (local_prompt_prefix);
FREE (local_prompt_newlines);
local_prompt = saved_local_prompt;
local_prompt_prefix = saved_local_prefix;
local_prompt_len = saved_local_length;
local_prompt_newlines = saved_local_prompt_newlines;
prompt_prefix_length = saved_prefix_length;
prompt_last_invisible = saved_last_invisible;
prompt_visible_length = saved_visible_length;
prompt_invis_chars_first_line = saved_invis_chars_first_line;
prompt_physical_chars = saved_physical_chars;
/* can test saved_local_prompt to see if prompt info has been saved. */
saved_local_prompt = saved_local_prefix = (char *)0;
saved_local_length = 0;
saved_last_invisible = saved_visible_length = saved_prefix_length = 0;
saved_invis_chars_first_line = saved_physical_chars = 0;
saved_local_prompt_newlines = 0;
}
char *
_rl_make_prompt_for_search (int pchar)
{
int len;
char *pmt, *p;
rl_save_prompt ();
/* We've saved the prompt, and can do anything with the various prompt
strings we need before they're restored. We want the unexpanded
portion of the prompt string after any final newline. */
p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
if (p == 0)
{
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, rl_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
}
else
{
p++;
len = strlen (p);
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, p);
pmt[len] = pchar;
pmt[len+1] = '\0';
}
/* will be overwritten by expand_prompt, called from rl_message */
prompt_physical_chars = saved_physical_chars + 1;
return pmt;
}
/* Quick redisplay hack when erasing characters at the end of the line. */
void
_rl_erase_at_end_of_line (int l)
{
register int i;
_rl_backspace (l);
for (i = 0; i < l; i++)
putc (' ', rl_outstream);
_rl_backspace (l);
for (i = 0; i < l; i++)
visible_line[--_rl_last_c_pos] = '\0';
rl_display_fixed++;
}
/* Clear to the end of the line. COUNT is the minimum
number of character spaces to clear, but we use a terminal escape
sequence if available. */
void
_rl_clear_to_eol (int count)
{
#ifndef __MSDOS__
if (_rl_term_clreol)
tputs (_rl_term_clreol, 1, _rl_output_character_function);
else
#endif
if (count)
space_to_eol (count);
}
/* Clear to the end of the line using spaces. COUNT is the minimum
number of character spaces to clear, */
static void
space_to_eol (int count)
{
register int i;
for (i = 0; i < count; i++)
putc (' ', rl_outstream);
_rl_last_c_pos += count;
}
void
_rl_clear_screen (int clrscr)
{
#if defined (__DJGPP__)
ScreenClear ();
ScreenSetCursor (0, 0);
#else
if (_rl_term_clrpag)
{
tputs (_rl_term_clrpag, 1, _rl_output_character_function);
if (clrscr && _rl_term_clrscroll)
tputs (_rl_term_clrscroll, 1, _rl_output_character_function);
}
else
rl_crlf ();
#endif /* __DJGPP__ */
}
/* Insert COUNT characters from STRING to the output stream at column COL. */
static void
insert_some_chars (char *string, int count, int col)
{
open_some_spaces (col);
_rl_output_some_chars (string, count);
}
/* Insert COL spaces, keeping the cursor at the same position. We follow the
ncurses documentation and use either im/ei with explicit spaces, or IC/ic
by itself. We assume there will either be ei or we don't need to use it. */
static void
open_some_spaces (int col)
{
#if !defined (__MSDOS__) && (!defined (__MINGW32__) || defined (NCURSES_VERSION))
char *buffer;
register int i;
/* If IC is defined, then we do not have to "enter" insert mode. */
if (_rl_term_IC)
{
buffer = tgoto (_rl_term_IC, 0, col);
tputs (buffer, 1, _rl_output_character_function);
}
else if (_rl_term_im && *_rl_term_im)
{
tputs (_rl_term_im, 1, _rl_output_character_function);
/* just output the desired number of spaces */
for (i = col; i--; )
_rl_output_character_function (' ');
/* If there is a string to turn off insert mode, use it now. */
if (_rl_term_ei && *_rl_term_ei)
tputs (_rl_term_ei, 1, _rl_output_character_function);
/* and move back the right number of spaces */
_rl_backspace (col);
}
else if (_rl_term_ic && *_rl_term_ic)
{
/* If there is a special command for inserting characters, then
use that first to open up the space. */
for (i = col; i--; )
tputs (_rl_term_ic, 1, _rl_output_character_function);
}
#endif /* !__MSDOS__ && (!__MINGW32__ || NCURSES_VERSION)*/
}
/* Delete COUNT characters from the display line. */
static void
delete_chars (int count)
{
if (count > _rl_screenwidth) /* XXX */
return;
#if !defined (__MSDOS__) && (!defined (__MINGW32__) || defined (NCURSES_VERSION))
if (_rl_term_DC && *_rl_term_DC)
{
char *buffer;
buffer = tgoto (_rl_term_DC, count, count);
tputs (buffer, count, _rl_output_character_function);
}
else
{
if (_rl_term_dc && *_rl_term_dc)
while (count--)
tputs (_rl_term_dc, 1, _rl_output_character_function);
}
#endif /* !__MSDOS__ && (!__MINGW32__ || NCURSES_VERSION)*/
}
void
_rl_update_final (void)
{
int full_lines, woff, botline_length;
if (line_structures_initialized == 0)
return;
full_lines = 0;
/* If the cursor is the only thing on an otherwise-blank last line,
compensate so we don't print an extra CRLF. */
if (_rl_vis_botlin && _rl_last_c_pos == 0 &&
visible_line[vis_lbreaks[_rl_vis_botlin]] == 0)
{
_rl_vis_botlin--;
full_lines = 1;
}
_rl_move_vert (_rl_vis_botlin);
woff = W_OFFSET(_rl_vis_botlin, wrap_offset);
botline_length = VIS_LLEN(_rl_vis_botlin) - woff;
/* If we've wrapped lines, remove the final xterm line-wrap flag. */
if (full_lines && _rl_term_autowrap && botline_length == _rl_screenwidth)
{
char *last_line, *last_face;
/* LAST_LINE includes invisible characters, so if you want to get the
last character of the first line, you have to take WOFF into account.
This needs to be done for both calls to _rl_move_cursor_relative,
which takes a buffer position as the first argument, and any direct
subscripts of LAST_LINE. */
last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */
last_face = &vis_face[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */
cpos_buffer_position = -1; /* don't know where we are in buffer */
_rl_move_cursor_relative (_rl_screenwidth - 1 + woff, last_line, last_face); /* XXX */
_rl_clear_to_eol (0);
puts_face (&last_line[_rl_screenwidth - 1 + woff],
&last_face[_rl_screenwidth - 1 + woff], 1);
}
_rl_vis_botlin = 0;
if (botline_length > 0 || _rl_last_c_pos > 0)
rl_crlf ();
fflush (rl_outstream);
rl_display_fixed++;
}
/* Move to the start of the current line. */
static void
cr (void)
{
_rl_cr ();
_rl_last_c_pos = 0;
}
/* Redraw the last line of a multi-line prompt that may possibly contain
terminal escape sequences. Called with the cursor at column 0 of the
line to draw the prompt on. */
static void
redraw_prompt (char *t)
{
char *oldp;
oldp = rl_display_prompt;
rl_save_prompt ();
rl_display_prompt = t;
local_prompt = expand_prompt (t, PMT_MULTILINE,
&prompt_visible_length,
&prompt_last_invisible,
&prompt_invis_chars_first_line,
&prompt_physical_chars);
local_prompt_prefix = (char *)NULL;
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
rl_forced_update_display ();
rl_display_prompt = oldp;
rl_restore_prompt();
}
/* Redisplay the current line after a SIGWINCH is received. */
void
_rl_redisplay_after_sigwinch (void)
{
char *t;
/* Clear the last line (assuming that the screen size change will result in
either more or fewer characters on that line only) and put the cursor at
column 0. Make sure the right thing happens if we have wrapped to a new
screen line. */
if (_rl_term_cr)
{
_rl_move_vert (_rl_vis_botlin);
_rl_cr ();
_rl_last_c_pos = 0;
#if !defined (__MSDOS__)
if (_rl_term_clreol)
tputs (_rl_term_clreol, 1, _rl_output_character_function);
else
#endif
{
space_to_eol (_rl_screenwidth);
_rl_cr ();
}
if (_rl_last_v_pos > 0)
_rl_move_vert (0);
}
else
rl_crlf ();
/* Redraw only the last line of a multi-line prompt. */
t = strrchr (rl_display_prompt, '\n');
if (t)
redraw_prompt (++t);
else
rl_forced_update_display ();
}
void
_rl_clean_up_for_exit (void)
{
if (_rl_echoing_p)
{
if (_rl_vis_botlin > 0) /* minor optimization plus bug fix */
_rl_move_vert (_rl_vis_botlin);
_rl_vis_botlin = 0;
fflush (rl_outstream);
rl_restart_output (1, 0);
}
}
void
_rl_erase_entire_line (void)
{
cr ();
_rl_clear_to_eol (0);
cr ();
fflush (rl_outstream);
}
void
_rl_ttyflush (void)
{
fflush (rl_outstream);
}
/* return the `current display line' of the cursor -- the number of lines to
move up to get to the first screen line of the current readline line. */
int
_rl_current_display_line (void)
{
int ret, nleft;
/* Find out whether or not there might be invisible characters in the
editing buffer. */
if (rl_display_prompt == rl_prompt)
nleft = _rl_last_c_pos - _rl_screenwidth - rl_visible_prompt_length;
else
nleft = _rl_last_c_pos - _rl_screenwidth;
if (nleft > 0)
ret = 1 + nleft / _rl_screenwidth;
else
ret = 0;
return ret;
}
void
_rl_refresh_line (void)
{
rl_clear_visible_line ();
rl_redraw_prompt_last_line ();
rl_keep_mark_active ();
}
#if defined (HANDLE_MULTIBYTE)
/* Calculate the number of screen columns occupied by STR from START to END.
In the case of multibyte characters with stateful encoding, we have to
scan from the beginning of the string to take the state into account. */
static int
_rl_col_width (const char *str, int start, int end, int flags)
{
wchar_t wc;
mbstate_t ps;
int tmp, point, width, max;
if (end <= start)
return 0;
if (MB_CUR_MAX == 1 || rl_byte_oriented)
/* this can happen in some cases where it's inconvenient to check */
return (end - start);
memset (&ps, 0, sizeof (mbstate_t));
point = 0;
max = end;
/* Try to short-circuit common cases. The adjustment to remove wrap_offset
is done by the caller. */
/* 1. prompt string */
if (flags && start == 0 && end == local_prompt_len && memcmp (str, local_prompt, local_prompt_len) == 0)
return (prompt_physical_chars + wrap_offset);
/* 2. prompt string + line contents */
else if (flags && start == 0 && local_prompt_len > 0 && end > local_prompt_len && local_prompt && memcmp (str, local_prompt, local_prompt_len) == 0)
{
tmp = prompt_physical_chars + wrap_offset;
/* XXX - try to call ourselves recursively with non-prompt portion */
tmp += _rl_col_width (str, local_prompt_len, end, flags);
return (tmp);
}
while (point < start)
{
if (_rl_utf8locale && UTF8_SINGLEBYTE(str[point]))
{
memset (&ps, 0, sizeof (mbstate_t));
tmp = 1;
}
else
tmp = mbrlen (str + point, max, &ps);
if (MB_INVALIDCH ((size_t)tmp))
{
/* In this case, the bytes are invalid or too short to compose a
multibyte character, so we assume that the first byte represents
a single character. */
point++;
max--;
/* 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 (MB_NULLWCH (tmp))
break; /* Found '\0' */
else
{
point += tmp;
max -= tmp;
}
}
/* If START is not a byte that starts a character, then POINT will be
greater than START. In this case, assume that (POINT - START) gives
a byte count that is the number of columns of difference. */
width = point - start;
while (point < end)
{
if (_rl_utf8locale && UTF8_SINGLEBYTE(str[point]))
{
tmp = 1;
wc = (wchar_t) str[point];
}
else
tmp = mbrtowc (&wc, str + point, max, &ps);
if (MB_INVALIDCH ((size_t)tmp))
{
/* In this case, the bytes are invalid or too short to compose a
multibyte character, so we assume that the first byte represents
a single character. */
point++;
max--;
/* and assume that the byte occupies a single column. */
width++;
/* 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 (MB_NULLWCH (tmp))
break; /* Found '\0' */
else
{
point += tmp;
max -= tmp;
tmp = WCWIDTH(wc);
width += (tmp >= 0) ? tmp : 1;
}
}
width += point - end;
return width;
}
#endif /* HANDLE_MULTIBYTE */
readline-8.1.2/mbutil.c 000644 000436 000120 00000030340 13645622120 015011 0 ustar 00chet admin 000000 000000 /* mbutil.c -- readline multibyte character utility functions */
/* Copyright (C) 2001-2020 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 "rldefs.h"
#include "rlmbutil.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"
/* Declared here so it can be shared between the readline and history
libraries. */
#if defined (HANDLE_MULTIBYTE)
int rl_byte_oriented = 0;
#else
int rl_byte_oriented = 1;
#endif
/* Ditto */
int _rl_utf8locale = 0;
/* **************************************************************** */
/* */
/* Multibyte Character Utility Functions */
/* */
/* **************************************************************** */
#if defined(HANDLE_MULTIBYTE)
/* **************************************************************** */
/* */
/* UTF-8 specific Character Utility Functions */
/* */
/* **************************************************************** */
/* Return the length in bytes of the possibly-multibyte character beginning
at S. Encoding is UTF-8. */
static int
_rl_utf8_mblen (const char *s, size_t n)
{
unsigned char c, c1, c2, c3;
if (s == 0)
return (0); /* no shift states */
if (n <= 0)
return (-1);
c = (unsigned char)*s;
if (c < 0x80)
return (c != 0);
if (c >= 0xc2)
{
c1 = (unsigned char)s[1];
if (c < 0xe0)
{
if (n == 1)
return -2;
if (n >= 2 && (c1 ^ 0x80) < 0x40)
return 2;
}
else if (c < 0xf0)
{
if (n == 1)
return -2;
if ((c1 ^ 0x80) < 0x40
&& (c >= 0xe1 || c1 >= 0xa0)
&& (c != 0xed || c1 < 0xa0))
{
if (n == 2)
return -2;
c2 = (unsigned char)s[2];
if ((c2 ^ 0x80) < 0x40)
return 3;
}
}
else if (c < 0xf4)
{
if (n == 1)
return -2;
if (((c1 ^ 0x80) < 0x40)
&& (c >= 0xf1 || c1 >= 0x90)
&& (c < 0xf4 || (c == 0xf4 && c1 < 0x90)))
{
if (n == 2)
return -2;
c2 = (unsigned char)s[2];
if ((c2 ^ 0x80) < 0x40)
{
if (n == 3)
return -2;
c3 = (unsigned char)s[3];
if ((c3 ^ 0x80) < 0x40)
return 4;
}
}
}
}
/* invalid or incomplete multibyte character */
return -1;
}
static int
_rl_find_next_mbchar_internal (char *string, int seed, int count, int find_non_zero)
{
size_t tmp, len;
mbstate_t ps;
int point;
wchar_t wc;
tmp = 0;
memset(&ps, 0, sizeof (mbstate_t));
if (seed < 0)
seed = 0;
if (count <= 0)
return seed;
point = seed + _rl_adjust_point (string, seed, &ps);
/* if _rl_adjust_point returns -1, the character or string is invalid.
treat as a byte. */
if (point == seed - 1) /* invalid */
return seed + 1;
/* if this is true, means that seed was not pointing to a byte indicating
the beginning of a multibyte character. Correct the point and consume
one char. */
if (seed < point)
count--;
while (count > 0)
{
len = strlen (string + point);
if (len == 0)
break;
if (_rl_utf8locale && UTF8_SINGLEBYTE(string[point]))
{
tmp = 1;
wc = (wchar_t) string[point];
memset(&ps, 0, sizeof(mbstate_t));
}
else
tmp = mbrtowc (&wc, string+point, len, &ps);
if (MB_INVALIDCH ((size_t)tmp))
{
/* invalid bytes. assume a byte represents a character */
point++;
count--;
/* reset states. */
memset(&ps, 0, sizeof(mbstate_t));
}
else if (MB_NULLWCH (tmp))
break; /* found wide '\0' */
else
{
/* valid bytes */
point += tmp;
if (find_non_zero)
{
if (WCWIDTH (wc) == 0)
continue;
else
count--;
}
else
count--;
}
}
if (find_non_zero)
{
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && WCWIDTH (wc) == 0)
{
point += tmp;
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
}
}
return point;
}
static inline int
_rl_test_nonzero (char *string, int ind, int len)
{
size_t tmp;
wchar_t wc;
mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t));
tmp = mbrtowc (&wc, string + ind, len - ind, &ps);
/* treat invalid multibyte sequences as non-zero-width */
return (MB_INVALIDCH (tmp) || MB_NULLWCH (tmp) || WCWIDTH (wc) > 0);
}
/* experimental -- needs to handle zero-width characters better */
static int
_rl_find_prev_utf8char (char *string, int seed, int find_non_zero)
{
char *s;
unsigned char b;
int save, prev;
size_t len;
if (find_non_zero)
len = RL_STRLEN (string);
prev = seed - 1;
while (prev >= 0)
{
b = (unsigned char)string[prev];
if (UTF8_SINGLEBYTE (b))
return (prev);
save = prev;
/* Move back until we're not in the middle of a multibyte char */
if (UTF8_MBCHAR (b))
{
while (prev > 0 && (b = (unsigned char)string[--prev]) && UTF8_MBCHAR (b))
;
}
if (UTF8_MBFIRSTCHAR (b))
{
if (find_non_zero)
{
if (_rl_test_nonzero (string, prev, len))
return (prev);
else /* valid but WCWIDTH (wc) == 0 */
prev = prev - 1;
}
else
return (prev);
}
else
return (save); /* invalid utf-8 multibyte sequence */
}
return ((prev < 0) ? 0 : prev);
}
/*static*/ int
_rl_find_prev_mbchar_internal (char *string, int seed, int find_non_zero)
{
mbstate_t ps;
int prev, non_zero_prev, point, length;
size_t tmp;
wchar_t wc;
if (_rl_utf8locale)
return (_rl_find_prev_utf8char (string, seed, find_non_zero));
memset(&ps, 0, sizeof(mbstate_t));
length = strlen(string);
if (seed < 0)
return 0;
else if (length < seed)
return length;
prev = non_zero_prev = point = 0;
while (point < seed)
{
if (_rl_utf8locale && UTF8_SINGLEBYTE(string[point]))
{
tmp = 1;
wc = (wchar_t) string[point];
memset(&ps, 0, sizeof(mbstate_t));
}
else
tmp = mbrtowc (&wc, string + point, length - point, &ps);
if (MB_INVALIDCH ((size_t)tmp))
{
/* in this case, bytes are invalid or too short to compose
multibyte char, so assume that the first byte represents
a single character anyway. */
tmp = 1;
/* clear the state of the byte sequence, because
in this case effect of mbstate is undefined */
memset(&ps, 0, sizeof (mbstate_t));
/* Since we're assuming that this byte represents a single
non-zero-width character, don't forget about it. */
prev = point;
}
else if (MB_NULLWCH (tmp))
break; /* Found '\0' char. Can this happen? */
else
{
if (find_non_zero)
{
if (WCWIDTH (wc) != 0)
prev = point;
}
else
prev = point;
}
point += tmp;
}
return prev;
}
/* return the number of bytes parsed from the multibyte sequence starting
at src, if a non-L'\0' wide character was recognized. It returns 0,
if a L'\0' wide character was recognized. It returns (size_t)(-1),
if an invalid multibyte sequence was encountered. It returns (size_t)(-2)
if it couldn't parse a complete multibyte character. */
int
_rl_get_char_len (char *src, mbstate_t *ps)
{
size_t tmp, l;
int mb_cur_max;
/* Look at no more than MB_CUR_MAX characters */
l = (size_t)strlen (src);
if (_rl_utf8locale && l > 0 && UTF8_SINGLEBYTE(*src))
tmp = (*src != 0) ? 1 : 0;
else
{
mb_cur_max = MB_CUR_MAX;
tmp = mbrlen((const char *)src, (l < mb_cur_max) ? l : mb_cur_max, ps);
}
if (tmp == (size_t)(-2))
{
/* too short to compose multibyte char */
if (ps)
memset (ps, 0, sizeof(mbstate_t));
return -2;
}
else if (tmp == (size_t)(-1))
{
/* invalid to compose multibyte char */
/* initialize the conversion state */
if (ps)
memset (ps, 0, sizeof(mbstate_t));
return -1;
}
else if (tmp == (size_t)0)
return 0;
else
return (int)tmp;
}
/* compare the specified two characters. If the characters matched,
return 1. Otherwise return 0. */
int
_rl_compare_chars (char *buf1, int pos1, mbstate_t *ps1, char *buf2, int pos2, mbstate_t *ps2)
{
int i, w1, w2;
if ((w1 = _rl_get_char_len (&buf1[pos1], ps1)) <= 0 ||
(w2 = _rl_get_char_len (&buf2[pos2], ps2)) <= 0 ||
(w1 != w2) ||
(buf1[pos1] != buf2[pos2]))
return 0;
for (i = 1; i < w1; i++)
if (buf1[pos1+i] != buf2[pos2+i])
return 0;
return 1;
}
/* adjust pointed byte and find mbstate of the point of string.
adjusted point will be point <= adjusted_point, and returns
differences of the byte(adjusted_point - point).
if point is invalid (point < 0 || more than string length),
it returns -1 */
int
_rl_adjust_point (char *string, int point, mbstate_t *ps)
{
size_t tmp;
int length, pos;
tmp = 0;
pos = 0;
length = strlen(string);
if (point < 0)
return -1;
if (length < point)
return -1;
while (pos < point)
{
if (_rl_utf8locale && UTF8_SINGLEBYTE(string[pos]))
tmp = 1;
else
tmp = mbrlen (string + pos, length - pos, ps);
if (MB_INVALIDCH ((size_t)tmp))
{
/* in this case, bytes are invalid or too short to compose
multibyte char, so assume that the first byte represents
a single character anyway. */
pos++;
/* clear the state of the byte sequence, because
in this case effect of mbstate is undefined */
if (ps)
memset (ps, 0, sizeof (mbstate_t));
}
else if (MB_NULLWCH (tmp))
pos++;
else
pos += tmp;
}
return (pos - point);
}
int
_rl_is_mbchar_matched (char *string, int seed, int end, char *mbchar, int length)
{
int i;
if ((end - seed) < length)
return 0;
for (i = 0; i < length; i++)
if (string[seed + i] != mbchar[i])
return 0;
return 1;
}
wchar_t
_rl_char_value (char *buf, int ind)
{
size_t tmp;
wchar_t wc;
mbstate_t ps;
int l;
if (MB_LEN_MAX == 1 || rl_byte_oriented)
return ((wchar_t) buf[ind]);
if (_rl_utf8locale && UTF8_SINGLEBYTE(buf[ind]))
return ((wchar_t) buf[ind]);
l = strlen (buf);
if (ind >= l - 1)
return ((wchar_t) buf[ind]);
if (l < ind) /* Sanity check */
l = strlen (buf+ind);
memset (&ps, 0, sizeof (mbstate_t));
tmp = mbrtowc (&wc, buf + ind, l - ind, &ps);
if (MB_INVALIDCH (tmp) || MB_NULLWCH (tmp))
return ((wchar_t) buf[ind]);
return wc;
}
#endif /* HANDLE_MULTIBYTE */
/* Find next `count' characters started byte point of the specified seed.
If flags is MB_FIND_NONZERO, we look for non-zero-width multibyte
characters. */
#undef _rl_find_next_mbchar
int
_rl_find_next_mbchar (char *string, int seed, int count, int flags)
{
#if defined (HANDLE_MULTIBYTE)
return _rl_find_next_mbchar_internal (string, seed, count, flags);
#else
return (seed + count);
#endif
}
/* Find previous character started byte point of the specified seed.
Returned point will be point <= seed. If flags is MB_FIND_NONZERO,
we look for non-zero-width multibyte characters. */
#undef _rl_find_prev_mbchar
int
_rl_find_prev_mbchar (char *string, int seed, int flags)
{
#if defined (HANDLE_MULTIBYTE)
return _rl_find_prev_mbchar_internal (string, seed, flags);
#else
return ((seed == 0) ? seed : seed - 1);
#endif
}
readline-8.1.2/configure.ac 000664 000436 000120 00000021421 13746615626 015660 0 ustar 00chet admin 000000 000000 dnl
dnl Configure script for readline library
dnl
dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2020 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 .
AC_REVISION([for Readline 8.1, version 2.90])
AC_INIT(readline, 8.1, bug-readline@gnu.org)
dnl make sure we are using a recent autoconf version
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR(readline.h)
AC_CONFIG_AUX_DIR(./support)
AC_CONFIG_HEADERS(config.h)
dnl update the value of RL_READLINE_VERSION in readline.h when this changes
LIBVERSION=8.1
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
dnl configure defaults
opt_curses=no
dnl arguments to configure
AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
if test "$opt_curses" = "yes"; then
prefer_curses=yes
fi
dnl option parsing for optional features
opt_multibyte=yes
opt_static_libs=yes
opt_shared_libs=yes
opt_install_examples=yes
opt_bracketed_paste_default=yes
AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval)
AC_ARG_ENABLE(bracketed-paste-default, AC_HELP_STRING([--disable-bracketed-paste-default], [disable bracketed paste by default [[default=enable]]]), opt_bracketed_paste_default=$enableval)
if test $opt_multibyte = no; then
AC_DEFINE(NO_MULTIBYTE_SUPPORT)
fi
if test $opt_bracketed_paste_default = yes; then
BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=1'
else
BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=0'
fi
AC_SUBST(BRACKETED_PASTE)
dnl load up the cross-building cache file -- add more cases and cache
dnl files as necessary
dnl Note that host and target machine are the same, and different than the
dnl build machine.
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'
AC_SUBST(CROSS_COMPILE)
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
AC_PROG_MAKE_SET
AC_PROG_CC
dnl AC_AIX
AC_MINIX
# 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}"
fi
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_CHECK_TOOL(AR, ar)
dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
dnl This allows people to set it when running configure or make
test -n "$ARFLAGS" || ARFLAGS="cr"
AC_PROG_RANLIB
MAKE_SHELL=/bin/sh
AC_SUBST(MAKE_SHELL)
AC_C_CONST
AC_C_PROTOTYPES
AC_C_CHAR_UNSIGNED
AC_C_VOLATILE
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)
AC_HEADER_STDC
AC_HEADER_STAT
AC_HEADER_DIRENT
AC_CHECK_FUNCS(fcntl kill lstat readlink)
AC_CHECK_FUNCS(fnmatch memmove pselect putenv select setenv setlocale \
strcasecmp strpbrk tcgetattr vsnprintf)
AC_CHECK_FUNCS(isascii isxdigit)
AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
AC_FUNC_CHOWN
AC_FUNC_STRCOLL
AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
string.h strings.h \
limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h)
AC_CHECK_HEADERS(sys/ptem.h,,,
[[
#if HAVE_SYS_STREAM_H
# include
#endif
]])
AC_SYS_LARGEFILE
BASH_SYS_SIGNAL_VINTAGE
BASH_SYS_REINSTALL_SIGHANDLERS
BASH_FUNC_POSIX_SETJMP
BASH_FUNC_LSTAT
BASH_FUNC_STRCOLL
BASH_FUNC_CTYPE_NONASCII
BASH_CHECK_GETPW_FUNCS
AC_HEADER_TIOCGWINSZ
BASH_TYPE_SIG_ATOMIC_T
BASH_TYPE_SIGHANDLER
BASH_HAVE_TIOCSTAT
BASH_HAVE_FIONREAD
BASH_CHECK_SPEED_T
BASH_STRUCT_WINSIZE
BASH_STRUCT_DIRENT_D_INO
BASH_STRUCT_DIRENT_D_FILENO
AC_CHECK_HEADERS(libaudit.h)
AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include ]])
dnl yuck
case "$host_os" in
aix*) prefer_curses=yes ;;
esac
BASH_CHECK_LIB_TERMCAP
if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
if test "$prefer_curses" = yes; then
TERMCAP_LIB=-lcurses
else
TERMCAP_LIB=-ltermcap #default
fi
fi
# Windows ncurses installation
if test "$TERMCAP_LIB" = "-lncurses"; then
AC_CHECK_HEADERS(ncurses/termcap.h)
fi
case "$TERMCAP_LIB" in
-ltinfo) TERMCAP_PKG_CONFIG_LIB=tinfo ;;
-lcurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
-lncurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
-ltermcap) TERMCAP_PKG_CONFIG_LIB=termcap ;;
*) TERMCAP_PKG_CONFIG_LIB=termcap ;;
esac
BASH_CHECK_MULTIBYTE
case "$host_cpu" in
*cray*) LOCAL_CFLAGS=-DCRAY ;;
*s390*) LOCAL_CFLAGS=-fsigned-char ;;
esac
case "$host_os" in
isc*) LOCAL_CFLAGS=-Disc386 ;;
hpux*) LOCAL_CFLAGS="-DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
esac
# shared library configuration section
#
# Shared object configuration section. These values are generated by
# ${srcdir}/support/shobj-conf
#
if test -f ${srcdir}/support/shobj-conf; then
AC_MSG_CHECKING(configuration for building shared libraries)
eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
# case "$SHLIB_LIBS" in
# *curses*|*termcap*|*termlib*) ;;
# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
# esac
AC_SUBST(SHOBJ_CC)
AC_SUBST(SHOBJ_CFLAGS)
AC_SUBST(SHOBJ_LD)
AC_SUBST(SHOBJ_LDFLAGS)
AC_SUBST(SHOBJ_XLDFLAGS)
AC_SUBST(SHOBJ_LIBS)
AC_SUBST(SHOBJ_STATUS)
AC_SUBST(SHLIB_STATUS)
AC_SUBST(SHLIB_XLDFLAGS)
AC_SUBST(SHLIB_DOT)
AC_SUBST(SHLIB_LIBPREF)
AC_SUBST(SHLIB_LIBSUFF)
AC_SUBST(SHLIB_LIBVERSION)
AC_SUBST(SHLIB_DLLVERSION)
AC_SUBST(SHLIB_LIBS)
AC_MSG_RESULT($SHLIB_STATUS)
# SHLIB_STATUS is either `supported' or `unsupported'. If it's
# `unsupported', turn off any default shared library building
if test "$SHLIB_STATUS" = 'unsupported'; then
opt_shared_libs=no
fi
# shared library versioning
# quoted for m4 so I can use character classes
SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
AC_SUBST(SHLIB_MAJOR)
AC_SUBST(SHLIB_MINOR)
fi
if test "$opt_static_libs" = "yes"; then
STATIC_TARGET=static
STATIC_INSTALL_TARGET=install-static
fi
if test "$opt_shared_libs" = "yes"; then
SHARED_TARGET=shared
SHARED_INSTALL_TARGET=install-shared
fi
AC_SUBST(STATIC_TARGET)
AC_SUBST(SHARED_TARGET)
AC_SUBST(STATIC_INSTALL_TARGET)
AC_SUBST(SHARED_INSTALL_TARGET)
if test "$opt_install_examples" = "yes"; then
EXAMPLES_INSTALL_TARGET=install-examples
fi
AC_SUBST(EXAMPLES_INSTALL_TARGET)
case "$build_os" in
msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
*) BUILD_DIR=`pwd` ;;
esac
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
AC_SUBST(BUILD_DIR)
if test -n "$want_auto_cflags"; then
CFLAGS="$AUTO_CFLAGS"
fi
CFLAGS="$CFLAGS $STYLE_CFLAGS"
AC_SUBST(CFLAGS)
AC_SUBST(LOCAL_CFLAGS)
AC_SUBST(LOCAL_LDFLAGS)
AC_SUBST(LOCAL_DEFS)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
AC_SUBST(host_cpu)
AC_SUBST(host_os)
AC_SUBST(LIBVERSION)
AC_SUBST(TERMCAP_LIB)
AC_SUBST(TERMCAP_PKG_CONFIG_LIB)
AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc],
[
# Makefile uses this timestamp file to record whether config.h is up to date.
echo > stamp-h
])
readline-8.1.2/rltty.c 000644 000436 000120 00000056267 13350464376 014725 0 ustar 00chet admin 000000 000000 /* rltty.c -- functions to prepare and restore the terminal for readline's
use. */
/* Copyright (C) 1992-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 .
*/
#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 */
rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
static void set_winsize PARAMS((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. */
static void
set_winsize (tty)
int tty;
{
#if defined (TIOCGWINSZ)
struct winsize w;
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
(void) ioctl (tty, TIOCSWINSZ, &w);
#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 PARAMS((TIOTYPE *));
static int _get_tty_settings PARAMS((int, TIOTYPE *));
static int get_tty_settings PARAMS((int, TIOTYPE *));
static int _set_tty_settings PARAMS((int, TIOTYPE *));
static int set_tty_settings PARAMS((int, TIOTYPE *));
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *));
static void
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 defined (USE_XON_XOFF)
/* 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);
# endif /* USE_XON_XOFF */
/* 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 PARAMS((TIOTYPE *));
static int _get_tty_settings PARAMS((int, TIOTYPE *));
static int get_tty_settings PARAMS((int, TIOTYPE *));
static int _set_tty_settings PARAMS((int, TIOTYPE *));
static int set_tty_settings PARAMS((int, TIOTYPE *));
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *));
static void _rl_bind_tty_special_chars PARAMS((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 defined (USE_XON_XOFF)
#if defined (IXANY)
tiop->c_iflag &= ~(IXON | IXANY);
#else
/* `strict' Posix systems do not define IXANY. */
tiop->c_iflag &= ~IXON;
#endif /* IXANY */
#endif /* USE_XON_XOFF */
/* 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);
if (_rl_eof_found)
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.1.2/INSTALL 000664 000436 000120 00000030311 13746617130 014411 0 ustar 00chet admin 000000 000000 Basic Installation
==================
These are installation instructions for Readline-8.1.
The simplest way to compile readline is:
1. `cd' to the directory containing the readline source code and type
`./configure' to configure readline for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes some time. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile readline and build the static readline
and history libraries. If supported, the shared readline and history
libraries will be built also. See below for instructions on compiling
the other parts of the distribution. Typing `make everything' will
cause the static and shared libraries (if supported) and the example
programs to be built.
3. Type `make install' to install the static readline and history
libraries, the readline include files, the documentation, and, if
supported, the shared readline and history libraries.
4. You can remove the created libraries and object files from the
build directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile readline for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the readline developers, and should be used with care.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It
uses those values to create a `Makefile' in the build directory,
and Makefiles in the `doc', `shlib', and `examples'
subdirectories. It also creates a `config.h' file containing
system-dependent definitions. Finally, it creates a shell script
`config.status' that you can run in the future to recreate the
current configuration, a file `config.cache' that saves the
results of its tests to speed up reconfiguring, and a file
`config.log' containing compiler output (useful mainly for
debugging `configure').
If you need to do unusual things to compile readline, please try
to figure out how `configure' could check whether to do them, and
mail diffs or instructions to so they can
be considered for the next release. If at some point
`config.cache' contains results you don't want to keep, you may
remove or edit it.
The file `configure.in' is used to create `configure' by a
program called `autoconf'. You only need `configure.in' if you
want to change it or regenerate `configure' using a newer version
of `autoconf'. The readline `configure.in' requires autoconf
version 2.50 or newer.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile readline for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile readline for one architecture at a
time in the source code directory. After you have installed
readline for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' will install the readline libraries in
`/usr/local/lib', the include files in
`/usr/local/include/readline', the man pages in `/usr/local/man',
and the info files in `/usr/local/info'. You can specify an
installation prefix other than `/usr/local' by giving `configure'
the option `--prefix=PATH' or by supplying a value for the
DESTDIR variable when running `make install'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.
If you give `configure' the option `--exec-prefix=PATH', the
readline Makefiles will use PATH as the prefix for installing the
libraries. Documentation and other data files will still use the
regular prefix.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but need to determine by the type of host readline
will run on. Usually `configure' can figure that out, but if it
prints a message saying it can not guess the host type, give it
the `--host=TYPE' option. TYPE can either be a short name for
the system type, such as `sun4', or a canonical name with three
fields: CPU-COMPANY-SYSTEM (e.g., i386-unknown-freebsd4.2).
See the file `config.sub' for the possible values of each field.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: the readline `configure' looks for a site script, but not
all `configure' scripts do.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
Optional Features
=================
The readline `configure' recognizes a single `--with-PACKAGE' option:
`--with-curses'
This tells readline that it can find the termcap library functions
(tgetent, et al.) in the curses library, rather than a separate
termcap library. Readline uses the termcap functions, but does not
link with the termcap or curses library itself, allowing applications
which link with readline the to choose an appropriate library.
This option tells readline to link the example programs with the
curses library rather than libtermcap.
`configure' also recognizes two `--enable-FEATURE' options:
`--enable-shared'
Build the shared libraries by default on supported platforms. The
default is `yes'.
`--enable-static'
Build the static libraries by default. The default is `yes'.
`--enable-bracketed-paste-default'
Enable bracketed paste by default, so the initial value of the
`enable-bracketed-paste' Readline variable is `on'. The default
is `yes'.
Shared Libraries
================
There is support for building shared versions of the readline and
history libraries. The configure script creates a Makefile in
the `shlib' subdirectory, and typing `make shared' will cause
shared versions of the readline and history libraries to be built
on supported platforms.
If `configure' is given the `--enable-shared' option, it will attempt
to build the shared libraries by default on supported platforms.
Configure calls the script support/shobj-conf to test whether or
not shared library creation is supported and to generate the values
of variables that are substituted into shlib/Makefile. If you
try to build shared libraries on an unsupported platform, `make'
will display a message asking you to update support/shobj-conf for
your platform.
If you need to update support/shobj-conf, you will need to create
a `stanza' for your operating system and compiler. The script uses
the value of host_os and ${CC} as determined by configure. For
instance, FreeBSD 4.2 with any version of gcc is identified as
`freebsd4.2-gcc*'.
In the stanza for your operating system-compiler pair, you will need to
define several variables. They are:
SHOBJ_CC The C compiler used to compile source files into shareable
object files. This is normally set to the value of ${CC}
by configure, and should not need to be changed.
SHOBJ_CFLAGS Flags to pass to the C compiler ($SHOBJ_CC) to create
position-independent code. If you are using gcc, this
should probably be set to `-fpic'.
SHOBJ_LD The link editor to be used to create the shared library from
the object files created by $SHOBJ_CC. If you are using
gcc, a value of `gcc' will probably work.
SHOBJ_LDFLAGS Flags to pass to SHOBJ_LD to enable shared object creation.
If you are using gcc, `-shared' may be all that is necessary.
These should be the flags needed for generic shared object
creation.
SHLIB_XLDFLAGS Additional flags to pass to SHOBJ_LD for shared library
creation. Many systems use the -R option to the link
editor to embed a path within the library for run-time
library searches. A reasonable value for such systems would
be `-R$(libdir)'.
SHLIB_LIBS Any additional libraries that shared libraries should be
linked against when they are created.
SHLIB_LIBPREF The prefix to use when generating the filename of the shared
library. The default is `lib'; Cygwin uses `cyg'.
SHLIB_LIBSUFF The suffix to add to `libreadline' and `libhistory' when
generating the filename of the shared library. Many systems
use `so'; HP-UX uses `sl'.
SHLIB_LIBVERSION The string to append to the filename to indicate the version
of the shared library. It should begin with $(SHLIB_LIBSUFF),
and possibly include version information that allows the
run-time loader to load the version of the shared library
appropriate for a particular program. Systems using shared
libraries similar to SunOS 4.x use major and minor library
version numbers; for those systems a value of
`$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' is appropriate.
Systems based on System V Release 4 don't use minor version
numbers; use `$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' on those systems.
Other Unix versions use different schemes.
SHLIB_DLLVERSION The version number for shared libraries that determines API
compatibility between readline versions and the underlying
system. Used only on Cygwin. Defaults to $SHLIB_MAJOR, but
can be overridden at configuration time by defining DLLVERSION
in the environment.
SHLIB_DOT The character used to separate the name of the shared library
from the suffix and version information. The default is `.';
systems like Cygwin which don't separate version information
from the library name should set this to the empty string.
SHLIB_STATUS Set this to `supported' when you have defined the other
necessary variables. Make uses this to determine whether
or not shared library creation should be attempted. If
shared libraries are not supported, this will be set to
`unsupported'.
You should look at the existing stanzas in support/shobj-conf for ideas.
Once you have updated support/shobj-conf, re-run configure and type
`make shared' or `make'. The shared libraries will be created in the
shlib subdirectory.
If shared libraries are created, `make install' will install them.
You may install only the shared libraries by running `make
install-shared' from the top-level build directory. Running `make
install' in the shlib subdirectory will also work. If you don't want
to install any created shared libraries, run `make install-static'.
readline-8.1.2/compat.c 000664 000436 000120 00000004515 13052147500 015003 0 ustar 00chet admin 000000 000000 /* compat.c -- backwards compatibility functions. */
/* Copyright (C) 2000-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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#include "rlstdc.h"
#include "rltypedefs.h"
extern void rl_free_undo_list PARAMS((void));
extern int rl_maybe_save_line PARAMS((void));
extern int rl_maybe_unsave_line PARAMS((void));
extern int rl_maybe_replace_line PARAMS((void));
extern int rl_crlf PARAMS((void));
extern int rl_ding PARAMS((void));
extern int rl_alphabetic PARAMS((int));
extern char **rl_completion_matches PARAMS((const char *, rl_compentry_func_t *));
extern char *rl_username_completion_function PARAMS((const char *, int));
extern char *rl_filename_completion_function PARAMS((const char *, int));
/* Provide backwards-compatible entry points for old function names. */
void
free_undo_list (void)
{
rl_free_undo_list ();
}
int
maybe_replace_line (void)
{
return rl_maybe_replace_line ();
}
int
maybe_save_line (void)
{
return rl_maybe_save_line ();
}
int
maybe_unsave_line (void)
{
return rl_maybe_unsave_line ();
}
int
ding (void)
{
return rl_ding ();
}
int
crlf (void)
{
return rl_crlf ();
}
int
alphabetic (int c)
{
return rl_alphabetic (c);
}
char **
completion_matches (const char *s, rl_compentry_func_t *f)
{
return rl_completion_matches (s, f);
}
char *
username_completion_function (const char *s, int i)
{
return rl_username_completion_function (s, i);
}
char *
filename_completion_function (const char *s, int i)
{
return rl_filename_completion_function (s, i);
}
readline-8.1.2/tcap.h 000664 000436 000120 00000003171 12651440357 014463 0 ustar 00chet admin 000000 000000 /* tcap.h -- termcap library functions and variables. */
/* Copyright (C) 1996-2015 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 (_RLTCAP_H_)
#define _RLTCAP_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#if defined (HAVE_TERMCAP_H)
# if defined (__linux__) && !defined (SPEED_T_IN_SYS_TYPES)
# include "rltty.h"
# endif
# include
#elif defined (HAVE_NCURSES_TERMCAP_H)
# include
#else
/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC.
Unfortunately, PC is a global variable used by the termcap library. */
#ifdef PC
# undef PC
#endif
extern char PC;
extern char *UP, *BC;
extern short ospeed;
extern int tgetent ();
extern int tgetflag ();
extern int tgetnum ();
extern char *tgetstr ();
extern int tputs ();
extern char *tgoto ();
#endif /* HAVE_TERMCAP_H */
#endif /* !_RLTCAP_H_ */
readline-8.1.2/undo.c 000644 000436 000120 00000020020 13424637000 014452 0 ustar 00chet admin 000000 000000 /* undo.c - manage list of changes to lines, offering opportunity to undo them */
/* 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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#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
/* System-specific feature definitions and include files. */
#include "rldefs.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
extern void _hs_replace_history_data PARAMS((int, histdata_t *, histdata_t *));
extern HIST_ENTRY *_rl_saved_line_for_history;
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
int _rl_doing_an_undo = 0;
/* How many unclosed undo groups we currently have. */
int _rl_undo_group_level = 0;
/* The current undo list for THE_LINE. */
UNDO_LIST *rl_undo_list = (UNDO_LIST *)NULL;
/* **************************************************************** */
/* */
/* Undo, and Undoing */
/* */
/* **************************************************************** */
static UNDO_LIST *
alloc_undo_entry (enum undo_code what, int start, int end, char *text)
{
UNDO_LIST *temp;
temp = (UNDO_LIST *)xmalloc (sizeof (UNDO_LIST));
temp->what = what;
temp->start = start;
temp->end = end;
temp->text = text;
temp->next = (UNDO_LIST *)NULL;
return temp;
}
/* Remember how to undo something. Concatenate some undos if that
seems right. */
void
rl_add_undo (enum undo_code what, int start, int end, char *text)
{
UNDO_LIST *temp;
temp = alloc_undo_entry (what, start, end, text);
temp->next = rl_undo_list;
rl_undo_list = temp;
}
/* Free an UNDO_LIST */
void
_rl_free_undo_list (UNDO_LIST *ul)
{
UNDO_LIST *release;
while (ul)
{
release = ul;
ul = ul->next;
if (release->what == UNDO_DELETE)
xfree (release->text);
xfree (release);
}
}
/* Free the existing undo list. */
void
rl_free_undo_list (void)
{
UNDO_LIST *release, *orig_list;
orig_list = rl_undo_list;
_rl_free_undo_list (rl_undo_list);
rl_undo_list = (UNDO_LIST *)NULL;
_hs_replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
}
UNDO_LIST *
_rl_copy_undo_entry (UNDO_LIST *entry)
{
UNDO_LIST *new;
new = alloc_undo_entry (entry->what, entry->start, entry->end, (char *)NULL);
new->text = entry->text ? savestring (entry->text) : 0;
return new;
}
UNDO_LIST *
_rl_copy_undo_list (UNDO_LIST *head)
{
UNDO_LIST *list, *new, *roving, *c;
if (head == 0)
return head;
list = head;
new = 0;
while (list)
{
c = _rl_copy_undo_entry (list);
if (new == 0)
roving = new = c;
else
{
roving->next = c;
roving = roving->next;
}
list = list->next;
}
roving->next = 0;
return new;
}
/* Undo the next thing in the list. Return 0 if there
is nothing to undo, or non-zero if there was. */
int
rl_do_undo (void)
{
UNDO_LIST *release, *search;
int waiting_for_begin, start, end;
HIST_ENTRY *cur, *temp;
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
start = end = waiting_for_begin = 0;
do
{
if (rl_undo_list == 0)
return (0);
_rl_doing_an_undo = 1;
RL_SETSTATE(RL_STATE_UNDOING);
/* To better support vi-mode, a start or end value of -1 means
rl_point, and a value of -2 means rl_end. */
if (rl_undo_list->what == UNDO_DELETE || rl_undo_list->what == UNDO_INSERT)
{
start = TRANS (rl_undo_list->start);
end = TRANS (rl_undo_list->end);
}
switch (rl_undo_list->what)
{
/* Undoing deletes means inserting some text. */
case UNDO_DELETE:
rl_point = start;
_rl_fix_point (1);
rl_insert_text (rl_undo_list->text);
xfree (rl_undo_list->text);
break;
/* Undoing inserts means deleting some text. */
case UNDO_INSERT:
rl_delete_text (start, end);
rl_point = start;
_rl_fix_point (1);
break;
/* Undoing an END means undoing everything 'til we get to a BEGIN. */
case UNDO_END:
waiting_for_begin++;
break;
/* Undoing a BEGIN means that we are done with this group. */
case UNDO_BEGIN:
if (waiting_for_begin)
waiting_for_begin--;
else
rl_ding ();
break;
}
_rl_doing_an_undo = 0;
RL_UNSETSTATE(RL_STATE_UNDOING);
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
release->next = 0; /* XXX */
/* If we are editing a history entry, make sure the change is replicated
in the history entry's line */
cur = current_history ();
if (cur && cur->data && (UNDO_LIST *)cur->data == release)
{
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
xfree (temp->line);
FREE (temp->timestamp);
xfree (temp);
}
/* Make sure there aren't any history entries with that undo list */
_hs_replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
/* And make sure this list isn't anywhere in the saved line for history */
if (_rl_saved_line_for_history && _rl_saved_line_for_history->data)
{
/* Brute force; no finesse here */
search = (UNDO_LIST *)_rl_saved_line_for_history->data;
if (search == release)
_rl_saved_line_for_history->data = rl_undo_list;
else
{
while (search->next)
{
if (search->next == release)
{
search->next = rl_undo_list;
break;
}
search = search->next;
}
}
}
xfree (release);
}
while (waiting_for_begin);
return (1);
}
#undef TRANS
int
_rl_fix_last_undo_of_type (int type, int start, int end)
{
UNDO_LIST *rl;
for (rl = rl_undo_list; rl; rl = rl->next)
{
if (rl->what == type)
{
rl->start = start;
rl->end = end;
return 0;
}
}
return 1;
}
/* Begin a group. Subsequent undos are undone as an atomic operation. */
int
rl_begin_undo_group (void)
{
rl_add_undo (UNDO_BEGIN, 0, 0, 0);
_rl_undo_group_level++;
return 0;
}
/* End an undo group started with rl_begin_undo_group (). */
int
rl_end_undo_group (void)
{
rl_add_undo (UNDO_END, 0, 0, 0);
_rl_undo_group_level--;
return 0;
}
/* Save an undo entry for the text from START to END. */
int
rl_modifying (int start, int end)
{
if (start > end)
{
SWAP (start, end);
}
if (start != end)
{
char *temp = rl_copy_text (start, end);
rl_begin_undo_group ();
rl_add_undo (UNDO_DELETE, start, end, temp);
rl_add_undo (UNDO_INSERT, start, end, (char *)NULL);
rl_end_undo_group ();
}
return 0;
}
/* Revert the current line to its previous state. */
int
rl_revert_line (int count, int key)
{
if (rl_undo_list == 0)
rl_ding ();
else
{
while (rl_undo_list)
rl_do_undo ();
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
rl_point = rl_mark = 0; /* rl_end should be set correctly */
#endif
}
return 0;
}
/* Do some undoing of things that were done. */
int
rl_undo_command (int count, int key)
{
if (count < 0)
return 0; /* Nothing to do. */
while (count)
{
if (rl_do_undo ())
count--;
else
{
rl_ding ();
break;
}
}
return 0;
}
readline-8.1.2/xmalloc.h 000664 000436 000120 00000002440 11130207322 015151 0 ustar 00chet admin 000000 000000 /* xmalloc.h -- memory allocation that aborts on errors. */
/* Copyright (C) 1999-2009 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
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 (_XMALLOC_H_)
#define _XMALLOC_H_
#if defined (READLINE_LIBRARY)
# include "rlstdc.h"
#else
# include
#endif
#ifndef PTR_T
#ifdef __STDC__
# define PTR_T void *
#else
# define PTR_T char *
#endif
#endif /* !PTR_T */
extern PTR_T xmalloc PARAMS((size_t));
extern PTR_T xrealloc PARAMS((void *, size_t));
extern void xfree PARAMS((void *));
#endif /* _XMALLOC_H_ */
readline-8.1.2/util.c 000664 000436 000120 00000027463 13636727023 014520 0 ustar 00chet admin 000000 000000 /* util.c -- readline utility functions */
/* 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 .
*/
#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 "rldefs.h"
#include "rlmbutil.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 (ALPHABETIC (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)
{
rl_ding ();
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_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 (whitespace (rl_line_buffer[end]) == 0 && end < rl_end);
if (whitespace (rl_line_buffer[end]) || end >= rl_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);
}
#if defined (USE_VARARGS)
void
#if defined (PREFER_STDARG)
_rl_ttymsg (const char *format, ...)
#else
_rl_ttymsg (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
rl_forced_update_display ();
}
void
#if defined (PREFER_STDARG)
_rl_errmsg (const char *format, ...)
#else
_rl_errmsg (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
}
#else /* !USE_VARARGS */
void
_rl_ttymsg (format, arg1, arg2)
char *format;
{
fprintf (stderr, "readline: ");
fprintf (stderr, format, arg1, arg2);
fprintf (stderr, "\n");
rl_forced_update_display ();
}
void
_rl_errmsg (format, arg1, arg2)
char *format;
{
fprintf (stderr, "readline: ");
fprintf (stderr, format, arg1, arg2);
fprintf (stderr, "\n");
}
#endif /* !USE_VARARGS */
/* **************************************************************** */
/* */
/* String Utility Functions */
/* */
/* **************************************************************** */
/* 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)
{
register int i, 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);
}
#ifndef HAVE_STRPBRK
/* Find the first occurrence in STRING1 of any character from STRING2.
Return a pointer to the character in STRING1. */
char *
_rl_strpbrk (const char *string1, const char *string2)
{
register const char *scan;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps;
register int i, 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 */
/* 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)
#if defined (USE_VARARGS)
static FILE *_rl_tracefp;
void
#if defined (PREFER_STDARG)
_rl_trace (const char *format, ...)
#else
_rl_trace (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
if (_rl_tracefp == 0)
_rl_tropen ();
vfprintf (_rl_tracefp, format, args);
fprintf (_rl_tracefp, "\n");
fflush (_rl_tracefp);
va_end (args);
}
int
_rl_tropen (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
#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)
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.1.2/histexpand.c 000644 000436 000120 00000123063 13573772534 015710 0 ustar 00chet admin 000000 000000 /* histexpand.c -- history expansion. */
/* Copyright (C) 1989-2018 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)
# ifndef _MINIX
# include
# endif
# include
#endif
#include "rlmbutil.h"
#include "history.h"
#include "histlib.h"
#include "chardefs.h"
#include "rlshell.h"
#include "xmalloc.h"
#define HISTORY_WORD_DELIMITERS " \t\n;&()|<>"
#define HISTORY_QUOTE_CHARACTERS "\"'`"
#define HISTORY_EVENT_DELIMITERS "^$*%-"
#define slashify_in_quotes "\\`\"$"
#define fielddelim(c) (whitespace(c) || (c) == '\n')
typedef int _hist_search_func_t PARAMS((const char *, int));
static char error_pointer;
static char *subst_lhs;
static char *subst_rhs;
static int subst_lhs_len;
static int subst_rhs_len;
/* Characters that delimit history event specifications and separate event
specifications from word designators. Static for now */
static char *history_event_delimiter_chars = HISTORY_EVENT_DELIMITERS;
static char *get_history_word_specifier PARAMS((char *, char *, int *));
static int history_tokenize_word PARAMS((const char *, int));
static char **history_tokenize_internal PARAMS((const char *, int, int *));
static char *history_substring PARAMS((const char *, int, int));
static void freewords PARAMS((char **, int));
static char *history_find_word PARAMS((char *, int));
static char *quote_breaks PARAMS((char *));
/* Variables exported by this file. */
/* The character that represents the start of a history expansion
request. This is usually `!'. */
char history_expansion_char = '!';
/* The character that invokes word substitution if found at the start of
a line. This is usually `^'. */
char history_subst_char = '^';
/* During tokenization, if this character is seen as the first character
of a word, then it, and all subsequent characters up to a newline are
ignored. For a Bourne shell, this should be '#'. Bash special cases
the interactive comment character to not be a comment delimiter. */
char history_comment_char = '\0';
/* The list of characters which inhibit the expansion of text if found
immediately following history_expansion_char. */
char *history_no_expand_chars = " \t\n\r=";
/* If set to a non-zero value, single quotes inhibit history expansion.
The default is 0. */
int history_quotes_inhibit_expansion = 0;
/* Used to split words by history_tokenize_internal. */
char *history_word_delimiters = HISTORY_WORD_DELIMITERS;
/* If set, this points to a function that is called to verify that a
particular history expansion should be performed. */
rl_linebuf_func_t *history_inhibit_expansion_function;
int history_quoting_state = 0;
/* **************************************************************** */
/* */
/* History Expansion */
/* */
/* **************************************************************** */
/* Hairy history expansion on text, not tokens. This is of general
use, and thus belongs in this library. */
/* The last string searched for by a !?string? search. */
static char *search_string;
/* The last string matched by a !?string? search. */
static char *search_match;
/* Return the event specified at TEXT + OFFSET modifying OFFSET to
point to after the event specifier. Just a pointer to the history
line is returned; NULL is returned in the event of a bad specifier.
You pass STRING with *INDEX equal to the history_expansion_char that
begins this specification.
DELIMITING_QUOTE is a character that is allowed to end the string
specification for what to search for in addition to the normal
characters `:', ` ', `\t', `\n', and sometimes `?'.
So you might call this function like:
line = get_history_event ("!echo:p", &index, 0); */
char *
get_history_event (const char *string, int *caller_index, int delimiting_quote)
{
register int i;
register char c;
HIST_ENTRY *entry;
int which, sign, local_index, substring_okay;
_hist_search_func_t *search_func;
char *temp;
/* The event can be specified in a number of ways.
!! the previous command
!n command line N
!-n current command-line minus N
!str the most recent command starting with STR
!?str[?]
the most recent command containing STR
All values N are determined via HISTORY_BASE. */
i = *caller_index;
if (string[i] != history_expansion_char)
return ((char *)NULL);
/* Move on to the specification. */
i++;
sign = 1;
substring_okay = 0;
#define RETURN_ENTRY(e, w) \
return ((e = history_get (w)) ? e->line : (char *)NULL)
/* Handle !! case. */
if (string[i] == history_expansion_char)
{
i++;
which = history_base + (history_length - 1);
*caller_index = i;
RETURN_ENTRY (entry, which);
}
/* Hack case of numeric line specification. */
if (string[i] == '-' && _rl_digit_p (string[i+1]))
{
sign = -1;
i++;
}
if (_rl_digit_p (string[i]))
{
/* Get the extent of the digits and compute the value. */
for (which = 0; _rl_digit_p (string[i]); i++)
which = (which * 10) + _rl_digit_value (string[i]);
*caller_index = i;
if (sign < 0)
which = (history_length + history_base) - which;
RETURN_ENTRY (entry, which);
}
/* This must be something to search for. If the spec begins with
a '?', then the string may be anywhere on the line. Otherwise,
the string must be found at the start of a line. */
if (string[i] == '?')
{
substring_okay++;
i++;
}
/* Only a closing `?' or a newline delimit a substring search string. */
for (local_index = i; c = string[i]; i++)
{
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
int v;
mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t));
/* These produce warnings because we're passing a const string to a
function that takes a non-const string. */
_rl_adjust_point ((char *)string, i, &ps);
if ((v = _rl_get_char_len ((char *)string + i, &ps)) > 1)
{
i += v - 1;
continue;
}
}
#endif /* HANDLE_MULTIBYTE */
if ((!substring_okay &&
(whitespace (c) || c == ':' ||
(i > local_index && history_event_delimiter_chars && c == '-') ||
(c != '-' && history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
(history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
string[i] == delimiting_quote)) ||
string[i] == '\n' ||
(substring_okay && string[i] == '?'))
break;
}
which = i - local_index;
temp = (char *)xmalloc (1 + which);
if (which)
strncpy (temp, string + local_index, which);
temp[which] = '\0';
if (substring_okay && string[i] == '?')
i++;
*caller_index = i;
#define FAIL_SEARCH() \
do { \
history_offset = history_length; xfree (temp) ; return (char *)NULL; \
} while (0)
/* If there is no search string, try to use the previous search string,
if one exists. If not, fail immediately. */
if (*temp == '\0' && substring_okay)
{
if (search_string)
{
xfree (temp);
temp = savestring (search_string);
}
else
FAIL_SEARCH ();
}
search_func = substring_okay ? history_search : history_search_prefix;
while (1)
{
local_index = (*search_func) (temp, -1);
if (local_index < 0)
FAIL_SEARCH ();
if (local_index == 0 || substring_okay)
{
entry = current_history ();
if (entry == 0)
FAIL_SEARCH ();
history_offset = history_length;
/* If this was a substring search, then remember the
string that we matched for word substitution. */
if (substring_okay)
{
FREE (search_string);
search_string = temp;
FREE (search_match);
search_match = history_find_word (entry->line, local_index);
}
else
xfree (temp);
return (entry->line);
}
if (history_offset)
history_offset--;
else
FAIL_SEARCH ();
}
#undef FAIL_SEARCH
#undef RETURN_ENTRY
}
/* Function for extracting single-quoted strings. Used for inhibiting
history expansion within single quotes. */
/* Extract the contents of STRING as if it is enclosed in single quotes.
SINDEX, when passed in, is the offset of the character immediately
following the opening single quote; on exit, SINDEX is left pointing
to the closing single quote. FLAGS currently used to allow backslash
to escape a single quote (e.g., for bash $'...'). */
static void
hist_string_extract_single_quoted (char *string, int *sindex, int flags)
{
register int i;
for (i = *sindex; string[i] && string[i] != '\''; i++)
{
if ((flags & 1) && string[i] == '\\' && string[i+1])
i++;
}
*sindex = i;
}
static char *
quote_breaks (char *s)
{
register char *p, *r;
char *ret;
int len = 3;
for (p = s; p && *p; p++, len++)
{
if (*p == '\'')
len += 3;
else if (whitespace (*p) || *p == '\n')
len += 2;
}
r = ret = (char *)xmalloc (len);
*r++ = '\'';
for (p = s; p && *p; )
{
if (*p == '\'')
{
*r++ = '\'';
*r++ = '\\';
*r++ = '\'';
*r++ = '\'';
p++;
}
else if (whitespace (*p) || *p == '\n')
{
*r++ = '\'';
*r++ = *p++;
*r++ = '\'';
}
else
*r++ = *p++;
}
*r++ = '\'';
*r = '\0';
return ret;
}
static char *
hist_error(char *s, int start, int current, int errtype)
{
char *temp;
const char *emsg;
int ll, elen;
ll = current - start;
switch (errtype)
{
case EVENT_NOT_FOUND:
emsg = "event not found";
elen = 15;
break;
case BAD_WORD_SPEC:
emsg = "bad word specifier";
elen = 18;
break;
case SUBST_FAILED:
emsg = "substitution failed";
elen = 19;
break;
case BAD_MODIFIER:
emsg = "unrecognized history modifier";
elen = 29;
break;
case NO_PREV_SUBST:
emsg = "no previous substitution";
elen = 24;
break;
default:
emsg = "unknown expansion error";
elen = 23;
break;
}
temp = (char *)xmalloc (ll + elen + 3);
if (s[start])
strncpy (temp, s + start, ll);
else
ll = 0;
temp[ll] = ':';
temp[ll + 1] = ' ';
strcpy (temp + ll + 2, emsg);
return (temp);
}
/* Get a history substitution string from STR starting at *IPTR
and return it. The length is returned in LENPTR.
A backslash can quote the delimiter. If the string is the
empty string, the previous pattern is used. If there is
no previous pattern for the lhs, the last history search
string is used.
If IS_RHS is 1, we ignore empty strings and set the pattern
to "" anyway. subst_lhs is not changed if the lhs is empty;
subst_rhs is allowed to be set to the empty string. */
static char *
get_subst_pattern (char *str, int *iptr, int delimiter, int is_rhs, int *lenptr)
{
register int si, i, j, k;
char *s;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps;
#endif
s = (char *)NULL;
i = *iptr;
#if defined (HANDLE_MULTIBYTE)
memset (&ps, 0, sizeof (mbstate_t));
_rl_adjust_point (str, i, &ps);
#endif
for (si = i; str[si] && str[si] != delimiter; si++)
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
int v;
if ((v = _rl_get_char_len (str + si, &ps)) > 1)
si += v - 1;
else if (str[si] == '\\' && str[si + 1] == delimiter)
si++;
}
else
#endif /* HANDLE_MULTIBYTE */
if (str[si] == '\\' && str[si + 1] == delimiter)
si++;
if (si > i || is_rhs)
{
s = (char *)xmalloc (si - i + 1);
for (j = 0, k = i; k < si; j++, k++)
{
/* Remove a backslash quoting the search string delimiter. */
if (str[k] == '\\' && str[k + 1] == delimiter)
k++;
s[j] = str[k];
}
s[j] = '\0';
if (lenptr)
*lenptr = j;
}
i = si;
if (str[i])
i++;
*iptr = i;
return s;
}
static void
postproc_subst_rhs (void)
{
char *new;
int i, j, new_size;
new = (char *)xmalloc (new_size = subst_rhs_len + subst_lhs_len);
for (i = j = 0; i < subst_rhs_len; i++)
{
if (subst_rhs[i] == '&')
{
if (j + subst_lhs_len >= new_size)
new = (char *)xrealloc (new, (new_size = new_size * 2 + subst_lhs_len));
strcpy (new + j, subst_lhs);
j += subst_lhs_len;
}
else
{
/* a single backslash protects the `&' from lhs interpolation */
if (subst_rhs[i] == '\\' && subst_rhs[i + 1] == '&')
i++;
if (j >= new_size)
new = (char *)xrealloc (new, new_size *= 2);
new[j++] = subst_rhs[i];
}
}
new[j] = '\0';
xfree (subst_rhs);
subst_rhs = new;
subst_rhs_len = j;
}
/* Expand the bulk of a history specifier starting at STRING[START].
Returns 0 if everything is OK, -1 if an error occurred, and 1
if the `p' modifier was supplied and the caller should just print
the returned string. Returns the new index into string in
*END_INDEX_PTR, and the expanded specifier in *RET_STRING. */
/* need current line for !# */
static int
history_expand_internal (char *string, int start, int qc, int *end_index_ptr, char **ret_string, char *current_line)
{
int i, n, starting_index;
int substitute_globally, subst_bywords, want_quotes, print_only;
char *event, *temp, *result, *tstr, *t, c, *word_spec;
int result_len;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t));
#endif
result = (char *)xmalloc (result_len = 128);
i = start;
/* If it is followed by something that starts a word specifier,
then !! is implied as the event specifier. */
if (member (string[i + 1], ":$*%^"))
{
char fake_s[3];
int fake_i = 0;
i++;
fake_s[0] = fake_s[1] = history_expansion_char;
fake_s[2] = '\0';
event = get_history_event (fake_s, &fake_i, 0);
}
else if (string[i + 1] == '#')
{
i += 2;
event = current_line;
}
else
event = get_history_event (string, &i, qc);
if (event == 0)
{
*ret_string = hist_error (string, start, i, EVENT_NOT_FOUND);
xfree (result);
return (-1);
}
/* If a word specifier is found, then do what that requires. */
starting_index = i;
word_spec = get_history_word_specifier (string, event, &i);
/* There is no such thing as a `malformed word specifier'. However,
it is possible for a specifier that has no match. In that case,
we complain. */
if (word_spec == (char *)&error_pointer)
{
*ret_string = hist_error (string, starting_index, i, BAD_WORD_SPEC);
xfree (result);
return (-1);
}
/* If no word specifier, than the thing of interest was the event. */
temp = word_spec ? savestring (word_spec) : savestring (event);
FREE (word_spec);
/* Perhaps there are other modifiers involved. Do what they say. */
want_quotes = substitute_globally = subst_bywords = print_only = 0;
starting_index = i;
while (string[i] == ':')
{
c = string[i + 1];
if (c == 'g' || c == 'a')
{
substitute_globally = 1;
i++;
c = string[i + 1];
}
else if (c == 'G')
{
subst_bywords = 1;
i++;
c = string[i + 1];
}
switch (c)
{
default:
*ret_string = hist_error (string, i+1, i+2, BAD_MODIFIER);
xfree (result);
xfree (temp);
return -1;
case 'q':
want_quotes = 'q';
break;
case 'x':
want_quotes = 'x';
break;
/* :p means make this the last executed line. So we
return an error state after adding this line to the
history. */
case 'p':
print_only = 1;
break;
/* :t discards all but the last part of the pathname. */
case 't':
tstr = strrchr (temp, '/');
if (tstr)
{
tstr++;
t = savestring (tstr);
xfree (temp);
temp = t;
}
break;
/* :h discards the last part of a pathname. */
case 'h':
tstr = strrchr (temp, '/');
if (tstr)
*tstr = '\0';
break;
/* :r discards the suffix. */
case 'r':
tstr = strrchr (temp, '.');
if (tstr)
*tstr = '\0';
break;
/* :e discards everything but the suffix. */
case 'e':
tstr = strrchr (temp, '.');
if (tstr)
{
t = savestring (tstr);
xfree (temp);
temp = t;
}
break;
/* :s/this/that substitutes `that' for the first
occurrence of `this'. :gs/this/that substitutes `that'
for each occurrence of `this'. :& repeats the last
substitution. :g& repeats the last substitution
globally. */
case '&':
case 's':
{
char *new_event;
int delimiter, failed, si, l_temp, ws, we;
if (c == 's')
{
if (i + 2 < (int)strlen (string))
{
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
_rl_adjust_point (string, i + 2, &ps);
if (_rl_get_char_len (string + i + 2, &ps) > 1)
delimiter = 0;
else
delimiter = string[i + 2];
}
else
#endif /* HANDLE_MULTIBYTE */
delimiter = string[i + 2];
}
else
break; /* no search delimiter */
i += 3;
t = get_subst_pattern (string, &i, delimiter, 0, &subst_lhs_len);
/* An empty substitution lhs with no previous substitution
uses the last search string as the lhs. */
if (t)
{
FREE (subst_lhs);
subst_lhs = t;
}
else if (!subst_lhs)
{
if (search_string && *search_string)
{
subst_lhs = savestring (search_string);
subst_lhs_len = strlen (subst_lhs);
}
else
{
subst_lhs = (char *) NULL;
subst_lhs_len = 0;
}
}
FREE (subst_rhs);
subst_rhs = get_subst_pattern (string, &i, delimiter, 1, &subst_rhs_len);
/* If `&' appears in the rhs, it's supposed to be replaced
with the lhs. */
if (member ('&', subst_rhs))
postproc_subst_rhs ();
}
else
i += 2;
/* If there is no lhs, the substitution can't succeed. */
if (subst_lhs_len == 0)
{
*ret_string = hist_error (string, starting_index, i, NO_PREV_SUBST);
xfree (result);
xfree (temp);
return -1;
}
l_temp = strlen (temp);
/* Ignore impossible cases. */
if (subst_lhs_len > l_temp)
{
*ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
xfree (result);
xfree (temp);
return (-1);
}
/* Find the first occurrence of THIS in TEMP. */
/* Substitute SUBST_RHS for SUBST_LHS in TEMP. There are three
cases to consider:
1. substitute_globally == subst_bywords == 0
2. substitute_globally == 1 && subst_bywords == 0
3. substitute_globally == 0 && subst_bywords == 1
In the first case, we substitute for the first occurrence only.
In the second case, we substitute for every occurrence.
In the third case, we tokenize into words and substitute the
first occurrence of each word. */
si = we = 0;
for (failed = 1; (si + subst_lhs_len) <= l_temp; si++)
{
/* First skip whitespace and find word boundaries if
we're past the end of the word boundary we found
the last time. */
if (subst_bywords && si > we)
{
for (; temp[si] && fielddelim (temp[si]); si++)
;
ws = si;
we = history_tokenize_word (temp, si);
}
if (STREQN (temp+si, subst_lhs, subst_lhs_len))
{
int len = subst_rhs_len - subst_lhs_len + l_temp;
new_event = (char *)xmalloc (1 + len);
strncpy (new_event, temp, si);
strncpy (new_event + si, subst_rhs, subst_rhs_len);
strncpy (new_event + si + subst_rhs_len,
temp + si + subst_lhs_len,
l_temp - (si + subst_lhs_len));
new_event[len] = '\0';
xfree (temp);
temp = new_event;
failed = 0;
if (substitute_globally)
{
/* Reported to fix a bug that causes it to skip every
other match when matching a single character. Was
si += subst_rhs_len previously. */
si += subst_rhs_len - 1;
l_temp = strlen (temp);
substitute_globally++;
continue;
}
else if (subst_bywords)
{
si = we;
l_temp = strlen (temp);
continue;
}
else
break;
}
}
if (substitute_globally > 1)
{
substitute_globally = 0;
continue; /* don't want to increment i */
}
if (failed == 0)
continue; /* don't want to increment i */
*ret_string = hist_error (string, starting_index, i, SUBST_FAILED);
xfree (result);
xfree (temp);
return (-1);
}
}
i += 2;
}
/* Done with modifiers. */
/* Believe it or not, we have to back the pointer up by one. */
--i;
if (want_quotes)
{
char *x;
if (want_quotes == 'q')
x = sh_single_quote (temp);
else if (want_quotes == 'x')
x = quote_breaks (temp);
else
x = savestring (temp);
xfree (temp);
temp = x;
}
n = strlen (temp);
if (n >= result_len)
result = (char *)xrealloc (result, n + 2);
strcpy (result, temp);
xfree (temp);
*end_index_ptr = i;
*ret_string = result;
return (print_only);
}
/* Expand the string STRING, placing the result into OUTPUT, a pointer
to a string. Returns:
-1) If there was an error in expansion.
0) If no expansions took place (or, if the only change in
the text was the de-slashifying of the history expansion
character)
1) If expansions did take place
2) If the `p' modifier was given and the caller should print the result
If an error occurred in expansion, then OUTPUT contains a descriptive
error message. */
#define ADD_STRING(s) \
do \
{ \
int sl = strlen (s); \
j += sl; \
if (j >= result_len) \
{ \
while (j >= result_len) \
result_len += 128; \
result = (char *)xrealloc (result, result_len); \
} \
strcpy (result + j - sl, s); \
} \
while (0)
#define ADD_CHAR(c) \
do \
{ \
if (j >= result_len - 1) \
result = (char *)xrealloc (result, result_len += 64); \
result[j++] = c; \
result[j] = '\0'; \
} \
while (0)
int
history_expand (char *hstring, char **output)
{
register int j;
int i, r, l, passc, cc, modified, eindex, only_printing, dquote, squote, flag;
char *string;
/* The output string, and its length. */
int result_len;
char *result;
#if defined (HANDLE_MULTIBYTE)
char mb[MB_LEN_MAX];
mbstate_t ps;
#endif
/* Used when adding the string. */
char *temp;
if (output == 0)
return 0;
/* Setting the history expansion character to 0 inhibits all
history expansion. */
if (history_expansion_char == 0)
{
*output = savestring (hstring);
return (0);
}
/* Prepare the buffer for printing error messages. */
result = (char *)xmalloc (result_len = 256);
result[0] = '\0';
only_printing = modified = 0;
l = strlen (hstring);
/* Grovel the string. Only backslash and single quotes can quote the
history escape character. We also handle arg specifiers. */
/* Before we grovel forever, see if the history_expansion_char appears
anywhere within the text. */
/* The quick substitution character is a history expansion all right. That
is to say, "^this^that^" is equivalent to "!!:s^this^that^", and in fact,
that is the substitution that we do. */
if (hstring[0] == history_subst_char)
{
string = (char *)xmalloc (l + 5);
string[0] = string[1] = history_expansion_char;
string[2] = ':';
string[3] = 's';
strcpy (string + 4, hstring);
l += 4;
}
else
{
#if defined (HANDLE_MULTIBYTE)
memset (&ps, 0, sizeof (mbstate_t));
#endif
string = hstring;
/* If not quick substitution, still maybe have to do expansion. */
/* `!' followed by one of the characters in history_no_expand_chars
is NOT an expansion. */
dquote = history_quoting_state == '"';
squote = history_quoting_state == '\'';
/* If the calling application tells us we are already reading a
single-quoted string, consume the rest of the string right now
and then go on. */
i = 0;
if (squote && history_quotes_inhibit_expansion)
{
hist_string_extract_single_quoted (string, &i, 0);
squote = 0;
if (string[i])
i++;
}
for ( ; string[i]; i++)
{
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
int v;
v = _rl_get_char_len (string + i, &ps);
if (v > 1)
{
i += v - 1;
continue;
}
}
#endif /* HANDLE_MULTIBYTE */
cc = string[i + 1];
/* The history_comment_char, if set, appearing at the beginning
of a word signifies that the rest of the line should not have
history expansion performed on it.
Skip the rest of the line and break out of the loop. */
if (history_comment_char && string[i] == history_comment_char &&
dquote == 0 &&
(i == 0 || member (string[i - 1], history_word_delimiters)))
{
while (string[i])
i++;
break;
}
else if (string[i] == history_expansion_char)
{
if (cc == 0 || member (cc, history_no_expand_chars))
continue;
/* DQUOTE won't be set unless history_quotes_inhibit_expansion
is set. The idea here is to treat double-quoted strings the
same as the word outside double quotes; in effect making the
double quote part of history_no_expand_chars when DQUOTE is
set. */
else if (dquote && cc == '"')
continue;
/* If the calling application has set
history_inhibit_expansion_function to a function that checks
for special cases that should not be history expanded,
call the function and skip the expansion if it returns a
non-zero value. */
else if (history_inhibit_expansion_function &&
(*history_inhibit_expansion_function) (string, i))
continue;
else
break;
}
/* Shell-like quoting: allow backslashes to quote double quotes
inside a double-quoted string. */
else if (dquote && string[i] == '\\' && cc == '"')
i++;
/* More shell-like quoting: if we're paying attention to single
quotes and letting them quote the history expansion character,
then we need to pay attention to double quotes, because single
quotes are not special inside double-quoted strings. */
else if (history_quotes_inhibit_expansion && string[i] == '"')
{
dquote = 1 - dquote;
}
else if (dquote == 0 && history_quotes_inhibit_expansion && string[i] == '\'')
{
/* If this is bash, single quotes inhibit history expansion. */
flag = (i > 0 && string[i - 1] == '$');
i++;
hist_string_extract_single_quoted (string, &i, flag);
}
else if (history_quotes_inhibit_expansion && string[i] == '\\')
{
/* If this is bash, allow backslashes to quote single
quotes and the history expansion character. */
if (cc == '\'' || cc == history_expansion_char)
i++;
}
}
if (string[i] != history_expansion_char)
{
xfree (result);
*output = savestring (string);
return (0);
}
}
/* Extract and perform the substitution. */
dquote = history_quoting_state == '"';
squote = history_quoting_state == '\'';
/* If the calling application tells us we are already reading a
single-quoted string, consume the rest of the string right now
and then go on. */
i = j = 0;
if (squote && history_quotes_inhibit_expansion)
{
int c;
hist_string_extract_single_quoted (string, &i, 0);
squote = 0;
for (c = 0; c < i; c++)
ADD_CHAR (string[c]);
if (string[i])
{
ADD_CHAR (string[i]);
i++;
}
}
for (passc = 0; i < l; i++)
{
int qc, tchar = string[i];
if (passc)
{
passc = 0;
ADD_CHAR (tchar);
continue;
}
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
int k, c;
c = tchar;
memset (mb, 0, sizeof (mb));
for (k = 0; k < MB_LEN_MAX; k++)
{
mb[k] = (char)c;
memset (&ps, 0, sizeof (mbstate_t));
if (_rl_get_char_len (mb, &ps) == -2)
c = string[++i];
else
break;
}
if (strlen (mb) > 1)
{
ADD_STRING (mb);
continue;
}
}
#endif /* HANDLE_MULTIBYTE */
if (tchar == history_expansion_char)
tchar = -3;
else if (tchar == history_comment_char)
tchar = -2;
switch (tchar)
{
default:
ADD_CHAR (string[i]);
break;
case '\\':
passc++;
ADD_CHAR (tchar);
break;
case '"':
dquote = 1 - dquote;
ADD_CHAR (tchar);
break;
case '\'':
{
/* If history_quotes_inhibit_expansion is set, single quotes
inhibit history expansion, otherwise they are treated like
double quotes. */
if (squote)
{
squote = 0;
ADD_CHAR (tchar);
}
else if (dquote == 0 && history_quotes_inhibit_expansion)
{
int quote, slen;
flag = (i > 0 && string[i - 1] == '$');
quote = i++;
hist_string_extract_single_quoted (string, &i, flag);
slen = i - quote + 2;
temp = (char *)xmalloc (slen);
strncpy (temp, string + quote, slen);
temp[slen - 1] = '\0';
ADD_STRING (temp);
xfree (temp);
}
else if (dquote == 0 && squote == 0 && history_quotes_inhibit_expansion == 0)
{
squote = 1;
ADD_CHAR (string[i]);
}
else
ADD_CHAR (string[i]);
break;
}
case -2: /* history_comment_char */
if ((dquote == 0 || history_quotes_inhibit_expansion == 0) &&
(i == 0 || member (string[i - 1], history_word_delimiters)))
{
temp = (char *)xmalloc (l - i + 1);
strcpy (temp, string + i);
ADD_STRING (temp);
xfree (temp);
i = l;
}
else
ADD_CHAR (string[i]);
break;
case -3: /* history_expansion_char */
cc = string[i + 1];
/* If the history_expansion_char is followed by one of the
characters in history_no_expand_chars, then it is not a
candidate for expansion of any kind. */
if (cc == 0 || member (cc, history_no_expand_chars) ||
(dquote && cc == '"') ||
(history_inhibit_expansion_function && (*history_inhibit_expansion_function) (string, i)))
{
ADD_CHAR (string[i]);
break;
}
#if defined (NO_BANG_HASH_MODIFIERS)
/* There is something that is listed as a `word specifier' in csh
documentation which means `the expanded text to this point'.
That is not a word specifier, it is an event specifier. If we
don't want to allow modifiers with `!#', just stick the current
output line in again. */
if (cc == '#')
{
if (result)
{
temp = (char *)xmalloc (1 + strlen (result));
strcpy (temp, result);
ADD_STRING (temp);
xfree (temp);
}
i++;
break;
}
#endif
qc = squote ? '\'' : (dquote ? '"' : 0);
r = history_expand_internal (string, i, qc, &eindex, &temp, result);
if (r < 0)
{
*output = temp;
xfree (result);
if (string != hstring)
xfree (string);
return -1;
}
else
{
if (temp)
{
modified++;
if (*temp)
ADD_STRING (temp);
xfree (temp);
}
only_printing += r == 1;
i = eindex;
}
break;
}
}
*output = result;
if (string != hstring)
xfree (string);
if (only_printing)
{
#if 0
add_history (result);
#endif
return (2);
}
return (modified != 0);
}
/* Return a consed string which is the word specified in SPEC, and found
in FROM. NULL is returned if there is no spec. The address of
ERROR_POINTER is returned if the word specified cannot be found.
CALLER_INDEX is the offset in SPEC to start looking; it is updated
to point to just after the last character parsed. */
static char *
get_history_word_specifier (char *spec, char *from, int *caller_index)
{
register int i = *caller_index;
int first, last;
int expecting_word_spec = 0;
char *result;
/* The range of words to return doesn't exist yet. */
first = last = 0;
result = (char *)NULL;
/* If we found a colon, then this *must* be a word specification. If
it isn't, then it is an error. */
if (spec[i] == ':')
{
i++;
expecting_word_spec++;
}
/* Handle special cases first. */
/* `%' is the word last searched for. */
if (spec[i] == '%')
{
*caller_index = i + 1;
return (search_match ? savestring (search_match) : savestring (""));
}
/* `*' matches all of the arguments, but not the command. */
if (spec[i] == '*')
{
*caller_index = i + 1;
result = history_arg_extract (1, '$', from);
return (result ? result : savestring (""));
}
/* `$' is last arg. */
if (spec[i] == '$')
{
*caller_index = i + 1;
return (history_arg_extract ('$', '$', from));
}
/* Try to get FIRST and LAST figured out. */
if (spec[i] == '-')
first = 0;
else if (spec[i] == '^')
{
first = 1;
i++;
}
else if (_rl_digit_p (spec[i]) && expecting_word_spec)
{
for (first = 0; _rl_digit_p (spec[i]); i++)
first = (first * 10) + _rl_digit_value (spec[i]);
}
else
return ((char *)NULL); /* no valid `first' for word specifier */
if (spec[i] == '^' || spec[i] == '*')
{
last = (spec[i] == '^') ? 1 : '$'; /* x* abbreviates x-$ */
i++;
}
else if (spec[i] != '-')
last = first;
else
{
i++;
if (_rl_digit_p (spec[i]))
{
for (last = 0; _rl_digit_p (spec[i]); i++)
last = (last * 10) + _rl_digit_value (spec[i]);
}
else if (spec[i] == '$')
{
i++;
last = '$';
}
else if (spec[i] == '^')
{
i++;
last = 1;
}
#if 0
else if (!spec[i] || spec[i] == ':')
/* check against `:' because there could be a modifier separator */
#else
else
/* csh seems to allow anything to terminate the word spec here,
leaving it as an abbreviation. */
#endif
last = -1; /* x- abbreviates x-$ omitting word `$' */
}
*caller_index = i;
if (last >= first || last == '$' || last < 0)
result = history_arg_extract (first, last, from);
return (result ? result : (char *)&error_pointer);
}
/* Extract the args specified, starting at FIRST, and ending at LAST.
The args are taken from STRING. If either FIRST or LAST is < 0,
then make that arg count from the right (subtract from the number of
tokens, so that FIRST = -1 means the next to last token on the line).
If LAST is `$' the last arg from STRING is used. */
char *
history_arg_extract (int first, int last, const char *string)
{
register int i, len;
char *result;
int size, offset;
char **list;
/* XXX - think about making history_tokenize return a struct array,
each struct in array being a string and a length to avoid the
calls to strlen below. */
if ((list = history_tokenize (string)) == NULL)
return ((char *)NULL);
for (len = 0; list[len]; len++)
;
if (last < 0)
last = len + last - 1;
if (first < 0)
first = len + first - 1;
if (last == '$')
last = len - 1;
if (first == '$')
first = len - 1;
last++;
if (first >= len || last > len || first < 0 || last < 0 || first > last)
result = ((char *)NULL);
else
{
for (size = 0, i = first; i < last; i++)
size += strlen (list[i]) + 1;
result = (char *)xmalloc (size + 1);
result[0] = '\0';
for (i = first, offset = 0; i < last; i++)
{
strcpy (result + offset, list[i]);
offset += strlen (list[i]);
if (i + 1 < last)
{
result[offset++] = ' ';
result[offset] = 0;
}
}
}
for (i = 0; i < len; i++)
xfree (list[i]);
xfree (list);
return (result);
}
static int
history_tokenize_word (const char *string, int ind)
{
register int i, j;
int delimiter, nestdelim, delimopen;
i = ind;
delimiter = nestdelim = 0;
if (member (string[i], "()\n")) /* XXX - included \n, but why? been here forever */
{
i++;
return i;
}
if (ISDIGIT (string[i]))
{
j = i;
while (string[j] && ISDIGIT (string[j]))
j++;
if (string[j] == 0)
return (j);
if (string[j] == '<' || string[j] == '>')
i = j; /* digit sequence is a file descriptor */
else
{
i = j;
goto get_word; /* digit sequence is part of a word */
}
}
if (member (string[i], "<>;&|"))
{
int peek = string[i + 1];
if (peek == string[i])
{
if (peek == '<' && string[i + 2] == '-')
i++;
else if (peek == '<' && string[i + 2] == '<')
i++;
i += 2;
return i;
}
else if (peek == '&' && (string[i] == '>' || string[i] == '<'))
{
j = i + 2;
while (string[j] && ISDIGIT (string[j])) /* file descriptor */
j++;
if (string[j] =='-') /* <&[digits]-, >&[digits]- */
j++;
return j;
}
else if ((peek == '>' && string[i] == '&') || (peek == '|' && string[i] == '>'))
{
i += 2;
return i;
}
/* XXX - process substitution -- separated out for later -- bash-4.2 */
else if (peek == '(' && (string[i] == '>' || string[i] == '<')) /*)*/
{
i += 2;
delimopen = '(';
delimiter = ')';
nestdelim = 1;
goto get_word;
}
i++;
return i;
}
get_word:
/* Get word from string + i; */
if (delimiter == 0 && member (string[i], HISTORY_QUOTE_CHARACTERS))
delimiter = string[i++];
for (; string[i]; i++)
{
if (string[i] == '\\' && string[i + 1] == '\n')
{
i++;
continue;
}
if (string[i] == '\\' && delimiter != '\'' &&
(delimiter != '"' || member (string[i], slashify_in_quotes)))
{
i++;
continue;
}
/* delimiter must be set and set to something other than a quote if
nestdelim is set, so these tests are safe. */
if (nestdelim && string[i] == delimopen)
{
nestdelim++;
continue;
}
if (nestdelim && string[i] == delimiter)
{
nestdelim--;
if (nestdelim == 0)
delimiter = 0;
continue;
}
if (delimiter && string[i] == delimiter)
{
delimiter = 0;
continue;
}
/* Command and process substitution; shell extended globbing patterns */
if (nestdelim == 0 && delimiter == 0 && member (string[i], "<>$!@?+*") && string[i+1] == '(') /*)*/
{
i += 2;
delimopen = '(';
delimiter = ')';
nestdelim = 1;
continue;
}
if (delimiter == 0 && (member (string[i], history_word_delimiters)))
break;
if (delimiter == 0 && member (string[i], HISTORY_QUOTE_CHARACTERS))
delimiter = string[i];
}
return i;
}
static char *
history_substring (const char *string, int start, int end)
{
register int len;
register char *result;
len = end - start;
result = (char *)xmalloc (len + 1);
strncpy (result, string + start, len);
result[len] = '\0';
return result;
}
/* Parse STRING into tokens and return an array of strings. If WIND is
not -1 and INDP is not null, we also want the word surrounding index
WIND. The position in the returned array of strings is returned in
*INDP. */
static char **
history_tokenize_internal (const char *string, int wind, int *indp)
{
char **result;
register int i, start, result_index, size;
/* If we're searching for a string that's not part of a word (e.g., " "),
make sure we set *INDP to a reasonable value. */
if (indp && wind != -1)
*indp = -1;
/* Get a token, and stuff it into RESULT. The tokens are split
exactly where the shell would split them. */
for (i = result_index = size = 0, result = (char **)NULL; string[i]; )
{
/* Skip leading whitespace. */
for (; string[i] && fielddelim (string[i]); i++)
;
if (string[i] == 0 || string[i] == history_comment_char)
return (result);
start = i;
i = history_tokenize_word (string, start);
/* If we have a non-whitespace delimiter character (which would not be
skipped by the loop above), use it and any adjacent delimiters to
make a separate field. Any adjacent white space will be skipped the
next time through the loop. */
if (i == start && history_word_delimiters)
{
i++;
while (string[i] && member (string[i], history_word_delimiters))
i++;
}
/* If we are looking for the word in which the character at a
particular index falls, remember it. */
if (indp && wind != -1 && wind >= start && wind < i)
*indp = result_index;
if (result_index + 2 >= size)
result = (char **)xrealloc (result, ((size += 10) * sizeof (char *)));
result[result_index++] = history_substring (string, start, i);
result[result_index] = (char *)NULL;
}
return (result);
}
/* Return an array of tokens, much as the shell might. The tokens are
parsed out of STRING. */
char **
history_tokenize (const char *string)
{
return (history_tokenize_internal (string, -1, (int *)NULL));
}
/* Free members of WORDS from START to an empty string */
static void
freewords (char **words, int start)
{
register int i;
for (i = start; words[i]; i++)
xfree (words[i]);
}
/* Find and return the word which contains the character at index IND
in the history line LINE. Used to save the word matched by the
last history !?string? search. */
static char *
history_find_word (char *line, int ind)
{
char **words, *s;
int i, wind;
words = history_tokenize_internal (line, ind, &wind);
if (wind == -1 || words == 0)
{
if (words)
freewords (words, 0);
FREE (words);
return ((char *)NULL);
}
s = words[wind];
for (i = 0; i < wind; i++)
xfree (words[i]);
freewords (words, wind + 1);
xfree (words);
return s;
}
readline-8.1.2/terminal.c 000664 000436 000120 00000052646 13737625372 015365 0 ustar 00chet admin 000000 000000 /* terminal.c -- controlling the terminal with termcap. */
/* Copyright (C) 1996-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 .
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include
#endif
#include
#include "posixstat.h"
#include
#if defined (HAVE_SYS_FILE_H)
# include
#endif /* HAVE_SYS_FILE_H */
#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"
#ifdef __MSDOS__
# include
#endif
#include "rltty.h"
#if defined (HAVE_SYS_IOCTL_H)
# include /* include for declaration of ioctl */
#endif
#include "tcap.h"
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
#if defined (__MINGW32__)
# include
# include
static void _win_get_screensize PARAMS((int *, int *));
#endif
#if defined (__EMX__)
static void _emx_get_screensize PARAMS((int *, int *));
#endif
/* If the calling application sets this to a non-zero value, readline will
use the $LINES and $COLUMNS environment variables to set its idea of the
window size before interrogating the kernel. */
int rl_prefer_env_winsize = 0;
/* If this is non-zero, readline will set LINES and COLUMNS in the
environment when it handles SIGWINCH. */
int rl_change_environment = 1;
/* **************************************************************** */
/* */
/* Terminal and Termcap */
/* */
/* **************************************************************** */
#ifndef __MSDOS__
static char *term_buffer = (char *)NULL;
static char *term_string_buffer = (char *)NULL;
#endif
static int tcap_initialized;
#if !defined (__linux__) && !defined (NCURSES_VERSION)
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern
# endif /* __EMX__ || NEED_EXTERN_PC */
char PC, *BC, *UP;
#endif /* !__linux__ && !NCURSES_VERSION */
/* Some strings to control terminal actions. These are output by tputs (). */
char *_rl_term_clreol;
char *_rl_term_clrpag;
char *_rl_term_clrscroll;
char *_rl_term_cr;
char *_rl_term_backspace;
char *_rl_term_goto;
char *_rl_term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */
int _rl_terminal_can_insert = 0;
/* How to insert characters. */
char *_rl_term_im;
char *_rl_term_ei;
char *_rl_term_ic;
char *_rl_term_ip;
char *_rl_term_IC;
/* How to delete characters. */
char *_rl_term_dc;
char *_rl_term_DC;
/* How to move forward a char, non-destructively */
char *_rl_term_forward_char;
/* How to go up a line. */
char *_rl_term_up;
/* A visible bell; char if the terminal can be made to flash the screen. */
static char *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap = -1;
/* Non-zero means that this terminal has a meta key. */
static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */
static char *_rl_term_mm;
static char *_rl_term_mo;
/* The sequences to enter and exit standout mode. */
static char *_rl_term_so;
static char *_rl_term_se;
/* The key sequences output by the arrow keys, if this terminal has any. */
static char *_rl_term_ku;
static char *_rl_term_kd;
static char *_rl_term_kr;
static char *_rl_term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */
static char *_rl_term_ks;
static char *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */
static char *_rl_term_kh;
static char *_rl_term_kH;
static char *_rl_term_at7; /* @7 */
/* Delete key */
static char *_rl_term_kD;
/* Insert key */
static char *_rl_term_kI;
/* Cursor control */
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
/* It's not clear how HPUX is so broken here. */
#ifdef TGETENT_BROKEN
# define TGETENT_SUCCESS 0
#else
# define TGETENT_SUCCESS 1
#endif
#ifdef TGETFLAG_BROKEN
# define TGETFLAG_SUCCESS 0
#else
# define TGETFLAG_SUCCESS 1
#endif
#define TGETFLAG(cap) (tgetflag (cap) == TGETFLAG_SUCCESS)
static void bind_termcap_arrow_keys PARAMS((Keymap));
/* Variables that hold the screen dimensions, used by the display code. */
int _rl_screenwidth, _rl_screenheight, _rl_screenchars;
/* Non-zero means the user wants to enable the keypad. */
int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
#if defined (__EMX__)
static void
_emx_get_screensize (int *swp, int *shp)
{
int sz[2];
_scrsize (sz);
if (swp)
*swp = sz[0];
if (shp)
*shp = sz[1];
}
#endif
#if defined (__MINGW32__)
static void
_win_get_screensize (int *swp, int *shp)
{
HANDLE hConOut;
CONSOLE_SCREEN_BUFFER_INFO scr;
hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
if (hConOut != INVALID_HANDLE_VALUE)
{
if (GetConsoleScreenBufferInfo (hConOut, &scr))
{
*swp = scr.dwSize.X;
*shp = scr.srWindow.Bottom - scr.srWindow.Top + 1;
}
}
}
#endif
/* Get readline's idea of the screen size. TTY is a file descriptor open
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
non-null serve to check whether or not we have initialized termcap. */
void
_rl_get_screen_size (int tty, int ignore_env)
{
char *ss;
#if defined (TIOCGWINSZ)
struct winsize window_size;
#endif /* TIOCGWINSZ */
int wr, wc;
wr = wc = -1;
#if defined (TIOCGWINSZ)
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
{
wc = (int) window_size.ws_col;
wr = (int) window_size.ws_row;
}
#endif /* TIOCGWINSZ */
#if defined (__EMX__)
_emx_get_screensize (&wc, &wr);
#elif defined (__MINGW32__)
_win_get_screensize (&wc, &wr);
#endif
if (ignore_env || rl_prefer_env_winsize == 0)
{
_rl_screenwidth = wc;
_rl_screenheight = wr;
}
else
_rl_screenwidth = _rl_screenheight = -1;
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
is unset. If we prefer the environment, check it first before
assigning the value returned by the kernel. */
if (_rl_screenwidth <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("COLUMNS")))
_rl_screenwidth = atoi (ss);
if (_rl_screenwidth <= 0)
_rl_screenwidth = wc;
#if defined (__DJGPP__)
if (_rl_screenwidth <= 0)
_rl_screenwidth = ScreenCols ();
#else
if (_rl_screenwidth <= 0 && term_string_buffer)
_rl_screenwidth = tgetnum ("co");
#endif
}
/* Environment variable LINES overrides setting of "li" if IGNORE_ENV
is unset. */
if (_rl_screenheight <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("LINES")))
_rl_screenheight = atoi (ss);
if (_rl_screenheight <= 0)
_rl_screenheight = wr;
#if defined (__DJGPP__)
if (_rl_screenheight <= 0)
_rl_screenheight = ScreenRows ();
#else
if (_rl_screenheight <= 0 && term_string_buffer)
_rl_screenheight = tgetnum ("li");
#endif
}
/* If all else fails, default to 80x24 terminal. */
if (_rl_screenwidth <= 1)
_rl_screenwidth = 80;
if (_rl_screenheight <= 0)
_rl_screenheight = 24;
/* If we're being compiled as part of bash, set the environment
variables $LINES and $COLUMNS to new values. Otherwise, just
do a pair of putenv () or setenv () calls. */
if (rl_change_environment)
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
void
_rl_set_screen_size (int rows, int cols)
{
if (_rl_term_autowrap == -1)
_rl_init_terminal_io (rl_terminal_name);
if (rows > 0)
_rl_screenheight = rows;
if (cols > 0)
{
_rl_screenwidth = cols;
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
}
if (rows > 0 || cols > 0)
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
void
rl_set_screen_size (int rows, int cols)
{
_rl_set_screen_size (rows, cols);
}
void
rl_get_screen_size (int *rows, int *cols)
{
if (rows)
*rows = _rl_screenheight;
if (cols)
*cols = _rl_screenwidth;
}
void
rl_reset_screen_size (void)
{
_rl_get_screen_size (fileno (rl_instream), 0);
}
void
_rl_sigwinch_resize_terminal (void)
{
_rl_get_screen_size (fileno (rl_instream), 1);
}
void
rl_resize_terminal (void)
{
_rl_get_screen_size (fileno (rl_instream), 1);
if (_rl_echoing_p)
{
if (CUSTOM_REDISPLAY_FUNC ())
rl_forced_update_display ();
else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
_rl_redisplay_after_sigwinch ();
}
}
struct _tc_string {
const char * const tc_var;
char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
search algorithm to something smarter. */
static const struct _tc_string tc_strings[] =
{
{ "@7", &_rl_term_at7 },
{ "DC", &_rl_term_DC },
{ "E3", &_rl_term_clrscroll },
{ "IC", &_rl_term_IC },
{ "ce", &_rl_term_clreol },
{ "cl", &_rl_term_clrpag },
{ "cr", &_rl_term_cr },
{ "dc", &_rl_term_dc },
{ "ei", &_rl_term_ei },
{ "ic", &_rl_term_ic },
{ "im", &_rl_term_im },
{ "kD", &_rl_term_kD }, /* delete */
{ "kH", &_rl_term_kH }, /* home down ?? */
{ "kI", &_rl_term_kI }, /* insert */
{ "kd", &_rl_term_kd },
{ "ke", &_rl_term_ke }, /* end keypad mode */
{ "kh", &_rl_term_kh }, /* home */
{ "kl", &_rl_term_kl },
{ "kr", &_rl_term_kr },
{ "ks", &_rl_term_ks }, /* start keypad mode */
{ "ku", &_rl_term_ku },
{ "le", &_rl_term_backspace },
{ "mm", &_rl_term_mm },
{ "mo", &_rl_term_mo },
{ "nd", &_rl_term_forward_char },
{ "pc", &_rl_term_pc },
{ "se", &_rl_term_se },
{ "so", &_rl_term_so },
{ "up", &_rl_term_up },
{ "vb", &_rl_visible_bell },
{ "vs", &_rl_term_vs },
{ "ve", &_rl_term_ve },
};
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
/* Read the desired terminal capability strings into BP. The capabilities
are described in the TC_STRINGS table. */
static void
get_term_capabilities (char **bp)
{
#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
#endif
tcap_initialized = 1;
}
int
_rl_init_terminal_io (const char *terminal_name)
{
const char *term;
char *buffer;
int tty, tgetent_ret, dumbterm;
term = terminal_name ? terminal_name : sh_get_env_value ("TERM");
_rl_term_clrpag = _rl_term_cr = _rl_term_clreol = _rl_term_clrscroll = (char *)NULL;
tty = rl_instream ? fileno (rl_instream) : 0;
if (term == 0)
term = "dumb";
dumbterm = STREQ (term, "dumb");
#ifdef __MSDOS__
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_terminal_can_insert = term_has_meta = _rl_term_autowrap = 0;
_rl_term_cr = "\r";
_rl_term_backspace = (char *)NULL;
_rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
_rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
_rl_term_so = _rl_term_se = (char *)NULL;
#if defined(HACK_TERMCAP_MOTION)
_rl_term_forward_char = (char *)NULL;
#endif
_rl_get_screen_size (tty, 0);
#else /* !__MSDOS__ */
/* I've separated this out for later work on not calling tgetent at all
if the calling application has supplied a custom redisplay function,
(and possibly if the application has supplied a custom input function). */
if (CUSTOM_REDISPLAY_FUNC())
{
tgetent_ret = -1;
}
else
{
if (term_string_buffer == 0)
term_string_buffer = (char *)xmalloc(2032);
if (term_buffer == 0)
term_buffer = (char *)xmalloc(4080);
buffer = term_string_buffer;
tgetent_ret = tgetent (term_buffer, term);
}
if (tgetent_ret != TGETENT_SUCCESS)
{
FREE (term_string_buffer);
FREE (term_buffer);
buffer = term_buffer = term_string_buffer = (char *)NULL;
_rl_term_autowrap = 0; /* used by _rl_get_screen_size */
/* Allow calling application to set default height and width, using
rl_set_screen_size */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
{
#if defined (__EMX__)
_emx_get_screensize (&_rl_screenwidth, &_rl_screenheight);
_rl_screenwidth--;
#else /* !__EMX__ */
_rl_get_screen_size (tty, 0);
#endif /* !__EMX__ */
}
/* Defaults. */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
{
_rl_screenwidth = 79;
_rl_screenheight = 24;
}
/* Everything below here is used by the redisplay code (tputs). */
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
_rl_term_cr = "\r";
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_kI = _rl_term_kD = (char *)NULL;
_rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL;
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_term_ve = _rl_term_vs = (char *)NULL;
_rl_term_forward_char = (char *)NULL;
_rl_term_so = _rl_term_se = (char *)NULL;
_rl_terminal_can_insert = term_has_meta = 0;
/* Assume generic unknown terminal can't handle the enable/disable
escape sequences */
_rl_enable_bracketed_paste = 0;
/* Reasonable defaults for tgoto(). Readline currently only uses
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
PC = '\0';
BC = _rl_term_backspace = "\b";
UP = _rl_term_up;
return 0;
}
get_term_capabilities (&buffer);
/* Set up the variables that the termcap library expects the application
to provide. */
PC = _rl_term_pc ? *_rl_term_pc : 0;
BC = _rl_term_backspace;
UP = _rl_term_up;
if (_rl_term_cr == 0)
_rl_term_cr = "\r";
_rl_term_autowrap = TGETFLAG ("am") && TGETFLAG ("xn");
/* Allow calling application to set default height and width, using
rl_set_screen_size */
if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
_rl_get_screen_size (tty, 0);
/* "An application program can assume that the terminal can do
character insertion if *any one of* the capabilities `IC',
`im', `ic' or `ip' is provided." But we can't do anything if
only `ip' is provided, so... */
_rl_terminal_can_insert = (_rl_term_IC || _rl_term_im || _rl_term_ic);
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
term_has_meta = TGETFLAG ("km");
if (term_has_meta == 0)
_rl_term_mm = _rl_term_mo = (char *)NULL;
#endif /* !__MSDOS__ */
/* Attempt to find and bind the arrow keys. Do not override already
bound keys in an overzealous attempt, however. */
bind_termcap_arrow_keys (emacs_standard_keymap);
#if defined (VI_MODE)
bind_termcap_arrow_keys (vi_movement_keymap);
bind_termcap_arrow_keys (vi_insertion_keymap);
#endif /* VI_MODE */
/* There's no way to determine whether or not a given terminal supports
bracketed paste mode, so we assume a terminal named "dumb" does not. */
if (dumbterm)
_rl_enable_bracketed_paste = 0;
return 0;
}
/* Bind the arrow key sequences from the termcap description in MAP. */
static void
bind_termcap_arrow_keys (Keymap map)
{
Keymap xkeymap;
xkeymap = _rl_keymap;
_rl_keymap = map;
rl_bind_keyseq_if_unbound (_rl_term_ku, rl_get_previous_history);
rl_bind_keyseq_if_unbound (_rl_term_kd, rl_get_next_history);
rl_bind_keyseq_if_unbound (_rl_term_kr, rl_forward_char);
rl_bind_keyseq_if_unbound (_rl_term_kl, rl_backward_char);
rl_bind_keyseq_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */
rl_bind_keyseq_if_unbound (_rl_term_at7, rl_end_of_line); /* End */
rl_bind_keyseq_if_unbound (_rl_term_kD, rl_delete);
rl_bind_keyseq_if_unbound (_rl_term_kI, rl_overwrite_mode); /* Insert */
_rl_keymap = xkeymap;
}
char *
rl_get_termcap (const char *cap)
{
register int i;
if (tcap_initialized == 0)
return ((char *)NULL);
for (i = 0; i < NUM_TC_STRINGS; i++)
{
if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0)
return *(tc_strings[i].tc_value);
}
return ((char *)NULL);
}
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
has changed. */
int
rl_reset_terminal (const char *terminal_name)
{
_rl_screenwidth = _rl_screenheight = 0;
_rl_init_terminal_io (terminal_name);
return 0;
}
/* A function for the use of tputs () */
#ifdef _MINIX
void
_rl_output_character_function (int c)
{
putc (c, _rl_out_stream);
}
#else /* !_MINIX */
int
_rl_output_character_function (int c)
{
return putc (c, _rl_out_stream);
}
#endif /* !_MINIX */
/* Write COUNT characters from STRING to the output stream. */
void
_rl_output_some_chars (const char *string, int count)
{
fwrite (string, 1, count, _rl_out_stream);
}
/* Move the cursor back. */
int
_rl_backspace (int count)
{
register int i;
#ifndef __MSDOS__
if (_rl_term_backspace)
for (i = 0; i < count; i++)
tputs (_rl_term_backspace, 1, _rl_output_character_function);
else
#endif
for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream);
return 0;
}
/* Move to the start of the next line. */
int
rl_crlf (void)
{
#if defined (NEW_TTY_DRIVER) || defined (__MINT__)
if (_rl_term_cr)
tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif /* NEW_TTY_DRIVER || __MINT__ */
putc ('\n', _rl_out_stream);
return 0;
}
void
_rl_cr (void)
{
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
#else
tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif
}
/* Ring the terminal bell. */
int
rl_ding (void)
{
if (_rl_echoing_p)
{
switch (_rl_bell_preference)
{
case NO_BELL:
default:
break;
case VISIBLE_BELL:
if (_rl_visible_bell)
{
#ifdef __DJGPP__
ScreenVisualBell ();
#else
tputs (_rl_visible_bell, 1, _rl_output_character_function);
#endif
break;
}
/* FALLTHROUGH */
case AUDIBLE_BELL:
fprintf (stderr, "\007");
fflush (stderr);
break;
}
return (0);
}
return (-1);
}
/* **************************************************************** */
/* */
/* Entering and leaving terminal standout mode */
/* */
/* **************************************************************** */
void
_rl_standout_on (void)
{
#ifndef __MSDOS__
if (_rl_term_so && _rl_term_se)
tputs (_rl_term_so, 1, _rl_output_character_function);
#endif
}
void
_rl_standout_off (void)
{
#ifndef __MSDOS__
if (_rl_term_so && _rl_term_se)
tputs (_rl_term_se, 1, _rl_output_character_function);
#endif
}
/* **************************************************************** */
/* */
/* Controlling the Meta Key and Keypad */
/* */
/* **************************************************************** */
static int enabled_meta = 0; /* flag indicating we enabled meta mode */
void
_rl_enable_meta_key (void)
{
#if !defined (__DJGPP__)
if (term_has_meta && _rl_term_mm)
{
tputs (_rl_term_mm, 1, _rl_output_character_function);
enabled_meta = 1;
}
#endif
}
void
_rl_disable_meta_key (void)
{
#if !defined (__DJGPP__)
if (term_has_meta && _rl_term_mo && enabled_meta)
{
tputs (_rl_term_mo, 1, _rl_output_character_function);
enabled_meta = 0;
}
#endif
}
void
_rl_control_keypad (int on)
{
#if !defined (__DJGPP__)
if (on && _rl_term_ks)
tputs (_rl_term_ks, 1, _rl_output_character_function);
else if (!on && _rl_term_ke)
tputs (_rl_term_ke, 1, _rl_output_character_function);
#endif
}
/* **************************************************************** */
/* */
/* Controlling the Cursor */
/* */
/* **************************************************************** */
/* Set the cursor appropriately depending on IM, which is one of the
insert modes (insert or overwrite). Insert mode gets the normal
cursor. Overwrite mode gets a very visible cursor. Only does
anything if we have both capabilities. */
void
_rl_set_cursor (int im, int force)
{
#ifndef __MSDOS__
if (_rl_term_ve && _rl_term_vs)
{
if (force || im != rl_insert_mode)
{
if (im == RL_IM_OVERWRITE)
tputs (_rl_term_vs, 1, _rl_output_character_function);
else
tputs (_rl_term_ve, 1, _rl_output_character_function);
}
}
#endif
}
readline-8.1.2/readline.h 000664 000436 000120 00000115473 13661240723 015325 0 ustar 00chet admin 000000 000000 /* Readline.h -- the names of functions callable from within readline. */
/* Copyright (C) 1987-2020 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 (_READLINE_H_)
#define _READLINE_H_
#ifdef __cplusplus
extern "C" {
#endif
#if defined (READLINE_LIBRARY)
# include "rlstdc.h"
# include "rltypedefs.h"
# include "keymaps.h"
# include "tilde.h"
#else
# include
# include
# include
# include
#endif
/* Hex-encoded Readline version number. */
#define RL_READLINE_VERSION 0x0801 /* Readline 8.0 */
#define RL_VERSION_MAJOR 8
#define RL_VERSION_MINOR 1
/* Readline data structures. */
/* Maintaining the state of undo. We remember individual deletes and inserts
on a chain of things to do. */
/* The actions that undo knows how to undo. Notice that UNDO_DELETE means
to insert some text, and UNDO_INSERT means to delete some text. I.e.,
the code tells undo what to undo, not how to undo it. */
enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
/* What an element of THE_UNDO_LIST looks like. */
typedef struct undo_list {
struct undo_list *next;
int start, end; /* Where the change took place. */
char *text; /* The text to insert, if undoing a delete. */
enum undo_code what; /* Delete, Insert, Begin, End. */
} UNDO_LIST;
/* The current undo list for RL_LINE_BUFFER. */
extern UNDO_LIST *rl_undo_list;
/* The data structure for mapping textual names to code addresses. */
typedef struct _funmap {
const char *name;
rl_command_func_t *function;
} FUNMAP;
extern FUNMAP **funmap;
/* **************************************************************** */
/* */
/* Functions available to bind to key sequences */
/* */
/* **************************************************************** */
/* Bindable commands for numeric arguments. */
extern int rl_digit_argument PARAMS((int, int));
extern int rl_universal_argument PARAMS((int, int));
/* Bindable commands for moving the cursor. */
extern int rl_forward_byte PARAMS((int, int));
extern int rl_forward_char PARAMS((int, int));
extern int rl_forward PARAMS((int, int));
extern int rl_backward_byte PARAMS((int, int));
extern int rl_backward_char PARAMS((int, int));
extern int rl_backward PARAMS((int, int));
extern int rl_beg_of_line PARAMS((int, int));
extern int rl_end_of_line PARAMS((int, int));
extern int rl_forward_word PARAMS((int, int));
extern int rl_backward_word PARAMS((int, int));
extern int rl_refresh_line PARAMS((int, int));
extern int rl_clear_screen PARAMS((int, int));
extern int rl_clear_display PARAMS((int, int));
extern int rl_skip_csi_sequence PARAMS((int, int));
extern int rl_arrow_keys PARAMS((int, int));
extern int rl_previous_screen_line PARAMS((int, int));
extern int rl_next_screen_line PARAMS((int, int));
/* Bindable commands for inserting and deleting text. */
extern int rl_insert PARAMS((int, int));
extern int rl_quoted_insert PARAMS((int, int));
extern int rl_tab_insert PARAMS((int, int));
extern int rl_newline PARAMS((int, int));
extern int rl_do_lowercase_version PARAMS((int, int));
extern int rl_rubout PARAMS((int, int));
extern int rl_delete PARAMS((int, int));
extern int rl_rubout_or_delete PARAMS((int, int));
extern int rl_delete_horizontal_space PARAMS((int, int));
extern int rl_delete_or_show_completions PARAMS((int, int));
extern int rl_insert_comment PARAMS((int, int));
/* Bindable commands for changing case. */
extern int rl_upcase_word PARAMS((int, int));
extern int rl_downcase_word PARAMS((int, int));
extern int rl_capitalize_word PARAMS((int, int));
/* Bindable commands for transposing characters and words. */
extern int rl_transpose_words PARAMS((int, int));
extern int rl_transpose_chars PARAMS((int, int));
/* Bindable commands for searching within a line. */
extern int rl_char_search PARAMS((int, int));
extern int rl_backward_char_search PARAMS((int, int));
/* Bindable commands for readline's interface to the command history. */
extern int rl_beginning_of_history PARAMS((int, int));
extern int rl_end_of_history PARAMS((int, int));
extern int rl_get_next_history PARAMS((int, int));
extern int rl_get_previous_history PARAMS((int, int));
extern int rl_operate_and_get_next PARAMS((int, int));
/* Bindable commands for managing the mark and region. */
extern int rl_set_mark PARAMS((int, int));
extern int rl_exchange_point_and_mark PARAMS((int, int));
/* Bindable commands to set the editing mode (emacs or vi). */
extern int rl_vi_editing_mode PARAMS((int, int));
extern int rl_emacs_editing_mode PARAMS((int, int));
/* Bindable commands to change the insert mode (insert or overwrite) */
extern int rl_overwrite_mode PARAMS((int, int));
/* Bindable commands for managing key bindings. */
extern int rl_re_read_init_file PARAMS((int, int));
extern int rl_dump_functions PARAMS((int, int));
extern int rl_dump_macros PARAMS((int, int));
extern int rl_dump_variables PARAMS((int, int));
/* Bindable commands for word completion. */
extern int rl_complete PARAMS((int, int));
extern int rl_possible_completions PARAMS((int, int));
extern int rl_insert_completions PARAMS((int, int));
extern int rl_old_menu_complete PARAMS((int, int));
extern int rl_menu_complete PARAMS((int, int));
extern int rl_backward_menu_complete PARAMS((int, int));
/* Bindable commands for killing and yanking text, and managing the kill ring. */
extern int rl_kill_word PARAMS((int, int));
extern int rl_backward_kill_word PARAMS((int, int));
extern int rl_kill_line PARAMS((int, int));
extern int rl_backward_kill_line PARAMS((int, int));
extern int rl_kill_full_line PARAMS((int, int));
extern int rl_unix_word_rubout PARAMS((int, int));
extern int rl_unix_filename_rubout PARAMS((int, int));
extern int rl_unix_line_discard PARAMS((int, int));
extern int rl_copy_region_to_kill PARAMS((int, int));
extern int rl_kill_region PARAMS((int, int));
extern int rl_copy_forward_word PARAMS((int, int));
extern int rl_copy_backward_word PARAMS((int, int));
extern int rl_yank PARAMS((int, int));
extern int rl_yank_pop PARAMS((int, int));
extern int rl_yank_nth_arg PARAMS((int, int));
extern int rl_yank_last_arg PARAMS((int, int));
extern int rl_bracketed_paste_begin PARAMS((int, int));
/* Not available unless _WIN32 is defined. */
#if defined (_WIN32)
extern int rl_paste_from_clipboard PARAMS((int, int));
#endif
/* Bindable commands for incremental searching. */
extern int rl_reverse_search_history PARAMS((int, int));
extern int rl_forward_search_history PARAMS((int, int));
/* Bindable keyboard macro commands. */
extern int rl_start_kbd_macro PARAMS((int, int));
extern int rl_end_kbd_macro PARAMS((int, int));
extern int rl_call_last_kbd_macro PARAMS((int, int));
extern int rl_print_last_kbd_macro PARAMS((int, int));
/* Bindable undo commands. */
extern int rl_revert_line PARAMS((int, int));
extern int rl_undo_command PARAMS((int, int));
/* Bindable tilde expansion commands. */
extern int rl_tilde_expand PARAMS((int, int));
/* Bindable terminal control commands. */
extern int rl_restart_output PARAMS((int, int));
extern int rl_stop_output PARAMS((int, int));
/* Miscellaneous bindable commands. */
extern int rl_abort PARAMS((int, int));
extern int rl_tty_status PARAMS((int, int));
/* Bindable commands for incremental and non-incremental history searching. */
extern int rl_history_search_forward PARAMS((int, int));
extern int rl_history_search_backward PARAMS((int, int));
extern int rl_history_substr_search_forward PARAMS((int, int));
extern int rl_history_substr_search_backward PARAMS((int, int));
extern int rl_noninc_forward_search PARAMS((int, int));
extern int rl_noninc_reverse_search PARAMS((int, int));
extern int rl_noninc_forward_search_again PARAMS((int, int));
extern int rl_noninc_reverse_search_again PARAMS((int, int));
/* Bindable command used when inserting a matching close character. */
extern int rl_insert_close PARAMS((int, int));
/* Not available unless READLINE_CALLBACKS is defined. */
extern void rl_callback_handler_install PARAMS((const char *, rl_vcpfunc_t *));
extern void rl_callback_read_char PARAMS((void));
extern void rl_callback_handler_remove PARAMS((void));
extern void rl_callback_sigcleanup PARAMS((void));
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
/* VI-mode bindable commands. */
extern int rl_vi_redo PARAMS((int, int));
extern int rl_vi_undo PARAMS((int, int));
extern int rl_vi_yank_arg PARAMS((int, int));
extern int rl_vi_fetch_history PARAMS((int, int));
extern int rl_vi_search_again PARAMS((int, int));
extern int rl_vi_search PARAMS((int, int));
extern int rl_vi_complete PARAMS((int, int));
extern int rl_vi_tilde_expand PARAMS((int, int));
extern int rl_vi_prev_word PARAMS((int, int));
extern int rl_vi_next_word PARAMS((int, int));
extern int rl_vi_end_word PARAMS((int, int));
extern int rl_vi_insert_beg PARAMS((int, int));
extern int rl_vi_append_mode PARAMS((int, int));
extern int rl_vi_append_eol PARAMS((int, int));
extern int rl_vi_eof_maybe PARAMS((int, int));
extern int rl_vi_insertion_mode PARAMS((int, int));
extern int rl_vi_insert_mode PARAMS((int, int));
extern int rl_vi_movement_mode PARAMS((int, int));
extern int rl_vi_arg_digit PARAMS((int, int));
extern int rl_vi_change_case PARAMS((int, int));
extern int rl_vi_put PARAMS((int, int));
extern int rl_vi_column PARAMS((int, int));
extern int rl_vi_delete_to PARAMS((int, int));
extern int rl_vi_change_to PARAMS((int, int));
extern int rl_vi_yank_to PARAMS((int, int));
extern int rl_vi_yank_pop PARAMS((int, int));
extern int rl_vi_rubout PARAMS((int, int));
extern int rl_vi_delete PARAMS((int, int));
extern int rl_vi_back_to_indent PARAMS((int, int));
extern int rl_vi_unix_word_rubout PARAMS((int, int));
extern int rl_vi_first_print PARAMS((int, int));
extern int rl_vi_char_search PARAMS((int, int));
extern int rl_vi_match PARAMS((int, int));
extern int rl_vi_change_char PARAMS((int, int));
extern int rl_vi_subst PARAMS((int, int));
extern int rl_vi_overstrike PARAMS((int, int));
extern int rl_vi_overstrike_delete PARAMS((int, int));
extern int rl_vi_replace PARAMS((int, int));
extern int rl_vi_set_mark PARAMS((int, int));
extern int rl_vi_goto_mark PARAMS((int, int));
/* VI-mode utility functions. */
extern int rl_vi_check PARAMS((void));
extern int rl_vi_domove PARAMS((int, int *));
extern int rl_vi_bracktype PARAMS((int));
extern void rl_vi_start_inserting PARAMS((int, int, int));
/* VI-mode pseudo-bindable commands, used as utility functions. */
extern int rl_vi_fWord PARAMS((int, int));
extern int rl_vi_bWord PARAMS((int, int));
extern int rl_vi_eWord PARAMS((int, int));
extern int rl_vi_fword PARAMS((int, int));
extern int rl_vi_bword PARAMS((int, int));
extern int rl_vi_eword PARAMS((int, int));
/* **************************************************************** */
/* */
/* Well Published Functions */
/* */
/* **************************************************************** */
/* Readline functions. */
/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
extern char *readline PARAMS((const char *));
extern int rl_set_prompt PARAMS((const char *));
extern int rl_expand_prompt PARAMS((char *));
extern int rl_initialize PARAMS((void));
/* Undocumented; unused by readline */
extern int rl_discard_argument PARAMS((void));
/* Utility functions to bind keys to readline commands. */
extern int rl_add_defun PARAMS((const char *, rl_command_func_t *, int));
extern int rl_bind_key PARAMS((int, rl_command_func_t *));
extern int rl_bind_key_in_map PARAMS((int, rl_command_func_t *, Keymap));
extern int rl_unbind_key PARAMS((int));
extern int rl_unbind_key_in_map PARAMS((int, Keymap));
extern int rl_bind_key_if_unbound PARAMS((int, rl_command_func_t *));
extern int rl_bind_key_if_unbound_in_map PARAMS((int, rl_command_func_t *, Keymap));
extern int rl_unbind_function_in_map PARAMS((rl_command_func_t *, Keymap));
extern int rl_unbind_command_in_map PARAMS((const char *, Keymap));
extern int rl_bind_keyseq PARAMS((const char *, rl_command_func_t *));
extern int rl_bind_keyseq_in_map PARAMS((const char *, rl_command_func_t *, Keymap));
extern int rl_bind_keyseq_if_unbound PARAMS((const char *, rl_command_func_t *));
extern int rl_bind_keyseq_if_unbound_in_map PARAMS((const char *, rl_command_func_t *, Keymap));
extern int rl_generic_bind PARAMS((int, const char *, char *, Keymap));
extern char *rl_variable_value PARAMS((const char *));
extern int rl_variable_bind PARAMS((const char *, const char *));
/* Backwards compatibility, use rl_bind_keyseq_in_map instead. */
extern int rl_set_key PARAMS((const char *, rl_command_func_t *, Keymap));
/* Backwards compatibility, use rl_generic_bind instead. */
extern int rl_macro_bind PARAMS((const char *, const char *, Keymap));
/* Undocumented in the texinfo manual; not really useful to programs. */
extern int rl_translate_keyseq PARAMS((const char *, char *, int *));
extern char *rl_untranslate_keyseq PARAMS((int));
extern rl_command_func_t *rl_named_function PARAMS((const char *));
extern rl_command_func_t *rl_function_of_keyseq PARAMS((const char *, Keymap, int *));
extern rl_command_func_t *rl_function_of_keyseq_len PARAMS((const char *, size_t, Keymap, int *));
extern void rl_list_funmap_names PARAMS((void));
extern char **rl_invoking_keyseqs_in_map PARAMS((rl_command_func_t *, Keymap));
extern char **rl_invoking_keyseqs PARAMS((rl_command_func_t *));
extern void rl_function_dumper PARAMS((int));
extern void rl_macro_dumper PARAMS((int));
extern void rl_variable_dumper PARAMS((int));
extern int rl_read_init_file PARAMS((const char *));
extern int rl_parse_and_bind PARAMS((char *));
/* Functions for manipulating keymaps. */
extern Keymap rl_make_bare_keymap PARAMS((void));
extern int rl_empty_keymap PARAMS((Keymap));
extern Keymap rl_copy_keymap PARAMS((Keymap));
extern Keymap rl_make_keymap PARAMS((void));
extern void rl_discard_keymap PARAMS((Keymap));
extern void rl_free_keymap PARAMS((Keymap));
extern Keymap rl_get_keymap_by_name PARAMS((const char *));
extern char *rl_get_keymap_name PARAMS((Keymap));
extern void rl_set_keymap PARAMS((Keymap));
extern Keymap rl_get_keymap PARAMS((void));
extern int rl_set_keymap_name PARAMS((const char *, Keymap));
/* Undocumented; used internally only. */
extern void rl_set_keymap_from_edit_mode PARAMS((void));
extern char *rl_get_keymap_name_from_edit_mode PARAMS((void));
/* Functions for manipulating the funmap, which maps command names to functions. */
extern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *));
extern const char **rl_funmap_names PARAMS((void));
/* Undocumented, only used internally -- there is only one funmap, and this
function may be called only once. */
extern void rl_initialize_funmap PARAMS((void));
/* Utility functions for managing keyboard macros. */
extern void rl_push_macro_input PARAMS((char *));
/* Functions for undoing, from undo.c */
extern void rl_add_undo PARAMS((enum undo_code, int, int, char *));
extern void rl_free_undo_list PARAMS((void));
extern int rl_do_undo PARAMS((void));
extern int rl_begin_undo_group PARAMS((void));
extern int rl_end_undo_group PARAMS((void));
extern int rl_modifying PARAMS((int, int));
/* Functions for redisplay. */
extern void rl_redisplay PARAMS((void));
extern int rl_on_new_line PARAMS((void));
extern int rl_on_new_line_with_prompt PARAMS((void));
extern int rl_forced_update_display PARAMS((void));
extern int rl_clear_visible_line PARAMS((void));
extern int rl_clear_message PARAMS((void));
extern int rl_reset_line_state PARAMS((void));
extern int rl_crlf PARAMS((void));
/* Functions to manage the mark and region, especially the notion of an
active mark and an active region. */
extern void rl_keep_mark_active PARAMS((void));
extern void rl_activate_mark PARAMS((void));
extern void rl_deactivate_mark PARAMS((void));
extern int rl_mark_active_p PARAMS((void));
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern int rl_message ();
#endif
extern int rl_show_char PARAMS((int));
/* Undocumented in texinfo manual. */
extern int rl_character_len PARAMS((int, int));
extern void rl_redraw_prompt_last_line PARAMS((void));
/* Save and restore internal prompt redisplay information. */
extern void rl_save_prompt PARAMS((void));
extern void rl_restore_prompt PARAMS((void));
/* Modifying text. */
extern void rl_replace_line PARAMS((const char *, int));
extern int rl_insert_text PARAMS((const char *));
extern int rl_delete_text PARAMS((int, int));
extern int rl_kill_text PARAMS((int, int));
extern char *rl_copy_text PARAMS((int, int));
/* Terminal and tty mode management. */
extern void rl_prep_terminal PARAMS((int));
extern void rl_deprep_terminal PARAMS((void));
extern void rl_tty_set_default_bindings PARAMS((Keymap));
extern void rl_tty_unset_default_bindings PARAMS((Keymap));
extern int rl_tty_set_echoing PARAMS((int));
extern int rl_reset_terminal PARAMS((const char *));
extern void rl_resize_terminal PARAMS((void));
extern void rl_set_screen_size PARAMS((int, int));
extern void rl_get_screen_size PARAMS((int *, int *));
extern void rl_reset_screen_size PARAMS((void));
extern char *rl_get_termcap PARAMS((const char *));
/* Functions for character input. */
extern int rl_stuff_char PARAMS((int));
extern int rl_execute_next PARAMS((int));
extern int rl_clear_pending_input PARAMS((void));
extern int rl_read_key PARAMS((void));
extern int rl_getc PARAMS((FILE *));
extern int rl_set_keyboard_input_timeout PARAMS((int));
/* `Public' utility functions . */
extern void rl_extend_line_buffer PARAMS((int));
extern int rl_ding PARAMS((void));
extern int rl_alphabetic PARAMS((int));
extern void rl_free PARAMS((void *));
/* Readline signal handling, from signals.c */
extern int rl_set_signals PARAMS((void));
extern int rl_clear_signals PARAMS((void));
extern void rl_cleanup_after_signal PARAMS((void));
extern void rl_reset_after_signal PARAMS((void));
extern void rl_free_line_state PARAMS((void));
extern int rl_pending_signal PARAMS((void));
extern void rl_check_signals PARAMS((void));
extern void rl_echo_signal_char PARAMS((int));
extern int rl_set_paren_blink_timeout PARAMS((int));
/* History management functions. */
extern void rl_clear_history PARAMS((void));
/* Undocumented. */
extern int rl_maybe_save_line PARAMS((void));
extern int rl_maybe_unsave_line PARAMS((void));
extern int rl_maybe_replace_line PARAMS((void));
/* Completion functions. */
extern int rl_complete_internal PARAMS((int));
extern void rl_display_match_list PARAMS((char **, int, int));
extern char **rl_completion_matches PARAMS((const char *, rl_compentry_func_t *));
extern char *rl_username_completion_function PARAMS((const char *, int));
extern char *rl_filename_completion_function PARAMS((const char *, int));
extern int rl_completion_mode PARAMS((rl_command_func_t *));
#if 0
/* Backwards compatibility (compat.c). These will go away sometime. */
extern void free_undo_list PARAMS((void));
extern int maybe_save_line PARAMS((void));
extern int maybe_unsave_line PARAMS((void));
extern int maybe_replace_line PARAMS((void));
extern int ding PARAMS((void));
extern int alphabetic PARAMS((int));
extern int crlf PARAMS((void));
extern char **completion_matches PARAMS((char *, rl_compentry_func_t *));
extern char *username_completion_function PARAMS((const char *, int));
extern char *filename_completion_function PARAMS((const char *, int));
#endif
/* **************************************************************** */
/* */
/* Well Published Variables */
/* */
/* **************************************************************** */
/* The version of this incarnation of the readline library. */
extern const char *rl_library_version; /* e.g., "4.2" */
extern int rl_readline_version; /* e.g., 0x0402 */
/* True if this is real GNU readline. */
extern int rl_gnu_readline_p;
/* Flags word encapsulating the current readline state. */
extern unsigned long rl_readline_state;
/* Says which editing mode readline is currently using. 1 means emacs mode;
0 means vi mode. */
extern int rl_editing_mode;
/* Insert or overwrite mode for emacs mode. 1 means insert mode; 0 means
overwrite mode. Reset to insert mode on each input line. */
extern int rl_insert_mode;
/* The name of the calling program. You should initialize this to
whatever was in argv[0]. It is used when parsing conditionals. */
extern const char *rl_readline_name;
/* The prompt readline uses. This is set from the argument to
readline (), and should not be assigned to directly. */
extern char *rl_prompt;
/* The prompt string that is actually displayed by rl_redisplay. Public so
applications can more easily supply their own redisplay functions. */
extern char *rl_display_prompt;
/* The line buffer that is in use. */
extern char *rl_line_buffer;
/* The location of point, and end. */
extern int rl_point;
extern int rl_end;
/* The mark, or saved cursor position. */
extern int rl_mark;
/* Flag to indicate that readline has finished with the current input
line and should return it. */
extern int rl_done;
/* If set to a character value, that will be the next keystroke read. */
extern int rl_pending_input;
/* Non-zero if we called this function from _rl_dispatch(). It's present
so functions can find out whether they were called from a key binding
or directly from an application. */
extern int rl_dispatching;
/* Non-zero if the user typed a numeric argument before executing the
current function. */
extern int rl_explicit_arg;
/* The current value of the numeric argument specified by the user. */
extern int rl_numeric_arg;
/* The address of the last command function Readline executed. */
extern rl_command_func_t *rl_last_func;
/* The name of the terminal to use. */
extern const char *rl_terminal_name;
/* The input and output streams. */
extern FILE *rl_instream;
extern FILE *rl_outstream;
/* If non-zero, Readline gives values of LINES and COLUMNS from the environment
greater precedence than values fetched from the kernel when computing the
screen dimensions. */
extern int rl_prefer_env_winsize;
/* If non-zero, then this is the address of a function to call just
before readline_internal () prints the first prompt. */
extern rl_hook_func_t *rl_startup_hook;
/* If non-zero, this is the address of a function to call just before
readline_internal_setup () returns and readline_internal starts
reading input characters. */
extern rl_hook_func_t *rl_pre_input_hook;
/* The address of a function to call periodically while Readline is
awaiting character input, or NULL, for no event handling. */
extern rl_hook_func_t *rl_event_hook;
/* The address of a function to call if a read is interrupted by a signal. */
extern rl_hook_func_t *rl_signal_event_hook;
/* The address of a function to call if Readline needs to know whether or not
there is data available from the current input source. */
extern rl_hook_func_t *rl_input_available_hook;
/* The address of the function to call to fetch a character from the current
Readline input stream */
extern rl_getc_func_t *rl_getc_function;
extern rl_voidfunc_t *rl_redisplay_function;
extern rl_vintfunc_t *rl_prep_term_function;
extern rl_voidfunc_t *rl_deprep_term_function;
/* Dispatch variables. */
extern Keymap rl_executing_keymap;
extern Keymap rl_binding_keymap;
extern int rl_executing_key;
extern char *rl_executing_keyseq;
extern int rl_key_sequence_length;
/* Display variables. */
/* If non-zero, readline will erase the entire line, including any prompt,
if the only thing typed on an otherwise-blank line is something bound to
rl_newline. */
extern int rl_erase_empty_line;
/* If non-zero, the application has already printed the prompt (rl_prompt)
before calling readline, so readline should not output it the first time
redisplay is done. */
extern int rl_already_prompted;
/* A non-zero value means to read only this many characters rather than
up to a character bound to accept-line. */
extern int rl_num_chars_to_read;
/* The text of a currently-executing keyboard macro. */
extern char *rl_executing_macro;
/* Variables to control readline signal handling. */
/* If non-zero, readline will install its own signal handlers for
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
extern int rl_catch_signals;
/* If non-zero, readline will install a signal handler for SIGWINCH
that also attempts to call any calling application's SIGWINCH signal
handler. Note that the terminal is not cleaned up before the
application's signal handler is called; use rl_cleanup_after_signal()
to do that. */
extern int rl_catch_sigwinch;
/* If non-zero, the readline SIGWINCH handler will modify LINES and
COLUMNS in the environment. */
extern int rl_change_environment;
/* Completion variables. */
/* Pointer to the generator function for completion_matches ().
NULL means to use rl_filename_completion_function (), the default
filename completer. */
extern rl_compentry_func_t *rl_completion_entry_function;
/* Optional generator for menu completion. Default is
rl_completion_entry_function (rl_filename_completion_function). */
extern rl_compentry_func_t *rl_menu_completion_entry_function;
/* If rl_ignore_some_completions_function is non-NULL it is the address
of a function to call after all of the possible matches have been
generated, but before the actual completion is done to the input line.
The function is called with one argument; a NULL terminated array
of (char *). If your function removes any of the elements, they
must be free()'ed. */
extern rl_compignore_func_t *rl_ignore_some_completions_function;
/* Pointer to alternative function to create matches.
Function is called with TEXT, START, and END.
START and END are indices in RL_LINE_BUFFER saying what the boundaries
of TEXT are.
If this function exists and returns NULL then call the value of
rl_completion_entry_function to try to match, otherwise use the
array of strings returned. */
extern rl_completion_func_t *rl_attempted_completion_function;
/* The basic list of characters that signal a break between words for the
completer routine. The initial contents of this variable is what
breaks words in the shell, i.e. "n\"\\'`@$>". */
extern const char *rl_basic_word_break_characters;
/* The list of characters that signal a break between words for
rl_complete_internal. The default list is the contents of
rl_basic_word_break_characters. */
extern /*const*/ char *rl_completer_word_break_characters;
/* Hook function to allow an application to set the completion word
break characters before readline breaks up the line. Allows
position-dependent word break characters. */
extern rl_cpvfunc_t *rl_completion_word_break_hook;
/* List of characters which can be used to quote a substring of the line.
Completion occurs on the entire substring, and within the substring
rl_completer_word_break_characters are treated as any other character,
unless they also appear within this list. */
extern const char *rl_completer_quote_characters;
/* List of quote characters which cause a word break. */
extern const char *rl_basic_quote_characters;
/* List of characters that need to be quoted in filenames by the completer. */
extern const char *rl_filename_quote_characters;
/* List of characters that are word break characters, but should be left
in TEXT when it is passed to the completion function. The shell uses
this to help determine what kind of completing to do. */
extern const char *rl_special_prefixes;
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
the address of a string (the current directory name) as an arg. It
changes what is displayed when the possible completions are printed
or inserted. The directory completion hook should perform
any necessary dequoting. This function should return 1 if it modifies
the directory name pointer passed as an argument. If the directory
completion hook returns 0, it should not modify the directory name
pointer passed as an argument. */
extern rl_icppfunc_t *rl_directory_completion_hook;
/* If non-zero, this is the address of a function to call when completing
a directory name. This function takes the address of the directory name
to be modified as an argument. Unlike rl_directory_completion_hook, it
only modifies the directory name used in opendir(2), not what is displayed
when the possible completions are printed or inserted. If set, it takes
precedence over rl_directory_completion_hook. The directory rewrite
hook should perform any necessary dequoting. This function has the same
return value properties as the directory_completion_hook.
I'm not happy with how this works yet, so it's undocumented. I'm trying
it in bash to see how well it goes. */
extern rl_icppfunc_t *rl_directory_rewrite_hook;
/* If non-zero, this is the address of a function for the completer to call
before deciding which character to append to a completed name. It should
modify the directory name passed as an argument if appropriate, and return
non-zero if it modifies the name. This should not worry about dequoting
the filename; that has already happened by the time it gets here. */
extern rl_icppfunc_t *rl_filename_stat_hook;
/* If non-zero, this is the address of a function to call when reading
directory entries from the filesystem for completion and comparing
them to the partial word to be completed. The function should
either return its first argument (if no conversion takes place) or
newly-allocated memory. This can, for instance, convert filenames
between character sets for comparison against what's typed at the
keyboard. The returned value is what is added to the list of
matches. The second argument is the length of the filename to be
converted. */
extern rl_dequote_func_t *rl_filename_rewrite_hook;
/* Backwards compatibility with previous versions of readline. */
#define rl_symbolic_link_hook rl_directory_completion_hook
/* If non-zero, then this is the address of a function to call when
completing a word would normally display the list of possible matches.
This function is called instead of actually doing the display.
It takes three arguments: (char **matches, int num_matches, int max_length)
where MATCHES is the array of strings that matched, NUM_MATCHES is the
number of strings in that array, and MAX_LENGTH is the length of the
longest string in that array. */
extern rl_compdisp_func_t *rl_completion_display_matches_hook;
/* Non-zero means that the results of the matches are to be treated
as filenames. This is ALWAYS zero on entry, and can only be changed
within a completion entry finder function. */
extern int rl_filename_completion_desired;
/* Non-zero means that the results of the matches are to be quoted using
double quotes (or an application-specific quoting mechanism) if the
filename contains any characters in rl_word_break_chars. This is
ALWAYS non-zero on entry, and can only be changed within a completion
entry finder function. */
extern int rl_filename_quoting_desired;
/* Set to a function to quote a filename in an application-specific fashion.
Called with the text to quote, the type of match found (single or multiple)
and a pointer to the quoting character to be used, which the function can
reset if desired. */
extern rl_quote_func_t *rl_filename_quoting_function;
/* Function to call to remove quoting characters from a filename. Called
before completion is attempted, so the embedded quotes do not interfere
with matching names in the file system. */
extern rl_dequote_func_t *rl_filename_dequoting_function;
/* Function to call to decide whether or not a word break character is
quoted. If a character is quoted, it does not break words for the
completer. */
extern rl_linebuf_func_t *rl_char_is_quoted_p;
/* Non-zero means to suppress normal filename completion after the
user-specified completion function has been called. */
extern int rl_attempted_completion_over;
/* Set to a character describing the type of completion being attempted by
rl_complete_internal; available for use by application completion
functions. */
extern int rl_completion_type;
/* Set to the last key used to invoke one of the completion functions */
extern int rl_completion_invoking_key;
/* Up to this many items will be displayed in response to a
possible-completions call. After that, we ask the user if she
is sure she wants to see them all. The default value is 100. */
extern int rl_completion_query_items;
/* Character appended to completed words when at the end of the line. The
default is a space. Nothing is added if this is '\0'. */
extern int rl_completion_append_character;
/* If set to non-zero by an application completion function,
rl_completion_append_character will not be appended. */
extern int rl_completion_suppress_append;
/* Set to any quote character readline thinks it finds before any application
completion function is called. */
extern int rl_completion_quote_character;
/* Set to a non-zero value if readline found quoting anywhere in the word to
be completed; set before any application completion function is called. */
extern int rl_completion_found_quote;
/* If non-zero, the completion functions don't append any closing quote.
This is set to 0 by rl_complete_internal and may be changed by an
application-specific completion function. */
extern int rl_completion_suppress_quote;
/* If non-zero, readline will sort the completion matches. On by default. */
extern int rl_sort_completion_matches;
/* If non-zero, a slash will be appended to completed filenames that are
symbolic links to directory names, subject to the value of the
mark-directories variable (which is user-settable). This exists so
that application completion functions can override the user's preference
(set via the mark-symlinked-directories variable) if appropriate.
It's set to the value of _rl_complete_mark_symlink_dirs in
rl_complete_internal before any application-specific completion
function is called, so without that function doing anything, the user's
preferences are honored. */
extern int rl_completion_mark_symlink_dirs;
/* If non-zero, then disallow duplicates in the matches. */
extern int rl_ignore_completion_duplicates;
/* If this is non-zero, completion is (temporarily) inhibited, and the
completion character will be inserted as any other. */
extern int rl_inhibit_completion;
/* Applications can set this to non-zero to have readline's signal handlers
installed during the entire duration of reading a complete line, as in
readline-6.2. This should be used with care, because it can result in
readline receiving signals and not handling them until it's called again
via rl_callback_read_char, thereby stealing them from the application.
By default, signal handlers are only active while readline is active. */
extern int rl_persistent_signal_handlers;
/* Input error; can be returned by (*rl_getc_function) if readline is reading
a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
#define READERR (-2)
/* Definitions available for use by readline clients. */
#define RL_PROMPT_START_IGNORE '\001'
#define RL_PROMPT_END_IGNORE '\002'
/* Possible values for do_replace argument to rl_filename_quoting_function,
called by rl_complete_internal. */
#define NO_MATCH 0
#define SINGLE_MATCH 1
#define MULT_MATCH 2
/* Possible state values for rl_readline_state */
#define RL_STATE_NONE 0x000000 /* no state; before first call */
#define RL_STATE_INITIALIZING 0x0000001 /* initializing */
#define RL_STATE_INITIALIZED 0x0000002 /* initialization done */
#define RL_STATE_TERMPREPPED 0x0000004 /* terminal is prepped */
#define RL_STATE_READCMD 0x0000008 /* reading a command key */
#define RL_STATE_METANEXT 0x0000010 /* reading input after ESC */
#define RL_STATE_DISPATCHING 0x0000020 /* dispatching to a command */
#define RL_STATE_MOREINPUT 0x0000040 /* reading more input in a command function */
#define RL_STATE_ISEARCH 0x0000080 /* doing incremental search */
#define RL_STATE_NSEARCH 0x0000100 /* doing non-inc search */
#define RL_STATE_SEARCH 0x0000200 /* doing a history search */
#define RL_STATE_NUMERICARG 0x0000400 /* reading numeric argument */
#define RL_STATE_MACROINPUT 0x0000800 /* getting input from a macro */
#define RL_STATE_MACRODEF 0x0001000 /* defining keyboard macro */
#define RL_STATE_OVERWRITE 0x0002000 /* overwrite mode */
#define RL_STATE_COMPLETING 0x0004000 /* doing completion */
#define RL_STATE_SIGHANDLER 0x0008000 /* in readline sighandler */
#define RL_STATE_UNDOING 0x0010000 /* doing an undo */
#define RL_STATE_INPUTPENDING 0x0020000 /* rl_execute_next called */
#define RL_STATE_TTYCSAVED 0x0040000 /* tty special chars saved */
#define RL_STATE_CALLBACK 0x0080000 /* using the callback interface */
#define RL_STATE_VIMOTION 0x0100000 /* reading vi motion arg */
#define RL_STATE_MULTIKEY 0x0200000 /* reading multiple-key command */
#define RL_STATE_VICMDONCE 0x0400000 /* entered vi command mode at least once */
#define RL_STATE_CHARSEARCH 0x0800000 /* vi mode char search */
#define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
#define RL_STATE_DONE 0x2000000 /* done; accepted line */
#define RL_SETSTATE(x) (rl_readline_state |= (x))
#define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
#define RL_ISSTATE(x) (rl_readline_state & (x))
struct readline_state {
/* line state */
int point;
int end;
int mark;
int buflen;
char *buffer;
UNDO_LIST *ul;
char *prompt;
/* global state */
int rlstate;
int done;
Keymap kmap;
/* input state */
rl_command_func_t *lastfunc;
int insmode;
int edmode;
char *kseq;
int kseqlen;
int pendingin;
FILE *inf;
FILE *outf;
char *macro;
/* signal state */
int catchsigs;
int catchsigwinch;
/* search state */
/* completion state */
rl_compentry_func_t *entryfunc;
rl_compentry_func_t *menuentryfunc;
rl_compignore_func_t *ignorefunc;
rl_completion_func_t *attemptfunc;
char *wordbreakchars;
/* options state */
/* hook state */
/* reserved for future expansion, so the struct size doesn't change */
char reserved[64];
};
extern int rl_save_state PARAMS((struct readline_state *));
extern int rl_restore_state PARAMS((struct readline_state *));
#ifdef __cplusplus
}
#endif
#endif /* _READLINE_H_ */
readline-8.1.2/configure 000775 000436 000120 00000671642 13747016150 015305 0 ustar 00chet admin 000000 000000 #! /bin/sh
# From configure.ac for Readline 8.1, version 2.90.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for readline 8.1.
#
# Report bugs to .
#
#
# Copyright (C) 1992-1996, 1998-2012 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 -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; 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
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# 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
test -z "$as_dir" && as_dir=.
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
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# 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'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_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 -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
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
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || 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
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
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
test -z "$as_dir" && as_dir=.
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_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
break 2
fi
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
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'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$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
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=`$as_echo "$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 ||
$as_echo 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
as_fn_append ()
{
eval $1=\$$1\$2
}
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
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
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
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$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 ||
$as_echo 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 '
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" ||
{ $as_echo "$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
}
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
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_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
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.1'
PACKAGE_STRING='readline 8.1'
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_SYS_TYPES_H
# include
#endif
#ifdef HAVE_SYS_STAT_H
# include
#endif
#ifdef STDC_HEADERS
# include
# include
#else
# ifdef HAVE_STDLIB_H
# include
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include
# endif
# include
#endif
#ifdef HAVE_STRINGS_H
# include
#endif
#ifdef HAVE_INTTYPES_H
# include
#endif
#ifdef HAVE_STDINT_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif"
ac_subst_vars='LTLIBOBJS
TERMCAP_PKG_CONFIG_LIB
TERMCAP_LIB
LIBVERSION
ARFLAGS
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
MAKE_SHELL
RANLIB
AR
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
EGREP
GREP
CPP
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
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
enable_multibyte
enable_shared
enable_static
enable_install_examples
enable_bracketed_paste_default
enable_largefile
'
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'
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
# Accept the important Cygnus configure options, so we can diagnose typos.
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=`$as_echo "$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=`$as_echo "$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 ;;
-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=`$as_echo "$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=`$as_echo "$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.
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$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" ;;
*) $as_echo "$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
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 ||
$as_echo 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.1 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]
--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.1:";;
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
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
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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$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 guested configure.
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
$as_echo "$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.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 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
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\""
$as_echo "$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
$as_echo "$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
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
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_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\""
$as_echo "$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
$as_echo "$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
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
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_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
( $as_echo "## ----------------------------------- ##
## Report this to bug-readline@gnu.org ##
## ----------------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
# ac_fn_c_try_run LINENO
# ----------------------
# Try to link 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\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$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\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
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_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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
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
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
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 ()
{
if (sizeof (($2)))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
eval "$3=yes"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${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$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\""
$as_echo "$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
$as_echo "$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
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
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 (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
#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 ();
/* 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 ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
# ---------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly.
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
as_decl_name=`echo $2|sed 's/ *(.*//'`
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
#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
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_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 ()
{
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 ()
{
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
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
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
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 ()
{
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
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
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext 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 ()
{
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
as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
fi
rm -f core conftest.err conftest.$ac_objext 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 () { return $2; }
static unsigned long int ulongval () { return $2; }
#include
#include
int
main ()
{
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.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
_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
test -z "$as_dir" && as_dir=.
$as_echo "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=`$as_echo "$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=$?
# Save into config.log some information that might help in debugging.
{
echo
$as_echo "## ---------------- ##
## 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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$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
$as_echo "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
$as_echo "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
$as_echo "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
$as_echo "$as_me: caught signal $ac_signal"
$as_echo "$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
$as_echo "/* confdefs.h */" > confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_URL "$PACKAGE_URL"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
# We do not want a PATH search for config.site.
case $CONFIG_SITE in #((
-*) ac_site_file1=./$CONFIG_SITE;;
*/*) ac_site_file1=$CONFIG_SITE;;
*) ac_site_file1=./$CONFIG_SITE;;
esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
else
ac_site_file1=$ac_default_prefix/share/config.site
ac_site_file2=$ac_default_prefix/etc/config.site
fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" \
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
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,)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
$as_echo "$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=`$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error $? "run \`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_aux_dir=
for ac_dir in ./support "$srcdir"/./support; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in ./support \"$srcdir\"/./support" "$LINENO" 5
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.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
ac_config_headers="$ac_config_headers config.h"
LIBVERSION=8.1
# 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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
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
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
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
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
$as_echo "$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
# Check whether --with-curses was given.
if test "${with_curses+set}" = set; then :
withval=$with_curses; opt_curses=$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+set}" = set; then :
enableval=$enable_multibyte; opt_multibyte=$enableval
fi
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
enableval=$enable_shared; opt_shared_libs=$enableval
fi
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then :
enableval=$enable_static; opt_static_libs=$enableval
fi
# Check whether --enable-install-examples was given.
if test "${enable_install_examples+set}" = set; then :
enableval=$enable_install_examples; opt_install_examples=$enableval
fi
# Check whether --enable-bracketed-paste-default was given.
if test "${enable_bracketed_paste_default+set}" = set; then :
enableval=$enable_bracketed_paste_default; opt_bracketed_paste_default=$enableval
fi
if test $opt_multibyte = no; then
$as_echo "#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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
$as_echo_n "(cached) " >&6
else
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
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
SET_MAKE=
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
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
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$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.
$as_echo "$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; 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\""
$as_echo "$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
$as_echo "$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 ()
{
;
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.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$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\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
$as_echo "$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+set}" = set && 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
ac_file=''
fi
if test -z "$ac_file"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
$as_echo_n "checking for C compiler default output file name... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "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\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$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
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$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; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$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 ()
{
FILE *f = fopen ("conftest.out", "w");
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.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
$as_echo_n "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\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$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\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$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
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
$as_echo "$cross_compiling" >&6; }
rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
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\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
$as_echo "$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
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$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; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
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 ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
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.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; 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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
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;
}
/* 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 don't provoke an error unfortunately, instead are silently treated
as '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's necessary to write '\x00'==0 to get something
that's 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 **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_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
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
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_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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "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 ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-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.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# 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. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
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
# Passes both tests.
ac_preproc_ok=:
break
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
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
$as_echo "$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.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# 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. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
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
# Passes both tests.
ac_preproc_ok=:
break
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
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
ac_path_GREP_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
test -z "$as_dir" && as_dir=.
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "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_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
ac_path_GREP_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_GREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
if test -z "$EGREP"; then
ac_path_EGREP_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
test -z "$as_dir" && as_dir=.
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "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_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
ac_path_EGREP_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_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; 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=$EGREP
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
if test "x$ac_cv_header_minix_config_h" = xyes; then :
MINIX=yes
else
MINIX=
fi
if test "$MINIX" = yes; then
$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
$as_echo "#define _MINIX 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
if ${ac_cv_safe_to_define___extensions__+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# define __EXTENSIONS__ 1
$ac_includes_default
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_safe_to_define___extensions__=yes
else
ac_cv_safe_to_define___extensions__=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
test $ac_cv_safe_to_define___extensions__ = yes &&
$as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
$as_echo "#define _ALL_SOURCE 1" >>confdefs.h
$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
$as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
# 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}"
fi
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
$as_echo_n "checking whether $CC needs -traditional... " >&6; }
if ${ac_cv_prog_gcc_traditional+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_pattern="Autoconf.*'x'"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
Autoconf TIOCGETP
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "$ac_pattern" >/dev/null 2>&1; then :
ac_cv_prog_gcc_traditional=yes
else
ac_cv_prog_gcc_traditional=no
fi
rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
Autoconf TCGETA
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "$ac_pattern" >/dev/null 2>&1; then :
ac_cv_prog_gcc_traditional=yes
fi
rm -f conftest*
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
if test $ac_cv_prog_gcc_traditional = yes; then
CC="$CC -traditional"
fi
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.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
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
fi
if test "${ac_cv_path_install+set}" = set; 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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
$as_echo "$AR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
$as_echo "$ac_ct_AR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_AR" = x; then
AR=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
AR=$ac_ct_AR
fi
else
AR="$ac_cv_prog_AR"
fi
test -n "$ARFLAGS" || ARFLAGS="cr"
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
$as_echo "$RANLIB" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
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
test -z "$as_dir" && as_dir=.
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
$as_echo "$ac_ct_RANLIB" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_RANLIB" = x; then
RANLIB=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
RANLIB=$ac_ct_RANLIB
fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
MAKE_SHELL=/bin/sh
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
if ${ac_cv_c_const+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#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};
/* AIX 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;
}
{ /* AIX 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
ac_cv_c_const=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
$as_echo "$ac_cv_c_const" >&6; }
if test $ac_cv_c_const = no; then
$as_echo "#define const /**/" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for function prototypes" >&5
$as_echo_n "checking for function prototypes... " >&6; }
if test "$ac_cv_prog_cc_c89" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define PROTOTYPES 1" >>confdefs.h
$as_echo "#define __PROTOTYPES 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
$as_echo_n "checking whether char is unsigned... " >&6; }
if ${ac_cv_c_char_unsigned+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
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
ac_cv_c_char_unsigned=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5
$as_echo "$ac_cv_c_char_unsigned" >&6; }
if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
$as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
$as_echo_n "checking for working volatile... " >&6; }
if ${ac_cv_c_volatile+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
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
ac_cv_c_volatile=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
$as_echo "$ac_cv_c_volatile" >&6; }
if test $ac_cv_c_volatile = no; then
$as_echo "#define volatile /**/" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; }
if ${ac_cv_type_signal+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
return *(signal (0, 0)) (0) == 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_type_signal=int
else
ac_cv_type_signal=void
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
$as_echo "$ac_cv_type_signal" >&6; }
cat >>confdefs.h <<_ACEOF
#define RETSIGTYPE $ac_cv_type_signal
_ACEOF
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
cat >>confdefs.h <<_ACEOF
#define size_t unsigned int
_ACEOF
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
cat >>confdefs.h <<_ACEOF
#define ssize_t int
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
if ${ac_cv_header_stat_broken+:} false; then :
$as_echo_n "(cached) " >&6
else
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
ac_cv_header_stat_broken=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5
$as_echo "$ac_cv_header_stat_broken" >&6; }
if test $ac_cv_header_stat_broken = yes; then
$as_echo "#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=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
if eval \${$as_ac_Header+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include <$ac_hdr>
int
main ()
{
if ((DIR *) 0)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$as_ac_Header=yes"
else
eval "$as_ac_Header=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$as_ac_Header
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_hdr" | $as_tr_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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
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. */
#ifdef __cplusplus
extern "C"
#endif
char opendir ();
int
main ()
{
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$ac_exeext
if ${ac_cv_search_opendir+:} false; then :
break
fi
done
if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
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. */
#ifdef __cplusplus
extern "C"
#endif
char opendir ();
int
main ()
{
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$ac_exeext
if ${ac_cv_search_opendir+:} false; then :
break
fi
done
if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
$as_echo "$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
for ac_func in fcntl kill lstat readlink
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in fnmatch memmove pselect putenv select setenv setlocale \
strcasecmp strpbrk tcgetattr vsnprintf
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in isascii isxdigit
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in getpwent getpwnam getpwuid
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
if ${ac_cv_type_uid_t+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "uid_t" >/dev/null 2>&1; then :
ac_cv_type_uid_t=yes
else
ac_cv_type_uid_t=no
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
$as_echo "$ac_cv_type_uid_t" >&6; }
if test $ac_cv_type_uid_t = no; then
$as_echo "#define uid_t int" >>confdefs.h
$as_echo "#define gid_t int" >>confdefs.h
fi
for ac_header in unistd.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
if test "x$ac_cv_header_unistd_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UNISTD_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
$as_echo_n "checking for working chown... " >&6; }
if ${ac_cv_func_chown_works+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_func_chown_works=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#include
int
main ()
{
char *f = "conftest.chown";
struct stat before, after;
if (creat (f, 0600) < 0)
return 1;
if (stat (f, &before) < 0)
return 1;
if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
return 1;
if (stat (f, &after) < 0)
return 1;
return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ac_cv_func_chown_works=yes
else
ac_cv_func_chown_works=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
rm -f conftest.chown
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5
$as_echo "$ac_cv_func_chown_works" >&6; }
if test $ac_cv_func_chown_works = yes; then
$as_echo "#define HAVE_CHOWN 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5
$as_echo_n "checking for working strcoll... " >&6; }
if ${ac_cv_func_strcoll_works+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_func_strcoll_works=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
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
ac_cv_func_strcoll_works=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcoll_works" >&5
$as_echo "$ac_cv_func_strcoll_works" >&6; }
if test $ac_cv_func_strcoll_works = yes; then
$as_echo "#define HAVE_STRCOLL 1" >>confdefs.h
fi
for ac_header in fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
string.h strings.h \
limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in sys/ptem.h
do :
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 :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_PTEM_H 1
_ACEOF
fi
done
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
fi
if test "$enable_largefile" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
if ${ac_cv_sys_largefile_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
ac_save_CC=$CC
while :; do
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
break
fi
rm -f core conftest.err conftest.$ac_objext
CC="$CC -n32"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_largefile_CC=' -n32'; break
fi
rm -f core conftest.err conftest.$ac_objext
break
done
CC=$ac_save_CC
rm -f conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
$as_echo "$ac_cv_sys_largefile_CC" >&6; }
if test "$ac_cv_sys_largefile_CC" != no; then
CC=$CC$ac_cv_sys_largefile_CC
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
if ${ac_cv_sys_file_offset_bits+:} false; then :
$as_echo_n "(cached) " >&6
else
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_file_offset_bits=no; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _FILE_OFFSET_BITS 64
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_file_offset_bits=64; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_file_offset_bits=unknown
break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
case $ac_cv_sys_file_offset_bits in #(
no | unknown) ;;
*)
cat >>confdefs.h <<_ACEOF
#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
_ACEOF
;;
esac
rm -rf conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
if ${ac_cv_sys_large_files+:} false; then :
$as_echo_n "(cached) " >&6
else
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_large_files=no; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGE_FILES 1
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_large_files=1; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_large_files=unknown
break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
$as_echo "$ac_cv_sys_large_files" >&6; }
case $ac_cv_sys_large_files in #(
no | unknown) ;;
*)
cat >>confdefs.h <<_ACEOF
#define _LARGE_FILES $ac_cv_sys_large_files
_ACEOF
;;
esac
rm -rf conftest*
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of signal functions" >&5
$as_echo_n "checking for type of signal functions... " >&6; }
if ${bash_cv_signal_vintage+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
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_signal_vintage=posix
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
int mask = sigmask(SIGINT);
sigsetmask(mask); sigblock(mask); sigpause(mask);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
bash_cv_signal_vintage=4.2bsd
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
RETSIGTYPE foo() { }
int
main ()
{
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_signal_vintage=svr3
else
bash_cv_signal_vintage=v7
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_signal_vintage" >&5
$as_echo "$bash_cv_signal_vintage" >&6; }
if test "$bash_cv_signal_vintage" = posix; then
$as_echo "#define HAVE_POSIX_SIGNALS 1" >>confdefs.h
elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
$as_echo "#define HAVE_BSD_SIGNALS 1" >>confdefs.h
elif test "$bash_cv_signal_vintage" = svr3; then
$as_echo "#define HAVE_USG_SIGHOLD 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal handlers must be reinstalled when invoked" >&5
$as_echo_n "checking if signal handlers must be reinstalled when invoked... " >&6; }
if ${bash_cv_must_reinstall_sighandlers+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5
$as_echo "$as_me: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&2;}
bash_cv_must_reinstall_sighandlers=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#ifdef HAVE_UNISTD_H
#include
#endif
#include
typedef RETSIGTYPE sigfunc();
volatile int nsigint;
#ifdef HAVE_POSIX_SIGNALS
sigfunc *
set_signal_handler(sig, 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
RETSIGTYPE
sigint(s)
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
bash_cv_must_reinstall_sighandlers=yes
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_must_reinstall_sighandlers" >&5
$as_echo "$bash_cv_must_reinstall_sighandlers" >&6; }
if test $bash_cv_must_reinstall_sighandlers = yes; then
$as_echo "#define MUST_REINSTALL_SIGHANDLERS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
$as_echo_n "checking for presence of POSIX-style sigsetjmp/siglongjmp... " >&6; }
if ${bash_cv_func_sigsetjmp+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&5
$as_echo "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&2;}
bash_cv_func_sigsetjmp=missing
else
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;
sigjmp_buf xx;
/* get the mask */
sigemptyset(&set);
sigemptyset(&oset);
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
/* save it */
code = sigsetjmp(xx, 1);
if (code)
exit(0); /* could get sigmask and compare to oset here. */
/* change it */
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
bash_cv_func_sigsetjmp=missing
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_sigsetjmp" >&5
$as_echo "$bash_cv_func_sigsetjmp" >&6; }
if test $bash_cv_func_sigsetjmp = present; then
$as_echo "#define HAVE_POSIX_SIGSETJMP 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lstat" >&5
$as_echo_n "checking for lstat... " >&6; }
if ${bash_cv_func_lstat+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
lstat(".",(struct stat *)0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
bash_cv_func_lstat=yes
else
bash_cv_func_lstat=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_lstat" >&5
$as_echo "$bash_cv_func_lstat" >&6; }
if test $bash_cv_func_lstat = yes; then
$as_echo "#define HAVE_LSTAT 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not strcoll and strcmp differ" >&5
$as_echo_n "checking whether or not strcoll and strcmp differ... " >&6; }
if ${bash_cv_func_strcoll_broken+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5
$as_echo "$as_me: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&2;}
bash_cv_func_strcoll_broken=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#if defined (HAVE_LOCALE_H)
#include
#endif
#include
#include
int
main(c, v)
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
bash_cv_func_strcoll_broken=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strcoll_broken" >&5
$as_echo "$bash_cv_func_strcoll_broken" >&6; }
if test $bash_cv_func_strcoll_broken = yes; then
$as_echo "#define STRCOLL_BROKEN 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the ctype macros accept non-ascii characters" >&5
$as_echo_n "checking whether the ctype macros accept non-ascii characters... " >&6; }
if ${bash_cv_func_ctype_nonascii+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check ctype macros if cross compiling -- defaulting to no" >&5
$as_echo "$as_me: WARNING: cannot check ctype macros if cross compiling -- defaulting to no" >&2;}
bash_cv_func_ctype_nonascii=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef HAVE_LOCALE_H
#include
#endif
#include
#include
#include
int
main(c, v)
int c;
char *v[];
{
char *deflocale;
unsigned char x;
int r1, r2;
#ifdef HAVE_SETLOCALE
/* We take a shot here. If that locale is not known, try the
system default. We try this one because '\342' (226) is
known to be a printable character in that locale. */
deflocale = setlocale(LC_ALL, "en_US.ISO8859-1");
if (deflocale == 0)
deflocale = setlocale(LC_ALL, "");
#endif
x = '\342';
r1 = isprint(x);
x -= 128;
r2 = isprint(x);
exit (r1 == 0 || r2 == 0);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
bash_cv_func_ctype_nonascii=yes
else
bash_cv_func_ctype_nonascii=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_ctype_nonascii" >&5
$as_echo "$bash_cv_func_ctype_nonascii" >&6; }
if test $bash_cv_func_ctype_nonascii = yes; then
$as_echo "#define CTYPE_NON_ASCII 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getpw functions are declared in pwd.h" >&5
$as_echo_n "checking whether getpw functions are declared in pwd.h... " >&6; }
if ${bash_cv_getpw_declared+:} false; then :
$as_echo_n "(cached) " >&6
else
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 "getpwuid" >/dev/null 2>&1; then :
bash_cv_getpw_declared=yes
else
bash_cv_getpw_declared=no
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_getpw_declared" >&5
$as_echo "$bash_cv_getpw_declared" >&6; }
if test $bash_cv_getpw_declared = yes; then
$as_echo "#define HAVE_GETPW_DECLS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether termios.h defines TIOCGWINSZ" >&5
$as_echo_n "checking whether termios.h defines TIOCGWINSZ... " >&6; }
if ${ac_cv_sys_tiocgwinsz_in_termios_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#ifdef TIOCGWINSZ
yes
#endif
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1; then :
ac_cv_sys_tiocgwinsz_in_termios_h=yes
else
ac_cv_sys_tiocgwinsz_in_termios_h=no
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5
$as_echo "$ac_cv_sys_tiocgwinsz_in_termios_h" >&6; }
if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5
$as_echo_n "checking whether sys/ioctl.h defines TIOCGWINSZ... " >&6; }
if ${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#ifdef TIOCGWINSZ
yes
#endif
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "yes" >/dev/null 2>&1; then :
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes
else
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5
$as_echo "$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6; }
if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
$as_echo "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sig_atomic_t in signal.h" >&5
$as_echo_n "checking for sig_atomic_t in signal.h... " >&6; }
if ${ac_cv_have_sig_atomic_t+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
sig_atomic_t x;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_have_sig_atomic_t=yes
else
ac_cv_have_sig_atomic_t=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_sig_atomic_t" >&5
$as_echo "$ac_cv_have_sig_atomic_t" >&6; }
if test "$ac_cv_have_sig_atomic_t" = "no"
then
ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" "$ac_includes_default"
if test "x$ac_cv_type_sig_atomic_t" = xyes; then :
else
cat >>confdefs.h <<_ACEOF
#define sig_atomic_t int
_ACEOF
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether signal handlers are of type void" >&5
$as_echo_n "checking whether signal handlers are of type void... " >&6; }
if ${bash_cv_void_sighandler+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#ifdef signal
#undef signal
#endif
#ifdef __cplusplus
extern "C"
#endif
void (*signal ()) ();
int
main ()
{
int i;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_void_sighandler=yes
else
bash_cv_void_sighandler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_void_sighandler" >&5
$as_echo "$bash_cv_void_sighandler" >&6; }
if test $bash_cv_void_sighandler = yes; then
$as_echo "#define VOID_SIGHANDLER 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIOCSTAT in sys/ioctl.h" >&5
$as_echo_n "checking for TIOCSTAT in sys/ioctl.h... " >&6; }
if ${bash_cv_tiocstat_in_ioctl+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
int x = TIOCSTAT;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_tiocstat_in_ioctl=yes
else
bash_cv_tiocstat_in_ioctl=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_tiocstat_in_ioctl" >&5
$as_echo "$bash_cv_tiocstat_in_ioctl" >&6; }
if test $bash_cv_tiocstat_in_ioctl = yes; then
$as_echo "#define TIOCSTAT_IN_SYS_IOCTL 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FIONREAD in sys/ioctl.h" >&5
$as_echo_n "checking for FIONREAD in sys/ioctl.h... " >&6; }
if ${bash_cv_fionread_in_ioctl+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
int x = FIONREAD;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_fionread_in_ioctl=yes
else
bash_cv_fionread_in_ioctl=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_fionread_in_ioctl" >&5
$as_echo "$bash_cv_fionread_in_ioctl" >&6; }
if test $bash_cv_fionread_in_ioctl = yes; then
$as_echo "#define FIONREAD_IN_SYS_IOCTL 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for speed_t in sys/types.h" >&5
$as_echo_n "checking for speed_t in sys/types.h... " >&6; }
if ${bash_cv_speed_t_in_sys_types+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
speed_t x;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_speed_t_in_sys_types=yes
else
bash_cv_speed_t_in_sys_types=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_speed_t_in_sys_types" >&5
$as_echo "$bash_cv_speed_t_in_sys_types" >&6; }
if test $bash_cv_speed_t_in_sys_types = yes; then
$as_echo "#define SPEED_T_IN_SYS_TYPES 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct winsize in sys/ioctl.h and termios.h" >&5
$as_echo_n "checking for struct winsize in sys/ioctl.h and termios.h... " >&6; }
if ${bash_cv_struct_winsize_header+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
struct winsize x;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_struct_winsize_header=ioctl_h
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
struct winsize x;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_struct_winsize_header=termios_h
else
bash_cv_struct_winsize_header=other
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $bash_cv_struct_winsize_header = ioctl_h; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: sys/ioctl.h" >&5
$as_echo "sys/ioctl.h" >&6; }
$as_echo "#define STRUCT_WINSIZE_IN_SYS_IOCTL 1" >>confdefs.h
elif test $bash_cv_struct_winsize_header = termios_h; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: termios.h" >&5
$as_echo "termios.h" >&6; }
$as_echo "#define STRUCT_WINSIZE_IN_TERMIOS 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_ino" >&5
$as_echo_n "checking for struct dirent.d_ino... " >&6; }
if ${bash_cv_dirent_has_dino+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#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
# endif /* SYSDIR */
# ifdef HAVE_NDIR_H
# include
# endif
#endif /* HAVE_DIRENT_H */
int
main ()
{
struct dirent d; int z; z = d.d_ino;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_dirent_has_dino=yes
else
bash_cv_dirent_has_dino=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_dino" >&5
$as_echo "$bash_cv_dirent_has_dino" >&6; }
if test $bash_cv_dirent_has_dino = yes; then
$as_echo "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_fileno" >&5
$as_echo_n "checking for struct dirent.d_fileno... " >&6; }
if ${bash_cv_dirent_has_d_fileno+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#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
# endif /* SYSDIR */
# ifdef HAVE_NDIR_H
# include
# endif
#endif /* HAVE_DIRENT_H */
int
main ()
{
struct dirent d; int z; z = d.d_fileno;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_dirent_has_d_fileno=yes
else
bash_cv_dirent_has_d_fileno=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_fileno" >&5
$as_echo "$bash_cv_dirent_has_d_fileno" >&6; }
if test $bash_cv_dirent_has_d_fileno = yes; then
$as_echo "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h
fi
for ac_header in libaudit.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default"
if test "x$ac_cv_header_libaudit_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBAUDIT_H 1
_ACEOF
fi
done
ac_fn_c_check_decl "$LINENO" "AUDIT_USER_TTY" "ac_cv_have_decl_AUDIT_USER_TTY" "#include
"
if test "x$ac_cv_have_decl_AUDIT_USER_TTY" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_AUDIT_USER_TTY $ac_have_decl
_ACEOF
case "$host_os" in
aix*) prefer_curses=yes ;;
esac
if test "X$bash_cv_termcap_lib" = "X"; then
_bash_needmsg=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which library has the termcap functions" >&5
$as_echo_n "checking which library has the termcap functions... " >&6; }
_bash_needmsg=
fi
if ${bash_cv_termcap_lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_fn_c_check_func "$LINENO" "tgetent" "ac_cv_func_tgetent"
if test "x$ac_cv_func_tgetent" = xyes; then :
bash_cv_termcap_lib=libc
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5
$as_echo_n "checking for tgetent in -ltermcap... " >&6; }
if ${ac_cv_lib_termcap_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltermcap $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. */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_termcap_tgetent=yes
else
ac_cv_lib_termcap_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5
$as_echo "$ac_cv_lib_termcap_tgetent" >&6; }
if test "x$ac_cv_lib_termcap_tgetent" = xyes; then :
bash_cv_termcap_lib=libtermcap
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfo" >&5
$as_echo_n "checking for tgetent in -ltinfo... " >&6; }
if ${ac_cv_lib_tinfo_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltinfo $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. */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_tinfo_tgetent=yes
else
ac_cv_lib_tinfo_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgetent" >&5
$as_echo "$ac_cv_lib_tinfo_tgetent" >&6; }
if test "x$ac_cv_lib_tinfo_tgetent" = xyes; then :
bash_cv_termcap_lib=libtinfo
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5
$as_echo_n "checking for tgetent in -lcurses... " >&6; }
if ${ac_cv_lib_curses_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcurses $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. */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_curses_tgetent=yes
else
ac_cv_lib_curses_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tgetent" >&5
$as_echo "$ac_cv_lib_curses_tgetent" >&6; }
if test "x$ac_cv_lib_curses_tgetent" = xyes; then :
bash_cv_termcap_lib=libcurses
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5
$as_echo_n "checking for tgetent in -lncurses... " >&6; }
if ${ac_cv_lib_ncurses_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lncurses $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. */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ncurses_tgetent=yes
else
ac_cv_lib_ncurses_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5
$as_echo "$ac_cv_lib_ncurses_tgetent" >&6; }
if test "x$ac_cv_lib_ncurses_tgetent" = xyes; then :
bash_cv_termcap_lib=libncurses
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5
$as_echo_n "checking for tgetent in -lncursesw... " >&6; }
if ${ac_cv_lib_ncursesw_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lncursesw $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. */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ncursesw_tgetent=yes
else
ac_cv_lib_ncursesw_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5
$as_echo "$ac_cv_lib_ncursesw_tgetent" >&6; }
if test "x$ac_cv_lib_ncursesw_tgetent" = xyes; then :
bash_cv_termcap_lib=libncursesw
else
bash_cv_termcap_lib=gnutermcap
fi
fi
fi
fi
fi
fi
fi
if test "X$_bash_needmsg" = "Xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which library has the termcap functions" >&5
$as_echo_n "checking which library has the termcap functions... " >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using $bash_cv_termcap_lib" >&5
$as_echo "using $bash_cv_termcap_lib" >&6; }
if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
LDFLAGS="$LDFLAGS -L./lib/termcap"
TERMCAP_LIB="./lib/termcap/libtermcap.a"
TERMCAP_DEP="./lib/termcap/libtermcap.a"
elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
TERMCAP_LIB=-ltermcap
TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libtinfo; then
TERMCAP_LIB=-ltinfo
TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libncurses; then
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libc; then
TERMCAP_LIB=
TERMCAP_DEP=
else
TERMCAP_LIB=-lcurses
TERMCAP_DEP=
fi
if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
if test "$prefer_curses" = yes; then
TERMCAP_LIB=-lcurses
else
TERMCAP_LIB=-ltermcap #default
fi
fi
# Windows ncurses installation
if test "$TERMCAP_LIB" = "-lncurses"; then
for ac_header in ncurses/termcap.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "ncurses/termcap.h" "ac_cv_header_ncurses_termcap_h" "$ac_includes_default"
if test "x$ac_cv_header_ncurses_termcap_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_NCURSES_TERMCAP_H 1
_ACEOF
fi
done
fi
case "$TERMCAP_LIB" in
-ltinfo) TERMCAP_PKG_CONFIG_LIB=tinfo ;;
-lcurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
-lncurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
-ltermcap) TERMCAP_PKG_CONFIG_LIB=termcap ;;
*) TERMCAP_PKG_CONFIG_LIB=termcap ;;
esac
for ac_header in wctype.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "wctype.h" "ac_cv_header_wctype_h" "$ac_includes_default"
if test "x$ac_cv_header_wctype_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_WCTYPE_H 1
_ACEOF
fi
done
for ac_header in wchar.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default"
if test "x$ac_cv_header_wchar_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_WCHAR_H 1
_ACEOF
fi
done
for ac_header in langinfo.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "langinfo.h" "ac_cv_header_langinfo_h" "$ac_includes_default"
if test "x$ac_cv_header_langinfo_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LANGINFO_H 1
_ACEOF
fi
done
for ac_header in mbstr.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "mbstr.h" "ac_cv_header_mbstr_h" "$ac_includes_default"
if test "x$ac_cv_header_mbstr_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_MBSTR_H 1
_ACEOF
fi
done
ac_fn_c_check_func "$LINENO" "mbrlen" "ac_cv_func_mbrlen"
if test "x$ac_cv_func_mbrlen" = xyes; then :
$as_echo "#define HAVE_MBRLEN 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "mbscasecmp" "ac_cv_func_mbscasecmp"
if test "x$ac_cv_func_mbscasecmp" = xyes; then :
$as_echo "#define HAVE_MBSCMP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "mbscmp" "ac_cv_func_mbscmp"
if test "x$ac_cv_func_mbscmp" = xyes; then :
$as_echo "#define HAVE_MBSCMP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "mbsnrtowcs" "ac_cv_func_mbsnrtowcs"
if test "x$ac_cv_func_mbsnrtowcs" = xyes; then :
$as_echo "#define HAVE_MBSNRTOWCS 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "mbsrtowcs" "ac_cv_func_mbsrtowcs"
if test "x$ac_cv_func_mbsrtowcs" = xyes; then :
$as_echo "#define HAVE_MBSRTOWCS 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "mbschr" "ac_cv_func_mbschr"
if test "x$ac_cv_func_mbschr" = xyes; then :
$as_echo "#define HAVE_MBSCHR 1" >>confdefs.h
else
case " $LIBOBJS " in
*" mbschr.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS mbschr.$ac_objext"
;;
esac
fi
ac_fn_c_check_func "$LINENO" "wcrtomb" "ac_cv_func_wcrtomb"
if test "x$ac_cv_func_wcrtomb" = xyes; then :
$as_echo "#define HAVE_WCRTOMB 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "wcscoll" "ac_cv_func_wcscoll"
if test "x$ac_cv_func_wcscoll" = xyes; then :
$as_echo "#define HAVE_WCSCOLL 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "wcsdup" "ac_cv_func_wcsdup"
if test "x$ac_cv_func_wcsdup" = xyes; then :
$as_echo "#define HAVE_WCSDUP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "wcwidth" "ac_cv_func_wcwidth"
if test "x$ac_cv_func_wcwidth" = xyes; then :
$as_echo "#define HAVE_WCWIDTH 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "wctype" "ac_cv_func_wctype"
if test "x$ac_cv_func_wctype" = xyes; then :
$as_echo "#define HAVE_WCTYPE 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "wcswidth" "ac_cv_func_wcswidth"
if test "x$ac_cv_func_wcswidth" = xyes; then :
$as_echo "#define HAVE_WCSWIDTH 1" >>confdefs.h
else
case " $LIBOBJS " in
*" wcswidth.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS wcswidth.$ac_objext"
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc and mbstate_t are properly declared" >&5
$as_echo_n "checking whether mbrtowc and mbstate_t are properly declared... " >&6; }
if ${ac_cv_func_mbrtowc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
wchar_t wc;
char const s[] = "";
size_t n = 1;
mbstate_t state;
return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_func_mbrtowc=yes
else
ac_cv_func_mbrtowc=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mbrtowc" >&5
$as_echo "$ac_cv_func_mbrtowc" >&6; }
if test $ac_cv_func_mbrtowc = yes; then
$as_echo "#define HAVE_MBRTOWC 1" >>confdefs.h
fi
if test $ac_cv_func_mbrtowc = yes; then
$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h
fi
for ac_func in iswlower iswupper towlower towupper iswctype
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
$as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
if ${bash_cv_langinfo_codeset+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
char* cs = nl_langinfo(CODESET);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
bash_cv_langinfo_codeset=yes
else
bash_cv_langinfo_codeset=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_langinfo_codeset" >&5
$as_echo "$bash_cv_langinfo_codeset" >&6; }
if test $bash_cv_langinfo_codeset = yes; then
$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t in wchar.h" >&5
$as_echo_n "checking for wchar_t in wchar.h... " >&6; }
if ${bash_cv_type_wchar_t+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
wchar_t foo;
foo = 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_type_wchar_t=yes
else
bash_cv_type_wchar_t=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wchar_t" >&5
$as_echo "$bash_cv_type_wchar_t" >&6; }
if test $bash_cv_type_wchar_t = yes; then
$as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctype_t in wctype.h" >&5
$as_echo_n "checking for wctype_t in wctype.h... " >&6; }
if ${bash_cv_type_wctype_t+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
wctype_t foo;
foo = 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_type_wctype_t=yes
else
bash_cv_type_wctype_t=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wctype_t" >&5
$as_echo "$bash_cv_type_wctype_t" >&6; }
if test $bash_cv_type_wctype_t = yes; then
$as_echo "#define HAVE_WCTYPE_T 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wint_t in wctype.h" >&5
$as_echo_n "checking for wint_t in wctype.h... " >&6; }
if ${bash_cv_type_wint_t+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
wint_t foo;
foo = 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bash_cv_type_wint_t=yes
else
bash_cv_type_wint_t=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wint_t" >&5
$as_echo "$bash_cv_type_wint_t" >&6; }
if test $bash_cv_type_wint_t = yes; then
$as_echo "#define HAVE_WINT_T 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wcwidth broken with unicode combining characters" >&5
$as_echo_n "checking for wcwidth broken with unicode combining characters... " >&6; }
if ${bash_cv_wcwidth_broken+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
bash_cv_wcwidth_broken=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
#include
int
main(c, v)
int c;
char **v;
{
int w;
setlocale(LC_ALL, "en_US.UTF-8");
w = wcwidth (0x0301);
exit (w == 0); /* exit 0 if wcwidth broken */
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
bash_cv_wcwidth_broken=yes
else
bash_cv_wcwidth_broken=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_wcwidth_broken" >&5
$as_echo "$bash_cv_wcwidth_broken" >&6; }
if test "$bash_cv_wcwidth_broken" = yes; then
$as_echo "#define WCWIDTH_BROKEN 1" >>confdefs.h
fi
if test "$am_cv_func_iconv" = yes; then
OLDLIBS="$LIBS"
LIBS="$LIBS $LIBINTL $LIBICONV"
for ac_func in locale_charset
do :
ac_fn_c_check_func "$LINENO" "locale_charset" "ac_cv_func_locale_charset"
if test "x$ac_cv_func_locale_charset" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LOCALE_CHARSET 1
_ACEOF
fi
done
LIBS="$OLDLIBS"
fi
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5
$as_echo_n "checking size of wchar_t... " >&6; }
if ${ac_cv_sizeof_wchar_t+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default"; then :
else
if test "$ac_cv_type_wchar_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (wchar_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_wchar_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5
$as_echo "$ac_cv_sizeof_wchar_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t
_ACEOF
case "$host_cpu" in
*cray*) LOCAL_CFLAGS=-DCRAY ;;
*s390*) LOCAL_CFLAGS=-fsigned-char ;;
esac
case "$host_os" in
isc*) LOCAL_CFLAGS=-Disc386 ;;
hpux*) LOCAL_CFLAGS="-DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
esac
# shared library configuration section
#
# Shared object configuration section. These values are generated by
# ${srcdir}/support/shobj-conf
#
if test -f ${srcdir}/support/shobj-conf; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking configuration for building shared libraries" >&5
$as_echo_n "checking configuration for building shared libraries... " >&6; }
eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
# case "$SHLIB_LIBS" in
# *curses*|*termcap*|*termlib*) ;;
# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
# esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHLIB_STATUS" >&5
$as_echo "$SHLIB_STATUS" >&6; }
# SHLIB_STATUS is either `supported' or `unsupported'. If it's
# `unsupported', turn off any default shared library building
if test "$SHLIB_STATUS" = 'unsupported'; then
opt_shared_libs=no
fi
# shared library versioning
# quoted for m4 so I can use character classes
SHLIB_MAJOR=`expr "$LIBVERSION" : '\([0-9]\)\..*'`
SHLIB_MINOR=`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`
fi
if test "$opt_static_libs" = "yes"; then
STATIC_TARGET=static
STATIC_INSTALL_TARGET=install-static
fi
if test "$opt_shared_libs" = "yes"; then
SHARED_TARGET=shared
SHARED_INSTALL_TARGET=install-shared
fi
if test "$opt_install_examples" = "yes"; then
EXAMPLES_INSTALL_TARGET=install-examples
fi
case "$build_os" in
msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
*) BUILD_DIR=`pwd` ;;
esac
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
if test -n "$want_auto_cflags"; then
CFLAGS="$AUTO_CFLAGS"
fi
CFLAGS="$CFLAGS $STYLE_CFLAGS"
ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc"
ac_config_commands="$ac_config_commands default"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$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=\ *)
# `set' does not quote correctly, so add quotes: double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
if test ! -f "$cache_file" || test -h "$cache_file"; then
cat confcache >"$cache_file"
else
case $cache_file in #(
*/* | ?:*)
mv -f confcache "$cache_file"$$ &&
mv -f "$cache_file"$$ "$cache_file" ;; #(
*)
mv -f confcache "$cache_file" ;;
esac
fi
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
as_write_fail=0
cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; 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
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# 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
test -z "$as_dir" && as_dir=.
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
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# 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
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
# 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_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# 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
as_fn_append ()
{
eval $1=\$$1\$2
}
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
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
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 ||
$as_echo 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
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
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
# 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=`$as_echo "$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 ||
$as_echo 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
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_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_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by readline $as_me 8.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_commands="$ac_config_commands"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
--config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Configuration commands:
$config_commands
Report bugs to ."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
readline config.status 8.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
test -n "\$AWK" || AWK=awk
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
--config | --confi | --conf | --con | --co | --c )
$as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
'') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
exec "\$@"
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
$as_echo "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
"shlib/Makefile") CONFIG_FILES="$CONFIG_FILES shlib/Makefile" ;;
"readline.pc") CONFIG_FILES="$CONFIG_FILES readline.pc" ;;
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' >$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
h
s///
s/^/:/
s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$//
x
s/\(=[ ]*\).*/\1/
G
s/\n//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' >$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
shift
for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input='Generated from '`
$as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
$as_echo "$as_me: creating $ac_file" >&6;}
fi
# Neutralize special characters interpreted by sed in replacement strings.
case $configure_input in #(
*\&* | *\|* | *\\* )
ac_sed_conf_input=`$as_echo "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$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
case $ac_mode in
:F)
#
# CONFIG_FILE
#
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
ac_sed_dataroot='
/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
"$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
rm -f "$ac_tmp/stdin"
case $ac_file in
-) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
*) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
:C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
esac
case $ac_file$ac_mode in
"default":C)
# Makefile uses this timestamp file to record whether config.h is up to date.
echo > stamp-h
;;
esac
done # for ac_tag
as_fn_exit 0
_ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
readline-8.1.2/parse-colors.h 000644 000436 000120 00000002777 11741616321 016151 0 ustar 00chet admin 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 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 _PARSE_COLORS_H_
#define _PARSE_COLORS_H_
#include "readline.h"
#define LEN_STR_PAIR(s) sizeof (s) - 1, s
void _rl_parse_colors (void);
static const char *const indicator_name[]=
{
"lc", "rc", "ec", "rs", "no", "fi", "di", "ln", "pi", "so",
"bd", "cd", "mi", "or", "ex", "do", "su", "sg", "st",
"ow", "tw", "ca", "mh", "cl", NULL
};
/* Buffer for color sequences */
static char *color_buf;
#endif /* !_PARSE_COLORS_H_ */
readline-8.1.2/CHANGELOG 000664 000436 000120 00000106511 13746617272 014607 0 ustar 00chet admin 000000 000000 \[Readline-specific changelog. Descriptions of changes to the source are
found in the bash changelog.]
6/9
---
Makefile.in
- quote value of ${INSTALL_DATA} when passing it to makes in
subdirectories
7/1
---
Makefile.in
- don't pass INSTALL_DATA to a make in the `doc' subdirectory; let
autoconf set the value itself in the Makefile
- removed a stray `-' before $(RANLIB) in the `install' recipe
doc/Makefile.in
- add a VPATH assignment so the documentation is not remade if it's
already up-to-date in the distribution
configure.in
- call AC_SUBST(LOCAL_LDFLAGS), since Makefile.in contains
@LOCAL_LDFLAGS@
7/9
---
config.h.in
- add define lines for STRUCT_WINSIZE_IN_SYS_IOCTL and
STRUCT_WINSIZE_IN_TERMIOS
configure.in
- call BASH_STRUCT_WINSIZE to look for the definition of
`struct winsize'
7/17
----
configure.in
- call AC_MINIX
config.h.in
- add define line for AC_MINIX
7/18
----
Makefile.in
- add `install-shared' and `uninstall-shared' targets
8/4
---
Makefile.in
- install and uninstall libhistory.a in the `install' and
`uninstall' targets
9/4
---
configure.in
- bumped LIBVERSION up to 2.1.1, indicating that this is patch
level 1 to release 2.1
9/16
----
Makefile.in
- `make distclean' now descends into the `examples' subdir
doc/Makefile.in
- the `distclean' and `maintainer-clean' targets should remove
Makefile
examples/Makefile.in
- added the various clean targets
4/2
---
configure.in
- bumped LIBVERSION up to 2.2
4/18
----
[readline-2.2 released]
4/20
----
Makefile.in
- make `libhistory.a' a dependency of `install'
- fixed a typo in the recipe for `install' that copied libreadline.a
to libhistory.old right after installing it
4/27
----
doc/Makefile.in
- install {readline,history}.info out of the source directory if
they are not found in the current (build) directory -- only an
issue if the libraries are built in a different directory than
the source directory
5/1
---
support/shobj-conf
- script from the bash distribution to do shared object and library
configuration
shlib/Makefile.in
- new directory and makefile to handle building shared versions of
libreadline and libhistory, controlled by support/shobj-conf
5/7
---
doc/Makefile.in
- set SHELL to /bin/sh, rather than relying on make to be correct
5/14
----
savestring.c
- new file, moved from shell.c, for backwards compatibility
Makefile.in, shlib/Makefile.in
- make sure savestring.c is compiled and added to libreadline and
libhistory
[THERE ARE NO MORE #ifdef SHELL LINES IN THE C SOURCE FILES.]
5/15
----
README
- updated description of shared library creation for the new scheme
[THERE ARE NO MORE #ifdef SHELL LINES IN ANY OF THE SOURCE FILES.]
Makefile.in
- bumped SHLIB_MAJOR up to 4 since we've augmented the library
API
- rlconf.h is now one of the installed headers, so applications can
find out whether things like vi-mode are available in the installed
libreadline
5/20
----
configure.in
- changed RL_LIBRARY_VERSION to 4.0 to match the version of the
installed shared libraries
6/5
---
rlstdc.h
- new file
Makefile.in
- rlstdc.h is now one of the installed headers
8/3
---
shlib/Makefile.in
- made the suffix rule that creates xx.so from xx.c write the
compiler output to `a.o', which is then mv'd to xx.so, because
some compilers (Sun WSpro 4.2, for example) don't allow any
suffixes other than `.o' for `cc -c' (not even `a.out')
9/15
----
Makefile.in
- AR and ARFLAGS are now substituted by configure, used in recipes
that build the libraries
configure.in
- use AC_CHECK_PROG to check for ar
- set ARFLAGS if it has not already been set in the environment
10/5
----
Makefile.in
- removed savestring.o from object file list
10/28
-----
shlib/Makefile.in
- don't use a fixed filename in the .c.so suffix rule to avoid
problems with parallel makes
12/21
-----
support/shlib-install
- new script to install shared readline and history libraries
shlib/Makefile.in
- changed to call shlib-install for install and uninstall targets
[readline-4.0-beta1 frozen]
12/22
-----
configure.in
- call AC_SUBST for SHOBJ_XLDFLAGS and SHLIB_LIBS
shlib/Makefile.in
- SHOBJ_XLDFLAGS and SHLIB_LIBS are now substituted by configure
- add $(SHLIB_LIBS) at end of command line that builds the shared
libraries (currently needed only by AIX 4.2)
12/31
-----
MANIFEST, MANIFEST.doc
- the TOC html files are no longer generated and no longer part of
the distribution
2/18/1999
---------
configure.in
- set MAKE_SHELL to /bin/sh and substitute into the Makefiles
Makefile.in,{doc,examples,shlib}/Makefile.in
- set SHELL from @MAKE_SHELL@
[readline-4.0 released]
3/11
----
doc/Makefile.in
- removed references to HTMLTOC, since separate HTML table-of-contents
files are no longer created
examples/Makefile.in
- remove `*.exe' in clean target for MS-DOS
Makefile.in
- make `readline' target depend on ./libreadline.a
- configure now substitutes TERMCAP_LIB into Makefile.in
- use ${TERMCAP_LIB} instead of -ltermcap in recipe for `readline'
- clean target now removes readline and readline.exe in case they
get built
configure.in
- use `pwd.exe' to set BUILD_DIR on MS-DOS DJGPP
3/15
----
support/shlib-install
- Irix 5.x and Irix 6.x should install shared libraries like Solaris 2
- changes for installing on hp-ux 1[01].x
3/23
----
configure.in
- make sure that the $CC argument to shobj-conf is quoted
4/8
---
xmalloc.h, rlprivate.h, rlshell.h
- new files
Makefile.in,shlib/Makefile.in
- add dependencies on xmalloc.h, rlshell.h
- add xmalloc.h, rlprivate.h, rlshell.h to list of header files
MANIFEST
- add xmalloc.h, rlprivate.h, rlshell.h
4/9
---
Makefile.in,shlib/Makefile.in
- add dependencies on rlprivate.h
4/13
----
doc/Makefile.in
- add variable, PSDVI, which is the desired resolution of the
generated postscript files. Set to 300 because I don't have
any 600-dpi printers
- set LANGUAGE= before calling makeinfo, so messages are in English
- add rluserman.{info,dvi,ps,html} to appropriate variables
- add rules to create rluserman.{info,dvi,ps,html}
- install and uninstall rluserman.info, but don't update the directory
file in $(infodir) yet
MANIFEST
- add doc/rluserman.{texinfo,info,dvi,ps,html}
4/30
----
configure.in
- updated library version to 4.1
5/3
---
configure.in
- SHLIB_MAJOR and SHLIB_MINOR shared library version numbers are
constructed from $LIBRARY_VERSION and substituted into Makefiles
5/5
---
support/shlib-install
- OSF/1 installs shared libraries like Solaris
Makefile.in
- broke the header file install and uninstall into two new targets:
install-headers and uninstall-headers
- install and uninstall depend on install-headers and uninstall-headers
respectively
- changed install-shared and uninstall-shared targets to depend on
install-headers and uninstall-headers, respectively, so users may
choose to install only the shared libraries. I'm not sure about
the uninstall one yet -- maybe it should check whether or not
the static libraries are installed and not remove the header files
if they are
9/3
---
configure.in, config.h.in
- added test for memmove (for later use)
- changed version to 4.1-beta1
9/13
----
examples/rlfe.c
- Per Bothner's `rlfe' readline front-end program
examples/Makefile.in
- added rules to build rlfe
9/21
----
support/shlib-install
- changes to handle FreeBSD-3.x elf or a.out shared libraries, which
have different semantics and need different naming conventions
1/24/2000
---------
doc/Makefile.in
- remove *.bt and *.bts on `make clean'
2/4
---
configure.in
- changed LIBVERSION to 4.1-beta5
3/17/2000
---------
[readline-4.1 released]
3/23
----
Makefile.in
- remove the `-t' argument to ranlib in the install recipe; some
ranlibs don't have it and attempt to create a file named `-t'
3/27
----
support/shlib-install
- install shared libraries unwritable by anyone on HP-UX
- changed symlinks to relative pathnames on all platforms
shlib/Makefile.in
- added missing `includedir' assignment, substituted by configure
Makefile.in
- added missing @SET_MAKE@ so configure can set $MAKE appropriately
configure.in
- add call to AC_PROG_MAKE_SET
8/30
----
shlib/Makefile.in
- change the soname bound into the shared libraries, so it includes
only the major version number. If it includes the minor version,
programs depending on it must be rebuilt (which may or may not be
a bad thing)
9/6
---
examples/rlfe.c
- add -l option to log input and output (-a option appends to logfile)
- add -n option to set readline application name
- add -v, -h options for version and help information
- change a few things because getopt() is now used to parse arguments
9/12
----
support/shlib-install
- fix up the libname on HPUX 11
10/18
-----
configure.in
- changed library version to 4.2-alpha
10/30
-----
configure.in
- add -fsigned-char to LOCAL_CFLAGS for Linux running on the IBM
S/390
Makefile.in
- added new file, rltypedefs.h, installed by default with `make install'
11/2
----
compat.c
- new file, with backwards-compatibility function definitions
Makefile.in,shlib/Makefile.in
- make sure that compat.o/compat.so are built and linked apppropriately
support/shobj-conf
- picked up bash version, which means that shared libs built on
linux and BSD/OS 4.x will have an soname that does not include
the minor version number
11/13
-----
examples/rlfe.c
- rlfe can perform filename completion for relative pathnames in the
inferior process's context if the OS supports /proc/PID/cwd (linux
does it OK, Solaris is slightly warped, none of the BSDs have it)
11/17/2000
----------
[readline-4.2-alpha released]
11/27
-----
Makefile.in,shlib/Makefile.in
- added dependencies for rltypedefs.h
shlib/Makefile.in
- changed dependencies on histlib.h to $(topdir)/histlib.h
1/22
----
configure.in
- changed release version to 4.2-beta
2/2
---
examples/Makefile.in
- build histexamp as part of the examples
2/5
---
doc/Makefile.in
- don't remove the dvi, postscript, html, info, and text `objects'
on a `make distclean', only on a `make maintainer-clean'
3/6
---
doc/history.{0,3}, doc/history_3.ps
- new manual page for history library
doc/Makefile.in
- rules to install and uninstall history.3 in ${man3dir}
- rules to build history.0 and history_3.ps
4/2
---
configure.in
- changed LIBVERSION to `4.2'
4/5
---
[readline-4.2 frozen]
4/9
---
[readline-4.2 released]
5/2
---
Makefile.in,{doc,examples,shlib}/Makefile.in
- added support for DESTDIR installation root prefix, to support
building packages
doc/Makefile.in
- add an info `dir' file entry for rluserman.info on `make install'
- change man1ext to `.1' and man3ext to `.3'
- install man pages with a $(man3ext) extension in the target directory
- add support for installing html documentation if `htmldir' has a
value
Makefile.in
- on `make install', install from the `shlib' directory, too
- on `make uninstall', uninstall in the `doc' and `shlib'
subdirectories, too
support/shlib-install
- add `freebsdelf*', `freebsdaout*', Hurd, `sysv4*', `sysv5*', `dgux*'
targets for symlink creation
5/7
---
configure.in, config.h.in
- check for , define HAVE_LIMITS_H if found
5/8
---
aclocal.m4
- pick up change to BASH_CHECK_LIB_TERMCAP that adds check for
libtinfo (termcap-specific portion of ncurses-5.2)
5/9
---
configure.in
- call AC_C_CONST to find out whether or not the compiler supports
`const'
config.h.in
- placeholder for `const' define, if any
5/10
----
configure.in
- fix AC_CHECK_PROG(ar, ...) test to specify right value for the
case where ar is not found; should produce a better error message
5/14
----
configure.in,config.h.in
- check for vsnprintf, define HAVE_VSNPRINTF if found
5/21
----
configure.in, config.h.in
- add checks for size_t, ssize_t
5/30
----
configure.in
- update autoconf to version 2.50, use in AC_PREREQ
- changed AC_INIT to new flavor
- added AC_CONFIG_SRCDIR
- AC_CONFIG_HEADER -> AC_CONFIG_HEADERS
- call AC_C_PROTOTYPES
- AC_RETSIGTYPE -> AC_TYPE_SIGNAL
8/22
----
configure.in
- updated the version number to 4.2a
Makefile.in,shlib/Makefile.in
- make sure tilde.o is built -DREADLINE_LIBRARY when being built as
part of the standalone library, so it picks up the right include
files
8/23
----
support/shlib-install
- support for Darwin/MacOS X shared library installation
9/24
----
examples/readlinebuf.h
- a new file, a C++ streambuf interface that uses readline for I/O.
Donated by Dimitris Vyzovitis
10/9
----
configure.in
- replaced call to BASH_HAVE_TIOCGWINSZ with AC_HEADER_TIOCGWINSZ
[readline-4.2a-beta1 frozen]
10/15
-----
configure.in, config.h.in
- check for , define HAVE_MEMORY_H if found
- check for , define HAVE_STRINGS_H if found
10/18
-----
configure.in, config.h.in
- check for isascii, define HAVE_ISASCII if found
configure.in
- changed the macro names from bash as appropriate:
BASH_SIGNAL_CHECK -> BASH_SYS_SIGNAL_VINTAGE
BASH_REINSTALL_SIGHANDLERS -> BASH_SYS_REINSTALL_SIGHANDLERS
BASH_MISC_SPEED_T -> BASH_CHECK_SPEED_T
10/22
-----
configure.in
- check for isxdigit with AC_CHECK_FUNCS
config.h.in
- new define for HAVE_ISXDIGIT
10/29
-----
configure.in, config.h.in
- check for strpbrk with AC_CHECK_FUNCS, define HAVE_STRPBRK if found
11/1
----
Makefile.in
- make sure DESTDIR is passed to install and uninstall makes in
subdirectories
- when saving old copies of installed libraries, make sure we use
DESTDIR for the old installation tree
[readline-4.2a-rc1 frozen]
11/2
----
Makefile.in, shlib/Makefile.in
- don't put -I$(includedir) into CFLAGS
11/15
-----
[readline-4.2a released]
11/20
-----
examples/rlcat.c
- new file
examples/Makefile.in
- changes for rlcat
11/28
-----
configure.in
- default TERMCAP_LIB to -lcurses if $prefer_curses == yes (as when
--with-curses is supplied)
examples/Makefile.in
- substitute @LDFLAGS@ in LDFLAGS assignment
11/29
-----
config.h.in
- add necessary defines for multibyte include files and functions
- add code to define HANDLE_MULTIBYTE if prerequisites are met
configure.in
- call BASH_CHECK_MULTIBYTE
12/14
-----
config.h.in
- add #undef PROTOTYPES, filled in by AC_C_PROTOTYPES
12/17
-----
config.h.in
- moved HANDLE_MULTIBYTE code to rlmbutil.h
rlmbutil.h, mbutil.c
- new files
Makefile.in, shlib/Makefile.in
- added rules for mbutil.c
12/20
-----
configure.in
- added --enable-shared, --enable-static options to configure to
say which libraries are built by default (both default to yes)
- if SHLIB_STATUS == 'unsupported', turn off default shared library
building
- substitute new STATIC_TARGET, SHARED_TARGET, STATIC_INSTALL_TARGET,
and SHARED_INSTALL_TARGET
Makefile.in
- `all' target now depends on (substituted) @STATIC_TARGET@ and
@SHARED_TARGET@
- `install' target now depends on (substituted) @STATIC_INSTALL_TARGET@
and @SHARED_INSTALL_TARGET@
INSTALL, README
- updated with new info about --enable-shared and --enable-static
1/10/2002
---------
configure.in
- bumped the library version number to 4.3
1/24
----
Makefile.in,shlib/Makefile.in
- changes for new file, text.c, with character and text handling
functions from readline.c
2/20
----
{configure.config.h}.in
- call AC_C_CHAR_UNSIGNED, define __CHAR_UNSIGNED__ if chars are
unsigned by default
5/20
----
doc/Makefile.in
- new maybe-clean target that removes the generated documentation if
the build directory differs from the source directory
- distclean target now depends on maybe-clean
7/17
----
[readline-4.3 released]
7/18
----
shlib/Makefile.in
- fix bad dependency: text.so: terminal.c, make it depend on text.c
8/7
---
support/shlib-install
- break `linux' out into its own stanza: it seems that linux
distributions are all moving to the following scheme:
libreadline.so.4.3 installed version
libreadline.so.4 -> libreadline.so.4.3 symlink
libreadline.so -> libreadline.so.4 symlink
10/29
-----
support/shlib-install
- change INSTALL_LINK[12] to use `&&' instead of `;' so it only
tries the link if the cd succeeds; put ${echo} in there, too
- use $LN instead of `ln -s' so it works on machines without symlinks
- change special linux stanza to use cd before ln also
- change to use $INSTALL_LINK1 and $INSTALL_LINK2 appropriately
instead of explicit commands in various stanzas
2/1
---
config.h.in
- add HAVE_MBRTOWC and HAVE_MBRLEN
- add NO_MULTIBYTE_SUPPORT for new configure argument
- add STDC_HEADERS
configure.in
- new argument --enable-multibyte (enabled by default), allows
multibyte support to be turned off even on systems that support it
- add check for ansi stdc headers with call to AC_HEADER_STDC
2/3
---
configure.in
- add call to BASH_FUNC_CTYPE_NONASCII
config.h.in
- add CTYPE_NON_ASCII
2/20
----
doc/manvers.texinfo
- renamed to version.texi to match other GNU software
- UPDATE-MONTH variable is now `UPDATED-MONTH'
doc/{hist,rlman,rluserman}.texinfo
- include version.texi
doc/{rltech,rluser,hstech,hsuser}.texi
- changed the suffix from `texinfo' to `texi'
doc/Makefile.in
- made appropriate changes for {{rl,hs}tech,{rl,hs}user}.texi
doc/{rlman,rluserman}.texinfo
- changed the suffix from `texinfo' to `texi'
doc/hist.texinfo
- renamed to history.texi to be more consistent
6/11
----
shlib/Makefile.in
- have configure substitute value of `@LDFLAGS@' into the assignment
to SHLIB_XLDFLAGS
6/16
----
configure.in
- readline and history libraries are now at version 5.0
8/18
----
support/shlib-install
- support for FreeBSD-gnu (from Robert Millan)
12/4
----
Makefile.in
- add variables for localedir and the PACKAGE_* variables, auto-set
by configure
12/9
----
Makefile.in
- use mkinstalldirs instead of mkdirs
4/22
----
Makefile.in
- separate doc install/uninstall out into two new targets:
install-doc and uninstall-doc
- make install-doc and uninstall-doc prerequisites of appropriate
install and uninstall targets
examples/rl-fgets.c
- new example from Harold Levy that wraps fgets replacement functions
that call readline in a shared library that can be interposed with
LD_PRELOAD
7/27
----
[readline-5.0 released]
11/15
-----
examples/rlfe/{ChangeLog,Makefile.in,README,config.h.in,configure,configure.in,extern.h,os.h,pty.c,rlfe.c,screen.h}
- new version of rlfe, rlfe-0.4, from Per Bothner; now a standalone
application
11/16
-----
shlib/Makefile.in
- substitute TERMCAP_LIB in from configure
configure.in
- if SHLIB_LIBS doesn't include a termcap library (curses, ncurses,
termcap, termlib), append the value of $TERMCAP_LIB to it
11/30
-----
configure.in
- take out change from 11/16; it doesn't work for some systems (e.g.,
SunOS 4.x and Solaris 2.6)
- add support for --enable-purify configure argument
- pass TERMCAP_LIB in environment when calling shobj-conf
examples/Makefile.in
- add support for building examples with purify
1/23/2005
---------
configure.in
- set BUILD_DIR to contain backslashes to escape any spaces in the
directory name -- this is what make will accept in targets and
prerequisites, so it's better than trying to use double quotes
2/25
----
configure.in
- change check for sys/ptem.h to include sys/stream.h if present, to
avoid the `present but cannot be compiled' messages on Solaris and
SVR4.2 (does anyone still use SVR4.2?)
5/7
---
configure.in
- add cross-compiling support from the bash configure.in, which cygwin
and mingw have apparently adopted
- add check for pwd.h, fcntl.h
- add checks for fcntl, kill system calls
- add checks for getpw{ent,nam,uid} C library functions
- pass a compile-time option through to Makefiles if cross-compiling
config.h.in
- add HAVE_PWD_H for , HAVE_FCNTL_H for
- add HAVE_FCNTL, HAVE_KILL for respective system calls
- add HAVE_GETPW{ENT,NAM,UID} for passwd functions
Makefile.in,shlib/Makefile.in
- @CROSS_COMPILE@ is substituted into DEFS (equal to -DCROSS_COMPILING
if bash is being cross-compiled)
8/2
---
examples/Makefile.in
- use $(READLINE_LIB) instead of -lreadline to get around MacOS X 10.4's
preference for (incompatible) shared libraries over static libraries
in the load path
8/11
----
support/shobj-conf
- new variable: SHLIB_LIBPREF, prefix for shared library name (defaults
to `lib'
- new variable: SHLIB_DLLVERSION, used on Cygwin to set the library
version number
- new variable: SHLIB_DOT, separator character between library name and
suffix and version information (defaults to `.')
- new stanza for cygwin to generate windows-compatible dll
support/shlib-install
- add new option `-b bindir' for systems like cygwin/windows that
require it
- new stanza for cygwin that installs a dll into $bindir and an implied
link library into $libdir
configure.in
- substitute new variables from shobj-conf
shlib/Makefile.in
- substitute bindir, SHLIB_DOT, SHLIB_LIBPREF, SHLIB_DLLVERSION from
configure
- pass `-b $(bindir)' to shlib-install for install and uninstall targets
- library names now use $SHLIB_LIBPREF and $SHLIB_DOT
INSTALL,README
- document new SHLIB_DOT, SHLIB_LIBPREF, and SHLIB_DLLVERSION variables
10/4
----
[readline-5.1-beta1 frozen]
12/1
----
configure.in
- changed release status to `release'
[readline-5.1 frozen]
12/9
----
[readline-5.1 released]
12/14
-----
examples/rlfe/Makefile.in
- add @LIBS@ to LIBS assignment to pick up extra libraries from
configure
1/3/2006
--------
support/shlib-install
- Install shared libraries with execute bit set on Linux
6/9
---
[readline-5.2-alpha frozen]
6/26
----
configure.in
- set CROSS_COMPILE to the empty string by default, so we don't inherit
a random value from the environment
7/8
---
[readline-5.2-alpha released]
[readline-5.2-beta released]
9/12
----
config.h.in
- add defines for wcscoll, iswctype, iswupper, iswlower, towupper,
towlower functions
- replace define for wctomb with one for wcrtomb
- add defines for wchar_t, wint_t, wctype_t types
10/11
-----
[readline-5.2 released]
11/9
----
examples/rlfe/{configure.in,Makefile.in,config.h.in,rlfe.c,pty.c}
- portability fixes from Mike Frysinger
11/21
-----
Makefile.in
- add `install-examples' and `uninstall-examples' targets
examples/Makefile.in
- add correct variables to build examples on Windows
- add appropriate rules to install and uninstall example sources in
$(datadir)/readline
11/27
-----
config.h.in
- move #undef of HAVE_STRCOLL out of config.h.in, since autoconf tries
to substitute it based on configure tests
4/27/2007
---------
examples/autoconf
- new directory with example autoconf macros to detect readline and
return information about the installed version
6/13
----
support/shlib-install
- changes to support AIX 5.x shared library installation
3/20/2008
---------
support/shlib-install
- add support for NetBSD and Interix shared library installation
4/22
----
support/wcwidth.c
- updated implementation from 2007-05
7/18
----
support/shlib-install
- support for mingw32, contributed by Carlo Bramix
8/4
---
configure.in
- changed to readline-6.0
8/18
----
support/config.{guess,sub}
- updated to newer versions from autoconf-2.62 distribution
3/5/2009
--------
support/shlib-install
- take a new -V host_vendor argument
- add ${host_vendor} to string tested in case statement for symlink
creation section
- add support for FreeBSD/gentoo, which uses Linux library naming
scheme
- change FreeBSD symlink rules, since FreeBSD 7+ has only ELF shared
libraries. DragonflyBSD rules are the same. Fix from Timothy
Redaelli
shlib/Makefile.in
- add definition of host_vendor, substituted by configure
- add -V host_vendor argument to all invocations of shlib-install.
Fix from Timothy Redaelli
3/10
----
configure.in
- add call to AC_SYS_LARGEFILE for readdir and largefile support on
Linux
config.h.in
- add _FILE_OFFSET_BITS define
4/19
----
Makefile.in
- add targets for making and installing documentation required by GNU
coding standards. Fix from Joseph Myers
posixselect.h
- pick up from bash. Inspired by Mike Frysinger
10/28
-----
support/shlib-install
- decrease the default version of FreeBSD that installs shared libraries
to 4.x. Advice from Peter Jeremy
12/18
-----
[readline-6.1-rc1 released]
12/23
-----
doc/Makefile.in
- make sure $(topdir) is not ".." before removing all of the formatted
documentation in `make distclean'. $(topdir) is set to `..' if
readline is being built in the source directory. Fixes problem
noticed by THOUMIN Damien
12/29
-----
[readline-6.1 frozen]
2/5/2010
--------
examples/Makefile.in
- make sure to install example C files using $(srcdir)/$$f in case
we're building outside the source directory. Bug report and fix
from Peter Breitenlohner
7/25
----
xfree.c
- new file with xfree() implementation, moved from xmalloc.c
12/28
-----
{examples,shlib}/Makefile.in
- Cygwin-based changes from Eric Blake
3/26/2011
---------
Makefile.in
- don't ignore failures when building, installing, or cleaning in
the shlib subdirectory. Sample patch from Mike Frysinger
shlib/Makefile.in
- split the install and uninstall targets into install-supported and
install-unsupported targets that depend on the value of
SHLIB_STATUS
4/2
---
{,shlib}/Makefile.in
- add dependency for callback.o/callback.so on xmalloc.h. From
Jan Kratochvil
{,doc,examples,shlib}/Makefile.in
- fix typo: htm target should be html. From Jan Kratochvil
- remove `.' from VPATH. From Jan Kratochvil
examples/rlfe/configure.in
- quote AC_PROGRAM_SOURCE. From Jan Kratochvil
5/17
----
config.h.in
- WCWIDTH_BROKEN: new define, picked up from bash, defined on systems
where wcwidth returns 1 for Unicode combining characters
11/28
-----
support/shlib-install
- make sure solaris2 systems make the installed shared library
executable. ldd warns about it otherwise. Bug and fix from
Tim Mooney
examples/hist_erasedups.c
- new example program, shows how to erase duplicates from the history
list
examples/hist_purgecmd.c
- new example program, shows how to remove all entries matching a
string or pattern from the history list
1/12/2012
---------
colors.[ch],parse-colors.[ch]}
- new files, part of color infrastructure support
Makefile.in,shlib/Makefile.in
- arrange to have colors.o and parse-colors.o added to library
(static and shared versions)
{configure,config.h}.in
- check for stdbool.h, define HAVE_STDBOOL_H if found
rldefs.h
- COLOR_SUPPORT: if defined, compile in colors.c and parse-colors.c
for color support
1/18
----
{configure,config.h}.in
- new check: check for AUDIT_USER_TTY defined in ,
define HAVE_DECL_AUDIT_USER_TTY if both are found
8/7
---
configure.in
- AC_CANONICAL_BUILD: call to set the build_xxx variables
- use $build_os instead of $host_os to decide when DJGPP should run
`pwd.exe' to figure out the build directory. Report and fix from
Yao Qi
8/29
----
configure.ac
- new name for configure.in
MANIFEST,Makefile.in
- configure.in -> configure.ac
1/5/2013
--------
configure.ac
- move version number up to 6.3
1/31
----
configure.ac
- use AC_CHECK_TOOL instead of AC_CHECK_PROG to check for ar, since it
will find $host-prefixed versions of utilities. Report and fix from
Mike Frysinger
3/4
---
Makefile.in
- PACKAGE_TARNAME, docdir: new variables substituted by autoconf
- OTHER_DOCS,OTHER_INSTALLED_DOCS: new variables with auxiliary
documentation files to be installed into $(docdir)
- install: add new rule to install $(OTHER_DOCS)
- uninstall: add new rule to uninstall $(docdir)/$(OTHER_INSTALLED_DOCS)
4/29
----
Makefile.in
- installdirs: make sure to create $(DESTDIR)$(docdir). Report from
1/27/2014
---------
Makefile.in
- install-examples: should not depend on `shared', since the examples
themselves are not built using shared libraries. Report from
support/shobj-conf
- [from bash] darwin: changed the install_name embedded into the
shared library to contain only the major version number, not the
minor one. The idea is that the minor versions should all be API/ABI
compatible, and it is better to link automatically with the latest
one. Idea from Max Horn
2/26/2014
---------
[readline-6.3 released]
3/14
----
shlib/Makefile.in
- fix typo in dependency list for vi_mode.so: it should not depend on
just $(topdir). Report and fix from Natanael Copa