mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-10 12:10:35 +02:00
commit bash-20041014 snapshot
This commit is contained in:
@@ -1355,6 +1355,7 @@ static struct {
|
||||
int *value;
|
||||
int flags;
|
||||
} boolean_varlist [] = {
|
||||
{ "bind-tty-special-chars", &_rl_bind_stty_chars, 0 },
|
||||
{ "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
|
||||
{ "byte-oriented", &rl_byte_oriented, 0 },
|
||||
{ "completion-ignore-case", &_rl_completion_case_fold, 0 },
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
.\"
|
||||
.\" Last Change: Wed Jan 28 15:43:53 EST 2004
|
||||
.\"
|
||||
.TH READLINE 3 "2004 January 28" "GNU Readline 5.0"
|
||||
.TH READLINE 3 "2004 October 15" "GNU Readline 5.0"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -338,6 +338,11 @@ If set to \fBnone\fP, readline never rings the bell. If set to
|
||||
\fBvisible\fP, readline uses a visible bell if one is available.
|
||||
If set to \fBaudible\fP, readline attempts to ring the terminal's bell.
|
||||
.TP
|
||||
.B bind\-tty\-special\-chars (On)
|
||||
If set to \fBOn\fP, readline attempts to bind the control characters
|
||||
treated specially by the kernel's terminal driver to their readline
|
||||
equivalents.
|
||||
.TP
|
||||
.B comment\-begin (``#'')
|
||||
The string that is inserted in \fBvi\fP mode when the
|
||||
.B insert\-comment
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -284,6 +284,8 @@ negative argument.
|
||||
|
||||
A command function should return 0 if its action completes successfully,
|
||||
and a non-zero value if some error occurs.
|
||||
This is the convention obeyed by all of the builtin Readline bindable
|
||||
command functions.
|
||||
|
||||
@node Readline Variables
|
||||
@section Readline Variables
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -404,6 +404,12 @@ If set to @samp{none}, Readline never rings the bell. If set to
|
||||
If set to @samp{audible} (the default), Readline attempts to ring
|
||||
the terminal's bell.
|
||||
|
||||
@item bind-tty-special-chars
|
||||
@vinded bind-tty-special-chars
|
||||
If set to @samp{on}, Readline attempts to bind the control characters
|
||||
treated specially by the kernel's terminal driver to their Readline
|
||||
equivalents.
|
||||
|
||||
@item comment-begin
|
||||
@vindex comment-begin
|
||||
The string to insert at the beginning of the line when the
|
||||
|
||||
@@ -1693,6 +1693,12 @@ shell functions specified with @option{-F}.
|
||||
@item nospace
|
||||
Tell Readline not to append a space (the default) to words completed at
|
||||
the end of the line.
|
||||
|
||||
@item plusdirs
|
||||
After any matches defined by the compspec are generated,
|
||||
directory name completion is attempted and any
|
||||
matches are added to the results of the other actions.
|
||||
|
||||
@end table
|
||||
|
||||
@item -A @var{action}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2004 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 5.0
|
||||
@set VERSION 5.0
|
||||
@set UPDATED 28 January 2004
|
||||
@set UPDATED-MONTH January 2004
|
||||
@set EDITION 5.1-devel
|
||||
@set VERSION 5.1-devel
|
||||
@set UPDATED 16 October 2004
|
||||
@set UPDATED-MONTH October 2004
|
||||
|
||||
@set LASTCHANGE Wed Jan 28 15:46:54 EST 2004
|
||||
@set LASTCHANGE Sat Oct 16 19:08:23 EDT 2004
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2004 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 5.1-devel
|
||||
@set VERSION 5.1-devel
|
||||
@set UPDATED 15 October 2004
|
||||
@set UPDATED-MONTH October 2004
|
||||
|
||||
@set LASTCHANGE Fri Oct 15 14:52:31 EDT 2004
|
||||
+11
-3
@@ -251,6 +251,10 @@ int _rl_convert_meta_chars_to_ascii = 1;
|
||||
rather than as a meta-prefixed escape sequence. */
|
||||
int _rl_output_meta_chars = 0;
|
||||
|
||||
/* Non-zero means to look at the termios special characters and bind
|
||||
them to equivalent readline functions at startup. */
|
||||
int _rl_bind_stty_chars = 1;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Top Level Functions */
|
||||
@@ -863,7 +867,8 @@ readline_initialize_everything ()
|
||||
static void
|
||||
readline_default_bindings ()
|
||||
{
|
||||
rl_tty_set_default_bindings (_rl_keymap);
|
||||
if (_rl_bind_stty_chars)
|
||||
rl_tty_set_default_bindings (_rl_keymap);
|
||||
}
|
||||
|
||||
/* Reset the default bindings for the terminal special characters we're
|
||||
@@ -871,8 +876,11 @@ readline_default_bindings ()
|
||||
static void
|
||||
reset_default_bindings ()
|
||||
{
|
||||
rl_tty_unset_default_bindings (_rl_keymap);
|
||||
rl_tty_set_default_bindings (_rl_keymap);
|
||||
if (_rl_bind_stty_chars)
|
||||
{
|
||||
rl_tty_unset_default_bindings (_rl_keymap);
|
||||
rl_tty_set_default_bindings (_rl_keymap);
|
||||
}
|
||||
}
|
||||
|
||||
/* Bind some common arrow key sequences in MAP. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -250,6 +250,7 @@ extern int _rl_bell_preference;
|
||||
extern int _rl_meta_flag;
|
||||
extern int _rl_convert_meta_chars_to_ascii;
|
||||
extern int _rl_output_meta_chars;
|
||||
extern int _rl_bind_stty_chars;
|
||||
extern char *_rl_comment_begin;
|
||||
extern unsigned char _rl_parsing_conditionalized_out;
|
||||
extern Keymap _rl_keymap;
|
||||
|
||||
@@ -657,10 +657,12 @@ rl_prep_terminal (meta_flag)
|
||||
|
||||
otio = tio;
|
||||
|
||||
rl_tty_unset_default_bindings (_rl_keymap);
|
||||
if (_rl_bind_stty_chars)
|
||||
rl_tty_unset_default_bindings (_rl_keymap);
|
||||
save_tty_chars (&otio);
|
||||
RL_SETSTATE(RL_STATE_TTYCSAVED);
|
||||
_rl_bind_tty_special_chars (_rl_keymap, tio);
|
||||
if (_rl_bind_stty_chars)
|
||||
_rl_bind_tty_special_chars (_rl_keymap, tio);
|
||||
|
||||
prepare_terminal_settings (meta_flag, otio, &tio);
|
||||
|
||||
|
||||
+12
-12
@@ -122,16 +122,7 @@ sh_set_lines_and_columns (lines, cols)
|
||||
{
|
||||
char *b;
|
||||
|
||||
#if defined (HAVE_PUTENV)
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
|
||||
sprintf (b, "LINES=%d", lines);
|
||||
putenv (b);
|
||||
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
|
||||
sprintf (b, "COLUMNS=%d", cols);
|
||||
putenv (b);
|
||||
#else /* !HAVE_PUTENV */
|
||||
# if defined (HAVE_SETENV)
|
||||
#if defined (HAVE_SETENV)
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
|
||||
sprintf (b, "%d", lines);
|
||||
setenv ("LINES", b, 1);
|
||||
@@ -141,8 +132,17 @@ sh_set_lines_and_columns (lines, cols)
|
||||
sprintf (b, "%d", cols);
|
||||
setenv ("COLUMNS", b, 1);
|
||||
free (b);
|
||||
# endif /* HAVE_SETENV */
|
||||
#endif /* !HAVE_PUTENV */
|
||||
#else /* !HAVE_SETENV */
|
||||
# if defined (HAVE_PUTENV)
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
|
||||
sprintf (b, "LINES=%d", lines);
|
||||
putenv (b);
|
||||
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
|
||||
sprintf (b, "COLUMNS=%d", cols);
|
||||
putenv (b);
|
||||
# endif /* HAVE_PUTENV */
|
||||
#endif /* !HAVE_SETENV */
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
/* shell.c -- readline utility functions that are normally provided by
|
||||
bash when readline is linked as part of the shell. */
|
||||
|
||||
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if defined (HAVE_LIMITS_H)
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "rlstdc.h"
|
||||
#include "rlshell.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
extern struct passwd *getpwuid PARAMS((uid_t));
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* Nonzero if the integer type T is signed. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
|
||||
/* Bound on length of the string representing an integer value of type T.
|
||||
Subtract one for the sign bit if T is signed;
|
||||
302 / 1000 is log10 (2) rounded up;
|
||||
add one for integer division truncation;
|
||||
add one more for a minus sign if t is signed. */
|
||||
#define INT_STRLEN_BOUND(t) \
|
||||
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
|
||||
+ 1 + TYPE_SIGNED (t))
|
||||
|
||||
/* All of these functions are resolved from bash if we are linking readline
|
||||
as part of bash. */
|
||||
|
||||
/* Does shell-like quoting using single quotes. */
|
||||
char *
|
||||
sh_single_quote (string)
|
||||
char *string;
|
||||
{
|
||||
register int c;
|
||||
char *result, *r, *s;
|
||||
|
||||
result = (char *)xmalloc (3 + (4 * strlen (string)));
|
||||
r = result;
|
||||
*r++ = '\'';
|
||||
|
||||
for (s = string; s && (c = *s); s++)
|
||||
{
|
||||
*r++ = c;
|
||||
|
||||
if (c == '\'')
|
||||
{
|
||||
*r++ = '\\'; /* insert escaped single quote */
|
||||
*r++ = '\'';
|
||||
*r++ = '\''; /* start new quoted string */
|
||||
}
|
||||
}
|
||||
|
||||
*r++ = '\'';
|
||||
*r = '\0';
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Set the environment variables LINES and COLUMNS to lines and cols,
|
||||
respectively. */
|
||||
void
|
||||
sh_set_lines_and_columns (lines, cols)
|
||||
int lines, cols;
|
||||
{
|
||||
char *b;
|
||||
|
||||
#if defined (HAVE_PUTENV)
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
|
||||
sprintf (b, "LINES=%d", lines);
|
||||
putenv (b);
|
||||
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
|
||||
sprintf (b, "COLUMNS=%d", cols);
|
||||
putenv (b);
|
||||
#else /* !HAVE_PUTENV */
|
||||
# if defined (HAVE_SETENV)
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
|
||||
sprintf (b, "%d", lines);
|
||||
setenv ("LINES", b, 1);
|
||||
free (b);
|
||||
|
||||
b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
|
||||
sprintf (b, "%d", cols);
|
||||
setenv ("COLUMNS", b, 1);
|
||||
free (b);
|
||||
# endif /* HAVE_SETENV */
|
||||
#endif /* !HAVE_PUTENV */
|
||||
}
|
||||
|
||||
char *
|
||||
sh_get_env_value (varname)
|
||||
const char *varname;
|
||||
{
|
||||
return ((char *)getenv (varname));
|
||||
}
|
||||
|
||||
char *
|
||||
sh_get_home_dir ()
|
||||
{
|
||||
char *home_dir;
|
||||
struct passwd *entry;
|
||||
|
||||
home_dir = (char *)NULL;
|
||||
entry = getpwuid (getuid ());
|
||||
if (entry)
|
||||
home_dir = entry->pw_dir;
|
||||
return (home_dir);
|
||||
}
|
||||
|
||||
#if !defined (O_NDELAY)
|
||||
# if defined (FNDELAY)
|
||||
# define O_NDELAY FNDELAY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int
|
||||
sh_unset_nodelay_mode (fd)
|
||||
int fd;
|
||||
{
|
||||
int flags, bflags;
|
||||
|
||||
if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
|
||||
return -1;
|
||||
|
||||
bflags = 0;
|
||||
|
||||
#ifdef O_NONBLOCK
|
||||
bflags |= O_NONBLOCK;
|
||||
#endif
|
||||
|
||||
#ifdef O_NDELAY
|
||||
bflags |= O_NDELAY;
|
||||
#endif
|
||||
|
||||
if (flags & bflags)
|
||||
{
|
||||
flags &= ~bflags;
|
||||
return (fcntl (fd, F_SETFL, flags));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -20,6 +20,12 @@
|
||||
|
||||
#if !defined (HAVE_STRNLEN)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdc.h>
|
||||
|
||||
/* Find the length of S, but scan at most MAXLEN characters. If no '\0'
|
||||
|
||||
Reference in New Issue
Block a user