Imported from ../bash-2.04.tar.gz.

This commit is contained in:
Jari Aalto 2000-03-17 21:46:59 +00:00
commit bb70624e96
387 changed files with 28522 additions and 9334 deletions

View file

@ -7,7 +7,7 @@ This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
@ -17,7 +17,7 @@ for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES bind.c
@ -26,7 +26,7 @@ $PRODUCES bind.c
$BUILTIN bind
$DEPENDS_ON READLINE
$FUNCTION bind_builtin
$SHORT_DOC bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [keyseq:readline-function]
$SHORT_DOC bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function]
Bind a key sequence to a Readline function, or to a macro. The
syntax is equivalent to that found in ~/.inputrc, but must be
passed as a single argument: bind '"\C-x\C-r": re-read-init-file'.
@ -40,6 +40,8 @@ Arguments we accept:
-p List functions and bindings in a form that can be
reused as input.
-r keyseq Remove the binding for KEYSEQ.
-x keyseq:shell-command Cause SHELL-COMMAND to be executed when KEYSEQ
is entered.
-f filename Read key bindings from FILENAME.
-q function-name Query about which keys invoke the named function.
-u function-name Unbind all keys which are bound to the named function.
@ -93,6 +95,7 @@ extern int no_line_editing;
#define SFLAG 0x0200
#define SSFLAG 0x0400
#define UFLAG 0x0800
#define XFLAG 0x1000
int
bind_builtin (list)
@ -102,7 +105,7 @@ bind_builtin (list)
FILE *old_rl_outstream;
Keymap kmap, saved_keymap;
int flags, opt;
char *initfile, *map_name, *fun_name, *unbind_name, *remove_seq;
char *initfile, *map_name, *fun_name, *unbind_name, *remove_seq, *cmd_seq;
if (no_line_editing)
return (EXECUTION_FAILURE);
@ -122,7 +125,7 @@ bind_builtin (list)
rl_outstream = stdout;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "lvpVPsSf:q:u:m:r:")) != EOF)
while ((opt = internal_getopt (list, "lvpVPsSf:q:u:m:r:x:")) != EOF)
{
switch (opt)
{
@ -167,6 +170,10 @@ bind_builtin (list)
case 'S':
flags |= SSFLAG;
break;
case 'x':
flags |= XFLAG;
cmd_seq = list_optarg;
break;
default:
builtin_usage ();
BIND_RETURN (EX_USAGE);
@ -242,6 +249,9 @@ bind_builtin (list)
}
}
if (flags & XFLAG)
return_code = bind_keyseq_to_unix_command (cmd_seq);
/* Process the rest of the arguments as binding specifications. */
while (list)
{