summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-07-23 11:50:53 +0000
committertjr <tjr@FreeBSD.org>2002-07-23 11:50:53 +0000
commitf9fd5faa32d9a7f2b556f323090c9b6f2489ab61 (patch)
tree30084fb3c5e19f62d3064bce8b107128e70ca226 /bin
parent1419e21345a70f2237a1608b56aaa25d89e8c496 (diff)
downloadFreeBSD-src-f9fd5faa32d9a7f2b556f323090c9b6f2489ab61.zip
FreeBSD-src-f9fd5faa32d9a7f2b556f323090c9b6f2489ab61.tar.gz
Add a `bind' builtin command, which is simply a wrapper around libedit's
builtin command of the same name. This allows the key bindings for the shell's line editor to be changed. MFC after: 2 weeks
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/builtins.def1
-rw-r--r--bin/sh/histedit.c18
-rw-r--r--bin/sh/myhistedit.h1
-rw-r--r--bin/sh/sh.14
4 files changed, 24 insertions, 0 deletions
diff --git a/bin/sh/builtins.def b/bin/sh/builtins.def
index 2410425..233e25f 100644
--- a/bin/sh/builtins.def
+++ b/bin/sh/builtins.def
@@ -92,3 +92,4 @@ waitcmd wait
aliascmd alias
ulimitcmd ulimit
testcmd test [
+bindcmd bind
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 37a10bf..ae39c0b 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -480,6 +480,16 @@ str_to_event(char *str, int last)
}
return (he.num);
}
+
+int
+bindcmd(int argc, char **argv)
+{
+
+ if (el == NULL)
+ error("line editing is disabled");
+ return (el_parse(el, argc, argv));
+}
+
#else
#include "error.h"
@@ -491,4 +501,12 @@ histcmd(int argc, char **argv)
/*NOTREACHED*/
return (0);
}
+
+int
+bindcmd(int argc, char **argv)
+{
+
+ error("not compiled with line editing support");
+ return (0);
+}
#endif
diff --git a/bin/sh/myhistedit.h b/bin/sh/myhistedit.h
index 77817c7..644b2c0 100644
--- a/bin/sh/myhistedit.h
+++ b/bin/sh/myhistedit.h
@@ -45,4 +45,5 @@ void sethistsize(const char *);
int histcmd(int, char **);
int not_fcnumber(char *);
int str_to_event(char *, int);
+int bindcmd(int, char **);
diff --git a/bin/sh/sh.1 b/bin/sh/sh.1
index 369b5f3..38410d0 100644
--- a/bin/sh/sh.1
+++ b/bin/sh/sh.1
@@ -1279,6 +1279,10 @@ Execute the specified builtin command,
.Ar cmd .
This is useful when the user wishes to override a shell function
with the same name as a builtin command.
+.It Ic bind Oo Fl aeklrsv Oc Oo Ar key Oo Ar command Oc Oc
+List or alter key bindings for the line editor.
+This command is documented in
+.Xr editrc 5 .
.It Ic cd Oo Fl LP Oc Op Ar directory
Switch to the specified
.Ar directory ,
OpenPOWER on IntegriCloud