aboutsummaryrefslogtreecommitdiff
path: root/gnu/lib/libreadline/examples
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1994-05-09 20:36:08 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1994-05-09 20:36:08 +0000
commitce4acff5b6111059cbb384355626bffe3112f432 (patch)
tree7d4aef8f293a311c0fa8931aa76f7c175c67f392 /gnu/lib/libreadline/examples
parent9b39195f897feda3df970a60ee9ebee43c2d102b (diff)
Notes
Diffstat (limited to 'gnu/lib/libreadline/examples')
-rw-r--r--gnu/lib/libreadline/examples/Inputrc58
-rw-r--r--gnu/lib/libreadline/examples/fileman.c53
2 files changed, 111 insertions, 0 deletions
diff --git a/gnu/lib/libreadline/examples/Inputrc b/gnu/lib/libreadline/examples/Inputrc
new file mode 100644
index 000000000000..db9510dd7b64
--- /dev/null
+++ b/gnu/lib/libreadline/examples/Inputrc
@@ -0,0 +1,58 @@
+# My ~/.inputrc file is in -*- text -*- for easy editing with Emacs.
+#
+# Notice the various bindings which are conditionalized depending
+# on which program is running, or what terminal is active.
+#
+
+# In all programs, all terminals, make sure this is bound.
+"\C-x\C-r": re-read-init-file
+
+# Hp terminals (and some others) have ugly default behaviour for C-h.
+"\C-h": backward-delete-char
+"\e\C-h": backward-kill-word
+"\C-xd": dump-functions
+
+# In xterm windows, make the arrow keys do the right thing.
+$if TERM=xterm
+"\e[A": previous-history
+"\e[B": next-history
+"\e[C": forward-char
+"\e[D": backward-char
+
+# Under Xterm in Bash, we bind local Function keys to do something useful.
+$if Bash
+"\e[11~": "Function Key 1"
+"\e[12~": "Function Key 2"
+"\e[13~": "Function Key 3"
+"\e[14~": "Function Key 4"
+"\e[15~": "Function Key 5"
+
+# I know the following escape sequence numbers are 1 greater than
+# the function key. Don't ask me why, I didn't design the xterm terminal.
+"\e[17~": "Function Key 6"
+"\e[18~": "Function Key 7"
+"\e[19~": "Function Key 8"
+"\e[20~": "Function Key 9"
+"\e[21~": "Function Key 10"
+$endif
+$endif
+
+# For Bash, all terminals, add some Bash specific hacks.
+$if Bash
+"\C-xv": show-bash-version
+"\C-x\C-e": shell-expand-line
+
+# Here is one for editing my path.
+"\C-xp": "$PATH\C-x\C-e\C-e\"\C-aPATH=\":\C-b"
+
+# Make C-x r read my mail in emacs.
+# "\C-xr": "emacs -f rmail\C-j"
+$endif
+
+# For FTP, different hacks:
+$if Ftp
+"\C-xg": "get \M-?"
+"\C-xt": "put \M-?"
+$endif
+
+" ": self-insert
diff --git a/gnu/lib/libreadline/examples/fileman.c b/gnu/lib/libreadline/examples/fileman.c
index 92f3942fd66f..0adc2a19e2f8 100644
--- a/gnu/lib/libreadline/examples/fileman.c
+++ b/gnu/lib/libreadline/examples/fileman.c
@@ -244,7 +244,14 @@ static char syscom[1024];
com_list (arg)
char *arg;
{
+ if (!arg)
+ arg = "*";
+
+#ifdef __GO32__
+ sprintf (syscom, "ls -lp %s", arg);
+#else
sprintf (syscom, "ls -FClg %s", arg);
+#endif
system (syscom);
}
@@ -390,3 +397,49 @@ valid_argument (caller, arg)
* compile-command: "cc -g -I../.. -L.. -o fileman fileman.c -lreadline -ltermcap"
* end:
*/
+
+#ifdef __GO32__
+/* **************************************************************** */
+/* */
+/* xmalloc and xrealloc () */
+/* */
+/* **************************************************************** */
+
+static void memory_error_and_abort ();
+
+char *
+xmalloc (bytes)
+ int bytes;
+{
+ char *temp = (char *)malloc (bytes);
+
+ if (!temp)
+ memory_error_and_abort ();
+ return (temp);
+}
+
+char *
+xrealloc (pointer, bytes)
+ char *pointer;
+ int bytes;
+{
+ char *temp;
+
+ if (!pointer)
+ temp = (char *)xmalloc (bytes);
+ else
+ temp = (char *)realloc (pointer, bytes);
+
+ if (!temp)
+ memory_error_and_abort ();
+
+ return (temp);
+}
+
+static void
+memory_error_and_abort ()
+{
+ fprintf (stderr, "xmalloc: Out of virtual memory!\n");
+ abort ();
+}
+#endif